Nmag console commands in a nutshell

Nmag is a python-based micromagnetic simulator for finite elements mesh.

First we add the path and one alias for a comfort work to our bashrc from <nsim>/bin directory:

echo "export PATH=\$PATH:`pwd`" >> ~/.bashrc
echo "alias nmeshimportg='`pwd`/nmesimport --gmsh'" >> ~/.bashrc

Convert the mesh in Version ASCII v2.x format to Version 1:

gmsh  -3 -format msh1 sphere.msh -o sphere1.msh

Convert the mesh from msh to nmesh.h5 format (note, that nmeshimportg is the alias!):

fid=sphere; nmeshimportg  $fid.msh $fid.nmesh.h5

Getting fields distribution in all stages (in vtk format):

fid=sphere; nmagpp --vtk $fid.vtk $fid

Getting fields distribution in selected and the last stages (in vtk format):

fid=sphere; nmagpp --range "[10, 20, 50] + [max(ids)]" --vtk $fid.vtk $fid

Parallel execution:

time mpirun -np 2 -host localhost nsim bar.py

Leave a Reply