Hi everyone,
I am solving a nonlinear elasticity for an incompressible solid where I have enforced incompressibility constraint (det(F) = 1) using a Lagrange multiplier p. My code seems to be working and my displacement values seem to be correct. However, there is a problem in the last four lines of the code:
In order to check satisfaction of incompressibility I am visualizing det(F) using paraview. If I project my obtained result in a function space W with CG(1) I can see that det(F) = 1 every where which seems correct. However, If I change CG(2), I get det(F) ~ 7 everywhere.
Is there any problem with projection? Also, when I look at solution for p, I see strong fluctuations. anyone has any idea about this issue?
Thanks
Here is my code:
from dolfin import *
import numpy as np
parameters[âform_compilerâ][âquadrature_degreeâ] =3
parameters[âform_compilerâ][âcpp_optimizeâ] =True
parameters[âform_compilerâ][âoptimizeâ] =True
ffc_options = {âoptimizeâ: True,
âeliminate_zerosâ: True,
âprecompute_basis_constâ: True,
âprecompute_ip_constâ: True,
âquadrature_degreeâ: 2}
Lx = 100
Ly = 10
mesh = RectangleMesh.create([Point(0,0),Point(Lx,Ly)],[40,4],CellType.Type.quadrilateral)
V1 = VectorElement(âCGâ, mesh.ufl_cell(), 2) # displacement finite element
V2 = FiniteElement(âCGâ, mesh.ufl_cell(), 2) # lagrange multiplier
V = FunctionSpace(mesh, MixedElement([V1, V2]))
vtest = TestFunction(V)
u_t = Function(V)
(u,p)=split(u_t)
(v_u,v_p)=split(vtest)
left = CompiledSubDomain(ânear(x[0], side) && on_boundaryâ, side = 0.0)
bcl = DirichletBC(V.sub(0), Constant((0.,0.)), left)
bcs = [bcl]
mu = Constant(10**6)
B = Constant((0.0, -1.0))
d = u.geometric_dimension()
I = Identity(d) # Identity tensor
F = I + grad(u) # Deformation gradient
C = F.T*F # Right Cauchy-Green tensor
Ic = tr©
detF = det(F)
Sigma = mu * F - p * (inv(F).T)
Func = inner(grad(v_u),Sigma) * dx - dot(v_u,B)*dx + v_p * (detF - 1) *dx
solve(Func == 0, u_t, bcs,form_compiler_parameters=ffc_options,solver_parameters={ânewton_solverâ:{ârelaxation_parameterâ:0.5,ârelative_toleranceâ:1e-4 ,âmaximum_iterationsâ:50,} })#form_compiler_parameters=ffc_options)
(u,p)=u_t.split()
file = File(âdisplacement.pvdâ);
file << u;
file = File(âpressure.pvdâ);
file << p;
#Here CG = 1, gives correct results bu CG =2 does not!!!
W=FunctionSpace(mesh,âCGâ,2)# ???
projected_detF = project(det(I+grad(u)),W)
file = File(âdetF.pvdâ)
file << projected_detF