# Multiple cylindrical source as shown in figure

Dear Experts,
Is it possible to model multiple cylindrical sources (as shown in the attached figure) in FLUKA ? How to sample different orientation of the source cylinders in a single source.f ?

Can these cylindrical sources be activated in region-basis option of newgen_source.f as shown below?
call regionsource ( coordinate_x, coordinate_y, coordinate_z, [region number], [xmin], [xmax], [ymin], [ymax], [zmin], [zmax] )
Here how to put the [region number] of these many cylindrical source regions?

Dear @ArghyaC,

Similarly as it was discussed in Multiple complex source in Fluka, you can use a random number to select between regions.

Please note, the `regionsource()` subroutine is not part of the distributed version of the source_newgen.f user routine.

Also, since it is using a rejection method, the speed of the sampling is worse, than sampling directly from a cylinder and then roto-translating the coordinates to match the geometry.

Cheers,
David

Can I code like below:

random = FLRNDM(XDUMMY)

if (random .lt. beam1_probablility) then
call regionsource ( coordinate_x, coordinate_y, coordinate_z, [region number_1], [xmin], [xmax],[ymin], [ymax], [zmin], [zmax] )
else if (random .lt. beam1_probability + beam2_probability) then
call regionsource ( coordinate_x, coordinate_y, coordinate_z, [region number_2], [xmin], [xmax], [ymin], [ymax], [zmin], [zmax] )
else if (random .lt. beam1_probability + beam2_probability + beam3_probability) then
call regionsource ( coordinate_x, coordinate_y, coordinate_z, [region number_3], [xmin], [xmax], [ymin], [ymax], [zmin], [zmax] )
else
call regionsource ( coordinate_x, coordinate_y, coordinate_z, [region number_4], [xmin], [xmax], [ymin], [ymax], [zmin], [zmax] )
end if

Kindly correct me if the above code is wrong.

Whether you have some example source.f file using roto-translating the coordinates for such application?

Kindly give me some suggestions.

Dear @ArghyaC,

The code looks correct, but you need to optimize the x/y/z min/max values for each regions separately, to increase the success rate of the rejection sampling.

I’m not aware of an example for a roto-translation, but since it is only 2 dimensional matrix and vector operations are needed, it should be hard to program them. (Rotation matrix - Wikipedia)

Cheers,
David