Understanding source.f

Dear Expert,

This is regarding understanding the blocks present in default source.f.
After the initialization,

  1. the first “IF” condition is for checking for (Radioactive) isotope: Does this mean when we select ISOTOPE card, that block gets activated?

  2. the next “IF” condition comes for Heavy ions and then for normal hadrons. Both these blocks have their own set of TKEFLK (NPFLKA), AGESTK (NPFLKA) , PMOFLK (NPFLKA) etc. By default they will read from the BEAM card inputs. But when we want to give user specified values, do we have to write their values in their own blocks ? In other words, if the primary particle is photon or neutrons, do we have to mention TKEFLK (NPFLKA) values in that particular hadron block or can we write it separately after that IF statement ends ?

  3. Can we define multiple particle emission using source.f, with out using ISOTOPE card ? For example if a particle emits both beta and gamma, then can we define that in a single source.f or do we have to perform the simulation twice taking one particle at a time ?

Regards,
Riya

1 Like

Dear Riya,

This are the answers to your questions the regarding the source.f blocks:

  1. Yes.

  2. Replying to your question, after the mentioned IF statement ends one can overwrite the array value.
    You can also modify the routine in such a way that it can read the values given by the user in the input file via the SOURCE card. For instance, if you define in the source.f:
      PAR1 = WHASOU(1)
    it means that the variable PAR1 will take the value given in WHAT(1) of the SOURCE card defined in the input file.

  3. The answer to your question is yes, you can define multiple particle emissions using the same source.f. You can load both, betas and gammas, in a single primary event looping over NPFLKA variable. The properties of each particle are set as a function of the NPFLKA in the default source.f,
    where NPFLKA=1 (NPFLKA=0 at the entrance of the routine but then is given the value NPFLKA = NPFLKA+1 = 1). Now, to ensure that the properties of the second particle are different from the first one, you need to redefine all variables for “NPFLKA+1”. This can be also applied for more particles.
    There is another thing you need to consider. Since the ID of betas and gammas is not the same, i.e., ID(electron)=3 and ID(photon)=7, some variable definition would also depend on an index link to the particle ID. Therefore, you will need to add to your routine a block like:
      DO INDEX=1,2
       IF (INDEX.EQ.1) THEN
        ILOFLK(NPFLKA) = 3
       ELSE IF (INDEX.EQ.2) THEN
        ILOFLK(NPFLKA) = 7
      END DO

I hope you find this information useful.

Kind regards,
Marta

1 Like

Thank you @msabateg, it was very helpful.

Regards,
Riya