This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Nonlinear Mixedspace on overlapping domains

+2 votes

Hi,
I have the following Problem:
$$\sigma \Delta \phi_1 =0 \text{ on } \Omega_1$$

$$\sigma \Delta \phi_1 + f(\phi_1,\phi_2)=0 \text{ on }\Omega_2$$
$$\sigma \Delta \phi_2 - f(\phi_1,\phi_2)=0 \text{ on }\Omega_2$$
$$\sigma \Delta \phi_2 =0 \text{ on }\Omega_3$$
$$\sigma \Delta \phi_1 +f(\phi_1,\phi_2)=0\text{ on }\Omega_4$$
$$\sigma \Delta \phi_2 -f(\phi_1,\phi_2)=0 \text{ on }\Omega_4$$
$$\sigma \Delta \phi_1 =0 \text{ on }\Omega_5$$
$$\phi_1=0 \text{ o n} \partial\Omega_{31-1}$$
$$\frac{\partial \phi_1}{\partial n} = 0 \text{ on } \partial\Omega_{13}$$
$$\frac{\partial \phi_1}{\partial n} = 0 \text{ on } \partial\Omega_{23}$$
$$\frac{\partial \phi_1}{\partial n} = 0 \text{ on } \partial\Omega_{34}$$
$$\frac{\partial \phi_1}{\partial n} = 0 \text{ on } \partial\Omega_{35}$$

$$\frac{\partial \phi_2}{\partial n} = 0 \text{ on } \partial\Omega_{13}$$
$$\frac{\partial \phi_2}{\partial n} = 0 \text{ on } \partial\Omega_{12}$$
$$\frac{\partial \phi_2}{\partial n} = 0 \text{ on } \partial\Omega_{45}$$
$$\frac{\partial \phi_2}{\partial n} = 0 \text{ on } \partial\Omega_{35}$$

where f is a nonlinear function $\partial\Omega_{xy}$ is the interface between region x and y. $\phi_1=0 \text{ on } \partial\Omega_{31-1}$ means the dirichlet condition is definded on a subpart of $\Omega_{31}$ where the neuman condition does not hold.

I'am trying to solve F==0 with a newton solver. But it always gives -nan as residual at the second iteration and I have no idea why. (If I put in the exact solution with dummy parameters it computes correctly 0 as residual and stops.)

My UFL file is:

scalar = FiniteElement("DG", tetrahedron, 1)
scalarMixed = scalar*scalar
sigma= Coefficient(scalarMixed)
sigma_solid, sigma_electrolyte,  =split(sigma)

u = Coefficient(scalarMixed)
u_solid,u_electrolyte = split(u)
v = TestFunction(scalarMixed)
v_solid, v_electrolyte = split(v)

a_solid = sigma_solid*inner(grad(u_solid), grad(v_solid))
a_electrolyte = sigma_electrolyte*inner(grad(u_electrolyte), grad(v_electrolyte))

f = exp(u_solid-u_electrolyte-1)-exp(-(u_solid-u_electrolyte-1))

h = a_solid*dx((5,6,7,8))+ f*v_solid*dx(6)+f*v_solid*dx(7)+n("+")*v_solid("+")*dS((10,4))+n*v_solid*ds(1)
g = a_electrolyte*dx((6,7,9)) -f*v_electrolyte*dx(6)-f*v_electrolyte*dx(7)+n("+")*v_electrolyte("+")*dS((2,3,10,11))+n*v_electrolyte*ds(1)

F = h+g
u_n = TrialFunction(scalarMixed)
J = derivative(F,u,u_n)

f is shown in reduced form. The strange measure numbering arises from the gmsh numbering, which I wasnt able to change.

Regions 2,4 are porous media $\phi_1$ only exists on the solid phase, $\phi_2$ exists only on the liquid phase and f is the transfer function between the phases. Therefore adding up the equations in Region 2 or Region 4 to get rid of the non-linearity isn't valid.

closed with the note: Found a solution
asked Feb 21, 2017 by Weltenbrand FEniCS Novice (150 points)
closed Mar 6, 2017 by Weltenbrand

I have tried to solve the problem without any coupling of the domains, basically three poisson equations. It still gives the same problem with the nan.

With the snes+bicgstab I made it "work", meaning not going to -nan.

...