programmer's documentation
Functions | Variables
cs_hodge.c File Reference

Build discrete Hodge operators. More...

#include "cs_defs.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include <limits.h>
#include <assert.h>
#include "bft_mem.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_scheme_geometry.h"
#include "cs_hodge.h"
Include dependency graph for cs_hodge.c:

Functions

static void _check_stiffness (const cs_sdm_t *sloc)
 Check the coherency of the values of a stiffness matrix. More...
 
static void _check_vector_hodge (const cs_real_3_t *vec, const cs_real_3_t *res, const cs_sdm_t *hdg, const cs_param_hodge_t h_info, cs_cell_builder_t *cb)
 Check the coherency of the values of a discrete Hodge operator. More...
 
static void _compute_cost_quant_iso (const int n_ent, const double invcvol, const double ptyval, const cs_real_3_t *pq, const cs_real_3_t *dq, double *alpha, double *kappa, cs_sdm_t *hloc)
 Compute quantities used for defining the entries of the discrete Hodge for COST algo. when the property is isotropic Initialize the local discrete Hodge op. with the consistency part. More...
 
static void _compute_cost_quant (const int n_ent, const double invcvol, const cs_real_33_t ptymat, const cs_real_3_t *pq, const cs_real_3_t *dq, double *alpha, double *kappa, cs_sdm_t *hloc)
 Compute quantities used for defining the entries of the discrete Hodge for COST algo. Initialize the local discrete Hodge op. with the consistency part. More...
 
static void _compute_hodge_cost (const int n_ent, const double beta2, const double alpha[], const double kappa[], double hval[])
 Build a local discrete Hodge operator using the generic COST algo. and cellwise view of the mesh Specific for EpFd Hodge operator COST means COnsistency + STabilization. More...
 
void cs_hodge_fb_cost_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the generic COST algo. The computed matrix is stored in cb->loc Case of CDO face-based schemes. More...
 
void cs_hodge_fb_voro_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the Voronoi algorithm The computed matrix is stored in cb->loc Case of CDO face-based schemes. More...
 
void cs_hodge_vb_cost_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the generic COST algo. Case of CDO vertex-based schemes. More...
 
void cs_hodge_vb_voro_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the Voronoi algorithm The computed matrix is stored in cb->loc Case of CDO vertex-based schemes. More...
 
void cs_hodge_vb_wbs_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the generic WBS algo. WBS standing for Whitney Barycentric Subdivision (WBS) algo. More...
 
void cs_hodge_vcb_get_stiffness (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local stiffness matrix using the generic WBS algo. WBS standing for Whitney Barycentric Subdivision (WBS) algo. The computed matrix is stored in cb->loc. More...
 
void cs_hodge_vcb_wbs_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using the WBS algo. This function is specific for vertex+cell-based schemes. More...
 
void cs_hodge_vpcd_wbs_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using WBS algo. Hodge op. from primal vertices to dual cells. This function is specific for vertex-based schemes. More...
 
void cs_hodge_vpcd_voro_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal vertices to dual cells. This function is specific for vertex-based schemes. More...
 
void cs_hodge_epfd_voro_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal edges to dual faces. This function is specific for vertex-based schemes. More...
 
void cs_hodge_epfd_cost_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using the COST algo. Hodge op. from primal edges to dual faces. This function is specific for vertex-based schemes. More...
 
void cs_hodge_fped_voro_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal faces to dual edges. This function is related to cell-based schemes. More...
 
void cs_hodge_fped_cost_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using the COST algo. Hodge op. from primal faces to dual edges. This function is related to cell-based schemes. More...
 
void cs_hodge_edfp_voro_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from dual edges to primal faces. This function is related to face-based schemes. More...
 
void cs_hodge_edfp_cost_get (const cs_param_hodge_t h_info, const cs_cell_mesh_t *cm, cs_cell_builder_t *cb)
 Build a local Hodge operator for a given cell using the COST algo. Hodge op. from dual edges to primal faces. This function is related to face-based schemes. More...
 
void cs_hodge_matvec (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_param_hodge_t h_info, const cs_property_t *pty, const double in_vals[], double result[])
 Compute cellwise a discrete hodge operator and multiple it with a vector. More...
 
void cs_hodge_compute_wbs_surfacic (const cs_face_mesh_t *fm, cs_sdm_t *hf)
 Compute the hodge operator related to a face (i.e. a mass matrix with unity property) using a Whitney Barycentric Subdivision (WBS) algorithm. More...
 

Variables

static const double cs_hodge_vc_coef = 3./20
 

Detailed Description

Build discrete Hodge operators.

Function Documentation

◆ _check_stiffness()

static void _check_stiffness ( const cs_sdm_t *  sloc)
inlinestatic

Check the coherency of the values of a stiffness matrix.

Parameters
[in]slocpointer to a cs_sdm_t struct.

◆ _check_vector_hodge()

static void _check_vector_hodge ( const cs_real_3_t vec,
const cs_real_3_t res,
const cs_sdm_t *  hdg,
const cs_param_hodge_t  h_info,
cs_cell_builder_t cb 
)
inlinestatic

Check the coherency of the values of a discrete Hodge operator.

Parameters
[in]vecvectors of quantities to test against a hodge [in] res vectors of quantities to compare with
[in]hdgpointer to a cs_sdm_t structure
[in]h_infoparametrization of the discrete Hodge operator
[in,out]cbpointer to a cell builder structure buffers to store temporary values

◆ _compute_cost_quant()

static void _compute_cost_quant ( const int  n_ent,
const double  invcvol,
const cs_real_33_t  ptymat,
const cs_real_3_t pq,
const cs_real_3_t dq,
double *  alpha,
double *  kappa,
cs_sdm_t *  hloc 
)
static

Compute quantities used for defining the entries of the discrete Hodge for COST algo. Initialize the local discrete Hodge op. with the consistency part.

Parameters
[in]n_entnumber of local entities
[in]invcvol1/|c|
[in]ptymatvalues of the tensor related to the material pty
[in]pqpointer to the first set of quantities
[in]dqpointer to the second set of quantities
[in,out]alphageometrical quantity
[in,out]kappageometrical quantity
[in,out]hlocpointer to a cs_sdm_t struct.

◆ _compute_cost_quant_iso()

static void _compute_cost_quant_iso ( const int  n_ent,
const double  invcvol,
const double  ptyval,
const cs_real_3_t pq,
const cs_real_3_t dq,
double *  alpha,
double *  kappa,
cs_sdm_t *  hloc 
)
static

Compute quantities used for defining the entries of the discrete Hodge for COST algo. when the property is isotropic Initialize the local discrete Hodge op. with the consistency part.

Parameters
[in]n_entnumber of local entities
[in]invcvol1/|c|
[in]ptyvalvalues of property inside this cell
[in]pqpointer to the first set of quantities
[in]dqpointer to the second set of quantities
[in,out]alphageometrical quantity
[in,out]kappageometrical quantity
[in,out]hlocpointer to a cs_sdm_t struct.

◆ _compute_hodge_cost()

static void _compute_hodge_cost ( const int  n_ent,
const double  beta2,
const double  alpha[],
const double  kappa[],
double  hval[] 
)
static

Build a local discrete Hodge operator using the generic COST algo. and cellwise view of the mesh Specific for EpFd Hodge operator COST means COnsistency + STabilization.

Parameters
[in]cmpointer to a cs_cell_mesh_t structure
[in]h_infopointer to a cs_param_hodge_t structure
[in,out]hlocpointer to a cs_sdm_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_compute_wbs_surfacic()

void cs_hodge_compute_wbs_surfacic ( const cs_face_mesh_t fm,
cs_sdm_t *  hf 
)

Compute the hodge operator related to a face (i.e. a mass matrix with unity property) using a Whitney Barycentric Subdivision (WBS) algorithm.

Parameters
[in]fmpointer to a cs_face_mesh_t structure
[in,out]hfpointer to a cs_sdm_t structure to define

◆ cs_hodge_edfp_cost_get()

void cs_hodge_edfp_cost_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using the COST algo. Hodge op. from dual edges to primal faces. This function is related to face-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_edfp_voro_get()

void cs_hodge_edfp_voro_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from dual edges to primal faces. This function is related to face-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_epfd_cost_get()

void cs_hodge_epfd_cost_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using the COST algo. Hodge op. from primal edges to dual faces. This function is specific for vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_epfd_voro_get()

void cs_hodge_epfd_voro_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal edges to dual faces. This function is specific for vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_fb_cost_get_stiffness()

void cs_hodge_fb_cost_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the generic COST algo. The computed matrix is stored in cb->loc Case of CDO face-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_fb_voro_get_stiffness()

void cs_hodge_fb_voro_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the Voronoi algorithm The computed matrix is stored in cb->loc Case of CDO face-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_fped_cost_get()

void cs_hodge_fped_cost_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using the COST algo. Hodge op. from primal faces to dual edges. This function is related to cell-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_fped_voro_get()

void cs_hodge_fped_voro_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal faces to dual edges. This function is related to cell-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_matvec()

void cs_hodge_matvec ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_param_hodge_t  h_info,
const cs_property_t pty,
const double  in_vals[],
double  result[] 
)

Compute cellwise a discrete hodge operator and multiple it with a vector.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]h_infocs_param_hodge_t structure
[in]ptypointer to a cs_property_t structure or NULL
[in]in_valsvector to multiply with the discrete Hodge op.
[in,out]resultarray storing the resulting matrix-vector product

◆ cs_hodge_vb_cost_get_stiffness()

void cs_hodge_vb_cost_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the generic COST algo. Case of CDO vertex-based schemes.

Build a local stiffness matrix using the generic COST algo. The computed matrix is stored in cb->loc Case of CDO vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vb_voro_get_stiffness()

void cs_hodge_vb_voro_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the Voronoi algorithm The computed matrix is stored in cb->loc Case of CDO vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vb_wbs_get_stiffness()

void cs_hodge_vb_wbs_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the generic WBS algo. WBS standing for Whitney Barycentric Subdivision (WBS) algo.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vcb_get_stiffness()

void cs_hodge_vcb_get_stiffness ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local stiffness matrix using the generic WBS algo. WBS standing for Whitney Barycentric Subdivision (WBS) algo. The computed matrix is stored in cb->loc.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t structure
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vcb_wbs_get()

void cs_hodge_vcb_wbs_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using the WBS algo. This function is specific for vertex+cell-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vpcd_voro_get()

void cs_hodge_vpcd_voro_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using VORONOI algo. Hodge op. from primal vertices to dual cells. This function is specific for vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

◆ cs_hodge_vpcd_wbs_get()

void cs_hodge_vpcd_wbs_get ( const cs_param_hodge_t  h_info,
const cs_cell_mesh_t cm,
cs_cell_builder_t cb 
)

Build a local Hodge operator for a given cell using WBS algo. Hodge op. from primal vertices to dual cells. This function is specific for vertex-based schemes.

Parameters
[in]h_infopointer to a cs_param_hodge_t structure
[in]cmpointer to a cs_cell_mesh_t struct.
[in,out]cbpointer to a cs_cell_builder_t structure

Variable Documentation

◆ cs_hodge_vc_coef

const double cs_hodge_vc_coef = 3./20
static

(end ignore by Doxygen)