Re: DO WHILE LOOP in source.f

From: <me_at_marychin.org>
Date: Mon, 15 Jul 2013 16:00:05 +0200 (CEST)

Hai Զ,

You keep getting the same values for G1 and G2 because between each call
to source.f fortran remembers the previous values of G1 and G2. The
remembered values naturally satisfy the condition
          (2.0*G1-1.0)**2+(2.0*G2-1.0)**2 .LE. 1.0
So from the second call onwards, the FLRNDM lines are no longer executed.

To fix the problem, you may initialise G1 and G2, before DO WHILE, to
values which satisfy the condition:
          (2.0*G1-1.0)**2+(2.0*G2-1.0)**2 .GT. 1.0
so that the FLRNDM lines get executed at least once.

I guess you've found the answer to your post titled, 'How to
define a truncated cone source in Fluka?' The answer is source.f.

:) mary

On Fri, 12 Jul 2013, Զ wrote:

>
> Dear Fluka users,
>
> I use a do while loop in source.f like this,
>
> R=140.0
> H=100.0
> DO WHILE ( (2.0*G1-1.0)**2+(2.0*G2-1.0)**2 .GT. 1.0)
> G1=FLRNDM(XDUMMY)
> G2=FLRNDM(XDUMMY)
> END DO
>
> XBEAM=R*(2.0*G1-1.0)
> YBEAM=R*(2.0*G2-1.0)
> ZBEAM=H*(2.0*FLRNDM(XDUMMY)-1.0)
>
> but for every particle, it gives the same value for G1 and G2,
> what is the problem?
>
> Many thanks
> Yuanjie
>
>
>
Received on Tue Jul 16 2013 - 10:02:08 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 16 2013 - 10:02:09 CEST