I need to do some gradient caluculations in cs_user_postprocess.
Is it okay to fill the value array from which I calculate the gradient up to n_cells? Or do I have to take care on the ghost cells and should fill the array with n_cells_with_ghosts values?
A skeleton of my routine:
Code: Select all
cs_field_t *u = cs_field_by_name("velocity");
cs_real_t *values;
cs_real_3_t *grad;
BFT_MALLOC(values, cs_glob_mesh->n_cells_with_ghosts, cs_real_t);
BFT_MALLOC(grad, cs_glob_mesh->n_cells_with_ghosts, cs_real_3_t);
cs_lnum_t cellid;
for (cellid=0; cellid < n_cells; cellid++) {
values[cellid] = u->val[3*cellid+0];
}
cs_gradient_scalar("user",
CS_GRADIENT_ITER, /* gradient type */
cs_glob_mesh->halo_type, /* halo type **/
1, /* inc */
true, /* recompute cocg */
100, /* sweeps */
0, /* tr_dim */
0, /* hydrostatic pressure */
0, /* w_stride */
1, /* verbosity */
-1, /* clip mode */
1.0e-8, /* epsilon */
0.0, /* extrap */
1.5, /* clip coeff */
NULL, /* external force */
NULL, /* bc_coeff_a */
NULL, /* bc_coeff_b */
values, /* values */
NULL, /* weight coeff */
NULL, /* cpl */
grad); /* gradient */
Kind regards, Ralf