Generate Feelpp CFPDES files with Python MagnetSetup
Python MagnetSetup is a Python application developed by Christophe Trophime that allow the user to create Feelpp files for chosen geometry, materials properties and physics. It uses a mix of templates files and python code, as well as a database where the geometries and magnet properties are stored.
1. Objectives
My participation in the development of this application were on the cfpdes templates in axisymmetric coordinates. The main objectives were :
-
Add templates for all the formulations using the Atheta Axi case for the magnetic part
-
Adding the templates for thermo-elasto-maxwell-quasi-static formulation
-
Updating the templates and python code for Feelpp v110
3. Parameters for PythonMagnetSetup
The command line to run PythonMagnetSetup is :
python -m python_magnetsetup.cli --magnet HL-test --method cfpdes --time static --geom Axi --model thmagel --cooling mean
The different parameters that can be changed to create the feelpp files are :
-
magnet : the choice of the magnet (geometry & materials properties)
-
time : static or transient
-
model : the physic that will be used
3.1. Magnet
When the magnet is chosen, the python program automatically gives instruction to create the mesh file. Let’s see some example :
-
HL-test : two helices magnet
HL-test
|
HL-test with materials names
|
-
M19061901 : fourteen helices magnet
M19061901
|
M19061901 with materials names
|
3.2. Model
The templates available for the models are separated in two part :
-
static :
-
mag : magnetostatic model with the unknown \(\phi\)
-
mag_hcurl : magnetostatic model with the unknown \(A_\theta\)*
-
thelec : thermostatic model
-
thmag : thermo-magnetostatic model with the unknown \(\phi\)
-
thmag_hcurl : thermo-magnetostatic model with the unknown \(A_\theta\)*
-
thmagel : thermo-elasto-magnetostatic model with the unknown \(\phi\)
-
thmagel_hcurl : thermo-elasto-magnetostatic model with the unknown \(A_\theta\)*
-
-
transient :
-
mqs : maxwell-quasi-static model with the unknown \(\phi\)
-
mqs_hcurl : maxwell-quasi-static model with the unknown \(A_\theta\)*
-
thmqs : thermo-maxwell-quasi-static model with the unknown \(\phi\)
-
thmqs_hcurl : thermo-maxwell-quasi-static model with the unknown \(A_\theta\)*
-
thmqsel : thermo-elasto-maxwell-quasi-static model with the unknown \(\phi\)*
-
thmqsel_hcurl : thermo-elasto-maxwell-quasi-static model with the unknown \(A_\theta\)*
-
* newly implemented models
The templates are also available in version 110 here.
4. Example - thmag_hcurl
Let’s see examples with the thermo-magnetostatic thmag_hcurl model.
We run :
python -m python_magnetsetup.cli --magnet HL-test --method cfpdes --time static --geom Axi --model thmag_hcurl --cooling mean
It will generate json and cfg files, based on the characteristics of the materials.
For example, in the magnet HL-test, the material H1_Cu0 is defined as an insulator and H1_Cu1 as a conductor. When creating the json file, in the Materials part, H1_Cu0 uses the insulator template and H1_Cu1 the conductor template :
Template to json file
|
The formulations of the models are contained in two different json files, one for the insulator and one for the conductor, that will be shared for all the materials depending on their characteristics :
conductor.json & insulator.json
|
4.1. v110
For the version 110 of Feelpp, the informations all previously contained in Materials are separated between the Models part and the Materials part. In the Models part, there was originally only one model per physic for the conductor and insulator :
heat models
|
But, by using a list of materials and not explicitly calling them in the expression (example : \(\texttt{materials_k}\) instead of \(\texttt{materials_H1_Cu0_k}\)), it considerably slowed down the simulations, especially for geometries with lots of materials. Therefore, it was decided to have one model per material for each physics :
heat models
|
4.2. Results
Let’s see some results of the model thmag_hcurl on the HL-test and the M19061901 magnet. For those examples, only the magnet part was changed in the command line.
HL-test - Magnetic potential \(A_\theta (Tm)\)
|
M19061901 - Magnetic potential \(A_\theta (Tm)\)
|
HL-test - Magnetic flux density \(Br(T)\)
|
M19061901 - Magnetic flux density \(Br(T)\)
|
HL-test - Magnetic flux density \(Bz(T)\)
|
M19061901 - Magnetic flux density \(Bz(T)\)
|
HL-test - Temperature \(T(K)\)
|
M19061901 - Temperature \(T(K)\)
|