- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Anna Ferrari <a.ferrari_at_hzdr.de>

Date: Mon, 03 Feb 2014 02:25:21 +0100

Dear Sion,

I suggest first to read the Chapter 13.2.19 of the manual, "source.f

user-written source". You can find the way to implement in the source routine

a biased distribution. I copy here the part interesting for you:

--------------------------------------

* Sampling from a biased distribution

The technique for sampling from a generic distribution described

above can be extended to modify the probability of sampling in

different parts of the interval (importance sampling). We

replace f(x) by a weighted function g(x) = f(x) * h(x), where h(x)

is any appropriate function of x we like to choose. We normalise g(x)

in the same way as f(x) before:

/x /xmax /x

G(x) = | g(x)dx / | g(x)dx = | f(x)*h(x)dx / B

/xmin /xmin /xmin

and we need also the integral of f(x) over the whole interval:

/xmax

A = | f(x)dx

/xmin

All the sampling is done using the biased cumulative normalised

function G instead of the original unbiased F: we sample a uniform

pseudo-random number t as before, and we get the sampled value XX by

inverting G(x):

-1

XX = G (t)

The particle is assigned a weight B/(A * h(XX))

A special case of importance sampling is when the biasing function

chosen is the inverse of the unbiased distribution function:

h(x) = 1/f(x)

g(x) = f(x) * h(x) = 1

G(x) = (x - xmin) / (xmax - xmin)

In this case we sample a uniform pseudo-random number t using

FLRNDM as shown above. The sampled value XX is simply given by:

XX = xmin + (xmax - xmin)*t

and the particle is assigned a weight:

/xmax

B/(A h(X)) = f(XX)*(xmax - xmin) / | f(x)dx

/xmin

But since FLUKA normalizes all results per unit primary weight, any

constant factor is eliminated in the normalization. Therefore it is

sufficient to assign each particle a weight f(x).

--------------------------------------------------------

The answer to your first question should be now quite clear... the weight is

calculated as illustrated above, no reason to be an integer (why?).

2. No, the biasing of the primaries and the biasing of the secondaries and (I

would add) the importance sampling (which is particle and region-based) refer

to separate actions in the transport: the source generation in the first case

and the tracking of generated particles in the other two cases (respectively

secondaries and primary+secondaries). Obviously you have to take care that the

biasing you chose is meaningful and you don't underestimate important

contributors.

3. I would not change the location of the lines you wrote(...why?)

Hope it helps,

kind regards,

Anna

Am Thu, 30 Jan 2014 16:07:31 -0500 schrieb Sion Koren <skoren_at_chpnet.org>:

*> Dear friends,
*

*>
*

*> I would like to sample from fluence by sampling the energy uniformly and
*

*>adjusting the weight accordingly.
*

*> I have a few questions please:
*

*>
*

*>
*

*> 1. Must a weight be an integer? Can the fluence spectra (photons per
*

*>MeV per incident electron in my case) be multiplied for biasing?
*

*>
*

*> 2. Would it effect the usage of secondary particles biasing with the
*

*>bias card?
*

*>
*

*> 3. In the Source.f subroutine the particle weight is dealt with at
*

*>those lines:
*

*> * Wt is the weight of the particle
*

*> WTFLK (NPFLKA) = ONEONE
*

*> WEIPRI = WEIPRI + WTFLK (NPFLKA)
*

*>
*

*>
*

*> Can the location of these lines in the subroutine be modified?
*

*> Can one please give an example of a correct way to modify the weight.
*

*>
*

*>
*

*> Thanks in advance,
*

*>
*

*> Sion Koren, PhD, DABR
*

*>
*

*>
*

*> This message and any attachments are confidential and intended solely
*

*> for the use of the individual or entity to which they are addressed. If
*

*> you are not the intended recipient, you are prohibited from printing,
*

*> copying, forwarding, saving, or otherwise using or relying upon them in
*

*> any manner. Please notify the sender immediately if you have received
*

*> this message by mistake and delete it from your system.
*

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Anna Ferrari

Institute of Radiation Physics

Helmholtz-Zentrum Dresden-Rossendorf e.V.

Tel. +49 351 260 2872

a.ferrari_at_hzdr.de

http://www.hzdr.de

Vorstand: Prof. Dr. Dr. h. c. Roland Sauerbrey, Prof. Dr. Dr. h. c. Peter

Joehnk

Vereinsregister: VR 1693 beim Amtsgericht Dresden

Received on Mon Feb 03 2014 - 03:46:43 CET

Date: Mon, 03 Feb 2014 02:25:21 +0100

Dear Sion,

I suggest first to read the Chapter 13.2.19 of the manual, "source.f

user-written source". You can find the way to implement in the source routine

a biased distribution. I copy here the part interesting for you:

--------------------------------------

* Sampling from a biased distribution

The technique for sampling from a generic distribution described

above can be extended to modify the probability of sampling in

different parts of the interval (importance sampling). We

replace f(x) by a weighted function g(x) = f(x) * h(x), where h(x)

is any appropriate function of x we like to choose. We normalise g(x)

in the same way as f(x) before:

/x /xmax /x

G(x) = | g(x)dx / | g(x)dx = | f(x)*h(x)dx / B

/xmin /xmin /xmin

and we need also the integral of f(x) over the whole interval:

/xmax

A = | f(x)dx

/xmin

All the sampling is done using the biased cumulative normalised

function G instead of the original unbiased F: we sample a uniform

pseudo-random number t as before, and we get the sampled value XX by

inverting G(x):

-1

XX = G (t)

The particle is assigned a weight B/(A * h(XX))

A special case of importance sampling is when the biasing function

chosen is the inverse of the unbiased distribution function:

h(x) = 1/f(x)

g(x) = f(x) * h(x) = 1

G(x) = (x - xmin) / (xmax - xmin)

In this case we sample a uniform pseudo-random number t using

FLRNDM as shown above. The sampled value XX is simply given by:

XX = xmin + (xmax - xmin)*t

and the particle is assigned a weight:

/xmax

B/(A h(X)) = f(XX)*(xmax - xmin) / | f(x)dx

/xmin

But since FLUKA normalizes all results per unit primary weight, any

constant factor is eliminated in the normalization. Therefore it is

sufficient to assign each particle a weight f(x).

--------------------------------------------------------

The answer to your first question should be now quite clear... the weight is

calculated as illustrated above, no reason to be an integer (why?).

2. No, the biasing of the primaries and the biasing of the secondaries and (I

would add) the importance sampling (which is particle and region-based) refer

to separate actions in the transport: the source generation in the first case

and the tracking of generated particles in the other two cases (respectively

secondaries and primary+secondaries). Obviously you have to take care that the

biasing you chose is meaningful and you don't underestimate important

contributors.

3. I would not change the location of the lines you wrote(...why?)

Hope it helps,

kind regards,

Anna

Am Thu, 30 Jan 2014 16:07:31 -0500 schrieb Sion Koren <skoren_at_chpnet.org>:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Anna Ferrari

Institute of Radiation Physics

Helmholtz-Zentrum Dresden-Rossendorf e.V.

Tel. +49 351 260 2872

a.ferrari_at_hzdr.de

http://www.hzdr.de

Vorstand: Prof. Dr. Dr. h. c. Roland Sauerbrey, Prof. Dr. Dr. h. c. Peter

Joehnk

Vereinsregister: VR 1693 beim Amtsgericht Dresden

Received on Mon Feb 03 2014 - 03:46:43 CET

*
This archive was generated by hypermail 2.3.0
: Mon Feb 03 2014 - 03:46:43 CET
*