PHITS Multi-Purpose Particle and Heavy Ion Transport code System Advanced Lecture (I) Useful Functions Last revised 2014/08 Title 1 Table of Contents 1. [transform] 2. [magnetic field] 3. [counter] Table of Contents 2 [transform] section You can translate and/or rotate the geometries defined in [source], [surface], [cell], [magnetic field] sections as well as r-z and xyz meshes defined in any tally. Z Y Rotation X XYZ coordinate system Translation [transform] 3 Input Formats In the case of M=1, • • • • n : ID of transformation O1,O2,O3: Displacement vector B1~B9: Elements of rotation matrix M: Parameter to change the equation of the transformation (Only for the case of M=1 is shown here.) [transform] 4 Convenient Way to Use You can use the following sample to easily transform the coordinate. [Transf set: c10[0] set: c20[0] set: c30[0] orm] $ angle of around Z (degree) $ angle of around Y (degree) $ angle of around X (degree) Rotation angles around X-, Y-, and Z-axes. X-, Y-, and Z components for translation tr1 0 0 0 cos(c10/180*pi)*cos(c20/180*pi) sin(c10/180*pi)*cos(c30/180*pi)+cos(c10/180*pi)*sin(c20/180*pi)*sin(c30/180*pi) sin(c10/180*pi)*sin(c30/180*pi)-cos(c10/180*pi)*sin(c20/180*pi)*cos(c30/180*pi) -sin(c10/180*pi)*cos(c20/180*pi) cos(c10/180*pi)*cos(c30/180*pi)-sin(c10/180*pi)*sin(c20/180*pi)*sin(c30/180*pi) cos(c10/180*pi)*sin(c30/180*pi)+sin(c10/180*pi)*sin(c20/180*pi)*cos(c30/180*pi) sin(c20/180*pi) -cos(c20/180*pi)*sin(c30/180*pi) cos(c20/180*pi)*cos(c30/180*pi) 1 [transform] 5 Example transform.inp Execute to see the geometry. [Material] mat[1] 1H 2 16O 1 [Surface] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [Cell] 100 -1 101 1 -1. 110 0 Let’strack_xy.eps rotate the cylinder around Y-axis by 30 degrees 10 -11 12 -13 -10 #101 Cylinder with radius of 5cm and height of 10cm [transform] track_xz.eps 6 Example (Rotation) transform.inp [Transform] set: c10[0] $ angle of around Z (degree) set: c20[0] c20[30] $$angle angleofofaround aroundYY(degree) (degree) set: c30[0] $ angle of around X (degree) tr1 0 0 0 ・・・・・・・・・・・・・・・・・・ [Surface] 10 so 500. 11 cz 5. Rotation angles around X-, 12 pz 0. Transformation Y-, and Z-axes. 13 pz 10. of cell 101 by tr1. C e and l l ] Z-components X-, [Y-, 100 -1 10 for the translation 101 1 -1. -11 12 -13 trcl=1 110 0 -10 #101 Let’s rotate the cylinder around Y-axis by 30 degrees track_xz.eps [transform] 7 Example(translation) transform.inp [Transform] set: c10[0] $ angle of around Z (degree) set: c20[30] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 0 0 0 50 ・・・・・・・・・・・・・・・・・・ Move this cylinder along the positive direction of the Z-axis by 50 cm Rotation angles around X-, Y-, and Z-axes. X-, Y-, and Z-components for the translation In the case of M=1, the translation is performed after the rotation. track_xz.eps [transform] 8 Exercise 1 transform.inp Let’s rotate the cylinder around Y-axis by 45 degrees, then transform it along with X-axis by 10 cm and Z-axis by 45 cm. [Transform] set: c10[0] $ angle of around Z (degree) set: c20[45] c20[30] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 10 0 00 50 45 ・・・・・・・・・・・・・・・・・・ [transform] 9 Exercise 2 transform.inp Construct the geometry shown below by adding 3 cells •Do not change [surface] section •Change [cell] & [transform] section In [transform] section, copy & paste lines below set: c10[*] by 3 times, and assign each transform equation by tr2, tr3, tr4, respectively [transform] 10 Table of Contents 1. [transform] 2. [magnetic field] 3. [counter] Table of Contents 11 [magnetic field] section You can set magnetic fields (dipole and quadrupole) in certain region in PHITS geometry to bend and deflect the charged particle trajectories Example of dipole magnet: Homogeneous magnetic field F=ev×B [magnetic field] 12 [magnetic field] section You can set magnetic fields (dipole and quadrupole) in certain region in PHITS geometry to bend and deflect the charged particle trajectories Example of quadrupole magnet: Converge charged particle trajectory Y-axis N S X-axis S N Schematic image of quadrupole magnet [magnetic field] 13 Input Format reg: cell ID to set the magnetic field typ: dipole (=2) or quadrupole (=4) gap: half distance between magnet in cm (not used for dipole but need to be input) mgf: strength of magnetic field in kG trcl: transform ID You have to set imagnf=1 in [parameters] section when you use magnetic field Direction of Magnetic Field Y-axis (positive direction) for dipole →positive charged particle bends to the negative direction of X-axis when it is going to the positive direction of Z-axis For quadrupole →positive charged particle converges along to X-axis and diverges along to Yaxis when it is going to the positive direction of Z-axis [magnetic field] 14 Example magfield.inp Check geometry and perform simulation by setting icntl=0 [Source] s-type = 1 proj = proton dir = 1 r0 = 2.5 z0 = -10. z1 = -10. e0 = 290 [Surface] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [Cell] 100 -1 10 101 1 -1. -11 12 -13 trcl=1 102 1 -1. -11 12 -13 trcl=2 103 1 -1. -11 12 -13 trcl=3 104 1 -1. -11 12 -13 trcl=4 110 0 -10 #101 #102 #103 #104 [magnetic field] 15 Example for Dipole Magnet magfield.inp [Parameters] icntl = 0 maxcas = 100 maxbch = 10 c imagnf imagnf==11 file(6) = phits.out [magnetic field] reg typ gap mgf 104 2 10 100 [magnetic field] 16 Example for Quadrupole Magnet magfield.inp [Parameters] icntl = 0 maxcas = 100 maxbch = 10 imagnf = 1 file(6) = phits.out [magnetic field] reg typ gap mgf 104 2 4 10 100 [magnetic field] 17 Exercise1 magfield.inp Check divergence of particles along to the Y-axis [T-TRACK] mesh = xyz x-type = 2 nx = 100 xmin = -25. xmax = 25. y-type = 2 ny = 100 ymin = -25. ymax = 25. z-type = 1 nz = 3 1 30.0 40.0 50.0 60.0 -5.0 5.0 part = proton ・・・・・・・・・・・・・・・・・・ file = xy_track_proton.dat [magnetic field] 18 magfield.inp Exercise2 Bend and converge the beam to hit cell 103 like the picture below (You do not have to consider the divergence of beam along to Y-axis) •Set two difference magnetic fields •Control the beam by changing the direction and strength of the magnetic fields [magnetic field] 19 Table of Contents 1. [transform] 2. [magnetic field] 3. [counter] Table of Contents 20 What is “Counter” in PHITS? Each particle has its own “Counter” number to identify what it has been experienced, such as entering, exiting from, reacting in, and reflected by a certain region. To investigate the origin of tallied particle → What are the difference between particles Produced in each region? Tally When a particle collides in a region, count = counter +1. [counter] 21 Input Format Counter ID (up to 3) Countered particle (Particle type followed by this counter) Cells for activating this counter Event Types in: Enter the cell out: Exit from the cell coll: React in the cell ref: Reflected by the cell Action •0: Nothing happens •10000: Set counter = 0 •Other: Counter = Counter + Number [counter] 22 Example counter.inp Check geometry and perform simulation by setting icntl=0 [Material] MAT[ 1 ] 1H 2 16O 1 MAT[ 2 ] 14N 8 16O 2 MAT[ 3 ] 63Cu 0.6915 65Cu 0.3085 [Cell] 100 -1 10 101 1 -1. -11 12 -13 trcl=1 102 1 -1. -11 12 -13 trcl=2 103 2 -1.20e-03 -11 12 -13 trcl=3 104 3 -8.93 -11 12 -13 trcl=4 110 0 -10 #101 #102 #103 #104 ・・・・・・ [Counter] counter = 1 part = proton reg in out 102 0 0 coll 1 ref 0 track_xz.eps [counter] 23 Example counter.inp [T-Cross] title = Particle current using [T-cross] tally mesh = reg reg = 1 non r-in r-out area 1 110 101 1.0 e-type = 3 emin = 1.0 emax = 500. ne = 30 From 110 to 101 unit = 1 axis = eng file = cross.dat output = current part = proton angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 cross.eps [counter] 24 Example Add conditions related the counter option to the [t-cross] section! •ctmin(1)=1, ctmax(1)=1 counter.inp [Counter] counter = 1 part = proton reg in out coll ref 102 0 0 1 0 [T-Cross] ・・・・・・ ・・・・・・ ・・・・・・ file = cross-c1.dat output = current part = proton angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(1) = 1 Min & Max values ctmax(1) = 1 of cross-c1.eps Scattered protons only in the the counter ID1 for region 102 are tallied. tallied particle [counter] 25 Exercise 1 counter.inp [Counter] counter = 1 part = proton reg in out coll ref 102 0 0 1 0 Add neutron to “part” in the [t-cross] section to considerer their origin. [T-Cross] ・・・・・・ ・・・・・・ ・・・・・・ file = cross-c1.dat output = current part = proton neutron angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(1) = 1 ctmax(1) = 1 cross-c1.eps Neutrons can also be estimated with the condition as in the protons. [counter] 26 Exercise 2 Let’s tally scattered particles from the 103 and 104 regions as in 102. •Define counter 2 and 3 in the [counter] section to count events occurred in 103 and 104, respectively. •Copy & paste the [t-cross] section (2 times), and set a condition of counter 2 and 3. (change their output file names) tally [counter] 27 Answer 2 counter.inp [Counter] ・・・・・・ counter = 2 part = proton reg in out coll ref 103 0 0 1 0 counter = 3 part = proton reg in out coll ref 104 0 0 1 0 [T-Cross] ・・・・・・ file = cross-c2.dat output = current part = proton neutron angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(2) = 1 ctmax(2) = 1 cross-c2.eps cross-c3.eps • No reaction occurs in the air region. • Protons scattered from 104 are very little. [counter] 28 Summary • You can set up complex geometries as well as source and tallies using [transform] section • You can analyze the simulation results in more detail using [counter] section • You can simulate the particle trajectories in magnetic fields using [magnetic field] section Summary 29