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. | |
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. | |
Variables | |
static int | out_count = 0 |
static OutputS * | OutArray = NULL |
static OutputS | rst_out |
static int | rst_flag = 0 |
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.
int check_particle_binning | ( | char * | out | ) |
Check if particle binning is need.
Definition at line 1252 of file output.c.
Referenced by init_output().
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().
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().
1-component of cell-centered B-field
Definition at line 1146 of file output.c.
References ConsS::B1c, and GridS::U.
2-component of cell-centered B-field
Definition at line 1151 of file output.c.
References ConsS::B2c, and GridS::U.
3-component of cell-centered B-field
Definition at line 1156 of file output.c.
References ConsS::B3c, and GridS::U.
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.
Particle density.
Referenced by dump_particle_history().
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.
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.
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.
Particle 2-velocity.
Referenced by expr_dVypar(), and OutputModeAmplitude().
Particle 3-velocity.
Referenced by expr_dV3par(), expr_dVypar(), and OutputModeAmplitude().
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().
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().
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().
void init_output | ( | MeshS * | pM | ) |
Initializes data output.
Definition at line 171 of file output.c.
References ath_error(), ath_perr(), ath_pout(), check_particle_binning(), OutputS::dat_fmt, OutputS::der, OutputS::dmax, OutputS::dmin, OutputS::dt, OutputS::expr, free_output(), get_usr_expr(), get_usr_out_fun(), get_usr_par_prop(), getexpr(), getRGB(), OutputS::gmax, OutputS::gmin, OutputS::id, OutputS::n, name, OutputS::ndim, OutputS::ndomain, OutputS::nlevel, OutputS::num, MeshS::Nx, OutputS::out, out_count, OutputS::out_fmt, OutputS::out_fun, OutputS::out_pargrid, OutputS::palette, par_exist(), par_getd(), par_getd_def(), par_geti(), par_geti_def(), par_gets(), par_gets_def(), OutputS::par_prop, parse_slice(), OutputS::reduce_x1, OutputS::reduce_x2, OutputS::reduce_x3, OutputS::res_fun, OutputS::rgb, MeshS::RootMaxX, MeshS::RootMinX, rst_flag, OutputS::sdmax, OutputS::sdmin, OutputS::t, MeshS::time, OutputS::x1l, OutputS::x1u, OutputS::x2l, OutputS::x2u, OutputS::x3l, and OutputS::x3u.
Referenced by main().
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().
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().
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().
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:
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().
int out_count = 0 [static] |
Definition at line 105 of file output.c.
Referenced by data_output(), data_output_destruct(), and init_output().
int rst_flag = 0 [static] |
Definition at line 108 of file output.c.
Referenced by data_output(), data_output_destruct(), and init_output().