Hello,
I am trying to rewrite the hyperplasticity demo in terms of the second Piola–Kirchhoff stress sigma
(partial of phi wrt partial of Eps ) and the Lagrangian Green strain Eps = 0.5*(F.T*F-I)
,
referring to this post Minimizing the potential energy in a hyperelasticity problem - #2 by kamensky
The main term on the weak form here would be sigma
contraction with dEps
, which I computed with dEps = fe.derivative(Eps, u, u_test)
However, I got a error message after just one Newton iteration:
*** -------------------------------------------------------------------------
*** Error: Unable to successfully call PETSc function 'MatSetValuesLocal'.
*** Reason: PETSc error code is: 63 (Argument out of range).
*** Where: This error was encountered inside /Users/runner/miniforge3/conda-bld/fenics-pkgs_1719292218781/work/dolfin/la/PETScMatrix.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.1.0
*** Git changeset:
*** -------------------------------------------------------------------------
import fenics as fe
import ufl
def bottom(x, on_boundary):
return (on_boundary and fe.near(x[1], 0.0))
def top(x, on_boundary):
return (on_boundary and fe.near(x[1], 1.0))
E = 20.0e6
mu = 0.5*E
Bulk = E*mu / (3*(3*mu-E))
mesh = fe.UnitSquareMesh(5,5)
V = fe.VectorFunctionSpace(mesh, "CG", 1)
u_tr = fe.TrialFunction(V)
u_test = fe.TestFunction(V)
u = fe.Function(V)
bc = [ fe.DirichletBC(V, fe.Constant((0.0, 0.0)), bottom), fe.DirichletBC(V, fe.Constant((0.0, 0.1)), top)]
I = fe.Identity(2)
F = I + fe.grad(u)
C = F.T*F
J = fe.det(F)
## Gent
I_1 = fe.tr(C)
phi=( mu * (I_1 - 2 - 3 * fe.ln(J)) + Bulk * fe.ln(J) )
Eps = 0.5*(F.T*F-I)
dEps = fe.derivative(Eps, u, u_test)
Eps = fe.variable(Eps)
sigma = fe.derivative(phi, Eps)
Form = fe.inner(sigma, dEps) * fe.dx
Jac = fe.derivative(Form, u, u_tr)
problem = fe.NonlinearVariationalProblem(Form, u, bc, Jac)
solver = fe.NonlinearVariationalSolver(problem)
solver.solve()