5.3.18. ユーザー定義ソース¶
s-type=100のソースタイプです。usrsors.f90 にプログラムを書き込むことにより、ユーザー定義のソースを利用することができます。
以下に示すソースのパラメータをソースセクションに指定した場合は、ユーザーソースで定義された値よりも優先します。
以下のものが指定されたとき、ユーザー定義データがある場合もユーザー定義データより優先します。
値 |
説明 |
下限 \(x\) 座標[cm]。 |
値 |
説明 |
上限 \(x\) 座標[cm]。 |
値 |
説明 |
下限 \(y\) 座標[cm]。 |
値 |
説明 |
上限 \(y\) 座標[cm]。 |
値 |
説明 |
下限 \(z\) 座標[cm]。 |
値 |
説明 |
上限 \(z\) 座標[cm]。 |
値 |
説明 |
スピンの方向ベクトルの \(x\) 成分。 |
値 |
説明 |
スピンの方向ベクトルの \(y\) 成分。 |
値 |
説明 |
スピンの方向ベクトルの \(z\) 成分。 |
値 |
説明 |
(D=1.0) |
入射粒子の \(z\) 軸方向からの方向余弦。 all を指定した時は、等方分布。 data を指定した時は、 a-type サブセクションが必要。 |
値 |
説明 |
(D= all) |
入射粒子の方位角[degree]。 = all; 0から360の範囲でランダムに決定。 |
値 |
説明 |
(D=0.0) |
入射粒子方向の立体角範囲[degree]。 = \(-1\) ; \(\cos^2\) のbiasがかかった分布。 |
値 |
説明 |
(単色の場合)入射粒子のエネルギー[MeV/n]。 e-type = & (分布をもつ場合)入射粒子のエネルギー[MeV/n]。 |
値 |
説明 |
(初期値無し) |
(分布をもつ場合)入射粒子のエネルギー[MeV/n]。これとe0のどちらかの指定が必要。 |
値 |
説明 |
(D=1.0) |
ソース粒子のウエイト。 |
値 |
説明 |
(D=1.0) |
ソース粒子のウエイトの規格化定数。 t-type = & (D=0) 時間分布。 |
値 |
説明 |
(D=all) |
領域を限定する. |
値 |
説明 |
(D=1000) |
領域限定の際の最大再試行回数。 |
値 |
説明 |
(D=なし) |
座標変換番号もしくは座標変換定義。 |
インプットファイルで set により指定したユーザー定義定数 c1-c99 は、プログラム内で cval(1-99) により参照できます。 ただし、複数回指定した場合は最後に定義した値が有効となります。
デフォルトで usrsors.f90 に入っているプログラムは、以下のようなものです。
最初のコメント部に、ソースに必要な変数と、粒子指定に必要なkf codeのリストがあります。
次に、プログラム内で使用できる一様乱数と、ガウス乱数のfunctionの説明があります。
プログラムの最初の部分は、初期化の際のファイルのオープンの例があります。
最後の部分に必要な変数の値の一つの例が書かれています。
この例題を参考にユーザー定義ソースを書いてください。
ソースセクションで指定した変数は、優先しますから、その場合は、ここで定義する必要はありません。
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