Stopping criterion based on L2 time residuals
This is an example of cs_user_extra_operations allowing to properly stop a computation when the L2 time residuals (displayed in the run_solver.log file) of all solved variables have decreased below a value of 1e-3.
L2 time residuals of a variable at a given time step are a relative measure of the unsteady term of its transport equation:
bool cved = true ;
for (int f_id = 0; f_id < n_fields; f_id++) {
}
}
if (cved) {
}
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition bft_printf.c:140
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
int cs_field_n_fields(void)
Return the number of defined fields.
Definition cs_field.c:1527
const void * cs_field_get_key_struct(const cs_field_t *f, const int key_id, void *s)
Return a structure for a given key associated with a field.
Definition cs_field.c:3386
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition cs_field.c:2307
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition cs_field.c:2490
cs_time_step_t * cs_get_glob_time_step(void)
Provide acces to cs_glob_time_step.
Definition cs_time_step.c:401
#define CS_FIELD_VARIABLE
Definition cs_field.h:63
Field descriptor.
Definition cs_field.h:124
int type
Definition cs_field.h:129
Definition cs_parameters.h:100
double l2residual
Definition cs_parameters.h:105
time step descriptor
Definition cs_time_step.h:51
int nt_cur
Definition cs_time_step.h:61
int nt_max
Definition cs_time_step.h:62