[fluka-discuss]: Sampling direction cosines with SOURCE is buggy 5 times out of 10

From: Primidis, Thomas <Thomas.Primidis_at_liverpool.ac.uk>
Date: Tue, 29 Oct 2019 01:46:22 +0000

Dear forum,


I am using source.f to describe an x-ray source. I am assigning x and y direction cosines and then I calculate z direction cosine by cz=sqrt(ONEONE-cx**2-cy**2). After that calculation, I test whether the final sum of squares is still .EQ. ONEONE and if not I repeat the sampling until the condition is satisfied. For the record, I sample the photon position (x,y,z) on the XY plane and I assume an x-ray virtual point origin at Z=-2mm thus the direction vector (cx,cy,cz)=(x,y,z)/sqrt(x**2+y**2+z**2), with cz actually calculated via sqrt(1-cx**2-cy**2) to force cx**2+cy**2+cz**2.EQ.ONEONE.


I am counting how many times the sampling is incorrect&repeated and I have seen that 50% of the time the initial sampling is incorrect. I believe this causes particular angles to not be sampled which might be the reason for a beam that looks like the one attached. I can confirm that the XY plane position is sampled correctly because if I force cz=ONEONE and the rest ZERZER, the figure is a smooth as expected (smaller) disk. But when I sample the angles, these radial steps emerge.


When the sampling is repeated its because the sum of the squares is slightly different than ONEONE. Repeating the normalisation (cx,cy,cz)=(cx,cy,cz)/sqrt(cx**2+cy**2+cz**2) and recalculating cz, results in infinite loops with this as the result of the sum of squares:

First calculation

0.99999999999999989
After renormalisations
0.99999999999999989
0.99999999999999989
0.99999999999999989
1.0000000000000002
1.0000000000000002
1.0000000000000002
1.0000000000000002
...
...
Is there a workaround for this issue?


Best regards,

Thomas




__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info

textimageIDEAL.jpg
(image/jpeg attachment: textimageIDEAL.jpg)

Received on Tue Oct 29 2019 - 04:16:34 CET

This archive was generated by hypermail 2.3.0 : Tue Oct 29 2019 - 04:16:38 CET