feeLLGood – Tips and tricks
Here is a random collection of tips that can help you make better use of feeLLGood.
The usual way to use
feellgood to do some simulations is to follow the following workflow:
First, prepare you mesh, using
gmshor any other mesh generation software that can provide a mesh in gmsh text format 2.2. Optionally, use the rev_CMK tool if you have to reduce index spectrum.
Once your mesh is ready, you have to create a YAML file with the input parameters needed by the
feellgoodexecutable. You can create the file with a text editor, or use the Python helper script
settingsMaker.pyto create the file in JSON format. As JSON is a subset of YAML, it is acceptable as feeLLGood's input.
Run your simulation, either from a script, or with the command line using your YAML file as an input for the executable
You will need to visualize your data and/or perform some calculations on them. A tool to convert
feellgoodoutput files is provided in the tools directory. It converts the magnetization distribution in the output text files .sol in a format paraview can read directly. Some more information about the
convert2vtkscript is available in the section tools.
Creating the mesh
FeeLLGood expects the mesh to be made of first order tetrahedrons, and stored in a file in the “.msh” file format version 2.2. Such a mesh can be built by Gmsh, but beware that versions of Gmsh newer than 3.0.6 use a newer, incompatible version of the “.msh” file format.
If you have Gmsh installed, you can check its version number by typing:
If the version is lower than or equal to
3.0.6, the mesh file version should be
2.2, and readable by FeeLLGood.
Binary packages of Gmsh 3.0.6 are available for:
On Linux, the program and its documentation can be installed as follows:
wget http://gmsh.info/bin/Linux/gmsh-3.0.6-Linux64.tgz tar xzf gmsh-3.0.6-Linux64.tgz cd gmsh-3.0.6-Linux64 chmod a+x bin/onelab.py sudo cp -R --parents * /usr/local
Gmsh can be used to build a mesh from a
.geo file from command line as follows:
gmsh myFile.geo -3 -o myMesh.msh
myMesh.msh is readable by FeeLLGood.
It is also possible with a gmsh version 4.1.x or above to force the msh format to be 2.2:
gmsh myFile.geo -3 -format msh22 -o myMesh.msh
How to make a good mesh
It is strongly recommended to use a constant density of tetrahedrons in the material, since it is well known that domain-walls would be strongly affected in their motion if non-uniform meshing was used. Usual other recommendations while meshing also apply while solving LLG with finite element method:
- no flat tetrahedrons
- avoid sharp angles
- take care of the indices of the nodes: be sure to apply an algorithm to reduce the node index bandwidth, such as Cuthill-McKee algorithm. We provide the source code of a simple tool to apply the reverse Cuthill-McKee algorithm on a mesh file in the sub directory
- average size of the tetrahedrons should be smaller than the exchange length
- curved geometries must be properly meshed to avoid eventual artificial surface charges
Generally speaking, a micromagnetic simulation should not depend on the mesh, so it is recommended to check the results with different meshes, and/or various meshing techniques: extrusion, 3D meshing, or others.
In a separate YAML file, you will provide all the parameters that describe your material in accordance with the region numbering system of gmsh. \( M_s \) , \( \alpha \) , and other parameters such as anisotropy constants are provided here.
Since feellgood needs regions to define boundary conditions, it is necessary to use a .geo script to generate numbered surface and volume regions. Once the mesh is done, the user just have to write a YAML file to give each material parameters for each regions.
See user documentation for more information on all the possible parameters.
Validating the simulation results
In order to qualify the simulation results, it is recommended to slightly vary:
- the element size in the mesh
- the min and max values on both \(du\) and \(dt\) and check that the output results do not change.
This does definitely not prove that the calculation is correct, but at least you are sure feeLLGood converged towards a possible solution of the micromagnetic problem.