PLUTO  4.2
 All Data Structures Files Functions Variables Enumerations Macros Pages
Macros | Variables
pluto.h File Reference

PLUTO main header file. More...

#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include "definitions.h"
#include <al.h>
#include "macros.h"
#include "structs.h"
#include "mod_defs.h"
#include "MHD/ShearingBox/shearingbox.h"
#include "States/plm_coeffs.h"
#include "States/ppm_coeffs.h"
#include "Math_Tools/math_tools.h"
#include "eos.h"
#include "prototypes.h"

Go to the source code of this file.

Macros

#define MAX_OUTPUT_TYPES   11
 
#define RECONSTRUCT_4VEL   NO
 
#define UNIT_DENSITY   (CONST_mp)
 
#define UNIT_LENGTH   (CONST_au)
 
#define UNIT_VELOCITY   (1.e5)
 
#define KELVIN   (UNIT_VELOCITY*UNIT_VELOCITY*CONST_amu/CONST_kB)
 
#define NSCL   (NTRACER + NIONS + (ENTROPY_SWITCH != 0))
 
#define NVAR   (NFLX + NSCL + NDUST)
 
Labels identifying different boundary and domain regions.

These are useful in Boundary() and when setting RBox structures in different points of the code.

#define X1_BEG   101
 
#define X1_END   102
 
#define X2_BEG   103
 
#define X2_END   104
 
#define X3_BEG   105
 
#define X3_END   106
 
#define DOM   107
 
#define TOT   108
 
Bit flag labels.

The following macros define the bits that can be turned on or off in an unsigned char (= 1 byte = 8 bits) variable. Different bit flags allow to enable or disable certain actions in a given cell at different points in the code, see also flag.c. The 3D unsigned char ***flag array is used for bookeeping, in each zone (i,j,k), which bits are actually switched on or off. A simple bitwise operation is used to enable a flag, e.g., flag[k][j][i] |= FLAG_XXX . For instance, by turning the FLAG_HLL bit on, we have flag = 00000100 , while by also enabling the FLAG_SPLIT_CELL one has flag = 00010100 and so on. Individual bits can also be turned off with the complement operator

Individual bits can also be turned off, e.g., flag &= ~FLAG_XXX;

#define FLAG_MINMOD   1
 
#define FLAG_FLAT   2
 
#define FLAG_HLL   4
 
#define FLAG_ENTROPY   8
 
#define FLAG_SPLIT_CELL   16
 
#define FLAG_INTERNAL_BOUNDARY   32
 
#define FLAG_CONS2PRIM_FAIL   64
 
#define FLAG_BIT8   128
 
Physical constants in c.g.s units.

The following set of macros express some useful physical constants in c.g.s units (erg, cm and sec). Values have been taken from http://physic.nist.gov/cuu/Constants/index.html

#define CONST_AH   1.008
 
#define CONST_AHe   4.004
 
#define CONST_AZ   30.0
 
#define CONST_amu   1.66053886e-24
 
#define CONST_au   1.49597892e13
 
#define CONST_c   2.99792458e10
 
#define CONST_eV   1.602176463158e-12
 
#define CONST_G   6.6726e-8
 
#define CONST_h   6.62606876e-27
 
#define CONST_kB   1.3806505e-16
 
#define CONST_ly   0.9461e18
 
#define CONST_mp   1.67262171e-24
 
#define CONST_mn   1.67492728e-24
 
#define CONST_me   9.1093826e-28
 
#define CONST_mH   1.6733e-24
 
#define CONST_Msun   2.e33
 
#define CONST_Mearth   5.9736e27
 
#define CONST_NA   6.0221367e23
 
#define CONST_pc   3.0856775807e18
 
#define CONST_PI   3.14159265358979
 
#define CONST_Rearth   6.378136e8
 
#define CONST_Rsun   6.96e10
 
#define CONST_sigma   5.67051e-5
 
#define CONST_sigmaT   6.6524e-25
 

Variables

int prank
 
long int IBEG
 
long int IEND
 
long int JBEG
 
long int JEND
 
long int KBEG
 
long int KEND
 
long int NX1
 
long int NX2
 
long int NX3
 
long int NX1_TOT
 
long int NX2_TOT
 
long int NX3_TOT
 
long int NMAX_POINT
 
int g_i
 
int g_j
 
int g_k
 
int g_dir
 
int g_maxRiemannIter
 
int g_maxRootIter
 
long int g_usedMemory
 
long int g_stepNumber
 
int g_intStage
 
int g_operatorStep
 
double g_maxCoolingRate
 
double g_minCoolingTemp
 
double g_smallDensity
 
double g_smallPressure
 
double g_time
 
double g_dt
 
double g_maxMach
 
double g_domBeg [3]
 
double g_domEnd [3]
 
double g_inputParam [32]
 

Detailed Description

Contains basic macro definitions, structure definitions and global variable declarations used by the code.

Author
A. Mignone (migno.nosp@m.ne@p.nosp@m.h.uni.nosp@m.to.i.nosp@m.t)
Date
July 05, 2015

Macro Definition Documentation

#define CONST_AH   1.008

Atomic weight of Hydrogen

#define CONST_AHe   4.004

Atomic weight of Helium

#define CONST_amu   1.66053886e-24

Atomic mass unit.

#define CONST_au   1.49597892e13

Astronomical unit.

#define CONST_AZ   30.0

Mean atomic weight of heavy elements

#define CONST_c   2.99792458e10

Speed of Light.

#define CONST_eV   1.602176463158e-12

Electron Volt in erg.

#define CONST_G   6.6726e-8

Gravitational Constant.

#define CONST_h   6.62606876e-27

Planck Constant.

#define CONST_kB   1.3806505e-16

Boltzmann constant.

#define CONST_ly   0.9461e18

Light year.

#define CONST_me   9.1093826e-28

Electron mass.

#define CONST_Mearth   5.9736e27

Earth Mass.

#define CONST_mH   1.6733e-24

Hydrogen atom mass.

#define CONST_mn   1.67492728e-24

Neutron mass.

#define CONST_mp   1.67262171e-24

Proton mass.

#define CONST_Msun   2.e33

Solar Mass.

#define CONST_NA   6.0221367e23

Avogadro Contant.

#define CONST_pc   3.0856775807e18

Parsec.

#define CONST_PI   3.14159265358979

$ \pi $.

#define CONST_Rearth   6.378136e8

Earth Radius.

#define CONST_Rsun   6.96e10

Solar Radius.

#define CONST_sigma   5.67051e-5

Stephan Boltmann constant.

#define CONST_sigmaT   6.6524e-25

Thomson Cross section.

#define DOM   107

Computational domain (interior)

#define FLAG_ENTROPY   8

Update pressure using entropy equation.

#define FLAG_FLAT   2

Reconstruct using FLAT limiter.

#define FLAG_HLL   4

Use HLL Riemann solver.

#define FLAG_INTERNAL_BOUNDARY   32

Zone belongs to an internal boundary region and should be excluded from being updated in time

#define FLAG_MINMOD   1

Reconstruct using MINMOD limiter.

#define FLAG_SPLIT_CELL   16

Zone is covered by a finer level (AMR only).

Define the conversion constant between dimensionless temperature prs/rho and physical temperature in Kelvin, T = (prs/rho)*KELVIN*mu

#define MAX_OUTPUT_TYPES   11

The maximum number of output file formats is fixed to 11 so that the size of runtime structure (defined below) is 64 bytes. This should prevent, for some compilers, attempts to change the alignment of the structure and therefore troubleshooting when restarting from files written on different architectures.

#define NSCL   (NTRACER + NIONS + (ENTROPY_SWITCH != 0))

The number of scalars (passive tracers). This includes

  • NTRACER (user-supplied)
  • NIONS chemical fractions (added by cooling modules)
  • Entropy In total, there are NSCL = NIONS+NTRACER+(ENTROPY passive scalar to be advected.
#define NVAR   (NFLX + NSCL + NDUST)

The total number of variables that are evolved in time. This includes:

  • NFLX: number of equations defining the system of conservation laws. For example, for the HD module, it consists of density, momentum and energy. It is defined in the physics module header file mod_defs.h.
  • NIONS: number of chemical species; defined in the cooling modules cooling.h, if present.
  • NTRACER: number of user-defined tracers; defined in the problem directory header file definitions.h
           NFLX    NIONS    NTRACER    ENTR    NDUST
                   <---------------------->
                              NSCL
           <--------------------------------------->
                    NVAR
    
#define RECONSTRUCT_4VEL   NO

When set to YES, reconstruct 4-velocity rather than 3-velocity (only for RHD and RMHD physics modules)

#define TOT   108

Computational domain (total)

#define UNIT_DENSITY   (CONST_mp)

Unit density in gr/cm^3.

#define UNIT_LENGTH   (CONST_au)

Unit Length in cm.

#define UNIT_VELOCITY   (1.e5)

Unit velocity in cm/sec.

#define X1_BEG   101

Boundary region at X1 beg

#define X1_END   102

Boundary region at X1 end

#define X2_BEG   103

Boundary region at X2 beg

#define X2_END   104

Boundary region at X2 end

#define X3_BEG   105

Boundary region at X3 beg

#define X3_END   106

Boundary region at X3 end

Variable Documentation

int g_dir

Specifies the current sweep or direction of integration. Its value is set usually in the time stepping functions and can take the values

  • IDIR, for integration in the X1 dir;
  • JDIR, for integration in the X2 dir;
  • KDIR, for integration in the X3 dir;
double g_domBeg[3]

Lower limits of the computational domain.

double g_domEnd[3]

Upper limits of the computational domain.

double g_dt

The current integration time step.

int g_i

x1 grid index when sweeping along the x2 or x3 direction.

double g_inputParam[32]

Array containing the user-defined parameters. The index names of this array are defined in definitions.h through the python interface.

int g_intStage

Gives the current integration stage of the time stepping method (predictor = 0, 1st corrector = 1, and so on).

int g_j

x2 grid index when sweeping along the x1 or x3 direction.

int g_k

x3 grid index when sweeping along the x1 or x2 direction.

double g_maxCoolingRate

The maximum fractional variation due to cooling from one step to the next.

double g_maxMach

The maximum Mach number computed during integration.

int g_maxRiemannIter

Maximum number of iterations for iterative Riemann Solver.

int g_maxRootIter

Maximum number of iterations for root finder

double g_minCoolingTemp

The minimum temperature (in K) below which cooling is suppressed.

int g_operatorStep

Gives the current operator step. (HYPERBOLIC_STEP/PARABOLIC_STEP/SOURCE_STEP).

double g_smallDensity

Small value for density fix.

double g_smallPressure

Small value for pressure fix.

long int g_stepNumber

Gives the current integration step number.

double g_time

The current integration time.

long int g_usedMemory

Amount of used memory in bytes.

long int IBEG

Lower grid index of the computational domain in the the X1 direction for the local processor.

long int IEND

Upper grid index of the computational domain in the the X1 direction for the local processor.

long int JBEG

Lower grid index of the computational domain in the the X2 direction for the local processor.

long int JEND

Upper grid index of the computational domain in the the X2 direction for the local processor.

long int KBEG

Lower grid index of the computational domain in the the X3 direction for the local processor.

long int KEND

Upper grid index of the computational domain in the the X3 direction for the local processor.

long int NMAX_POINT

Maximum number of points among the three directions, boundaries excluded.

long int NX1

Number of interior zones in the X1 directions (boundaries excluded) for the local processor.

long int NX1_TOT

Total number of zones in the X1 direction (boundaries included) for the local processor.

long int NX2

Number of interior zones in the X2 directions (boundaries excluded) for the local processor.

long int NX2_TOT

Total number of zones in the X2 direction (boundaries included) for the local processor.

long int NX3

Number of interior zones in the X3 directions (boundaries excluded) for the local processor.

long int NX3_TOT

Total number of zones in the X3 direction (boundaries included) for the local processor.

int prank

Processor rank. In serial mode it is defined to be 0.