My Project
programmer's documentation
Loading...
Searching...
No Matches
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-2019 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 * Type Definitions
49 *============================================================================*/
50
51typedef struct _cs_sat_coupling_t cs_sat_coupling_t;
52
53/*----------------------------------------------------------------------------
54 * Function pointer to mesh tagging function.
55 *
56 * Each function of this sort may be used to tag a mesh and associated
57 * points for mocatin exclusion.
58 *
59 * Note: if the context pointer is non-NULL, it must point to valid data
60 * when the selection function is called, so that value or structure
61 * should not be temporary (i.e. local);
62 *
63 * parameters:
64 * context <-> pointer to optional (untyped) value or structure.
65 * mesh <-> nodal mesh which should be tagged
66 * n_points <-- number of points to tag
67 * point_list_base <-- base numbering for point_list
68 * point_list <-- optional indirection for points
69 * point_tag --> point tag values (size: n_tags)
70 *----------------------------------------------------------------------------*/
71
72typedef void
73(cs_sat_coupling_tag_t) (void *context,
74 fvm_nodal_t *mesh,
75 cs_lnum_t n_points,
76 cs_lnum_t point_list_base,
77 const cs_lnum_t point_list[],
78 int *point_tag);
79
80/*============================================================================
81 * Public function prototypes for Fortran API
82 *============================================================================*/
83
84/*----------------------------------------------------------------------------
85 * Get number of code coupling
86 *
87 * Fortran interface:
88 *
89 * SUBROUTINE NBCCPL
90 * *****************
91 *
92 * INTEGER NBRCPL : <-- : number of code couplings
93 *----------------------------------------------------------------------------*/
94
95void CS_PROCF (nbccpl, NBCCPL)
96(
97 cs_int_t *nbrcpl
98);
99
100/*----------------------------------------------------------------------------
101 * Set the list of cells and boundary faces associated to a coupling
102 * and a cloud of point.
103 *
104 * The local "support" cells and boundary faces are used to localize
105 * the values in the distant "coupled" cells and faces.
106 * Depending on the role of sender and/or receiver of the current process
107 * in the coupling, some of these sets can be empty or not.
108 *
109 * The cell values are always localized and interpolated on the distant
110 * "cells" support. The face values are localized and interpolated on
111 * the distant "face" support if present, or on the distant "cell" support
112 * if not.
113 *
114 * If the input arrays LCESUP and LFBSUP are not ordered, they will be
115 * orderd in output.
116 *
117 * Fortran interface:
118 *
119 * SUBROUTINE DEFCPL
120 * *****************
121 *
122 * INTEGER NUMCPL : --> : coupling number
123 *----------------------------------------------------------------------------*/
124
125void CS_PROCF (defloc, DEFLOC)
126(
127 const cs_int_t *numcpl
128);
129
130/*----------------------------------------------------------------------------
131 * Get the number of cells and boundary faces, "support", coupled and not
132 * localized associated to a given coupling
133 *
134 * Fortran interface:
135 *
136 * SUBROUTINE NBECPL
137 * *****************
138 *
139 * INTEGER NUMCPL : --> : coupling number
140 * INTEGER NCESUP : <-- : number of "support" cells
141 * INTEGER NFBSUP : <-- : number of "support" boundary faces
142 * INTEGER NCECPL : <-- : number of coupled cells
143 * INTEGER NFBCPL : <-- : number of coupled boundary faces
144 * INTEGER NCENCP : <-- : number of not coupled cells
145 * : : (since not localized)
146 * INTEGER NFBNCP : <-- : number of not coupled boundary faces
147 * : : (since not localized)
148 *----------------------------------------------------------------------------*/
149
150void CS_PROCF (nbecpl, NBECPL)
151(
152 const cs_int_t *numcpl,
153 cs_int_t *ncesup,
154 cs_int_t *nfbsup,
155 cs_int_t *ncecpl,
156 cs_int_t *nfbcpl,
157 cs_int_t *ncencp,
158 cs_int_t *nfbncp
159);
160
161/*----------------------------------------------------------------------------
162 * Get the lists of coupled cells and boundary faces (i.e. receiving)
163 * associated to a given coupling
164 *
165 * The number of cells and boundary faces, got with NBECPL(), are used
166 * for arguments coherency checks.
167 *
168 * Fortran interface:
169 *
170 * SUBROUTINE LELCPL
171 * *****************
172 *
173 * INTEGER NUMCPL : --> : coupling number
174 * INTEGER NCECPL : --> : number of coupled cells
175 * INTEGER NFBCPL : --> : number of coupled boundary faces
176 * INTEGER LCECPL(*) : <-- : list of coupled cells
177 * INTEGER LFBCPL(*) : <-- : list of coupled boundary faces
178 *----------------------------------------------------------------------------*/
179
180void CS_PROCF (lelcpl, LELCPL)
181(
182 const cs_int_t *numcpl,
183 const cs_int_t *ncecpl,
184 const cs_int_t *nfbcpl,
185 cs_int_t *lcecpl,
186 cs_int_t *lfbcpl
187);
188
189/*----------------------------------------------------------------------------
190 * Get the lists of not coupled cells and boundary faces (i.e. receiving but
191 * not localized) associated to a given coupling
192 *
193 * The number of cells and boundary faces, got with NBECPL(), are used
194 * for arguments coherency checks.
195 *
196 * Fortran interface:
197 *
198 * SUBROUTINE LENCPL
199 * *****************
200 *
201 * INTEGER NUMCPL : --> : coupling number
202 * INTEGER NCENCP : --> : number of not coupled cells
203 * INTEGER NFBNCP : --> : number of not coupled boundary faces
204 * INTEGER LCENCP(*) : <-- : list of not coupled cells
205 * INTEGER LFBNCP(*) : <-- : list of not coupled boundary faces
206 *----------------------------------------------------------------------------*/
207
208void CS_PROCF (lencpl, LENCPL)
209(
210 const cs_int_t *numcpl,
211 const cs_int_t *ncencp,
212 const cs_int_t *nfbncp,
213 cs_int_t *lcencp,
214 cs_int_t *lfbncp
215);
216
217/*----------------------------------------------------------------------------
218 * Get the number of distant point associated to a given coupling
219 * and localized on the local domain
220 *
221 * Fortran interface:
222 *
223 * SUBROUTINE NPDCPL
224 * *****************
225 *
226 * INTEGER NUMCPL : --> : coupling number
227 * INTEGER NCEDIS : <-- : number of distant cells
228 * INTEGER NFBDIS : <-- : numbre de distant boundary faces
229 *----------------------------------------------------------------------------*/
230
231void CS_PROCF (npdcpl, NPDCPL)
232(
233 const cs_int_t *numcpl,
234 cs_int_t *ncedis,
235 cs_int_t *nfbdis
236);
237
238/*----------------------------------------------------------------------------
239 * Get the distant points coordinates associated to a given coupling
240 * and a list of points, and the elements number and type (cell or face)
241 * "containing" this points.
242 *
243 * The number of distant points NBRPTS must be equal to one the arguments
244 * NCEDIS or NFBDIS given by NPDCPL(), and is given here for coherency checks
245 * between the arguments NUMCPL and ITYSUP.
246 *
247 * Fortran interface:
248 *
249 * SUBROUTINE COOCPL
250 * *****************
251 *
252 * INTEGER NUMCPL : --> : coupling number
253 * INTEGER NBRPTS : --> : number of distant points
254 * INTEGER ITYDIS : --> : 1 : access to the points associated
255 * : : to the distant cells
256 * : : 2 : access to the points associated
257 * : : to the distant boundary faces
258 * INTEGER ITYLOC : <-- : 1 : localization on the local cells
259 * : : 2 : localization on the local faces
260 * INTEGER LOCPTS(*) : <-- : "containing" number associated to
261 * : : each point
262 * DOUBLE PRECISION COOPTS(3,*) : <-- : distant point coordinates
263 *----------------------------------------------------------------------------*/
264
265void CS_PROCF (coocpl, COOCPL)
266(
267 const cs_int_t *numcpl,
268 const cs_int_t *nbrpts,
269 const cs_int_t *itydis,
270 cs_int_t *ityloc,
271 cs_int_t *locpts,
272 cs_real_t *coopts,
273 cs_real_t *djppts,
274 cs_real_t *dofpts,
275 cs_real_t *pndpts
276);
277
278/*----------------------------------------------------------------------------
279 * Get the weighting coefficient needed for a centered-like interpolation
280 * in the case of a coupling on boundary faces.
281 *
282 * Fortran interface:
283 *
284 * SUBROUTINE PONDCP
285 * *****************
286 *
287 * INTEGER NUMCPL : --> : coupling number
288 * INTEGER NBRCPL : --> : number of distant points
289 * INTEGER ITYLOC : <-- : 1 : localization on the local cells
290 * : : 2 : localization on the local faces
291 * DOUBLE PRECISION pndcpl(*) : <-- : weighting coefficients
292 *----------------------------------------------------------------------------*/
293
294void CS_PROCF (pondcp, PONDCP)
295(
296 const cs_int_t *numcpl,
297 const cs_int_t *nbrcpl,
298 cs_int_t *ityloc,
299 cs_real_t *pndcpl,
300 cs_real_t *distof
301);
302
303/*----------------------------------------------------------------------------
304 * Exchange a variable associated to a set of point and a coupling.
305 *
306 * Fortran interface:
307 *
308 * SUBROUTINE VARCPL
309 * *****************
310 *
311 * INTEGER NUMCPL : --> : coupling number
312 * INTEGER NBRDIS : --> : number of values to send
313 * INTEGER NBRLOC : --> : number of values to receive
314 * INTEGER ITYVAR : --> : 1 : variables defined at cells
315 * : : 2 : variables defined at faces
316 * INTEGER STRIDE : --> : 1 : for scalars
317 * : : 3 : for vectors
318 * DOUBLE PRECISION VARDIS(*) : --> : distant variable(to send)
319 * DOUBLE PRECISION VARLOC(*) : <-- : local variable (to receive)
320 *----------------------------------------------------------------------------*/
321
322void CS_PROCF (varcpl, VARCPL)
323(
324 const cs_int_t *numcpl,
325 const cs_int_t *nbrdis,
326 const cs_int_t *nbrloc,
327 const cs_int_t *ityvar,
328 const cs_int_t *stride,
329 cs_real_t *vardis,
330 cs_real_t *varloc
331);
332
333/*----------------------------------------------------------------------------
334 * Array of integers exchange, associated to a given coupling.
335 *
336 * It is assumed that the arrays have the same size and the same values on
337 * each group of processus (local and distant).
338 *
339 * Fortran interface:
340 *
341 * SUBROUTINE TBICPL
342 * *****************
343 *
344 * INTEGER NUMCPL : --> : coupling number
345 * INTEGER NBRDIS : --> : number of values to send
346 * INTEGER NBRLOC : --> : number of values to receive
347 * INTEGER TABDIS(*) : --> : distant values (to send)
348 * INTEGER TABLOC(*) : <-- : local values (to receive)
349 *----------------------------------------------------------------------------*/
350
351void CS_PROCF (tbicpl, TBICPL)
352(
353 const cs_int_t *numcpl,
354 const cs_int_t *nbrdis,
355 const cs_int_t *nbrloc,
356 cs_int_t *vardis,
357 cs_int_t *varloc
358);
359
360/*----------------------------------------------------------------------------
361 * Array of reals exchange, associated to a given coupling.
362 *
363 * It is assumed that the arrays have the same size and the same values on
364 * each group of processus (local and distant).
365 *
366 * Fortran interface:
367 *
368 * SUBROUTINE TBRCPL
369 * *****************
370 *
371 * INTEGER NUMCPL : --> : coupling number
372 * INTEGER NBRDIS : --> : number of values to send
373 * INTEGER NBRLOC : --> : number of values to receive
374 * DOUBLE PRECISION TABDIS(*) : --> : distant values (to send)
375 * DOUBLE PRECISION TABLOC(*) : <-- : local values (to receive)
376 *----------------------------------------------------------------------------*/
377
378void CS_PROCF (tbrcpl, TBRCPL)
379(
380 const cs_int_t *numcpl,
381 const cs_int_t *nbrdis,
382 const cs_int_t *nbrloc,
383 cs_real_t *vardis,
384 cs_real_t *varloc
385);
386
387/*----------------------------------------------------------------------------
388 * Compute the maximum value of an integer variable associated to a coupling.
389 *
390 * It is assumed that the integer value is the same for each group of
391 * processus (local and distant).
392 *
393 * Fortran interface:
394 *
395 * SUBROUTINE MXICPL
396 * *****************
397 *
398 * INTEGER NUMCPL : --> : coupling number
399 * INTEGER VALDIS : --> : distant value (to send)
400 * INTEGER VALMAX : <-- : local maximum (to receive)
401 *----------------------------------------------------------------------------*/
402
403void CS_PROCF (mxicpl, MXICPL)
404(
405 const cs_int_t *const numcpl,
406 cs_int_t *const vardis,
407 cs_int_t *const varmax
408);
409
410/*============================================================================
411 * Public function prototypes
412 *============================================================================*/
413
414/*----------------------------------------------------------------------------*/
435/*----------------------------------------------------------------------------*/
436
437void
438cs_sat_coupling_define(const char *saturne_name,
439 const char *boundary_cpl_criteria,
440 const char *volume_cpl_criteria,
441 const char *boundary_loc_criteria,
442 const char *volume_loc_criteria,
443 int verbosity);
444
445/*----------------------------------------------------------------------------
446 * Get number of Code_Saturne couplings.
447 *
448 * returns:
449 * number of Code_Saturne couplings
450 *----------------------------------------------------------------------------*/
451
452int
454
455/*----------------------------------------------------------------------------
456 * Get pointer to Code_Saturne coupling.
457 *
458 * parameters:
459 * coupling_id <-- Id (0 to n-1) of Code_Saturne coupling
460 *
461 * returns:
462 * pointer to Code_Saturne coupling structure
463 *----------------------------------------------------------------------------*/
464
466cs_sat_coupling_by_id(int coupling_id);
467
468/*----------------------------------------------------------------------------
469 * Create a sat_coupling_t structure.
470 *
471 * parameters:
472 * ref_axis <-- reference axis
473 * face_sel_criterion <-- criterion for selection of boundary faces
474 * cell_sel_criterion <-- criterion for selection of cells
475 * sat_name <-- Code_Saturne application name
476 * verbosity <-- verbosity level
477 *----------------------------------------------------------------------------*/
478
479void
480cs_sat_coupling_add(const char *face_cpl_sel_c,
481 const char *cell_cpl_sel_c,
482 const char *face_loc_sel_c,
483 const char *cell_loc_sel_c,
484 const char *sat_name,
485 int verbosity);
486
487/*----------------------------------------------------------------------------
488 * Create a new internal Code_Saturne coupling.
489 *
490 * arguments:
491 * tag_func <-- pointer to tagging function
492 * tag_context <-- pointer to tagging function context
493 * boundary_criteria <-- boundary face selection criteria, or NULL
494 * volume_criteria <-- volume cell selection criteria, or NULL
495 * loc_tolerance <-- location tolerance factor (0.1 recommended)
496 * verbosity <-- verbosity level
497 *----------------------------------------------------------------------------*/
498
499void
501 void *tag_context,
502 const char *boundary_cpl_criteria,
503 const char *volume_cpl_criteria,
504 const char *boundary_loc_criteria,
505 const char *volume_loc_criteria,
506 float loc_tolerance,
507 int verbosity);
508
509/*----------------------------------------------------------------------------
510 * Initialize Code_Saturne couplings.
511 *
512 * This function may be called once all couplings have been defined,
513 * and it will match defined couplings with available applications.
514 *----------------------------------------------------------------------------*/
515
516void
518
519/*----------------------------------------------------------------------------
520 * Destroy all couplings
521 *----------------------------------------------------------------------------*/
522
523void
525
526/*----------------------------------------------------------------------------*/
527
529
530#endif /* __CS_COUPLAGE_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
double cs_real_t
Floating-point value.
Definition cs_defs.h:302
int cs_int_t
Fortran-compatible integer.
Definition cs_defs.h:301
#define CS_PROCF(x, y)
Definition cs_defs.h:481
#define END_C_DECLS
Definition cs_defs.h:468
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:298
void npdcpl(const cs_int_t *numcpl, cs_int_t *ncedis, cs_int_t *nfbdis)
Definition cs_sat_coupling.c:1349
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 verbosity)
Definition cs_sat_coupling.c:2128
void nbecpl(const cs_int_t *numcpl, cs_int_t *ncesup, cs_int_t *nfbsup, cs_int_t *ncecpl, cs_int_t *nfbcpl, cs_int_t *ncencp, cs_int_t *nfbncp)
Definition cs_sat_coupling.c:1142
void cs_sat_coupling_all_finalize(void)
Definition cs_sat_coupling.c:2166
void mxicpl(const cs_int_t *const numcpl, cs_int_t *const vardis, cs_int_t *const varmax)
Definition cs_sat_coupling.c:1829
void tbicpl(const cs_int_t *numcpl, const cs_int_t *nbrdis, const cs_int_t *nbrloc, cs_int_t *vardis, cs_int_t *varloc)
Definition cs_sat_coupling.c:1679
int cs_sat_coupling_n_couplings(void)
Definition cs_sat_coupling.c:1957
void coocpl(const cs_int_t *numcpl, const cs_int_t *nbrpts, const cs_int_t *itydis, cs_int_t *ityloc, cs_int_t *locpts, cs_real_t *coopts, cs_real_t *djppts, cs_real_t *dofpts, cs_real_t *pndpts)
Definition cs_sat_coupling.c:1409
struct _cs_sat_coupling_t cs_sat_coupling_t
Definition cs_sat_coupling.h:51
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 verbosity)
Definition cs_sat_coupling.c:2030
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:73
cs_sat_coupling_t * cs_sat_coupling_by_id(int coupling_id)
Definition cs_sat_coupling.c:1973
void defloc(const cs_int_t *numcpl)
Definition cs_sat_coupling.c:879
void lelcpl(const cs_int_t *numcpl, const cs_int_t *ncecpl, const cs_int_t *nfbcpl, cs_int_t *lcecpl, cs_int_t *lfbcpl)
Definition cs_sat_coupling.c:1204
void nbccpl(cs_int_t *nbrcpl)
Definition cs_sat_coupling.c:840
void tbrcpl(const cs_int_t *numcpl, const cs_int_t *nbrdis, const cs_int_t *nbrloc, cs_real_t *vardis, cs_real_t *varloc)
Definition cs_sat_coupling.c:1755
void cs_sat_coupling_all_init(void)
Definition cs_sat_coupling.c:1992
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 verbosity)
Define new Code_Saturne coupling.
Definition cs_sat_coupling.c:1895
void varcpl(const cs_int_t *numcpl, const cs_int_t *nbrdis, const cs_int_t *nbrloc, const cs_int_t *ityvar, const cs_int_t *stride, cs_real_t *vardis, cs_real_t *varloc)
Definition cs_sat_coupling.c:1590
void lencpl(const cs_int_t *numcpl, const cs_int_t *ncencp, const cs_int_t *nfbncp, cs_int_t *lcencp, cs_int_t *lfbncp)
Definition cs_sat_coupling.c:1279
void pondcp(const cs_int_t *numcpl, const cs_int_t *nbrcpl, cs_int_t *ityloc, cs_real_t *pndcpl, cs_real_t *distof)
Definition cs_sat_coupling.c:1511
Definition mesh.f90:26