-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 14 replies
-
Hi,
Note It's important to remove the MPC - center point from import felupe as fem
import numpy as np
mesh = fem.Cube(n=6)
mesh.update(points=np.vstack([mesh.points, [2, 0.5, 0.5]]))
mesh.points_without_cells = np.array([], dtype=int)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
solid = fem.SolidBody(umat=fem.NeoHooke(mu=1, bulk=2), field=field)
fixed = dict(fixed=fem.Boundary(field[0], fx=0))
points = np.arange(mesh.npoints)[mesh.x == 1.0]
mpc = fem.MultiPointConstraint(field, points=points, centerpoint=-1)
force = fem.PointLoad(field, points=[-1])
table = fem.math.linsteps([0, 1], num=5, axis=0, axes=3)
ramp = {force: 1 * table}
step = fem.Step(items=[solid, mpc, force], ramp=ramp, boundaries=fixed)
job = fem.Job(steps=[step]).evaluate()
plotter = solid.plot("Principal Values of Cauchy Stress", plotter=mpc.plot())
plotter.show() It is also possible to apply the MPC only in the direction of the force, i.e. import felupe as fem
import numpy as np
mesh = fem.Cube(n=6)
mesh.update(points=np.vstack([mesh.points, [2, 0.5, 0.5]]))
mesh.points_without_cells = np.array([], dtype=int)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
solid = fem.SolidBody(umat=fem.NeoHooke(mu=1, bulk=2), field=field)
boundaries = dict(
left=fem.Boundary(field[0], fx=0),
right=fem.Boundary(field[0], fx=2, skip=(1, 0, 0)),
)
points = np.arange(mesh.npoints)[mesh.x == 1.0]
mpc = fem.MultiPointConstraint(field, points=points, centerpoint=-1, skip=(0, 1, 1))
force = fem.PointLoad(field, points=[-1])
table = fem.math.linsteps([0, 1], num=5, axis=0, axes=3)
ramp = {force: table}
step = fem.Step(items=[solid, mpc, force], ramp=ramp, boundaries=boundaries)
job = fem.Job(steps=[step]).evaluate()
plotter = solid.plot("Principal Values of Cauchy Stress", plotter=mpc.plot())
plotter.show() If you know your force distribution, you can of course also apply the force on the mesh-points directly. import felupe as fem
import numpy as np
mesh = fem.Cube(n=6)
region = fem.RegionHexahedron(mesh)
field = fem.FieldContainer([fem.Field(region, dim=3)])
solid = fem.SolidBody(umat=fem.NeoHooke(mu=1, bulk=2), field=field)
boundaries = dict(left=fem.Boundary(field[0], fx=0))
points = np.arange(mesh.npoints)[mesh.x == mesh.x.max()]
force = fem.PointLoad(field, points=points)
table = fem.math.linsteps([0, 1], num=5, axis=0, axes=3)
ramp = {force: 1 / len(force.points) * table}
step = fem.Step(items=[solid, force], ramp=ramp, boundaries=boundaries)
job = fem.Job(steps=[step]).evaluate()
solid.plot("Principal Values of Cauchy Stress").show() Hope that helps! |
Beta Was this translation helpful? Give feedback.
It seems that PyVista doesn't show points inside the volume if you set the opacity to a value lower than 1. I think you'd have to modify the mesh before to do so.
Here is an example. Let's take a gmsh-file, e.g. cube6.geo. First, create the msh-file within gmsh and then follow this code to use it in FElupe.
code (requires the pypardiso-package)