Hi
I am trying to learn NGSPy. I am looking at one-eight of a thick spherical with internal pressure. I want to restrict the displacements on the y-z plane to have u_x = 0, in the z-x plane to have u_y = 0, and in the x-y plane to have u_z = 0.
Can I set the face to have Dirichlet Boundary condition? Does that mean all the three components of the displacement have to be specified on the boundaries marked as dirichlet
? I was not able to find an example in the documentation that sets just one component of displacement to 0. Can you kindly give a sample how to do it?
I have attached the code for the geometry, the load and the FESpace:
from ngsolve import Draw, Redraw, Id, Grad, Trace, Det, Parameter, specialcf, H1
from netgen.csg import Plane, Sphere, Pnt, Vec, CSGeometry
Prepare mesh
yz_plane = Plane (Pnt(0, 0, 0), Vec(-1, 0, 0)).bc(“xface”)
zx_plane = Plane (Pnt(0, 0, 0), Vec(0, -1, 0)).bc(“yface”)
xy_plane = Plane (Pnt(0, 0, 0), Vec(0, 0, -1)).bc(“zface”)
inner_sphere = Sphere(Pnt(0, 0, 0), 5).maxh(0.5).bc(“inner”)
outer_sphere = Sphere(Pnt(0, 0, 0), 25).maxh(5).bc(“outer”)
one_eight_sphere = ((outer_sphere - inner_sphere) * yz_plane * zx_plane * xy_plane).mat(‘rubber’)
geo = CSGeometry()
geo.Add(one_eight_sphere)
mesh = geo.GenerateMesh()
mesh.Refine()
mesh.SecondOrder()
mesh.Export(‘TestSphere.msh’, ‘Gmsh2 Format’)
Prepare constitutive equation
E, nu = 1.794, 0.3
mu = 0.5E/(1 + nu)
lam = E * nu / ((1 + nu)(1 - 2*nu))
def C(u):
F = Id(3) + Grad(u)
return F.trans * F
def NeoHooke(C):
return 0.5 * mu * (Trace(C - Id(3)) + 2 * mu/lam * Det(C)**(-0.5*lam/nu) - 1)
Prepare incremental load
factor = Parameter(0)
factor.Set(0.05)
pressure = factor * specialcf.normal(3)
Define the FESpace
fes = H1(mesh, order=2, dirichlet=‘xface|yface|zface’, dim=3)