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:
#define restrict
Definition: cs_defs.h:139
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
cs_lnum_t cs_lnum_2_t[2]
vector of 2 local mesh-entity ids
Definition: cs_defs.h:325
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:332
Definition: cs_mesh_quantities.h:92
cs_real_t * b_face_cog
Definition: cs_mesh_quantities.h:111
cs_real_t * i_face_surf
Definition: cs_mesh_quantities.h:122
cs_real_t * i_f_face_surf
Definition: cs_mesh_quantities.h:125
cs_real_t * i_face_cog
Definition: cs_mesh_quantities.h:110
cs_real_t * b_face_normal
Definition: cs_mesh_quantities.h:102
cs_real_t * cell_cen
Definition: cs_mesh_quantities.h:94
cs_real_t * i_f_face_normal
Definition: cs_mesh_quantities.h:104
cs_real_t * b_f_face_normal
Definition: cs_mesh_quantities.h:106
cs_real_t * i_face_normal
Definition: cs_mesh_quantities.h:100
cs_lnum_2_t * i_face_cells
Definition: cs_mesh.h:111
Associated properties
Accessing cell porosity property values is required so values may be set:
cs_field_t * cs_field_by_name(const char *name)
Return a pointer to a field based on its name.
Definition: cs_field.c:2340
cs_real_t * val
Definition: cs_field.h:151
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:
if (x < 20.)
cpro_porosi[cell_id] = 1.;
else
cpro_porosi[cell_id] = 0.5;
}
halo_type);
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
void cs_field_synchronize(cs_field_t *f, cs_halo_type_t halo_type)
Synchronize current parallel and periodic field values.
Definition: cs_field_operator.c:1206
cs_halo_type_t
Definition: cs_halo.h:56
@ CS_HALO_STANDARD
Definition: cs_halo.h:58
cs_lnum_t n_cells
Definition: cs_mesh.h:97
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:
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];
}
static cs_real_t cs_math_3_norm(const cs_real_t v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:424
cs_lnum_t n_i_faces
Definition: cs_mesh.h:98
and for boundary faces:
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];
}
cs_real_t * b_f_face_surf
Definition: cs_mesh_quantities.h:126
cs_lnum_t n_b_faces
Definition: cs_mesh.h:99
When not defined in this way, face porosities will match the lowest adjacent cell porosity.