Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed-field formulations with multiple solid bodies #809

Open
adtzlr opened this issue Jul 5, 2024 · 0 comments
Open

Mixed-field formulations with multiple solid bodies #809

adtzlr opened this issue Jul 5, 2024 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@adtzlr
Copy link
Owner

adtzlr commented Jul 5, 2024

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")

image

@adtzlr adtzlr added the documentation Improvements or additions to documentation label Jul 5, 2024
@adtzlr adtzlr self-assigned this Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant