feeLLGood – finite element LLG object oriented development

feeLLGood – Python modules

There are a few Python modules distributed with feeLLGood. They are located in the python-modules directory of the source distribution. The command make install installs them in

/usr/local/lib/python3.X/Y-packages/feellgood/

where 3.X is the version number of your Python interpreter, and Y-packages is either dist-packages or site-packages, depending or your Linux flavor. This is most likely already within your sys.path, and you can import those modules simply with:

from feellgood import module_name

settingsMaker.py: generate a JSON input file

This script provides a class called Settings. The constructor takes a single argument: the mesh file name. It will create an object than contains all the parameters the feellgood executable needs for running your simulation. Technically, it is a dictionnary with some (key,value) pairs mandatory, and others optional. Here is a table of the different keys.

key Mandatory/Optional
"outputs" mandatory, and all the inner keys too
"recentering" optional
"mesh" mandatory
"initial magnetization" mandatory, with some math expressions or a .sol file name
"Bext" mandatory, if no field set all components to zero
"spin_polarized_current" optional
"finite_element_solver" mandatory
"demagnetizing_field_solver" mandatory
"time_integration" mandatory

In order to create a new volume region, use the method createVolRegion. The only parameter is the volume name corresponding to your mesh. To fill the parameters of a volume region, use the method setMaterialRegion, it requires 4 parameters:

To create a new surface region, use the method createSurfRegion. The only parameter is the surface name corresponding to your mesh.

You may also access any of the keys of the settings dictionary directly in your script. Once you have filled all you need to give to feellgood, the JSON file can be generated with the write method. Its only parameter is the file name of your JSON parameters file.

meshMaker.py: generate various simple mesh using gmsh

It is a collection of classes to generate simple meshes in gmsh text format 2.2. To illustrate various possibilities to mesh, some mesh are built directly, others are using geo engine or open cascade engine included in gmsh python.

class Ico: generate a mesh of an icosahedron

This class generates a mesh of an icosahedron. This mesh is very simple, only containing 20 tetrahedrons, generated from the faces to the center at \((0,0,0)\). It may be usefull for some tests. The constructor has no parameter. A method make to write the mesh file accepts 3 parameters: the file name, the volume region name and the surface region name.

class Cuboid: generate a mesh of a cuboid

This class generates a mesh of a cuboid. This mesh is directly built with a uniform mesh made with cubes, then each of them is split into two triangular prisms, and then each prism is split in three tetrahedrons. The constructor accepts 5 parameters: the first two parameters are 3D points to fix the dimensions of the cuboid, and then come 3 integers, the number of points along each dimensions.

The method make writes the mesh file. It takes 3 parameters: the file name, the volume region name and the surface region name.

class Cylinder: generate a mesh of a cylinder

This class generates a mesh of a cylinder. This mesh is built using gmsh python API with geo engine. The constructor needs 5 parameters : radius, thickness (length along (0z)), meshSize, the volume region name and the surface region name. The method make writes the mesh file. It takes 1 parameter: the file name.

class Ellipsoid: generate a mesh of an ellipsoid

This class generates a mesh of an ellipsoid. This mesh is built using gmsh python API with open cascade engine. The constructor needs 5 parameters : radius1 (in the plane (Oxy)), radius2 (along (0z)), meshSize, the volume region name and the surface region name. The method make writes the mesh file. It takes 1 parameter: the file name.