# The meaning of dummy arguments

Dear experts,
I learn to use Function/subroutine recently and find that some dummy arguments of it do not give its meaning. For example, the meaning of “WVLNGT, OMGPHO, MMAT” does not give out in abscff.f, I only learned the meaning of “WVLNGT ,MMAT” from wvlnsh.f and does not know if it right.
By the way, could you help me to see the follow is right?

      DOUBLE PRECISION :: WVLNGT
DOUBLE PRECISION :: MMAT
DOUBLE PRECISION :: ABSCFF = 0.0
IF (abs(MMAT-3.500) .LT. 1.0D-4)THEN
IF(abs(WVLNGT-3.85D-5) .LT. 1.0D-6)THEN
ABSCFF = 20
ELSE IF(abs(WVLNGT-4.25D-5) .LT. 1.0D-6)THEN
ABSCFF = 0.05
ELSE
ABSCFF = 0
END IF
END IF
RETURN


Dear XIONG BANGPING,

According to the FLUKA manual, the input parameters of the ABSCFF function have the following meanings:

• WVLNGT: photon wavelength (in cm)
• OMGPHO: angular frequency (\omega = 2 \pi \nu) of the photon (in s^{-1})
• MMAT: material index

The angular frequency is inversely proportional to the wavelength. You are free to use which one you want according to your needs.

At first glance your code is right, but keep in mind that MMAT is the material index. So I am not sure it it makes sense to subtract a floating number to that. Also, I would recommend that you explicitely set a default value for ABDCFF in the function (outside of the IF ir in a else) as to cover all situations.

1 Like

Dear @blefebvre ,
I use MMAT subtract a floating number to express when photon are in a region, the floating number represent a material region according to the .out file. So does it right?

Dear XIONG BANGPING,

Yes you are right that MMAT represents the material ID and that the FLUKA code may something encode integers as floating point. But you view these number as integers. Whatever value of MMAT you expect, the value of:

abs(MMAT-3.500)


will never be lower than 0.5, meaning that

abs(MMAT-3.500) .LT. 1.0D-4


is always false. Please check that sometimes your code enters the IF statement.

MMAT .EQ. 3


or if you are really worried that MMAT might not be an integer, you can round it to the nearest integer using NINT:

NINT(MMAT) .EQ. 3


Dear @blefebvre ,
I have a mistake about the material number from .out file and find it is a integer. I modified my code, maybe it is right?

      DOUBLE PRECISION :: WVLNGT
INTEGER :: MMAT
IF (MMAT.EQ. 32)THEN
IF(abs(WVLNGT-3.85D-5) .LT. 1.0D-6)THEN
ABSCFF = 20.0
ELSE IF(abs(WVLNGT-4.25D-5) .LT. 1.0D-6)THEN
ABSCFF = 0.05
ELSE
ABSCFF = 0.0
END IF
ELSE
ABSCFF = 0.0
END IF
RETURN
*=== End of function Abscff ===========================================*
END


I don’t see anything wrong with this code. Only thing left if to check carefuly that it behaves like you intends.

Dear @blefebvre ,
I found other question suddenly. The abscff.f is combined with a OPT-PROP card, the card have designated material, so does the follow code is redundant？

IF (MMAT.EQ. 32)THEN

ELSE
ABSCFF = 0.0
END IF

Dear XIONG BANGPING,

You code is not redondant. You should make sure that a value for ABSCFF is specified in the default case. Otherwise you may get unpredicatable results. So I would say you handle this the proper way.

Dear @blefebvre ,
If I use more than one OPT-PROP card, the other card with its material set abscff conflict with my code, how it will be? You know my code cover all cases.
For example,In the second picture MMAT=33, I set abscff=0.06, it conflict with code in first picture.

ELSE
ABSCFF=0.0

Dear XIONG BANGPING,

The abscff routine is only called if the property is set to <-99. So in you case, it would only be called for getting the getting absorption coefficient of material POLYSTYR (when an optical photon is in a region with that material). For regions with material PMMA, FLUKA will always use 0.06 and will not call the routine at all.

Dear @blefebvre ,
I have understand it, thank you for your help.