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

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

Dear Niklas,

the "flukamy"-executable is created in the current directory, therefore
you should execute FLUKA with

$FLUPRO/flutil/rfluka -e ./flukamy -N0 -M5 Moderation_Tb

Details about the usage of "rfluka" can be found with

$FLUPRO/flutil/rfluka -h

When FLUKA output is combined using FLAIR's "Process"-button, I think it
wants 5 runs in order to be able to calculate (in addition to the average
mean value) the corresponding standard deviation (using the Central Limit
theorem). So I always run FLUKA with at least 5 runs.

In the standard source.f-file, there is a part where it says
* From this point .....

...

* ... to this point: don't change anything

So I usually do my sampling after that last line, and then you can fill
TKEFLK inside the sampling loop ("IF (CUM(I) .GT. C) THEN..."), but
probably before the line

* Calculate the total kinetic energy of the primaries: don't change

because then TKEFLK is used. Right after defining TKEFLK, you need to
specify

         PMOFLK (NPFLKA) = SQRT ( TKEFLK (NPFLKA) * ( TKEFLK (NPFLKA)
     & + TWOTWO * AM (IONID) ) )

so the momentum is defined consistently (otherwise it will use the "PBEAM"
value to which it is set earlier in the source.f file).

The values given in the BEAM and BEAMPOS card are accessible via the
$FLUPRO/flukapro/(BEAMCM)-common, but FLUKA will not do the sampling e.g.
for a CART-VOL or beam divergence when the SOURCE-card is specified in the
input. So one needs to take the corresponding values from the
BEAMCM-common and perform the sampling in the source.f-user routine.

Cheers,

         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 Sun, 22 Aug 2021, Ophoven, Niklas wrote:
> 
> Dear Stefan,
> 
> thank you very much for your detailed answer, this is really very helpful
> for me!
> 
> I tried to adopt your suggestions and finally I can now compile the NSpec.f
> file without any errors and the NSpec.o  file is successfully generated.
> Then I want to build the new executable with:
> 
> $FLUPRO/flutil/ldpmqmd -m fluka -o flukamy NSpec.o
> 
> However,  when   I want to execute my input file with $FLUPRO/flutil/flukamy
> -N0 -M3 Moderation_Tb I get the error: -bash: /opt/FLUKA//flukamy: No such
> file or directory
> 
> Indeed, in the flutil directory I cannot find an executable file named
> flukamy,  only the usual rfluka script. Any ideas what my mistake is?
> 
> I  have attached a new spectrum file (NSpec.txt), now with 3 columns as you
> have suggested. The flux is not differential,  it is indeed already in units
> of  n cm-2 s-1. I have converted the energy boundaries to GeV now already in
> the spectrum file.
> 
> "- 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)"
> 
> I have written this information in line 180 of the source file, is that the
> correct position?
> 
> You are right, I will probably have to implement the emission coordinates of
> the neutrons as well as the beam direction within the source file. Actually
> I want to define the source as a cartesian volume source (10 cm distance in
> z-direction to the target/sample) of same shape as the target, and all
> neutrons shall be emitted into positive z-direction.
> 
> There are 2 BEAMPOS cards in my input, because one defines the shape and
> the  other one the center of the source. Probably you are right and I will
> have to define that in the source card.
> 
> Kind regards,
> 
> Niklas
> 
> ____________________________________________________________________________
> Von: Stefan E. Mueller <stefan.mueller_at_hzdr.de>
> Gesendet: Sonntag, 22. August 2021 01:21:07
> An: Ophoven, Niklas
> Cc: fluka-discuss_at_fluka.org
> Betreff: Re: [fluka-discuss]: SOURCE routine for neutron source  
> 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 Mon Aug 23 2021 - 00:41:12 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 23 2021 - 00:41:15 CEST