Hi.
I am applying constant Electric Field on each logic volume using FieldManager.
However, applying electric field I want makes simulation killed.
276 auto eFieldDrift = G4ThreeVector(-4.40e-5, 0, 0); // 440 V/cm
277 ApplyElectricFieldToVolume(eFieldDrift, driftLV);
Here is code for applying constant electric field on driftLV while ApplyElectricFieldToVolume is
153 void GarfieldDetectorConstruction::ApplyElectricFieldToVolume(G4ThreeVector value, G4LogicalVolume* volume) {
154
155 if (!volume) return;
156
157 auto eField = new G4UniformElectricField(value);
158 auto eqEM = new G4EqMagElectricField(eField);
159 auto stepper = new G4ClassicalRK4(eqEM);
160 auto driver = new G4MagInt_Driver(1e-6 * mm, stepper);
161 auto chordFinder = new G4ChordFinder(driver);
162
163 auto fieldManager = new G4FieldManager(eField, chordFinder);
164 fieldManager->SetDetectorField(eField);
165
166 fieldManager->SetAccuraciesWithDeltaOneStep(1e-7 * mm);
167
168 volume->SetFieldManager(fieldManager, true);
169
170 G4cout << "E field Applied " << value / (volt / m) << G4endl;
171 G4cout << "E field Applied to " << volume->GetName() << G4endl;
172 }
There is no problem in compile and just applying Electric Field.
./electron.out:E field Applied (-4.4e+13,0,0)V/m to volume: Drift
But program is killed as remaining following log.
/vis/scene/notifyHandlers scene-0
### Run 0 starts.
... set ntuple merging row mode : row-wise - done
... create file : Garfield.root - done
... open analysis file : Garfield.root - done
... open analysis file : Garfield.root - done
--> Event 0 starts.
[1] 9969 killed ./exampleGeant4Interface
When I input
440 * volt / m
to vector, it does same.
Only input number 440 works well but it is not E field I want.
Is there any problem in stepping or anything else? ![]()