Importing COMSOL field maps
In this example, we use COMSOL Multiphysics to calculate the electric potential inside a GEM. A Matlab script for doing so is available in the directory Examples/Comsol/Comsol of the source tree. After having obtained the solution, we want to export it for use within Garfield++.
Complementary to the description given below, you can find instructions in this document (contributed by Irina Kempf).
Exporting a field map
As a first step, we save the mesh to a text file.
- Navigate in the tree to Mesh → Export.
- Choose a file name (file type ".mphtxt").
- Select: Export as second-order elements.
- Export.
Next, we export a map of the electric potential.
- Navigate to Results → Export → Data.
- Select the correct data set.
- Select expression "V".
- Choose a file name.
- Select data format "Spreadsheet".
- Select resolution "Custom".
- Select Lagrange order "2"
- Export.
Finally, we need to create a text file containing the relevant material properties. In this example, there are three materials: gas (domain 1) with dielectric constant ε = 1, polymer (domain 2) with dielectric constant ε = 4, and copper (domains 3 and 4). The text file should contain
- the number of materials,
- followed by the relative dielectric constants of each material,
- the number of domains and
- a list of domain indices and corresponding material indices (the latter starting with 0).
Our file should therefore look like this:
3
1 4 1e10
4
1 0
2 1
3 2
4 2
We can now import these files in Garfield++ using the class ComponentComsol
. The necessary steps are essentially the same as the ones discussed in the Ansys GEM example.
The source code of an example program is available in the directory Examples/Comsol of the source tree.