Importing three-dimensional ANSYS field maps
Ansys offers two element types for three-dimensional electrostatic problems: the quadratic curved tetrahedron and the brick. Only field maps based on the former, known as SOLID123, can be imported in Garfield++ (using the class ComponentAnsys123
).
In the following we briefly recap the main steps in a typical Ansys script. For a more detailed discussion see the GEM tutorial.
- Clear earlier calculations and enter the pre-processor.
FINISH /CLEAR,START /PREP7
-
If using the GUI, enter the preferences and ensure that the only discipline selected within the "Electromagnetic" group is "Electric". The equivalent commands are
KEYW,PR_ELMAG,1 KEYW,MAGELC,1
Disable the p-method solution options. This option leads to elements of higher polynomial order, for which Garfield++ does not have shape functions implemented.
/PMETH,OFF,1
-
Select the second-order tetrahedron as element.
ET,1,SOLID123
-
When defining material properties, be sure that every material has its permittivity set. Choose material numbers starting from 1 and leave no holes in the numbering. Set the permittivity of conductors to a very high value. Set the resistivity of perfect conductors to 0 so as to make them eligible for removal as background. Try to avoid temperature-dependent properties as these can not be used by Garfield to identify materials. For instance, to define a perfect conductor (material 1), a gas (material 2) and a dielectricum (material 3):
! Material properties MP,PERX,1,1e10 ! Metal MP,RSVX,1,0.0 ! MP,PERX,2,1.0 ! Gas MP,PERX,3,4.0 ! Permittivity of FR4
-
Create the model. Pay particular particular attention to gluing adjacent volumes where necessary (VGLUE command). For instance, to create a conducting strip on the wall of a block of dielectric material:
metal = 0.2 gas = 2 sub = -1 BLOCK, -10, -5, -10, 10, 0, metal ! 1: Wide side strip BLOCK, -2, -4, -10, 10, 0, metal ! 2: First signal BLOCK, -1, 1, -10, 10, 0, metal ! 3: 2nd signal BLOCK, 2, 4, -10, 10, 0, metal ! 4: 3rd signal BLOCK, 5, 10, -10, 10, 0, metal ! 5: Wide side strip BLOCK, -10, 10, -10, 10, sub, 0 ! 6: Substrate BLOCK, -10, 10, -10, 10, 0, gas ! 7: Gas ! Subtract the strips from the gas VSBV, 7, 1, , , KEEP ! 7 -> 8 VSBV, 8, 2, , , KEEP ! 8 -> 7 VSBV, 7, 3, , , KEEP ! 7 -> 8 VSBV, 8, 4, , , KEEP ! 8 -> 7 VSBV, 7, 5, , , KEEP ! 7 -> 8 ! Glue everything together 1 = left wide, 2, 3, 4, 5 = wide, 7 = sub, 8 = gas VGLUE, ALL
-
Assign material properties with the VATT command.
VSEL, S, VOLU, , 1, 5 ! Metal strips VATT, 1, ,1 VSEL, S, VOLU, , 7 ! Gas volume VATT, 3, ,1 VSEL, S, VOLU, , 8 ! Substrate VATT, 2, ,1
-
Set boundary conditions.
! Voltage boundary conditions on the metal VSEL, S, VOLU, , 1, 5 ! All strips at ground ASLV, S DA, ALL, VOLT, 0 ASEL, S, LOC, Z, gas ! Drift electrode DA, ALL, VOLT, -1000 ASEL, S, LOC, Z, sub ! Back plane DA, ALL, VOLT, 0
-
Mesh the problem.
! Meshing options VSEL, S, VOLU, , 8 ! Only mesh the gas ASLV, S MSHKEY,0 SMRT, 4 VMESH, 1,8
Then solve the problem.
/SOLU SOLVE FINISH
Visualize the solution (optional):
/POST1 /EFACET,1 PLNSOL, VOLT,, 0
-
Write the solution to files. The potentials at the nodes are written to a file with the PRNSOL command. In the example below, the file name is chosen to be "field.lis".
/OUTPUT, field, lis PRNSOL /OUTPUT
In addition, we need to export the coordinates of the nodes (command NLIST), the nodes constituting the elements (command ELIST), and the material properties (command MPLIST).
/OUTPUT, NLIST, lis NLIST,,,,COORD /OUTPUT /OUTPUT, ELIST, lis ELIST /OUTPUT /OUTPUT, MPLIST, lis MPLIST /OUTPUT
Weighting potentials
In order to compute signals, Garfield++ needs weighting potentials or weighting fields. These are obtained by setting the read-out electrodes to a potential of 1 V and all other electrodes to ground. ComponentAnsys123
- requires the weighting fields and the main field map to share the same mesh.
-
Continuing the above example, we first clear the existing loads.
/SOLU LSCLEAR,ALL
-
We then apply the boundary conditions corresponding to the weighting field of the first (leftmost) narrow strip (volume index 1), i. e. we set the potential of volume 1 to 1 V and the potential of the other metal volumes to 0 V. The potentials on the top side of the gas and the bottom side of the substrate are set to 0 V as well.
VSEL, S, VOLU, , 1 VSEL, A, VOLU, , 3, 5 ASLV, S DA, ALL, VOLT, 0 VSEL, S, VOLU, , 2 ASLV, S DA, ALL, VOLT, 1 ASEL, S, LOC, Z, gas DA, ALL, VOLT, 0 ASEL, S, LOC, Z, sub DA, ALL, VOLT, 0
-
We now solve without meshing again.
VSEL, S, VOLU, , 1, 8 ASLV, S ! Solve the field SOLVE
-
Using the PRNSOL command we export the new solution to a file called "weight1.lis". ``` ! Write the solution /POST1 /OUTPUT, weight1, lis PRNSOL /OUTPUT ````
Following the same recipe, we can calculate and save maps of the weighting potential for the other two narrow strips.
Importing main and weighting field maps
To load the ".lis" files exported from Ansys in a ComponentAnsys123
object, we use the function Initialise
.
ComponentAnsys123 fm;
fm.Initialise("ELIST.lis", "NLIST.lis", "MPLIST.lis", "field.lis", "mm");
To import the maps of the weighting potentials we use the function SetWeightingField
which takes two string arguments: the name of the file that contains the nodal solution, and the identifier we want to give the corresponding readout electrode.
`
fm.SetWeightingField("weight1.lis", "strip1");
fm.SetWeightingField("weight2.lis", "strip2");
fm.SetWeightingField("weight3.lis", "strip3");
To make a contour plot of the weighting potential we use the class ViewField
.
ViewField fieldView(&fm);
fieldView.SetPlaneXZ();
fieldView.PlotContourWeightingField("strip1", "v");
Source files
The Ansys script discussed above and a simple C++ program to read the field map can be found in the directory Examples/Ansys123 of the Garfield++ source tree. This folder also contains Ansys scripts for modelling a Micromegas and a Triple-GEM.