You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use FEniCS installed in WSL of Windows 10.
The version is 2019.01.
Then I update demo files in the tutorial.
I delete the plot code because WSL cannot use it.
"""FEniCS tutorial demo program: Linear elastic problem. -div(sigma(u)) = fThe model is used to simulate an elastic beam clamped atits left end and deformed under its own weight."""from __future__ importprint_functionfromdolfinimport*fromuflimportnabla_divimportnumpyasnp# Scaled variablesL=1; W=0.2mu=1rho=1delta=W/Lgamma=0.4*delta**2beta=1.25lambda_=betag=gamma# Create mesh and define function spacemesh=BoxMesh(Point(0, 0, 0), Point(L, W, W), 10, 3, 3)
V=VectorFunctionSpace(mesh, 'P', 1)
# Define boundary conditiontol=1E-14defclamped_boundary(x, on_boundary):
returnon_boundaryandx[0] <tolbc=DirichletBC(V, Constant((0, 0, 0)), clamped_boundary)
# Define strain and stressdefepsilon(u):
return0.5*(nabla_grad(u) +nabla_grad(u).T)
#return sym(nabla_grad(u))defsigma(u):
returnlambda_*nabla_div(u)*Identity(d) +2*mu*epsilon(u)
# Define variational problemu=TrialFunction(V)
d=u.geometric_dimension() # space dimensionv=TestFunction(V)
f=Constant((0, 0, -rho*g))
T=Constant((0, 0, 0))
a=inner(sigma(u), epsilon(v))*dxL=dot(f, v)*dx+dot(T, v)*ds# Compute solutionu=Function(V)
solve(a==L, u, bc)
# Plot solution# plot(u, title='Displacement', mode='displacement')# Plot stresss=sigma(u) - (1./3)*tr(sigma(u))*Identity(d) # deviatoric stressvon_Mises=sqrt(3./2*inner(s, s))
V=FunctionSpace(mesh, 'P', 1)
von_Mises=project(von_Mises, V)
# plot(von_Mises, title='Stress intensity')# Compute magnitude of displacementu_magnitude=sqrt(dot(u, u))
u_magnitude=project(u_magnitude, V)
# plot(u_magnitude, 'Displacement magnitude')print('min/max u:',
u_magnitude.vector().get_local().min(),
u_magnitude.vector().get_local().max())
# Save solution to file in VTK formatFile('elasticity/displacement.pvd') <<uFile('elasticity/von_mises.pvd') <<von_MisesFile('elasticity/magnitude.pvd') <<u_magnitude# Hold plot# interactive()
The text was updated successfully, but these errors were encountered:
I use FEniCS installed in WSL of Windows 10.
The version is 2019.01.
Then I update demo files in the tutorial.
I delete the plot code because WSL cannot use it.
The text was updated successfully, but these errors were encountered: