Dear collegues,
I have a question regarding the implementation of composite materials in Geant4. I am currently working at the realization of an hybrid scintillating material, consisting of an amorphous matrix (lead glass) containing fragments of common scintillators (LYSO, CsI,…). I want to reproduce this material in a Geant4 simulation. At the first order, my matrix can be described as a 2x2x20cm3 lead-glass parallelepiped filled with randomly distributed spheres (the scintillating fragments), with a 0.5 mm radius. I am trying to implement this geometry in Geant4 randomly generating the positions of the spheres within the parallelepiped. However, since I want to reach high volume fractions of scintillators, I am struggling with volumes overlap (with a high number of spheres, it is very likely to have superpositions). In order to overcome the overlap issue, I tried the G4SubtractionSolid strategy: I recursevely subtracted spheres to the parallelepiped (to then implement the “pitted” lead glass parallelepiped in a scintillating mother volume) with this function:
G4VSolid* currentSolid;
while (...){
currentSolid = new G4SubtractionSolid("BoxWithHoles", currentSolid, sphere, nullptr, spherePosition);
}
Unfortunately, the code will produce a segmentation fault if the sphere number on which I am iterating is above a certain threshold. Can anyone help me with that?
Hello, thank you very much for your reply. I already tried something similar, but my problem is that I have to place a very large number of spheres (I want the scintillating fragments to have a volume fraction of at least 30%), therefore the computational time is too large. Do you think that the procedure I described above can somehow work?
Hello! If I understand correctly, you need to place ~30000 spheres. Constructing a boolean solid with that many holes is not very good idea, the simulation will be extremely slow.
But you can speed up the placement of spheres by using one of the following approaches:
Generate required number of non-intersecting spheres and save their positions in a file;
Keep the array with the positions of spheres sorted in Z direction, and use the binary search to select candidates for overlap check;
Let imaging that the parallelepiped is subdivides into 20x20x200 cells, then instead of generating a random position, you can randomly select a cell where to place a sphere.
There is another solution that allows to quickly fill the parallelepiped with 30000 spheres, namely storing positions in several std::vector instead of one. In the attachment you can find DetectorConstruction.cc and vis.mac (rename the attached vis.mac.txt) for the example B1:
Thank you very much,
this solution is actually very efficient! Do you think it is a suitable strategies for even higher concentration? (I would like to reach a 60% volume fraction occupied by the spheres). Thank you very much again
If subdivide the parallelepiped into 80.000 cubic cells (1x1x1 mm^3) and fill all of them with spheres then the spheres will occupy 52% of the volume. In case if the spheres are placed randomly then, I think that they will occupy even less fraction.
Maximum possible fraction is ~74%. It’s reachable if apply a special close-packing. The 60% volume fraction can be achieved by applying such packing and then randomly removing some spheres.
Alternatively, you can swap the materials for the parallelepiped and spheres. I mean, to specify the scintillator as the material for the parallelepiped, and then place spheres with the lead glass there.