My Project
programmer's documentation
|
Temporal moments management. More...
#include "cs_defs.h"
#include <assert.h>
#include <stdarg.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_array_reduce.h"
#include "cs_base.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_log.h"
#include "cs_mesh.h"
#include "cs_mesh_location.h"
#include "cs_parall.h"
#include "cs_restart.h"
#include "cs_restart_default.h"
#include "cs_prototypes.h"
#include "cs_time_step.h"
#include "cs_time_moment.h"
Functions | |
void | cs_time_moment_destroy_all (void) |
Destroy all moments management metadata. More... | |
int | cs_time_moment_define_by_field_ids (const char *name, int n_fields, const int field_id[], const int component_id[], cs_time_moment_type_t type, int nt_start, double t_start, cs_time_moment_restart_t restart_mode, const char *restart_name) |
Define a moment of a product of existing fields components. More... | |
int | cs_time_moment_define_by_func (const char *name, int location_id, int dim, cs_time_moment_data_t *data_func, const void *data_input, cs_time_moment_data_t *w_data_func, void *w_data_input, cs_time_moment_type_t type, int nt_start, double t_start, cs_time_moment_restart_t restart_mode, const char *restart_name) |
Define a moment whose data values will be computed using a specified function. More... | |
int | cs_time_moment_n_moments (void) |
Return the number of defined time moments. More... | |
int | cs_time_moment_n_moments_restart (void) |
Return the number of time moments in the restart file, if any. More... | |
void | cs_time_moment_restart_options_by_id (int restart_id, cs_time_moment_restart_t *restart_mode, const char **restart_name) |
Define a moment restart mode and name by an id. More... | |
const char * | cs_time_moment_restart_name (int restart_id) |
Return name of a given time moments in the restart file, if any (check also cs_time_moment_n_moments_restart). More... | |
cs_field_t * | cs_time_moment_get_field (int moment_id) |
Return pointer to field associated with a given moment. More... | |
int | cs_time_moment_is_active (int moment_id) |
Return 1 if moment is active, 0 if it is not active yet. More... | |
void | cs_time_moment_reset (int moment_id) |
Reset a time moment. More... | |
void | cs_time_moment_map_cell_dt (const cs_real_t *dt) |
Map time step values array for temporal moments. More... | |
void | cs_time_moment_update_all (void) |
Update all moment accumulators. More... | |
void | cs_time_moment_log_setup (void) |
Log moment definition setup information. More... | |
void | cs_time_moment_log_iteration (void) |
Log moment definition information for a given iteration. More... | |
void | cs_time_moment_restart_use_main (int use_main) |
Indicate if restart API should use "main" instead of "auxiliary" file. More... | |
void | cs_time_moment_restart_read (cs_restart_t *restart) |
Read restart moment data. More... | |
void | cs_time_moment_restart_write (cs_restart_t *restart) |
Checkpoint moment data. More... | |
Variables | |
const char * | cs_time_moment_type_name [] |
Temporal moments management.
int cs_time_moment_define_by_field_ids | ( | const char * | name, |
int | n_fields, | ||
const int | field_id[], | ||
const int | component_id[], | ||
cs_time_moment_type_t | type, | ||
int | nt_start, | ||
double | t_start, | ||
cs_time_moment_restart_t | restart_mode, | ||
const char * | restart_name | ||
) |
Define a moment of a product of existing fields components.
Define a moment of a product of existing field components.
Moments will involve the tensor products of their component fields, and only scalar, vector, or rank-2 tensors are handled (for post-processing output reasons), so a moment may not involve more than 2 vectors or 1 tensor, unless single components are specified.
[in] | name | name of associated moment |
[in] | n_fields | number of associated fields |
[in] | field_id | ids of associated fields |
[in] | component_id | ids of matching field components (-1 for all) |
[in] | type | moment type |
[in] | nt_start | starting time step (or -1 to use t_start) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
[in] | restart_name | if not NULL, previous name in case of restart |
int cs_time_moment_define_by_func | ( | const char * | name, |
int | location_id, | ||
int | dim, | ||
cs_time_moment_data_t * | data_func, | ||
const void * | data_input, | ||
cs_time_moment_data_t * | w_data_func, | ||
void * | w_data_input, | ||
cs_time_moment_type_t | type, | ||
int | nt_start, | ||
double | t_start, | ||
cs_time_moment_restart_t | restart_mode, | ||
const char * | restart_name | ||
) |
Define a moment whose data values will be computed using a specified function.
[in] | name | name of associated moment |
[in] | location_id | id of associated mesh location |
[in] | dim | dimension associated with element data |
[in] | data_func | function used to define data values |
[in] | data_input | pointer to optional (untyped) value or structure to be used by data_func |
[in] | w_data_func | function used to define weight values |
[in] | w_data_input | pointer to optional (untyped) value or structure to be used by w_data_func |
[in] | type | moment type |
[in] | nt_start | starting time step (or -1 to use t_start) |
[in] | t_start | starting time |
[in] | restart_mode | behavior in case of restart (reset, automatic, or strict) |
[in] | restart_name | if not NULL, previous name in case of restart |
void cs_time_moment_destroy_all | ( | void | ) |
Destroy all moments management metadata.
cs_field_t* cs_time_moment_get_field | ( | int | moment_id | ) |
Return pointer to field associated with a given moment.
For moments defined automatically to assist computation of higher order moments, which do not have an associated field, NULL is returned.
[in] | moment_id | id of associated moment |
int cs_time_moment_is_active | ( | int | moment_id | ) |
Return 1 if moment is active, 0 if it is not active yet.
[in] | moment_id | id of associated moment |
void cs_time_moment_log_iteration | ( | void | ) |
Log moment definition information for a given iteration.
void cs_time_moment_log_setup | ( | void | ) |
Log moment definition setup information.
void cs_time_moment_map_cell_dt | ( | const cs_real_t * | dt | ) |
Map time step values array for temporal moments.
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_time_moment_n_moments | ( | void | ) |
Return the number of defined time moments.
int cs_time_moment_n_moments_restart | ( | void | ) |
Return the number of time moments in the restart file, if any.
void cs_time_moment_reset | ( | int | moment_id | ) |
Reset a time moment.
[in] | moment_id | id of associated moment |
const char* cs_time_moment_restart_name | ( | int | restart_id | ) |
Return name of a given time moments in the restart file, if any (check also cs_time_moment_n_moments_restart).
[in] | restart_id | id of time moment in restart data |
void cs_time_moment_restart_options_by_id | ( | int | restart_id, |
cs_time_moment_restart_t * | restart_mode, | ||
const char ** | restart_name | ||
) |
Define a moment restart mode and name by an id.
This is a utility function, to allow simplification of automatic setups. It must be called just before defining a moment to work properly if restart_id < -1 (automatic mode).
[in] | restart_id | -2: automatic, -1: reset, >= 0: id of matching moment in restart data |
[out] | restart_mode | matching restart mode |
[out] | restart_name | matching restart name |
void cs_time_moment_restart_read | ( | cs_restart_t * | restart | ) |
Read restart moment data.
[in] | restart | associated restart file pointer |
void cs_time_moment_restart_use_main | ( | int | use_main | ) |
Indicate if restart API should use "main" instead of "auxiliary" file.
[in] | use_main | use "main" restart if nonzero, "auxiliary" otherwise |
void cs_time_moment_restart_write | ( | cs_restart_t * | restart | ) |
Checkpoint moment data.
[in] | restart | associated restart file pointer |
void cs_time_moment_update_all | ( | void | ) |
Update all moment accumulators.