@bleyerj Hi, thankyou for the reply.
Sorry for not being clear. Yes, I am solving a 1d axial force problem.
To get started with modelling non linear constitutive laws, I took cube of the strain
I have actually tried it solving this way but from energy formulation following Defining non-linear constitutive laws
from dolfin import *
from dolfin.cpp.mesh import *
from mshr import *
#import matplotlib.pyplot as plt
import numpy as np
L = 40.
H = 10.
res = 100
base = Rectangle(Point(0,0), Point(L,H))
mesh = generate_mesh(base, res)
x = SpatialCoordinate(mesh)
V = VectorFunctionSpace(mesh, 'Lagrange', degree=1)
class Left_face(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and near(x[0],0)
class Right_face(SubDomain):
def inside(self, x, on_boundary):
return on_boundary and near(x[0],L)
left_face = Left_face()
right_face = Right_face()
u = Function(V, name='Displacement')
eps = sym(grad(u))
E_0 = 2e5
E_1 = E_0/100
sigma = (E_0*eps + (E_1*(eps**3)))
bc1 = DirichletBC(V, Constant((0,0)), sub_domains, 1)
#bc = DirichletBC(V, Constant((0.,0.)), left_face)
f1 = Constant((100,0))
du = TrialFunction(V)
u_ = TestFunction(V)
l = dot(f1,u)*ds(2)
# Energy:
energy = (0.5*inner(sigma,eps) - l)*dx
# Solve with homogeneous Dirichlet boundary conditions:
solve(derivative(energy,u)==0, u, bc1)
I was getting an error “Cannot take the power of a non-scalar expression .”
I guess I was not using ufl properly. I will do the appropriate changes and try the same again