Example Codes for Coupled Theories in Solid Mechanics
Eric M. Stewart, Shawn A. Chester, and Lallit Anand
Welcome#
This website compiles a collection of FEniCSx finite element codes for a wide array of coupled-physics theories in solid mechanics. These codes accompany the book,
L. Anand, E.M. Stewart, S.A. Chester. Introduction to coupled theories in solid mechanics. 2025, in preparation.
A selection of example codes are provided for:
Finite elasticity
Finite deformation viscoelasticity with inertial effects
Finite thermo-elasticity
Gel mechanics
Gel thermo-mechanics
Chemo-mechanically coupled Cahn-Hilliard
Electro-elasticity of dielectric elastomers
Electro-viscoelasticity of dielectric elastomers with inertial effects
Electro-chemo-elasticity of ionic polymers
Magneto-viscoelasticity of hard-magnetic soft-elastomers
Magneto-viscoelasticity of soft-magnetic soft-elastomers
Running the codes#
We recommend downloading or cloning the entire collection of example codes (< 30 MB of files) from the GitHub repository, and then running example codes locally on your machine using Docker and VSCode.
A detailed guide for installing FEniCSx in a Docker container and running the notebooks using VSCode is provided both for Mac and Windows. The installation process is essentially similar for the two operating systems, but the example screenshots in the instructions are from the relevant system.
These are our preferred methods for editing and running FEniCSx codes, although many other options exist.
Important
All codes were written for FEniCSx v0.8.0, so our instructions documents will direct you to install this specific version of FEniCSx.
Results#
Simulation results are post-processed and visualized in two primary ways:
Plots of curves are constructed and shown in-line using
matplotlib
.Field data for the simulation — i.e. contours of displacement, stress, and so on — are written to a
*.bp
file in the/results
directory which is included in each sub-folder of the GitHub repository. The results*.bp
file can be read and visualized by ParaView, using theADIOS2VTXReader
option.
Citation#
If you use these codes in your own research, please cite the software:
as well as the associated textbook:
L. Anand, E. M. Stewart, and S. A. Chester. Introduction to coupled theories in solid mechanics. 2025, in preparation.
BibTeX citations:
@software{stewart2025,
author = {Stewart, E. M. and Chester, S. A. and Anand, L.},
title = {Example codes for coupled theories in solid mechanics},
month = jan,
year = 2025,
publisher = {Zenodo},
doi = {10.5281/zenodo.14680876},
url = {https://doi.org/10.5281/zenodo.14680876}
}
@book{anand2025,
author={Anand, L. and Stewart, E. M. and Chester, S. A.},
title={Introduction to coupled theories in solid mechanics},
year={2025, in preparation.}
}
Legacy codes#
“Legacy FEniCS” versions of some of the example codes presented in this repository are available in the following repository: