29
PHITS Useful Functions Multi-Purpose Particle and Heavy Ion Transport code System Title 1 Oct. 2015 revised

P HI T S

  • Upload
    tanner

  • View
    14

  • Download
    0

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: P HI T S

PHITS

Useful Functions

Multi-Purpose Particle and Heavy Ion Transport code System

Title 1

Oct. 2015 revised

Page 2: P HI T S

Table of Contents

2

1. [transform]

2. [magnetic field]

3. [counter]

Table of Contents

Page 3: P HI T S

[transform] 3

X

Y

Z

Translation

Rotation

XYZ coordinate system

[transform] sectionYou 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.

Page 4: P HI T S

Input Formats

[transform] 4

• 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.)

In the case of M=1,

Page 5: P HI T S

[ 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

Convenient Way to Use

[transform] 5

You can use the following sample to easily transform the coordinate.

Rotation angles around X-, Y-, and Z-axes.

X-, Y-, and Z components for translation

Page 6: P HI T S

track_xy.eps

Example

[transform] 6

transform.inp

[ 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

Cylinder with radius of 5cm and height of 10cm

Let’s rotate the cylinder around Y-axis by 30 degrees

Execute to see the geometry.

track_xz.eps

Page 7: P HI T S

[ 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[30] $ angle of around Y (degree)set: c30[0] $ angle of around X (degree)

tr1 0 0 0

・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・

Example (Rotation)

[transform] 7

transform.inp

Rotation angles around X-, Y-, and Z-axes.

X-, Y-, and Z-components for the translation

[ 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

Transformation of cell 101 by tr1.

Let’s rotate the cylinder around Y-axis by 30 degrees

track_xz.eps

Page 8: P HI T S

[ 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 0

・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・

[ 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

・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・

Example(translation)

[transform] 8

transform.inp

Rotation angles around X-, Y-, and Z-axes.

X-, Y-, and Z-components for the translation

Move this cylinder along the positive direction of the Z-axis by 50 cm

In the case of M=1, the translation is performed after the rotation.

track_xz.eps

Page 9: P HI T S

[ 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

・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・

Exercise 1

[transform] 9

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.

[ 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

・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・ ・

Page 10: P HI T S

Exercise 2

[transform] 10

transform.inp

Construct the geometry shown below by adding 3 cells•Do not change [surface] section•Change [cell] & [transform] sectionIn [transform] section, copy & paste lines below set: c10[*] by 3 times, and assign each transform equation by tr2, tr3, tr4, respectively

Page 11: P HI T S

Table of Contents

11

1. [transform]

2. [magnetic field]

3. [counter]

Table of Contents

Page 12: P HI T S

[magnetic field] section

[magnetic field] 12

You can set magnetic fields (dipole and quadrupole) in certain region in PHITS geometry to bend and deflect the charged particle trajectories

F=ev×B

Example of dipole magnet :Homogeneous magnetic field

Page 13: P HI T S

[magnetic field] section

[magnetic field] 13

Example of quadrupole magnet :Converge charged particle trajectory

Schematic image of quadrupole magnet

N

NS

S

X-axis

Y-axis

You can set magnetic fields (dipole and quadrupole) in certain region in PHITS geometry to bend and deflect the charged particle trajectories

Page 14: P HI T S

Input Format

[magnetic field] 14

reg: cell ID to set the magnetic fieldtyp: 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 kGtrcl: transform ID

You have to set imagnf=1 in [parameters] section when you use magnetic field

Direction of Magnetic FieldY-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-axisFor 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

Page 15: P HI T S

[magnetic field] 15

magfield.inp[ 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

ExampleCheck geometry and perform simulation by setting icntl=0

Page 16: P HI T S

Example for Dipole Magnet

[magnetic field] 16

magfield.inp

[ P a r a m e t e r s ] icntl = 0 maxcas = 100 maxbch = 10c 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

Page 17: P HI T S

[ 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

Example for Quadrupole Magnet

[magnetic field] 17

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 4 10 100

Page 18: P HI T S

[ 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

[ 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

Exercise1

[magnetic field] 18

magfield.inp

Check divergence of particles along to the Y-axis

Page 19: P HI T S

Exercise2

[magnetic field] 19

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

Page 20: P HI T S

Table of Contents

20

1. [transform]

2. [magnetic field]

3. [counter]

Table of Contents

Page 21: P HI T S

What is “Counter” in PHITS?

[counter] 21

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.

Page 22: P HI T S

Input Format

[counter] 22

Counter ID (up to 3)

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

Countered particle (Particle type followed by this counter)

Page 23: P HI T S

Example

[counter] 23

counter.inp[ M a t e r i a l ]MAT[ 1 ] 1H 2 16O 1MAT[ 2 ] 14N 8 16O 2MAT[ 3 ] 63Cu 0.6915 65Cu 0.3085

[ C e l l ] 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

・ ・ ・ ・ ・ ・[ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 0 1 0

Check geometry and perform simulation by setting icntl=0

track_xz.eps

Page 24: P HI T S

Example

[counter] 24

counter.inp

[ T - C r o s s ]title = Particle current using [T-cross] tallymesh = reg reg = 1 non r-in r-out area 1 110 101 1.0 e-type = 3 emin = 1.0 emax = 500. ne = 30 unit = 1 axis = eng file = cross.datoutput = current part = proton angel = ymin[1.E-06] ymax[1.E-02] epsout = 1

From 110 to 101

cross.eps

Page 25: P HI T S

[counter] 25

[ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 0 1 0

[ T - C r o s s ]・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・ file = cross-c1.datoutput = current part = proton angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(1) = 1 ctmax(1) = 1

Min & Max values of the counter ID1 for tallied particle

Add conditions related the counter option to the [t-cross] section!•ctmin(1)=1, ctmax(1)=1

counter.inp

cross-c1.eps

Scattered protons only in the region 102 are tallied.

Example

Page 26: P HI T S

Exercise 1

[counter] 26

Add neutron to “part” in the [t-cross] section to considerer their origin.

Neutrons can also be estimated with the condition as in the protons.

[ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 0 1 0

[ T - C r o s s ]・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・ file = cross-c1.datoutput = current part = proton angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(1) = 1 ctmax(1) = 1

counter.inp

[ C o u n t e r ] counter = 1 part = proton reg in out coll ref 102 0 0 1 0

[ T - C r o s s ]・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・・ ・ ・ ・ ・ ・ file = cross-c1.datoutput = current part = proton neutron angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(1) = 1 ctmax(1) = 1 cross-c1.eps

Page 27: P HI T S

Exercise 2

[counter] 27

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

Page 28: P HI T S

Answer 2

[counter] 28

[ C o u n t e r ]・ ・ ・ ・ ・ ・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 - C r o s s ]・ ・ ・ ・ ・ ・ file = cross-c2.datoutput = current part = proton neutron angel = ymin[1.E-06] ymax[1.E-02] epsout = 1 ctmin(2) = 1 ctmax(2) = 1

counter.inp

cross-c2.eps cross-c3.eps

• No reaction occurs in the air region.• Protons scattered from 104 are very little.

Page 29: P HI T S

Summary

Summary 29

• 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