Hi
I’m trying to build a 2D Ogden problem in fenics, but I obtain a constant zero displacement field as solution. Thanks for the attention and for the answers.
from dolfin import *
from mshr import*
import matplotlib.pyplot as plt
parameters["form_compiler"]["cpp_optimize"] = True
ffc_options = {"optimize": True, \
"eliminate_zeros": True, \
"precompute_basis_const": True, \
"precompute_ip_const": True}
#Geometry
lpx=50
lpy=10
n_mesh=30
domain=Rectangle(Point(0,0),Point(lpx,lpy))
mesh=generate_mesh(domain, n_mesh)
U=VectorFunctionSpace(mesh,"P",2,2)
tollb=1E-13
def boundary_left(x): return abs(x[0]) < tollb
def boundary_right(x):return abs(x[0]-lpx) < tollb
# Material's parameter
alfa_1=1
mu_1=10
alfa_2=2
mu_2=10
D_1=10
u=Function(U)
Trial_u=TrialFunction(U)
Test_u=TestFunction(U)
F=grad(u)+Identity(2)
C=F.T*F
lambda_1=(tr(C)+ sqrt(tr(C)**2-4*det(C)))/2
lambda_2=(tr(C)- sqrt(tr(C)**2-4*det(C)))/2
t1=(mu_1/alfa_1)*((lambda_1**alfa_1)+(lambda_2**alfa_1)-2)
t2=(mu_2/alfa_2)*((lambda_1**alfa_2)+(lambda_2**alfa_2)-2)
t3=(1/D_1)*((det(C)-1)**2)
Energy=(t1+t2+t3)*dx
#Energy=Ogd_Energy(u)*dx
var1=derivative(Energy,u,Test_u)
var2=derivative(var1,u,Trial_u)
bc_left=DirichletBC(U, Constant((0.0,0.0)), boundary_left)
bc_right=DirichletBC(U,Constant((50.0,0.0)),boundary_right)
bc=[bc_left,bc_right]
problem = NonlinearVariationalProblem(var1,u,bc,J=var2)
solver = NonlinearVariationalSolver(problem)
plt.figure(0)
c = plot(u.sub(0), mode='color')
plt.colorbar(c)