mufem: fast and accurate simulations
mufem (pronounced /ˈmjuːfɛm/) is a finite-element simulation code for electromagnetics, photonics, and plasmas, and their coupled multi-physics problems, built for industry-relevant engineering applications.
mufem is driven through a Python interface, making it ideal for exploratory work, parametric studies and design optimization, and a natural fit for agentic workflows. mufem is free for both academic and commercial use.
For questions or support, please open an issue or contact us at info@raiden-numerics.com.
This repository hosts a quick introduction to mufem together with a collection of validation and example cases. For platform-specific setup see the Installation guide, and for tutorials and the full API reference see the mufem documentation.

Why mufem
build, run, and post-process simulations from a clean Python API; ideal for parametric sweeps, optimization, and agentic workflows. |
model electromagnetic, thermal, and structural phenomena and their interactions, all within a single framework. |
built on MFEM for high-order finite elements on curved, unstructured, non-conformal, and Cartesian meshes. |
parallel CPU and GPU solvers that scale efficiently from a single laptop to a large cluster. |
continuously tested against established benchmark suites and published experimental, analytical, and reference results. |
the community version is free for academic and commercial use, with no license fees, covering most workflows. |
Quick example
Solve the electrostatic field inside a cube held at 1 V across two faces. The simulation reads a mesh
whose tagged attributes (a Cube volume and its Anode/Cathode boundary faces) are referenced by
markers ("Cube" @ Vol, "Anode" @ Bnd, …):
import mufem
import mufem.electromagnetics.electrostatics as estat
from mufem import Vol, Bnd
sim = mufem.Simulation.New(name="Charged Cube", mesh_path="cube.msh")
sim.set_runner(mufem.SteadyRunner(total_iterations=1))
# Electrostatics model on the tagged "Cube" volume
model = estat.ElectrostaticsModel(order=2)
sim.get_model_manager().add_model(model)
model.add_material(estat.ElectrostaticMaterial(name="Air", marker="Cube" @ Vol))
# Apply 1 V across the cube: anode at 1 V, cathode grounded
model.add_conditions([
estat.ElectricPotentialCondition(name="Anode", marker="Anode" @ Bnd, electric_potential=1.0),
estat.ElectricPotentialCondition(name="Cathode", marker="Cathode" @ Bnd, electric_potential=0.0),
])
# Report the stored electric energy
report = mufem.VolumeIntegralReport(name="Energy", cff_name="Electric Energy Density")
sim.get_report_manager().add_report(report)
sim.run()
print("Electric energy:", report.evaluate(), "J")
# Export the fields for visualization (ParaView / VTK)
vis = sim.get_field_exporter()
vis.set_output_directory("ChargedCubeOutput")
vis.add_field_output("Electric Potential")
vis.add_field_output("Electric Field")
vis.save()
See the electrostatics cases for full, runnable examples, including mesh generation and comparison against reference results.
Gallery
Models
mufem provides finite-element models across several physics domains, composable for coupled multi-physics:
- Electrostatics: electric fields and potentials in dielectrics.
- Magnetostatics: static magnetic fields, including nonlinear materials.
- Time-Domain Magnetic: eddy currents and transient low-frequency magnetics.
- Time-Harmonic Magnetic: steady-state AC magnetics.
- Full-wave Maxwell (time-harmonic): high-frequency electromagnetics and antennas.
- Thermal: steady and transient heat conduction.
- Structural: linear elasticity.
See the documentation for the full model list and details.
Getting started
First create and activate a virtual environment:
python -m venv mufem-venv
source mufem-venv/bin/activate
Then install the latest release from PyPI:
pip install mufem
See the Installation guide for platform-specific instructions, and the mufem documentation for tutorials and API reference.
That is all you need to run the validation cases below directly.
Validation cases
This repository collects validation examples for mufem (tested against the pinned version). After following the Installation guide, run a specific case with:
(mufem-venv) pymufem Electromagnetics/Compumag-Team1b-Felix-Cylinder/case.py
Electromagnetics
mufem supports both low-frequency (magnetostatics, eddy currents, time-domain and time-harmonic magnetics) and high-frequency (full-wave Maxwell) electromagnetics.
-
TEAM (Testing Electromagnetic Analysis Methods) Benchmark Suite
Introduced in the late 1980s and continuously updated, the TEAM benchmarks focus primarily on low-frequency magnetic problems, providing a standard framework for evaluating numerical methods. Available cases: - Electrostatic
- Time-Domain Magnetic
- Time-Harmonic Magnetic
- Time-Harmonic Maxwell
Structural
-
NAFEMS Benchmark Suite
A long-standing set of reference problems from the NAFEMS simulation community covering structural, thermal, fluid, and multi-physics analyses. - Structural Mechanics
- Thermal


