Local definitions and initialization
Mesh quantities
It may be useful to access some mesh adjacencies and quantities, in which case local pointers allow for more readable code:
const cs_real_t *i_f_face_surf = mq->i_face_surf;
const cs_real_t *i_face_surf = mq_g->i_face_surf;
Associated properties
Accessing cell porosity property values is required so values may be set:
Example: define porosity by geometric zones
Individual cell porosity values can be assigned to each cell, so they may be based on groups, geometric criteria, or any other time-independent functions:
for (
cs_lnum_t cell_id = 0; cell_id < m->n_cells; cell_id++) {
if (x < 20.)
cpro_porosi[cell_id] = 1.;
else
cpro_porosi[cell_id] = 0.5;
}
halo_type);
When using the integral porosity model (cs_glob_porous_model == 3), the matching face equivalent surfaces can also be assigned in a corresponding manner, for interior faces:
for (
cs_lnum_t face_id = 0; face_id < m->n_i_faces; face_id++) {
if (x > 19.9999)
face_porosity = 0.5;
for (int i = 0; i < 3; i++)
i_f_face_normal[face_id][i] = face_porosity * i_face_normal[face_id][i];
}
and for boundary faces:
for (
cs_lnum_t face_id = 0; face_id < m->n_b_faces; face_id++) {
if (x > 19.9999)
face_porosity = 0.5;
for (int i = 0; i < 3; i++)
b_f_face_normal[face_id][i] = face_porosity * b_face_normal[face_id][i];
}
When not defined in this way, face porosities will match the lowest adjacent cell porosity.