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