# ComponentComsol::ElectricField: Field map not yet initialised

**URL:** <https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431>\
**Category:** Garfield++\
**Created:** [December 7, 2023, 10:27am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431 "2023-12-07T10:27:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![spencer2023](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@spencer2023](https://root-forum.cern.ch/u/spencer2023)\
**Post date:** [December 7, 2023, 10:27am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/1 "2023-12-07T10:27:05Z")

</div>

Hi, I can run the COMSOL examples from garfield++ official website. But then i try to load myself build mesh/field from COMSOL. It failed and with the error as titled.

---

<div class="post-metadata">

**Author:** ![mdessole](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mdessole/32/34021_2.png) [@mdessole](https://root-forum.cern.ch/u/mdessole)\
**Post date:** [December 7, 2023, 2:44pm UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/2 "2023-12-07T14:44:40Z")

</div>

Hi @spencer2023,  
thanks for reaching out! It is not clear to me whether your issue is ROOT related or not, can you provide a small code snipped of what you’re trying to do?

Cheers,  
Monica

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 7, 2023, 8:47pm UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/3 "2023-12-07T20:47:06Z")

</div>

Hi,  
there should be some more output from ComponentComsol preceding this error message. Can you post the full log?

---

<div class="post-metadata">

**Author:** ![spencer2023](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@spencer2023](https://root-forum.cern.ch/u/spencer2023)\
**Post date:** [December 8, 2023, 3:24am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/4 "2023-12-08T03:24:23Z")

</div>

@hschindl @mdessole  
I just try to verify the loading process. See the code as below.

#include

#include

#include

#include \<TApplication.h\>

#include \<TCanvas.h\>

#include \<TH1F.h\>

#include “Garfield/ComponentComsol.hh”

#include “Garfield/ViewField.hh”

#include “Garfield/ViewFEMesh.hh”

#include “Garfield/MediumMagboltz.hh”

#include “Garfield/Sensor.hh”

#include “Garfield/AvalancheMicroscopic.hh”

#include “Garfield/AvalancheMC.hh”

#include “Garfield/Random.hh”

using namespace Garfield;

int main(int argc, char \* argv) {

TApplication app(“app”, &argc, argv);

// Load the field map.

ComponentComsol fm;

fm.Initialise(“mesh.mphtxt”, “dielectrics.dat”, “field.txt”, “mm”);

fm.EnableMirrorPeriodicityX();

fm.EnableMirrorPeriodicityY();

fm.PrintRange();

}

Full log:  
ComponentComsol::Initialise: 13004 nodes.  
ComponentComsol::Initialise:  
Error parsing mesh.mphtxt.  
ComponentComsol::UpdatePeriodicityCommon:  
Field map not yet initialised.  
ComponentComsol::UpdatePeriodicityCommon:  
Field map not yet initialised.  
ComponentComsol::PrintRange:  
Dimensions of the elementary block  
0 \< x \< 0 cm,  
0 \< y \< 0 cm,  
0 \< z \< 0 cm,  
0 \< V \< 0 V.  
Periodicities  
x: mirror with length 0 cm  
y: mirror with length 0 cm  
z: none

---

<div class="post-metadata">

**Author:** ![spencer2023](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@spencer2023](https://root-forum.cern.ch/u/spencer2023)\
**Post date:** [December 8, 2023, 6:55am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/5 "2023-12-08T06:55:27Z")

</div>

I just modified the comsol file of the official example and can make the mesh/field file workable.

By the way, I need to set “relative permittivity” with user defined value, it use “from material”. It will pop out error as below during study computation.

 ![Screenshot from 2023-12-08 14-52-44](https://root-forum.cern.ch/uploads/default/original/3X/b/b/bbbc2679032fa311431066d56729b07327eaa0c8.png)  
 ![Screenshot from 2023-12-08 14-54-59](https://root-forum.cern.ch/uploads/default/original/3X/1/4/14ea871a38b626ddd9840b0ddf2efcea03364e51.png)

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [December 8, 2023, 4:08pm UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/6 "2023-12-08T16:08:43Z")

</div>

> [@spencer2023](#):
>
> ```auto
> ComponentComsol::Initialise: Error parsing mesh.mphtxt.
> 
> ```

Looks like `ComponentComsol` encountered a problem reading your `mesh.mphtxt` file. Maybe it’s in a different format than the one expected by `ComponentComsol` (second-order tetrahedra)?

@djjansse have you come across this Comsol error message (“Undefined material property ‘epsilon’ …”)?

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [December 9, 2023, 11:13am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/7 "2023-12-09T11:13:16Z")

</div>

Dear @spencer2023,

On the point of relative permittivity, I believe I have reproduced your case, showing me the same message. You need to provide a relative permittivity to all your materials to be able to solve the system. An example is given in the attached image.

As @hschindl mentioned, the mesh needs to be comprised of second-order tetrahedral elements. Depending on the version of COMSOL you are using, exporting the mesh can be done by right-clicking the mesh object and selecting the export option. Then, you must enable the “export as second-order elements” before writing the .mphtxt file.

I hope this helps.

Kind regards,

Djunes

 ![Screenshot](https://root-forum.cern.ch/uploads/default/original/3X/8/9/89de48083d82ffaa044d58a6871a0080321d175c.png)

---

<div class="post-metadata">

**Author:** ![spencer2023](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@spencer2023](https://root-forum.cern.ch/u/spencer2023)\
**Post date:** [December 11, 2023, 10:21am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/8 "2023-12-11T10:21:51Z")

</div>

Yes. I did find similar case and follow that instruction. But it does not work.

---

<div class="post-metadata">

**Author:** ![spencer2023](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@spencer2023](https://root-forum.cern.ch/u/spencer2023)\
**Post date:** [December 11, 2023, 10:24am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/9 "2023-12-11T10:24:04Z")

</div>

All relative permittivity value have been filled. But not help. Version is 6.2. Build 290

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [December 25, 2023, 10:24am UTC](https://root-forum.cern.ch/t/componentcomsol-field-map-not-yet-initialised/57431/10 "2023-12-25T10:24:26Z")

</div>

Closed on December 25, 2023, 10:24am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
