# Some solver issue

Hai,

I am running simple elasticity problem. But facing the some solver issue leading to termination.

from dolfin import *

E=3300 #in mpa
nu=0.37
lmbda, mu = Enu/((1.0 + nu )(1.0-2.0nu)) , E/(2(1+nu))

# Create mesh and define function space

mesh = Mesh(‘plate.xml’)
V = VectorFunctionSpace(mesh, “CG”, 1)
WV=TensorFunctionSpace(mesh, “CG”, 2)

# Define boundary condition

tol = 1E-14

bot = CompiledSubDomain(“near(x[1],-20) && on_boundary”) #bottom fixed

top=CompiledSubDomain(“near(x[1],20) && on_boundary”) #bottom fixed

bc1 = DirichletBC(V, Constant((0, 0, 0)), bot)
#bc2= DirichletBC(V.sub(0), Constant((0)), top)
bc=[bc1]

boundary = MeshFunction(“size_t”, mesh,mesh.topology().dim() - 1)
boundary.set_all(0)
top.mark(boundary, 1)

ds = Measure(“ds”)(subdomain_data=boundary)

Trc=Constant((0,10,0))

def sigma(u):

# Define variational problem

u = TrialFunction(V)
v = TestFunction(V)

L = dot(v, Trc)*ds(1)

# Compute solution

u = Function(V)

solve(a==L,u,bc,solver_parameters={“linear_solver”: “mumps”})

m= File ("./ResultsDir-Von/fringeplot.pvd")
umap = File ("./ResultsDir-Von/u.pvd")

# Plot stress

sigmaT = project(sigma(u),WV)
sigma_max = 0.5*(sigmaT[0,0] + sigmaT[1,1]) + sqrt( (0.5*(sigmaT[0,0] - sigmaT[1,1]))**2 + (sigmaT[0,1])2 )
sigma_min = 0.5
(sigmaT[0,0] + sigmaT[1,1]) - sqrt( (0.5
(sigmaT[0,0] - sigmaT[1,1]))**2 + (sigmaT[0,1])**2 )
fringes = project((sigma_max-sigma_min))
m<<fringes
umap<<u

There are several things to consider here:

1. please format the code using 3x` encapsulation.
2. Does your code run in serial?
3. Does your code run on a built in mesh? (Use `BoxMesh`)
4. How big is your non built in mesh, and how much memory do you have available
1. I run in parallel `mpirun -n 4 python3 file.py`
2. The its not simple box mesh but plate with hole problem
4.

My point was does your code work when you run it in serial, or does it also throw an error?

Secondly, have you tried to run other problems (any of the dolfin demos) on your system?

i had run a 2d version of this same problem and it run and got results and just now i had run a demo of hyperelasticity also

As you can see here, you are running out of memory.
You are actually running out of memory in your projection of `sigmaT`, as you are not changing the default solver type which is `lu`, see: Out of memory error - #4 by dokken for more information.

In general, you should consider using an iterative solver to solve your linear elasticity problem as well, as direct solvers scale badly with the number of degrees of freedom.

1 Like

Changed solver and it worked. Thanks