| Message: Re: Electric potential / non-uniform electric field | Not Logged In (login) |
|
Dear John, I searched for the answers in the previous messages to the forum, but unfortunately in vain. I maybe expressed myself not entirely exactly. What I meant by "adding a field to component" should have been "defining the field inside a volume". I have used an example from /advanced/purging_magnet to define a non-uniform magnetic field which is read from file containing information about the field. In order to do the same with the non-uniform electric field I have made a "conversion" of the magnetic field to electric (as shown below) feeding to the program a file with information about the electric field:
G4ThreeVector positionEl3Field = G4ThreeVector(0,0,1*m);
G4double fieldValueEF3 = 0.2*kilovolt/cm;
G4FieldManager *pFieldMgrEF3;
//Field grid in A9.TABLE. File must be in accessible from run urn directory.
G4ElectricField* PurgEl3Field= new TabulatedElField2D3D("MMPS_in_edit.txt", 0,0,0);
pFieldMgrEF3=G4TransportationManager::GetTransportationManager()->GetFieldManager();
G4cout<< "DeltaStep "<<pFieldMgrEF3->GetDeltaOneStep()/mm <<"mm" <<endl;
G4EqMagElectricField *myEquationEF3 = new G4EqMagElectricField(PurgEl3Field);
G4int nvar3 = 8; // Need to integrate 8 variables: x,y,z,p[xyz],E,t
G4MagIntegratorStepper* myStepperEF3 = new G4ClassicalRK4(myEquationEF3,nvar3);
G4MagInt_Driver* myIntgrDriverEF3 = new G4MagInt_Driver(1.0e-3*mm, myStepperEF3,
myStepperEF3->GetNumberOfVariables());
G4ChordFinder* myChordFinderEF3 = new G4ChordFinder(myIntgrDriverEF3);
pFieldMgrEF3->SetDetectorField(PurgEl3Field);
bool fieldIsInitialized = true; Here, MMPS_in_edit.txt is the file with the electric field components (x,y,z,E). The program compiles, however, when I try to run it, the program returns "Segmentation fault" and quits without giving a hint of what could go wrong. I would really appreaciate if you help me with this problem, Thank you. |
| Inline Depth: | Outline Depth: | Add message: |
|
to: |