Source file p3d.F90
Main program for the full-particle code:
-
perform initialization tasks (e.g. call to subroutine init_pe_env,
source file modules.F90), load start-up file
(call to subroutine input, source file inout.F90),
enforce Poisson equation div E = rho and div B
= 0 (call to subroutine divergence, source file maxwell.M)
-
main time stepping loop
-
calculate total energy: call to subroutine energy (source file
misc.M)
-
advance electric and magnetic field from t to t+dt/2 using
Ampere's and Faraday's law: call to subroutine stepfield (source
file maxwell.M); loop since stepfield
allows for a reduced time step
-
step particle location from t to t+dt/2: call to subroutine
stepx
(source file particles.F90)
-
sort particles in particle buffer to increase performance due to better
usage of the memory cache: call to subroutine partsort (source file
particles.F90)
-
calculate and smooth charge density rho: call to subroutines calc_rho
(source file particles.F90) and smooth_rho
(source file boundary.F90); subtract average
charge (call to subroutine subtract_average, source file misc.M)
-
fix divergence of E to satisfy Poisson equation: call to
subroutine divergence (source file maxwell.M)
-
step particle velocity form t to t+dt: call to subroutine
stepv
(source file particles.F90)
-
step particle location from t+dt/2 to t+dt: call to subroutine
stepx
(source
file particles.F90)
-
calculate and smooth current density j: call to subroutines
calc_j
(source
file particles.F90) and
smooth_j
(source file boundary.F90)
-
advance electric and magnetic field from t+dt/2 to t+dt:
call to subroutine stepfield (source file maxwell.M)
-
write movie frames on request (controlled by special header files, e.g.
movie2d.h):
calls to subroutines in source file movie.F90
-
several scenarios for finishing execution: maximum number of time steps
reached, maximum execution time reached, stop on operator's request (only
on T3E in Garching): call to subroutine output (source file inout.F90)
Switches:
-
skip_poisson: use this switch to determine how often the subroutine
divergence
is called to fix the Poisson equation. With #define skip_poisson 1
it is called at every time step, whereas with
#define skip_poisson
10 it is called after 10,20,30 time steps only. Usually a value of
10
is sufficient for numerical accuracy and speeds up execution.
-
subtract_average_rho: use this switch if the plasma is not exactly
neutral on average (i.e. same total number of electrons and ions), e.g.
when only electron dynamics is studied and the neutralizing background
is dropped. To activate this option use #define subtract_average_rho
-
electrostatic: use #define electrostatic for electrostatic
calculations. In this case the electric field is determined only by Poisson's
equation and the magnetic field does not change at all.
-
stat_ions: use #define stat_ions if the ions are stationary.
The velocity and the position of the ions is kept unchanged.
-
maxruntime: After maxruntime minutes of operation the code
starts termination and stores the data. maxruntime should be sufficiently
smaller than the time limit of the batch queue, since storing the data
can require a significant amount of time. Example: #define maxruntime
180
-
substeps: The code allows to substep the electromagnetic field,
the time step for Maxwell's equations being dt/(2*substeps). Choose
substeps
according to dt, e.g. #define substeps 12