Cylindirical source using source newgen with source routine

Versions

Please provide the used software versions.

FLUKA:4.5.0
Flair:3.4.2
Operating system: Ubuntu 25.04 virtual machine
Compiler: Gnu Fortran/gcc Ubuntu 14.2.0

Description

Dear all, I want to simulate marinelli beaker that contains isotopes in it using source_newgen_with_regionsource but first, I want to try source routine for cylindrical source and want to be sure that my steps are correct. So I can move forward.

First, I run simulation with original source routine. Its fluence result for photons are given in Figure 1. When I look at the photon fluence from top (z axis), the shape is square. It is probably because i selected Xmin,Xmax, Ymin, Ymax and Zmin, Zmax for source definition and my source becomes cubic shape. There is circular shape in Figure 1, I guess it is due to interaction of source with cylindrical container walls.

I tried it with 1 million particles too, but results for fluence also same.

I tried to convert coordinates to cylindrical by adding below code to source routine (below code is taken from previous topics ) :

     rmax = 6.799998D0
     zmin = -3.051062D0
     zmax = 0.518998D0
     theta = FLRNDM(xdummy)*TWOPIP
     r=rmax*FLRNDM(xdummy)
     coordinate_x = r*cos(theta)
     coordinate_y = r*sin(theta)
     coordinate_z = FLRNDM(xdummy)*(zmax-zmin)+zmin

I manage to compile source_newgen_with_regionsource with this changes but when I press “run” button, simulation seems running but it is actually not running. When I made error in source routine, even if it compiles, I had similar problems before.

Probably it is something easy but I didn’t find solution yet. I am playing with it for a long time. Could you please guide me? Thank you.

Note: Only source_newgen_with_regionsource.f files are different, the rest of fluka files are the same.

Input files

Figure 1,

de.flair (5.9 KB)

de.inp (6.8 KB)

source_newgen_with_regionsource.f (20.6 KB)

Fluka input file with original source routine,

source_newgen_with_regionsource.f (20.9 KB)

the source routine i tried to modify.

Dear Hakan,

you are overwriting the coordinates sampled with the regionsource() subroutine, a few lines later, where you sample from a flat distribution on each axis. This explains the box shape on the plot.

Cheers,
David

Thank you for your kind answer and support.

Sorry for not given different names to attached user routines previously.

2→I removed the lines under the title 5.2.1: Flat distribution as you advised. Since the top of beaker is circular and as you see in Figure Fluka_v2, I thought the interaction of photons with beaker walls is a little weird. I first thought it is related with 6.3.1 but it didn’t affect the result.

Figure Fluka_v2 User routine for v2:

source_newgen_with_regionsource3.f (20.3 KB)

3→I just want to see the effect of beaker so I removed it from the simulation and re-run it. The removed files from geometry are shown in Figure Fluka_geom_v3.

The result of photon fluence is given in Figure Fluka_v3.It became box again.

Figure Fluka_geom_v3

Figure Fluka_V3 User routine for v3:

source_newgen_with_regionsource4a.f (20.3 KB)

May be the behaviour given in Figure 3 is normal since I didn’t limit the geometry but I am not sure about Figure 2. Could you please comment on this? Is the behaviour in Figure v2 is correct?

Best regards,

p.s. I didn’t attach FLUKA files since they are based on the same files given in first topic, if you want others please let me know.

Dear Hakan,

I’m sorry for the late reply.

The issues are coming from the incorrect region number used for the sampling.

In case of v2, you are sampling in region 8, which is the container wall. It is not continous because the defined volume doesn’t cover all the region.

In other cases when the region is outside the specified volume (like with region 7) the sampling routine goes into an infinitly loop, and when it reaches the maximum number of recusions possible, it will fail and retund a random point in the whole volume.

If you use the correct region 9, you get the expected cylindrical source.

Cheers,
David

1 Like

Dear Dávid,

Thank you for your valuable time and solving my problem.

I got the solution for v2 as below and I understand the problem with v3.

Best regards,