9.2
general documentation
cs_hho_builder.h
Go to the documentation of this file.
1#ifndef CS_HHO_BUILDER_H
2#define CS_HHO_BUILDER_H
3
4/*============================================================================
5 * Low-level functions and structures used to build the algebraic system with
6 * a cellwise process when Hybrid High Order schemes are set for the space
7 * discretization
8 *============================================================================*/
9
10/*
11 This file is part of code_saturne, a general-purpose CFD tool.
12
13 Copyright (C) 1998-2026 EDF S.A.
14
15 This program is free software; you can redistribute it and/or modify it under
16 the terms of the GNU General Public License as published by the Free Software
17 Foundation; either version 2 of the License, or (at your option) any later
18 version.
19
20 This program is distributed in the hope that it will be useful, but WITHOUT
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23 details.
24
25 You should have received a copy of the GNU General Public License along with
26 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
27 Street, Fifth Floor, Boston, MA 02110-1301, USA.
28*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_base.h"
35#include "cdo/cs_basis_func.h"
36#include "cdo/cs_cdo_connect.h"
37#include "cdo/cs_property.h"
38#include "cdo/cs_sdm.h"
39#include "cdo/cs_xdef.h"
40
41/*============================================================================
42 * Macro definitions
43 *============================================================================*/
44
45/*============================================================================
46 * Type definitions
47 *============================================================================*/
48
49/* Cellwise builder for HHO discretization */
50typedef struct {
51
52 /* Current and maximal number of face basis allocated. This number is equal
53 to the max. number of faces for a cell */
54 short int n_face_basis;
56
57 cs_basis_func_t **face_basis; /* P_(d-1)^k polynomial basis */
58 cs_basis_func_t *cell_basis; /* P_d^k polynomial basis */
59 cs_basis_func_t *grad_basis; /* P_d^(k+1) \ P_d^0 polynomial basis */
60
61 cs_sdm_t *grad_reco_op; /* Gradient operator; Rectangular matrix */
62
63 /* Temporary matrices defined by blocks */
64 cs_sdm_t *tmp; /* Temporary block matrix (fs x ts) */
65 cs_sdm_t *bf_t; /* Transposed of Bf (used in stabilization) */
66 cs_sdm_t *jstab; /* Stabilization part related to a face */
67 cs_sdm_t *hdg; /* Another temporary matrix */
68
70
71/*============================================================================
72 * Public function prototypes
73 *============================================================================*/
74
75/*----------------------------------------------------------------------------*/
84/*----------------------------------------------------------------------------*/
85
87cs_hho_builder_create(int order,
88 int n_fc);
89
90/*----------------------------------------------------------------------------*/
96/*----------------------------------------------------------------------------*/
97
98void
100
101/*----------------------------------------------------------------------------*/
112/*----------------------------------------------------------------------------*/
113
114void
117 cs_hho_builder_t *hhob);
118
119/*----------------------------------------------------------------------------*/
127/*----------------------------------------------------------------------------*/
128
129static inline void
132 cs_hho_builder_t *hhob)
133{
134 if (hhob == NULL)
135 return;
136
137 /* Sanity checks */
138 assert(cm != NULL);
139
140 /* Setup cell basis functions */
141 hhob->cell_basis->setup(hhob->cell_basis, cm, 0, cm->xc, cb);
142 hhob->n_face_basis = 0;
143}
144
145/*----------------------------------------------------------------------------*/
158/*----------------------------------------------------------------------------*/
159
160void
162 const cs_property_data_t *diff_pty,
164 cs_hho_builder_t *hhob);
165
166/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
178void
180 const cs_property_data_t *diff_pty,
182 cs_hho_builder_t *hhob);
183
184/*----------------------------------------------------------------------------*/
198/*----------------------------------------------------------------------------*/
199
200void
202 const cs_cell_mesh_t *cm,
203 cs_real_t t_eval,
205 cs_hho_builder_t *hhob,
206 cs_real_t red[]);
207
208/*----------------------------------------------------------------------------*/
224/*----------------------------------------------------------------------------*/
225
226void
228 const cs_cell_mesh_t *cm,
229 cs_real_t t_eval,
231 cs_hho_builder_t *hhob,
232 cs_real_t red[]);
233
234/*----------------------------------------------------------------------------*/
247/*----------------------------------------------------------------------------*/
248
249void
251 short int f,
252 const cs_cell_mesh_t *cm,
253 cs_real_t t_eval,
255 cs_hho_builder_t *hhob,
256 cs_real_t res[]);
257
258/*----------------------------------------------------------------------------*/
271/*----------------------------------------------------------------------------*/
272
273void
275 short int f,
276 const cs_cell_mesh_t *cm,
277 cs_real_t t_eval,
279 cs_hho_builder_t *hhob,
280 cs_real_t res[]);
281
282#endif /* CS_HHO_BUILDER_H */
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
void cs_hho_builder_free(cs_hho_builder_t **p_builder)
Free a cs_hho_builder_t structure.
Definition: cs_hho_builder.cpp:819
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....
Definition: cs_hho_builder.cpp:1962
void cs_hho_builder_compute_grad_reco(const cs_cell_mesh_t *cm, const cs_property_data_t *diff_pty, 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...
Definition: cs_hho_builder.cpp:912
static void cs_hho_builder_cellbasis_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 only.
Definition: cs_hho_builder.h:130
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.
Definition: cs_hho_builder.cpp:1834
void cs_hho_builder_diffusion(const cs_cell_mesh_t *cm, const cs_property_data_t *diff_pty, 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...
Definition: cs_hho_builder.cpp:1152
cs_hho_builder_t * cs_hho_builder_create(int order, int n_fc)
Allocate a cs_hho_builder_t structure.
Definition: cs_hho_builder.cpp:749
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 analyti...
Definition: cs_hho_builder.cpp:1455
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 analyti...
Definition: cs_hho_builder.cpp:1629
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....
Definition: cs_hho_builder.cpp:861
Definition: cs_basis_func.h:177
cs_basis_func_setup_t * setup
Definition: cs_basis_func.h:195
Set of local and temporary buffers.
Definition: cs_cdo_local.h:56
Set of local quantities and connectivities related to a mesh cell.
Definition: cs_cdo_local.h:242
cs_real_3_t xc
Definition: cs_cdo_local.h:256
Definition: cs_hho_builder.h:50
cs_sdm_t * tmp
Definition: cs_hho_builder.h:64
cs_basis_func_t ** face_basis
Definition: cs_hho_builder.h:57
cs_basis_func_t * grad_basis
Definition: cs_hho_builder.h:59
short int n_max_face_basis
Definition: cs_hho_builder.h:55
short int n_face_basis
Definition: cs_hho_builder.h:54
cs_sdm_t * hdg
Definition: cs_hho_builder.h:67
cs_basis_func_t * cell_basis
Definition: cs_hho_builder.h:58
cs_sdm_t * grad_reco_op
Definition: cs_hho_builder.h:61
cs_sdm_t * jstab
Definition: cs_hho_builder.h:66
cs_sdm_t * bf_t
Definition: cs_hho_builder.h:65
Structure storing the evaluation of a property and its related data.
Definition: cs_property.h:219
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:156