My Project
programmer's documentation
Macros | Functions
cs_hho_builder.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include "bft_error.h"
#include "bft_mem.h"
#include "cs_log.h"
#include "cs_time_step.h"
#include "cs_hho_builder.h"
Include dependency graph for cs_hho_builder.c:

Macros

#define _dp3   cs_math_3_dot_product
 
#define _mv3   cs_math_33_3_product
 
#define CS_HHO_BUILDER_DBG   0
 

Functions

static void _fill_vol_reco_op (cs_sdm_t *stiffness, cs_sdm_t *rhs_c_t, cs_hho_builder_t *hhob)
 Fill the volume-related part of the matrices when building the reconstruction operator. More...
 
static void _add_tria_reduction (cs_real_t t_eval, const cs_xdef_analytic_input_t *anai, const cs_basis_func_t *fbf, const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const double surf, cs_cell_builder_t *cb, cs_real_t array[])
 Compute the reduction onto the face polynomial space of a function defined by an analytical expression depending on the location and the current time. More...
 
static void _add_tria_reduction_v (cs_real_t t_eval, const cs_xdef_analytic_input_t *anai, const cs_basis_func_t *fbf, const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const double surf, cs_cell_builder_t *cb, cs_real_t array[])
 Compute the reduction onto the face polynomial space of a function defined by an analytical expression depending on the location and the current time. Vector case. More...
 
static void _add_tetra_reduction (cs_real_t t_eval, const cs_xdef_analytic_input_t *anai, const cs_basis_func_t *cbf, const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const cs_real_3_t xv4, const double vol, cs_cell_builder_t *cb, cs_real_t array[])
 Compute the reduction onto the cell polynomial space of a function defined by an analytical expression depending on the location and the current time. More...
 
static void _add_tetra_reduction_v (cs_real_t t_eval, const cs_xdef_analytic_input_t *anai, const cs_basis_func_t *cbf, const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const cs_real_3_t xv4, const double vol, cs_cell_builder_t *cb, cs_real_t array[])
 Compute the reduction onto the cell polynomial space of a function defined by an analytical expression depending on the location and the current time.Vector case. More...
 
static void _add_tria_to_reco_op (const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const double surf, const cs_basis_func_t *fbf, const cs_real_t *kappa_nfc, cs_real_3_t *gpts, cs_sdm_t *rc, cs_sdm_t *rf, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Routine for computing volumetric integrals over a tetrahedron which are contributions to the local stiffness matrix on the gradient basis and to the right-hand side. More...
 
static void _add_tetra_to_reco_op (const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const cs_real_3_t xv4, const double vol, cs_sdm_t *stiffness, cs_real_3_t *gpts, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Routine for computing volumetric integrals over a tetrahedron which are contributions to the local stiffness matrix on the gradient basis and to the right-hand side. More...
 
static void _add_contrib_mcg (const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const cs_real_3_t xv4, const double vol, const cs_basis_func_t *cbf_kp1, cs_sdm_t *m_cg, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Routine for computing volumetric integrals over a tetrahedron which are contributions to the M_cg matrix. More...
 
static void _add_contrib_mf_cg (const cs_real_3_t xv1, const cs_real_3_t xv2, const cs_real_3_t xv3, const double surf, const cs_basis_func_t *fbf, const cs_basis_func_t *cbf_kp1, cs_sdm_t *mf_cg, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Routine for computing surfacic integrals over a triangle which are contributions to the Mf_cg matrix. More...
 
static cs_sdm_t * _compute_mcg (const cs_cell_mesh_t *cm, cs_basis_func_t *cbf_kp1, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Compute the diffusion operator. The gradient reconstruction operator has to be built just before this call (cb->aux stores the rhs) More...
 
cs_hho_builder_tcs_hho_builder_create (int order, int n_fc)
 Allocate a cs_hho_builder_t structure. More...
 
void cs_hho_builder_free (cs_hho_builder_t **p_builder)
 Free a cs_hho_builder_t structure. More...
 
void cs_hho_builder_cellwise_setup (const cs_cell_mesh_t *cm, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Set-up the basis functions related to a cell, its gradient and to the faces of this cell. Compute cell and face projection and its related modified Cholesky factorization. More...
 
void cs_hho_builder_compute_grad_reco (const cs_cell_mesh_t *cm, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Compute the gradient operator stemming from the relation stiffness * grad_op = rhs where stiffness is a square matrix of size grd_size rhs is matrix of size (n_fc*f_size + c_size) * grd_size Hence, grad_op a matrix grd_size * (n_fc*f_size + c_size) More...
 
void cs_hho_builder_diffusion (const cs_cell_mesh_t *cm, cs_cell_builder_t *cb, cs_hho_builder_t *hhob)
 Compute the diffusion operator. The gradient reconstruction operator has to be built just before this call (cb->aux stores the rhs) More...
 
void cs_hho_builder_reduction_from_analytic (const cs_xdef_t *def, const cs_cell_mesh_t *cm, cs_real_t t_eval, cs_cell_builder_t *cb, cs_hho_builder_t *hhob, cs_real_t red[])
 Compute the reduction onto the polynomial spaces (cell and faces) of a function defined by an analytical expression depending on the location and the current time red array has to be allocated before calling this function. More...
 
void cs_hho_builder_reduction_from_analytic_v (const cs_xdef_t *def, const cs_cell_mesh_t *cm, cs_real_t t_eval, cs_cell_builder_t *cb, cs_hho_builder_t *hhob, cs_real_t red[])
 Compute the reduction onto the polynomial spaces (cell and faces) of a function defined by an analytical expression depending on the location and the current time This function handles the vector case. More...
 
void cs_hho_builder_compute_dirichlet (const cs_xdef_t *def, short int f, const cs_cell_mesh_t *cm, cs_real_t t_eval, cs_cell_builder_t *cb, cs_hho_builder_t *hhob, cs_real_t res[])
 Compute the projection of the Dirichlet boundary conditions onto the polynomial spaces on faces. More...
 
void cs_hho_builder_compute_dirichlet_v (const cs_xdef_t *def, short int f, const cs_cell_mesh_t *cm, cs_real_t t_eval, cs_cell_builder_t *cb, cs_hho_builder_t *hhob, cs_real_t res[])
 Compute the projection of the Dirichlet boundary conditions onto the polynomial spaces on faces. Vector case. More...
 

Macro Definition Documentation

◆ _dp3

#define _dp3   cs_math_3_dot_product

◆ _mv3

#define _mv3   cs_math_33_3_product

◆ CS_HHO_BUILDER_DBG

#define CS_HHO_BUILDER_DBG   0

Function Documentation

◆ _add_contrib_mcg()

static void _add_contrib_mcg ( const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const cs_real_3_t  xv4,
const double  vol,
const cs_basis_func_t cbf_kp1,
cs_sdm_t *  m_cg,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)
inlinestatic

Routine for computing volumetric integrals over a tetrahedron which are contributions to the M_cg matrix.

Parameters
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]xv4fourth vertex
[in]volvolume of the tetrahedron
[in]cbf_kp1pointer to a cell basis function order:k+1
[in,out]m_cgmatrix to compute
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ _add_contrib_mf_cg()

static void _add_contrib_mf_cg ( const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const double  surf,
const cs_basis_func_t fbf,
const cs_basis_func_t cbf_kp1,
cs_sdm_t *  mf_cg,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)
inlinestatic

Routine for computing surfacic integrals over a triangle which are contributions to the Mf_cg matrix.

Parameters
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]surfsurface of the triangle to consider
[in]fbfpointer to a set of face basis functions
[in]cbf_kp1pointer to a set of cell basis functions (k+1)
[in,out]mf_cgmatrix to compute
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ _add_tetra_reduction()

static void _add_tetra_reduction ( cs_real_t  t_eval,
const cs_xdef_analytic_input_t anai,
const cs_basis_func_t cbf,
const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const cs_real_3_t  xv4,
const double  vol,
cs_cell_builder_t cb,
cs_real_t  array[] 
)
inlinestatic

Compute the reduction onto the cell polynomial space of a function defined by an analytical expression depending on the location and the current time.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]anaipointer to an analytical definition
[in]cbfpointer to a structure for face basis functions
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]xv4third vertex
[in]volvolume of the tetrahedron
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]arrayarray storing values to compute

◆ _add_tetra_reduction_v()

static void _add_tetra_reduction_v ( cs_real_t  t_eval,
const cs_xdef_analytic_input_t anai,
const cs_basis_func_t cbf,
const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const cs_real_3_t  xv4,
const double  vol,
cs_cell_builder_t cb,
cs_real_t  array[] 
)
inlinestatic

Compute the reduction onto the cell polynomial space of a function defined by an analytical expression depending on the location and the current time.Vector case.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]anaipointer to an analytical definition
[in]cbfpointer to a structure for face basis functions
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]xv4third vertex
[in]volvolume of the tetrahedron
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]arrayarray storing values to compute

◆ _add_tetra_to_reco_op()

static void _add_tetra_to_reco_op ( const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const cs_real_3_t  xv4,
const double  vol,
cs_sdm_t *  stiffness,
cs_real_3_t gpts,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)
static

Routine for computing volumetric integrals over a tetrahedron which are contributions to the local stiffness matrix on the gradient basis and to the right-hand side.

Parameters
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]xv4fourth vertex
[in]volvolume of the terahedron
[in,out]stiffnessstiffness matrix to compute
[in,out]gptscoordinates of the Gauss points
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ _add_tria_reduction()

static void _add_tria_reduction ( cs_real_t  t_eval,
const cs_xdef_analytic_input_t anai,
const cs_basis_func_t fbf,
const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const double  surf,
cs_cell_builder_t cb,
cs_real_t  array[] 
)
inlinestatic

Compute the reduction onto the face polynomial space of a function defined by an analytical expression depending on the location and the current time.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]anaipointer to an analytical definition
[in]fbfpointer to a structure for face basis functions
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]surfarea of the triangle
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]arrayarray storing values to compute

◆ _add_tria_reduction_v()

static void _add_tria_reduction_v ( cs_real_t  t_eval,
const cs_xdef_analytic_input_t anai,
const cs_basis_func_t fbf,
const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const double  surf,
cs_cell_builder_t cb,
cs_real_t  array[] 
)
inlinestatic

Compute the reduction onto the face polynomial space of a function defined by an analytical expression depending on the location and the current time. Vector case.

Parameters
[in]t_evaltime at which one performs the evaluation
[in]anaipointer to an analytical definition
[in]fbfpointer to a structure for face basis functions
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]surfarea of the triangle
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]arrayarray storing values to compute

◆ _add_tria_to_reco_op()

static void _add_tria_to_reco_op ( const cs_real_3_t  xv1,
const cs_real_3_t  xv2,
const cs_real_3_t  xv3,
const double  surf,
const cs_basis_func_t fbf,
const cs_real_t kappa_nfc,
cs_real_3_t gpts,
cs_sdm_t *  rc,
cs_sdm_t *  rf,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)
static

Routine for computing volumetric integrals over a tetrahedron which are contributions to the local stiffness matrix on the gradient basis and to the right-hand side.

Parameters
[in]xv1first vertex
[in]xv2second vertex
[in]xv3third vertex
[in]surfarea of the triangle
[in]fbfpointer to the related set of face basis functions
[in]kappa_nfcpermeability tensor times the related face normal
[in,out]gptscoordinates of the Gauss points
[in,out]rcright-hand side matrix to compute (cell part)
[in,out]rfright-hand side matrix to compute (face part)
[in,out]gptscoordinates of the Gauss points
[in,out]kappa_nfccoordinates of the Gauss points
[in,out]cbpointer to a cs_cell_builder_structure_t
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ _compute_mcg()

static cs_sdm_t* _compute_mcg ( const cs_cell_mesh_t cm,
cs_basis_func_t cbf_kp1,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)
static

Compute the diffusion operator. The gradient reconstruction operator has to be built just before this call (cb->aux stores the rhs)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]cbf_kp1pointer to a set of cell basis functions order=k+1
[in,out]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure
Returns
a pointer to a cs_sdm_t structure storing m_cg

◆ _fill_vol_reco_op()

static void _fill_vol_reco_op ( cs_sdm_t *  stiffness,
cs_sdm_t *  rhs_c_t,
cs_hho_builder_t hhob 
)
static

Fill the volume-related part of the matrices when building the reconstruction operator.

Parameters
[in,out]stiffnesspointer to the stiffness matrix
[in,out]rhs_c_tpointer to the right-hand side (matrix)
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ cs_hho_builder_cellwise_setup()

void cs_hho_builder_cellwise_setup ( const cs_cell_mesh_t cm,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)

Set-up the basis functions related to a cell, its gradient and to the faces of this cell. Compute cell and face projection and its related modified Cholesky factorization.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ cs_hho_builder_compute_dirichlet()

void cs_hho_builder_compute_dirichlet ( const cs_xdef_t def,
short int  f,
const cs_cell_mesh_t cm,
cs_real_t  t_eval,
cs_cell_builder_t cb,
cs_hho_builder_t hhob,
cs_real_t  res[] 
)

Compute the projection of the Dirichlet boundary conditions onto the polynomial spaces on faces.

Parameters
[in]defpointer to a cs_xdef_t structure
[in]flocal face id in the cellwise view of the mesh
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in,out]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure
[in,out]resvector containing the result

◆ cs_hho_builder_compute_dirichlet_v()

void cs_hho_builder_compute_dirichlet_v ( const cs_xdef_t def,
short int  f,
const cs_cell_mesh_t cm,
cs_real_t  t_eval,
cs_cell_builder_t cb,
cs_hho_builder_t hhob,
cs_real_t  res[] 
)

Compute the projection of the Dirichlet boundary conditions onto the polynomial spaces on faces. Vector case.

Parameters
[in]defpointer to a cs_xdef_t structure
[in]flocal face id in the cellwise view of the mesh
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in,out]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure
[in,out]resvector containing the result

◆ cs_hho_builder_compute_grad_reco()

void cs_hho_builder_compute_grad_reco ( const cs_cell_mesh_t cm,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)

Compute the gradient operator stemming from the relation stiffness * grad_op = rhs where stiffness is a square matrix of size grd_size rhs is matrix of size (n_fc*f_size + c_size) * grd_size Hence, grad_op a matrix grd_size * (n_fc*f_size + c_size)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ cs_hho_builder_create()

cs_hho_builder_t* cs_hho_builder_create ( int  order,
int  n_fc 
)

Allocate a cs_hho_builder_t structure.

Parameters
[in]orderorder of the polynomial basis function
[in]n_fcmax. number of faces in a cell
Returns
a pointer to a new allocated cs_hho_builder_t structure

◆ cs_hho_builder_diffusion()

void cs_hho_builder_diffusion ( const cs_cell_mesh_t cm,
cs_cell_builder_t cb,
cs_hho_builder_t hhob 
)

Compute the diffusion operator. The gradient reconstruction operator has to be built just before this call (cb->aux stores the rhs)

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure

◆ cs_hho_builder_free()

void cs_hho_builder_free ( cs_hho_builder_t **  p_builder)

Free a cs_hho_builder_t structure.

Parameters
[in,out]p_builderpointer of pointer on a cs_hho_builder_t struct.

◆ cs_hho_builder_reduction_from_analytic()

void cs_hho_builder_reduction_from_analytic ( const cs_xdef_t def,
const cs_cell_mesh_t cm,
cs_real_t  t_eval,
cs_cell_builder_t cb,
cs_hho_builder_t hhob,
cs_real_t  red[] 
)

Compute the reduction onto the polynomial spaces (cell and faces) of a function defined by an analytical expression depending on the location and the current time red array has to be allocated before calling this function.

Parameters
[in]defpointer to a cs_xdef_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in,out]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure
[in,out]redvector containing the reduction

◆ cs_hho_builder_reduction_from_analytic_v()

void cs_hho_builder_reduction_from_analytic_v ( const cs_xdef_t def,
const cs_cell_mesh_t cm,
cs_real_t  t_eval,
cs_cell_builder_t cb,
cs_hho_builder_t hhob,
cs_real_t  red[] 
)

Compute the reduction onto the polynomial spaces (cell and faces) of a function defined by an analytical expression depending on the location and the current time This function handles the vector case.

red array has to be allocated before calling this function.

Parameters
[in]defpointer to a cs_xdef_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in]t_evaltime at which one performs the evaluation
[in,out]cbpointer to a cell builder_t structure
[in,out]hhobpointer to a cs_hho_builder_t structure
[in,out]redvector containing the reduction