Message: Re: Getting NAN for values of Point in a magnetic field class Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Getting NAN for values of Point in a magnetic field class 

Forum: Fields: Magnetic and Otherwise
Re: None Getting NAN for values of Point in a magnetic field class (Aaron Liblong)
Re: Feedback Re: Getting NAN for values of Point in a magnetic field class (Gumplinger Peter)
Re: None Re: Getting NAN for values of Point in a magnetic field class (Aaron Liblong)
Date: 17 Jul, 2012
From: Gumplinger Peter <Gumplinger Peter>

Aaron,

What happens when you start your track from a random location in a random direction?

> Step#    X(mm)    Y(mm)    Z(mm) KinE(MeV)  dE(MeV) StepLeng TrackLeng  NextVolume ProcName
>     0        0        0        0         1        0        0         0    hallPhys initStep

Ok, so this is the start position.

> previous Bx, By, Bz: 1.38137e-314; 6.94803e-310; 6.95317e-310

I don't know why your 'previous B' is not exactly zero the first time its accessed.

> x, y, z: 0; 0; 0

Ok, that's what we want to see

> Br, Btheta, Bphi: 0.0001; 0; 0
> Bx, By, Bz: -nan; -nan; -nan

Your B-field can only be exactly zero on axis. The axis is a singularity and you can't calculate a Bx etc. Everywhere else, for Br>0, Btheta=0, and Bphi=0, Bx=Br*cos(phi), By=Br*sin(phi), Bz=0.

> x, y, z: 842.349; 842.349; 842.349

ok, the RungeKutta step attempt is to this location.

> One of x, y, or z is NAN: set Bx = By = Bz = 0

I don't see any of the x, y, z is Nan?

Anyway, a locatation exactly 0,0,0 and direction exactly 1,1,1 is unphysical. I suggest you start at a random position near zero and random direction near the diagonal.

In any event, you must take care to return correct B-field values for all coordinates.

Your simualtion is not even succeeding in doing one single step. This is not a G4 issue but one having to do with your Bfield setup. Your Bfield has to satisfy Maxwells Equations!

Peter

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

1 None: Re: Getting NAN for values of Point in a magnetic field class   (Aaron Liblong - 18 Jul, 2012)
(_ Feedback: Re: Getting NAN for values of Point in a magnetic field class   (Gumplinger Peter - 18 Jul, 2012)
 Add Message Add Message
to: "Re: Getting NAN for values of Point in a magnetic field class"

 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 ]