8.3
general documentation
cs_post_util.cpp File Reference
#include "cs_defs.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include "bft_mem.h"
#include "bft_printf.h"
#include "cs_array_reduce.h"
#include "cs_balance_by_zone.h"
#include "cs_base.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_field_operator.h"
#include "cs_geom.h"
#include "cs_math.h"
#include "cs_mesh.h"
#include "cs_mesh_intersect.h"
#include "cs_mesh_location.h"
#include "cs_mesh_quantities.h"
#include "cs_parall.h"
#include "cs_physical_model.h"
#include "cs_physical_constants.h"
#include "cs_prototypes.h"
#include "cs_selector.h"
#include "cs_turbomachinery.h"
#include "cs_turbulence_model.h"
#include "cs_velocity_pressure.h"
#include "cs_post_util.h"
+ Include dependency graph for cs_post_util.cpp:

Functions

void cs_cell_segment_intersect_select (void *input, cs_lnum_t *n_cells, cs_lnum_t **cell_ids)
 Select cells cut by a given segment. More...
 
void cs_cell_polyline_intersect_select (void *input, cs_lnum_t n_points, cs_lnum_t *n_cells, cs_lnum_t **cell_ids, cs_real_t **seg_c_len, cs_real_3_t **seg_c_cen)
 Select cells cut by a line composed of segments. More...
 
void cs_cell_segment_intersect_probes_define (void *input, cs_lnum_t *n_elts, cs_real_3_t **coords, cs_real_t **s)
 Define probes based on the centers of cells intersected by a given segment. More...
 
void cs_b_face_criterion_probes_define (void *input, cs_lnum_t *n_elts, cs_real_3_t **coords, cs_real_t **s)
 Define a profile based on centers of faces defined by a given criterion. More...
 
cs_real_t cs_post_turbomachinery_head (const char *criteria_in, cs_mesh_location_type_t location_in, const char *criteria_out, cs_mesh_location_type_t location_out)
 Compute the head of a turbomachinery (total pressure increase) More...
 
cs_real_t cs_post_moment_of_force (cs_lnum_t n_b_faces, const cs_lnum_t b_face_ids[], cs_real_t axis[3])
 Compute the magnitude of a moment of force torque) given an axis and the stress on a specific boundary. More...
 
void cs_post_stress_tangential (cs_lnum_t n_b_faces, const cs_lnum_t b_face_ids[], cs_real_3_t stress[])
 Compute tangential stress on a specific boundary. More...
 
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. More...
 
void cs_post_b_total_pressure (cs_lnum_t n_b_faces, const cs_lnum_t b_face_ids[], cs_real_t pres[])
 Compute total pressure on a specific boundary region. More...
 
void cs_post_evm_reynolds_stresses (cs_field_interpolate_t interpolation_type, cs_lnum_t n_cells, const cs_lnum_t cell_ids[], const cs_real_3_t *coords, cs_real_6_t *rst)
 Compute Reynolds stresses in case of Eddy Viscosity Models. More...
 
void cs_post_anisotropy_invariant (cs_lnum_t n_cells, const cs_lnum_t cell_ids[], const cs_real_t coords[][3], cs_real_2_t inv[])
 Compute the invariant of the anisotropy tensor. More...
 
void cs_post_boundary_flux (const char *scalar_name, cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[], cs_real_t b_face_flux[])
 Compute scalar flux on a specific boundary region. More...
 
void cs_post_field_cell_to_b_face_values (const cs_field_t *f, cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[], cs_real_t *b_val)
 Compute values at a selection of boundary faces of a given field located on cells. More...
 
cs_real_t cs_post_scalar_boundary_integral (const cs_real_t *scalar_vals, const cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[])
 Compute the surface integral of a scalar array of values located on boundary faces over a selection of boundary faces. More...
 
cs_real_t cs_post_bnd_scalar_boundary_integral (const cs_real_t *scalar_vals, const cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[])
 Compute the surface integral over a selection of boundary faces for a scalar array of values located over the selection. More...
 
cs_real_t cs_post_scalar_boundary_mean (const cs_real_t *scalar_vals, const cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[])
 Compute the surface mean of a scalar array of values located on boundary faces over a selection of boundary faces. Weighting is done using total surface of boundary faces. More...
 
cs_real_t cs_post_bnd_scalar_boundary_mean (const cs_real_t *scalar_vals, const cs_lnum_t n_loc_b_faces, const cs_lnum_t b_face_ids[])
 Compute the surface mean over a selection of boundary faces for a scalar array of values located over the selection. Weighting is done using total surface of boundary faces. More...
 
cs_real_t cs_post_scalar_b_zone_integral (const cs_zone_t *z, const cs_real_t *scalar_vals)
 Compute the surface integral of a scalar array of values located on boundary faces over a boundary zone. More...
 
cs_real_t cs_post_bnd_scalar_b_zone_integral (const cs_zone_t *z, const cs_real_t *scalar_vals)
 Compute the surface integral of a scalar over a boundary zone faces, for an array of values located on the zone's faces. More...
 
cs_real_t cs_post_scalar_b_zone_mean (const cs_zone_t *z, const cs_real_t *scalar_vals)
 Compute the surface mean of a scalar array of values located on boundary faces over a boundary zone. Weighting is done using total surface of boundary faces. More...
 
cs_real_t cs_post_bnd_scalar_b_zone_mean (const cs_zone_t *z, const cs_real_t *scalar_vals)
 Compute the surface mean of a scalar over a boundary zone faces, for an array of values located on the zone's faces. Weighting is done using total surface of boundary faces. More...
 

Function Documentation

◆ cs_b_face_criterion_probes_define()

void cs_b_face_criterion_probes_define ( void *  input,
cs_lnum_t n_elts,
cs_real_3_t **  coords,
cs_real_t **  s 
)

Define a profile based on centers of faces defined by a given criterion.

Here, the input points to string describing a selection criterion.

Parameters
[in]inputpointer to selection criterion
[out]n_eltsnumber of selected coordinates
[out]coordscoordinates of selected elements.
[out]scurvilinear coordinates of selected elements

◆ cs_cell_polyline_intersect_select()

void cs_cell_polyline_intersect_select ( void *  input,
cs_lnum_t  n_points,
cs_lnum_t n_cells,
cs_lnum_t **  cell_ids,
cs_real_t **  seg_c_len,
cs_real_3_t **  seg_c_cen 
)

Select cells cut by a line composed of segments.

This selection function may be used as an elements selection function for postprocessing.

In this case, the input points to a real array containing the segment's start and end coordinates.

Note: the input pointer must point to valid data when this selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;

The caller is responsible for freeing the returned cell_ids array. When passed to postprocessing mesh or probe set definition functions, this is handled automatically.

Deprecated:
Use cs_mesh_intersect_polyline_cell_select (rename) instead.
Parameters
[in]inputpointer to segments starts and ends: [x0, y0, z0, x1, y1, z1]
[in]n_pointsnumber of vertices in the polyline
[out]n_cellsnumber of selected cells
[out]cell_idsarray of selected cell ids (0 to n-1 numbering)
[out]seg_c_lenarray of length of the segment in the selected cells
[out]seg_c_cenarray of center coordinates of the segment in the selected cells

◆ cs_cell_segment_intersect_probes_define()

void cs_cell_segment_intersect_probes_define ( void *  input,
cs_lnum_t n_elts,
cs_real_3_t **  coords,
cs_real_t **  s 
)

Define probes based on the centers of cells intersected by a given segment.

This selection function may be used as a probe set definition function for postprocessing.

In this case, the input points to a real array containing the segment's start and end coordinates.

Note: the input pointer must point to valid data when this selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;

The caller is responsible for freeing the returned cell_ids array. When passed to postprocessing mesh or probe set definition functions, this is handled automatically.

Deprecated:
: higher-level cs_probe_set_create_from_segment function with n_probes argument set at 0 or lower includes equivalent function.
Parameters
[in]inputpointer to segment start and end: [x0, y0, z0, x1, y1, z1]
[out]n_eltsnumber of selected coordinates
[out]coordscoordinates of selected elements.
[out]scurvilinear coordinates of selected elements

◆ cs_cell_segment_intersect_select()

void cs_cell_segment_intersect_select ( void *  input,
cs_lnum_t n_cells,
cs_lnum_t **  cell_ids 
)

Select cells cut by a given segment.

This selection function may be used as an elements selection function for postprocessing.

In this case, the input points to a real array containing the segment's start and end coordinates.

Note: the input pointer must point to valid data when this selection function is called, so either:

  • that value or structure should not be temporary (i.e. local);
  • post-processing output must be ensured using cs_post_write_meshes() with a fixed-mesh writer before the data pointed to goes out of scope;

The caller is responsible for freeing the returned cell_ids array. When passed to postprocessing mesh or probe set definition functions, this is handled automatically.

Deprecated:
Use cs_mesh_intersect_segment_cell_select (rename) instead.
Parameters
[in]inputpointer to segment start and end: [x0, y0, z0, x1, y1, z1]
[out]n_cellsnumber of selected cells
[out]cell_idsarray of selected cell ids (0 to n-1 numbering)

◆ cs_post_anisotropy_invariant()

void cs_post_anisotropy_invariant ( cs_lnum_t  n_cells,
const cs_lnum_t  cell_ids[],
const cs_real_t  coords[][3],
cs_real_2_t  inv[] 
)

Compute the invariant of the anisotropy tensor.

Parameters
[in]n_cellsnumber of points
[in]cell_idscell location of points (indexed from 0 to n-1)
[in]coordspoint coordinates
[out]invAnisotropy tensor invariant [xsi, eta]

◆ cs_post_b_pressure()

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.

Parameters
[in]n_b_facesnumber of faces
[in]b_face_idslist of faces (0 to n-1)
[out]prespressure on a specific boundary region

◆ cs_post_b_total_pressure()

void cs_post_b_total_pressure ( cs_lnum_t  n_b_faces,
const cs_lnum_t  b_face_ids[],
cs_real_t  pres[] 
)

Compute total pressure on a specific boundary region.

Parameters
[in]n_b_facesnumber of faces
[in]b_face_idslist of faces (0 to n-1)
[out]prestotal pressure on a specific boundary region

◆ cs_post_bnd_scalar_b_zone_integral()

cs_real_t cs_post_bnd_scalar_b_zone_integral ( const cs_zone_t z,
const cs_real_t scalar_vals 
)

Compute the surface integral of a scalar over a boundary zone faces, for an array of values located on the zone's faces.

Parameters
[in]zpointer to boundary zone
[in]scalar_valsarray of scalar values of size n_b_faces
Returns
Value of computed surface integral

◆ cs_post_bnd_scalar_b_zone_mean()

cs_real_t cs_post_bnd_scalar_b_zone_mean ( const cs_zone_t z,
const cs_real_t scalar_vals 
)

Compute the surface mean of a scalar over a boundary zone faces, for an array of values located on the zone's faces. Weighting is done using total surface of boundary faces.

Parameters
[in]zpointer to boundary zone
[in]scalar_valsarray of scalar values of size n_b_faces
Returns
Value of computed surface mean value

◆ cs_post_bnd_scalar_boundary_integral()

cs_real_t cs_post_bnd_scalar_boundary_integral ( const cs_real_t scalar_vals,
const cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[] 
)

Compute the surface integral over a selection of boundary faces for a scalar array of values located over the selection.

Parameters
[in]scalar_valsarray of scalar values of size n_b_faces
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
Returns
Value of computed surface integral

◆ cs_post_bnd_scalar_boundary_mean()

cs_real_t cs_post_bnd_scalar_boundary_mean ( const cs_real_t scalar_vals,
const cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[] 
)

Compute the surface mean over a selection of boundary faces for a scalar array of values located over the selection. Weighting is done using total surface of boundary faces.

Parameters
[in]scalar_valsarray of scalar values of size n_b_faces
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
Returns
Value of computed surface mean value

◆ cs_post_boundary_flux()

void cs_post_boundary_flux ( const char *  scalar_name,
cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[],
cs_real_t  b_face_flux[] 
)

Compute scalar flux on a specific boundary region.

The flux is counted negatively through the normal.

Parameters
[in]scalar_namescalar name
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
[out]b_face_fluxsurface flux through selected faces

◆ cs_post_evm_reynolds_stresses()

void cs_post_evm_reynolds_stresses ( cs_field_interpolate_t  interpolation_type,
cs_lnum_t  n_cells,
const cs_lnum_t  cell_ids[],
const cs_real_3_t coords,
cs_real_6_t rst 
)

Compute Reynolds stresses in case of Eddy Viscosity Models.

Parameters
[in]interpolation_typeinterpolation type for turbulent kinetic energy field
[in]n_cellsnumber of points
[in]cell_idscell location of points (indexed from 0 to n-1, or null if 1-to-1)
[in]coordspoint coordinates (or null for cell centers)
[out]rstReynolds stresses stored as vector [r11, r22, r33, r12, r23, r13]

◆ cs_post_field_cell_to_b_face_values()

void cs_post_field_cell_to_b_face_values ( const cs_field_t f,
cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[],
cs_real_t b_val 
)

Compute values at a selection of boundary faces of a given field located on cells.

Field BCs are taken into account and boundary cell values are reconstructed using the cell gradient.

Parameters
[in]ffield pointer
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
[out]b_valvalues on boundary faces

◆ cs_post_moment_of_force()

cs_real_t cs_post_moment_of_force ( cs_lnum_t  n_b_faces,
const cs_lnum_t  b_face_ids[],
cs_real_t  axis[3] 
)

Compute the magnitude of a moment of force torque) given an axis and the stress on a specific boundary.

Parameters
[in]n_b_facesnumber of faces
[in]b_face_idslist of faces (0 to n-1)
[in]axisaxis
Returns
couple about the axis

◆ cs_post_scalar_b_zone_integral()

cs_real_t cs_post_scalar_b_zone_integral ( const cs_zone_t z,
const cs_real_t scalar_vals 
)

Compute the surface integral of a scalar array of values located on boundary faces over a boundary zone.

Parameters
[in]zpointer to boundary zone
[in]scalar_valsarray of scalar values of size n_b_faces
Returns
Value of computed surface integral

◆ cs_post_scalar_b_zone_mean()

cs_real_t cs_post_scalar_b_zone_mean ( const cs_zone_t z,
const cs_real_t scalar_vals 
)

Compute the surface mean of a scalar array of values located on boundary faces over a boundary zone. Weighting is done using total surface of boundary faces.

Parameters
[in]zpointer to boundary zone
[in]scalar_valsarray of scalar values of size n_b_faces
Returns
Value of computed surface mean value

◆ cs_post_scalar_boundary_integral()

cs_real_t cs_post_scalar_boundary_integral ( const cs_real_t scalar_vals,
const cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[] 
)

Compute the surface integral of a scalar array of values located on boundary faces over a selection of boundary faces.

Parameters
[in]scalar_valsarray of scalar values of size n_b_faces
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
Returns
Value of computed surface integral

◆ cs_post_scalar_boundary_mean()

cs_real_t cs_post_scalar_boundary_mean ( const cs_real_t scalar_vals,
const cs_lnum_t  n_loc_b_faces,
const cs_lnum_t  b_face_ids[] 
)

Compute the surface mean of a scalar array of values located on boundary faces over a selection of boundary faces. Weighting is done using total surface of boundary faces.

Parameters
[in]scalar_valsarray of scalar values of size n_b_faces
[in]n_loc_b_facesnumber of selected boundary faces
[in]b_face_idsids of selected boundary faces
Returns
Value of computed surface mean value

◆ cs_post_stress_tangential()

void cs_post_stress_tangential ( cs_lnum_t  n_b_faces,
const cs_lnum_t  b_face_ids[],
cs_real_3_t  stress[] 
)

Compute tangential stress on a specific boundary.

Parameters
[in]n_b_facesnumber of faces
[in]b_face_idslist of faces (0 to n-1)
[out]stresstangential stress on the specific boundary

◆ cs_post_turbomachinery_head()

cs_real_t cs_post_turbomachinery_head ( const char *  criteria_in,
cs_mesh_location_type_t  location_in,
const char *  criteria_out,
cs_mesh_location_type_t  location_out 
)

Compute the head of a turbomachinery (total pressure increase)

Parameters
[in]criteria_inselection criteria of turbomachinery suction
[in]location_inmesh location of turbomachinery suction
[in]criteria_outselection criteria of turbomachinery discharge
[in]location_outmesh location of turbomachinery discharge
Returns
turbomachinery head