Phys553000 05b (Openmpi)
Phys553000 05b (Openmpi)
國家同步輻射研究中心
周炳榮 Ping J. Chou
[email protected]
PHYS553000— 05b
[References]
1. S. Ramo, J.R. Whinnery, T. Van Duzer, Fields and Waves in Communication Electronics, 3rd ed.,
(Wiley, 1994).
2. A. Taflove & S.C. Hagness, Computational Electrodynamics: the finite-difference time-domain
method, 3rd ed. (Artech House, 2005)
3. A. Peterson et al., Computational Methods for Electromagnetics (IEEE, 1998).
4. M.N.O. Sadiku, Numerical Techniques in Electromagnetics, 2nd ed., (CRC, 2000)
5. D. Eadline, High Performance Computing for Dummies (Sun & AMD).
2
Computer lab for PHYS553000-05a
Homework 1) compute the cutoff frequencies of the four lowest propagating modes for a
rectangular waveguide. Compare the results for analytical formulas vs. numerical simulations.
Find out the dependence of computational accuracy vs. mesh size. Compare the simulated field
patterns with textbook results.
Homework 2) compute the cutoff frequencies of the four lowest propagating modes for a
cylindrical waveguide. Compare the results for analytical formulas vs. numerical simulations.
Find out the dependence of computational accuracy vs. mesh size. Compare the simulated field
patterns with textbook results.
Homework 3) compute the resonant frequencies of the two lowest TM- and TE-modes for a
rectangular cavity. Compare the results for analytical formulas vs. numerical simulations. Find
out the dependence of computational accuracy vs. mesh size. Compare the simulated field
patterns with textbook results.
Homework 4) compute the resonant frequencies of the two lowest TM- and TE-modes for a
pillbox cavity. Compare the results for analytical formulas vs. numerical simulations. Find out the
dependence of computational accuracy vs. mesh size. Compare the simulated field patterns with
textbook results.
Homework 5) using the computer simulations to perform a bead-pull measurement for the
fundament accelerating mode of a pillbox cavity. Compare the results of analytical formula vs.
numerical simulations. Find out the amplitude profile of fundamental accelerating mode from
both analytical formulas and numerical simulations.
3
Computer Exercise:
Homework 1) Please calculate the cutoff frequencies for TE10, TE01, and TM11 modes for a
rectangular waveguide by using the GdfidL code. Then, you compare the results of simulation
with these calculated from analytical formulas of waveguide. What are the field patterns of these
waveguide modes?
Homework 2) Please calculate the cutoff frequencies for TE11 and TM01 modes for a circular
waveguide by using the GdfidL code. Then, you compare the results of simulation with these
calculated from analytical formulas of waveguide. What are the field patterns of these waveguide
modes?
Homework 3) Please calculate the frequency of fundamental mode for a rectangular cavity by
using the GdfidL code. Then, you compare the results of simulation with these calculated from
analytical formulas. What are the field patterns of the fundamental mode?
Homework 4) Continue with the previous homework, let’s introduce a small perturbation to
the metallic boundary of the rectangular cavity. Let’s place a small cube on the end plane of the
cavity. Please calculate the frequency of fundamental mode for a rectangular cavity by using the
GdfidL code. Then, you compare the results of simulation with these calculated from the
analytical formula given by the Slater theorem . What are the field patterns of the fundamental
mode with this small cube?
4
What to do in this computer lab:
1. Log in the NSRRC Wi-Fi “NSRRC-staff ”
2. Divide students into 2 persons/team
3. Assign guest account to ‘yum01’ or ‘yum02’ for each team
4. Log in the guest account
5. Type command $ source .bashrc
6. Each team create its own directory under /home/yum01 or /home/yum02
e.g. $ mkdir team1
7. Copy examples from /home/yum01/RFlab to your own working directory
8. Edit the example input files:
-general
outfile= /home/yum01/team1/output/team1-result
scratch= /dev/shm/scratch-team1
9. Edit the dimensions of waveguides or cavities as you wish
10. Run the example input file after proper revision,
$ gd1< filename.gdf | tee filename.log
11. Compare the simulated results with your analytical calculation
5
Basic physics related to wake fields and impedances:
1. T. Weiland, Part. Accelerator, vol.15 (1984) 245-292, "On the numerical solution of Maxwell's
equations and applications in the field of accelerator physics"
2. T. Weiland, R. Wanzenberg, “wake fields and impedances”, in M. Dienes et al.(eds.), Frontier
of Particle Beams: Intensity Limitations (Springer-Verlag, 1992)
3. B.W. Zotter and S.A. Kheifets, Impedances and Wakes in High-Energy Particle Accelerators
(World Scientific, 1998).
6
Basic principles related to numerical simulation codes employing the
finite difference method :
1. T. Weiland, "On the numerical solution of Maxwell's equations and applications in the field
of accelerator physics" , Part. Accelerator, vol.15(1984) 245-292
2. W. Bruns, “GdfidL: a finite difference program with reduced memoery and CPU usage”, Proc.
Part. Accel. Conf. 1997 (Vancouver), p.2651.
3. Syntax and examples for the simulation code ‘GdfidL’ can be found at GdfidL homepage:
http://www.gdfidl.de
4. Numerical Techniques in Electromagnetics, 2nd ed. (CRC,2000), M.N.O. Sadiku
5. Computational Electrodynamics: the finite-difference time-domain method, 3rd ed., (Artech
House, 2005)A. Taflove and S.C. Hagness
We use the 3D electromagnetic simulation code GdfidL(parallel version) at NSRRC. GdfidL is developed
by Dr. Warner Bruns (Technical University in Berlin, Germany). It is developed for Unix/Linux operating
systems No Microsoft Windows
7
Basic Concepts of 3-D Computational
Electrodynamics
8
Solving Maxwell’s Equations with Numerical Methods
D
Maxwell’s equations can be approximately solved by
D discretizing the curl operators
J H
t
B
E x i A triple numerical index is assigned to each field
t
y j component in the computational volume
0 B x k accordingly.
Bz E y Ex
t x y
E y E yi , j 1,k E yi , j ,k Ex Exi 1, j ,k Exi , j ,k
,
x x y y
i 1, j , k
d i , j ,k x ( Ex Exi , j ,k ) y ( E yi , j 1,k E yi , j ,k )
Bz
dt x y 9
•The advantage of a simple finite difference method: it’s easy to understand and implemented in a
computer program by declaring a triple indexed discrete variables, i.e. (I, j, k).
•The disadvantage of a simple finite difference method: for most geometries the grid cells are also
assigned to regions where there are no electromagnetic fields (ideal conducting material). This will
increase the consumption of computer memory and decrease the computational speed.
•W. Bruns’ code GdfidL uses the linked list method instead of the simple finite- difference scheme as
described in the previous example. This results in a significant reduction of the number of grid cells
which is required to model the geometry and speed up the computation as well.
(i+1,j+1,k+1)
Maxwell’s equations (integral form)
Hz Maxwell’s Grid Equations (Matrix representation)
(i,j,k+1) grid-based numerical modeling method,
Maxwell's equations are modified to central-
Hx difference equations, discretized, and implemented
Ez Hy (i+1,j+1,k)
in software.
Ey
(i,j,k) (i+1,j,k)
Ex
10
Comparison between various simulation codes for electromagnetic fields
•HFSS and MAFIA v4.0 are both GUI programs, less control for users. GdfidL is text-driven but
more control for users, the input scripts can be reused later on.
•ACE3P is implemented on NERSC’s IBM SP2 supercomputer (ranked No. 5 in the June 2003 TOP
500 list), one of DOE’s grand challenge projects for computational accelerator physics, a large
collaboration between major US national labs and universities. Major development is led by
SLAC We have no access to this wonderful tool
11
GdfidL uses the generalized diagonal fillings
GdfidL uses the linked lists to store EM-fields of grid cells, less memory is required. It supports
inhomogenous meshes for better modeling of sharp edge or intersecting planes.
•An example of good agreements between rf measurements and GdfidL can be found at
http://link.aps.org/abstract/PRSTAB/v5/e033501
12
You should think of computer simulations as numerical experiments.
Do NOT blindly believe in anything you get from the computer simulations !!
Signal response
Signal sepctrum Noise
Mode frequency
t
f
[Ref.] V. Srinivas, M. Wolf, et al., Tau3P, SciDAC TSTT-SLAC meeting (1 Oct., 2003)
http://www-group.slac.stanford.edu/acd/Presentations.html 13
Another Approach of Discretization: Finite Element Method
•The development of finite element method can be traced back
to Alexander Hrennikoff (1941) and Richard Courant (1942).
Courant’s approach divides a domain into finite triangular
subregions. The development of finite element method began
in 1950s driven by engineering related problems. Since then it
has been generalized into a branch of applied mathematics for
numerical modeling of various physical systems.
•Finite element method can provide a better and more
accurate mesh for curved geometries than the finite difference
method.
An example of discrete mesh
(triangular mesh)
[Ref.] http://en.wikipedia.org/wiki/Finite_element
14
[Ref.] http://mathdl.maa.org/mathDL/1//convergence/
[Ref.] http://www.pas.rochester.edu/~bodek/dept/courant.gif
Basic Concepts of Parallel Computing on a
PC Cluster
15
High-performance Computing on Linux Clusters
CPU
The overall speed of a computer depends on
both the speed of CPU and the speed of
communication between memory and CPU.
cache memory
faster but more expensive •modern configuration to improve
bus the overall performance
slower memory 16
cheaper [Ref.] J.D. Sloan, High Performance Linux Clusters, (O’Reilly, 2005)
The architect of multiprocessor machine (UMA)
bus
memory
This is the generic structure for the uniform memory access (UMA) machines. There is a common
shared memory. The UMA machines also called symmetric multiprocessors (SMP) machines.
What is the difference between the clusters and the grid computing?
Clusters: computers are on the same subnetwork (LAN)
Grid computing: computers distribute across a WAN or internet (on a larger scale)
LAN: local area network (the same subnetwork)
17
Amdahl’s Law
The speed of parallel computation will not
always scale up as the number of
processors increase. The serial portion of
a program will be the limiting factor of
speedup one can gain by using multiple
Speed up
computers Amdahl’s Law (Gene Amdahl
in 1960s)
Node (slave)
NFS
Node (slave)
User Head (master)
asymmetric,
I/O server Node (slave)
expanded
External network/ Internet
Node (slave) 18
Basic configuration of the Linux cluster ‘ wilson’ at NSRRC
master node
External network
(local area
network, internet)
19
slave node slave node slave node slave node slave node slave node slave node
Network configuration
There are two network interfaces in a computer cluster: external(public) interface and
internal(private) interface. There are reserved address spaces that we can use to configure the
private interface, a.k.a. the virtual IP.
The usual IP configuration constraints also apply to our cluster configuration. For example, we should
not assign the broadcast address to a computer. In this case, we want to avoid 192.168.1.0 and
possibly 192.168.1.255.
20
Linux cluster in T192 computer lab (wilson: 172.18.120.4)
RF group
http://bd08.nsrrc.org.tw/cluster.html
Linux cluster supports the computing needs of staff in Division-A (master node: 12 CPUs, 80
GB; 25 computing nodes: total 240 CPUs, 768 GB; one dedicated for Matlab)
Software installed: parallel Elegant, parallel GdfidL, parallel TRACY, Mathematica, Matlab,
CERN ROOT
21
How to Run GdfidL Jobs on a Single Node
22
How to Use GdfidL at NSRRC
•Environment (Linux or Unix)
•Basic structure of input file
•Post processing
•Parallel computing
•My own learning experience (a suggestion only)
Environment:
Specify your environment settings for using GdfidL in your own login shell, e.g. “.cshrc” in C shell
or “.bashrc” in Bourne Again Shell
23
If your default login shell is Bash shell instead, you need to add the following lines to your “.bashrc” file.
###
### set up the GdfidL environment, from Warner Bruns
###
export GDFIDL_VERSION=180819
export GDFIDL_HOME=/usr/local/gd1
export GDFIDL_LICENSE=$GDFIDL_HOME/gdX-license
export PATH=$GDFIDL_HOME/Scripts/:$PATH
###
### end of GdfidL setup
###
## set up PBS/Torque
export PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
24
Basic structure of input file:
•Define variables and parameters
•Define the location of output files and temporary scratch
•Define boundary conditions
•Define the geometry of objects to be studied
•Display: define plotting options
•Solver: define actions/commands to be executed (doit)
Frequency-domain
Time-domain
•End of input script use ‘gd1’ or ‘single.gd1’
Post processing:
•Define the location of your output files
•Define the physics/rf engineering parameters of your interest
•Define the options for data display
•End of post processing script use ‘gd1.pp’
25
Parallel version Serial version
Prepare an input file for Prepare an input file for the postprocessor
the solver module ‘gd1’, module of GdfidL (gd1.pp)
then submit the parallel
job with a batch system
from the master node using
Display the electromagnetic fields or deduce
the example script
physical parameters with the postprocessor
‘OpenMPI-Job.pbs’
module ‘gd1.pp’
You need to prepare two separate input files for GdfidL. One is used by the solver module gd1, and
another one is used by the postprocessor module gd1.pp .
26
BD/LSD @ NSRRC
http://bd08.nsrrc.org.tw/cluster.html
27
wilson-ganglia
http://172.18.120.4/ganglia/
28
How to run GdfidL in the serial mode on a single node
First , log in any slave node to edit the input file with the following commands. Using the slave
node ‘node23’ as an example.
pjchou@wilson$ ssh –X node23
pjchou@node23$ cd YourWorkingDirectory
pjchou@node23$ gedit square01.gdf &
Bla bla bla….
pjchou@node23$ gd1 < square01.gdf | tee square01.log
or,
pjchou@node23$ single.gd1 < square01.gdf | tee square01.log
Example: /home/pjchou/gd1/Tutorial/square01.gdf
## File= square01.gdf
## inputfile for a square prism cavity(Eigenmode calculation).
## BoxWidth
## 10:40, 6-17-2002 y
## GapLength
#
# Some helpful symbols:
# x
z
define(EL, 1) define(MAG, 2)
define(INF, 1000)
define(STPSZE, 5e-3)
29
…continued to the next page
###
### We enter the section "-general"
### Here we define the name of the database where the
### results of the computation shall be written to.
### (outfile= )
### We also define what names shall be used for scratchfiles.
### (scratchbase= )
###
-general
outfile= /home/pjchou/output/results
scratchbase= /dev/shm/scratch-xxx
text()= STPSZE: mesh size This will affect the speed of
text()= DT: dimensional deviation parallel computation!
text()= BoxWidth: size of box cavity
###
### We define the borders of the computational volume,
### we define the default mesh-spacing,
### and we define the conditions at the borders:
###
-mesh
spacing= STPSZE
pxlow= eval(-1*(BoxWidth/2+1e-2) )
pylow= eval(-1*(GapLength/2+1e-2) )
pzlow= eval(-1*(BoxWidth/2+1e-2) )
pxhigh= eval(BoxWidth/2+1e-2 )
pyhigh= eval(GapLength/2+1e-2 )
pzhigh= eval(BoxWidth/2+1e-2 )
30
…continued to the next page
#
# We define symbols that will be used to describe our cavity:
# The names of the symbols can be up to 32 characters long,
# The values of the symbols can be up to 128 characters long.
#
define(DT , 3e-6 ) #dimensional deviation due to temperature
define(GapLength , eval(DT+30.0e-2) ) #length in y-axis
define(BoxWidth , eval(DT+42.43e-2) ) #length in x and z-axis
#
# The conditions to use at the borders of the computational volume:
#
cxlow= electric, cxhigh= electric
cylow= electric, cyhigh= electric
czlow= electric, czhigh= electric
######
######
#
# we fill the universe with metal
#
-brick
material= EL
xlow= -INF, xhigh= INF
ylow= -INF, yhigh= INF
zlow= -INF, zhigh= INF
doit
31
…continued to the next page
#
# we carve out the square box cavity
#
-brick
material= 0
xlow= -BoxWidth/2, xhigh= BoxWidth/2
ylow= -GapLength/2, yhigh= GapLength/2
zlow= -BoxWidth/2, zhigh= BoxWidth/2
doit
-mesh
#
# enforce 2 meshplanes: at both ends of cavity side opening
#
xfixed(2, eval(-(BoxWidth/2) ), eval(BoxWidth/2) )
yfixed(2, eval(-(GapLength/2)), eval(GapLength/2) )
zfixed(2, eval(-(BoxWidth/2) ), eval(BoxWidth/2) )
-volumeplot
showpartition= yes
plotopts= -geometry 600x480
doit
The dimension of matrix to be solved
-eigenvalues
How to give a good guess for estimated frequency?
solutions= 30
estimation= 1.3e9 # the estimated highest frequency
passes= 3
doit
32
…the end
How to run parallel GdfidL on a single node without the batch job system
#!/bin/bash
PBS_JOBID=PJChou
rm -f $PBS_JOBID-uniq
for N in 23
do
echo node$N >> $PBS_JOBID-uniq
## echo node$N.cluster >> $PBS_JOBID-uniq
done
rm -f $PBS_JOBID-uniq
echo finished.
# exit
###------------------------------------------------------------------------
### P.J. Chou, 17:53, 2018-8-30
…the end of the script file ‘ompiJob.x’
After the script is completed, change its permission to an executable file. Run the following
commands:
pjchou@node23$ chmod u+x ompiJob.x
pjchou@node23$ ./ompiJob.x
34
3. Another example of time-domain simulation using the input file ‘hkicker-v3.3.gdf’. You need to
modify the name of input file in the script file ‘ompiJob.x’ first. You can run the job either from
the master node or a slave node with the following command:
pjchou@node23$ ./ompiJob.x
or, pjchou@wilson$ ./ompiJob.x
#!/bin/bash
Bla bla bla…
…
Bla bla bla…
/opt/openmpi-1.8.8/bin/mpirun \
-np $NHOSTS \
-npernode 1 \
-hostfile $PBS_JOBID-uniq \
--show-progress \
--verbose \
$BINARY \
< ./hkicker-v3.3.gdf | tee hkicker-v3.3.log
rm -f $PBS_JOBID-uniq
echo finished.
# exit
###------------------------------------------------------------------------
### P.J. Chou, 17:53, 2018-8-30
※Prepare the script and submit a batch job from the master node (required)
1. Edit the script ‘OpenMPI-Job.pbs’ in your working directory on the mater node as shown
below:
#!/bin/bash
### --------------------------------------------------------------------------
### This PBS script file is provided by Warner Bruns in Nov. 2015 .
### 14:58 Sept. 4, 2018
### --------------------------------------------------------------------------
### Usage: qsub -X ./OpenMPI-Job.pbs
################
# Start Job from the Directory it was submitted.
cd $PBS_O_WORKDIR
/opt/openmpi-1.8.8/bin/mpirun \
-np $NHOSTS -hostfile $PBS_JOBID-uniq \
-npernode 1 \
$BINARY \
-DNROFTHREADS=$NTHREADS \
Single precision version, if
-DOUTFILE=$PBS_O_WORKDIR/Result \
you want to speed up the -DSCRATCH=/dev/shm/$PBS_JOBID \
time-domain calculation. -DLSSUBCWD=$PBS_O_WORKDIR/ \
< ./doris04_qsub.gdf | tee doris04_qsub.log
rm -f $PBS_JOBID-uniq
echo finished.
exit
38
3. After you edit the script ‘OpenMPI-Job.pbs’, submit the batch job from the master node with
the following commands:
pjchou@wilson$ qsub –X OpenMPI-Job.pbs
396.wilson.cluster
PBS Job ID
For the time-domain simulation, you edit the name of input file in the script ‘OpenMPI-Job.pbs’,
then submit the batch job on the master node. An example input file ‘hkicker-v3.3.gdf’ is used
for demonstration.
39
16 cores were used during
the calculation
40
How to Run GdfidL Jobs on Multi Nodes
41
How to run parallel GdfidL on multi nodes (batch job mode with Torque)
※Prepare the script and submit a batch job from the master node (required)
1. Edit the script ‘OpenMPI-Job.pbs’ in your working directory on the mater node. We use
the example input file ‘doris04_qsub_openmpi.gdf’. Besides the name of input file that you
need to change, the major change you need to do in the script file is shown below:
pjchou@wilson$ gedit OpenMPI-Job.pbs
#!/bin/bash
### --------------------------------------------------------------------------
### This PBS script file is provided by Warner Bruns in Nov. 2015 .
### 14:58 Sept. 4, 2018
### --------------------------------------------------------------------------
### Usage: qsub -X ./OpenMPI-Job.pbs
## --- Set the Time which this Job will not exceed ---
#PBS -l walltime=24:00:00
/opt/openmpi-1.8.8/bin/mpirun \
-np $NHOSTS -hostfile $PBS_JOBID-uniq \
-npernode 1 \
$BINARY \
-DNROFTHREADS=$NTHREADS \
-DOUTFILE=$PBS_O_WORKDIR/Result \
-DSCRATCH=/dev/shm/$PBS_JOBID \
-DLSSUBCWD=$PBS_O_WORKDIR/ \
< ./doris04_qsub_ompi.gdf | tee doris04_qsub_ompi.log
rm -f $PBS_JOBID-uniq
echo finished.
exit
43
All the processors on each node are used for this batch job as shown in the screen shot below
This example is not large enough. The calculation is slower when using two nodes! 44
The X-window displays of GdfidL plots will popped up during the calculation. When the X-window displays
disappear, it means the calculation is finished. You can view the results and any error messages from these
two files ‘OpenMPI-job.o***’ and ‘OpenMPI-Job.e***’, respectively.
45
How to Be a Smart User of GdfidL
46
How to model your structure with finer meshes and yet less computational
time in a smart way? Tricks of building your model
Experts tend to use inhomogeneous meshes to describe a 3-D structure with sharp
edges or curved features. On the contrary, a novice tends to use homogeneous
meshes to describe the structure. To achieve a better accuracy without big increase of
computation time, you should use inhomogeneous meshes as much as possible. You
need to have a good understanding about the physics of the problem that you are
going to simulate. Simply abuse the computing power of Linux cluster without much
thinking is a brute force approach that is stupid!
A test case I did before can serve as an example of using inhomogeneous meshes to
improve the accuracy and keep computation time as reasonable as possible.
47
Example: Assembly of SRF Module S0 – RF Window
49
S11 parameter as computed by GdfidL (t = 0.717”):
-15
-20
-25
-30
300 350 400 450 500 550 600 650
frequency [MHz]
1.0
0.9
0.8
0.7
0.6
S11
0.5
0.4
0.3
0.2
0.1
0.0
300 350 400 450 500 550 600 650
frequency [MHz]
50
Inhomogeneous mesh, zmesh= 1 mm, x/ymesh= 1.25 mm, computation time= 12 hrs.
51
rf ceramic window, t= 0.717" inhomogeneous mesh
-5
S11 in [dB]
-10
-15
-20
-25
300 350 400 450 500 550 600 650
frequency [MHz]
0.9
0.8
0.7
0.6
0.5
S11
0.4
0.3
0.2
0.1
0.0
300 350 400 450 500 550 600 650
frequency [MHz] 52
Example: /home/pjchou/gd1/Tutorial/square01.gdf
The output message displayed on the terminal during the
computation,
System is Linux-x86_64
Version is 2010-02-08
Important note: To compute the eigenmodes, ‘single.gd1’ results in a worse accuracy than ‘gd1’
for the same input file. It is advised to use the double-precision version ‘gd1’.
55
Example : Calculate the cutoff frequency of a circular waveguide
Please refer to /home/pjchou/gd1/Calibration/circular-wvguide.gdf and plotwvguide.gdf
R= 0.1 m
cumn
fc 878.500 MHz
2R
How to do it?
56
a) Mesh size= 0.01 m @ central region
mesh= 0.01 m
mesh= 0.00318 m
57
The simulated cutoff frequency for TE11 mode is 875.311 MHz (STPSZE= 0.01 m), the
analytical formula gives 878.500 MHz
It took 6 seconds.
58
b) Mesh size= 0.005 m @ central region
59
The simulated cutoff frequency for TE11 mode is 874.448 MHz (STPSZE= 0.005 m), the
analytical formula gives 878.500 MHz
It took 9 seconds.
60
c) Mesh size= 0.0025 m @ central region
61
The simulated cutoff frequency for TE11 mode is 875.940 MHz (STPSZE= 0.0025 m), the
analytical formula gives 878.500 MHz
It took 26 seconds.
62
d) Mesh size= 0.005 m @ central region
mesh= 0.00318 m
mesh= 0.005 m
Electric field of TE11 mode
63
The simulated cutoff frequency for TE11 mode is 878.614 MHz (STPSZE= 0.005 m), the
analytical formula gives 878.500 MHz
A proper use of inhomogenous mesh can greatly improve the accuracy and save the
computational time!
It took 15 seconds.
64
Example : Calculate the loss factor of a step collimator with circular symmetry
Please refer to /home/pjchou/gd1/Calibration/step-collimator.gdf and wake.gdf
~/gd1/Calibration/step-collimator.gdf
Job PID
If you want to kill a parallel GdfidL job, find out the job PID and use the following command, 65
$ kill -9 job_PID
66
-fdtd
-lcharge
charge= 1e-12
sigma= BunchLength
xposition= BeamX, yposition= BeamY
shigh= RecordLength
napoly= yes
return
-ports
name= beamlow , plane= zlow, doit
name= beamhigh, plane= zhigh, doit
return
doit
62 minutes
67
To view the computed wakepotential and impedance, run the postprocessor gd1.pp
$ gd1.pp < wake.gdf
232.956 1015
0.233 [V / pC ]
11012
Loss factor
68
69
70
Example : How to model four-button beam position monitor
/home/pjchou/gd1/TPS/BPM/bpm.tps01.gdf
71
Example : A flange gap in standard beam pipe
..\..\..\..\PJ.Chou_Research\CollectiveEffects\ImpedanceBudget\TLS\FlangeJoint
72
Refer to /home/pjchou/gd1/3D/flange.gdf and plotwake.gdf
Example: benchmark GdfidL ‘–type=impedance’
Loss factor for a cylindrical resistive pipe: length= 0.1 m, radius= 15 mm, rms bunch length= 3 mm,
made of aluminum (resistivity= 2.62e-8 ohm-m) kloss= 0.84e-3 V/pC (analytical result)
shigh= 200 m, beam sigma= 4.5 mm, (xb, yb)= (0, 1e-3 m)
W||(s) Re(Z||)
File= hkicker_v2d3.gdf
76
Wx(s) Wy(s)
77
When we zoom in the noise buildup, the oscillating frequency is around 1.65 GHz. It seems to
correspond to the dominant resonant peak (1.697 GHz) in Re(Zy). Since the amplitude of this resonant
mode is growing, the spectral magnitude of this mode is not reliable.
78
* Debug the Re(Zy) and the noise buildup in Wy
In the inputfile for gd1.pp, -wakes, shigh= 120, VERSION=180128g
File= hkicker_v2d3.gdf
79
In the inputfile for gd1.pp, -wakes, shigh= 140
80
In the inputfile for gd1.pp, -wakes, shigh= 160
81
In the inputfile for gd1.pp, -wakes, shigh= 180
82
In the inputfile for gd1.pp, -wakes, shigh= 200
As we increase the ‘shigh’ value, the amplitude of dominant mode in Re(Zy) keeps increasing. On the
other hand, the amplitude of dominant mode in Re(Z) reaches a steady value. The noise buildup in Wy
is affecting the accuracy of Re(Zy). Therefore, we can’t determine the transverse resonant modes by
time domain solver based on VERSION=180128g.
* End of debug 83
* Using ‘single.gd1’ and ‘–fdtd, hfdtd= yes’, computation time= 49 h 14 m, VERSION=180510
df= 2.99e6 Hz
Remedy for the numerical instability use the higher-order FDTD
84
-wakes, wantdf= 0.5e6 (shigh= 100 m)
85
* Using ‘single.gd1’ and 2*beampipe, computation time= 12 h 50 m, VERSION=180128g
Remedy for the numerical instability use a much longer beam pipe
86
Benchmark GdfidL FDTD using a coaxial line
1) Calculation of the characteristic line impedance (this feature only works in single-node runs)
138
Z0 log( D d )
d r
D 60
ln( D d )
r
File= ~/gd1/Calibration/test_coaxial-2.gdf
Using node22(8 threads): 28 min.
output
input
• Short pulse excitation
2*0.4 ns
File= ~/gd1/Calibration/plot-sparm.gdf
transmitted signal (output signal@port_Output)
<gd1.pp inputfile>
-sparameter
ports= all
modes= 1
timedata= yes
freqdata= yes # ‘no’ for TDR, excitation_freq= 0
• Step-pulse excitation
File= ~/gd1/Calibration/test_coaxial-2.gdf
Using node22(24 threads): 10 min.
transmitted signal (output signal@port_Output)
How to estimate the required memory (size) for your simulation job?
No. of gridcells= A
No. of gridcells_field= B (i.e. gridcells in a dielectric where fields are nonzero)
For a quick estimate of required memory, let’s assume the fill ratio A/B is roughly 0.5. Then, we
have the following relations:
Using more compute nodes does NOT necessarily speed up the computation!
95
My own learning experience (a suggestion only):
{
1. Starting with the tutorial files that I prepared, understand square0*.gdf and pillbox.gdf
to familiarize yourself with the basic syntax of GdfidL.
2. Then, you start with the tutorial provided by W. Bruns (he did a wonderful job!), step-
by-step practice these files ‘doris**.gdf ’ and understand why the inputfiles were
written the way it is.
3. Those files of GdfidL tutorial are located in ‘/usr/local/gd1/tutorial-SRRC’.
4. User manual can be found in ‘/usr/local/gd1’ and GdfidL’s home page.
5. Using the rigorous results for the pillbox cavity in J.D. Jackson’s textbook Classical
Electrodynamics, constructing a model with GdfidL and comparing both results
confidence builder/verification/validation
}
Example:
virus> setenv DISPLAY 140.110.205.206:0.0
97
Appendix-2:
Install MobaXterm on your MS Windows (X-server on you PC)
98
Step.2 open another x-terminal by typing the command ‘xterm –sb &’
99
Step.3 Log in the Linux cluster by using the command ‘ssh –X -l username 172.18.120.4’
100
For detailed formulation of FDTD, see
Computational Electrodynamics, A. Taflove (NSRRC, QC760/T34)
Computational Methods for Electromagnetics, A. Peterson (NSRRC, QC760/P48)
Numerical Techniques in Electromagnetics, 2nd ed., M.N.O. Sadiku (CRC,2000)
101