Message: Re: Getting NAN for values of Point in a magnetic field class  Not Logged In (login) 
So it turns out the NAN problem was entirely a result of trying to calculate the field at the origin. Thanks for noticing that! However, there is still some weird behaviour. The main problem is that when I set the field to a constant value, after the first step it no longer remains constant (though only slightly different). For example:
x, y, z: 20.5879; 18.6825; 19.6499 sin(theta), cos(phi): 0.816612; 0.740544 Br, Btheta, Bphi: 0; 1e05; 0 Bx, By, Bz: 4.27432e06; 3.87874e06; 8.16612e06 previous Bx, By, Bz: 4.27432e06; 3.87874e06; 8.16612e06 x, y, z: 27.5898; 24.5526; 26.1012 sin(theta), cos(phi): 0.816644; 0.747029 Br, Btheta, Bphi: 0; 1e05; 0 Bx, By, Bz: 4.31141e06; 3.83679e06; 8.16644e06 <
(next step) 1 29.5 25 23.5 0.99 0.00685 45.4 45.4 hallPhys eIoni
previous Bx, By, Bz: 0.9341733459286579; 0.1875870402351953; 0 < x, y, z: 29.51563709455589; 25.02548071971535; 23.5374965955675 sin(theta), cos(phi): 0.8543663692038602; 0.762739708814276 Br, Btheta, Bphi: 0; 1e05; 0 Bx, By, Bz: 3.963738238545995e06; 3.360742461663736e06; 8.543663692038603e06 < previous Bx, By, Bz: 0.06666666666666667; 1.086944420850742e322; 1.491668146240041e154 < x, y, z: 34.91789711328752; 29.70973367563871; 29.3859584436884 sin(theta), cos(phi): 0.8419042269305184; 0.7616214773706649 Br, Btheta, Bphi: 0; 1e05; 0 Bx, By, Bz: 4.109914943017864e06; 3.496902404816453e06; 8.419042269305184e06 previous Bx, By, Bz: 4.109914943017864e06; 3.496902404816453e06; 8.419042269305184e06 This also highlights an instance of the values initially stored in the field matrix not matching what they were previously set to. This only seems to happen around the beginning of a new step (including at the very start of the simulation, where it contains very small nonzero values). Do you know what could be causing this, and does it seem like a problem? I'm not sure if these values are used for anything after being changed, or are just sitting idly in the matrix before being recalculated. Other than that, you mentioned that problems may be arising because I'm using an unphysical field/particle setup. Just for the sake of the simulation, shouldn't I be able to simulate a physically impossible field (such as a magnetic monopole)? Or does the G4 particle tracking rely on a field that more or less satisfies Maxwell's equations?
Many thanks, Aaron

Inline Depth:  Outline Depth:  Add message: 
to: 