Boundary forces
This is an example of cs_user_extra_operations which computes boundary forces
Example 1: compute total forces on a boundary zone (subset of boundary faces).
{
if (b_forces != nullptr) {
const cs_real_t *b_face_surf = domain->mesh_quantities->b_face_surf;
const auto bpro_forces = b_forces->
get_val_v();
total_b_forces[i] += bpro_forces(face_id, i) * b_face_surf[face_id];
}
}
}
Field descriptor.
Definition: cs_field.h:275
cs_span_2d< cs_real_t > get_val_v(const int time_id=0) const
Return a 2D span view of field values. If the field is not a vector a fatal error is provoked.
Definition: cs_field.cpp:5103
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.cpp:708
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
#define CS_REAL_TYPE
Definition: cs_defs.h:476
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:349
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
cs_field_t * cs_field_try(int id)
Return a pointer to a field based on its id. If no field of the given name is defined,...
Definition: cs_field.cpp:4371
static void cs_parall_sum(int n, cs_datatype_t datatype, void *val)
Sum values of a given datatype on all default communicator processes.
Definition: cs_parall.h:139
const cs_lnum_t * elt_ids
Definition: cs_zone.h:61
cs_lnum_t n_elts
Definition: cs_zone.h:60
Example 2: compute pressure forces on a boundary zone (subset of boundary faces).
{
const cs_real_t *b_face_surf = domain->mesh_quantities->b_face_surf;
= domain->mesh_quantities->b_face_u_normal;
total_b_p_forces[i] += p_b_val[e_id]
* b_face_u_normal[face_id][i]
* b_face_surf[face_id];
}
}
Define a templated array class (owner of data)
Definition: cs_array.h:1118
cs_nreal_t cs_nreal_3_t[3]
Definition: cs_defs.h:375
void cs_post_b_pressure(cs_lnum_t n_b_faces, const cs_lnum_t b_face_ids[], cs_real_t pres[])
Compute pressure on a specific boundary region.
Definition: cs_post_util.cpp:578