Skip to content
Get started

Mixed-boundary linear elasticity

Gallery

Model a two-dimensional linear-elastic square with a fixed left edge and traction-free remaining edges, then compare its original and deformed mesh.

Follow Get started and keep its eqiora-source checkout and .venv. From the folder containing both, add plotting support and save the computed displacement:

Terminal windowbash
uv add 'eqiora[matplotlib]'
uv run python eqiora-source/examples/python/mixed_boundary_elasticity.py --displacement-png displacement.png

Stage 1 Problem and boundaries

Create a 1 m×1 m1\,\mathrm{m}\times1\,\mathrm{m} rectangle. The left edge has zero displacement; the right, lower, and upper edges have zero traction. A 16×1616\times16 Cartesian mesh covers the domain.

python
graph = eqiora.geometry.GeometryGraph()
rectangle = graph.rectangle(x_bounds=(0.0, 1.0), y_bounds=(0.0, 1.0))
geometry = graph.build(
rectangle,
named_topology={
"body": rectangle.region,
"x_lower": rectangle.boundaries[0],
"x_upper": rectangle.boundaries[1],
"y_lower": rectangle.boundaries[2],
"y_upper": rectangle.boundaries[3],
},
)
Geometry and mesh in the example script

Stage 2 Eqiora model definition

The .eqi component defines displacement, material parameters, load potential, equilibrium, the body support and its four boundary supports. With displacement u\boldsymbol{u}, shear modulus μ\mu, Lamé coefficient λ\lambda, and length ℓ\ell, its stress and load are

σ(u)=2μ sym⁡(∇u)+λ div⁡(u)I,q=2μxℓ.\boldsymbol{\sigma}(\boldsymbol{u}) =2\mu\,\operatorname{sym}(\nabla\boldsymbol{u}) +\lambda\,\operatorname{div}(\boldsymbol{u})\boldsymbol{I}, \qquad q=\frac{2\mu x}{\ell}.

The balance relation is

−∇ ⁣⋅σ(u)−∇q=0.-\nabla\!\cdot\boldsymbol{\sigma}(\boldsymbol{u})-\nabla q=0.
Eqiora component source

Stage 3 Choose numerical settings

Compile the model, then select Q1 elements and linear-solve settings.

python
model = eqiora.compile(
path=files(eqiora).joinpath("examples", "mixed-boundary-elasticity.eqi"),
geometry=geometry,
entry="MixedBoundaryElasticity2d",
bindings={
"body": geometry.selection("body"),
**{
side: (geometry.selection(side), geometry.selection("body"))
for side in ("x_lower", "x_upper", "y_lower", "y_upper")
},
"mu": 3.0, "lambda": 0.0, "length_scale": 1.0,
},
)
plan = eqiora.resolve(
model,
mesh=mesh,
spatial=eqiora.fem.Q1(),
solve=eqiora.solve.Linear(...),
)
Compile and resolve in the example script

Stage 4 Run and inspect displacement

The example function runs the plan and returns it with the result:

python
return plan, eqiora.run(plan)

Select the displacement field:

python
displacement = result.output(plan.fields[0])

The plotting code calls the same function, so it does not repeat the geometry, physics, mesh, or solver settings.

Stage 5 Displacement presentation

Reference and deformed meshes for the 2D mixed-boundary elasticity example.
Units: mDisplacement at scale 1, with the undeformed reference mesh shown for comparison.View the plotting path

The dashed mesh is the undeformed geometry; the orange mesh shows it displaced at scale 1. Changing the plot scale does not change the computed displacement.

Stage 6 Reading the deformation

Compare the fixed left edge with the displacement toward the loaded interior. The equations use small-strain linear elasticity; a visually large deformation does not make this a large-deformation material model.

Derive strain, stress, and equilibrium in the structural mechanics lessons, then follow the same model in the Python guide.