From: Alberto Fasso' <fasso_at_slac.stanford.edu>

Date: Tue, 16 Dec 2008 15:14:20 -0800 (PST)

Date: Tue, 16 Dec 2008 15:14:20 -0800 (PST)

Dear Dufei,

On Tue, 16 Dec 2008, dufei wrote:

*> Dear All:
*

*> I am a new fluka learner and not very familiar with Fortran. I want t=
*

o

*> calculate the deposition of protons on a CR-39 screen through a ring-like
*

*> magnetic field. As I know, I must set what(5) of the ASSIGNMAt card equal=
*

to 1

yes, only for the regions where a magnetic field exists.

*> and use the user routine MAGFLD.
*

You need to have also a card MGNFIELD with WHAT(4), WHAT(5) and WHAT(6) =3D=

0.0

in order to activate a call to MAGFLD.

*> But the user guide within the tar.gz file
*

*> only give a little description of the argument list. Could anyone give me=
*

a

*> more detail information of how to complete this job.
*

*>From the manual, Note on command MGNFIELD:
*

Note that the argument list of subroutine MAGFLD is

( X, Y, Z, BTX, BTY, BTZ, B, NREG, IDISC )

where BTX, BTY, BTZ are the DIRECTION COSINES of the magnetic

field at point X, Y, Z (NOT the components of the field!

The field magnitude is given by B). For this reason, it

is imperative that MAGFLD returns normalised values of BTX,

BTY and BTZ such that the sum of their squares is =3D 1.0

IN DOUBLE PRECISION.

Three zero values are not accepted: if the field is zero

at the point in question, you must return for instance 0, 0, 1

and B =3D 0. On the contrary, note that Bx, By, Bz in the

MGNFIELD option, given by WHAT(4)...WHAT(6) as described

above, are the field components and not the cosines.

It looks to me that the arguments in the list are well explained, with

the exception of NREG and IDISC.

More information is available in Chapter 13.2}:

--------

magfld.f definition of a magnetic field

--------

Argument list:

X,Y,Z: current position (input only)

BTX,BTY,BTZ: direction cosines of the magnetic field vector

(returned).

B: magnetic field intensity in Tesla (returned)

NREG: current region (input only)

IDISC: if returned =3D 1, the particle will be discarded

*> Our magnetic field is B(r)=3DB0exp(-|r-R0|/Re), where B0 is the maxim=
*

um

*> field, r is the distance apart from the ring-like axis(z axis), R0 and Re=
*

are

*> contants.
*

You will need to derive the value of B from X and Y:

R =3D SQRT(X**2 + Y**2)

B =3D B0 * EXP(-ABS(R - R0)/RE)

But you need to return also the direction cosines of the magnetic field.

You did not say what the direction is, but it looks that it is parallel to =

z.

In this case, you will write:

BTX =3D ZERZER

BTY =3D ZERZER

BTZ =3D ONEONE

Using the pre-defined values ZERZER and ONEONE for 0.D0 and 1.D0, you are s=

ure

that the cosines are correctly normalized. Otherwise, you need to provide

the normalization (in double precision!):

BTX =3D value of x cosine

BTY =3D value of y cosine

BTZ =3D SQRT(ONEONE - BTX**2 - BTY**2))

*> The range along the z axis is Zm.
*

I don't understand what you mean by this.

*> I know that the .f file will
*

*> produce a executable finally. Do I execute this file directly or use $FLU=
*

PRO/

*> flutil/rfluka -N0 -M5 filename & to calculate the .inp file and let the r=
*

fluka

*> to call the final executable?
*

You need to do this:

$FLUPRO/flutil/lfluka -m fluka -o mynewexe magfld.f

where mynewexe is any name you want to give to your executable. If you have

other user routines you want to link at the same time, you must add them

at the end, for instance

$FLUPRO/flutil/lfluka -m fluka -o mynewexe magfld.f source.f ...

Then, when you want to run FLUKA:

$FLUPRO/flutil/rfluka -e mynewexe -N0 -M5 filename &

(note the -o at linking time and the -e at running time)

Alberto

--=20

Alberto Fass=F2

SLAC-RP, MS 48, 2575 Sand Hill Road, Menlo Park CA 94025

Phone: (1 650) 926 4762 Fax: (1 650) 926 3569

fasso_at_slac.stanford.edu

--1334205520-877496204-1229469260=3D:6367--

Received on Wed Dec 17 2008 - 22:56:44 CET

*
This archive was generated by hypermail 2.2.0
: Wed Dec 17 2008 - 22:56:48 CET
*