7.2
general documentation
cs_cdo_toolbox.h
Go to the documentation of this file.
1 #ifndef __CS_CDO_TOOLBOX_H__
2 #define __CS_CDO_TOOLBOX_H__
3 
4 /*============================================================================
5  * Set of toolbox functions: shared buffer, balance, synchronization
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2022 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_cdo_connect.h"
33 #include "cs_flag.h"
34 #include "cs_xdef.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /* Strategy of synchronization of values shared across several cells
45  * This applies to vertices, edges and faces
46  *
47  * CS_CDO_SYNC_ZERO_VALUE
48  * If zero is a possible value then set this value, otherwise one takes
49  * the mean-value
50  *
51  * CS_CDO_SYNC_MEAN_VALUE
52  * Compute the mean-value across values to set
53  *
54  */
55 
56 #define CS_CDO_SYNC_ZERO_VALUE 1
57 #define CS_CDO_SYNC_MEAN_VALUE 2
58 
59 /*============================================================================
60  * Type definitions
61  *============================================================================*/
62 
63 /*
64  * Structure used to store information generated during the analysis
65  * of the balance of each term of an equation
66  */
67 
68 typedef struct {
69 
70  /* Where the balance is computed: primal vertices or primal cells */
71 
75 
76  /* Balance for each main term */
77 
84 
86 
87 /*============================================================================
88  * Public function prototypes
89  *============================================================================*/
90 
91 /*----------------------------------------------------------------------------*/
106 /*----------------------------------------------------------------------------*/
107 
108 void
110  cs_flag_t eb_flag,
111  cs_flag_t fb_flag,
112  cs_flag_t vb_flag,
113  cs_flag_t vcb_flag,
114  cs_flag_t hho_flag);
115 
116 /*----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------*/
121 
122 void
124 
125 /*----------------------------------------------------------------------------*/
133 /*----------------------------------------------------------------------------*/
134 
135 cs_real_t *
137 
138 /*----------------------------------------------------------------------------*/
144 /*----------------------------------------------------------------------------*/
145 
146 size_t
148 
149 /*----------------------------------------------------------------------------*/
158 /*----------------------------------------------------------------------------*/
159 
162  cs_lnum_t size);
163 
164 /*----------------------------------------------------------------------------*/
170 /*----------------------------------------------------------------------------*/
171 
172 void
174 
175 /*----------------------------------------------------------------------------*/
182 /*----------------------------------------------------------------------------*/
183 
184 void
186  cs_cdo_balance_t *balance);
187 
188 /*----------------------------------------------------------------------------*/
194 /*----------------------------------------------------------------------------*/
195 
196 void
198 
199 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 void
212  cs_xdef_t **defs,
213  cs_lnum_t def2v_idx[],
214  cs_lnum_t def2v_ids[]);
215 
216 /*----------------------------------------------------------------------------*/
225 /*----------------------------------------------------------------------------*/
226 
227 void
229  cs_xdef_t **defs,
230  cs_lnum_t def2e_idx[],
231  cs_lnum_t def2e_ids[]);
232 
233 /*----------------------------------------------------------------------------*/
242 /*----------------------------------------------------------------------------*/
243 
244 void
246  cs_xdef_t **defs,
247  cs_lnum_t def2f_idx[],
248  cs_lnum_t def2f_ids[]);
249 
250 /*----------------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------------*/
259 
260 void
262  int *counter,
263  cs_real_t *values);
264 
265 /*----------------------------------------------------------------------------*/
266 
268 
269 #endif /* __CS_CDO_TOOLBOX_H__ */
void cs_cdo_sync_vol_def_at_faces(int n_defs, cs_xdef_t **defs, cs_lnum_t def2f_idx[], cs_lnum_t def2f_ids[])
Synchronize the volumetric definitions to consider at each face.
Definition: cs_cdo_toolbox.c:617
cs_real_t * source_term
Definition: cs_cdo_toolbox.h:82
cs_real_t * boundary_term
Definition: cs_cdo_toolbox.h:83
void cs_cdo_toolbox_finalize(void)
Free buffers shared among the equations solved with CDO schemes.
Definition: cs_cdo_toolbox.c:241
size_t cs_cdo_toolbox_get_tmpbuf_size(void)
Get the allocation size of the temporary buffer.
Definition: cs_cdo_toolbox.c:277
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_cdo_balance_destroy(cs_cdo_balance_t **p_balance)
Free a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.c:386
Definition: cs_cdo_connect.h:61
cs_real_t * advection_term
Definition: cs_cdo_toolbox.h:81
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
cs_cdo_balance_t * cs_cdo_balance_create(cs_flag_t location, cs_lnum_t size)
Allocate a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.c:294
void cs_cdo_balance_sync(const cs_cdo_connect_t *connect, cs_cdo_balance_t *balance)
Synchronize balance terms if this is a parallel computation.
Definition: cs_cdo_toolbox.c:356
void cs_cdo_toolbox_init(const cs_cdo_connect_t *connect, cs_flag_t eb_flag, cs_flag_t fb_flag, cs_flag_t vb_flag, cs_flag_t vcb_flag, cs_flag_t hho_flag)
Allocate a pointer to a buffer of size at least the n_cells for managing temporary usage of memory wh...
Definition: cs_cdo_toolbox.c:117
cs_real_t * unsteady_term
Definition: cs_cdo_toolbox.h:78
cs_real_t * balance
Definition: cs_cdo_toolbox.h:74
void cs_cdo_balance_reset(cs_cdo_balance_t *b)
Reset a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.c:331
void cs_cdo_sync_vol_def_at_vertices(int n_defs, cs_xdef_t **defs, cs_lnum_t def2v_idx[], cs_lnum_t def2v_ids[])
Synchronize the volumetric definitions to consider at each vertex.
Definition: cs_cdo_toolbox.c:411
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:154
cs_flag_t location
Definition: cs_cdo_toolbox.h:72
void cs_cdo_sync_vertex_mean_values(int dim, int *counter, cs_real_t *values)
Compute the mean-value across ranks at each vertex.
Definition: cs_cdo_toolbox.c:719
cs_real_t * diffusion_term
Definition: cs_cdo_toolbox.h:80
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
Definition: cs_cdo_toolbox.h:68
#define END_C_DECLS
Definition: cs_defs.h:511
unsigned short int cs_flag_t
Definition: cs_defs.h:324
cs_real_t * cs_cdo_toolbox_get_tmpbuf(void)
Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be...
Definition: cs_cdo_toolbox.c:263
cs_real_t * reaction_term
Definition: cs_cdo_toolbox.h:79
cs_lnum_t size
Definition: cs_cdo_toolbox.h:73
void cs_cdo_sync_vol_def_at_edges(int n_defs, cs_xdef_t **defs, cs_lnum_t def2e_idx[], cs_lnum_t def2e_ids[])
Synchronize the volumetric definitions to consider at each edge.
Definition: cs_cdo_toolbox.c:514
double precision, save b
Definition: cs_fuel_incl.f90:146