8.1
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-2023 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 /*----------------------------------------------------------------------------*/
107 /*----------------------------------------------------------------------------*/
108 
109 void
111  cs_flag_t eb_flag,
112  cs_flag_t fb_flag,
113  cs_flag_t cb_flag,
114  cs_flag_t vb_flag,
115  cs_flag_t vcb_flag,
116  cs_flag_t hho_flag);
117 
118 /*----------------------------------------------------------------------------*/
122 /*----------------------------------------------------------------------------*/
123 
124 void
126 
127 /*----------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------*/
136 
137 cs_real_t *
139 
140 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 size_t
150 
151 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
164  cs_lnum_t size);
165 
166 /*----------------------------------------------------------------------------*/
172 /*----------------------------------------------------------------------------*/
173 
174 void
176 
177 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
186 void
188  cs_cdo_balance_t *b);
189 
190 /*----------------------------------------------------------------------------*/
196 /*----------------------------------------------------------------------------*/
197 
198 void
200 
201 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 
212 void
214  cs_xdef_t **defs,
215  cs_lnum_t def2v_idx[],
216  cs_lnum_t def2v_ids[]);
217 
218 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
229 void
231  cs_xdef_t **defs,
232  cs_lnum_t def2e_idx[],
233  cs_lnum_t def2e_ids[]);
234 
235 /*----------------------------------------------------------------------------*/
244 /*----------------------------------------------------------------------------*/
245 
246 void
248  cs_xdef_t **defs,
249  cs_lnum_t def2f_idx[],
250  cs_lnum_t def2f_ids[]);
251 
252 /*----------------------------------------------------------------------------*/
260 /*----------------------------------------------------------------------------*/
261 
262 void
264  int *counter,
265  cs_real_t *values);
266 
267 /*----------------------------------------------------------------------------*/
268 
270 
271 #endif /* __CS_CDO_TOOLBOX_H__ */
size_t cs_cdo_toolbox_get_tmpbuf_size(void)
Get the allocation size of the temporary buffer.
Definition: cs_cdo_toolbox.c:291
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:308
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:733
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:277
void cs_cdo_toolbox_finalize(void)
Free buffers shared among the equations solved with CDO schemes.
Definition: cs_cdo_toolbox.c:251
void cs_cdo_toolbox_init(const cs_cdo_connect_t *connect, cs_flag_t eb_flag, cs_flag_t fb_flag, cs_flag_t cb_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:118
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:528
void cs_cdo_balance_reset(cs_cdo_balance_t *b)
Reset a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.c:345
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:631
void cs_cdo_balance_sync(const cs_cdo_connect_t *connect, cs_cdo_balance_t *b)
Synchronize balance terms if this is a parallel computation.
Definition: cs_cdo_toolbox.c:370
void cs_cdo_balance_destroy(cs_cdo_balance_t **p_balance)
Free a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.c:400
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:425
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
unsigned short int cs_flag_t
Definition: cs_defs.h:321
Definition: cs_cdo_toolbox.h:68
cs_real_t * boundary_term
Definition: cs_cdo_toolbox.h:83
cs_real_t * unsteady_term
Definition: cs_cdo_toolbox.h:78
cs_real_t * advection_term
Definition: cs_cdo_toolbox.h:81
cs_real_t * reaction_term
Definition: cs_cdo_toolbox.h:79
cs_real_t * source_term
Definition: cs_cdo_toolbox.h:82
cs_lnum_t size
Definition: cs_cdo_toolbox.h:73
cs_flag_t location
Definition: cs_cdo_toolbox.h:72
cs_real_t * balance
Definition: cs_cdo_toolbox.h:74
cs_real_t * diffusion_term
Definition: cs_cdo_toolbox.h:80
Definition: cs_cdo_connect.h:61
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:160