Problem with mesh produced by mesh_converter

Hi,

I’ve recently been having some problems with the mesh_converter and allpix-squared, and have been in correspondence with Simon and Radek Privara regarding how I might overcome my problems. At the request of Simon, I’ve moved the discussion from the CERN e-mail service to this forum for better communication.

I’m a fairly new user of allpix and I’ve been trying to analyse a set of TCAD files one of my colleagues has produced. I’m going through the standard process of running it through mesh_converter before trying to get allpix to analyse it. Running it through mesh_converter doesn’t cause any problems. My mesh_converter config file looks like this:

#log_level: Defining the verbosity of the output
log_level = “STATUS”

#model: Choose to create a .apf or .init file
model = apf

#region: Take the region to be analysed from the .grd file
region = “Substrate”

#observable: Take the observable to be analysed from the .dat file
observable = “ElectrostaticPotential”

#xyz: Define the coordinate system
xyz = x y z

#divisions: Define the granularity of the new mesh
divisions = 10000 10000

#observable_units:
observable_units = V/cm

#orkers: The amount of threads the program should use
workers = 10

Nothing special, right? However, when I try to run over the resulting .apf file with allpix it gives this error:

|06:26:10.828| (FATAL) [I:ElectricFieldReader:detector1] Error in the configuration:
Value “TCAD_fields/stripedge_weighting_ElectrostaticPotential.apf” of key ‘file_name’ in section ‘ElectricFieldReader’ is not valid: invalid data
The configuration needs to be updated. Cannot continue.

I’m not really sure how to read this error message. It seems to be implying that the file is bad, even though mesh_converter doesn’t complain when creating it. I’ve looked at the .apf file itself and it doesn’t look different from the others I have. I tried to make a .init file using the same config file, but it took 2 hours to get to 10%, then the job was cancelled by lxplus for taking up too much memory.

I’ve already mentioned this to Radek, and his first hypothesis was that something was wrong with the dimension of the field. I’m not exactly sure what this means, but the relevant lines in the TCAD files mention that the simulation is two dimensional, and you can see in the above config file that I use two dimensions for the divisions, so I wouldn’t know where it’s going wrong.

If any of you could provide some insight regarding where you think it’s going wrong I would be grateful.

Cheers,
Damir

P.S: For completeness. here’s the config file I’m using with allpix. The “test-geometry” you see in the “detectors_file” field is just a timepix I’m currently using as a placeholder, it shouldn’t be causing any problems.

[Allpix]
number_of_events = 1
detectors_file = “experiment/test-geometry.conf”
log_level = “DEBUG”

[GeometryBuilderGeant4]

[DepositionGeant4]
particle_type = “e-”
source_energy = 5GeV
source_type = “beam”
beam_size = 3mm
source_position = 0 0 -200mm
beam_direction = 0 0 1
physics_list = FTFP_BERT_EMZ
output_plots = true

[ElectricFieldReader]
model = “mesh”
file_name = “experiment/stripedge_weighting_ElectrostaticPotential.apf”
output_plots = true

[GenericPropagation]
temperature = 293K
output_plots = true

[SimpleTransfer]
output_plots = true

[DefaultDigitizer]
output_plots = true

[DetectorHistogrammer]

Hi @damir

the problem is

observable = "ElectrostaticPotential"

You do not want the potential (which is a scalar field) but the electric field (a vector field with direction of the efield vectors). The APF file you produce contains a scalar field, but your electric field reader tries to read a vector field from it → invalid data.

Cheers,
Simon

PS: the detectors_file should not be a model file but a geometry description of your setup. From your statement above could be interpreted as pointing it to a model file of timepix.

Hi,

Thanks for this. I’ve looked into the TCAD files and have found that there are only two observables listed: “ElectrostaticPotential” and “WeightingPotential”. From my discussions with the colleague who provided the files I honestly just thought that “ElectrostaticPotential” was what I wanted.

Just for fun, I decided to try and run allpix over the “WeightingPotential” variable instead to see if I can make something out of it:

[Allpix]
number_of_events = 1
detectors_file = “configurations/test-geometry.conf”
model_paths = “/eos/user/d/damir/ALLPIX2_Remote/Experiment/configurations”
log_level = “DEBUG”

[GeometryBuilderGeant4]

[DepositionGeant4]
particle_type = “e-”
source_energy = 5GeV
source_type = “beam”
beam_size = 3mm
source_position = 0 0 -200mm
beam_direction = 0 0 1
physics_list = FTFP_BERT_EMZ
output_plots = true

#[ElectricFieldReader]
#model = “mesh”
#file_name = “TCAD_fields/stripedge_weighting_ElectrostaticPotential.apf”
#output_plots = true

[WeightingPotentialReader]
model = “mesh”
file_name = “TCAD_fields/stripedge_weighting_ElectrostaticPotential.apf”
output_plots = true

[GenericPropagation]
temperature = 293K
output_plots = true

[SimpleTransfer]
output_plots = true

[DefaultDigitizer]
output_plots = true

[DetectorHistogrammer]

This only gave me a different error:

|05:31:08.399| (FATAL) [I:WeightingPotentialReader:detector1] Error in the configuration:
Value “TCAD_fields/stripedge_weighting_ElectrostaticPotential.apf” of key ‘file_name’ in section ‘WeightingPotentialReader’ is not valid: Unphysical weighting potential detected, found -0.000040 < phi < 0.000000, expected 0 < phi < 1
The configuration needs to be updated. Cannot continue.

Unless anyone can give me a reason not to, I’m going to take this error at face-value and say that the TCAD files I’m using are broken.

Hi,

I have never seen a TCAD file containing the weighting potential directly. We normally produce two different simulations, use the electrostatic potential and calculate the different between the version and then normalize to 0…1.

Cheers,
Simon

Hi,

Looking more deeply into it, I’m even more confused. The TCAD files have “WeightingPotential” defined as a dataset, but when I try to use it as the observable in the mesh_converter config file, it gives me this:

|07:04:46.877| (FATAL) Fatal internal error
No matching region with observable “WeightingPotential” found in field file
Cannot continue.

I guess you’re right in saying that the WeightingPotential needs to be calculated using a separate method. The colleague of mine who made the TCAD files said they should be fine, but I guess I’ll have to have a more detailed conversation with him about how he produced these files in the coming days.

I actually made a mistake in my previous post. I tried to use the ElectrostaticPotential field as the file for the WeightingPotential. Obviously this shouldn’t work, but since I can’t make an .apf file with the WeightingPotential I guess the files still aren’t usable.

Cheers,
Damir