programmer's documentation
Functions | Variables
cs_lagr_stat.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_printf.h"
#include "bft_error.h"
#include "bft_mem.h"
#include "cs_base.h"
#include "cs_file.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_location.h"
#include "cs_mesh_quantities.h"
#include "cs_order.h"
#include "cs_parall.h"
#include "cs_restart_default.h"
#include "cs_timer_stats.h"
#include "cs_log.h"
#include "cs_array_reduce.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_lagr_tracking.h"
#include "cs_lagr.h"
#include "cs_lagr_stat.h"
Include dependency graph for cs_lagr_stat.c:

Functions

static void _unit_value_m_cells (const void *input, int location_id, int class_id, cs_real_t vals[])
 
static void _vol_fraction (const void *input, int location_id, int class_id, cs_real_t vals[])
 
static void _check_moment_type (int type)
 Check statistics type is in possible range. More...
 
static int _n_stat_types (void)
 Return number of possible statistics types. More...
 
static void _statistical_weight_name (int class, char name[64])
 Create statistical weight. More...
 
static void _stat_name (int stat_type, int component_id, int class_id, cs_lagr_stat_moment_t moment_type, char name[64])
 Create statistics name. More...
 
static cs_real_t_mwa_val (cs_lagr_moment_wa_t *mwa)
 Return pointer to weight accumulator values. More...
 
static const cs_real_t_mwa_const_val (const cs_lagr_moment_wa_t *mwa)
 Return pointer to weight accumulator values. More...
 
static const cs_real_t_dt_val (void)
 Return pointer to time step values. More...
 
static void _assert_restart_success (int retcode)
 
static int _check_restart (const char *name, const cs_time_step_t *ts, cs_lagr_moment_restart_info_t *ri, int location_id, int wa_location_id, int dim, cs_lagr_stat_moment_t moment_type, int stat_type, int class_id, int *nt_start, double *t_start, cs_lagr_stat_restart_t restart_mode)
 
static void _restart_info_read_auxiliary (cs_restart_t *r)
 
static void _restart_info_read (void)
 
static void _restart_info_free (void)
 
static void _cs_lagr_moment_restart_read (void)
 Read restart moment data. More...
 
static void _init_vars_attribute (void)
 
static int _find_or_add_wa (cs_lagr_moment_p_data_t *p_data_func, cs_lagr_moment_m_data_t *m_data_func, const void *data_input, int class_id, int location_id, int nt_start, double t_start, int prev_wa_id)
 Add or find moment weight and time accumulator. More...
 
static cs_field_t_cs_lagr_moment_associate_field (const char *name, int location_id, int dim)
 Create and associate a field to a moment. More...
 
static int _find_or_add_moment (int location_id, int component_id, int class_id, int stat_type, int dim, cs_lagr_moment_p_data_t *p_data_func, cs_lagr_moment_m_data_t *m_data_func, const void *data_input, cs_lagr_stat_moment_t m_type, int wa_id, int prev_id)
 Add or find moment structure. . More...
 
static void _cs_lagr_moment_reset (cs_lagr_moment_t *mt)
 Statistics initialization. More...
 
static cs_lnum_t _n_w_elts (const cs_lagr_moment_wa_t *mwa)
 Return number of elements associated with a weight accumulator. More...
 
static void _ensure_init_wa (cs_lagr_moment_wa_t *mwa)
 Initialize weight accumulator if required and reset to 0. More...
 
static void _update_wa_m (cs_lagr_moment_wa_t *mwa, cs_real_t *restrict w)
 Update weight accumulator for a mesh-based weight array. More...
 
static void _ensure_init_moment (cs_lagr_moment_t *mt)
 Initialize moment value if required. More...
 
static void _vv_mesh_location_cells (int location_id_y, const cs_real_t x[], cs_real_t y[])
 Vector-vector multiplication, where the multiplying vector is defined on cells, and the multiplied vector defined on a given mesh location. More...
 
static cs_real_t_compute_current_weight_m (cs_lagr_moment_wa_t *mwa, const cs_real_t *restrict dt, cs_real_t w0[1])
 Compute current weight if weight is based on a mesh (not particle) based function. More...
 
static void _cs_lagr_moment_reset_unsteady_stats (void)
 Reset unsteady stats. More...
 
static void _cs_lagr_stat_update_mesh_moment (cs_lagr_moment_t *mt, const cs_lagr_moment_wa_t *mwa, const cs_real_t *restrict w, int nt_cur)
 Update a given mesh based date function moment. More...
 
static void _cs_lagr_stat_update_all (void)
 Update all moment accumulators. More...
 
static void _free_all_moments (void)
 
static void _free_all_wa (void)
 Free all moment weight and time accumulators. More...
 
static int _stat_define (const char *name, int location_id, int stat_type, cs_lagr_stat_moment_t m_type, int class_id, int dim, int component_id, cs_lagr_moment_p_data_t *p_data_func, cs_lagr_moment_m_data_t *m_data_func, void *data_input, cs_lagr_moment_p_data_t *w_p_data_func, cs_lagr_moment_m_data_t *w_m_data_func, void *w_data_input, int nt_start, double t_start, cs_lagr_stat_restart_t restart_mode)
 Define a particle statistic. More...
 
int cs_lagr_stat_define (const char *name, int location_id, int stat_type, cs_lagr_stat_moment_t m_type, int class_id, int dim, int component_id, cs_lagr_moment_p_data_t *data_func, void *data_input, cs_lagr_moment_p_data_t *w_data_func, void *w_data_input, int nt_start, double t_start, cs_lagr_stat_restart_t restart_mode)
 Define a particle statistic. More...
 
int cs_lagr_stat_accumulator_define (const char *name, int location_id, int class_id, cs_lagr_moment_p_data_t *w_data_func, void *w_data_input, int nt_start, double t_start, cs_lagr_stat_restart_t restart_mode)
 Define a particle weight type statistic. More...
 
int cs_lagr_stat_time_moment_define (const char *name, int location_id, int stat_type, cs_lagr_stat_moment_t m_type, int class_id, int dim, int component_id, cs_lagr_moment_m_data_t *data_func, void *data_input, cs_lagr_moment_m_data_t *w_data_func, void *w_data_input, int nt_start, double t_start, cs_lagr_stat_restart_t restart_mode)
 Define a time moment associated to particle statistics. More...
 
void cs_lagr_stat_activate (int stat_type)
 Activate Lagrangian statistics for a given statistics type. More...
 
void cs_lagr_stat_deactivate (int stat_type)
 Deactivate Lagrangian statistics for a given statistics type. More...
 
void cs_lagr_stat_activate_attr (int attr_id)
 Activate Lagrangian statistics for a given particle attribute. More...
 
void cs_lagr_stat_deactivate_attr (int attr_id)
 Deactivate Lagrangian statistics for a given particle attribute. More...
 
int cs_lagr_stat_type_from_attr_id (int attr_id)
 Return statistics type associated with a given particle attribute id. More...
 
int cs_lagr_stat_type_to_attr_id (int stat_type)
 Return attribute id associated with a given statistics type. More...
 
void cs_lagr_stat_map_cell_dt (const cs_real_t *dt)
 Map time step values array for Lagrangian statistics. More...
 
void cs_lagr_stat_initialize (void)
 Lagrangian statistics initialization. More...
 
void cs_lagr_stat_update (void)
 Update particle statistics for a given time step. More...
 
void cs_lagr_stat_finalize (void)
 Destroy all moments management metadata. More...
 
void cs_lagr_stat_log_iteration (void)
 Log moment definition information for a given iteration. More...
 
void cs_lagr_stat_restart_write (cs_restart_t *restart)
 Checkpoint moment data. More...
 
cs_field_tcs_lagr_stat_get_moment (int stat_type, cs_lagr_stat_moment_t m_type, int class_id, int component_id)
 Return field associated with a given Lagrangian statistic, given a statistics type (i.e. variable), moment order, and given a statistics type (i.e. variable), moment order, statistical class, and component id. More...
 
cs_field_tcs_lagr_stat_get_stat_weight (int class_id)
 Return statistical weight. More...
 
cs_real_t cs_lagr_stat_get_age (void)
 Return global volume statistics age. More...
 
cs_real_t cs_lagr_stat_get_moment_age (cs_field_t *f)
 Return statistics age for a given moment. More...
 

Variables

static bool * _vol_stat_activate = NULL
 
static bool _restart_info_checked = false
 
static cs_lagr_moment_restart_info_t * _restart_info = NULL
 
static cs_lagr_moment_wa_t * _lagr_stats_wa = NULL
 
static cs_lagr_moment_t * _lagr_stats = NULL
 
static int _n_lagr_stats_wa = 0
 
static int _n_lagr_stats_wa_max = 0
 
static int _n_lagr_stats = 0
 
static int _n_lagr_stats_max = 0
 
static double _t_prev_iter = 0.
 
static const cs_real_t_p_dt = NULL
 
const char * cs_lagr_moment_type_name []
 
static cs_lagr_stat_options_t _lagr_stat_options
 
cs_lagr_stat_options_tcs_glob_lagr_stat_options = &_lagr_stat_options
 

Function Documentation

§ _assert_restart_success()

static void _assert_restart_success ( int  retcode)
static

§ _check_moment_type()

static void _check_moment_type ( int  type)
static

Check statistics type is in possible range.

Parameters
[in]typemoment type

§ _check_restart()

static int _check_restart ( const char *  name,
const cs_time_step_t ts,
cs_lagr_moment_restart_info_t *  ri,
int  location_id,
int  wa_location_id,
int  dim,
cs_lagr_stat_moment_t  moment_type,
int  stat_type,
int  class_id,
int *  nt_start,
double *  t_start,
cs_lagr_stat_restart_t  restart_mode 
)
static

§ _compute_current_weight_m()

static cs_real_t* _compute_current_weight_m ( cs_lagr_moment_wa_t *  mwa,
const cs_real_t *restrict  dt,
cs_real_t  w0[1] 
)
static

Compute current weight if weight is based on a mesh (not particle) based function.

When applicable, this function either returns a pointer to an allocated array, or to w0. If the returned value is different from w0 (i.e. allocated), the caller is responsible for freeing it.

When not applicable (i.e. when no mesh-based weight computation function is defined), NULL is returned.

[in, out] mwa moment weight accumulator [in] dt cell time step values [in, out] w0 pointer to buffer in case weight values is of size 1

Returns
pointer to weight array (w0 or allocated array), or NULL

§ _cs_lagr_moment_associate_field()

static cs_field_t* _cs_lagr_moment_associate_field ( const char *  name,
int  location_id,
int  dim 
)
static

Create and associate a field to a moment.

Parameters
[in]namefield name
[in]location_idmesh location id
[in]dimfield dimension
Returns
associated field

§ _cs_lagr_moment_reset()

static void _cs_lagr_moment_reset ( cs_lagr_moment_t *  mt)
static

Statistics initialization.

Reset moment to zero Called once for stationnary moments, at every step for non-stationnary statistics

§ _cs_lagr_moment_reset_unsteady_stats()

static void _cs_lagr_moment_reset_unsteady_stats ( void  )
static

Reset unsteady stats.

§ _cs_lagr_moment_restart_read()

static void _cs_lagr_moment_restart_read ( void  )
static

Read restart moment data.

§ _cs_lagr_stat_update_all()

static void _cs_lagr_stat_update_all ( void  )
static

Update all moment accumulators.

§ _cs_lagr_stat_update_mesh_moment()

static void _cs_lagr_stat_update_mesh_moment ( cs_lagr_moment_t *  mt,
const cs_lagr_moment_wa_t *  mwa,
const cs_real_t *restrict  w,
int  nt_cur 
)
static

Update a given mesh based date function moment.

Parameters
[in,out]mtpointer to associated moment
[in]mwapointer to associated weight accumulator
[in]wweight values for current time step
[in]nt_cur

§ _dt_val()

static const cs_real_t* _dt_val ( void  )
static

Return pointer to time step values.

Returns
pointer to time step values

§ _ensure_init_moment()

static void _ensure_init_moment ( cs_lagr_moment_t *  mt)
static

Initialize moment value if required.

Parameters
[in,out]mtmoment

§ _ensure_init_wa()

static void _ensure_init_wa ( cs_lagr_moment_wa_t *  mwa)
static

Initialize weight accumulator if required and reset to 0.

Parameters
[in,out]mwamoment weight accumulator

§ _find_or_add_moment()

static int _find_or_add_moment ( int  location_id,
int  component_id,
int  class_id,
int  stat_type,
int  dim,
cs_lagr_moment_p_data_t p_data_func,
cs_lagr_moment_m_data_t m_data_func,
const void *  data_input,
cs_lagr_stat_moment_t  m_type,
int  wa_id,
int  prev_id 
)
static

Add or find moment structure. .

Parameters
[in]location_idid of associated mesh location
[in]component_idattribute component id, or < 0 for all
[in]class_idstatistical class
[in]stat_typestatistics type id, or -1
[in]dimdimension associated with element data
[in]p_data_funcparticle-based function used to define data values, or NULL
[in]m_data_funcmesh-based function used to define data values, or NULL
[in]data_inputpointer to optional value or structure to be used by data_func
[in]m_typemoment type, mean or variance
[in]wa_idweight accumulator id
[in]prev_idrestart moment id
Returns
id of matching moment

§ _find_or_add_wa()

static int _find_or_add_wa ( cs_lagr_moment_p_data_t p_data_func,
cs_lagr_moment_m_data_t m_data_func,
const void *  data_input,
int  class_id,
int  location_id,
int  nt_start,
double  t_start,
int  prev_wa_id 
)
static

Add or find moment weight and time accumulator.

If no data function is provided, a constant weight of 1 is assumed (this weight will be multiplied by the time step).

Note that if the data_input associated with a data_func pointer is not NULL, the lifecycle of the data pointed to must be handled separately (and the pointer must remain valid throughout the time moment updates).

Parameters
[in]m_typeassociated moment type
[in]p_data_funcparticle-based function used to define data values, or NULL
[in]m_data_funcmesh-based function used to define data values, or NULL
[in]data_inputpointer to optional (untyped) value or structure
[in]class_idstatistical class number
[in]location_idassociated mesh location id
[in]nt_startstarting time step
[in]t_startstarting time
[in]prev_wa_idprevious weight accumulator id, or -1
Returns
id of matching time accumulator

§ _free_all_moments()

static void _free_all_moments ( void  )
static

§ _free_all_wa()

static void _free_all_wa ( void  )
static

Free all moment weight and time accumulators.

§ _init_vars_attribute()

static void _init_vars_attribute ( void  )
static

§ _mwa_const_val()

static const cs_real_t* _mwa_const_val ( const cs_lagr_moment_wa_t *  mwa)
static

Return pointer to weight accumulator values.

Parameters
[in]mwapointer to weight accumulator structure
Returns
pointer to weight accumulator values

§ _mwa_val()

static cs_real_t* _mwa_val ( cs_lagr_moment_wa_t *  mwa)
static

Return pointer to weight accumulator values.

Parameters
[in]mwapointer to weight accumulator structure
Returns
pointer to weight accumulator values

§ _n_stat_types()

static int _n_stat_types ( void  )
inlinestatic

Return number of possible statistics types.

Returns
number of possible statistics types

§ _n_w_elts()

static cs_lnum_t _n_w_elts ( const cs_lagr_moment_wa_t *  mwa)
static

Return number of elements associated with a weight accumulator.

Returns
number of elements associated with a weight accumulator.

§ _restart_info_free()

static void _restart_info_free ( void  )
static

§ _restart_info_read()

static void _restart_info_read ( void  )
static

§ _restart_info_read_auxiliary()

static void _restart_info_read_auxiliary ( cs_restart_t r)
static

§ _stat_define()

static int _stat_define ( const char *  name,
int  location_id,
int  stat_type,
cs_lagr_stat_moment_t  m_type,
int  class_id,
int  dim,
int  component_id,
cs_lagr_moment_p_data_t p_data_func,
cs_lagr_moment_m_data_t m_data_func,
void *  data_input,
cs_lagr_moment_p_data_t w_p_data_func,
cs_lagr_moment_m_data_t w_m_data_func,
void *  w_data_input,
int  nt_start,
double  t_start,
cs_lagr_stat_restart_t  restart_mode 
)
static

Define a particle statistic.

If dimension > 1, the val array is interleaved

Parameters
[in]namestatistics base name
[in]location_idid of associated mesh location
[in]stat_typepredefined statistics type, or -1
[in]m_typemoment type
[in]class_idparticle class id, or 0 for all
[in]dimdimension associated with element data
[in]component_idattribute component id, or < 0 for all
[in]p_data_funcpointer to particle function to compute statistics (if stat_type < 0)
[in]m_data_funcpointer to mesh location function to compute statistics (if stat_type < 0)
[in]data_inputassociated input
[in]w_p_data_funcpointer to particle function to compute weight (if NULL, statistic weight assumed)
[in]w_m_data_funcpointer to mesh location function to compute weight (if stat_type < 0)
[in]w_data_inputassociated input for w_data_func
[in]nt_startstarting time step (or -1 to use t_start, 0 to use idstnt)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
Returns
id of new moment in case of success, -1 in case of error.

§ _stat_name()

static void _stat_name ( int  stat_type,
int  component_id,
int  class_id,
cs_lagr_stat_moment_t  moment_type,
char  name[64] 
)
static

Create statistics name.

Parameters
[in]stat_typeparticle statistics type
[in]component_idcomponent id, or -1
[in]class_idstatistical class id, or 0
[in]moment_typemoment type
[out]nameresulting name

§ _statistical_weight_name()

static void _statistical_weight_name ( int  class,
char  name[64] 
)
static

Create statistical weight.

Parameters
[in]classstatistical class id, or 0
[out]nameresulting name

§ _unit_value_m_cells()

static void _unit_value_m_cells ( const void *  input,
int  location_id,
int  class_id,
cs_real_t  vals[] 
)
static

§ _update_wa_m()

static void _update_wa_m ( cs_lagr_moment_wa_t *  mwa,
cs_real_t *restrict  w 
)
static

Update weight accumulator for a mesh-based weight array.

Parameters
[in,out]mwamoment weight accumulator
[in]pointerto current weight values

§ _vol_fraction()

static void _vol_fraction ( const void *  input,
int  location_id,
int  class_id,
cs_real_t  vals[] 
)
static

§ _vv_mesh_location_cells()

static void _vv_mesh_location_cells ( int  location_id_y,
const cs_real_t  x[],
cs_real_t  y[] 
)
static

Vector-vector multiplication, where the multiplying vector is defined on cells, and the multiplied vector defined on a given mesh location.

Parameters
[in]location_id_ylocation id for y
[in]xmultiplier array
[in,out]ymultiplied array

§ cs_lagr_stat_accumulator_define()

int cs_lagr_stat_accumulator_define ( const char *  name,
int  location_id,
int  class_id,
cs_lagr_moment_p_data_t w_data_func,
void *  w_data_input,
int  nt_start,
double  t_start,
cs_lagr_stat_restart_t  restart_mode 
)

Define a particle weight type statistic.

Weights are automatically associated to general statitistics, but defining them explicitely allows activation of standard logging and postprocessing for those weights, as well as defining specific weights.

Parameters
[in]namestatistics base name
[in]location_idid of associated mesh location
[in]class_idparticle class id, or 0 for all
[in]w_data_funcpointer to function to compute particle weight (if NULL, statistic weight assumed)
[in]w_data_inputassociated input for w_data_func
[in]nt_startstarting time step (or -1 to use t_start, 0 to use idstnt)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
Returns
id of new moment in case of success, -1 in case of error.

§ cs_lagr_stat_activate()

void cs_lagr_stat_activate ( int  stat_type)

Activate Lagrangian statistics for a given statistics type.

This function is ignored if called after cs_lagr_stat_initialize.

Parameters
[in]stat_type_idparticle statistics type

§ cs_lagr_stat_activate_attr()

void cs_lagr_stat_activate_attr ( int  attr_id)

Activate Lagrangian statistics for a given particle attribute.

This function is ignored if called after cs_lagr_stat_initialize.

Parameters
[in]attr_idparticle attribute id

§ cs_lagr_stat_deactivate()

void cs_lagr_stat_deactivate ( int  stat_type)

Deactivate Lagrangian statistics for a given statistics type.

This function is ignored if called after cs_lagr_stat_initialize.

Parameters
[in]stat_typeparticle statistics type

§ cs_lagr_stat_deactivate_attr()

void cs_lagr_stat_deactivate_attr ( int  attr_id)

Deactivate Lagrangian statistics for a given particle attribute.

This function is ignored if called after cs_lagr_stat_initialize.

Parameters
[in]attr_idparticle attribute id

§ cs_lagr_stat_define()

int cs_lagr_stat_define ( const char *  name,
int  location_id,
int  stat_type,
cs_lagr_stat_moment_t  m_type,
int  class_id,
int  dim,
int  component_id,
cs_lagr_moment_p_data_t data_func,
void *  data_input,
cs_lagr_moment_p_data_t w_data_func,
void *  w_data_input,
int  nt_start,
double  t_start,
cs_lagr_stat_restart_t  restart_mode 
)

Define a particle statistic.

(DOXYGEN_SHOULD_SKIP_THIS)

If dimension > 1, the val array is interleaved

Parameters
[in]namestatistics base name
[in]location_idid of associated mesh location
[in]stat_typepredefined statistics type, or -1
[in]m_typemoment type
[in]classparticle class id, or 0 for all
[in]dimdimension associated with element data
[in]component_idattribute component id, or < 0 for all
[in]data_funcpointer to function to compute statistics (if stat_type < 0)
[in]data_inputassociated input
[in]w_data_funcpointer to function to compute weight (if NULL, statistic weight assumed)
[in]w_data_inputassociated input for w_data_func
[in]nt_startstarting time step (or -1 to use t_start, 0 to use idstnt)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
Returns
id of new moment in case of success, -1 in case of error.

§ cs_lagr_stat_finalize()

void cs_lagr_stat_finalize ( void  )

Destroy all moments management metadata.

§ cs_lagr_stat_get_age()

cs_real_t cs_lagr_stat_get_age ( void  )

Return global volume statistics age.

Returns
age of volume statistics, or -1 if statistics not active yet

§ cs_lagr_stat_get_moment()

cs_field_t* cs_lagr_stat_get_moment ( int  stat_type,
cs_lagr_stat_moment_t  m_type,
int  class_id,
int  component_id 
)

Return field associated with a given Lagrangian statistic, given a statistics type (i.e. variable), moment order, and given a statistics type (i.e. variable), moment order, statistical class, and component id.

Return field associated with a given Lagrangian statistic, given a statistics type (i.e. variable), moment order, statistical class, and component id.

Parameters
[in]stat_typestatistics type
[in]m_typemoment type (mean or variance)
[in]class_idparticle statistical class
[in]component_idcomponent id, or -1 for all
Returns
pointer to the field associated to the corresponding moment

§ cs_lagr_stat_get_moment_age()

cs_real_t cs_lagr_stat_get_moment_age ( cs_field_t f)

Return statistics age for a given moment.

Parameters
[in]ffield associated with given statistic
Returns
age of give statistic, or -1 if not active yet

§ cs_lagr_stat_get_stat_weight()

cs_field_t* cs_lagr_stat_get_stat_weight ( int  class_id)

Return statistical weight.

Parameters
[in]class_idparticle statistical class
Returns
pointer to the field associated to the corresponding weight

§ cs_lagr_stat_initialize()

void cs_lagr_stat_initialize ( void  )

Lagrangian statistics initialization.

Statistics activated or deactivated by previous calls to cs_lagr_stat_activate, cs_lagr_stat_deactivate, cs_lagr_stat_activate_attr, and cs_lagr_stat_deactivate_attr will be initialized here.

Restart info will be used after to fill in the moments structure

§ cs_lagr_stat_log_iteration()

void cs_lagr_stat_log_iteration ( void  )

Log moment definition information for a given iteration.

§ cs_lagr_stat_map_cell_dt()

void cs_lagr_stat_map_cell_dt ( const cs_real_t dt)

Map time step values array for Lagrangian statistics.

If this function is not called, the field referenced by field pointer CS_F_(dt) will be used instead.

Parameters
[in]dtpointer to time step values array

§ cs_lagr_stat_restart_write()

void cs_lagr_stat_restart_write ( cs_restart_t restart)

Checkpoint moment data.

Parameters
[in]restartassociated restart file pointer

§ cs_lagr_stat_time_moment_define()

int cs_lagr_stat_time_moment_define ( const char *  name,
int  location_id,
int  stat_type,
cs_lagr_stat_moment_t  m_type,
int  class_id,
int  dim,
int  component_id,
cs_lagr_moment_m_data_t data_func,
void *  data_input,
cs_lagr_moment_m_data_t w_data_func,
void *  w_data_input,
int  nt_start,
double  t_start,
cs_lagr_stat_restart_t  restart_mode 
)

Define a time moment associated to particle statistics.

This is similar to general time moments (see cs_time_moment.c), with restart, logging, and unsteady reinitialization behavior similar to other particle statistics.

If dimension > 1, the val array is interleaved

Parameters
[in]namestatistics base name
[in]location_idid of associated mesh location
[in]stat_typepredefined statistics type, or -1
[in]m_typemoment type
[in]class_idparticle class id, or 0 for all
[in]dimdimension associated with element data
[in]component_idattribute component id, or < 0 for all
[in]data_funcpointer to function to compute statistics (if stat_type < 0)
[in]data_inputassociated input
[in]w_data_funcpointer to function to compute weight (if NULL, statistic weight assumed)
[in]w_data_inputassociated input for w_data_func
[in]nt_startstarting time step (or -1 to use t_start, 0 to use idstnt)
[in]t_startstarting time
[in]restart_modebehavior in case of restart (reset, automatic, or strict)
Returns
id of new moment in case of success, -1 in case of error.

§ cs_lagr_stat_type_from_attr_id()

int cs_lagr_stat_type_from_attr_id ( int  attr_id)

Return statistics type associated with a given particle attribute id.

Parameters
[in]attr_idparticle attribute id
Returns
associated particle statistics type id

§ cs_lagr_stat_type_to_attr_id()

int cs_lagr_stat_type_to_attr_id ( int  stat_type)

Return attribute id associated with a given statistics type.

Parameters
[in]stat_typeparticle statistics type
Returns
attribute id, or -1 if not applicable

§ cs_lagr_stat_update()

void cs_lagr_stat_update ( void  )

Update particle statistics for a given time step.

Variable Documentation

§ _lagr_stat_options

cs_lagr_stat_options_t _lagr_stat_options
static
Initial value:
= {.isuist = 0,
.idstnt = 0,
.nstist = 0,
.threshold = 1e-12}

§ _lagr_stats

cs_lagr_moment_t* _lagr_stats = NULL
static

§ _lagr_stats_wa

cs_lagr_moment_wa_t* _lagr_stats_wa = NULL
static

§ _n_lagr_stats

int _n_lagr_stats = 0
static

§ _n_lagr_stats_max

int _n_lagr_stats_max = 0
static

§ _n_lagr_stats_wa

int _n_lagr_stats_wa = 0
static

§ _n_lagr_stats_wa_max

int _n_lagr_stats_wa_max = 0
static

§ _p_dt

const cs_real_t* _p_dt = NULL
static

§ _restart_info

cs_lagr_moment_restart_info_t* _restart_info = NULL
static

§ _restart_info_checked

bool _restart_info_checked = false
static

§ _t_prev_iter

double _t_prev_iter = 0.
static

§ _vol_stat_activate

bool* _vol_stat_activate = NULL
static

§ cs_glob_lagr_stat_options

cs_lagr_stat_options_t* cs_glob_lagr_stat_options = &_lagr_stat_options

§ cs_lagr_moment_type_name

const char* cs_lagr_moment_type_name[]
Initial value:
= {N_("MEAN"),
N_("VARIANCE")}
#define N_(String)
Definition: cs_defs.h:56