|Message: Re: Getting NAN for values of Point in a magnetic field class||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
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!
|Inline Depth:||Outline Depth:||Add message:|