5.3.18. User-defined source¶
An original source function can be used by editing usrsors.f90 and setting s-type = 100.
If the following parameters are set, these values have priority over the user-defined data.
Parameters with (D=***) are optional.
value |
explanation |
Minimum x coordinate [cm]. |
value |
explanation |
Maximum x coordinate [cm]. |
value |
explanation |
Minimum y coordinate [cm]. |
value |
explanation |
Maximum y coordinate [cm]. |
value |
explanation |
Minimum z coordinate [cm]. |
value |
explanation |
Maximum z coordinate [cm]. |
value |
explanation |
(D=0) |
x component of spin. |
value |
explanation |
(D=0) |
y component of spin. |
value |
explanation |
(D=0) |
z component of spin. |
value |
explanation |
Direction cosine of the projectile relative to the z-axis. |
|
all |
Isotropic source. |
data |
An a-type subsection is required. |
value |
explanation |
(D=all) |
Azimuthal angle [degree]. |
all |
Randomly selected in the range from 0 to 360 degrees. |
value |
explanation |
(D=0.0) |
Solid angle spread [degree]. |
-1 |
\(\cos^2\) bias distribution. |
value |
explanation |
For mono-energy source, specify the projectile energy [MeV/n]. For an energy spectrum, use e-type = instead. |
value |
explanation |
mono-energy source |
Give the source energy [MeV/n] directly by e0. |
energy spectrum |
Specify the source energy distribution by e-type. |
value |
explanation |
(D=1.0) |
Weight of source particles. |
value |
explanation |
(D=1.0) |
Normalization factor of the source particle. |
value |
explanation |
(D=all) |
Region restriction. |
value |
explanation |
(D=1000) |
Maximum number of retries when reg is specified. |
value |
explanation |
(D=none) |
Transform number, or the definition of transform. |
User-defined variables c1-c99 set by set can be used in usrsors.f90 as cval(1-99).
Note that the last setting of set is used if the same variable is defined several times.
A sample program of usrsors.f90 is shown below.
In the first comment part, there is a list of the variables necessary to define the source.
Next, there is a list of kf-codes specifying the source particle.
In the last part of the comment, the random number functions are shown, one for a uniform random number and the other for a Gaussian random number.
The first part of the program is an example of the initialization, which describes the opening and closing of the data file.
The remaining part shows a list of the variables the user should define in this subroutine.
1 !***********************************************************************
2 ! *
3 subroutine usrsors(x,y,z,u,v,w,e,wt,time,name,kf,nc1,nc2,nc3, &
4 & sx,sy,sz)
5 ! *
6 ! sample subroutine for user defined source. *
7 ! *
8 ! variables : *
9 ! *
10 ! x, y, z : position of the source. *
11 ! u, v, w : unit vector of the particle direction. *
12 ! e : kinetic energy of particle (MeV). *
13 ! wt : weight of particle. *
14 ! time : initial time of particle. (ns) *
15 ! name : usually = 1, for Coulmb spread. *
16 ! kf : kf code of the particle. *
17 ! nc1 : initial value of counter 1 *
18 ! nc2 : initial value of counter 2 *
19 ! nc3 : initial value of counter 3 *
20 ! sx,sy,sz : spin components *
21 ! *
22 !----------------------------------------------------------------------*
23 ! *
24 ! kf code table *
25 ! *
26 ! kf-code: ityp : description *
27 ! *
28 ! 2212 : 1 : proton *
29 ! 2112 : 2 : neutron *
30 ! 211 : 3 : pion (+) *
31 ! 111 : 4 : pion (0) *
32 ! -211 : 5 : pion (-) *
33 ! -13 : 6 : muon (+) *
34 ! 13 : 7 : muon (-) *
35 ! 321 : 8 : kaon (+) *
36 ! 311 : 9 : kaon (0) *
37 ! -321 : 10 : kaon (-) *
38 ! *
39 ! kf-code of the other transport particles *
40 ! *
41 ! 12 : nu_e *
42 ! 14 : nu_mu *
43 ! 221 : eta *
44 ! 331 : eta' *
45 ! -311 : k0bar *
46 ! -2112 : nbar *
47 ! -2212 : pbar *
48 ! 3122 : Lambda0 *
49 ! 3222 : Sigma+ *
50 ! 3212 : Sigma0 *
51 ! 3112 : Sigma- *
52 ! 3322 : Xi0 *
53 ! 3312 : Xi- *
54 ! 3334 : Omega- *
55 ! *
56 !----------------------------------------------------------------------*
57 ! *
58 ! available function for random number *
59 ! *
60 ! unirn(dummy) : uniform random number from 0 to 1 *
61 ! gaurn(dummy) : gaussian random number *
62 ! for exp( - x**2 / 2 / sig**2 ) : sig = 1.0 *
63 ! *
64 !----------------------------------------------------------------------*
65 ! use of parameter specified in your input *
66 ! You can use parameters c1 - c100 as cval(1) - cval(100) *
67 ! If the parameter is defined more than once in your input file, *
68 ! the value defined at last is used in this subroutine *
69 !***********************************************************************
70 implicit real*8 (a-h,o-z)
71 !-----------------------------------------------------------------------
72 include 'angel01.inc'
73 !-----------------------------------------------------------------------
74 common /rval1/ cval(mxcval), aval(mxcval)
75 data ifirst / 0 /
76 save ifirst
77 !$OMP THREADPRIVATE(ifirst)
78 character filenm*50
79 logical exex
80 !-----------------------------------------------------------------------
81 ! example of initialization
82 !-----------------------------------------------------------------------
83 if( ifirst .eq. 0 ) then
84 ! filenm = 'input.dat'
85 ! inquire( file = filenm, exist = exex )
86 ! if( exex .eqv. .false. ) then
87 ! write(*,*) 'file does not exist => ', filenm
88 ! call parastop( 887 )
89 ! end if
90 ! open(71, file = filenm, status = 'old' )
91 ! close(71)
92 ifirst = 1
93 end if
94 !-----------------------------------------------------------------------
95 ! example for 3 GeV proton with z-direction
96 !-----------------------------------------------------------------------
97 x = 0.0
98 y = 0.0
99 z = 0.0
100 u = 0.0
101 v = 0.0
102 w = 1.0
103 e = 3000.0
104 wt = 1.0
105 time = 0.0
106 name = 1
107 kf = 2212
108 nc1 = 0
109 nc2 = 0
110 nc3 = 0
111 sx = 0.d0
112 sy = 0.d0
113 sz = 0.d0
114 !-----------------------------------------------------------------------
115 return
116 end