-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Using mixed-field formulation solid bodies with multiple solid bodies is possible, but tricky. This is a working example which should be added to the How-To section.
import felupe as fem
# create three meshes and a merged container
meshes = [
fem.Rectangle(n=(4, 10)),
fem.Rectangle(n=(6, 10)).translate(1, axis=0),
fem.Rectangle(n=(10, 10)).translate(2, axis=0),
]
container = fem.MeshContainer(meshes, merge=True)
ax = container.imshow()
# stack a top-level mesh, create a region and a field
# the dual-mesh must be created for the dual submesh(es) of the mixed-fields
# the offsets must match between the top-level mixed-field and the mixed sub-field
mesh = container.stack()
region = fem.RegionQuad(mesh)
field = fem.FieldsMixed(
region,
n=3,
axisymmetric=True,
mesh=fem.MeshContainer(meshes[1:], merge=True).stack().dual(points_per_cell=1),
)
# sub regions and first sub-field (displacements as single-field container)
regions = [fem.RegionQuad(m) for m in container.meshes]
field1 = fem.FieldContainer([fem.FieldPlaneStrain(regions[0], dim=2)])
# mixed sub-fields: the dual meshes must be created manually
# the number of points must be taken from the top-level mixed-field
# the offsets must match for the mixed-fields and their dual meshes
field2 = fem.FieldsMixed(
regions[1],
n=3,
axisymmetric=True,
offset=0,
mesh=meshes[1].dual(
points_per_cell=1,
offset=0, # first dual mesh, no offset
npoints=field[1].region.mesh.npoints, # must match top-level dual-mesh
),
)
field3 = fem.FieldsMixed(
regions[2],
n=3,
axisymmetric=True,
offset=meshes[1].ncells,
mesh=meshes[2].dual(
points_per_cell=1,
offset=meshes[1].ncells, # second dual mesh, offset necessary
npoints=field[1].region.mesh.npoints, # must match top-level dual-mesh
),
)
fields = [field1, field2, field3]
# load case
boundaries, loadcase = fem.dof.uniaxial(field, move=-0.8, clamped=True)
# constitutive material formulations and solid bodies
# a) (u)-formulation) on large-strain extended linear-elasticity
# b) (u-p-J)-formulation on large-strain extended linear-elasticity
# c) (u-p-J)-formulation for a nearly-incompressible hyperelastic material
umats = [
fem.LinearElasticLargeStrain(E=10, nu=0.3),
fem.ThreeFieldVariation(fem.LinearElasticLargeStrain(E=3, nu=0.3)),
fem.NearlyIncompressible(fem.NeoHooke(mu=1), bulk=5000),
]
solids = [fem.SolidBody(umat, f) for umat, f in zip(umats, fields)]
# add the step to the job and pass the top-level field as x0-argument+
step = fem.Step(items=solids, boundaries=boundaries)
job = fem.Job([step]).evaluate(x0=field)
ax = field.imshow("Principal Values of Logarithmic Strain")Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
