forked from Warwick-Plasma/EPOCH_manuals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
epoch_user.tex
5928 lines (5004 loc) · 253 KB
/
epoch_user.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\include{epoch_head}
\externaldocument{epoch_dev}
\begin{document}%
\includepdf{images/title_page_user}
{
\fontfamily{phv}\selectfont\input{epoch_user_title}
}
\fontfamily{garamond}\selectfont%
\tableofcontents%
\newpage%
\DefineShortVerb{\#}
\fvset{formatcom=\color{warwickred}}
\section{FAQs}
\subsection{Is this manual up to date?}
Whenever a new milestone version of {\EPOCH} is finalised, the version
number is changed and this manual is updated accordingly. The version number
of the manual should match the first two digits for that of the {\EPOCH}
source code.
This version number is printed to screen when you run the code. The line looks
something like the following:
\begin{boxverbatim}
Welcome to EPOCH2D version 4.17.0 (commit v4.17.0-0-g1f6d56a22-clean)
\end{boxverbatim}
Here, only the number ``4.17'' is important.
Since version 3.1 of the manual, new additions and changes are mentioned
in the appendix.
\subsection{\texorpdfstring
{What is {\EPOCH}?}
{What is {EPOCH}?}}
{\EPOCH} is a plasma physics simulation code which uses the Particle in Cell
(PIC) method. In this method, collections of physical particles are represented
using a smaller number of pseudoparticles, and the fields generated by the
motion of these pseudoparticles are calculated using a finite difference time
domain technique on an underlying grid of fixed spatial resolution. The forces
on the pseudoparticles due to the calculated fields are then used to update the
pseudoparticle velocities, and these velocities are then used to update the
pseudoparticle positions. This leads to a scheme which can reproduce the full
range of classical micro-scale behaviour of a collection of charged
particles.
\subsubsection{\texorpdfstring
{Features of {\EPOCH}}
{Features of {EPOCH}}}
\begin{itemize}
\item MPI parallelised, explicit, second-order, relativistic PIC code.
\item Dynamic load balancing option for making optimal use of all processors
when run in parallel.
\item MPI-IO based output, allowing restart on an arbitrary number of
processors.
\item Data analysis and visualisation options include ITT IDL, LLNL VisIt,
Mathworks MatLab and matplotlib in Python.
\item Control of setup and runs of {\EPOCH} through a customisable input deck.
\end{itemize}
\subsection{The origins of the code}
The {\EPOCH} family of PIC codes is based on the older PSC code written by
Hartmut Ruhl and retains almost the same core algorithm for the field updates
and particle push routines. {\EPOCH} was written to add more modern features
and to structure the code in such a way that future expansion of the code is
made as easy as possible.
\subsection{\texorpdfstring
{What normalisations are used in {\EPOCH}?}
{What normalisations are used in {EPOCH}?}}
Since the idea from the start was that {\EPOCH} would be used by a large number
of different users and that it should be as easy as possible to ``plug in''
different modules from different people into a given copy of the code, it was
decided to write {\EPOCH} in SI units. There are a few places in the code where
some quantities are given in other units for convenience (for example charges
are specified in multiples of the electron charge), but the entire core of the
code is written in SI units.
\subsection{What are those \code{\_num} things doing everywhere?}
Historically using the compiler auto-promotion of \code{REAL} to
\code{DOUBLE PRECISION} was unreliable, so {\EPOCH} uses ``kind'' tags to
specify the precision of the code. The \code{\_num} suffixes and the associated
definition of \code{REAL}s as \code{REAL(num)} are these ``kind'' tags in
operation. The \code{\_num} tags force numerical constants to match the
precision of the code, preventing errors due to precision conversion. The
important thing is that all numerical constants should be tagged with an
\code{\_num} tag and all \code{REAL}s should be defined as \code{REAL(num)}.
\subsection{What is an input deck?}
An input deck is text file which can be used to set simulation parameters
for {\EPOCH} without needing to edit or recompile the source code.
It consists of a list of blocks which start as \inlineemph{begin:blockname}
and end with \inlineemph{end:blockname}. Within the body of each block is
a list of key/value pairs, one per line, with key and value separated by
an equals sign. Most aspects of a simulation can be controlled using an
input deck, such as the number of grid points in the simulation domain,
the initial distribution of particles and initial electromagnetic field
configuration. It is designed to be relatively easy to read and edit. For
most projects it should be possible to set up a simulation without
editing the source code at all.
For more details, read \sectit{input}.
\subsection{I just want to use the code as a black box, or I'm just
starting. How do I do that?}
Begin by reading \sectit{examples}. There's quite a lot to learn in order to
get started, so you should plan to read through all of this section. You will
also need to refer to \sectit{input}. Next, look at the code and have
a play with some test problems. After that re-read this section. This should be
enough for testing simple problems.
\subsection{What is the auto-loader?}
Throughout this document we will often refer to the ``auto-loader'' when
setting up the initial particle distribution. In the input deck it is
possible to specify a functional form for the density and temperature
of a particle species. {\EPOCH} will then place the particles to match
the density function and set the velocities of the particles so that they
match the Maxwellian thermal distribution for the temperature.
The code which performs this particle set up is called the ``auto-loader''.
At present, there is no way to specify a non-Maxwellian particle distribution
from within the input deck. In such cases, it is necessary to edit and
recompile the {\EPOCH} source code. The recommended method for setting
the initial particle properties is to use the ``\code{manual\_load}'' function
as described in \sect{manualload}.
\subsection{What is a maths parser?}
As previously mentioned, the behaviour of {\EPOCH} is controlled using an
input deck which contains a list of key/value pairs. The value part of the
pair is not restricted to simple constants but can be a complex mathematical
expression. It is evaluated at run time using a section of code called the
``maths parser''. There is no need for the end user to know anything about this
code. It is just there to enable the use of mathematical expressions in the
input deck.
Further information about this facility can be found in
\sect{maths_parser}.
\subsection{I am an advanced user, but I want to set up the code so that less
experienced users can use it. How do I do that?}
See \sectit{customising}.
\subsection{\texorpdfstring
{I want to develop an addition to {\EPOCH}. How do I do that?}
{I want to develop an addition to {EPOCH}. How do I do that?}}
A slightly outdated developers manual exists which should be sufficient to
cover most aspects of the code functionality. However, the code is written
in a fairly modular and consistent manner, so reading through that
is the best source of information. If you get stuck then you can post
questions on the CCPForge forums.
\subsection{\texorpdfstring
{I want to have a full understanding of how {\EPOCH} works. How do I do that?}
{I want to have a full understanding of how {EPOCH} works. How do I do that?}}
If you really want to understand {\EPOCH}
in full, the only way is to read all of
this manual and then read through the code. Most of it is commented.
\subsection{How do I acknowledge use of the code?}
There is a paper which details many aspects of the {\EPOCH} implementation
and also includes useful information on current PIC codes. This paper is
OpenAccess so freely available to all. If using EPOCH in
your research output please use this as the reference for EPOCH and ideally
also acknowledge the UK grant which funded this work.
The \hologo{BibTeX} entry for this paper is as follows.
\begin{verbatim}
@article{Arber:2015hc,
author = {Arber, T D and Bennett, K and Brady, C S and Lawrence-Douglas,
A and Ramsay, M G and Sircombe, N J and Gillies, P and Evans,
R G and Schmitz, H and Bell, A R and Ridgers, C P},
title = {{Contemporary particle-in-cell approach to laser-plasma modelling}},
journal = {Plasma Physics and Controlled Fusion},
year = {2015},
volume = {57},
number = {11},
pages = {1--26},
month = nov
}
\end{verbatim}
Acknowledgement: ``This work was in part funded by the UK EPSRC grants
EP/G054950/1, EP/G056803/1, EP/G055165/1 and EP/ M022463/1.''
\newpage
\section{\texorpdfstring
{{\EPOCH} for end users}
{{EPOCH} for end users}}
\label{sec:endusers}
This manual aims to give a complete description of how to set up and run
{\EPOCH} as an end user. Further details on the design and implementation of
the code may be found in \citet{Arber} and \citet{Ridgers}.
We begin by giving a brief overview of the {\EPOCH} code-base, how to
compile and run the code. Note that throughout this user manual, instructions
are given assuming that you are typing commands at a UNIX terminal.
\subsection{\texorpdfstring
{Structure of the {\EPOCH} codes}
{Structure of the {EPOCH} codes}}
\label{sec:directory_structure}
When obtained, the {\EPOCH} codes all have a similar structure. If the tarred
and gzipped archive (commonly referred to as a tarball) is downloaded and
unpacked into the user's \verb|$HOME| directory, then the extracted contents
will consist of a directory named ``\verb|$HOME/epoch-4.17.0|''
(with ``4.17.0'' substituted by the current version number) and the
subdirectories and files listed below.
Alternatively, if the code is checked out from the GitHub git
repository with the command\\
\indent\inlinecode{%
git clone --recursive https://github.com/Warwick-Plasma/epoch.git}\\
\noindent%
then the directory will be ``\verb|$HOME/epoch|''.
Once the code has been obtained, the top-level directory will contain the
following 4 directories and several files
\begin{itemize}
\item epoch1d - Source code and other files required for the 1D version of
{\EPOCH}.
\item epoch2d - Source code and other files required for the 2D version of
{\EPOCH}.
\item epoch3d - Source code and other files required for the 3D version of
{\EPOCH}.
\item SDF - Source code for the SDF file format which is used to generate
output for {\EPOCH} runs. This directory also includes various tools
and readers for working with SDF files.
\item CHANGELOG - A brief overview of the change history for each
released version of {\EPOCH}.
\item CODING\_STYLE - This document contains the conventions which must be
used for any code being submitted for inclusion in the {\EPOCH} project.
\item LICENSE - A copy of the GPLv3 license which is used by the {\EPOCH}
project.
\item README.md - A brief overview of obtaining and using the {\EPOCH} code.
\item make\_tarball.sh - This is a shell script which is used for creating
the tarred and gzipped archives of {\EPOCH} which are posted to the
GitHub server each time a new release is made.
\item test\_all.sh - A regression test script used when testing the code.
\end{itemize}
The three {\EPOCH} subdirectories all have a similar structure. Inside each
of the epoch\{1,2,3\}d directories, there are 3 sub-directories:
\begin{itemize}
\item src - The {\EPOCH} source code.
\item example\_decks - A sample data directory containing example input deck
files.
\item Data - This is an empty directory to use for running simulations.
\end{itemize}
There are also 3 files:
\begin{itemize}
\item Makefile - A standard makefile.
\item Start.pro - An IDL script which starts the IDL visualisation
routines. Execute it using ``idl Start''.
\item unpack\_source\_from\_restart - Restart dumps can be written to contain
a copy of the input decks and source code used to generate them. This script
can be used to unpack that information from a given restart dump. It is run
from the command line and must be passed the name of the restart dump file.
\end{itemize}
\subsection{Libraries and requirements}
The {\EPOCH} codes are written using MPI for parallelism, but have no other
libraries or dependencies. Currently, the codes are written to only require
MPI1.2 compatible libraries, although this may change to require full MPI2
compliance in the future. Current versions of both MPICH and OpenMPI implement
the MPI2 standard and are known to work with this code. The SCALI MPI
implementation is only compliant with the MPI1.2 specification and may loose
support soon.
There are no plans to write a version of {\EPOCH} which does not require
the MPI libraries.
The code is supplied with a standard GNU make Makefile, which is also
compatible with most other forms of the {\bf make} utility. In theory it is
possible to compile the code without a {\bf make} utility, but it is much
easier to compile the code using the supplied makefile.
\subsection{\texorpdfstring
{Compiling and running {\EPOCH}}
{Compiling and running {EPOCH}}}
To compile {\EPOCH} in the supplied state, you must first change to the
correct working directory. As explained in \sect{directory_structure}, the
root directory for {\EPOCH} contains several subdirectories, including
separate directories for each of the 1D, 2D and 3D versions of the code.
To compile the 2D version of the code, you first switch to the ``epoch2d''
directory using the command\\
\indent\inlinecode{cd \$HOME/epoch/epoch2d}\\
and then type\\
\indent\inlinecode{make}\\
and the code will compile. There are certain options within the code which are
controlled by compiler preprocessors and are described in the next
section. When the code is compiled, it creates a new directory called ``bin''
containing the compiled binary which will be called \inlinecode{epoch1d},
\inlinecode{epoch2d} or \inlinecode{epoch3d}. To run the code, just execute the
binary file by typing:\\
\indent\inlinecode{./bin/epoch2d}\\
or whatever the correct binary is for the dimensionality of the code that you
have. You should be given a screen which begins with the {\EPOCH} logo, and then
reads:
\begin{boxverbatim}
Welcome to EPOCH2D version 4.17.0 (commit v4.17.0-0-g1f6d56a22-clean)
*************************************************************
The code was compiled with no compile time options
*************************************************************
Code is running on 1 processing elements
Specify output directory
\end{boxverbatim}
At this point, the user simply types in the name of the (already existing)
output directory and the code will read the input deck files inside the
specified directory and start running. To run the code in parallel, just use
the normal mpirun or mpiexec scripts supplied by your MPI implementation. If
you want the code to run unattended, then you will need to pipe in the
output directory name to be used. The method for doing this varies between MPI
implementations. For many MPI implementations (such as recent versions of
OpenMPI) this can be achieved with the following:\\
\indent\inlinecode{echo Data | mpirun -np 2 ./bin/epoch2d}\\
Some cluster setups accept the following instead:\\
\indent\inlinecode{mpirun -np 2 ./bin/epoch2d < deck.file}\\
where ``deck.file'' is a file containing the name of the output directory.
Some cluster queueing systems do not
allow the use of input pipes to mpirun. In this case, there is usually a
``-stdin'' command line option to specify an input file. See your cluster
documentation for more details.
As of version 4.2.12, {\EPOCH} now checks for the existence of a file named
``USE\_DATA\_DIRECTORY'' in the current working directory before it prompts
the user for a Data directory. If such a file exists, it reads it to obtain the
name of the data directory to use and does not prompt the user. If no such file
exists, it prompts for a data directory name as before.
This is useful for cluster setups in which it is difficult or
impossible to pipe in the directory name using a job script.
The ``Makefile'' supplied with {\EPOCH} is setup to use the Intel compiler
by default. However, it also contains configurations for gfortran, pgi, g95,
archer and ibm (the compiler suite used on IBM's BlueGene machines).
In order to compile using one of the listed configurations, add the
``\verb|COMPILER=|'' option to the ``\verb|make|'' command. For example\\
\indent\inlinecode{make COMPILER=gfortran}\\
will compile the code using the gfortran compiler and appropriate compiler
flags.
As of version 4.11, it is now possible for the build system to automatically
detect the correct compiler to use. Typing
\indent\inlinecode{make COMPILER=auto}\\
will cause the build system to guess which compiler is in use. Note that this
might not always work, so it is better to use the correct value for
``\verb|COMPILER|'' if it is already known.
You can also compile the code with debugging flags by adding
``\verb|MODE=debug|'' and can compile using more than one processor by
using ``\verb|-j<n>|'', where ``\verb|<n>|''
is the number of processors to use. Note that this is just to speed up the
compilation process; the resulting binary can be run on any number of
processors.
\subsection{Compiler flags and preprocessor defines}
\label{sec:makefile}
As already stated, some features of the code are controlled by compiler
preprocessor directives. The flags for these preprocessor directives are
specified in ``Makefile'' and are placed on lines which look like the
following:
\begin{boxverbatim}
DEFINES += $(D)PER_SPECIES_WEIGHT
\end{boxverbatim}
On most machines ``\texttt{\$(D)}'' just means ``\texttt{-D}'' but the variable
is required to accommodate more exotic setups.
Most of the flags provided in the ``Makefile'' are commented out by prepending
them with a ``\verb|#|'' symbol (the ``make'' system's comment character).
To turn on the effect controlled by a given preprocessor directive, just
uncomment the appropriate ``DEFINES'' line by deleting this ``\verb|#|''
symbol. The options currently controlled by the preprocessor are:\\
\begin{itemize}
\item PER\_SPECIES\_WEIGHT - By default, each pseudoparticle in the code can
represent a different number of real particles. Memory can be saved by
disabling this feature and have all of the pseudoparticles in a species
use the same particle weight. Many of the codes more advanced features
require per-particle weighting so it is enabled by default.
Use this flag to disable per-particle weighting if you need to save on
memory, but it this option is recommended only for advanced users.
\item NO\_TRACER\_PARTICLES - This flag will disable the option to specify one
or more species as zero-current particles. Zero-current particles
move about as would a normal particle with the same charge and mass, but
they do not generate any current and are therefore passive
elements in the simulation. Zero-current particles should be included in
collisions to ensure they move identically to ordinary particles. The
implementation of zero-current particles requires an additional ``IF'' clause
in the particle push, so it has a slight performance impact. If you do not
require the feature then setting this flag will give a slight performance
improvement. \warn Since the particles effectively have zero weight in terms
of their numerical heating properties, they
do not always behave in the same way that an ordinary particle with weight
would behave and this can sometimes lead to unexpected behaviour. If the
purpose is merely to track a subset of a particle species to use as output
then a better mechanism to use is ``persistent subsets''
(see \sect{persistent_subsets}). In version 5.0, this flag will be
and replaced with ``ZERO\_CURRENT\_PARTICLES''.
\item NO\_PARTICLE\_PROBES - For laser plasma interaction studies it can
sometimes
be useful to be able to record information about particles which cross a
plane in the simulation. Since this requires the code to check whether each
particles has crossed the plane in the particles pusher and also to store
copies of particles until the next output dump, it is a heavyweight
diagnostic. If you don't require the diagnostic you can set this flag to
disable it.
\item PARTICLE\_SHAPE\_TOPHAT - By default, the code uses a first order
b-spline (triangle) shape function to represent particles giving
third order particle weighting.
Using this flag changes the particle representation to that of a top-hat
function (0th order b-spline yielding a second order weighting).
\item PARTICLE\_SHAPE\_BSPLINE3 - This flag changes the particle representation
to that of a 3rd order b-spline shape function (5th order weighting).
\item WT\_INTERPOLATION - When this option is enabled, the time-step dependent
force interpolation scheme (WT scheme from \citet{Lu2020}) is used.
\item PARTICLE\_ID - When this option is enabled, all particles are assigned
a unique identification number when writing particle data to file. This
number can then be used to track the progress of a particle during the
simulation.
\item PARTICLE\_ID4 - This does the same as the previous option except it uses
a 4-byte integer instead of an 8-byte one. Whilst this saves storage space,
care must be taken that the number does not overflow.
\item PHOTONS - This enables support for photon particle types in the code.
These are a pre-requisite for modelling synchrotron emission, radiation
reaction and pair production (see \sect{qed_block}).
\item TRIDENT\_PHOTONS - This enables support for virtual photons which are
used by the Trident process for pair production.
\item PREFETCH - This enables an Intel-specific code optimisation.
\item PARSER\_DEBUG - The code outputs more detailed information whilst
parsing the input deck. This is a debug mode for code development.
\item PARTICLE\_DEBUG - Each particle is additionally tagged with information
about which processor it is currently on, and which processor it started
on. This is a debug mode for code development.
\item MPI\_DEBUG - This option installs an error handler for MPI calls which
should aid tracking down some MPI related errors.
\item SIMPLIFY\_DEBUG - This option enables debugging code related to the
deck parser simplification routine.
\item NO\_IO - This option disables all file I/O which can be useful when
doing benchmarking.
\item COLLISIONS\_TEST - This enables some routines for debugging the collision
routines. It completely alters the behaviour of the code. This flag should
never be enabled by the end user.
\item PER\_PARTICLE\_CHARGE\_MASS - By default, the particle charge and
mass are specified on a per-species basis. With this flag enabled, charge
and mass become a per-particle property. This is a legacy flag which will
be removed soon.
\item PARSER\_CHECKING - Setting this flag adds code which checks for valid
values on evaluated deck expressions.
This slows down the code but may be required if floating point exceptions
are enabled.
\item WORK\_DONE\_INTEGRATED - This enables support for tracking the work done
on each particle by the electric field. Note that this increases the size
of each particle by 48 bytes. The information gathered can be output to
file using the ``work\_\{x,y,z\}'' and ``work\_\{x,y,z\}\_total'' dumpmasks.
See \sect{output_directives}.
\item HC\_PUSH - Use the push from \citet{Higuera_Cary_2017}
rather than the Boris push.
This is slower than the Boris push but gives the correct $E\times B$
velocity, which can be important for highly relativistic simulations.
\item DELTAF\_METHOD - Compile the code to use the delta-f method to represent
particles rather than standard PIC. Note that this completely changes the
code behaviour and should not be enabled for normal use. See \sect{deltaf}.
\item DELTAF\_DEBUG - Add debug code for the delta-f method.
\item NO\_USE\_ISATTY - When printing the initial welcome message, EPOCH makes
use of the C-library's isatty function. This requires Fortran2003 features
that might not be available on all platforms. The flag allows this
functionality to be disabled on platforms that don't support it.
\item NO\_MPI3 - This compiler flag allows the user to disable MPI-3 features
such as the ``MPI\_TYPE\_SIZE\_X'' routine. This allows the code to be
compiled against older versions of the MPI library. The flag should only be
enabled if the code fails to compile without it.
\item DECK\_DEBUG - If this flag is enabled then the code will exit if any
warnings are encountered during deck parsing. If the flag is not enabled then
the same behaviour can be obtained by using the ``deck\_warnings\_fatal''
flag in the control block of the input deck. See \sect{control_block}.
\item BREMSSTRAHLUNG - This flag enables the model for simulating
bremsstrahlung radiation. See \sect{bremsstrahlung_block} for details.
\end{itemize}
If a user requests an option which the code has not been compiled to support
then the code will give an error or warning message as follows:
\begin{boxverbatim}
*** ERROR ***
Unable to set "use_qed=T" in the "qed" block.
Please recompile with the -DPHOTONS preprocessor flag.
\end{boxverbatim}
It is also possible to pass other flags to the compiler. In ``Makefile'' there
is a line which reads\\
\indent\inlinecode{FFLAGS = -O3 -fast}\\
The two commands to the right are compiler flags and are passed unaltered to
the FORTRAN compiler. Change this line to add any additional flags required by
your compiler.
By default, {\EPOCH} will write a copy of the source code and input decks
into each restart dump. This can be very useful since a restart dump contains
an exact copy of the code which was used to generate it, ensuring that you
can always regenerate the data or continue running from a restart.
The output can be prevented by using ``dump\_source\_code = F'' and
``dump\_input\_deck = F'' in the output block.
However, the functionality is difficult to build on some platforms so
the Makefile contains a line for bypassing this section of the build
process. Just below all the DEFINE flags there is the following line:
\begin{boxverbatim}
#ENCODED_SOURCE = epoch_source_info_dummy.o
\end{boxverbatim}
Just uncomment this line and source code in restart dumps will be permanently
disabled.
\subsection{\texorpdfstring
{Running {\EPOCH} and basic control of EPOCH1D}
{Running {EPOCH} and basic control of EPOCH1D}}
When the code is run, the output is
{\samepage
\begin{lboxverbatim}{Command line output}
d########P d########b .######b d####### d##P d##P
d########P d########### d########### .########## d##P d##P
---- ---- ---- ----- ---- ----- ---- -- P
d########P d####,,,####P ####. .#### d###P d############P
d########P d#########P #### .###P ####. d############P
d##P d##P #### d#### ####. d##P d##P
d########P d##P ###########P ##########P d##P d##P
d########P d##P d######P #######P d##P d##P
Welcome to EPOCH2D version 4.17.0 (commit v4.17.0-0-g1f6d56a22-clean)
*************************************************************
The code was compiled with no compile time options
*************************************************************
Code is running on 1 processing elements
Specify output directory
\end{lboxverbatim}
}
At which point the end user should simply type in the name of the directory
where the code output is to be placed. This directory must also include the
file \qtt{input.deck} which controls the code setup, specifies how to set the
initial conditions and controls the I/O. Writing an input deck for {\EPOCH} is
fairly time consuming and so the code is supplied with some example input decks
which include all the necessary sections for the code to run. Alternately, the
code checks for the Data directory in a file named ``USE\_DATA\_DIRECTORY''
before prompting at the command-line. This allows the code to be run without
waiting for input at the command-line.
\section{\texorpdfstring
{The {\EPOCH} input deck}
{The {EPOCH} input deck}}
\label{sec:input}
Most of the control of {\EPOCH} is through a text file called \code{input.deck}.
The input deck file must be in the output directory which is passed to the
code at runtime and contains all the basic
information which is needed to set up the code, including the size and
subdivision of the domain, the boundary conditions, the species of particles to
simulate and the output settings for the code. For most users this will be
capable of specifying all the initial conditions and output options they need.
More complicated initial conditions will be handled in later sections.
The input deck is a structured
file which is split into separate blocks, with each block containing several
``parameter'' = ``value'' pairs. The pairs can be present in any order, and not
all possible pairs must be present in any given input deck. If a required pair
is missing the code will exit with an error message. The blocks themselves can
also appear in any order. The input deck is case
sensitive, so true is always ``T'', false is always ``F'' and the names of
the parameters are always lower case.
Parameter values are evaluated using a maths parser which is described in
\sect{maths_parser}.\\
If the deck contains a ``\verb|\|'' character then the rest of the line
is ignored and the next line becomes a continuation of the current one. Also,
the comment character is ``\verb|#|''; if the ``\verb|#|'' character is used
anywhere on a line then the remainder of that line is ignored.\\
\noindent There are three {\it input deck directive} commands, which are:
\begin{itemize}
\item begin:{\it block} - Begin the block named {\it block}.
\item end:{\it block} - Ends the block named {\it block}.
\item import:{\it filename} - Includes another file (called {\it filename})
into the input deck at the point where the directive is encountered. The
input deck parser reads the included file exactly as if the contents of the
included file were pasted directly at the position of the import directive.
\end{itemize}
Each block must be surrounded by valid {\it begin:} and {\it end:} directives
or the input deck will fail. There are currently fourteen valid blocks hard
coded into the input deck reader, but it is possible for end users to extend
the input deck. The fourteen built in blocks are:
\begin{itemize}
\item control - Contains information about the general code setup.
\item boundaries - Contains information about the boundary conditions for this
run.
\item species - Contains information about the species of particles which are
used in the code. Also details of how these are initialised.
\item laser - Contains information about laser boundary sources.
\item fields - Contains information about the EM fields specified at the
start of the simulation.
\item window - Contains information about the moving window if the code is
used in that fashion.
\item output - Contains information about when and how to dump output files.
\item output\_global - Contains parameters which should be applied to all
output blocks.
\item dist\_fn - Contains information about distribution functions that should
be calculated for output.
\item probe - Contains information about particle probes used for output.
\item collisions - Contains information about particle collisions.
\item qed - Contains information about QED pair production.
\item subset - Contains configuration for filters which can be used to modify
the data to be output.
\item constant - Contains information about user defined constants and
expressions. These are designed to simplify the initial condition setup.
\end{itemize}
Note that it is possible for an end user to add new blocks to the input deck.
As a result, a version of the code which you have obtained from a source other
than the GitHub repository may include additional input deck blocks that are
not documented in this manual.
\subsection{\texorpdfstring
{\inlineemph{control} block}
{ {control} block}}
\label{sec:control_block}
The \cemph{control} block sets up the basic code properties for the
domain, the end time of the code, the load balancer and the types of initial
conditions to use.
The control block of a valid input deck for EPOCH2D reads as follows:
\begin{lboxverbatim}{control block}
begin:control
# Global number of gridpoints
nx = 512 # in x
ny = 512 # in y
# Global number of particles
nparticles = 10 * nx * ny
# Final time of simulation
t_end = 1.0e-12
# nsteps = -1
# Size of domain
x_min = -0.1e-6
x_max = 400.0e-6
y_min = -400.0e-6
y_max = 400.0e-6
# dt_multiplier = 0.95
# dlb_threshold = 0.8
# restart_snapshot = 98
# field_order = 2
# maxwell_solver = yee
# stdout_frequency = 10
end:control
\end{lboxverbatim}
As illustrated in the above code block, the ``{\texttt{\#}}'' symbol is treated
as a comment character and the code ignores everything on a line following this
character.\\
The allowed entries are as follows:\\
{\emphtext nx, ny, nz} - Number of grid points in the x,y,z direction. This
parameter is mandatory.\\
{\emphtext nparticles} - The global number of pseudoparticles in the
simulation. This parameter does not need to be given if a specific number
of particles is supplied for each particle species by using the ``nparticles''
directive in each \cemph{species} block (see \sect{species_block}). If both are
given then the value in the \cemph{control} block will be ignored.
``npart'' is accepted as an alias.\\
{\emphtext nsteps} - The number of iterations of the core solver before the
code terminates. Negative numbers instruct the code to only terminate at
\inlineemph{t\_end}. If \inlineemph{nsteps} is not specified then
\inlineemph{t\_end} must be given.\\
{\emphtext t\_end} - The final simulation time in simulation seconds before the
code terminates. If \inlineemph{t\_end} is not specified then
\inlineemph{nsteps} must be given. If they are both specified then
the first time restriction to be satisfied takes precedence. Sometimes it is
more useful to specify the time in picoseconds or femtoseconds. To accomplish
this, just append the appropriate multiplication factor. For example,
``t\_end = 3 * femto'' specifies 3 femtoseconds. A list of multiplication
factors is supplied in \sect{constants}.\\
{\emphtext \{x,y,z\}\_min} - Minimum grid position of the domain in
metres. These are required parameters. Can be negative. ``\{x,y,z\}\_start''
is accepted as a synonym. In a similar manner to that described above,
distances can be specified in microns using a multiplication constant.
eg. ``x\_min = 4 * micron'' specifies a distance of 4$\mu$m.\\
{\emphtext \{x,y,z\}\_max} - Maximum grid position of the domain in
metres. These are required parameters. Must be greater than
\inlineemph{\{x,y,z\}\_min}. ``\{x,y,z\}\_end'' is accepted as a synonym.\\
{\emphtext dt\_multiplier} - Factor by which the timestep is multiplied before
it is applied in the code, i.e. a multiplying factor applied to the CFL
condition on the timestep. Must be less than one. If no value is given then
the default of 0.95 is used. If \inlineemph{maxwell\_solver} is different from
``yee'' (the default) this parameter becomes increasingly relevant.\\
{\emphtext dlb\_threshold} - The minimum ratio of the
load on the least loaded processor to that on the most loaded processor allowed
before the code load balances. Set to 1 means
always balance, set to 0 means never balance. If this parameter is not
specified then the code will only be load balanced at initialisation time.\\
{\emphtext restart\_snapshot} - The number of a previously written restart
dump to restart the code from. If not specified then the initial conditions
from the input deck are used.
Note that as of version 4.2.5, this parameter can now also accept a filename
in place of a number.
If you want to restart from ``0012.sdf'' then it can either be
specified using ``restart\_snapshot = 12'', or alternatively it can be
specified using ``restart\_snapshot = 0012.sdf''. This syntax is required
if output file prefixes have been used (see \sect{output_block}).\\
{\emphtext field\_order} - Order of the finite difference scheme used for
solving Maxwell's equations. Can be 2, 4 or 6. If not specified, the default
is to use a second order scheme.\\
{\emphtext maxwell\_solver} - Choose a Maxwell solver scheme with an extended
stencil. This option is only active if \inlineemph{field\_order} is set to 2.
Possible options are ``yee'', ``lehe\_\{x,y,z\}'', ``pukhov'',``cowan'', ``m4''
and ``custom''.
Note that
not all options are available in 1d and 2d. The default is ``yee'' which is the
default second order scheme.\\
{\emphtext stdout\_frequency} - If specified then the code will print a one
line status message to stdout after every given number or timesteps. The
default is to print nothing to screen (ie. ``\code{stdout\_frequency = 0}'').\\
{\emphtext use\_random\_seed} - The initial particle distribution is
generated using a random number generator. By default, {\EPOCH} uses a fixed
value for the random generator seed so that results are repeatable. If this
flag is set to ``T'' then the seed will be generated using the system clock.\\
{\emphtext nproc\{x,y,z\}} - Number of processes in the \inlineemph{x,y,z}
directions. By default, {\EPOCH} will try to pick the best method of splitting
the domain amongst the available processors but occasionally the user may
wish to override this choice.\\
{\emphtext smooth\_currents} - This is a logical flag. If set to ``T'' then
a smoothing function is applied to the current generated during the particle
push. This can help to reduce noise and self-heating in a simulation. The
smoothing function used is the same as that outlined in \citet{Buneman}.
The default value is ``F''.\\
{\emphtext field\_ionisation} - Logical flag which turns on field ionisation.
See \sect{ionisation}.\\
{\emphtext use\_bsi} - Logical flag which turns on barrier suppression
ionisation correction to the tunnelling ionisation model for high intensity
lasers. See \sect{ionisation}. This flag should always be enabled when
using field ionisation and is only supplied for testing purposes.
The default is ``T''.\\
{\emphtext use\_multiphoton} - Logical flag which turns on modelling
ionisation by multiple photon absorption. This should be set to ``F'' if
there is no laser attached to a boundary as it relies on laser frequency.
See \sect{ionisation}. This flag should always be enabled when
using field ionisation and is only supplied for testing purposes.
The default is ``T''.\\
{\emphtext particle\_tstart} - Specifies the time at which to start pushing
particles. This allows the field to evolve using the Maxwell solver for a
specified time before beginning to move the particles.\\
{\emphtext use\_exact\_restart} - Logical flag which makes a simulation
restart using exactly the same configuration as the original simulation. If
set to ``T'' then the domain split amongst processors will be identical
along with the seeds for the random number generators. Note that the flag
will be ignored if the number of processors does not match that used in the
original run. The default value is ``T''.\\
{\emphtext allow\_cpu\_reduce} - Logical flag which allows the number of CPUs
used to be reduced from the number specified. In some situations it may not
be possible to divide the simulation amongst all the processors requested.
If this flag is set to ``T'' then {\EPOCH} will continue to run and leave
some of the requested CPUs idle. If set to ``F'' then code will exit if all
CPUs cannot be utilised. The default value is ``T''.\\
{\emphtext check\_stop\_file\_frequency} - Integer parameter controlling
automatic halting of the code. The frequency is specified as number of
simulation cycles. Refer to description later in this section.
The default value is 10.\\
{\emphtext stop\_at\_walltime} - Floating point parameter controlling
automatic halting of the code. Refer to description later in this section.
The default value is -1.0.\\
{\emphtext stop\_at\_walltime\_file} - String parameter controlling
automatic halting of the code. Refer to description later in this section.
The default value is an empty string.\\
{\emphtext simplify\_deck} - If this logical flag is set to ``T'' then the deck
parser will attempt to simplify the maths expressions encountered after the
first pass. This can significantly improve the speed of evaluation for some
input deck blocks. The default value is ``F''.\\
{\emphtext print\_constants} - If this logical flag is set to ``T'', deck
constants are printed to the ``deck.status'' and ``const.status'' files
as they are parsed. The default value is ``F''.\\
{\emphtext use\_migration} - Logical flag which determines whether or not to
use particle migration. The default is ``F''. See \sect{migration}.\\
{\emphtext migration\_interval} - The number of timesteps between each
migration event. The default is 1 (migrate at every timestep).
See \sect{migration}.\\
{\emphtext allow\_missing\_restart} - Logical flag to allow code to run when
a restart dump is absent.
When ``restart\_snapshot'' is specified then the simulation first
checks that the specified restart dump is valid. If the restart dump
exists and is valid then it is used to provide initial conditions
for the simulation.
However, if the restart dump does not exist or is not usable for
some reason then by default the simulation will abort.
If ``allow\_missing\_restart'' is set to ``T'' then the simulation will
not abort but will continue to run and use the initial conditions
contained in the input deck to initialise the simulation.
The default value is ``F''.\\
{\emphtext print\_eta\_string} - If this logical flag is set to ``T'' then the
current estimated time to completion will be appended to the status
updates. The default value is ``T''.\\
{\emphtext n\_zeros} - Integer flag which specifies the number of digits to
use for the output file numbers.
(eg. ``0012.sdf''). By default, the code tries to calculate the number of
digits required by dividing t\_end by dt\_snapshot. Note that the minimum
number of digits is 4.\\
{\emphtext use\_accurate\_n\_zeros} - If this logical flag is set to
``T'' then the code performs a more rigorous test to determine the number of
digits required to accommodate all outputs that are to be generated by a run.
Since this can be time consuming and is overkill for most cases, it is
disabled by default.
The default value is ``F''.\\
{\emphtext use\_particle\_count\_update} - If this logical flag is set to
``T'' then the code keeps global particle counts for each species on each
processor. This information isn't needed by the core
algorithm, but can be useful for developing some types of additional physics
packages. It does require one additional MPI\_ALL\_REDUCE per species per
timestep, so it is not activated by default.
The default value is ``F''.\\
{\emphtext reset\_walltime} - When restarting from a dump file, the current
walltime displayed will include the elapsed walltime recorded in the
restart dump. The user can request that this time is ignored by setting
the \inlineemph{reset\_walltime} flag to ``T''.
The default value is ``F''.\\
{\emphtext dlb\_maximum\_interval} - This integer parameter determines the
maximum number of timesteps to allow between load balancing checks.
Each time that the load balancing sweep is unable to improve the load
balance of the simulation, it doubles the number of steps before the
next check will occur. It will keep increasing the check interval until
it reaches the value given by \inlineemph{dlb\_maximum\_interval}. If the
value of \inlineemph{dlb\_maximum\_interval} is negative then the check
interval will increase
indefinitely. When the load balancing sweep finds an improvement to the
load balance of the simulation, the check interval is reset to one.
The default value is 500.\\
{\emphtext dlb\_force\_interval} - This integer parameter determines the
maximum number of timesteps
to allow between forcing a full load balance sweep.
If the current load balance is greater than the value of
\inlineemph{dlb\_threshold}
then the load balancer exits before attempting to improve the loading.
If \inlineemph{dlb\_force\_interval} is greater than zero, then the full load
balancer will be run at the requested interval of timesteps, regardless
of the value of \inlineemph{dlb\_threshold}. Note that the simulation will
only be redistributed if this would result in an improved load balance.
The default value is 2000.\\
{\emphtext balance\_first} - This logical flag determines whether a load balance
will be attempted on the first call of the load balancer.
The load balancer performs two functions: first it attempts to find a
domain decomposition that balances the load evenly amongst processors.
Next, it redistributes the domain and particles onto the new layout (if
required). This latter step is always required when setting up the
simulation, so the load balancer is always called once during set-up.
This flag controls whether or not a load balance is attempted during
this call, regardless of the value of \inlineemph{dlb\_threshold}.
The default value is ``T''.\\
{\emphtext use\_pre\_balance} - This logical flag determines whether a load
balance will be attempted before the particle load occurs. If this flag is
set to ``T'' then the particle auto-loader will be called at setup time, but
instead of creating particles it will just populate a particle-per-cell field
array. This will then be used to calculate the optimal domain decomposition
and all field arrays will be redistributed to use the new layout. Finally,
after all of this has been done, the auto-loader will be called again and
create just the particles that are present on their optimally load-balanced
domains. In contrast, if the flag is set to ``F'' then the domain is just
divided evenly amongst processors and the particles are loaded on this domain
decomposition. Balancing is then carried out on to redistribute the work load.
For heavily imbalanced problems, this can lead to situations in which there is
insufficient memory to setup a simulation, despite there being sufficient
resources for the final load-balanced conditions. The default value is
``T''.\\
{\emphtext use\_optimal\_layout} - This logical flag determines whether the
load balancer attempts to find an optimal processor split before loading
the particles. The initial domain split is chosen in such a way as to
minimize the total surface area of the resulting domains in 3D, or edge
lengths in 2D. For example, if a 2D square domain is run on 16 CPUs then the
domain will be divided by 4 in the x-direction and 4 in the y-direction. The
other possible splits (1x16, 2x8, 8x2, 16x1) are rejected because they all
yield rectangular subdomains whose total edge length is greater than the
4x4 edge length. For some problems (eg. a density ramp or thin foil) this is
a poor choice and a better load balance would be obtained by a less even
split. It is always possible to specify such a split by using
\inlineemph{nproc\{x,y,z\}} flags but enabling the
\inlineemph{use\_optimal\_layout} flag will automatically determine the best
split for you. Future versions of the code will also allow the split to be
changed dynamically at run time. The default value is ``T''.\\
{\emphtext use\_more\_setup\_memory} - This logical flag determines whether the
extra memory will be used during the initial setup of particle species.
If set to false then
only one set of arrays will be used for storing temperature, density and
drift during species loading. This can be a significant memory saving but
omes at the expense of recalculating grid quantities multiple times.
Setting the flag to true enables one set of arrays per species.
The default value is ``F''.\\
{\emphtext deck\_warnings\_fatal} - This logical flag controls the behaviour
of the deck parser when a warning is encountered. Usually the code will
just print a warning message and continue running. Setting this flag to ``T''
will force the code to abort.
The default value is ``F''.\\
\subsubsection{Maxwell Solvers}
\label{sec:maxwell_solvers}
With the default settings ``\inlineemph{field\_order}=2'',
``\inlineemph{maxwell\_solver}=yee'' EPOCH will use the standard second order
Yee scheme for solving Maxwell's equations.
This scheme has a grid dispersion relation with phase velocities smaller than
$c$, especially for large spatial frequencies.
It is possible to introduce extended stencils into the update step of the
Maxwell-Faraday equation which will help improving the dispersion relation.
All of the following extended stencils are only available when
``\inlineemph{field\_order}=2''.
Please note that you will also need to choose an appropriate
\inlineemph{dt\_multiplier}, according to the selected scheme.
A \inlineemph{dt\_multiplier} equal to unity would result in using the largest
time-step allowed by the CFL condition for any of the implemented schemes.
This time-step is said to be marginally stable.
While, in general, the marginally stable time-step has the best dispersion
properties, simulations may suffer from numerical problems such as
exponentially growing noise.
Choosing smaller values for the \inlineemph{dt\_multiplier} tend to improve on
this, while adversely affecting the dispersion relation.
The implemented solvers behave differently in this regard.
Different options are available as follows:\\
{\emphtext maxwell\_solver = lehe\_\{x,y,z\}} - This setting will enable an
extended
stencil proposed by \citet{Lehe2013}.
This stencil focusses on improving the dispersion relation along a specific
direction. The ``lehe\_x'' stencil optimises for waves travelling along the
$x$-axis. Similarly ``lehe\_\{y,z\}'' are tuned for the $y$ and $z$ axis.
please take this into account when defining your laser input.
It is available in EPOCH1D, EPOCH2D and EPOCH3D.
While it is not technically required to use a \inlineemph{dt\_multiplier}
smaller than unity, the value proposed by \citet{Lehe2013} is
``\inlineemph{dt\_multiplier}=0.96''. \\
{\emphtext maxwell\_solver = pukhov} - This setting will enable an extended
stencil proposed by \citet{Pukhov1999} under the name of NDFX.
It is available in EPOCH2D and EPOCH3D. In EPOCH1D, setting
``\inlineemph{maxwell\_solver} = pukhov'' will make the code fall back silently
to Yee's scheme. Pukhov's NDFX scheme aims at improving the
numerical dispersion relation by allowing to choose
``\inlineemph{dt\_multiplier} = 1.0'', while smaller values are also valid.
The resulting dispersion relation is best along the axis with the smallest grid
spacing.\\
{\emphtext maxwell\_solver = cowan} - This setting will enable an extended
stencil proposed by \citet{Cowan2013}. It is available only in EPOCH3D. In
EPOCH1D and EPOCH2D, setting ``\inlineemph{maxwell\_solver} = cowan'' will make
the code fall back silently to Yee's scheme.
\citet{Cowan2013} propose to numerically calculate a time step that has the
correct group velocity for the input laser. Typically these time
steps are only slightly below the CFL condition, e.\,g.
``\inlineemph{dt\_multiplier} = 0.999''.
When Cowan's scheme is reduced to 2D it is the same as Pokhov's scheme with