My Project
programmer's documentation
|
#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_event.h"
#include "cs_lagr_particle.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_e_data_t(const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
typedef void() | cs_lagr_moment_m_data_t(const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
Functions | |
int | cs_lagr_stat_particle_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-based statistic. More... | |
int | cs_lagr_stat_event_define (const char *name, int location_id, int stat_type, cs_lagr_stat_group_t stat_group, cs_lagr_stat_moment_t m_type, int class_id, int dim, int component_id, cs_lagr_moment_e_data_t *data_func, void *data_input, cs_lagr_moment_e_data_t *w_data_func, void *w_data_input, int nt_start, double t_start, cs_lagr_stat_restart_t restart_mode) |
Define an event-based statistic. More... | |
int | cs_lagr_stat_accumulator_define (const char *name, int location_id, cs_lagr_stat_group_t stat_group, int class_id, cs_lagr_moment_p_data_t *p_data_func, cs_lagr_moment_e_data_t *e_data_func, void *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_mesh_define (const char *name, int location_id, cs_lagr_stat_group_t stat_group, int class_id, int dim, cs_lagr_moment_m_data_t *data_func, void *data_input, int nt_start, double t_start) |
Define mesh-based statistic based on particles or particle events. 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, 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_activate_time_moment (int stat_type, cs_lagr_stat_moment_t moment) |
Activate time moment for some predefined Lagrangian statistics types. 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... | |
int | cs_lagr_stat_type_by_name (const char *name) |
Determine a basic statistic type by its base name. 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... | |
bool | cs_lagr_stat_is_active (cs_lagr_stat_group_t group) |
Indicate if a given statistics type has active statistics. More... | |
void | cs_lagr_stat_restart_read (void) |
Read particle statistics restart info if needed. More... | |
void | cs_lagr_stat_prepare (void) |
Prepare particle statistics for a given time step. More... | |
void | cs_lagr_stat_update (void) |
Update particle statistics for a given time step. More... | |
void | cs_lagr_stat_update_event (cs_lagr_event_set_t *events, cs_lagr_stat_group_t group) |
Update event-based moment accumulators. More... | |
void | cs_lagr_stat_finalize (void) |
Destroy all moments management metadata. More... | |
void | cs_lagr_stat_log_setup (void) |
Log moment definition setup information. 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_t * | cs_lagr_stat_get_moment (int stat_type, cs_lagr_stat_group_t stat_group, 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), group (particles or event), moment order, statistical class, and component id. More... | |
cs_field_t * | cs_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_t * | cs_glob_lagr_stat_options |
typedef void() cs_lagr_moment_e_data_t(const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
typedef void() cs_lagr_moment_m_data_t(const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
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[]) |
enum cs_lagr_stat_group_t |
enum cs_lagr_stat_type_t |
Predefined particle and event statistics
int cs_lagr_stat_accumulator_define | ( | const char * | name, |
int | location_id, | ||
cs_lagr_stat_group_t | stat_group, | ||
int | class_id, | ||
cs_lagr_moment_p_data_t * | p_data_func, | ||
cs_lagr_moment_e_data_t * | e_data_func, | ||
void * | 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.
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_group | statistics group (particle or event) |
[in] | class_id | particle class id, or 0 for all |
[in] | p_data_func | pointer to function to compute particle weight (if NULL, statistic weight assumed) |
[in] | e_data_func | pointer to function to compute event weight (if NULL, statistic weight assumed) |
[in] | data_input | associated input for data_func |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
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.
[in] | stat_type | particle statistics type |
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.
[in] | attr_id | particle attribute id |
void cs_lagr_stat_activate_time_moment | ( | int | stat_type, |
cs_lagr_stat_moment_t | moment | ||
) |
Activate time moment for some predefined Lagrangian statistics types.
By default, statistics such as mass flows are based on a current time step, and time moments are not computed by default. This function allows forcing the associated moment level so that it is computed also.
Note that requesting a higher order moment will automatically include lower order moments, so activating the variance also activates the mean.
[in] | stat_type | particle statistics type |
[in] | moment | associated time moment level |
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.
[in] | stat_type | particle statistics type |
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.
[in] | attr_id | particle attribute id |
int cs_lagr_stat_event_define | ( | const char * | name, |
int | location_id, | ||
int | stat_type, | ||
cs_lagr_stat_group_t | stat_group, | ||
cs_lagr_stat_moment_t | m_type, | ||
int | class_id, | ||
int | dim, | ||
int | component_id, | ||
cs_lagr_moment_e_data_t * | data_func, | ||
void * | data_input, | ||
cs_lagr_moment_e_data_t * | w_data_func, | ||
void * | w_data_input, | ||
int | nt_start, | ||
double | t_start, | ||
cs_lagr_stat_restart_t | restart_mode | ||
) |
Define an event-based statistic.
If dimension > 1, the val array is interleaved
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_type | predefined statistics type, or -1 |
[in] | stat_group | statistics group (event type) |
[in] | m_type | moment type |
[in] | class_id | particle class id, or 0 for all |
[in] | dim | dimension associated with element data |
[in] | component_id | attribute component id, or < 0 for all |
[in] | data_func | pointer to function to compute statistics (if stat_type < 0) |
[in] | data_input | associated input |
[in] | w_data_func | pointer to function to compute weight (if NULL, statistic weight assumed) |
[in] | w_data_input | associated input for w_data_func |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
void cs_lagr_stat_finalize | ( | void | ) |
Destroy all moments management metadata.
cs_real_t cs_lagr_stat_get_age | ( | void | ) |
Return global volume statistics age.
cs_field_t* cs_lagr_stat_get_moment | ( | int | stat_type, |
cs_lagr_stat_group_t | stat_group, | ||
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), group (particles or event), moment order, statistical class, and component id.
[in] | stat_type | statistics type |
[in] | stat_group | statistics group (particle or event) |
[in] | m_type | moment type (mean or variance) |
[in] | class_id | particle statistical class |
[in] | component_id | component id, or -1 for all |
cs_real_t cs_lagr_stat_get_moment_age | ( | cs_field_t * | f | ) |
Return statistics age for a given moment.
[in] | f | field associated with given statistic |
cs_field_t* cs_lagr_stat_get_stat_weight | ( | int | class_id | ) |
Return statistical weight.
[in] | class_id | particle statistical class |
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
bool cs_lagr_stat_is_active | ( | cs_lagr_stat_group_t | group | ) |
Indicate if a given statistics type has active statistics.
[in] | group | event group to update |
void cs_lagr_stat_log_iteration | ( | void | ) |
Log moment definition information for a given iteration.
void cs_lagr_stat_log_setup | ( | void | ) |
Log moment definition setup information.
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.
[in] | dt | pointer to time step values array |
int cs_lagr_stat_mesh_define | ( | const char * | name, |
int | location_id, | ||
cs_lagr_stat_group_t | stat_group, | ||
int | class_id, | ||
int | dim, | ||
cs_lagr_moment_m_data_t * | data_func, | ||
void * | data_input, | ||
int | nt_start, | ||
double | t_start | ||
) |
Define mesh-based statistic based on particles or particle events.
This type of statistic is reinitialized and evaluated during each time step, but may be computed incrementally when based on particle events, so the associated data function must uptate the statistics without reinitializing them at each call.
As this type of statistic does not need to keep state between time steps, it is ignored by the lagragian statistics checkpoint/restart mechanism.
If dimension > 1, the val array is interleaved
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_group | statistics group (particle or event) |
[in] | class_id | particle class id, or 0 for all |
[in] | dim | dimension associated with element data |
[in] | data_func | pointer to function to compute statistics |
[in] | data_input | associated input |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
int cs_lagr_stat_particle_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-based statistic.
If dimension > 1, the val array is interleaved
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_type | predefined statistics type, or -1 |
[in] | stat_group | statistics group (particle or event) |
[in] | m_type | moment type |
[in] | class_id | particle class id, or 0 for all |
[in] | dim | dimension associated with element data |
[in] | component_id | attribute component id, or < 0 for all |
[in] | data_func | pointer to function to compute statistics (if stat_type < 0) |
[in] | data_input | associated input |
[in] | w_data_func | pointer to function to compute weight (if NULL, statistic weight assumed) |
[in] | w_data_input | associated input for w_data_func |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
(DOXYGEN_SHOULD_SKIP_THIS)
If dimension > 1, the val array is interleaved
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_type | predefined statistics type, or -1 |
[in] | m_type | moment type |
[in] | class_id | particle class id, or 0 for all |
[in] | dim | dimension associated with element data |
[in] | component_id | attribute component id, or < 0 for all |
[in] | data_func | pointer to function to compute statistics (if stat_type < 0) |
[in] | data_input | associated input |
[in] | w_data_func | pointer to function to compute weight (if NULL, statistic weight assumed) |
[in] | w_data_input | associated input for w_data_func |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
void cs_lagr_stat_prepare | ( | void | ) |
Prepare particle statistics for a given time step.
void cs_lagr_stat_restart_read | ( | void | ) |
Read particle statistics restart info if needed.
void cs_lagr_stat_restart_write | ( | cs_restart_t * | restart | ) |
Checkpoint moment data.
[in] | restart | associated restart file pointer |
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, | ||
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 aligned with other particle statistics.
Time moments must be based on values available at the end of each time step, so they cannot be based directly on events (though they can be based on fields defined through cs_lagr_stat_mesh_define, as the matching event-based fields will be updated first).
If dimension > 1, the val array is interleaved
[in] | name | statistics base name |
[in] | location_id | id of associated mesh location |
[in] | stat_type | predefined statistics type, or -1 |
[in] | m_type | moment type |
[in] | class_id | particle class id, or 0 for all |
[in] | dim | dimension associated with element data |
[in] | component_id | attribute component id, or < 0 for all |
[in] | data_func | pointer to function to compute statistics (if stat_type < 0) |
[in] | data_input | associated input |
[in] | nt_start | starting time step (or -1 to use t_start, 0 to use idstnt) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
int cs_lagr_stat_type_by_name | ( | const char * | name | ) |
Determine a basic statistic type by its base name.
[in] | name | particle statistics base name (without class id) |
int cs_lagr_stat_type_from_attr_id | ( | int | attr_id | ) |
Return statistics type associated with a given particle attribute id.
[in] | attr_id | particle attribute id |
int cs_lagr_stat_type_to_attr_id | ( | int | stat_type | ) |
Return attribute id associated with a given statistics type.
[in] | stat_type | particle statistics type |
void cs_lagr_stat_update | ( | void | ) |
Update particle statistics for a given time step.
void cs_lagr_stat_update_event | ( | cs_lagr_event_set_t * | events, |
cs_lagr_stat_group_t | group | ||
) |
Update event-based moment accumulators.
Partial updates are allowed, so as to balance memory cost for storing events and repetition of mesh-location-based weight updates.
[in] | events | pointer to event set |
[in] | group | event group to update |
Partial updates are allowed, so as to balance memory cost for storing events and repetition of mesh-location-based weigh updates.
[in] | events | pointer to event set |
[in] | group | event group to update |
cs_lagr_stat_options_t* cs_glob_lagr_stat_options |