Re: [fluka-discuss]: problems of two-steps method

From: Andrea Fontana <andrea.fontana_at_pv.infn.it>
Date: Sun, 4 Nov 2018 17:59:05 +0100

Dear Yang,
     the 20 in the DO loop instruction refers to line 181 that you
find at the end of the source.f the file:

  20   CONTINUE

and it is not the number of repetitions in the loop (this is NLINES,
equal to 10000 in your case). All the lines between the DO and
the CONTINUE are repeated NLINES times: therefore, for each event,
FLUKA will load 10000 primary particles in the stack at once
and track them as a single huge event. This cannot work and it
is likely to break the stack size (i.e. the memory that Fluka
allocates). You can try to run your code, which technically compiles,
but you will see  that the run will give you errors.

The correct way to work with Fluka, is to sample one particle per event
  from the arrays that you fill at the initialization step
in source.f: the SOURCE function is called for each primary (you
should replace the 1 with 10000 for example in the START card in
2.inp) and, at each call, a SINGLE primary particle is loaded in
the stack and tracked by Fluka, with all the secondaries.

Moreover, also take into account that Fluka will give you results
normalized per primary, which is the number you indicate in the START
card.

Hope this helps! You can find more information in the lecture on
user's routines given at the Fluka courses, for example at:

https://indico.cern.ch/event/334606/contributions/779780/attachments/653355/898394/AdvancedUserRoutines2014.pdf

Kind regards,
Andrea


Il 04/11/2018 16:43, YANG Tao ha scritto:
> Dear Andrea,
>    Thanks for your patient explanation, in fact, the example in the last emails are the one from others, I copied from the internet and wanted to study the two-steps method. Now I almost understand the procedure,
> except the second loop of the source.f file in the last email.
> I copy it as follows:
>       DO 20,  I = 1, NLINES
>       NPFLKA = NPFLKA + 1
>
> you changed it as:
>
>       ISAMPL = FLRNDM (DUMMY) * NLINES
>
>       ISAMPL = ISAMPL + 1
>
>
> indeed, I understand your code, does it mean we will sample the
> particle from the phase space file of the 1.f+1.inp output? Is the
> primary number defined in the 2.inp file("ie, START card")?
>
> Since the original code of the problem is not written by me, so I
> don't completely understand what the second loop means. I guess it
> reads all of the array elements from the 1st step output and repeats
> 20 times. I think this method is also correct, so what is the concrete
> mistake of this sampling method?
>
> Thanks again!
>
> Best regards
>
> Yang
>
>
>
>
>
>
>
>
>
>
>
> > -----原始邮件-----
> > 发件人: "Andrea Fontana" <andrea.fontana_at_pv.infn.it>
> > 发送时间: 2018-11-03 18:53:56 (星期六)
> > 收件人: "YANG Tao" <yangt_at_ihep.ac.cn>
> > 抄送: fluka-discuss_at_fluka.org
> > 主题: Re: [fluka-discuss]: problems of two-steps method
> >
> > Dear Yang,
> >     I had a better look and I see the reason of this geometry errors:
> > it is the READ format string that I have used in source.f (my fault),
> > which is different from the one you used in the WRITE statement at
> > step one. This is easy to fix.
> >
> > But, I see another error still in source.f: you read the file in the
> > inizialization step with a loop and this is fine. But then, you have
> > a second loop on all the file lines at each function call: you
> > should instead random sample from the arrays that you have already
> > stored in memory, one particle at each call. So I removed the
> > second loop and added a sampling instruction on the array index
> > (variable I becomes ISAMPL). See also this previous thread on
> > this problem:
> >
> > file:///C:/Users/Andrea/Desktop/Ricerca/Fluka/fluka-discuss_20180209/fluka-discuss/www.fluka.org/web_archive/earchive/new-fluka-discuss/8944.html
> >
> > I send you a corrected version of source.f.
> >
> > Your code should run now, but looking further at the .inp file
> > I see that you request radioactive decay, but only define IRRPROFI
> > without DCYTIMES and DCYSCORE cards: in this case I expect that you
> > will only record the prompt particles. But we can see this later...
> >
> > Please let me know,
> >
> > Kind regards,
> > Andrea
> >
> > Il 03/11/2018 04:15, YANG Tao ha scritto:
> > > Dear Andrea,
> > >      Thanks for your reply. I ran it as your suggestions,  unfortunately, it has some errors " STOP  TOO MANY ERRORS IN GEOMETRY: STOP", but I see no geometry errors in FLAIR, so I am very puzzled with the error, the geometry is not complex, so where are errors from?
> > > Thanks again.
> > > Best regards
> > > Yang
> > >> -----原始邮件-----
> > >> 发件人: "Andrea Fontana" <andrea.fontana_at_pv.infn.it>
> > >> 发送时间: 2018-11-02 19:16:20 (星期五)
> > >> 收件人: "YANG Tao" <yangt_at_ihep.ac.cn>, fluka-discuss_at_fluka.org
> > >> 抄送:
> > >> 主题: Re: [fluka-discuss]: problems of two-steps method
> > >>
> > >> Dear Yang,
> > >>       I ran your example and I have found a couple of FORTRAN errors
> > >> in the file I/O instructions:
> > >>
> > >> - in file 1.f in the OPEN instruction, you have put 'NEW' as status,
> > >>     but this will create a new file for each WRITE statement (the
> > >>     function is called at *each* boundary crossing): simply write
> > >>     'UNKNOWN' or do not specify the status.
> > >>     With this correction, at step 1 you write the Data1.dat file
> > >>     (named 1001_Data1.dat with Fluka naming conventions).
> > >>
> > >> - in file source.f, the problem is due to the fact that UNIT=88
> > >>     should be opened in the 2.inp file with the Fluka card OPEN
> > >>     and not directly in the FORTRAN code.
> > >>     Moreover, you read 20000 lines, but your file has only 10000:
> > >>     therefore you hit the end of file and this generates the EOF error.
> > >>     To be on the safe side, I have put a protection in the READ
> > >>     statement as:
> > >>
> > >>           READ (88,102,END=101)
> > >>     ......
> > >>     101 CONTINUE
> > >>
> > >>     so that the code knows how to handle this situation.
> > >>     At this point, step 2 also works, but the I have seen tracking
> > >>     errors, seemingly due to geometry problems...
> > >>
> > >> I leave it to you now, but I am available for further interactions
> > >> if needed.
> > >>
> > >> In attachment, a revised version of your files.
> > >>
> > >> Kind regards,
> > >> Andrea
> > >>
> > >> Il 02/11/2018 08:16, YANG Tao ha scritto:
> > >>> Hi, everyone!
> > >>>
> > >>>
> > >>> Recently, I simulate  using so called two-steps method to simulate the
> > >>> activation problem. File 1.input and 1.f use FLUSCW.F +USRBDX to
> > >>> calculate the generated particles, and 2.f use the 1st step results as
> > >>> the source. But when I run the 2nd step, I get an error(seen in
> > >>> 2.log), "At line 73 of file source.f (unit = 88, file = '../try.dat')
> > >>> Fortran runtime error: End of file", I try many ways but cannot solve
> > >>> it. could anyone give a suggestion, any suggestion is appreciate!
> > >>>
> > >>> Best regards!
> > >>>
> > >>> Yang
> > >>>
> > >> --
> > >> ========================================================================
> > >> Dr. Andrea Fontana                    tel: +39 0382 987991
> > >> Istituto Nazionale                    fax: +39 0382 423241
> > >> di Fisica Nucleare
> > >> Sezione di Pavia                      e-mail: andrea.fontana_at_pv.infn.it
> > >> Via Bassi 6                           web   : www.pv.infn.it/~fontana
> > >> 27100 PAVIA, Italy
> > >> ========================================================================
> > >>
> > >
> > >
> > >
> > >
> >
> > --
> > ========================================================================
> > Dr. Andrea Fontana                    tel: +39 0382 987991
> > Istituto Nazionale                    fax: +39 0382 423241
> > di Fisica Nucleare
> > Sezione di Pavia                      e-mail: andrea.fontana_at_pv.infn.it
> > Via Bassi 6                           web   : www.pv.infn.it/~fontana
> > 27100 PAVIA, Italy
> > ========================================================================
> >
>
>
> --
> 杨涛
> 中科院高能所东莞分部(东莞中子科学中心)加速器技术部
> 地址:东莞市大朗镇中子源路1号中国散裂中子源A2栋606室
> E-mail:yangt_at_ihep.ac.cn
> 电话:0769-38944239
> 邮编:523803
>
>
> --
>
> 杨涛
> 中科院高能所东莞分部(东莞中子科学中心)加速器技术部
> 地址:东莞市大朗镇中子源路1号中国散裂中子源A2栋606室
> E-mail:yangt_at_ihep.ac.cn <mailto:yangt_at_ihep.ac.cn>
> 电话:0769-38944239
> 邮编:523803
>

-- 
========================================================================
Dr. Andrea Fontana                    tel: +39 0382 987991
Istituto Nazionale                    fax: +39 0382 423241
di Fisica Nucleare
Sezione di Pavia                      e-mail: andrea.fontana_at_pv.infn.it
Via Bassi 6                           web   : www.pv.infn.it/~fontana
27100 PAVIA, Italy
========================================================================
__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Sun Nov 04 2018 - 19:13:24 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 04 2018 - 19:13:26 CET