programmer's documentation
Data Structures | Typedefs | Enumerations | Functions | Variables
cs_lagr_stat.h File Reference
#include "cs_defs.h"
#include "assert.h"
#include "cs_base.h"
#include "cs_field.h"
#include "cs_restart.h"
#include "cs_lagr.h"
#include "cs_lagr_particle.h"
Include dependency graph for cs_lagr_stat.h:

Go to the source code of this file.

Data Structures

struct  cs_lagr_stat_options_t
 

Typedefs

typedef void() cs_lagr_moment_p_data_t(const void *input, const void *particle, const cs_lagr_attribute_map_t *p_am, cs_real_t vals[])
 
typedef void() cs_lagr_moment_m_data_t(const void *input, int location_id, int class_id, cs_real_t vals[])
 

Enumerations

enum  cs_lagr_stat_moment_t { CS_LAGR_MOMENT_MEAN, CS_LAGR_MOMENT_VARIANCE }
 
enum  cs_lagr_stat_restart_t { CS_LAGR_MOMENT_RESTART_RESET, CS_LAGR_MOMENT_RESTART_AUTO, CS_LAGR_MOMENT_RESTART_EXACT }
 
enum  cs_lagr_stat_type_t { CS_LAGR_STAT_CUMULATIVE_WEIGHT, CS_LAGR_STAT_VOLUME_FRACTION, CS_LAGR_STAT_PARTICLE_ATTR }
 

Functions

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, 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

cs_lagr_stat_options_tcs_glob_lagr_stat_options
 

Typedef Documentation

◆ cs_lagr_moment_m_data_t

typedef void() cs_lagr_moment_m_data_t(const void *input, int location_id, int class_id, cs_real_t vals[])

◆ cs_lagr_moment_p_data_t

typedef void() cs_lagr_moment_p_data_t(const void *input, const void *particle, const cs_lagr_attribute_map_t *p_am, cs_real_t vals[])

Enumeration Type Documentation

◆ cs_lagr_stat_moment_t

Particle statistics moment type

Enumerator
CS_LAGR_MOMENT_MEAN 
CS_LAGR_MOMENT_VARIANCE 

◆ cs_lagr_stat_restart_t

Moment restart behavior

Enumerator
CS_LAGR_MOMENT_RESTART_RESET 
CS_LAGR_MOMENT_RESTART_AUTO 
CS_LAGR_MOMENT_RESTART_EXACT 

◆ cs_lagr_stat_type_t

Prefedined particle statistics, not based on particle attributes

Enumerator
CS_LAGR_STAT_CUMULATIVE_WEIGHT 

cumulative particle statistical weight (active if any particle attribute statistics are active, may be activated separately)

CS_LAGR_STAT_VOLUME_FRACTION 

particle volume fraction

CS_LAGR_STAT_PARTICLE_ATTR 

particle attribute; add attribute id for given attribute

Function Documentation

◆ 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_typeparticle 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.

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.

(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, 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

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

◆ cs_glob_lagr_stat_options

cs_lagr_stat_options_t* cs_glob_lagr_stat_options