Message: eIoni process in E-field returns nan, crashes simulation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question eIoni process in E-field returns nan, crashes simulation 

Forum: Fields: Magnetic and Otherwise
Date: 08 Apr, 2016
From: Jayson Vavrek <Jayson Vavrek>

Hi all,

I'm using geant4-10-00-patch-02 to simulate photon transport through metal targets. In a simplified geometry I have a spectrum of photons incident on a single layer of metal foil (logical volume foil_1_L) that is enclosed completely by a mother logical volume (theFoil_L) that I use to enclose the foil layers for more complicated setups.

I have attached a uniform E-field to theFoil_L to accelerate the electrons downbeam (in the x+ direction) with the following code:

  fEMfield = new G4UniformElectricField(G4ThreeVector(-1000.0*kilovolt/cm,0.0,0.0));

  // Create an equation of motion for this field
  fEquation = new G4EqMagElectricField(fEMfield); 
  G4int nvar = 8;
  fStepper = new G4ClassicalRK4( fEquation, nvar );   

  // create a new field manager
  fFieldManager = new G4FieldManager();

  // Set this field to the new field manager 
  fFieldManager->SetDetectorField(fEMfield );
  fMinStep     = 0.1*cm ; // minimal step of 0.1 cm
  fIntgrDriver = new G4MagInt_Driver(fMinStep, fStepper, fStepper->GetNumberOfVariables() );
  fChordFinder = new G4ChordFinder(fIntgrDriver);
  fFieldManager->SetChordFinder( fChordFinder );
  fFieldManager->SetDeltaOneStep( 0.1*cm );

  ...<definition of geometries>...

  // apply the electric field across the foil
  theFoil_L->SetFieldManager(fFieldManager, true);

Now, regardless of the field value I enter—even 0!—the simulation eventually comes to a halt when an eIoni process returns nan for several values of the G4Track (shown here using /stepping/verbose 2):

* G4Track Information:   Particle = gamma,   Track ID = 1,   Parent ID = 0

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0   -1e+03        1        1      2.38        0        0         0    TheWorld initStep
    1      990        1        1      2.38        0 1.99e+03  1.99e+03  foilLayer1 Transportation
    2    1e+03        1        1     0.316        0     9.61     2e+03  foilLayer1 compt
    :----- List of 2ndaries - #SpawnInStep=  1(Rest= 0,Along= 0,Post= 1), #SpawnTotal=  1 ---------------
    :     1e+03         1         1      2.07                 e-
    :----------------------------------------------------------------- EndOf2ndaries Info ---------------

* G4Track Information:   Particle = e-,   Track ID = 2,   Parent ID = 1

Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
    0    1e+03        1        1      2.07        0        0         0  foilLayer1 initStep
    1    1e+03      1.1    0.943       nan      nan      nan       nan  foilLayer1 eIoni

Here I have also offset the beam axis by 1 mm in the y- and z-directions as an earlier post suggested that 0 coordinates may be causing the problem.

Without the E-field, I've run upwards of 10^13 photons with no problem. With the E-field in place—again, even if its strength is 0—the code typically crashes after 10^4 events. Have I coded something incorrectly in the setup of the field? Or is this a known bug? I have seen a few similar questions on the forums but no clear resolution.

Thanks, Jayson V.

 Add Message Add Message
to: "eIoni process in E-field returns nan, crashes simulation"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]