How to product a SOBP

Dear experts
Good afternoon. Can you explain to me what went wrong? I want to generate a SOBP, set by their own energy and weight, here is a screenshot of the error
SOBP.dat (598 Bytes)
sourceSpectrum.f (8.6 KB)


I sincerely look forward to your early answer, I wish you a happy work, happy every day!

Hi,

Your request is a bit unclear. Nevertheless, I tried to understand what you needed. I assume you want to sample from a discrete spectrum some protons to study the spread-out Bragg peak.

Your code is not compiling, there are several syntax errors. Then you want to calculate the cumulative distribution (I do not understand your approach, since it should just be a sum of discrete probabilities). Even after fixing these two problems, you do not sample from the cumulative spectrum in the main loop. I tried to apply some adjustments to your code, and now you should be able to perform what you were trying to do.

Keep in mind that you can have the same results, with less effort, using a SPOTBEAM card. (There are several examples in the forum). Otherwise, I would suggest using the new generation source routine, which is more user-oriented.

Let me know If something is unclear.

sourceSpectrum.f (9.5 KB)
test.flair (2.8 KB)

Cheers,
Daniele

Dear Daniele Calzolari

Good evening! Thank you very much for taking time out of your busy schedule to help me answer my questions. I have successfully compiled and run your file!
Your files produced SOBP perfectly today, just as I set multiple SPOTBEAM effects! However, I have a very confused problem today: when my beam shape is a 7x7cm square source, but I see the final result of the beam on the X axis horizontally like a point source irradiation, and in the following is the compiled result VS uncompiled ordinary square source generated 2 D energy deposited in the water
问题一
The above figure is the compiled source. There is SOBP in the Z axis, but the transverse X axis does not reflect the 7x7cm size source. The incident shape of the particles in the figure is much like the point source


Figure 2 is the ordinary single-energy square source shot into the water tank
NOTE:The source shape of both images is a 7x7cm square proton source

I sincerely look forward to your early reply, and wish you a happy and warm weekend!

                                Zhuhuaiyu

Hello Zhuhuaiyu,

The source routine I provided you manages just the particles energy spectrum.
If you want to add the beam size, you need to sample it, and add it to the particle coordinates (see also this discussion: Beam sizes when using source.f).

If you want to proceed with this source routine, my suggested approach to sample from a rectangular source would be:

  1. Sample a random variable between zero and one with FLRNDM(DUMMY)
  2. Select the limits XLOW and XHIGH of the rectangular distribution for x and y (in your case, respectively -7 and +7).
  3. Sample one random x (and then y) position from the uniform distribution:
XFLK(NPFLKA) = XBEAM + XLOW  + ( XHIGH - XLOW ) * FLRNDM(DUMMY)

Remember that this approach works only if the frame of reference of the beam is not rotated in respect of the cartesian one, otherwise you would need to add another rotation.
Cheers,
Daniele

Dear Daniele Calzolari

Good evening. In these three days, I have rewritten the document according to your methods, and after many attempts to get the results (for protons only), now I would like to ask you about the following three questions:

First, I am not sure if I wrote it right, and I always feel that the dose distribution shape of the X-axis should have a peak plateau (because it is uniformly sampled), as shown in Figure 1 below. But my X-axis diagram is shown in Figure 2. Why does it become sharp after compilation? Did I not use uniform sampling correctly?
4
2

Second, when I replaced SOBP.dat and particle species with 12C (I adopted “heavy-ion”), no energy deposition of heavy ions was detected in the tank, as shown in Figure 3
3
However, there is no problem with the two-dimensional map of protons, as shown in Figure 4
5

Third, Is my card missing the cut-off energy of neutrons, electrons and photons, or is it a nuclear reaction model?
12C.flair (2.9 KB)
SOBP.dat (2.7 KB)
sourceSpectrum.f (9.9 KB)
I’m so sorry to take up your time, but as a FLUKA beginner, this is the third week of study, and I’m very interested in it! Hope you can help me again!
I sincerely look forward to your early answer and wish you success in your work
Zhuhuaiyu

You are not sampling correctly.
When you’re doing the sampling, you are doing this:

      XLOW = -3.5D0 * SQRT( FLRNDM(XDUMMY) )
      XHIGH = 3.5D0 * SQRT( FLRNDM(XDUMMY) )
      YLOW = -3.5D0 * SQRT( FLRNDM(XDUMMY) )
      YHIGH = 3.5D0 * SQRT( FLRNDM(XDUMMY) )

The x and y limits should not be sampled, those are fixed variables, therefore you might want to write:

      XLOW = -3.5D0
      XHIGH = 3.5D0
      YLOW = -3.5D0
      YHIGH = 3.5D0

The carbon ions are depositing their energy in the beginning of the material. Check if the range you observe is compatible with the energy you selected.
For the threshold/reaction models, I suggest to read the beginner lectures of the Fluka course. They are extremely useful learn FLUKA usage:

2 posts were split to a new topic: Using source routine with DMPJET