310 likes | 441 Views
P HI T S. Multi-Purpose P article and H eavy I on T ransport code S ystem. Advanced Lecture (I) Useful Functions. Last revised 2013/05. Title. 1. Table of Contents. [transform] [counter] [magnetic field]. Table of Contents. 2. [transform] section.
E N D
PHITS Multi-Purpose Particle and Heavy Ion Transport code System Advanced Lecture (I) Useful Functions Last revised 2013/05 Title 1
Table of Contents • [transform] • [counter] • [magnetic field] 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 Translation X Rotation XYZ coordinate system [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. [ T r a n s f o r m ] set: c10[0] $ angle of around Z (degree) set: c20[0] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) 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 Rotation angles around X-, Y-, and Z-axes. X-, Y-, and Z components for translation [transform] 5
Example transform.inp Execute to see the geometry. [ M a t e r i a l ] mat[1] 1H 2 16O 1 [ S u r f a c e ] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [ C e l l ] 100 -1 10 101 1 -1. -11 12 -13 110 0 -10 #101 Let’s try to move this cylinder along the positive direction of Z-axis by 50 cm Cylinder with radius of 5cm and height of 10cm [transform] 6
Example(translation) transform.inp [ S u r f a c e ] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [ C e l l ] 100 -1 10 101 1 -1. -11 12 -13 trcl=1 110 0 -10 #101 [ T r a n s f o r m ] set: c10[0] $ angle of around Z (degree) set: c20[0] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 0 0 0 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ [ T r a n s f o r m ] set: c10[0] $ angle of around Z (degree) set: c20[0] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 0 0 50 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Rotation angles around X-, Y-, and Z-axes. Transformation of cell 101 by tr1. X-, Y-, and Z-components for the translation Move this cylinder along the positive direction of the Z-axis by 50 cm [transform] 7
Example (Rotation) transform.inp [ T r a n s f o r m ] 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 50 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ [ T r a n s f o r m ] set: c10[0] $ angle of around Z (degree) set: c20[0] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 0 0 50 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Rotation angles around X-, Y-, and Z-axes. X-, Y-, and Z-components for the translation Let’s rotate the cylinder around Y-axis by 30 degrees In the case of M=1, the translation is performed after the rotation. [transform] 8
Exercise 1 transform.inp [ T r a n s f o r m ] 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 50 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ [ T r a n s f o r m ] set: c10[0] $ angle of around Z (degree) set: c20[45] $ angle of around Y (degree) set: c30[0] $ angle of around X (degree) tr1 10 0 45 ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ Let’s transform the cylinder along with X-axis by 10 cm and Z-axis by 45 cm, then rotate it around Y-axis by 45 degrees [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 • [transform] • [counter] • [magnetic field] Table of Contents 11
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 [counter] 12
Example of Usage Let “count = counter + 1” when particle exits a region Tally Counter = 1 Counter = 3 Counter = 2 [counter] 13
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] 14
Example counter.inp Check geometry and perform simulation by setting icntl=0 [ S o u r c e ] s-type = 1 proj = proton dir = 1 r0 = 2.5 z0 = -10. z1 = -10. e0 = 290 [ S u r f a c e ] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [ C e l l ] 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 [counter] 15
Example counter.inp [ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 1 0 0 103 0 1 0 0 104 0 1 0 0 [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton.dat title = Proton flux using [T-track] tally ctmin(1) = 1 ctmax(1) = 3 Min & Max values of the counter ID1 for tallied particle flux-proton.eps [counter] 16
Example counter.inp Change the max value of the counter ID1 of tallied particle [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton-c1.dat title = Proton flux using [T-track] tally ctmin(1) = 1 ctmax(1) = 1 [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton.dat title = Proton flux using [T-track] tally ctmin(1) = 1 ctmax(1) = 3 [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton-c3.dat title = Proton flux using [T-track] tally ctmin(1) = 3 ctmax(1) = 3 [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton-c2.dat title = Proton flux using [T-track] tally ctmin(1) = 2 ctmax(1) = 2 flux-proton-c2.eps flux-proton-c3.eps flux-proton.eps flux-proton-c1.eps [counter] 17
Excerise1 counter.inp [ C o u n t e r ] counter = 1 part = neutron reg in out coll ref 102 0 1 0 0 103 0 1 0 0 104 0 1 0 0 [ T - T R A C K ] mesh = reg reg = 101 part = neutron e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-neutron-c1.dat title = Neutron flux using [T-track] tally ctmin(1) = 1 ctmax(1) = 1 [ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 1 0 0 103 0 1 0 0 104 0 1 0 0 [ T - T R A C K ] mesh = reg reg = 101 part = proton e-type = 2 ne = 30 emin = 0. emax = 300. axis = eng unit = 1 file = flux-proton-c1.dat title = Proton flux using [T-track] tally ctmin(1) = 1 ctmax(1) = 1 Change the countered particle from proton to neutron, and check the profiles of neutrons considering their origin • Counter conditions • ctmin(1)=1, ctmax(1)=3 • ctmin(1)=3, ctmax(1)=3 • ctmin(1)=2, ctmax(1)=2 • ctmin(1)=1, ctmax(1)=1 Increase history number maxcas=1000 [counter] 18
Exercise1 counter.inp Change the countered particle from proton to neutron, and check the profiles of neutrons considering their origin • Counter conditions • ctmin(1)=1, ctmax(1)=3 • ctmin(1)=3, ctmax(1)=3 • ctmin(1)=2, ctmax(1)=2 • ctmin(1)=1, ctmax(1)=1 Less number of neutrons passing through all 3 regions in comparison to that of protons Increase history number maxcas=1000 flux-neutron.eps flux-neutron-c3.eps flux-neutron-c2.eps flux-neutron-c1.eps [counter] 19
Exercise2 counter.inp Q. Are all neutrons with counter = 1 originated from cell 102? A. No. Neutrons originated in cells 103 or 104 but without passing through other cells also have counter = 1 • How can you distinguish between neutrons originated in cells 102, 103 or 104? • Set 3 counter IDs individually • How about neutrons originated in cell 102, and scattered in cell 103 before arriving at cell 101? [counter] 20
Table of Contents • [transform] • [counter] • [magnetic field] Table of Contents 21
[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] 22
[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] 23
Input Format 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 Y-axis when it is going to the positive direction of Z-axis 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 [magnetic field] 24
Example magfield.inp Check geometry and perform simulation by setting icntl=0 [ S o u r c e ] s-type = 1 proj = proton dir = 1 r0 = 2.5 z0 = -10. z1 = -10. e0 = 290 [ S u r f a c e ] 10 so 500. 11 cz 5. 12 pz 0. 13 pz 10. [ C e l l ] 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] 25
Example for Dipole Magnet magfield.inp [ P a r a m e t e r s ] icntl = 0 maxcas = 100 maxbch = 10 c imagnf = 1 file(6) = phits.out [magnetic field] reg typ gap mgf 104 2 10 100 [ P a r a m e t e r s ] icntl = 0 maxcas = 100 maxbch = 10 imagnf = 1 file(6) = phits.out [magnetic field] reg typ gap mgf 104 2 10 100 [magnetic field] 26
Example for Quadrupole Magnet magfield.inp [ P a r a m e t e r s ] icntl = 0 maxcas = 100 maxbch = 10 imagnf = 1 file(6) = phits.out [magnetic field] reg typ gap mgf 104 2 10 100 [ P a r a m e t e r s ] icntl = 0 maxcas = 100 maxbch = 10 imagnf = 1 file(6) = phits.out [magnetic field] reg typ gap mgf 104 4 10 100 [magnetic field] 27
Exercise1 magfield.inp Check divergence of particles along to the Y-axis [ T - T R A C K ] 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 30.0 40.0 50.0 60.0 part = proton ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ file = xy_track_proton.dat [ T - T R A C K ] mesh = xyz x-type = 2 nx = 100 xmin = -25. xmax = 25. y-type = 2 ny = 100 ymin = -25. ymax = 25. z-type = 1 nz = 1 -5.0 5.0 part = proton ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ file = xy_track_proton.dat [magnetic field] 28
Exercise2 magfield.inp • 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] 29
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 30