RE: [fluka-discuss]: Read external file in source.f for source information

From: Joachim Vollaire <joachim.vollaire_at_cern.ch>
Date: Wed, 30 Jul 2014 16:30:28 +0000

Dear Zi-Yi Yang

Is your problem a test or a real case ? If it is a real case (you want to samples from two locations with two energies) using a source routine is maybe not the most efficient way CPU wise as you will do a call to the source routine each time you generate a particle (which at low energy could end-up being a non-negligible fraction of your transport time....). An alternative could be using the standard BEAM definition card and run two different calculations and merge the results (be careful to run the same number of primary for the two cases) / or post process the results of the two cases separately and average the results with the same weight.

If you want to read from a data file, a few years ago I gave a presentation in a technical FLUKA meeting where I did this for a specific source shape, I was reading the coordinate and direction from an external data file. You find the link to the presentation below if this can help, the routine must have been updated but the principle is still the same:

http://info-fluka-discussion.web.cern.ch/info-fluka-discussion/talks/Vollaire_Activation_ApplicationDump_150307.pdf

Note that in my case I find more elegant to load the position during initialization and then sample randomly the starting point for each primary rather than going sequentially through the file. In the latter case there is always a chance that your distribution is not properly sample as it would depend on the number of primary run....
Hoping this help
Joachim


-----Original Message-----
From: owner-fluka-discuss_at_mi.infn.it [mailto:owner-fluka-discuss_at_mi.infn.it] On Behalf Of Rong-Jiun Sheu
Sent: 30 July 2014 11:46
To: fluka-discuss_at_fluka.org
Subject: [fluka-discuss]: Read external file in source.f for source information

Dear FLUKA experts,

I am trying to use source.f to read some information from the .txt file which including four variables (energy, xposition, yposition, zposition) in each line. When the FLUKA runs, I hope to get the results that it will calculate 1E6 particles using first line information from the file.
And another 1E6 particles using the second line. So I used a do while cycle but it didn’t work. Is there someone could help me ? Thanks in advance .

Zi-Yi Yang
NTHU, Taiwan
Received on Wed Jul 30 2014 - 19:56:01 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 30 2014 - 19:56:05 CEST