9.0
general documentation
Loading...
Searching...
No Matches
Postprocessing of results obtained with CDO schemes for a scalar transport equation.

Postprocessing of results obtained with CDO schemes for a scalar transport equation.

This is an example of cs_user_extra_operations allowing to add operations on results produced by CDO schemes. It allows to define advanced postprocessing.

const cs_cdo_connect_t *connect = domain->connect;
const cs_cdo_quantities_t *cdoq = domain->cdo_quantities;
const cs_time_step_t *time_step = domain->time_step;
const char *eqname = cs_equation_get_name(eq);
if (eq == nullptr)
bft_error(__FILE__, __LINE__, 0,
" Invalid equation name. Stop extra operations.");
/* Open a file */
char *filename = nullptr;
int len = strlen("Resume-.log")+strlen(eqname)+1;
if (eqp->flag & CS_EQUATION_UNSTEADY) {
if (time_step->nt_cur == 0)
return;
if (cs_log_default_is_active() == false)
return;
len += 9;
CS_MALLOC(filename, len, char);
sprintf(filename, "Resume-%s-t%.f.log", eqname, time_step->t_cur);
}
else {
if (time_step->nt_cur > 0)
return;
CS_MALLOC(filename, len, char);
sprintf(filename, "Resume-%s.log", eqname);
}
resume = fopen(filename, "w");
bft_printf(" Extra operations\n");
/* Extra-operations depend on the numerical scheme */
switch (space_scheme) {
_cdovb_post(connect, cdoq, time_step, eq, true);
break;
default:
bft_error(__FILE__, __LINE__, 0,
_("Invalid space scheme. Stop post-processing.\n"));
}
bft_printf("\n");
bft_printf(" >> Equation %s (done)\n", eqname);
printf("\n >> Extra operation for equation: %s\n", eqname);
/* Free */
CS_FREE(filename);
fclose(resume);