Message: Re: Bug in magnetic field transportation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Bug in magnetic field transportation 

Forum: Fields: Magnetic and Otherwise
Re: Question Bug in magnetic field transportation (Vahe)
Date: 22 Jun, 2011
From: John Apostolakis <John Apostolakis>

The behaviour that you describe for the field class is expected. There 
is no bug, and it does not indicate a problem.

But it shows that you are using either vacuum as the material.

The field is sampled before the volume intersection happens, with a 
proposed step size determined by the physics.  If you have vacuum, then 
the length of the physics step will be very large.

This is why the value of the field is requested at (x,y,z)=(0.0, 0.0, 
250810.0) (mm) and other similar locations.

So the first 12 evaluations are for the first attempted step.
The field module attempts an integration for a step size of 1000,000.0 
mm.  To estimate the integration error it makes two steps of 500000 mm 
each. in addition to the final step of 1000,000.0 mm.

The Runge-Kutta algorithm makes three extra field evaluations, starting 
with the mid-point at 0, 0, 250810.0, in order to estimate the first 
half-step, and so on.

It then uses this straight line to intersect the current volume, and 
finds the intersection at 0, 0, 2810.

The fact that the field must be evaluated at points which are outside 
the current volume is due to the choice of computing the curved path and 
then making the intersection with the (current) volume boundary or its 
sub-volumes' surfaces.

John

On 6/21/11 4:32 PM, Vahe wrote:
>
> *** Discussion title: Fields: Magnetic and Otherwise
>
> I have a simple magnetic volume (box start z = 810 mm end z = 2810 mm).
> I defined the magnetic volume like this
>
> logMagneticBox->SetFieldManager(fieldMgr, true);
>
> where fieldMgr is an object of a class inherited from G4MagneticField. I
> output void BBMagneticField::GetFieldValue(const double Point[3],
> double* Bfield) const
>
> Here is the output of the program when electron passes through the box
> (momentum direction nx = 0, ny = 0 , nz = 1).
>
> *********************************************************************************************************
> * G4Track Information:   Particle = e-,   Track ID = 1,   Parent ID = 0
> *********************************************************************************************************
>
> Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
>      0    0.000    0.000    0.000   499.489    0.000    0.000     0.000       World initStep
>      1    0.000    0.000  810.000   499.489    0.000  810.000   810.000      Magnet Transportation
> Point 0,1,2 = 0.0000 0.0000 810.0000
> Point 0,1,2 = 0.0000 0.0000 250810.0000
> Point 0,1,2 = 0.0000 0.0000 250810.0000
> Point 0,1,2 = 0.0000 0.0000 500810.0000
> Point 0,1,2 = 0.0000 0.0000 500810.0000
> Point 0,1,2 = 0.0000 0.0000 750810.0000
> Point 0,1,2 = 0.0000 0.0000 750810.0000
> Point 0,1,2 = 0.0000 0.0000 1000810.0000
> Point 0,1,2 = 0.0000 0.0000 500810.0000
> Point 0,1,2 = 0.0000 0.0000 500810.0000
> Point 0,1,2 = 0.0000 0.0000 1000810.0000
> Point 0,1,2 = 0.0000 0.0000 810.0000
> Point 0,1,2 = 0.0000 0.0000 1310.0000
> Point 0,1,2 = 0.0000 0.0000 1310.0000
> Point 0,1,2 = 0.0000 0.0000 1810.0000
> Point 0,1,2 = 0.0000 0.0000 1810.0000
> Point 0,1,2 = 0.0000 0.0000 2310.0000
> Point 0,1,2 = 0.0000 0.0000 2310.0000
> Point 0,1,2 = 0.0000 0.0000 2810.0000
> Point 0,1,2 = 0.0000 0.0000 1810.0000
> Point 0,1,2 = 0.0000 0.0000 1810.0000
> Point 0,1,2 = 0.0000 0.0000 2810.0000
>      2    0.000    0.000 2810.000   499.489    0.000 2000.000  2810.000       World Transportation
>      3    0.000    0.000 20000.000   499.489    0.000 17190.000 20000.000  OutOfWorld Transportation
> Run terminated.
> Run Summary
>    Number of events processed : 1
>
> Line 2-11 show some crazy numbers for the track position printed from
> GetFieldValue. Is this a bug or I am doing something wrong?
>
> -------------------------------------------------------------
> Visit this GEANT4 at hypernews.slac.stanford.edu message (to reply or unsubscribe) at:
> http://hypernews.slac.stanford.edu/HyperNews/geant4/get/emfields/183.html

-- 
John Apostolakis
Tel: Office +41-22-767-7239
      Mobile +41-76-242-0801

 Add Message Add Message
to: "Re: Bug in magnetic field transportation"

 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 ]