From: Alberto Fasso' (fasso@SLAC.Stanford.EDU)
Date: Tue Nov 28 2006 - 20:38:02 CET
First I would like to comment on your idea to do a two-step calculation
for photons (from gas bremsstrahlung, I guess) streaming through the ratchet
wall. This seems to be a common trend (I have just discussed it with other
colleagues from another photon source), but I don't recommend it.
It is always easy to make mistakes in two-step calculations, mainly in
doing the normalization but also in defining which particles to "dump"
in the first step. Sometimes it is unavoidable in order to limit computing time,
but in your case it certainly isn't. It is much better to make an
extensive use of leading particle biasing, applied to all regions
where electrons and photons are transported (option EMF-BIAS with
WHAT(1) = 1022.) You will see that computing times will be very reasonable,
and your results will be much better.
However, since this can be useful in other circumstances, I will try to
answer your questions about collision files.
I must admit that in the manual the description of USERDUMP and of the
preparation of a collision file are unnecessarily complicated. In particular,
boundary crossing dumping has been a late addition to the code which is not yet
well explained. Chapter 11 still foresees only 3 cases: continuous energy
deposition, point energy deposition and source particles. It ignores boundary
crossing and user-defined dumps, which in my experience are the most common
requested features. I am planning to rewrite soon the whole chapter in a more
Here I will give you a simple recipe.
1) Forget the default. What is described in Chapter 11 assumes that you
have a USERDUMP command in your input, but you do not intend to write
your own version of MGDRAW (i.e. you use the default version which is
in the FLUKA library, so you don't have to modify, compile and link it).
The latter possibility is just mentioned, but not explained in detail:
"Data are written on the collision tape in single precision and unformatted,
but it is also possible for the user to modify the MGDRAW subroutine and to
obtain a more customised output file".
I suggest that you do just this, now I will show you how.
2) Have a look at the mgdraw.f routine in directory $FLUPRO/usermvax.
In addition to the main entry MGDRAW (dumping trajectories and dE/dx energy
losses), it has 5 other ENTRYes:
BXDRAW (boundary crossing, that you are interested in)
EEDRAW (called at the end of an event)
ENDRAW (point energy deposition)
SODRAW (source particles)
USDRAW (called at various physical interactions)
Calls to each of the above entries, or some combination of them, are
activated by setting some WHAT parameter in command USERDUMP.
3) Boundary crossing dumping is not mentioned in the description of command
USERDUMP. To get it, do the following:
WHAT(1) = 100.
WHAT(2) = 0.0 (I suggest that you do your own file opening in the user
routine, see below)
WHAT(3) = any out of 0., 2., 3., 4., 5., 6. (i.e., not 1.). All these
choices generate calls to ENTRY BXDRAW, but each of them is in
combination with some other ENTRY:
0. calls BXDRAW, SODRAW, MGDRAW, ENDRAW, EEDRAW
2. calls BXDRAW, MGDRAW, ENDRAW, EEDRAW
3. calls BXDRAW, ENDRAW, EEDRAW
etc. (see description of WHAT(3) in the manual)
If you intend to use only BXDRAW, set WHAT(3) = 3., which minimizes
the number of calls.
WHAT(4) = 0. (unless you need also calls to USDRAW)
SDUM = blank (as I said, better do your own file opening).
4) I assume now that you only need BXDRAW. Edit the mgdraw.f routine and
remove all the existing code under each of the other entries, so that you
DIMENSION DTQUEN ( MXTRCK, MAXQMG )
DATA LFCOPE / .FALSE. /
ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
.... see later ....
ENTRY EEDRAW ( ICODE )
ENTRY ENDRAW ( ICODE, MREG, RULL, XSCO, YSCO, ZSCO )
ENTRY USDRAW ( ICODE, MREG, XSCO, YSCO, ZSCO )
5) Now fill in your requests under the BXDRAW entry.
First open your collision file at the first call. In a first attempt,
open it as a formatted file. It takes more disk space and it is less
accurate, but it allows you to look at it and check that it is what you
want. Once everything is fine, you might change it to unformatted.
In what follows, xx is any logical I/O unit number (must be > 20),
and abcdef is the name you want to give to the collision file.
It will be returned to you as inputname001_abcdef (if inputname is the name
of your input file)
ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
IF ( .NOT. LFCOPE ) THEN
LFCOPE = .TRUE.
OPEN ( UNIT = xx, FILE = "abcdef", STATUS = 'UNKNOWN')
Then specify your request. A boundary is defined by the region number from
which the particle is coming (MREG in the argument list), and the region
number into which it is entering (NEWREG). XSCO, YSCO and ZSCO are the
coordinates of the crossing point. If you need to specify other things
(particle type, energy, direction cosines, etc.) use the variables in
COMMON TRACKR (explained in Chap. 13 of the manual)
Write down coordinates, energy and weight of all photons crossing from region
18 to region 31
IF(MREG .EQ. 18 .AND. NEWREG .EQ. 31 .AND. JTRACK .EQ. 7) THEN
WRITE(xx, 100) XSCO, YSCO, ZSCO, ETRACK, WTRACK
If you want photons crossing in both directions:
IF(((MREG .EQ. 18 .AND. NEWREG .EQ. 31) .OR. (MREG .EQ. 31 .AND.
& NEWREG .EQ. 18)) .AND. JTRACK .EQ. 7) THEN
...and of course you can code any other condition you want
Note the importance of ALWAYS writing the weight, as Alfredo has already
stressed. Particles without their weight are meaningless.
If you have an geometry input with names instead of numbers,
you need to add first a call to a special routine to convert names to
numbers. But this is already a mail too long, let's do that in another one
if anybody is interested.
Also, I attach an example of source which reads a collision file similar to the
one described above.
On Mon, 27 Nov 2006, Holbourn, MP (Martin) wrote:
> My geometry is similar to that found at most storage rings - a concrete
> ratchet wall with a beampipe through the end wall. My job runs successfully
> and I do indeed get high energy photons streaming through the hole in the
> concrete from electrons lost upstream on a collimator. What I want to do is
> use these photons as the source to a separate phased run as described in the
> section of the manual relating to collision tapes. The manual seems to suggest
> that one can record all particles crossing a given boundary but how do you
> specify which boundary crossing you are interested in? Option USERDUMP does
> not seem to contain any info on how to specify a boundary so am I missing
> something? Should WHAT(3) of USERDUMP be = 1?
> Also how does one write subroutine SOURCE to read the collision tape? Page 416
> of the manual says for case 3 (source particles) the first record contains
> NCASE, LSTACK, LSTMAX, TKESUM, WEIPRI
> and the next record
> (ILO(I), ETOT(I), WT(I), XA(I), YA(I), ZA(I), TX(I), TY(I), TZ(I), I=1,LSTACK)
> BUT P438 of the manual suggests reading the collision tape by the statement
> READ(21,*) IPART,X ,Y ,Z, COSX, COSY, COSZ, ENERGY, WEIGHT
> which is a different order of variables than written to the tape - again I
> might have misunderstood what is going on here.
> Can anyone point me in the right direction or perhaps share a working source.f
> routine that does what I am trying to do.
> Thanks for any help,
> Martin Holbourn
> Radiation Protection Adviser
> Daresbury Laboratory
> WA4 4AD
> Tel: 01925 603266
> Fax: 01925 603381
-- Alberto Fasso` SLAC-RP, MS 48, 2575 Sand Hill Road, Menlo Park CA 94025 Phone: (1 650) 926 4762 Fax: (1 650) 926 3569 email@example.com
This archive was generated by hypermail 2.1.6 : Wed Nov 29 2006 - 00:01:09 CET