### How to constructe a expression from an array.

39

views

0

Here is the problem. I want to solve a Poisson equation:

$\epsilon_0\Delta\phi=\rho\left(x,y\right)$`ϵ`_{0}Δ`ϕ`=`ρ`(`x`,`y`)

where ρ is the charge distribution. The charge distribution is given by a 2D array.

I want to solve this equation in this way:

```
rho = interpolateFunction(rhoArray) #Pseudo code
a = inner(nabla_grad(u), nabla_grad(v))*dx
L = f*v*dx
# Compute solution
u = Function(V)
solve(a == L, u, bc)
```

So how to implement the interpolateFunction?

Community: FEniCS Project

Please login to add an answer/comment or follow this question.