PLUTO  4.4-patch2
Macros | Variables
pluto.h File Reference

PLUTO main header file. More...

#include <stdio.h>
#include <stdarg.h>
#include <stdint.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/Hall_MHD/hall_mhd.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 INITIAL_SMOOTHING   NO
 
#define NGHOST_USR   -1
 
#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 NIONS   0
 
#define NFLX_LOOP(n)   for ((n) = NFLX; (n)--; )
 
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 uint16_t (2 bytes integer, 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, 16-bit ***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_NEGATIVE_PRESSURE   128
 
#define FLAG_NEGATIVE_ENERGY   256
 
#define FLAG_NEGATIVE_DENSITY   512
 
#define FLAG_BIT_11   1024
 
#define FLAG_BIT_12   2048
 
#define FLAG_BIT_13   4096
 
#define FLAG_BIT_14   8192
 
#define FLAG_BIT_15   16384
 
#define FLAG_GCA_FAILURE   32768
 
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_e   4.80320425e-10
 
#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_Rgas   8.3144598e7
 
#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_intStage
 
int g_maxIMEXIter
 
int g_maxRiemannIter
 
int g_maxRootIter
 
int g_nprocs
 
long int g_stepNumber
 
long int g_usedMemory
 
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@t.nosp@m.o.inf.nosp@m.n.it)
Date
Jun 02, 2021

Macro Definition Documentation

◆ CONST_AH

#define CONST_AH   1.008

Atomic weight of Hydrogen

◆ CONST_AHe

#define CONST_AHe   4.004

Atomic weight of Helium

◆ CONST_amu

#define CONST_amu   1.66053886e-24

Atomic mass unit.

◆ CONST_au

#define CONST_au   1.49597892e13

Astronomical unit.

◆ CONST_AZ

#define CONST_AZ   30.0

Mean atomic weight of heavy elements

◆ CONST_c

#define CONST_c   2.99792458e10

Speed of Light.

◆ CONST_e

#define CONST_e   4.80320425e-10

Elementary (proton) charge

◆ CONST_eV

#define CONST_eV   1.602176463158e-12

Electron Volt in erg.

◆ CONST_G

#define CONST_G   6.6726e-8

Gravitational Constant.

◆ CONST_h

#define CONST_h   6.62606876e-27

Planck Constant.

◆ CONST_kB

#define CONST_kB   1.3806505e-16

Boltzmann constant.

◆ CONST_ly

#define CONST_ly   0.9461e18

Light year.

◆ CONST_me

#define CONST_me   9.1093826e-28

Electron mass.

◆ CONST_Mearth

#define CONST_Mearth   5.9736e27

Earth Mass.

◆ CONST_mH

#define CONST_mH   1.6733e-24

Hydrogen atom mass.

◆ CONST_mn

#define CONST_mn   1.67492728e-24

Neutron mass.

◆ CONST_mp

#define CONST_mp   1.67262171e-24

Proton mass.

◆ CONST_Msun

#define CONST_Msun   2.e33

Solar Mass.

◆ CONST_NA

#define CONST_NA   6.0221367e23

Avogadro Contant.

◆ CONST_pc

#define CONST_pc   3.0856775807e18

Parsec.

◆ CONST_PI

#define CONST_PI   3.14159265358979

$ \pi $.

◆ CONST_Rearth

#define CONST_Rearth   6.378136e8

Earth Radius.

◆ CONST_Rgas

#define CONST_Rgas   8.3144598e7

Perfect gas constant

◆ CONST_Rsun

#define CONST_Rsun   6.96e10

Solar Radius.

◆ CONST_sigma

#define CONST_sigma   5.67051e-5

Stephan Boltmann constant.

◆ CONST_sigmaT

#define CONST_sigmaT   6.6524e-25

Thomson Cross section.

◆ DOM

#define DOM   107

Computational domain (interior)

◆ FLAG_BIT_11

#define FLAG_BIT_11   1024

Free bit

◆ FLAG_BIT_12

#define FLAG_BIT_12   2048

Free bit

◆ FLAG_BIT_13

#define FLAG_BIT_13   4096

Free bit

◆ FLAG_BIT_14

#define FLAG_BIT_14   8192

Free bit

◆ FLAG_BIT_15

#define FLAG_BIT_15   16384

Free bit

◆ FLAG_ENTROPY

#define FLAG_ENTROPY   8

Update pressure using entropy equation.

◆ FLAG_FLAT

#define FLAG_FLAT   2

Reconstruct using FLAT limiter.

◆ FLAG_GCA_FAILURE

#define FLAG_GCA_FAILURE   32768

Singularity in the GCA because of E_ > B (incomplete stencil error)

◆ FLAG_HLL

#define FLAG_HLL   4

Switch to HLL Riemann solver.

◆ FLAG_INTERNAL_BOUNDARY

#define FLAG_INTERNAL_BOUNDARY   32

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

◆ FLAG_MINMOD

#define FLAG_MINMOD   1

Reconstruct using MINMOD limiter.

◆ FLAG_NEGATIVE_DENSITY

#define FLAG_NEGATIVE_DENSITY   512

A negative density has been found

◆ FLAG_NEGATIVE_ENERGY

#define FLAG_NEGATIVE_ENERGY   256

A negative energy has been found

◆ FLAG_NEGATIVE_PRESSURE

#define FLAG_NEGATIVE_PRESSURE   128

A negative pressure has been found

◆ FLAG_SPLIT_CELL

#define FLAG_SPLIT_CELL   16

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

◆ INITIAL_SMOOTHING

#define INITIAL_SMOOTHING   NO

Assign initial conditions by averaging multiple values inside the cell

◆ KELVIN

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

◆ NFLX_LOOP

#define NFLX_LOOP (   n)    for ((n) = NFLX; (n)--; )

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. 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_FLUID
         <---------------------->
                   NSCL
 <---------------------------------------------->
                     NVAR

◆ NGHOST_USR

#define NGHOST_USR   -1

When positive, it specifes a user-provided number of ghost zones.

◆ NIONS

#define NIONS   0

Set the number of scalars including:

  • NTRACER (user-supplied)
  • NIONS chemical fractions (cooling modules)
  • Entropy

In total, there are NSCL = NIONS+NTRACER+ENTROPY passive scalar to be advected.

◆ RECONSTRUCT_4VEL

#define RECONSTRUCT_4VEL   NO

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

◆ TOT

#define TOT   108

Computational domain (total)

◆ UNIT_DENSITY

#define UNIT_DENSITY   (CONST_mp)

Unit density in gr/cm^3.

◆ UNIT_LENGTH

#define UNIT_LENGTH   (CONST_au)

Unit Length in cm.

◆ UNIT_VELOCITY

#define UNIT_VELOCITY   (1.e5)

Unit velocity in cm/sec.

◆ X1_BEG

#define X1_BEG   101

Boundary region at X1 beg

◆ X1_END

#define X1_END   102

Boundary region at X1 end

◆ X2_BEG

#define X2_BEG   103

Boundary region at X2 beg

◆ X2_END

#define X2_END   104

Boundary region at X2 end

◆ X3_BEG

#define X3_BEG   105

Boundary region at X3 beg

◆ X3_END

#define X3_END   106

Boundary region at X3 end

Variable Documentation

◆ g_dir

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;

◆ g_domBeg

double g_domBeg[3]

Lower limits of the computational domain.

◆ g_domEnd

double g_domEnd[3]

Upper limits of the computational domain.

◆ g_dt

double g_dt

The current integration time step.

◆ g_i

int g_i

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

◆ g_inputParam

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.

◆ g_intStage

int g_intStage

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

◆ g_j

int g_j

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

◆ g_k

int g_k

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

◆ g_maxCoolingRate

double g_maxCoolingRate

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

◆ g_maxIMEXIter

int g_maxIMEXIter

Maximum number if iterations in IMEX scheme

◆ g_maxMach

double g_maxMach

The maximum Mach number computed during integration.

◆ g_maxRiemannIter

int g_maxRiemannIter

Maximum number of iterations for iterative Riemann Solver.

◆ g_maxRootIter

int g_maxRootIter

Maximum number of iterations for root finder

◆ g_minCoolingTemp

double g_minCoolingTemp

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

◆ g_nprocs

int g_nprocs

The total number of processors

◆ g_smallDensity

double g_smallDensity

Small value for density fix.

◆ g_smallPressure

double g_smallPressure

Small value for pressure fix.

◆ g_stepNumber

long int g_stepNumber

Gives the current integration step number.

◆ g_time

double g_time

The current integration time.

◆ g_usedMemory

long int g_usedMemory

Amount of used memory in bytes.

◆ IBEG

long int IBEG

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

◆ IEND

long int IEND

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

◆ JBEG

long int JBEG

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

◆ JEND

long int JEND

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

◆ KBEG

long int KBEG

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

◆ KEND

long int KEND

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

◆ NMAX_POINT

long int NMAX_POINT

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

◆ NX1

long int NX1

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

◆ NX1_TOT

long int NX1_TOT

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

◆ NX2

long int NX2

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

◆ NX2_TOT

long int NX2_TOT

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

◆ NX3

long int NX3

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

◆ NX3_TOT

long int NX3_TOT

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

◆ prank

int prank

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