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

None 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)
Date: 17 Jul, 2012
From: Aaron Liblong <Aaron Liblong>

Thanks for the quick response!

Alright, so this is a run with an initial electron trajectory of (1,1,1), from the origin. The magnetic field is constant in the direction of r so it should have no effect on the particle, which is travelling in the direction of r. Whenever I get NAN values for the x, y, or z coordinates, I set the field equal to 0 (just as a temporary means of avoiding passing NAN values to the field matrix). I've output the value of the (x,y,z) coordinates when they are not NAN, values of sin(theta) and cos(phi) just to see if these calculations are working, and the values of the field in both spherical and cartesian coordinates:

*********************************************************************************************************
* 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        0        0         1        0        0         0    hallPhys initStep
previous Bx, By, Bz: 1.38137e-314; 6.94803e-310; 6.95317e-310
x, y, z: 0; 0; 0
sin(theta), cos(phi): -nan; -nan
Br, Btheta, Bphi: 0.0001; 0; 0
Bx, By, Bz: -nan; -nan; -nan
previous Bx, By, Bz: 7.41034e-315; 1.97626e-323; 1.49167e-154
x, y, z: 842.349; 842.349; 842.349
sin(theta), cos(phi): 0.816497; 0.707107
Br, Btheta, Bphi: 0.0001; 0; 0
Bx, By, Bz: 5.7735e-05; 5.7735e-05; 5.7735e-05
previous Bx, By, Bz: 5.7735e-05; 5.7735e-05; 5.7735e-05
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 0; 0
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 6.94802e-310; 6.94784e-310
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 6.95317e-310; 6.94802e-310; -nan
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 0; 0
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 0; 0
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 0; 0
x, y, z: 1684.7; 1684.7; 1684.7
sin(theta), cos(phi): 0.816497; 0.707107
Br, Btheta, Bphi: 0.0001; 0; 0
Bx, By, Bz: 5.7735e-05; 5.7735e-05; 5.7735e-05
previous Bx, By, Bz: 5.7735e-05; 5.7735e-05; 5.7735e-05
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 0; 0
One of x, y, or z is NAN: set Bx = By = Bz = 0
previous Bx, By, Bz: 0; 6.94803e-310; 2.122e-314
x, y, z: 84.2349; 84.2349; 84.2349
sin(theta), cos(phi): 0.816497; 0.707107
Br, Btheta, Bphi: 0.0001; 0; 0
Bx, By, Bz: 5.7735e-05; 5.7735e-05; 5.7735e-05

After a slight hiccup at the start (which seems to be the result of having small values for the coordinates; see below), the field remains constant, interspersed with instances of NAN values for the coordinates. As for the path of the particle, it ends up travelling out some distance along (1,1,1), then back toward the origin, then back out, and on and on, with its net movement tending toward the origin. By the end, it reaches absurdly small values for its coordinates; for example:

 x, y, z: 1.44338e-315; 1.44338e-315; 1.44338e-315

 x, y, z: 2.88675e-315; 2.88675e-315; 2.88675e-315

 x, y, z: 1.44338e-316; 1.44338e-316; 1.44338e-316

Additionally, at this point, despite having numerical values for the coordinates, the calculation of other quantities returns NAN. For example:

 x, y, z: 2.88675e-202; 2.88675e-202; 2.88675e-202
sin(theta), cos(phi): nan; 0.707107
Br, Btheta, Bphi: 0.0001; 0; 0
Bx, By, Bz: nan; nan; nan
previous Bx, By, Bz: nan; nan; nan

This only occurs for very small values of (x,y,z), including 0.

Hopefully that helps. If not, please let me know what more information I can provide.

Thank you,
 Aaron

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   (Youming Yang - 17 Jul, 2012)
2 Feedback: Re: Getting NAN for values of Point in a magnetic field class   (Gumplinger Peter - 17 Jul, 2012)
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 ]