Re: [fluka-discuss]: Writting SOURCE user routine generating from file with mixture of particles?

From: <Andrea.Mairani_at_mi.infn.it>
Date: Tue, 12 Nov 2013 21:41:38 +0100

Dear Vahan,
What are the columns #5,6 and 7?
As Mina wrote,
> The problem seems to be in the following line:
>
> * TZFLK (NPFLKA) = SQRT ( ONEONE - TXFLK (NPFLKA)**2
> * & - TYFLK (NPFLKA)**2 )
but you should NOT change it, the problem is that TXFLK (NPFLKA)**2 +
TYFLK (NPFLKA)**2 is greater than 1 (!) in your case and you have the
floating exception....
Cheers,
Andrea





> I commented it out and added:
>
> TZFLK (NPFLKA) = COSZ(I)
>
>
> The above fix gets rid of the core dump but again, I don't know why the
> original line causes a core dump. I have run into this problem before.
> I am sending this response to the list. Maybe someone has an
> explanation (I am neither a FLUKA nor a FORTRAN expert).
>
>
> I ran your project with the 'test.dat' file and produced output files
> (please check the numbers, I didn't look at the source file in detail).
> 3 0.2 0.3 -0.9 -0.2 -0.4 -0.9 0.003
> 1 0.3 -0.3 -0.6 0.5 0.5 -0.3 0.007
> 3 -0.3 -0.3 -0.5 -0.5 -0.9 0.8 0.006
>
>
> I don't think you need the data file to be in the D+/-xx format (from
> your 'test-correct.dat' file). FLUKA itself doesn't write output from
> the first step (scoring particles crossing a boundary (boundaries) in
> this format.
> 1 20D-01 1D-02 -1D+00 -1D-01 1D-01 1D-01 1D-04
> 3 10.2D-01 1.3D-02 -14D+00 -8D-01 1.2D-01 1D-01 1D-03
> 8 20D-01 1D-02 -1D+00 -1.1D-01 1D-01 1D-01 200D-04
> 3 19D-01 10D-02 -18D+00 -1D-01 -1D-01 -1D-01 1D-04
>
> Again, I am not an expert, so I'll leave it to the experts to comment.
>
> Best wishes,
> Mina
>
>
> On 13-11-09 06:36 AM, Vahan Petrosyan wrote:
>> Thanks for reply your answer helped me very much.
>> But I revised my source code and found many LOGICAL mistakes because
>> of which my source routine didn't work at all. Yes it run but it
>> didn't take beam from data file. So.... I corrected my mistakes and
>> now it works as I want.
>>
>> But I have SMALL Problem! Can you help me please?
>> I have DATA FILE in this format: 3 0.2 0.3 -0.9 -0.2
>> -0.4 -0.9 0.003
>> but when I run it crashes with ERROR: "Floating point exception (core
>> dumped)"
>> I read the the lecture
>> https://www.fluka.org/free_download/course/triumf2012/Lectures/AdvancedFluka2012.pdf
>>
>> Where it SAYS:
>> "The code works under IMPLICIT DOUBLE PRECISION for variables in the
>> range (A-H,O-Z). Don’t forget ..D+/-xx (eg
>> 2.3D+00, 7.8D-03) in all numerical settings in user routines, and be
>> careful in passing variables to/from Fluka"
>> ie passed number should be in this form "2.3D+00".
>> So...... I manually crated DATA FILE with this format: 1 20D-01
>> 1D-02 -1D+00 -1D-01 1D-01 1D-01 1D-04
>> and my code worked as I expected.
>> ..................
>> I tried to use DBLE() function in order to convert my array elements
>> to DOUBlE PRECISION when I assign it to the FLUKA variables but it
>> doesn't help...... again the same error appears.
>> ....I do like this....
>> TXFLK (NPFLKA) = DBLE(COSX(I))
>> .....................
>> When I use another DATA FILE where numbers are like this "2.3D+00"
>> format My code WORKS JUST FINE!!!
>>
>> Now I try to convert data in form "2.3D+00" myself using this doc.
>> http://docs.oracle.com/cd/E19957-01/805-4939/z40007437a2e/index.html
>> but can't implement.... the same error appears.....
>> So question how can I convert my DATA file numbers to this "2.3D+00"
>> format using FORTRAN77?
>>
>> Thank You!
>>
>> On 11/8/2013 10:47 PM, nozarm_at_triumf.ca wrote:
>>> Hello Vahan,
>>>
>>> I just tried compiling and running the executable and it worked just
>>> fine.
>>> I defined a new run in your flair project, named testroutine-A with
>>> 1000
>>> primaries per cycle and 5 cycles.
>>>
>>>
>>> Cmd: /usr/bin/nohup /triumfcs/linux/fluka/fluka/default/flutil/rfluka
>>> -M 5
>>> testroutine-A
>>>
>>> produced:
>>>
>>>
>>> -rw-rw-r-- 1 nozarm nozarm 4000238 Nov 8 10:39stroutine-A001.log
>>> -rw-rw-r-- 1 nozarm nozarm 4000238 Nov 8 10:39
>>> testroutine-A001_fort.32
>>> -rw-rw-r-- 1 nozarm nozarm 114352 Nov 8 10:39 testroutine-A001.out
>>> -rw-rw-r-- 1 nozarm nozarm 22470 Nov 8 10:39 testroutine-A001.err
>>>
>>> and similar files for A002 through A005.
>>>
>>> I even looked at your usrbin plot and it looks fine.
>>>
>>> I am attaching the flair project file with the run definition. I think
>>> your problem was with the way you were running fluka at the end.
>>>
>>> Best wishes,
>>> Mina
>>>
>>>
>>>> Hi everyone!
>>>> I am wrtitting a custom SOURCE routine that generates beam with
>>>> mixture
>>>> of particles for example electrons and protons from DATA FILE.
>>>> I read the FLUKA help part 13.2.19 and fluka discuss thread from
>>>> Alberto
>>>> Fasso
>>>> http://www.fluka.org/web_archive/earchive/new-fluka-discuss/2887.html.
>>>> I was able to write the routine and compile it with success!!! But
>>>> when
>>>> I run FLUKA It starts to work in a moment and crashes with "Finished
>>>> with ERRORS".
>>>> In my source.f routine:
>>>> 1) I read file using OPEN command
>>>> 2) I use READ command inside DO loop in order to fill arrays of
>>>> particle-ID, coordinates, cosines and energy.
>>>> 3) I put particle intanialization from input file in DO loop.
>>>> DO 20 I = 1, NLINES
>>>> NPFLKA = NPFLKA + 1
>>>> WTFLK (NPFLKA) = ONEONE
>>>> WEIPRI = WEIPRI + WTFLK (NPFLKA)
>>>> IJBEAM = PARTID(I)
>>>> TXFLK (NPFLKA) = COSX(I)
>>>> TYFLK (NPFLKA) = COSX(I)
>>>>
>>>> ****** etc. ******
>>>> 20 CONTINUE
>>>> RETURN
>>>> CALL SOEVSV
>>>>
>>>> I can't undertand why it happens because in my nohup.out file there is
>>>> only one single line
>>>>
>>>> ======================= Running FLUKA for cycle # 1
>>>> =======================
>>>> /usr/local/fluka/flutil/rfluka: line 358: 1926 Aborted
>>>> (core dumped) "${EXE}" < "$INPN" 2> "$LOGF" > "$LOGF"
>>>>
>>>> If someone has time PLEASE take a look and say why my SOURCE doesn't
>>>> work.......
>>>> I am attached files that I got after run.
>>>>
>>>> Thank You.
>>>>
>>>>
>>>>
>>
>
>
Received on Tue Nov 12 2013 - 22:30:15 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 12 2013 - 22:30:16 CET