RE: [fluka-discuss]: Source-Generic distribution

From: Alberto Fasso <fasso_at_mail.cern.ch>
Date: Mon, 17 Feb 2014 15:32:29 +0100

Dear Renata,

let me add another piece of advice.
Apart from the fact that you did not do the right mathematics (as both
Giuseppe and Joachim have pointed out), you should always write your
numbers in double precision (except integers, of course).

So, even assuming that you had the right formula (that you had not), it
should not be written:
FX=(SQRT(X*0.001))*(1/(EXP((X*0.001)/20000)))*156000
but
FX=(SQRT(X*0.001D0))*(1.D0/(EXP((X*0.001D0)/20000.D0)))*156000.D0
or
FX=(SQRT(X*1.D-3))*(1.D0/(EXP((X*1.D-3)/2.D4)))*1.56D5

Note that every number above is written with a decimal point and with
a D in the exponent. You risk to meet unpleasant surprises if you
don't do it.

Alberto


On Mon, 17 Feb 2014, Joachim Vollaire wrote:

> Dear Renata,
>
> To complement what Giuseppe just said, one trick is (for debugging purposes at the beginning) to write an echo in the output file of the energy you sampled (just run 100 particles to avoid creating a monster file) to ensure you have the logic you intent and see the distribution makes sense.
>
> WRITE(LUNOUT,*)
> & 'Energy ',TKEFLK (NPFLKA)
>
> In that case you are not sampling with the correct function as indicated by Giuseppe and (by chance) you ended with an energy greater than 1 MeV which is the upper limit used for the tabulation (see manual) considering the BEAM card you used.
>
> Note that if you sample with a max energy of 1 MeV you should use for the BEAM card something a little greater in the BEAM card to avoid running into that proplem.
>
> Default (command BEAM not requested): not allowed! The WHAT(1) value of the
> BEAM command is imperatively required, in order to set up the
> maximum energy of cross-section tabulations.
>
> Cheers
> Joachim
>
>
> -----Original Message-----
> From: owner-fluka-discuss_at_mi.infn.it [mailto:owner-fluka-discuss_at_mi.infn.it] On Behalf Of Giuseppe Battistoni
> Sent: 17 February 2014 14:17
> To: rleanza_at_lns.infn.it; fluka-discuss_at_fluka.org
> Subject: Re: [fluka-discuss]: Source-Generic distribution
>
> Dear Renata
> samplig a variable (energy in this case) from a given function requires a different mathematics.
> Please study the following lecture from FLUKA courses:
> https://www.fluka.org/free_download/course/dresden2013/Lectures/09_Statistics_and_sampling_1013.pdf
> If you have problems let us know
>
> Giuseppe Battistoni
>
>
> On 2/17/14 12:37 PM, rleanza_at_lns.infn.it wrote:
>> Dear fluka users,
>>
>> I have create a source.f file to simulate an electrons beam. The
>> Kinetic energy change from 0 to 1 Mev according the function:
>> a*sqrt(X)*exp(-(X/b)), where a and b are two constants (a=156000,
>> b=20000). I compile and build the source.f and it is ok.
>> When I try to run, it doesn't work. I'm attaching my source.f file.
>> Could you kindly guide me where the error should be?
>> Best regards,
>>
>
>
> --
> INFN Milano
> via Celoria 16, 20133 Milano, Italy
> tel: +39 02 50317307
> fax: +39 02 50317617
>
>
Received on Mon Feb 17 2014 - 18:38:41 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 17 2014 - 18:38:44 CET