Solving $div(A)=B$ for unkown $A$

49 Views Asked by At

I'm mechanical PhD student and I'm trying to solve the following problem discretized on the domain $(x,y)\in[0,1]^2$. Find $D$ such that

$$\frac{\partial}{\partial x}\left(\rho D\frac{\partial c}{\partial x}\right)+\frac{\partial}{\partial y}\left(\rho D\frac{\partial c}{\partial y}\right)=A$$ knowing $\rho$, $c$ and $A$ in each point of the domain. the boundary conditions are assumed to be periodic.

Initially, I discretized the equation and obtain a matrix for $D_i^j$ values ($D_i^j=D(x(i),y(j))$. But, the main problem comes out when the gradient of $c$ is null.