8.3
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-2024 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
68typedef 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/*----------------------------------------------------------------------------*/
108/*----------------------------------------------------------------------------*/
109
110void cs_cdo_toolbox_init(const cs_cdo_connect_t *connect,
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 cs_flag_t mac_flag);
118
119/*----------------------------------------------------------------------------*/
123/*----------------------------------------------------------------------------*/
124
125void
127
128/*----------------------------------------------------------------------------*/
136/*----------------------------------------------------------------------------*/
137
138cs_real_t *
140
141/*----------------------------------------------------------------------------*/
147/*----------------------------------------------------------------------------*/
148
149size_t
151
152/*----------------------------------------------------------------------------*/
161/*----------------------------------------------------------------------------*/
162
165 cs_lnum_t size);
166
167/*----------------------------------------------------------------------------*/
173/*----------------------------------------------------------------------------*/
174
175void
177
178/*----------------------------------------------------------------------------*/
185/*----------------------------------------------------------------------------*/
186
187void
190
191/*----------------------------------------------------------------------------*/
197/*----------------------------------------------------------------------------*/
198
199void
201
202/*----------------------------------------------------------------------------*/
211/*----------------------------------------------------------------------------*/
212
213void
215 cs_xdef_t **defs,
216 cs_lnum_t def2v_idx[],
217 cs_lnum_t def2v_ids[]);
218
219/*----------------------------------------------------------------------------*/
228/*----------------------------------------------------------------------------*/
229
230void
232 cs_xdef_t **defs,
233 cs_lnum_t def2e_idx[],
234 cs_lnum_t def2e_ids[]);
235
236/*----------------------------------------------------------------------------*/
245/*----------------------------------------------------------------------------*/
246
247void
249 cs_xdef_t **defs,
250 cs_lnum_t def2f_idx[],
251 cs_lnum_t def2f_ids[]);
252
253/*----------------------------------------------------------------------------*/
261/*----------------------------------------------------------------------------*/
262
263void
265 int *counter,
266 cs_real_t *values);
267
268/*----------------------------------------------------------------------------*/
269
271
272#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.cpp:302
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.cpp:741
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, cs_flag_t mac_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.cpp:118
void cs_cdo_toolbox_finalize(void)
Free buffers shared among the equations solved with CDO schemes.
Definition: cs_cdo_toolbox.cpp:258
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.cpp:538
void cs_cdo_balance_reset(cs_cdo_balance_t *b)
Reset a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.cpp:356
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.cpp:640
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.cpp:381
void cs_cdo_balance_destroy(cs_cdo_balance_t **p_balance)
Free a cs_cdo_balance_t structure.
Definition: cs_cdo_toolbox.cpp:411
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.cpp:436
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.cpp:288
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.cpp:319
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
unsigned short int cs_flag_t
Definition: cs_defs.h:344
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