.. _userdefined: [ T-Userdefined ] セクション ================================================== ユーザー定義タリーは、通常のタリーでは得ることができない様々な物理量をタリーする機能です。 各ユーザーが PHITS のソースファイル ``usrtally.f`` を Fortran 言語を用いて変更し、求める物理量を書き出します。 このため、ソースファイルのコンパイルが必要となります。 インプットファイルで **[t-userdefined]** セクションを定義することにより、PHITS 実行時に ``subroutine usrtally`` を通過するようになります。 通過のタイミングは **dumpall** の書き出しと同じで、あらゆるイベントが発生した時です。 本タリーの基本的な考え方として、``subroutine usrtally`` で示されている変数を if 文等の条件で選別してカウントすることで、求める物理量を引き出します。 この ``subroutine`` で扱うことができる変数を以下で説明しますが、中には値を変更すると PHITS の計算がおかしくなる変数もあるので、十分に注意してください。 本タリーの具体的な利用方法については、``\phits\utility\usrtally`` フォルダにある readme やサンプルインプットを参照してください。 **[t-userdefined]** セクションでは、書き出し用ファイル名を与える **file**、``subroutine usrtally`` で使用できるパラメータの数を指定する **nudtvar**、およびそのパラメータの値 **udtvar(i)** [#udtvar-note]_ が定義できます。 これらは再コンパイルせずに変更できる変数です。 .. rst-class:: no-caption-number .. list-table:: **file** :header-rows: 0 * - value - explanation * - ``file name`` - ``subroutine usrtally`` 内で使用できる書き出し用ファイルです。 最大 50 まで定義できます。装置番号は 151-200 です。 .. rst-class:: no-caption-number .. list-table:: **nudtvar** :header-rows: 0 * - value - explanation * - **0** (default) - 定義する **udtvar(i)** の数です。 .. rst-class:: no-caption-number .. list-table:: **udtvar(i)** :header-rows: 0 * - value - explanation * - numerical value (D=0) - ``subroutine usrtally`` 内で使用できるパラメータです。 **i=nudtvar** まで定義できます。 .. _ex-tudf-ex1: .. code-block:: text :caption: **[T-Userdefined]** パラメータの入力例 1: file = output1.dat <-装置番号は151で、subroutine usrtally内ではiudtf(1) 2: file = output2.dat <-装置番号は152で、subroutine usrtally内ではiudtf(2) 3: nudtvar = 2 <-subroutine usrtally内ではnudtvar 4: udtvar(1) = 20.0 <-subroutine usrtally内ではudtvar(1) 5: udtvar(2) = -10.0 <-subroutine usrtally内ではudtvar(2) 以下が ``subroutine usrtally`` 内で示されている変数です。 1. **NCOL** これはプログラムの中の変数で、粒子輸送のタイミングの認識変数です。 .. code-block:: text :caption: **NCOL** の意味 NCOL 1 : start of calculation 2 : end of calculation 3 : end of a batch 4 : source 5 : detection of geometry error 6 : recovery of geometry error 7 : termination by geometry error 8 : termination by weight cut-off 9 : termination by time cut-off 10 : geometry boundary crossing 11 : termination by energy cut-off 12 : termination by escape or leakage 13 : (n,x) reaction 14 : (n,n'x) reaction 15 : sequential transport only for tally 16 : surface cross for WW of xyz mesh 2. **npe, me** それぞれメモリ分散型並列計算時の並列 PE (Processor Element) 数と、各 Element の識別番号です。 3. **ipomp, npomp** それぞれメモリ共有型並列計算時のスレッド識別番号と、使用している全スレッド数です。 4. **iusrtally** ``subroutine usrtally`` への通過をコントロールするパラメータです。インプットファイルに **[T-Userdefined]** セクションがあれば 1 になっています。 5. **iudtf(50)** **file** で定義したファイルの装置番号 151-200 です。 6. **nudtvar** **nudtvar** として定義した数です。使用できる **udtvar(i)** の上限値です。 7. **udtvar(i)** **udtvar(i)** で定義した値です。**i=nudtvar** まで使用できます。インプットファイルで定義していない **udtvar(i)** には 0 が入っています。 8. **NOCAS, NOBCH, RCASC, RSOUIN** .. code-block:: text :caption: **NOCAS**, **NOBCH**, **RCASC**, **RSOUIN** の意味 NOCAS : current event number in this batch NOBCH : current batch number RCASC : real number of NOCAS+maxcas*(NOBCH-1) RSOUIN : sum of the weight of source particle 9. **NO, IDMN, ITYP, KTYP, JTYP, MTYP, RTYP, OLDWT** .. code-block:: text :caption: **NO**, **IDMN**, **ITYP**, **KTYP**, **JTYP**, **MTYP**, **RTYP**, **OLDWT** の意味 NO : cascade id in this event IDMN : material id ITYP : particle type KTYP : particle kf-code JTYP : charge number of the particle MTYP : baryon number of the particle RTYP : rest mass of the particle (MeV) OLDWT : weight of the particle at (x,y,z) 10. **QS** 電子の阻止能 (:math:`dE/dx`) です。 11. **IBLZ1, IBLZ2, ILEV1, ILEV2** .. code-block:: text :caption: **IBLZ1**, **IBLZ2**, **ILEV1**, **ILEV2** の意味 IBLZ1 : cell id at (x,y,z) IBLZ2 : cell id after crossing ILEV1 : level structure id of the cell at (x,y,z) ILEV2 : level structure id of the cell after crossing **ILAT1** と **ILAT2** は、階層構造をもつ CELL の変数です。 12. **COSTH, UANG(1), UANG(2), UANG(3), NSURF** .. code-block:: text :caption: **COSTH**, **UANG(1-3)**, **NSURF** の意味 COSTH : cosine of an angle of incidence in a surface crossing UANG(1,2,3) : x,y,z component of a normal vector of its surface, respectively NSURF : internal number of the surface This is different from the surface number defined in **[surface]**. 13. **NAME, NCNT(1), NCNT(2), NCNT(3)** .. code-block:: text :caption: **NAME**, **NCNT(1-3)** の意味 NAME : collision number of the particle NCNT(1,2,3) : values of counter 1, 2, and 3 14. **WT, U, V, W** .. code-block:: text :caption: **WT**, **U**, **V**, **W** の意味 WT : weight of the particle at (xc,yc,zc) U, V, W : unit vector of momentum of the particle 15. **E, T, X, Y, Z** .. code-block:: text :caption: **E**, **T**, **X**, **Y**, **Z** の意味 E : energy of the particle at (x,y,z) (MeV) T : time of the particle at (x,y,z) (nsec) X, Y, Z : position coordinate of the preceding event point (cm) 16. **EC, TC, XC, YC, ZC** .. code-block:: text :caption: **EC**, **TC**, **XC**, **YC**, **ZC** の意味 EC : energy of the particle at (xc,yc,zc) (MeV) TC : time of the particle at (xc,yc,zc) (nsec) XC, YC, ZC : position coordinate of the particle (cm) 17. **SPX, SPY, SPZ** .. code-block:: text :caption: **SPX**, **SPY**, **SPZ** の意味 SPX, SPY, SPZ : unit vector of spin direction of the particle 18. **NZST** 粒子がもつ電荷 (charge state) です。 19. **NCLSTS** 衝突もしくは崩壊による生成粒子の個数です。原子核も含みます。 **MATHZ, MATHN, JCOLL, KCOLL** .. code-block:: text :caption: **MATHZ**, **MATHN**, **JCOLL**, **KCOLL** の意味 MATHZ : Z number of the mother nucleus MATHN : N number of the mother nucleus JCOLL : reaction type id1 KCOLL : reaction type id2 **JCOLL** と **KCOLL** はそれぞれ次のような意味を持ちます。 .. code-block:: text :caption: **JCOLL** の意味 JCOLL 0 : nothing happen 1 : Hydrogen collisions 2 : Particle Decays 3 : Elastic collisions 4 : High Energy Nuclear collisions 5 : Heavy Ion reactions 6 : Neutron reactions by data 7 : Photon reactions by data 8 : Electron reactions by data 9 : P,d,a, and photo-nuclear reactions by data 10 : Neutron event mode 11 : Delta Ray production 12 : Muon atomic interaction 13 : Photon reactions by EGS5 14 : Electron reactions by EGS5 15 : Photon photonuclear interaction 16 : Negative muon captured by nucleon 17 : Muon photonuclear interaction 18 : Electron recoil by track structure mode 19 : Muon pair production (photon -> mu+ mu-) 20 : User defined interaction .. code-block:: text :caption: **KCOLL** の意味 KCOLL 0 : normal 1 : high energy fission 2 : high energy absorption 3 : low energy n elastic 4 : low energy n non-elastic 5 : low energy n fission 6 : low energy n absorption **ICLUSTS, JCLUSTS, QCLUSTS, JCOUNT** これらの変数は、各生成粒子の情報を記述するもので、**NCLSTS** だけ繰り返し、また、それぞれの変数も以下のように配列を持ちます。 .. code-block:: text :caption: **ICLUSTS** の意味 ICLUSTS 0 : nucleus 1 : proton 2 : neutron 3 : pion 4 : photon 5 : kaon 6 : muon 7 : others .. code-block:: text :caption: **JCLUSTS(i)** の意味 JCLUSTS(i) i = 0 : angular momentum = 1 : proton number = 2 : neutron number = 3 : ityp = 4 : status of the particle, 0: real, <0: dead = 5 : charge number = 6 : baryon number = 7 : kf code = 8 : isomer level (0: ground state, 1: first isomer, 2: second isomer) .. code-block:: text :caption: **QCLUSTS(i)** の意味 QCLUSTS(i) i = 0 : impact parameter = 1 : x-component of unit vector of momentum = 2 : y-component of unit vector of momentum = 3 : z-component of unit vector of momentum = 4 : e_tot = sqrt(p^2 + m^2) (GeV) = 5 : rest mass (GeV) = 6 : excitation energy (MeV) = 7 : kinetic energy (MeV) = 8 : weight = 9 : time (nsec) = 10 : x coordinate (cm) = 11 : y coordinate (cm) = 12 : z coordinate (cm) .. [#udtvar-note] バージョン 3.01 以前の **udtparai** (:math:`i=0-9`) と同様の役割を果たします。バージョン 3.02 以降の PHITS でも **udtparai** は使用可能です。