My Project
programmer's documentation
Macros | Functions
cs_balance_by_zone.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "fvm_writer.h"
#include "cs_base.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_field_operator.h"
#include "cs_mesh.h"
#include "cs_mesh_quantities.h"
#include "cs_halo.h"
#include "cs_halo_perio.h"
#include "cs_log.h"
#include "cs_parall.h"
#include "cs_parameters.h"
#include "cs_prototypes.h"
#include "cs_time_step.h"
#include "cs_turbomachinery.h"
#include "cs_selector.h"
#include "cs_post.h"
#include "cs_face_viscosity.h"
#include "cs_gradient_perio.h"
#include "cs_physical_constants.h"
#include "cs_thermal_model.h"
#include "cs_convection_diffusion.h"
#include "cs_boundary_conditions.h"
#include "cs_balance_by_zone.h"
Include dependency graph for cs_balance_by_zone.c:

Macros

#define _CS_MODULE2_2(vect)   0.5*(vect[0] * vect[0] + vect[1] * vect[1] + vect[2] * vect[2])
 
#define _CS_DOT_PRODUCT(vect1, vect2)   (vect1[0] * vect2[0] + vect1[1] * vect2[1] + vect1[2] * vect2[2])
 

Functions

void cs_balance_by_zone_compute (const char *scalar_name, cs_lnum_t n_cells_sel, const cs_lnum_t cell_sel_ids[], cs_real_t balance[CS_BALANCE_N_TERMS])
 Compute the different terms of the balance of a given scalar, on a volume zone defined by selected cell ids/. More...
 
void cs_balance_by_zone (const char *selection_crit, const char *scalar_name)
 Compute and log the different terms of the balance of a given scalar, on a volumic zone defined by selection criteria. The different contributions to the balance are printed in the run_solver.log. More...
 
void cs_pressure_drop_by_zone_compute (cs_lnum_t n_cells_sel, const cs_lnum_t cell_sel_ids[], cs_real_t balance[CS_BALANCE_P_N_TERMS])
 Computes one term of the head loss balance (pressure drop) on a on a volume zone defined by selected cell ids/. More...
 
void cs_pressure_drop_by_zone (const char *selection_crit)
 Computes one term of the head loss balance (pressure drop) on a volumic zone defined by the criterion also given as argument. The different contributions are printed in the run_solver.log. More...
 
void cs_surface_balance (const char *selection_crit, const char *scalar_name, const cs_real_t normal[3])
 Compute the surface balance of a given scalar. More...
 
void cs_flux_through_surface (const char *scalar_name, const cs_real_t normal[3], cs_lnum_t n_b_faces_sel, cs_lnum_t n_i_faces_sel, const cs_lnum_t b_face_sel_ids[], const cs_lnum_t i_face_sel_ids[], cs_real_t *balance, cs_real_t *flux_b_faces, cs_real_t *flux_i_faces)
 Get the face by face surface flux of a given scalar, through a surface area defined by the given face ids. More...
 

Macro Definition Documentation

◆ _CS_DOT_PRODUCT

#define _CS_DOT_PRODUCT (   vect1,
  vect2 
)    (vect1[0] * vect2[0] + vect1[1] * vect2[1] + vect1[2] * vect2[2])

◆ _CS_MODULE2_2

#define _CS_MODULE2_2 (   vect)    0.5*(vect[0] * vect[0] + vect[1] * vect[1] + vect[2] * vect[2])

Function Documentation

◆ cs_balance_by_zone()

void cs_balance_by_zone ( const char *  selection_crit,
const char *  scalar_name 
)

Compute and log the different terms of the balance of a given scalar, on a volumic zone defined by selection criteria. The different contributions to the balance are printed in the run_solver.log.

This function computes the balance relative to a given scalar on a selected zone of the mesh. We assume that we want to compute balances (convective and diffusive) at the boundaries of the calculation domain represented below (with different boundary types).

The scalar and the zone are selected at the top of the routine by the user. In the case of the temperature, the energy balance in Joules will be computed by multiplying by the specific heat.

Parameters
[in]selection_critzone selection criterion
[in]scalar_namescalar name

◆ cs_balance_by_zone_compute()

void cs_balance_by_zone_compute ( const char *  scalar_name,
cs_lnum_t  n_cells_sel,
const cs_lnum_t  cell_sel_ids[],
cs_real_t  balance[CS_BALANCE_N_TERMS] 
)

Compute the different terms of the balance of a given scalar, on a volume zone defined by selected cell ids/.

This function computes the balance relative to a given scalar on a selected zone of the mesh. We assume that we want to compute balances (convective and diffusive) at the boundaries of the calculation domain represented below (with different boundary types).

In the case of the temperature, the energy balance in Joules will be computed by multiplying by the specific heat.

Parameters
[in]scalar_namescalar name
[in]n_cells_selnumber of selected cells
[in]cell_sel_idsids of selected cells
[out]balancearray of computed balance terms (see cs_balance_term_t)

◆ cs_flux_through_surface()

void cs_flux_through_surface ( const char *  scalar_name,
const cs_real_t  normal[3],
cs_lnum_t  n_b_faces_sel,
cs_lnum_t  n_i_faces_sel,
const cs_lnum_t  b_face_sel_ids[],
const cs_lnum_t  i_face_sel_ids[],
cs_real_t balance,
cs_real_t flux_b_faces,
cs_real_t flux_i_faces 
)

Get the face by face surface flux of a given scalar, through a surface area defined by the given face ids.

For interior faces, the flux is counted negatively relative to the given normal (as neighboring interior faces may have differently-aligned normals).

For boundary faces, the flux is counted negatively in the outwards-facing direction.

Parameters
[in]scalar_namescalar name
[in]normaloutwards normal direction
[in]n_b_faces_selnumber of selected boundary faces
[in]n_i_faces_selnumber of selected internal faces
[in]b_face_sel_idsids of selected boundary faces
[in]i_face_sel_idsids of selected internal faces
[out]balanceoptional array of computed balance terms (see cs_balance_term_t), of size CS_BALANCE_N_TERMS, or NULL
[out]flux_b_facesoptional surface flux through selected boundary faces, or NULL
[out]flux_i_facesoptional surface flux through selected interior faces, or NULL

◆ cs_pressure_drop_by_zone()

void cs_pressure_drop_by_zone ( const char *  selection_crit)

Computes one term of the head loss balance (pressure drop) on a volumic zone defined by the criterion also given as argument. The different contributions are printed in the run_solver.log.

Parameters
[in]selection_critzone selection criterion

◆ cs_pressure_drop_by_zone_compute()

void cs_pressure_drop_by_zone_compute ( cs_lnum_t  n_cells_sel,
const cs_lnum_t  cell_sel_ids[],
cs_real_t  balance[CS_BALANCE_P_N_TERMS] 
)

Computes one term of the head loss balance (pressure drop) on a on a volume zone defined by selected cell ids/.

Parameters
[in]n_cells_selnumber of selected cells
[in]cell_sel_idsids of selected cells
[out]balancearray of computed balance terms (see cs_balance_p_term_t)

◆ cs_surface_balance()

void cs_surface_balance ( const char *  selection_crit,
const char *  scalar_name,
const cs_real_t  normal[3] 
)

Compute the surface balance of a given scalar.

For interior faces, the flux is counted negatively relative to the given normal (as neighboring interior faces may have differently-aligned normals).

For boundary faces, the flux is counted negatively in the outwards-facing direction.

Parameters
[in]selection_critzone selection criterion
[in]scalar_namescalar name
[in]normaloutwards normal direction