My Project
programmer's documentation
|
#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_time_step.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"
Functions | |
static void | _class_name (const char *name, int class_id, char class_name[64]) |
Define mesh-based statistic based on particles or particle events. More... | |
static void | _group_name (cs_lagr_stat_group_t group, char group_name[64]) |
Build group name for logging. More... | |
static void | _log_setup_start_time (int nt_start, double t_start, int allow_reset) |
Log moment definition start time for moment or accumulator. More... | |
static const cs_real_t * | _dt_val (void) |
Return pointer to time step values. More... | |
static void | _unit_value_m_elts (const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
static void | _vol_fraction (const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
static void | _bdy_mass_flux_update (const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
static void | _bdy_mass_flux (const void *input, const cs_lagr_event_set_t *events, int location_id, int class_id, cs_real_t vals[]) |
static void | _boundary_impact_angle (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
static void | _boundary_impact_velocity (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
static void | _boundary_resuspension_weight (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
static void | _boundary_fouling_weight (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
static void | _boundary_fouling_diameter (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], cs_real_t vals[]) |
static void | _boundary_fouling_coke_fraction (const void *input, const cs_lagr_event_set_t *events, cs_lnum_t id_range[2], 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 int | _n_e_stat_types (void) |
Return number of possible statistics types including events. More... | |
static void | _statistical_weight_name (cs_lagr_stat_group_t stat_group, int class, char name[64]) |
Create statistical weight. More... | |
static void | _attr_moment_name (int attr_id, int component_id, int class_id, cs_lagr_stat_moment_t moment_type, char name[64]) |
Create moment name for a moment associated with a particle or event attribute. More... | |
static void | _moment_name (const char *base_name, int component_id, int class_id, cs_lagr_stat_moment_t moment_type, char name[64]) |
Create moment 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 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 | _ensure_init_moment (cs_lagr_moment_t *mt) |
Initialize moment value if required. More... | |
static void | _cs_lagr_stat_update_mesh_stats (cs_time_step_t *ts) |
Update particle-based mesh statistics. More... | |
static void | _prepare_mesh_stat (cs_lagr_mesh_stat_t *ms) |
Initialize statistics value if required. 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, int moment_type, int stat_type, cs_lagr_stat_group_t stat_group, int class_id, int *nt_start, double *t_start, cs_lagr_stat_restart_t restart_mode) |
Check if a moment can use previous data. More... | |
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 void | _init_events_attribute (void) |
static int | _find_or_add_wa (cs_lagr_moment_p_data_t *p_data_func, cs_lagr_moment_e_data_t *e_data_func, cs_lagr_moment_m_data_t *m_data_func, const void *data_input, cs_lagr_stat_group_t stat_group, 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, bool have_previous) |
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_e_data_t *e_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 int | _find_or_add_mesh_stat (int location_id, int class_id, cs_lagr_stat_group_t stat_group, int dim, cs_lagr_moment_m_data_t *data_func, const void *data_input, int nt_start, double t_start) |
Add or find mesh statistics structure. 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 | _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_stat_reset_unsteady (cs_lagr_stat_group_t stat_group, const cs_time_step_t *ts) |
Reset unsteady stats (all accumulators and particle-based moments). 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 data function moment. More... | |
static int | _location_attr (int location_id) |
Return location attribute to use for an event-based moment or accumulator. More... | |
static void | _cs_lagr_stat_update_all (void) |
Update all particle-based moment and time moment accumulators. More... | |
static void | _cs_lagr_stat_set_active_event_time (cs_lagr_stat_group_t group, int nt_cur) |
Modify current time for active event-based moment accumulators. More... | |
static void | _free_all_moments (void) |
static void | _free_all_wa (void) |
Free all moment weight and time accumulators. More... | |
static void | _free_all_mesh_stats (void) |
static int | _stat_moment_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_p_data_t *p_data_func, cs_lagr_moment_e_data_t *e_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_e_data_t *w_e_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... | |
static void | _event_stat_initialize (void) |
Lagrangian statistics initialization. More... | |
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_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_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_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... | |
|
static |
|
static |
Create moment name for a moment associated with a particle or event attribute.
[in] | attr_id | particle statistics type |
[in] | component_id | component id, or -1 |
[in] | class_id | statistical class id, or 0 |
[in] | moment_type | moment type |
[out] | name | resulting name |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Check statistics type is in possible range.
[in] | type | moment type |
|
static |
Check if a moment can use previous data.
Depending on the restart mode, restart time and time step may also be updated.
[in] | name | moment name |
[in] | ts | time step status |
[in] | ri | restart info |
[in] | location_id | id of associated mesh location |
[in] | wa_location_id | associated weight accumulator mesh location id |
[in] | dim | dimension associated with moment |
[in] | moment_type | moment type |
[in] | stat_type | predefined statistics type, or -1 |
[in] | stat_group | statistics group (particle or event) |
[in] | class_id | particle class id, or 0 for all |
[in] | nt_start | starting time step |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
|
static |
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] | class_id | particle class id, or 0 for all |
[out] | class_name | base name with class id appended if > 0 |
|
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 |
|
static |
Create and associate a field to a moment.
[in] | name | field name |
[in] | location_id | mesh location id |
[in] | dim | field dimension |
[in] | have_previous | do we save the previous time values |
|
static |
Read restart moment data.
|
static |
Reset unsteady stats (all accumulators and particle-based moments).
[in] | stat_group | statistics group (particle or event) |
[in] | ts | time step |
|
static |
Modify current time for active event-based moment accumulators.
This allows resetting the previous time after partial updates, and setting the current time at the end of a time loop.
[in] | group | event group to update |
[in] | nt_cur | current time step to set |
|
static |
Update all particle-based moment and time moment accumulators.
|
static |
Update a given mesh based data function moment.
[in,out] | mt | pointer to associated moment |
[in] | mwa | pointer to associated weight accumulator |
[in] | w | weight values for current time step |
[in] | nt_cur |
|
static |
Update particle-based mesh statistics.
[in] | ts | time step structure |
|
static |
Return pointer to time step values.
|
static |
Initialize moment value if required.
[in,out] | mt | moment |
|
static |
Initialize weight accumulator if required and reset to 0.
[in,out] | mwa | moment weight accumulator |
|
static |
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
|
static |
Add or find mesh statistics structure.
[in] | location_id | id of associated mesh location |
[in] | class_id | statistical class |
[in] | stat_group | statistics group (particle or event) |
[in] | dim | dimension associated with element data |
[in] | data_func | mesh-based function used to define data values |
[in] | data_input | pointer to optional value or structure to be used by data_func |
[in] | m_type | moment type, mean or variance |
[in] | wa_id | weight accumulator id |
[in] | prev_id | restart moment id |
|
static |
Add or find moment structure. .
[in] | location_id | id of associated mesh location |
[in] | component_id | attribute component id, or < 0 for all |
[in] | class_id | statistical class |
[in] | stat_type | statistics type id, or -1 |
[in] | dim | dimension associated with element data |
[in] | p_data_func | particle-based function used to define data values, or NULL |
[in] | e_data_func | event-based function used to define data values, or NULL |
[in] | m_data_func | mesh-based function used to define data values, or NULL |
[in] | data_input | pointer to optional value or structure to be used by data_func |
[in] | m_type | moment type, mean or variance |
[in] | wa_id | weight accumulator id |
[in] | prev_id | restart moment 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).
[in] | m_type | associated moment type |
[in] | p_data_func | particle-based function used to define data values, or NULL |
[in] | e_data_func | event-based function used to define data values, or NULL |
[in] | m_data_func | mesh-based function used to define data values, or NULL |
[in] | data_input | pointer to optional (untyped) value or structure |
[in] | stat_group | statistics group (particle or event) |
[in] | class_id | statistical class number |
[in] | location_id | associated mesh location id |
[in] | nt_start | starting time step |
[in] | t_start | starting time |
[in] | prev_wa_id | previous weight accumulator id, or -1 |
|
static |
|
static |
|
static |
Free all moment weight and time accumulators.
|
static |
Build group name for logging.
[in] | group | event group to update |
[out] | name | group log name |
|
static |
|
static |
|
static |
Return location attribute to use for an event-based moment or accumulator.
[in] | location_id | id of moment or accumulator mesh location |
|
static |
Log moment definition start time for moment or accumulator.
|
static |
Create moment name.
[in] | base_name | moment base name |
[in] | component_id | component id, or -1 |
[in] | class_id | statistical class id, or 0 |
[in] | moment_type | moment type |
[out] | name | resulting name |
|
static |
Return pointer to weight accumulator values.
[in] | mwa | pointer to weight accumulator structure |
|
static |
Return pointer to weight accumulator values.
[in] | mwa | pointer to weight accumulator structure |
|
inlinestatic |
Return number of possible statistics types including events.
|
inlinestatic |
Return number of possible statistics types.
|
static |
Return number of elements associated with a weight accumulator.
|
static |
Initialize statistics value if required.
[in,out] | ms | mesh-based statistics |
|
static |
|
static |
|
static |
|
static |
Define a particle 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] | p_data_func | pointer to particle function to compute statistics (if stat_type < 0) |
[in] | e_data_func | pointer to eventfunction to compute statistics (if stat_type < 0) |
[in] | m_data_func | pointer to mesh location function to compute statistics (if stat_type < 0) |
[in] | data_input | associated input |
[in] | w_p_data_func | pointer to particle function to compute weight (if NULL, statistic weight assumed) |
[in] | w_e_data_func | pointer to event function to compute weight (if NULL, statistic weight assumed) |
[in] | w_m_data_func | pointer to mesh location function to compute weight (if stat_type < 0) |
[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) |
|
static |
Create statistical weight.
[in] | stat_group | statistics group (particle or event) |
[in] | class | statistical class id, or 0 |
[out] | name | resulting name |
|
static |
Update weight accumulator for a mesh-based weight array.
[in,out] | mwa | moment weight accumulator |
[in] | w | pointer to current weight values |
|
static |
|
static |
Vector-vector multiplication, where the multiplying vector is defined on cells, and the multiplied vector defined on a given mesh location.
[in] | location_id_y | location id for y |
[in] | x | multiplier array |
[in,out] | y | multiplied array |
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.
(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 weigh updates.
[in] | events | pointer to event set |
[in] | group | event group to update |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
cs_lagr_stat_options_t* cs_glob_lagr_stat_options = &_lagr_stat_options |