Message: Re: Electric potential / non-uniform electric field Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Electric potential / non-uniform electric field 

Forum: Fields: Magnetic and Otherwise
Re: None Electric potential / non-uniform electric field (Hannele)
Re: None Re: Electric potential / non-uniform electric field (John Apostolakis)
Date: 18 Sep, 2007
From: Hannele <hatueron@jyu.fi>

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:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: Electric potential / non-uniform electric field   (Peter Gumplinger - 26 Sep, 2007)
 Add Message Add Message
to: "Re: Electric potential / non-uniform electric field"

 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 ]