ComponentComsol::ElectricField: Field map not yet initialised

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.

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?


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

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




#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”);





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

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-54-59

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’ …”)?

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,


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

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

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