9.2
general documentation
cs_sat_coupling.h
Go to the documentation of this file.
1#ifndef CS_SAT_COUPLING_H
2#define CS_SAT_COUPLING_H
3
4/*============================================================================
5 * Functions associated with code coupling.
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 * Standard C library headers
32 *----------------------------------------------------------------------------*/
33
34/*----------------------------------------------------------------------------
35 * Local headers
36 *----------------------------------------------------------------------------*/
37
38#include "fvm/fvm_defs.h"
39#include "fvm/fvm_nodal.h"
40
41#include "base/cs_base.h"
42
43/*============================================================================
44 * Global variables
45 *============================================================================*/
46
48
49/*=============================================================================
50 * Type Definitions
51 *============================================================================*/
52
53typedef struct _cs_sat_coupling_t cs_sat_coupling_t;
54
55/*----------------------------------------------------------------------------
56 * Function pointer to mesh tagging function.
57 *
58 * Each function of this sort may be used to tag a mesh and associated
59 * points for mocatin exclusion.
60 *
61 * Note: if the context pointer is non-null, it must point to valid data
62 * when the selection function is called, so that value or structure
63 * should not be temporary (i.e. local);
64 *
65 * parameters:
66 * context <-> pointer to optional (untyped) value or structure.
67 * mesh <-> nodal mesh which should be tagged
68 * n_points <-- number of points to tag
69 * point_list_base <-- base numbering for point_list
70 * point_list <-- optional indirection for points
71 * point_tag --> point tag values (size: n_tags)
72 *----------------------------------------------------------------------------*/
73
74typedef void
75(cs_sat_coupling_tag_t) (void *context,
76 fvm_nodal_t *mesh,
77 cs_lnum_t n_points,
78 cs_lnum_t point_list_base,
79 const cs_lnum_t point_list[],
80 int *point_tag);
81
82/*============================================================================
83 * Public function prototypes
84 *============================================================================*/
85
86/*----------------------------------------------------------------------------*/
108/*----------------------------------------------------------------------------*/
109
110void
111cs_sat_coupling_define(const char *saturne_name,
112 const char *boundary_cpl_criteria,
113 const char *volume_cpl_criteria,
114 const char *boundary_loc_criteria,
115 const char *volume_loc_criteria,
116 int reverse,
117 int verbosity);
118
119/*----------------------------------------------------------------------------
120 * Get number of code_saturne couplings.
121 *
122 * returns:
123 * number of code_saturne couplings
124 *----------------------------------------------------------------------------*/
125
126int
128
129/*----------------------------------------------------------------------------
130 * Get pointer to code_saturne coupling.
131 *
132 * parameters:
133 * coupling_id <-- Id (0 to n-1) of code_saturne coupling
134 *
135 * returns:
136 * pointer to code_saturne coupling structure
137 *----------------------------------------------------------------------------*/
138
140cs_sat_coupling_by_id(int coupling_id);
141
142/*----------------------------------------------------------------------------
143 * Create a sat_coupling_t structure.
144 *
145 * parameters:
146 * ref_axis <-- reference axis
147 * face_sel_criterion <-- criterion for selection of boundary faces
148 * cell_sel_criterion <-- criterion for selection of cells
149 * sat_name <-- code_saturne application name
150 * reverse <-- reverse mode if 1
151 * verbosity <-- verbosity level
152 *----------------------------------------------------------------------------*/
153
154void
155cs_sat_coupling_add(const char *face_cpl_sel_c,
156 const char *cell_cpl_sel_c,
157 const char *face_loc_sel_c,
158 const char *cell_loc_sel_c,
159 const char *sat_name,
160 int reverse,
161 int verbosity);
162
163/*----------------------------------------------------------------------------
164 * Create a new internal code_saturne coupling.
165 *
166 * arguments:
167 * tag_func <-- pointer to tagging function
168 * tag_context <-- pointer to tagging function context
169 * boundary_criteria <-- boundary face selection criteria, or NULL
170 * volume_criteria <-- volume cell selection criteria, or NULL
171 * loc_tolerance <-- location tolerance factor (0.1 recommended)
172 * reverse <-- reverse mode if 1
173 * verbosity <-- verbosity level
174 *----------------------------------------------------------------------------*/
175
176void
178 void *tag_context,
179 const char *boundary_cpl_criteria,
180 const char *volume_cpl_criteria,
181 const char *boundary_loc_criteria,
182 const char *volume_loc_criteria,
183 float loc_tolerance,
184 int reverse,
185 int verbosity);
186
187/*----------------------------------------------------------------------------
188 * Initialize code_saturne couplings.
189 *
190 * This function may be called once all couplings have been defined,
191 * and it will match defined couplings with available applications.
192 *----------------------------------------------------------------------------*/
193
194void
196
197/*----------------------------------------------------------------------------
198 * Array of reals exchange, associated to a given coupling.
199 *
200 * It is assumed that the arrays have the same size and the same values on
201 * each group of processes (local and distant).
202 *
203 * int cpl_id : --> : coupling id (0-based)
204 * int nbrdis : --> : number of values to send
205 * int nbrloc : --> : number of values to receive
206 * cs_real_t vardis : --> : distant values (to send)
207 * cs_real_t varloc : <-- : local values (to receive)
208 *----------------------------------------------------------------------------*/
209
210void
212 cs_lnum_t nbrdis,
213 cs_lnum_t nbrloc,
214 cs_real_t *vardis,
215 cs_real_t *varloc);
216
217/*----------------------------------------------------------------------------*/
218/*
219 * code_saturne/code_saturne coupling using volumic source terms.
220 */
221/*----------------------------------------------------------------------------*/
222
223void
225(
226 cs_field_t *f,
227 cs_real_t *rhs,
228 cs_real_t *fimp
229);
230
231/*----------------------------------------------------------------------------*/
232/*
233 * code_saturne/code_saturne boundary coupling initialization call
234 */
235/*----------------------------------------------------------------------------*/
236
237void
239(
240 int *bc_type
241);
242
243/*----------------------------------------------------------------------------*/
244/*
245 * Initialization of main variables for code_saturne/code_saturne coupling
246 */
247/*----------------------------------------------------------------------------*/
248
249void
251(
252 void
253);
254
255/*----------------------------------------------------------------------------*/
256/*
257 * Set the list of cells and boundary faces associated to a coupling
258 * and a cloud of point.
259 *
260 * The local "support" cells and boundary faces are used to locate
261 * the values in the distant "coupled" cells and faces.
262 * Depending on the role of sender and/or receiver of the current process
263 * in the coupling, some of these sets can be empty or not.
264 *
265 * The cell values are always located and interpolated on the distant
266 * "cells" support. The face values are located and interpolated on
267 * the distant "face" support if present, or on the distant "cell" support
268 * if not.
269 *
270 * If the input arrays LCESUP and LFBSUP are not ordered, they will be
271 * orderd in output.
272 */
273/*----------------------------------------------------------------------------*/
274
275void
277(
278 void
279);
280
281/*----------------------------------------------------------------------------*/
282/*
283 * code_saturne/code_saturne coupling using boundary conditions
284 */
285/*----------------------------------------------------------------------------*/
286
287void
289(
290 int *bc_type,
291 cs_real_t *dt
292);
293
294/*----------------------------------------------------------------------------
295 * Destroy all couplings
296 *----------------------------------------------------------------------------*/
297
298void
300
301/*----------------------------------------------------------------------------*/
302
303#endif /* CS_COUPLAGE_H */
Field descriptor.
Definition: cs_field.h:275
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
@ dt
Definition: cs_field_pointer.h:61
int cs_glob_sat_coupling_face_interpolation_type
void cs_sat_coupling_initialize(void)
Initialization of main variables for code_saturne/code_saturne coupling.
Definition: cs_sat_coupling.cpp:1977
void cs_sat_coupling_array_exchange(int cpl_id, cs_lnum_t nbrdis, cs_lnum_t nbrloc, cs_real_t *vardis, cs_real_t *varloc)
Definition: cs_sat_coupling.cpp:2492
void cs_sat_coupling_define(const char *saturne_name, const char *boundary_cpl_criteria, const char *volume_cpl_criteria, const char *boundary_loc_criteria, const char *volume_loc_criteria, int reverse, int verbosity)
Define new code_saturne coupling.
Definition: cs_sat_coupling.cpp:1844
void cs_sat_coupling_bnd_initialize(int *bc_type)
code_saturne/code_saturne boundary coupling initialization call
Definition: cs_sat_coupling.cpp:2791
void cs_sat_coupling_all_finalize(void)
Definition: cs_sat_coupling.cpp:2997
void cs_sat_coupling_exchange_at_cells(cs_field_t *f, cs_real_t *rhs, cs_real_t *fimp)
code_saturne/code_saturne coupling using volumic source terms.
Definition: cs_sat_coupling.cpp:2554
void cs_sat_coupling_add(const char *face_cpl_sel_c, const char *cell_cpl_sel_c, const char *face_loc_sel_c, const char *cell_loc_sel_c, const char *sat_name, int reverse, int verbosity)
Definition: cs_sat_coupling.cpp:2342
int cs_sat_coupling_n_couplings(void)
Definition: cs_sat_coupling.cpp:1908
struct _cs_sat_coupling_t cs_sat_coupling_t
Definition: cs_sat_coupling.h:53
void() cs_sat_coupling_tag_t(void *context, fvm_nodal_t *mesh, cs_lnum_t n_points, cs_lnum_t point_list_base, const cs_lnum_t point_list[], int *point_tag)
Definition: cs_sat_coupling.h:75
cs_sat_coupling_t * cs_sat_coupling_by_id(int coupling_id)
Definition: cs_sat_coupling.cpp:1924
void cs_sat_coupling_add_internal(cs_sat_coupling_tag_t *tag_func, void *tag_context, const char *boundary_cpl_criteria, const char *volume_cpl_criteria, const char *boundary_loc_criteria, const char *volume_loc_criteria, float loc_tolerance, int reverse, int verbosity)
Definition: cs_sat_coupling.cpp:2443
void cs_sat_coupling_all_init(void)
Definition: cs_sat_coupling.cpp:1943
void cs_sat_coupling_locate_all(void)
Set the list of cells and boundary faces associated to a coupling and a cloud of point.
Definition: cs_sat_coupling.cpp:2076
void cs_sat_coupling_exchange_at_bnd_faces(int *bc_type, cs_real_t *dt)
code_saturne/code_saturne coupling using boundary conditions
Definition: cs_sat_coupling.cpp:2863
Definition: mesh.f90:26