Message: Re: Electric Field does not work... Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Electric Field does not work... 

Keywords: Electric Field
Forum: Fields: Magnetic and Otherwise
Re: Question Electric Field does not work... (Dai ho Ko)
Date: 31 Aug, 2004
From: John Apostolakis <John Apostolakis>

Dear Dai ho Ko,

I believe that I can point out a problem with your proposed Electric field class. Fixing this will improve the program's results.

On looking at your code, I noticed that it does not follow the convention we created for the electromagnetic field components:

 - Components 0, 1 and 2 are reserved for the Magnetic Field.
 - Components 3, 4 and 5 are reserved for the Electric field.

Such a convention is required between a field and its corresponding equation of motion -- and the above is the one that we chose.

This convention used in the relevant equation of motion classes: 
  G4EqMagElectricField.cc  for the combined electro-magnetic field
  G4Mag_UsualEqRhs.cc  	   for the 'pure' magnetic field

Please change your code

  void ExN03Field::GetFieldValue(const double Point[3],double *Bfield) const
  {
    Bfield[0] = 0.;
    Bfield[2] = 0.;
    if(Point[2]>0.0 )
    { Bfield[1] = Bz; }
    else
    { Bfield[1] = 0.; }
  }

so that it puts the electric field components in Bfield[3], [4] & [5], and sets components [0], [1] and [2] to zero.

As an example, see the class G4UniformElectricField.cc (eg at URL http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/src/G4UniformElectricField.cc )

 88 // ------------------------------------------------------------------------
 89 
 90 void G4UniformElectricField::GetFieldValue (const G4double[4],
 91                                             G4double *fieldBandE ) const 
 92 {
 93    fieldBandE[0]= 0.0;
 94    fieldBandE[1]= 0.0;
 95    fieldBandE[2]= 0.0;
 96    fieldBandE[3]= fFieldComponents[3] ;
 97    fieldBandE[4]= fFieldComponents[4] ;
 98    fieldBandE[5]= fFieldComponents[5] ;
 99 }

Best regards, John Apostolakis

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Electric Field does not work...   (Dai ho Ko - 31 Aug, 2004)
 Add Message Add Message
to: "Re: Electric Field does not work..."

 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 ]