9.2
general documentation
cs_param_cdo.h
Go to the documentation of this file.
1#ifndef CS_PARAM_CDO_H
2#define CS_PARAM_CDO_H
3
4/*============================================================================
5 * High-level metadata related to CDO/HHO schemes
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_defs.h"
35
36/*============================================================================
37 * Macro definitions
38 *============================================================================*/
39
40/* Same mechanism as the one used in PETSC_DEFAULT */
41
42#define CS_CDO_KEEP_DEFAULT -2
43
44/* Specifications for OpenMP loops/sections */
45
46#define CS_CDO_OMP_CHUNK_SIZE 128
47#define CS_CDO_OMP_SCHEDULE schedule(static, CS_CDO_OMP_CHUNK_SIZE)
48#define CS_CDO_OMP_SYNC_MODE 0 /* > 0 --> critical sections otherwise
49 * atomic sections is used */
50
51/* Avoid issues with assert in some OpenMp contructs using gcc 9 */
52
53#if defined(HAVE_OPENMP) && defined(__GNUC__)
54 #if __GNUC__ == 9
55 #define CS_CDO_OMP_ASSERT(e)
56 #else
57 #define CS_CDO_OMP_ASSERT(e) assert(e)
58 #endif
59#else
60 #define CS_CDO_OMP_ASSERT(e) assert(e)
61#endif
62
63/* The following limitation only results from an optimization in the size of
64 the bit mask (can be changed if needed by changing the definition of
65 the type cs_mask_t)
66 Here is the max. number of reaction terms allowed in an equation */
68#define CS_CDO_N_MAX_REACTIONS 8
70#define CS_ALL_FACES 0 /* All faces: interior + border */
71#define CS_BND_FACES 1 /* Boundary faces */
72#define CS_INT_FACES 2 /* Interior faces */
73
74/* HHO specific part:
75 *
76 * Number of DoFs on faces and cells according to the polynomial space
77 */
79#define CS_N_DOFS_FACE_0TH 1
80#define CS_N_DOFS_FACE_1ST 3
81#define CS_N_DOFS_FACE_2ND 6
83#define CS_N_DOFS_CELL_0TH 1
84#define CS_N_DOFS_CELL_1ST 4
85#define CS_N_DOFS_CELL_2ND 10
86
87/*============================================================================
88 * Type definitions
89 *============================================================================*/
91typedef enum {
93 CS_PARAM_CDO_MODE_OFF = -1, /* CDO schemes are not used */
94 CS_PARAM_CDO_MODE_WITH_FV = 1, /* CDO and legacy FV schemes are used */
95 CS_PARAM_CDO_MODE_NS_WITH_FV = 2, /* CDO schemes activated for NSE and
96 legacy FV schemes for other
97 equations */
98 CS_PARAM_CDO_MODE_ONLY = 3 /* Only CDO schemes are used */
101
102/*============================================================================
103 * Global variables
104 *============================================================================*/
105
107
108/*============================================================================
109 * Public function prototypes
110 *============================================================================*/
111
112/*----------------------------------------------------------------------------*/
117/*----------------------------------------------------------------------------*/
118
119void
121
122/*----------------------------------------------------------------------------*/
128/*----------------------------------------------------------------------------*/
129
132
133/*----------------------------------------------------------------------------*/
137/*----------------------------------------------------------------------------*/
138
139void
140cs_param_cdo_log(void);
141
142/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148void
150
151/*----------------------------------------------------------------------------*/
155/*----------------------------------------------------------------------------*/
156
157bool
159
160/*----------------------------------------------------------------------------*/
164/*----------------------------------------------------------------------------*/
165
166bool
168
169/*----------------------------------------------------------------------------*/
173/*----------------------------------------------------------------------------*/
174
175bool
177
178/*----------------------------------------------------------------------------*/
182/*----------------------------------------------------------------------------*/
183
184bool
186
187/*----------------------------------------------------------------------------*/
191/*----------------------------------------------------------------------------*/
192
193bool
195
196/*----------------------------------------------------------------------------*/
200/*----------------------------------------------------------------------------*/
201
202bool
204
205/*----------------------------------------------------------------------------*/
209/*----------------------------------------------------------------------------*/
210
211bool
213
214#endif /* CS_PARAM_CDO_H */
bool cs_param_cdo_has_cdo_only(void)
Tell if CDO is only used.
Definition: cs_param_cdo.cpp:251
bool cs_param_cdo_has_cdo_and_fv(void)
Tell if FVM and CDO are used.
Definition: cs_param_cdo.cpp:234
bool cs_param_cdo_has_cdo(void)
Tell if CDO is used.
Definition: cs_param_cdo.cpp:287
void cs_param_cdo_log(void)
Print a welcome message indicating what is the current CDO status.
Definition: cs_param_cdo.cpp:111
bool cs_param_cdo_has_cdo_main(void)
Tell if CDO is used to solve main equations.
Definition: cs_param_cdo.cpp:217
bool cs_param_cdo_has_fv_only(void)
Tell if FVM is oly used.
Definition: cs_param_cdo.cpp:275
cs_param_cdo_mode_t
Definition: cs_param_cdo.h:90
@ CS_PARAM_CDO_MODE_ONLY
Definition: cs_param_cdo.h:97
@ CS_PARAM_CDO_MODE_OFF
Definition: cs_param_cdo.h:92
@ CS_PARAM_CDO_MODE_NS_WITH_FV
Definition: cs_param_cdo.h:94
@ CS_PARAM_CDO_MODE_WITH_FV
Definition: cs_param_cdo.h:93
cs_param_cdo_mode_t cs_glob_param_cdo_mode
bool cs_param_cdo_has_fv_main(void)
Tell if FVM is used to solve main equations.
Definition: cs_param_cdo.cpp:200
void cs_param_cdo_setup_log(void)
Print generic parameters used with CDO/HHO schemes.
Definition: cs_param_cdo.cpp:151
bool cs_param_cdo_has_NS_with_fv(void)
Tell if CDO is only used.
Definition: cs_param_cdo.cpp:263
cs_param_cdo_mode_t cs_param_cdo_mode_get(void)
Get the mode of activation for the CDO/HHO schemes.
Definition: cs_param_cdo.cpp:99
void cs_param_cdo_mode_set(cs_param_cdo_mode_t mode)
Set the global variable storing the mode of activation to apply to CDO/HHO schemes.
Definition: cs_param_cdo.cpp:85