Skip to content

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

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:

  1. load or construct a tetrahedral mesh;
  2. define magnetic materials with SI-valued parameters;
  3. create a simulation and map mesh regions to materials;
  4. set magnetization and applied fields;
  5. calculate fields, advance time, or relax the state; and
  6. 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.