Re: [fluka-discuss]: SOURCE routine for neutron source

From: Stefan E. Mueller <stefan.mueller_at_hzdr.de>
Date: Sun, 22 Aug 2021 01:21:07 +0200 (CEST)

Dear Niklas,

I had a look at your files, and have the following comments/suggestions:

- in line 61 you put LFIRST = .FALSE., but in this way it will never enter
the initialization at line 72 where you read the file. Just move the
WRITE-line below line 72 and take out the first LFIRST = .FALSE..

- It is probably preferable to use the OAUXFI-Routine to read the file
instead of the OPEN-card in the input file (also your OPEN card is
incomplete, and it somehow shadows the SOURCE-card in your input file). So
I'd remove the OPEN-card and open the file like this:

          call OAUXFI('./NSpec.txt', LUNRD, 'OLD', IERR )

(where LUNRD is specified in the WHAT(1) of the SOURCE card:

SOURCE 21.
)

Using OAUXFI has the advantage that the file is searched for in several
places:
1) First of all: try to open the file in the current directory
2) Second attempt: try to open the file in the original work directory
3) Third attempt: try to open the file in the FLUPRO directory
4) Last attempt: try to open the file in the user home directory

(see
http://www.fluka.org/web_archive/earchive/new-fluka-discuss/0342.html)

- If possible, I'd arrange the input file like this for each bin (i.e.
adding a column with the bin upper limit):
         Emin Emax Value

- You want to skip the first line, and then read the values with a
simple DO-loop (there may be more flexible ways to do this, but I usually
know how many values I have, so I hardcode the number which is 100 in
your case):
         READ (LUNRD, '(A)') LINE
         DO I=1, 100
                 READ (LINE, *, ERR=10) EMIN, EMAX, H
         ...calculate cumulated probability...
         END DO

(do you have the differential neutron flux in NSpec.txt? The units in the
header line give (cm-2s-1), so I am not sure if you need to multiply by
the bin-width when building the sum)

- After the sampling in energy, you have to pass the sampled value for
the kinetic energy to TKEFLK(NPFLKA):
         TKEFLK(NPFLKA) = (ERG(I-1) + (ERG(I)-ERG(I-1))*FLRNDM(C))*1.D-03
         (watch out, FLUKA expects GeV, but your input has MeV energy bins)

- Then redefine the Particle momentum using the new value of TKEFLK
(NPFLKA):
         PMOFLK (NPFLKA) = SQRT ( TKEFLK (NPFLKA) * ( TKEFLK (NPFLKA)
      & + TWOTWO * AM (IONID) ) )

(otherwise it will be "PBEAM", which is derived from the BEAM-card)

- I am not sure if the CART-VOL sampling specified by the BEAMPOS card is
reflected in the XBEAM,YBEAM,ZBEAM used in the source user routine, so you
might want to check this - if it is not, then just sample the particle
coordinates accordingly in NSource.f (I also noticed you have two
BEAMPOS-cards in your inpput file)

- in general, you also might want to make sure that the continuation
character "&" is always in column 6 (otherwise the compiler will
complain about a "Non-numeric character in statement label" because it
expects a number there).

I hope this helps,

         Stefan

--
Stefan E. Mueller
Department of Information Services and Computing - Computational Science
and Institute of Radiation Physics
Helmholtz-Zentrum Dresden-Rossendorf
Tel: +49 (0351) 260 3847
Stefan.Mueller_at_hzdr.de
http://www.hzdr.de
Vorstand: Prof. Dr. Sebastian M. Schmidt, Dr. Diana Stiller
Vereinsregister: VR 1693 beim Amtsgericht Dresden
On Fri, 20 Aug 2021, Ophoven, Niklas wrote:
> 
> Dear FLUKA experts,
> 
> 
> so far there was no need for me to modify any of the available user routines
> in FLUKA, but now I have to do so. Iam using FLUKA with the Ubuntu 18.04 LTS
> software.
> 
> In principle my simulation is quite simple:
> 
> I want to simulate a rectangular shaped neutron source (homogenously
> distributed in a cartesian volume source with emission direction into
> z-axis) that hits a rectangular shaped target of same dimensions made of
> terbium(III) chloride hexahydrate. 
> 
> 
> So far I have managed to copy the SOURCE.f file from the FLUKA directory,
> but the compilation $FLUPRO/flutil/fff NSource.f (source file is attached)
> still yields some errors. I spent some time now on solving the errors with
> material from FLUKA courses and old, similar questions in this mailing list.
> However, as Iam not an expert in Fortran, I would appreciate any kind of
> help or guidance you could give me there.
> 
> 
> I want to load in the spectrum data in a histogram form, i.e. energy bins
> and relative emission probabilities. The left column in the file shows the
> energy bin boundaries, the right column gives the flux values. Note, that
> the energy boundaries on the left are lower and upper boundaries, so that
> the left column is bigger by one line compared to the right column. When I
> would simply divide the flux in each bin over the total (integral) flux,
> would this be sufficient for FLUKA to reconstruct the shape of the
> spectrum? 
> 
> 
> I will load the spectrum data with an OPEN card in the input file (see
> attachment). The data got the logical unit number 21, is it sufficient to
> put "21" before the file ending for FLUKA to recognize that file
> adequately? 
> 
> 
> Any  kind  of comments and guidance is of great help for me, thanks in
> advance.
> 
> 
> Kind regards,
> 
> 
> Niklas
> 
> 
> 
> ---------------------------------------------------------------------------
> ---------------------
> ---------------------------------------------------------------------------
> ---------------------
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDir Volker Rieke
> Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
> Karsten Beneke (stellv. Vorsitzender), Dr. Astrid Lambrecht,
> Prof. Dr. Frauke Melchior
> ---------------------------------------------------------------------------
> ---------------------
> ---------------------------------------------------------------------------
> ---------------------
> 
> 
>



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

Received on Sun Aug 22 2021 - 03:47:12 CEST

This archive was generated by hypermail 2.3.0 : Sun Aug 22 2021 - 03:47:18 CEST