2.4. Composing the code

The code uses precompiler directives. All of them are supposed to be set in the file piernik.def in the problem directory.

Precompiler directives:

  • are used to select parts of PIERNIK code, which are relevant for given problem
  • instruct setup on which routines should be selected for compilation in ./obj directory
  • instruct precompiler on which parts of selected routines should be retained for compilation

2.4.1. FLUID COMPONENTS:

#define IONIZED
to include parts of the code related to ionized fluid
#define NEUTRAL
to include parts of the code related to neutral fluid
#define DUST
to include parts of the code related to dust fluid
#define COSM_RAYS
to include parts of the code related to cosmic ray component
#define COSM_RAYS_SOURCES
to take into account several different species of cosmic rays particles
#define TRACER
to include parts of the code related to tracer

2.4.2. PHYSICS INCLUDED (i.e. FIELDS, INTERACTIONS):

#define ISO
the choice between adiabatic and isothermal fluids (if defined then isothermal fluid is set, otherwise adiabatic)
#define ISO_LOCAL
to choose isothermal fluids with locally specified soundspeed and temperature (required ISO; currently works only with IONIZED fluid.)
#define MAGNETIC
to include parts of the code related to magnetic field (otherwise magnetic field is switched off even if ionized fluid is simulated)
#define RESISTIVE
to include resistive dissipation of magnetic field
#define FLUID_INTERACTIONS
to take into account interactions between different fluids (eg. drag force)
#define BALSARA
switch to implicit scheme for interactions from Balsara et al. MNRAS (2009) 397 24 and Tilley & Balsara MNRAS (2008) 389 1058
#define GRAV
to include gravitational forces. The type of gravity is govern by external_gp value. Then chosen gravitational potential is computed. If no gravity type is defined by external_gp character value then grav_accel defined by user is used and from given gravitational acceleration potential is computed.
#define VARIABLE_USER_GP
user flag to switch on gravity maxima dumps to log and tsl files (for SELF_GRAV this is as default)
#define CORIOLIS
switch on Coriolis force (works only with RTVD scheme.)
#define SN_SRC
switch on supernovae insert: supernovae initialization is called and random_sn routine is available to be hooked e.g. to problem_customize_solution

2.4.3. NUMERICAL SCHEMES AND SOLUTIONS:

#define RTVD
to choose Relaxing TVD scheme (then HLLC cannot be defined). Set by default if no scheme is chosen.
#define HLLC
to choose HLLC scheme (without magnetic fields; RTVD cannot be defined)
#define LOCAL_FR_SPEED
choose locally computed freezing speed (i.e. in each cell) (then GLOBAL_FR_SPEED cannot be defined)
#define GLOBAL_FR_SPEED
choose globally computed freezing speed (i.e. constant for the whole domain) (then LOCAL_FR_SPEED cannot be defined)
#define MULTIGRID
multigrid solver to include self–gravity (uses FFT when possible, recommended). Desired to be set with GRAV and/or COSM_RAYS flags.
#define FFTW
using shear_fftw (SHEAR should be defined)
#define SHEAR
to include Coriolis and tidal forces in gas equation of motion and use Hawley, Gammie and Balbus (1995) type approach for shearing BCS (only with RTVD scheme.)
#define SHEAR_BND
shear boundary conditions.
#define HYDROSTATIC_V2
change hydrostatic_zeq scheme and find midplane corresponding to zero gravity (practically the least gravity absolute value)
#define ZERO_BND_EMF
switch to putting 0 on emf boundaries for outflow type boundary conditions instead of constant emf gradient as default

2.4.4. DIRECTIVES ALLOCATED TO PROBLEMS:

#define JEANS_PROBLEM
switch on jeans problem-specific quirks
#define MACLAURIN_PROBLEM
switch on maclaurin problem-specific quirks
#define USER_RULES
include precompiler instructions from user_rules.h file from problem directory at the beginning of compilation

2.4.5. OTHERS:

#define DEBUG
enable modules: piernikdebug (src/base/debug.F90) and piernikiodebug (src/hdf5/io_debug.F90)
#define DEBUG_DUMPS
switch on HDF5 control dumps to debug refinement updates
#define HEAVY_DEBUG
marks routines that normally are never called, but at some point were useful to test correctness or something.
#define VERBOSE
print additional diagnostic information on stdout
#define INDEPENDENT_ATOUTB
switch to independent (instead of collective) write to files (restart files) for arrays with outer boundary area type
#define PERFMON
switch on counting total wallclock and cpu times and printing them at the end of a simulation.
#define PIERNIK_OPENCL
Include module responsible for integration of OpenCL in Piernik
#define __INTEL_COMPILER
automatic flag placed by Intel Compiler
#define __PGI
flag for Portland Compilers

2.4.6. AUTOMATICALLY DEFINED:

#define SELF_GRAV
switch on self-gravity, automatically defined when MULTIGRID and GRAV are defined.
#define VARIABLE_GP
automatically defined when SELF_GRAV or VARIABLE_USER_GP is defined.

2.4.7. INTERNAL (NOT ALLOWED TO USE BY USER!!!):

#define POISSON_FFT
Out-of-date. Flag to include self–gravity (pure FFT solver)
#define HDF5
hdf5
#define SN_GALAXY
sn_galaxy
#define MAGNETIZED
magnetized
#define CRS_GALAXY
crs_galaxy
#define CR_SN
cr_sn
#define UMUSCL
umuscl
#define __GFORTRAN__
__gfortran__
#define FR_SPEED
Flag used to code configuration sanity checks. Do not define it!
#define FR_SPEED2
Flag used to code configuration sanity checks. Do not define it!
#define FLUID
Flag used to code configuration sanity checks. Do not define it!
#define HYDRO_SOLVER
Flag used to code configuration sanity checks. Do not define it!
#define I_KNOW_WHAT_I_AM_DOING
i_know_what_i_am_doing
#define _CRAYFTN
_crayftn
#define __TEST
__test
#define PSM
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define PLN
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define KSG
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define KSM
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define PGM
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define SSY
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define SI
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define CGS
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.
#define WT4
Out-of-date. Use run-time parameter units_set from UNITS namelist instead of { PGM SSY SI CGS WT4 PSM PLN KSG KSM } preprocessor symbols.