Multithreading application hangs for particular opticalSurface definition

Dear G4 users,

I’m running a very simple example consisting of gamma rays going through on an optical fibre from which I’m detecting Cherenkov light production.
The optical fibre consists in three layers:
-Silica core
-Silica Cladding
-Aluminium coating

I define optical surface between core and clad and between clad an coat as follows:

  // Surface between core & clad
  coreCladSurface = new G4OpticalSurface("coreCladSurface");
  coreCladSurface->SetType(dielectric_dielectric);
  coreCladSurface->SetFinish(ground);
  coreCladSurface->SetModel(unified);

  // Surface between core & coating
  cladCoatSurface = new G4OpticalSurface("cladCoatSurface");
  cladCoatSurface->SetType(dielectric_metal);
  cladCoatSurface->SetFinish(ground);
  cladCoatSurface->SetModel(unified);

  G4MaterialPropertiesTable * mptSurfaceCoreClad = new G4MaterialPropertiesTable();
  G4MaterialPropertiesTable * mptSurfaceCladCoat = new G4MaterialPropertiesTable();
  
  mptSurfaceCoreClad->AddProperty("REFLECTIVITY", energy, reflectivityClad, 2);
  mptSurfaceCladCoat->AddProperty("REFLECTIVITY", energy, reflectivityCoat, 2);

  coreCladSurface->SetMaterialPropertiesTable(mptSurfaceCoreClad);  
  cladCoatSurface->SetMaterialPropertiesTable(mptSurfaceCladCoat);

  G4LogicalSkinSurface *skinCore = new G4LogicalSkinSurface("skinCore", logicFiberCore, coreCladSurface); 
  G4LogicalSkinSurface *skinClad = new G4LogicalSkinSurface("skinClad", logicFiberClad, cladCoatSurface); 

I’ve noticed that my simulations are stucked when I define a polished surface Surface->SetFinish(polished) (by setting /run/printProgress x, every simulations being run on 20 threads ) :

  • Launching 500 run get me stucked on the 200th run
  • 5000 runs get me stucked at the 2800th run
  • 30000 runs get me stucked at the 18000th run and so on… every time I increase the total number of run, G4 seems to manage to complete a larger amount of runs than when I tell it to simulate fewer runs.

When I set a ground surface Surface->SetFinish(ground) the calculations run perfectly fine in a few seconds.

I know that it’s not mandatory to define an optical surface as long as we want the interface to be perfectly smooth with refractive index defined in both volumes at each side of the interface, but even with no optical surface definition, my simulations get stuck…
I have the same problem by defining G4LogicalBorderSurface instead of G4LogicalSkinSurface.

I guess it’s either a problem with multi-threading, even if I get the same problem with single thread ?

If you have any hint on how to check where does this problem comes from or if you think there is a mistake somewhere else, could you please help me with that ?

Thank you for your help,
Geogeo

Since you see this behaviour with any type of polished surface, and not with ground, it may simply be that the optical photon is bouncing back and forth between two perfectly reflecting surfaces. You should see it with tracking/verbose 1. In practice, get around this by defining some absorption in the materials.

2 Likes

I must agree; it was observed by me as well. Ideal mirrors, tight spaces, and bad luck with the incident angle produce such odd latchups.

Indeed by setting a finite absorption length all my runs do complete, thank you for your help.

However I still don’t understand why my simulation succeeded to run 20000 successfully when I’ve defined /run/beamOn 50000 but still hang at 4000 when I’ve defined /run/beamOn 5000 do you have any explanations ?

Thank you,
Geogeo

could it be the distribution of event IDs to particular worker threads depends on the total number of events of the run? then the state of the random number generator would be different (identical seeding assumed!)

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