Source file p3d-hybrid.F90
Main program for the hybrid 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 div B = 0 (call to subroutine divergence,
source file hybrid.M)
-
main time stepping loop
-
calculate total energy: call to subroutine energy (source file
misc.M)
-
advance electron pressure and magnetic field from t to t+dt/2
using electron fluid equations: call to subroutine stephybrid (source
file hybrid.M); loop since stephybrid
allows for a reduced time step controlled by the switch substeps
-
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 ion density n (for compatibility with the particle
code the density is stored in the variable rho): call to subroutines
calc_rho (source file particles.F90)
and smooth_rho (source file boundary.F90);
add base density to avoid numerical instabilities at very low particle
density: call to subroutine add_base_density (source file hybrid.M)
-
calculate and smooth ion current density j (required to calculate
electric field): call to subroutines calc_j (source file particles.F90)
and smooth_j (source file boundary.F90)
-
calculate electric field (required for ion equation of motion): call to
subroutine calc_e (source file hybrid.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 ion density n: call to subroutines calc_rho
(source file particles.F90) and smooth_rho
(source file boundary.F90); add base density:
call to subroutine add_base_density (source file hybrid.M)
-
calculate and smooth ion current density j: call to subroutines
calc_j
(source
file particles.F90) and
smooth_j
(source file boundary.F90)
-
advance electron pressure and magnetic field from t to t+dt/2
using electron fluid equations: call to subroutine stephybrid (source
file hybrid.M)
-
write movie frames on request (controlled by special header files, e.g.
movie2dhybrid.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:
-
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 substepping of the fluid part, the time
step in the routine stephybrid is dt(2*substeps). Only at
the last substep in the substepping loop the multigrid is called in full
version leading to convergence, whereas during the other cycles multigrid
iterations with a fixed number of iterations are performed (compare discussion
for the source file multigrid.M)