tRK4の使い方 ( パラメータ設定・前処理篇 )

tRK4のファイル・ディレクトリ構成

  • src : Fortran ソースコード群

  • pyt : python プリポストコード群

  • dat : データ類, config類

  • png : 出力画像類

  • bpm : ビームポジションモニタ用出力ファイル

  • prb : 粒子プローブ用出力ファイル

  • job : 保存用 job ディレクトリ

  • dev : 開発中のコード、不要コード仮置き場

  • README : メモ

  • go.py : 実行スクリプト

実行例

コンフィグ設定 ( parameter.conf )

  • parameter.conf を書き換える.

  • parameter.confの例は以下の通り.

コンフィグファイルの例
# input parameter file for track__RK4
# converted into input.conf  by  pyt/interpret__config.py
# free format nkConstant file 

# -------------------------------------------------------- #
# ---  for tRK4                                        --- #
# -------------------------------------------------------- #

EFieldListFile		string		dat/efieldlist.dat
BFieldListFile		string		dat/bfieldlist.dat
EFieldParamFile		string		dat/efieldparam.dat
BFieldParamFile		string		dat/bfieldparam.dat

particleFile  		string		dat/particles.dat
popoutFile		string		dat/popout.dat
probeFileBase  		string		prb/probe
bpmFile			string		bpm/screen_bpm.dat

flag__axisymmetry	logical		True
flag__popoutBoundary	logical		False
flag__probeField	logical		True
flag__beamposmonitor	logical		False

particleBoundary__x	string		None
particleBoundary__y	string		None
particleBoundary__z	string		None

type__iterMax		string		load
type__dt                string		load
iterMax			integer		500000
dt			float		2.e-14
alpha_wci		float		1.e-5
alpha_CFL		float		1.e-2

t_simuStart		float		0.0
t_simuEnd		float		1.50e-8
t_probeStart		float		0.0
t_probeStep		float		1.00e-11
t_probeEnd		float		1.50e-8

bpm_direction		string		z
bpm_screen_pos		float		0.106176

mp			float		9.1093836e-31
qe			float		1.6021766e-19
cv			float		2.9979246e+08


# -------------------------------------------------------- #
# ---  for python scripts                              --- #
# -------------------------------------------------------- #

# -- travelling wave  -- #
tw_cosEigenFile 	string		dat/efield_regular_opened.dat
tw_sinEigenFile 	string		dat/efield_regular_closed.dat
tw_timeStart		float		0.0
tw_nCycle		integer		4
tw_nTime		integer		101
tw_frequency		float		2.856e9
tw_phase		float		0.0
# -- wave information -- #
P_input			float		125.0e3
Lcavity			float		0.1049
beta_wave		float		0.999
# -- from superfish   -- #
Ustored			float		0.0013767
Qvalue			float		13950.1
rsh			float		30.583e6
t_transit_time		float		0.7187

# -- field making     -- #
strength_bfield       	float		0.010
xMin_bfield		float		0.0
xMax_bfield		float		0.011
yMin_bfield		float		0.0
yMax_bfield		float		0.0
zMin_bfield		float		0.0
zMax_bfield		float		4.20
LI_bfield		integer		11
LJ_bfield		integer		1
LK_bfield		integer		11

電場・磁場の設定

  • サンプル磁場・電場の生成

$ python pyt/generate__bFieldSample.py
$ python pyt/generate__eFieldSample.py

電場・磁場ファイルリストの作成

  • 全ての磁場・電場リスト、及びその使い方をリスト表記する.

  • リストファイルのサンプルは以下.

磁場・電場ファイルリストの作成
# FileName		       EorB  Amplitude	Frequency  Phase  xyzshift	     modulation_type   boundary_xyz		nRepeat_xyz
dat/efield_buncher1_opened.dat E     +2.770286 	2.856e9    0.0 	  0.0 0.0 0.0        cos 	       axisymm axisymm Neumann 	1 1 1
dat/efield_buncher1_closed.dat E     +2.638368 	2.856e9    0.0 	  0.0 0.0 0.0        sin 	       axisymm axisymm Neumann 	1 1 1
dat/bfield_buncher1_opened.dat B     +2.770286 	2.856e9    0.0 	  0.0 0.0 0.0        cos 	       axisymm axisymm Neumann 	1 1 1
dat/bfield_buncher1_closed.dat B     +2.638368 	2.856e9    0.0 	  0.0 0.0 0.0        sin 	       axisymm axisymm Neumann 	1 1 1
dat/efield_buncher2_opened.dat E     +3.632319 	2.856e9    0.0 	  0.0 0.0 0.067179   cos 	       axisymm axisymm Neumann 	1 1 2
dat/efield_buncher2_closed.dat E     +3.022602 	2.856e9    0.0 	  0.0 0.0 0.067179   sin 	       axisymm axisymm Neumann 	1 1 2
dat/bfield_buncher2_opened.dat B     +3.632319 	2.856e9    0.0 	  0.0 0.0 0.067179   cos 	       axisymm axisymm Neumann 	1 1 2
dat/bfield_buncher2_closed.dat B     +3.022602 	2.856e9    0.0 	  0.0 0.0 0.067179   sin 	       axisymm axisymm Neumann 	1 1 2
dat/efield_regular_opened.dat  E     +8.505209 	2.856e9    0.0 	  0.0 0.0 0.25611900 cos 	       axisymm axisymm Neumann 	1 1 40
dat/efield_regular_closed.dat  E     +7.753930 	2.856e9    0.0 	  0.0 0.0 0.25611900 sin 	       axisymm axisymm Neumann 	1 1 40
  • 各項目の説明

    • FileName - ファイル名 ( e.g. dat/efield_buncher1_opened.dat )

    • EorB - 電場か磁場か ( E or B )

    • Amplitude - 場の振幅 スケール倍する ( e.g. 3.1 (スケール倍), 1.0 (なし) )

    • Frequency - 変調の周波数 modulation_typeで変調はスイッチ ( e.g. 2.856e9 Hz )

    • Phase - 変調の位相進み ( e.g. 0.0 or 90.0, etc. )

    • xyzshift - 座標のシフト xyz座標の3つの実数で指定 ( e.g. 0 1 0 )

    • modulation_type - 変調のタイプ. ( cos, sin, off から選ぶ )

    • boundary_xyz - 境界条件 axisymm, Neumann, Dirichletから選ぶ ( axisymm, Neumann, Neumann )

    • nRepeat_xyz - 場の反復回数 RFキャビティなど周期構造で使用 xyzの3座標分を記載 ( e.g. 1 1 21 )

初期粒子情報の準備

  • dat/particle.confで生成する初期粒子のパラメータを書き換える

  • 初期粒子を生成 ( dat/particles.dat ) する.

$ python pyt/generate__particleSample.py
  • dat/particle.confの例は以下.

初期粒子のパラメータ情報
# -- constants -- #
npt			integer		1001
cv			double		2.9979246e+08
qp			double		1.6021766e-19
mp			double		9.1093836e-31

# -- distribution :: [ equispace, uniform, gaussian, ]  -- #
distribution_x		string		gaussian
distribution_y		string		gaussian
distribution_z		string		gaussian

xMin			double		-0.010
xMax			double		+0.010
yMin			double		-0.010
yMax			double		+0.010
zMin			double		-0.030
zMax			double		+0.030

# -- energy distribution :: [ equispace, uniform, gaussian ] -- #
distribution_energy	string		uniform
energy_Min		double		1.0e5
energy_Max		double		3.0e5

angle_theta1		double		0.0
angle_theta2		double		0.0

スクリプトのまとめて実行

  • 上記の操作をまとめてスクリプト実行

  • パラメータファイルを書き換える

    • dat/parameter.conf

    • dat/fieldlist.conf

    • dat/particle.conf

$ python go.py
$ ./main