AgentFEM
AgentFEM is an open-source platform for AI-native finite-element computing. It provides a readable engineering workflow for defining, solving, inspecting, and reusing finite-element models while keeping the numerical formulation and result evidence accessible.
Start here¶
| I want to... | Go to... |
|---|---|
| See what I can build or try a browser demo | Explore AgentFEM |
| Install AgentFEM and run one model | Getting started |
| Build a solid, thermal, dynamic, or creep analysis | User guide |
| Reproduce an executable capability | Examples |
| Connect Codex or another compatible agent | AgentFEM MCP |
| Look up an equation, output variable, or function | Theory and reference |
The public workflow follows the concepts used in an engineering analysis:
Study → Model → Mesh/Regions → Fields → Materials → Loads/Constraints
→ Solution Step → Results/Verification
Quick installation¶
The recommended conda-forge installation provides AgentFEM and its compatible FEniCSx/PETSc/MPI foundation together:
mamba create -n agentfem-env --override-channels -c conda-forge \
python=3.11 fenics-dolfinx=0.11 agentfem
mamba activate agentfem-env
agentfem doctor
Windows users should currently use WSL2. Optional mesh, visualization, and
machine-learning integrations are described in the
installation and platform guide. When the canonical
source is slow, ask an agent to "use the mirror channel"; the documented
route does not change global conda configuration. On WSL, run
agentfem workspace --protect once; the same safe project layout
is used by both Mamba installations and the Complete Runtime.
First finite-element model¶
The following complete example solves a two-dimensional linear-elastic cantilever. The left boundary is fixed and a traction is applied on the right.
from mpi4py import MPI
from agentfem import fields, mesh, models, studies
from agentfem.constitutive import elasticity
study = studies.static_solid(
dimension=2,
assumption="plane_stress",
)
domain = mesh.rectangle(
(0.0, 0.0),
(1.0, 0.2),
(40, 8),
comm=MPI.COMM_WORLD,
cell_type="triangle",
)
model = models.create(study=study, mesh=domain, name="cantilever")
u = model.field(fields.displacement(domain, degree=1))
model.material(
elasticity.isotropic_elastic(
young=210.0e9,
poisson=0.30,
density=7800.0,
)
)
left = mesh.face(domain, axis="x", value=0.0, name="left", tag=1)
right = mesh.face(domain, axis="x", value=1.0, name="right", tag=2)
model.fix(u, on=left)
model.traction((0.0, -1.0e6), on=right)
model.check()
result = model.step(target=u).solve_result(output="cantilever.xdmf")
result.verify("engineering").require()
result.write_manifest("cantilever.result.json")
print(model.tree())
print(result)
Save the code as cantilever.py and run:
The analysis produces displacement and standard stress/strain fields in XDMF/HDF5, together with a structured result manifest containing quantities, artifacts, solver evidence, and verification state. The repository's release example adds a Golden benchmark and explicit release-quality checks.
Browse by task¶
| Topic | Start here |
|---|---|
| Create and run an installed project | Getting started |
| Linear, nonlinear, and thermoelastic solids | Solid mechanics |
| Steady and transient temperature problems | Heat transfer |
| Structural dynamics, modes, harmonic response, and waves | Dynamics and waves |
| Plasticity, creep, state, and cutback | Creep and inelasticity |
| Meshes, regions, loads, and constraints | Model definition |
| Fields, histories, output, and post-processing | Results |
| Campaigns, datasets, user models, and surrogates | Simulation to learning |
Current scope¶
| Area | Available workflow |
|---|---|
| Solid mechanics | Linear elasticity, thermoelasticity, Neo-Hookean and Mooney--Rivlin finite strain, mixed displacement-pressure hyperelasticity, stateful small-strain J2, and experimental finite-strain J2 with 3D strong/displacement-only affine-MPC plus serial 3D P2/DG0 and 2D plane-strain Q2/DPC1 mixed providers |
| Heat transfer | Steady conduction and implicit transient heat transfer |
| Dynamics and vibration | Newmark/generalized-\(\alpha\) implicit dynamics, central-difference explicit wave propagation, and engineering linear modal and provider-neutral direct harmonic procedures |
| Time-dependent materials | Global isothermal/Arrhenius power-law creep, engineering generalized-Maxwell transient equilibrium, and reviewed material-point creep/damage tools; generalized-Maxwell harmonic coupling remains experimental |
| Mesh and constraints | Structured/XDMF meshes, optional Gmsh and meshio routes, direct Abaqus C3D10H import, equation constraints, and distributed periodic workflows |
| Results and verification | Standard fields, histories, resultants, progress, checkpoints, Golden benchmarks, and explicit quality policies |
| Simulation and learning | Parameter campaigns, scientific datasets, user-model execution, NumPy/PyTorch adapters, surrogate baselines, applicability guards, and FEM fallback |
Capabilities with different maturity levels are identified in the relevant guide and example instead of being presented as equally complete.
Theory and reference¶
Engineering definitions are part of the documentation contract. The theory and conventions page collects the governing equations, kinematic conventions, analysis-procedure distinctions, and links to the detailed material and output definitions. The scientific function reference is generated from reviewed knowledge cards and records formulas, assumptions, tests, benchmarks, consumers, and known limitations.
Use the reference according to the question being asked:
- Theory and conventions — governing equations, measures, signs, and analysis assumptions.
- Output variables and field semantics — meanings
of
U,S,E,LE,PE,CE,MISES, energies, recovery, and visualization fields. - Scientific operator contracts — composition of \(\mathbf{K}\), \(\mathbf{M}\), \(\mathbf{C}\), \(\mathbf{F}\), residuals, and tangents.
- Python API — public signatures and call-level lookup.
- Examples — executable workflows and their numerical maturity.
Humans and agents¶
AI-native does not mean replacing finite-element computation with AI. Humans, scripts, IDEs, future GUIs, and AI agents operate the same public model and structured result contract. Advanced users can still reach UFL, DOLFINx, PETSc, MPI, and custom constitutive implementations when a problem requires a lower layer.
AgentFEM was initiated by Haoming Luo and open-sourced on GitHub in July 2026.