Functions | Variables

output.c File Reference

Controls output of data. More...

Go to the source code of this file.

Functions

Real expr_d (const GridS *pG, const int i, const int j, const int k)
 Density.
Real expr_M1 (const GridS *pG, const int i, const int j, const int k)
 1-component of momentum
Real expr_M2 (const GridS *pG, const int i, const int j, const int k)
 2-component of momentum
Real expr_M3 (const GridS *pG, const int i, const int j, const int k)
 3-component of momentum
Real expr_E (const GridS *pG, const int i, const int j, const int k)
 Total energy.
Real expr_B1c (const GridS *pG, const int i, const int j, const int k)
 1-component of cell-centered B-field
Real expr_B2c (const GridS *pG, const int i, const int j, const int k)
 2-component of cell-centered B-field
Real expr_B3c (const GridS *pG, const int i, const int j, const int k)
 3-component of cell-centered B-field
Real expr_ME (const GridS *pG, const int i, const int j, const int k)
 Magnetic field energy.
Real expr_V1 (const GridS *pG, const int i, const int j, const int k)
 1-velocity
Real expr_V2 (const GridS *pG, const int i, const int j, const int k)
 2-velocity
Real expr_V3 (const GridS *pG, const int i, const int j, const int k)
 3-velocity
Real expr_P (const GridS *pG, const int i, const int j, const int k)
 Pressure.
Real expr_cs2 (const GridS *pG, const int i, const int j, const int k)
 Sound speed squared.
Real expr_S (const GridS *pG, const int i, const int j, const int k)
 entropy = P/d^{Gamma}
Real expr_G (const GridS *pG, const int i, const int j, const int k)
 gamma = 1/sqrt(1-v^2)
Real expr_dpar (const GridS *pG, const int i, const int j, const int k)
 Particle density.
Real expr_M1par (const GridS *pG, const int i, const int j, const int k)
 Particle 1-momentum.
Real expr_M2par (const GridS *pG, const int i, const int j, const int k)
 Particle 2-momentum.
Real expr_M3par (const GridS *pG, const int i, const int j, const int k)
 Particle 3-momentum.
Real expr_V1par (const GridS *pG, const int i, const int j, const int k)
 Particle 1-velocity.
Real expr_V2par (const GridS *pG, const int i, const int j, const int k)
 Particle 2-velocity.
Real expr_V3par (const GridS *pG, const int i, const int j, const int k)
 Particle 3-velocity.
int check_particle_binning (char *out)
 Check if particle binning is need.
static ConsFun_t getexpr (const int n, const char *expr)
 Return a function pointer for a simple expression - no parsing.
static void free_output (OutputS *pout)
 free memory associated with Output structure.
static void parse_slice (char *block, char *axname, Real *l, Real *u, int *flag)
 Sets the lower and upper bounds of a slice along an axis, using values of x1, x2 or x3 in the <output> block.
float * getRGB (char *name)
 function for accessing palettes stored stored in structure RGB.
void init_output (MeshS *pM)
 Initializes data output.
void data_output (MeshS *pM, const int flag)
 Called by main(), tests whether time for output, and calls appropriate output functions.
void data_output_destruct (void)
 Free all memory associated with Output, called by main() at end of run.
Real *** OutData3 (GridS *pgrid, OutputS *pout, int *Nx1, int *Nx2, int *Nx3)
 Creates 3D array of output data with dimensions equal to Grid using output expression (function pointer) stored in Output structure.
Real ** OutData2 (GridS *pgrid, OutputS *pout, int *Nx1, int *Nx2)
 Creates 2D array of output data with two dimensions equal to Grid and one dimension reduced according to range stored in x1l/x1u, etc.
RealOutData1 (GridS *pgrid, OutputS *pout, int *Nx1)
 Creates 1D array of output data with one dimensions equal to Grid and two dimensions reduced according to range stored in x1l/x1u, etc.

Variables

static int out_count = 0
static OutputSOutArray = NULL
static OutputS rst_out
static int rst_flag = 0

Detailed Description

Controls output of data.

PURPOSE: Controls output of data. Output is divided into three types:

TOTAL NUMBER of outputs is controlled by 'maxout' in <job> block in input file. Only the first 'maxout' <outputN> blocks are processed, where N < maxout. If N > maxout, that <outputN> block is ignored.

OPTIONS available in an <outputN> block are:

EXAMPLE of an <outputN> block for a VTK dump:

EXAMPLE of an <outputN> block for a ppm image of a x1-x2 slice with data averaged over 0.5-10 in x3 in ppm format:

EXAMPLE of an <outputN> block for restarts:

CONTROL of output proceeds as follows: -init_output(): called by main(), parses the first maxout output blocks. The info in each block is stored in an element of a global array of "Output_s" structures, including a pointer to the appropriate output function. -data_output(): called in main loop, compares integration time with time for output for each element in Output array, and calls output functions.

To add permanently a new type of output X, write a new function output_X, modify init_output() to set the output function pointer when out_fmt=X in the input file (see below for examples of pgm, ppm, etc.)

See Users Manual to add a problem-specific user-defined output function in the problem definition file.

CONTAINS PUBLIC FUNCTIONS:

PRIVATE FUNCTION PROTOTYPES:

VARIABLE TYPE AND STRUCTURE DEFINITIONS: none ============================================================================

Definition in file output.c.


Function Documentation

int check_particle_binning ( char *  out  ) 

Check if particle binning is need.

Definition at line 1252 of file output.c.

Referenced by init_output().

Here is the caller graph for this function:

void data_output ( MeshS pM,
const int  flag 
)

Called by main(), tests whether time for output, and calls appropriate output functions.

Setting the input argument flag=1 forces a write of all output's. If the input argument flag=0, then only those output's whose next output time has passed will be written.

Definition at line 498 of file output.c.

References OutputS::dt, OutputS::n, n, OutputS::num, out_count, OutputS::out_fun, par_setd(), par_seti(), particle_to_grid(), OutputS::res_fun, rst_flag, OutputS::t, and MeshS::time.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void data_output_destruct ( void   ) 

Free all memory associated with Output, called by main() at end of run.

Definition at line 576 of file output.c.

References ath_pout(), OutputS::dat_fmt, OutputS::gmax, OutputS::gmin, OutputS::id, OutputS::out, out_count, OutputS::out_fmt, and rst_flag.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

Real expr_B1c ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

1-component of cell-centered B-field

Definition at line 1146 of file output.c.

References ConsS::B1c, and GridS::U.

Real expr_B2c ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

2-component of cell-centered B-field

Definition at line 1151 of file output.c.

References ConsS::B2c, and GridS::U.

Real expr_B3c ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

3-component of cell-centered B-field

Definition at line 1156 of file output.c.

References ConsS::B3c, and GridS::U.

Real expr_cs2 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Sound speed squared.

Definition at line 1207 of file output.c.

References ConsS::B1c, ConsS::B2c, ConsS::B3c, ConsS::d, ConsS::E, Gamma, Gamma_1, ConsS::M1, ConsS::M2, ConsS::M3, and GridS::U.

Real expr_d ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Density.

Definition at line 1114 of file output.c.

References ConsS::d, and GridS::U.

Real expr_dpar ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle density.

Referenced by dump_particle_history().

Here is the caller graph for this function:

Real expr_E ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Total energy.

Definition at line 1135 of file output.c.

References ConsS::E, and GridS::U.

Real expr_G ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

gamma = 1/sqrt(1-v^2)

Definition at line 1240 of file output.c.

References Cons_to_Prim(), GridS::U, PrimS::V1, PrimS::V2, PrimS::V3, and W.

Here is the call graph for this function:

Real expr_M1 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

1-component of momentum

Definition at line 1119 of file output.c.

References ConsS::M1, and GridS::U.

Real expr_M1par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 1-momentum.

Real expr_M2 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

2-component of momentum

Definition at line 1124 of file output.c.

References ConsS::M2, and GridS::U.

Real expr_M2par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 2-momentum.

Real expr_M3 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

3-component of momentum

Definition at line 1129 of file output.c.

References ConsS::M3, and GridS::U.

Real expr_M3par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 3-momentum.

static Real expr_ME ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Magnetic field energy.

Computes B^2/8pi.

Definition at line 1161 of file output.c.

References ConsS::B1c, ConsS::B2c, ConsS::B3c, and GridS::U.

Real expr_P ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Pressure.

Definition at line 1189 of file output.c.

References ConsS::B1c, ConsS::B2c, ConsS::B3c, ConsS::d, ConsS::E, Gamma_1, Iso_csound2, ConsS::M1, ConsS::M2, ConsS::M3, and GridS::U.

Real expr_S ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

entropy = P/d^{Gamma}

Definition at line 1223 of file output.c.

References ConsS::B1c, ConsS::B2c, ConsS::B3c, ConsS::d, ConsS::E, Gamma, Gamma_1, ConsS::M1, ConsS::M2, ConsS::M3, and GridS::U.

Real expr_V1 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

1-velocity

Definition at line 1173 of file output.c.

References ConsS::d, ConsS::M1, and GridS::U.

Real expr_V1par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 1-velocity.

Referenced by expr_dVxpar().

Here is the caller graph for this function:

Real expr_V2 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

2-velocity

Definition at line 1178 of file output.c.

References ConsS::d, ConsS::M2, and GridS::U.

Referenced by OutputModeAmplitude().

Here is the caller graph for this function:

Real expr_V2par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 2-velocity.

Referenced by expr_dVypar(), and OutputModeAmplitude().

Here is the caller graph for this function:

Real expr_V3 ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

3-velocity

Definition at line 1183 of file output.c.

References ConsS::d, ConsS::M3, and GridS::U.

Referenced by OutputModeAmplitude().

Here is the caller graph for this function:

Real expr_V3par ( const GridS pG,
const int  i,
const int  j,
const int  k 
)

Particle 3-velocity.

Referenced by expr_dV3par(), expr_dVypar(), and OutputModeAmplitude().

Here is the caller graph for this function:

static void free_output ( OutputS pOut  )  [static]

free memory associated with Output structure.

Only used when error occurs in adding a new output; this function frees memory and returns control to calling function

Definition at line 1357 of file output.c.

References OutputS::dat_fmt, OutputS::id, OutputS::out, and OutputS::out_fmt.

Referenced by init_output().

Here is the caller graph for this function:

static ConsFun_t getexpr ( const int  n,
const char *  expr 
) [static]

Return a function pointer for a simple expression - no parsing.

For a user defined expression, get_usr_expr() in problem.c is used.

Definition at line 1279 of file output.c.

References ath_perr().

Referenced by init_output().

Here is the call graph for this function:

Here is the caller graph for this function:

float * getRGB ( char *  name  ) 

function for accessing palettes stored stored in structure RGB.

Compares argument with strings (names) of palettes in RGB, and returns pointer to first element of matching palette.

Definition at line 1427 of file output.c.

References ath_perr(), RGB::name, RGB::rgb, and rgb.

Referenced by init_output().

Here is the call graph for this function:

Here is the caller graph for this function:

void init_output ( MeshS pM  ) 
Real * OutData1 ( GridS pgrid,
OutputS pout,
int *  Nx1 
)

Creates 1D array of output data with one dimensions equal to Grid and two dimensions reduced according to range stored in x1l/x1u, etc.

Data is computed using output expression (function pointer) stored in Output structure. If slice range lies outside of coordinate range in Grid, the NULL pointer is returned. Dimension of array created is also returned in arguments.

Definition at line 881 of file output.c.

References ath_error(), ath_perr(), calloc_1d_array(), data, OutputS::expr, fc_pos(), GridS::ie, il, GridS::is, iu, GridS::je, jl, GridS::js, ju, GridS::ke, kl, GridS::ks, ku, GridS::MaxX, GridS::MinX, OutputS::n, OutputS::ndim, GridS::Nx, OutputS::out, OutputS::reduce_x1, OutputS::reduce_x2, OutputS::reduce_x3, OutputS::x1l, OutputS::x1u, OutputS::x2l, OutputS::x2u, OutputS::x3l, and OutputS::x3u.

Referenced by out_ktab(), and output_tab_1d().

Here is the call graph for this function:

Here is the caller graph for this function:

Real ** OutData2 ( GridS pgrid,
OutputS pout,
int *  Nx1,
int *  Nx2 
)

Creates 2D array of output data with two dimensions equal to Grid and one dimension reduced according to range stored in x1l/x1u, etc.

Data is computed using output expression (function pointer) stored in Output structure. If slice range lies outside of coordinate range in Grid, the NULL pointer is returned. Dimensions of array created are also returned in arguments

Definition at line 699 of file output.c.

References ath_error(), ath_perr(), calloc_2d_array(), data, OutputS::expr, fc_pos(), GridS::ie, il, GridS::is, iu, GridS::je, jl, GridS::js, ju, GridS::ke, kl, GridS::ks, ku, GridS::MaxX, GridS::MinX, OutputS::n, OutputS::ndim, GridS::Nx, OutputS::out, OutputS::reduce_x1, OutputS::reduce_x2, OutputS::reduce_x3, OutputS::x1l, OutputS::x1u, OutputS::x2l, OutputS::x2u, OutputS::x3l, and OutputS::x3u.

Referenced by output_pgm(), output_ppm(), output_tab_2d(), and output_vtk_2d().

Here is the call graph for this function:

Here is the caller graph for this function:

Real *** OutData3 ( GridS pgrid,
OutputS pout,
int *  Nx1,
int *  Nx2,
int *  Nx3 
)

Creates 3D array of output data with dimensions equal to Grid using output expression (function pointer) stored in Output structure.

Dimensions of array created also returned in arguments.

Definition at line 636 of file output.c.

References ath_error(), calloc_3d_array(), data, OutputS::expr, GridS::ie, il, GridS::is, iu, GridS::je, jl, GridS::js, ju, GridS::ke, kl, GridS::ks, ku, OutputS::n, OutputS::ndim, GridS::Nx, and OutputS::out.

Referenced by output_tab_3d(), and output_vtk_3d().

Here is the call graph for this function:

Here is the caller graph for this function:

static void parse_slice ( char *  block,
char *  axname,
Real l,
Real u,
int *  flag 
) [static]

Sets the lower and upper bounds of a slice along an axis, using values of x1, x2 or x3 in the <output> block.

These are used to slice the data for outputs, averaged between l and u. Valid formats are:

  • x1 = 5e3 both l and u set to 5.0e3
  • x1 = 5.3:10e4 l set to 5.3, u set to 1.0e5
  • x1 = : l set to RootMinX, u set to RootMaxX
  • x1 = 5: l set to 5.0, u set to RootMaxX
  • x1 = :10 l set to RootMinX, u set to 10.0 If values for x1,x2,x3 are not set in the <output> block, then l and u are not changed (default values should be set in calling function).

Note that data is always reduced along the directions specified by x1/2/3. It is not possible to create a smaller 3D array by specifying ranges for all three of x1,x2 and x3 at once. Instead, this would reduce the data to a single point (not allowed).

This function only parses the input text to extract values of l and u, the actual slicing and averaging is done by OutData1,2,3().

Definition at line 1391 of file output.c.

References ath_error(), par_exist(), and par_gets().

Referenced by init_output().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int out_count = 0 [static]

Definition at line 105 of file output.c.

Referenced by data_output(), data_output_destruct(), and init_output().

OutputS* OutArray = NULL [static]

Definition at line 106 of file output.c.

int rst_flag = 0 [static]

Definition at line 108 of file output.c.

Referenced by data_output(), data_output_destruct(), and init_output().

OutputS rst_out [static]

Definition at line 107 of file output.c.