Gradient reconstruction at boundaries and associated functions. More...
#include "base/cs_defs.h"#include <cmath>#include <chrono>#include <assert.h>#include <errno.h>#include <stdio.h>#include <stdarg.h>#include <string.h>#include <float.h>#include "bft/bft_error.h"#include "bft/bft_printf.h"#include "base/cs_ext_neighborhood.h"#include "base/cs_field.h"#include "base/cs_halo.h"#include "base/cs_math.h"#include "base/cs_mem.h"#include "base/cs_parall.h"#include "base/cs_profiling.h"#include "mesh/cs_mesh.h"#include "mesh/cs_mesh_adjacencies.h"#include "mesh/cs_mesh_quantities.h"#include "alge/cs_gradient.h"#include "alge/cs_gradient_priv.h"#include "alge/cs_gradient_boundary.h"
Include dependency graph for cs_gradient_boundary.cpp:Functions | |
| void | cs_gradient_boundary_iprime_lsq_s (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_halo_type_t halo_type, double clip_coeff, int hyd_p_flag, cs_real_t f_ext[][3], cs_real_t *df_limiter, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t c_weight[], const cs_real_t var[], cs_real_t *restrict var_iprime, cs_real_t var_iprime_flux[]) |
| Compute the values of a scalar at boundary face I' positions using least-squares interpolation. More... | |
| void | cs_gradient_boundary_iprime_lsq_s_ani (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, cs_lnum_t n_faces, const cs_lnum_t *face_ids, double clip_coeff, int hyd_p_flag, cs_real_t f_ext[][3], cs_real_t *df_limiter, const cs_field_bc_coeffs_t *bc_coeffs, cs_real_t viscce[][6], const cs_real_t weighb[], const cs_real_t c_weight[][6], const cs_real_t var[], cs_real_t *restrict var_iprime, cs_real_t var_iprime_flux[]) |
| Compute the values of a scalar at boundary face I' positions using least-squares interpolation with anisotropic weighting. More... | |
| template<cs_lnum_t stride> | |
| void | cs_gradient_boundary_iprime_lsq_strided (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_halo_type_t halo_type, double b_clip_coeff, cs_real_t *df_limiter, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t c_weight[], const cs_real_t var[][stride], cs_real_t var_iprime[][stride], cs_real_t var_iprime_lim[][stride]) |
| Compute the values of a vector at boundary face I' positions using least-squares interpolation. More... | |
| template void | cs_gradient_boundary_iprime_lsq_strided (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_halo_type_t halo_type, double b_clip_coeff, cs_real_t *df_limiter, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t c_weight[], const cs_real_t var[][3], cs_real_t var_iprime[][3], cs_real_t var_iprime_lim[][3]) |
| template void | cs_gradient_boundary_iprime_lsq_strided (cs_dispatch_context &ctx, const cs_mesh_t *m, const cs_mesh_quantities_t *fvq, cs_lnum_t n_faces, const cs_lnum_t *face_ids, cs_halo_type_t halo_type, double b_clip_coeff, cs_real_t *df_limiter, const cs_field_bc_coeffs_t *bc_coeffs, const cs_real_t c_weight[], const cs_real_t var[][6], cs_real_t var_iprime[][6], cs_real_t var_iprime_lim[][6]) |
Gradient reconstruction at boundaries and associated functions.
| void cs_gradient_boundary_iprime_lsq_s | ( | cs_dispatch_context & | ctx, |
| const cs_mesh_t * | m, | ||
| const cs_mesh_quantities_t * | fvq, | ||
| cs_lnum_t | n_faces, | ||
| const cs_lnum_t * | face_ids, | ||
| cs_halo_type_t | halo_type, | ||
| double | clip_coeff, | ||
| int | hyd_p_flag, | ||
| cs_real_t | f_ext[][3], | ||
| cs_real_t * | df_limiter, | ||
| const cs_field_bc_coeffs_t * | bc_coeffs, | ||
| const cs_real_t | c_weight[], | ||
| const cs_real_t | var[], | ||
| cs_real_t *restrict | var_iprime, | ||
| cs_real_t | var_iprime_flux[] | ||
| ) |
Compute the values of a scalar at boundary face I' positions using least-squares interpolation.
This assumes ghost cell values for the variable (var) are up-to-date.
A simple limiter is applied to ensure the maximum principle is preserved (using non-reconstructed values in case of non-homogeneous Neumann conditions).
To compute the values at I', we only need the gradient along II', so in most cases, we could simply assume a Neumann BC for a given face.
We still use the provided BC's when possible, for the following cases:
| [in] | ctx | Reference to dispatch context |
| [in] | m | pointer to associated mesh structure |
| [in] | fvq | pointer to associated finite volume quantities |
| [in] | n_faces | number of faces at which to compute values |
| [in] | face_ids | ids of boundary faces at which to compute values, or null for all |
| [in] | halo_type | halo (cell neighborhood) type |
| [in] | clip_coeff | clipping (limiter) coefficient (no limiter if < 0) |
| [in] | hyd_p_flag | flag for hydrostatic pressure |
| [in] | f_ext | exterior force generating pressure |
| [in] | df_limiter | diffusion clipping (limiter) field (no limiter if nullptr) |
| [in] | bc_coeffs | boundary condition structure, or null |
| [in] | c_weight | cell variable weight, or null |
| [in] | var | variable values et cell centers |
| [out] | var_iprime | variable values et face iprime locations |
| [out] | var_iprime | variable values at face iprime locations for gradient |
| [out] | var_iprime_flux | variable values at face iprime locations for flux, or nullptr if not needed |
| void cs_gradient_boundary_iprime_lsq_s_ani | ( | cs_dispatch_context & | ctx, |
| const cs_mesh_t * | m, | ||
| const cs_mesh_quantities_t * | fvq, | ||
| cs_lnum_t | n_faces, | ||
| const cs_lnum_t * | face_ids, | ||
| double | clip_coeff, | ||
| int | hyd_p_flag, | ||
| cs_real_t | f_ext[][3], | ||
| cs_real_t * | df_limiter, | ||
| const cs_field_bc_coeffs_t * | bc_coeffs, | ||
| cs_real_t | viscce[][6], | ||
| const cs_real_t | weighb[], | ||
| const cs_real_t | c_weight[][6], | ||
| const cs_real_t | var[], | ||
| cs_real_t *restrict | var_iprime, | ||
| cs_real_t | var_iprime_flux[] | ||
| ) |
Compute the values of a scalar at boundary face I' positions using least-squares interpolation with anisotropic weighting.
This assumes ghost cell values for the variable (var) are up-to-date.
A simple limiter is applied to ensure the maximum principle is preserved (using non-reconstructed values in case of non-homogeneous Neumann conditions).
| [in] | ctx | Reference to dispatch context |
| [in] | m | pointer to associated mesh structure |
| [in] | fvq | pointer to associated finite volume quantities |
| [in] | n_faces | number of faces at which to compute values |
| [in] | face_ids | ids of boundary faces at which to compute values, or null for all |
| [in] | clip_coeff | clipping (limiter) coefficient (no limiter if < 0) |
| [in] | hyd_p_flag | flag for hydrostatic pressure |
| [in] | f_ext | exterior force generating pressure |
| [in] | df_limiter | diffusion clipping (limiter) field |
| [in] | bc_coeffs | boundary condition structure |
| [in] | viscce | symmetric cell tensor |
| [in] | weighb | boundary face weight for cells i in case of tensor diffusion, or nullptr |
| [in] | c_weight | cell variable weight, or null |
| [in] | var | variable values et cell centers |
| [out] | var_iprime | variable values et face iprime locations for gradient |
| [out] | var_iprime_flux | variabes values at face iprime locations for flux, or nullptr if not needed |
| template void cs_gradient_boundary_iprime_lsq_strided | ( | cs_dispatch_context & | ctx, |
| const cs_mesh_t * | m, | ||
| const cs_mesh_quantities_t * | fvq, | ||
| cs_lnum_t | n_faces, | ||
| const cs_lnum_t * | face_ids, | ||
| cs_halo_type_t | halo_type, | ||
| double | b_clip_coeff, | ||
| cs_real_t * | df_limiter, | ||
| const cs_field_bc_coeffs_t * | bc_coeffs, | ||
| const cs_real_t | c_weight[], | ||
| const cs_real_t | var[][3], | ||
| cs_real_t | var_iprime[][3], | ||
| cs_real_t | var_iprime_lim[][3] | ||
| ) |
| template void cs_gradient_boundary_iprime_lsq_strided | ( | cs_dispatch_context & | ctx, |
| const cs_mesh_t * | m, | ||
| const cs_mesh_quantities_t * | fvq, | ||
| cs_lnum_t | n_faces, | ||
| const cs_lnum_t * | face_ids, | ||
| cs_halo_type_t | halo_type, | ||
| double | b_clip_coeff, | ||
| cs_real_t * | df_limiter, | ||
| const cs_field_bc_coeffs_t * | bc_coeffs, | ||
| const cs_real_t | c_weight[], | ||
| const cs_real_t | var[][6], | ||
| cs_real_t | var_iprime[][6], | ||
| cs_real_t | var_iprime_lim[][6] | ||
| ) |
| void cs_gradient_boundary_iprime_lsq_strided | ( | cs_dispatch_context & | ctx, |
| const cs_mesh_t * | m, | ||
| const cs_mesh_quantities_t * | fvq, | ||
| cs_lnum_t | n_faces, | ||
| const cs_lnum_t * | face_ids, | ||
| cs_halo_type_t | halo_type, | ||
| double | b_clip_coeff, | ||
| cs_real_t * | df_limiter, | ||
| const cs_field_bc_coeffs_t * | bc_coeffs, | ||
| const cs_real_t | c_weight[], | ||
| const cs_real_t | var[][stride], | ||
| cs_real_t | var_iprime[][stride], | ||
| cs_real_t | var_iprime_lim[][stride] | ||
| ) |
Compute the values of a vector at boundary face I' positions using least-squares interpolation.
This assumes ghost cell values which might be used are already synchronized.
A simple limiter is applied to ensure the maximum principle is preserved (using non-reconstructed values in case of non-homogeneous Neumann conditions).
This function uses a local iterative approach to compute the cell gradient, as handling of the boundary condition terms b in higher dimensions would otherwise require solving higher-dimensional systems, often at a higher cost.
To compute the values at I', we only need the gradient along II', so in most cases, we could simply assume a Neuman BC.
The same logic is applied as for cs_gradient_boundary_iprime_lsq_s.
| [in] | ctx | Reference to dispatch context |
| [in] | m | pointer to associated mesh structure |
| [in] | fvq | pointer to associated finite volume quantities |
| [in] | n_faces | number of faces at which to compute values |
| [in] | face_ids | ids of boundary faces at which to compute values, or NULL for all |
| [in] | halo_type | halo (cell neighborhood) type |
| [in] | b_clip_coeff | boundary clipping (limiter) coefficient (no limiter if < 0) |
| [in] | df_limiter | diffusion clipping (limiter) field (no limiter if nullptr) |
| [in] | bc_coeffs | boundary condition structure, or NULL |
| [in] | c_weight | cell variable weight, or NULL |
| [in] | var | variable values at cell centers |
| [out] | var_iprime | variable values at face iprime locations |
| [out] | var_iprime_lim | limited variable values at face iprime locations |