Nmag for Python 3¶
Nmag is a Python interface for finite-element micromagnetic simulations. This rewrite runs on modern Python, reads legacy Nmesh files and common mesh formats, and provides static fields, adaptive magnetization dynamics, relaxation, checkpointing, and structured NDT/HDF5 output.
Install Nmag Run the quickstart
Where to begin¶
- New to the package? Follow the quickstart, then work through the sphere tutorial.
- Building a simulation? Read the simulation workflow and the guides for meshes, materials, and output.
- Moving an old script? Start with the legacy migration guide.
- Looking up a call? Use the curated API reference.
Current project status
The supported workflows are usable, but the rewrite does not implement every feature of Nmag 0.2. Validate a new geometry or material model before relying on production results, and check the supported scope before porting a legacy study.
A Python simulation, end to end¶
An Nmag program follows a small set of explicit steps:
- load or construct a tetrahedral mesh;
- define magnetic materials with SI-valued parameters;
- create a simulation and map mesh regions to materials;
- set magnetization and applied fields;
- calculate fields, advance time, or relax the state; and
- save averages and spatial fields for analysis.
The documentation concentrates on that user workflow. Internal solver design, development investigations, and validation machinery are intentionally not part of this manual.
Project lineage¶
Nmag was originally developed at the University of Southampton. The historical Nmag 0.2 manual remains useful for micromagnetic background, but its Python 2 syntax, command-line tools, solver options, and some supported physics do not describe this rewrite. The original source is available from nmag-project/nmag-src.