[neutron-mc] Re: sqrt: DOMAIN error

Emmanuel Farhi farhi at ill.fr
Fri Sep 12 10:12:29 CEST 2003


Hy Philip,

I have looked at that 'sqrt: DOMAIN error' error printed while running your
simulation.
I could not reproduce it on my Dec Compaq computer, but I think I know what is
the reason for the error.

Indeed, it may come from the lib/share/mcstas-r.c:mcestimate_error function
while computing the intensity error estimate.
If your computer does not handle 'double' numbers with enough digits (64
bytes), then an error is reported when computing the sqr and then the sqrt.
This is, I think, a numerical over or under flow depending on the number
accuracy of your system.

To test that, you may, for instance, divide your source flux by, say 10^10.

Cheers, Emmanuel.

Philip Wilk wrote:

> Dear Emmanuel,
>
> I have also found the same error when using the Monitor_nD component. The
> output from the monitor looks fine and seems to be accurate, but the DOMAIN
> error is troubling.
>
> The monitor dimentions are small in this example, but I get the error with a
> larger monitor as well. I call the component with the following code (one
> example):
>
> ----- begin -------
> COMPONENT lambda_end2 = Monitor_nD(
>  xmin = -0.002, xmax = 0.002,
>  ymin = -0.002, ymax = 0.002,
>  options="lambda bins=50 auto limits",
>  filename="erg5.dat")
>    AT (0, 0, 3.05) RELATIVE cguide ROTATED (0, 0, 0) RELATIVE cguide
> ----- end -------
>
> And the following is the output to the screen while running a simulation
> with 10^9 neutrons and a series of 8 wavelength monitors via the Monitor_nD
> component:
>
> ----- begin -------
> sqrt: DOMAIN error
> Detector: lamda_begin_I=3.11197e+17 lamda_begin_ERR=1.92993e+13
> lamda_begin_N=3.
> 63473e+08 "erg1.dat"
> Detector: lambda_middle_I=3.95513e+16 lambda_middle_ERR=6.03749e+12
> lambda_middl
> e_N=1.68336e+08 "erg2.dat"
> Detector: lambda_middle2_I=1.43218e+16 lambda_middle2_ERR=3.13988e+12
> lambda_mid
> dle2_N=1.08399e+08 "erg3.dat"
> Detector: lambda_end1_I=3.4155e+14 lambda_end1_ERR=4.58569e+11
> lambda_end1_N=1.6
> 5878e+06 "erg4.dat"
>
> sqrt: DOMAIN error
> Detector: lambda_end2_I=3.87996e+14 lambda_end2_ERR=4.8729e+11
> lambda_end2_N=1.8
> 729e+06 "erg5.dat"
> Detector: lambda_end3_I=4.37953e+14 lambda_end3_ERR=5.27462e+11
> lambda_end3_N=1.
> 39967e+06 "erg6.dat"
>
> sqrt: DOMAIN error
> Detector: lambda_end4_I=3.60408e+14 lambda_end4_ERR=5.30696e+11
> lambda_end4_N=75
> 1711 "erg7.dat"
>
> sqrt: DOMAIN error
> Detector: lambda_end5_I=2.45439e+14 lambda_end5_ERR=4.64571e+11
> lambda_end5_N=44
> 5504 "erg8.dat"
> ----- end -------
>
> Regards,
> Philip
>
> ----- Original Message -----
> From: Emmanuel Farhi
> To: pwilk-radiochem at hahnium.com ; neutron-mc at risoe.dk
> Sent: Tuesday, August 26, 2003 3:17 PM
>
> Hy Philip,
> You probably have some zero velocity neutrons or such huge velocities that
> the square gets hawfull (before getting the sqrt), else I can not figure out
> how the 'sqrt' can fail in the speed in L_monitor.comp.
> You may copy this component locally and change the line #76 so that it tests
> the speed norm to be non zero or reasonable value (not huge).
> You may also try replacing with the Monitor_nD(options="auto lambda",
> filename="...")
> Cheers, Emmanuel.
>
> Philip Wilk wrote:
> Hi,
> I am using the new version 1.7
> I keep getting "sqrt: DOMAIN error"
> Just like I was getting with version 1.6.4 , should I be worried about this?
> It seems to be associated with the wavelength detector component.
> See example output:
> Detector: psd_begin_I=75.9887 psd_begin_ERR=0.0701353
> psd_begin_N=3.65191e+06 "p
> sd1.dat"
> Detector: lambda_begin_I=75.9887 lambda_begin_ERR=0.0701353
> lambda_begin_N=3.651
> 91e+06 "erg1.dat"
> Detector: psd_middle_I=6.2552 psd_middle_ERR=0.017862
> psd_middle_N=1.68387e+06 "
> psd2.dat"
> sqrt: DOMAIN error
> Detector: lambda_middle_I=6.2552 lambda_middle_ERR=0.017862
> lambda_middle_N=1.68
> 387e+06 "erg2.dat"
> Detector: psd_middle2_I=1.20321 psd_middle2_ERR=0.00418768
> psd_middle2_N=1.08584
> e+06 "psd3.dat"
> Detector: lambda_middle2_I=1.20321 lambda_middle2_ERR=0.00418768
> lambda_middle2_
> N=1.08584e+06 "erg3.dat"
> Detector: psd_end_I=0.65266 psd_end_ERR=0.002805 psd_end_N=389221 "psd4.dat"
> Detector: lambda_end_I=0.65266 lambda_end_ERR=0.002805 lambda_end_N=389221
> "erg4
> .dat"
> Cheers,
> Philip
> --

--
What's up Doc ?
--------------------------------------------
Emmanuel FARHI, http://www.ill.fr/tas/people/Farhi.html   \|/ ____ \|/
CS-Group ILL4/156, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 20 76 48     \__U_/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20030912/be330f82/attachment.html>


More information about the mcstas-users mailing list