programmer's 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-2015 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 "cs_base.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Structure Definitions
47  *============================================================================*/
48 
49 typedef struct _cs_sat_coupling_t cs_sat_coupling_t;
50 
51 /*============================================================================
52  * Public function prototypes for Fortran API
53  *============================================================================*/
54 
55 /*----------------------------------------------------------------------------
56  * User function wrapper for definition of Code_Saturne couplings
57  *
58  * Fortran Interface:
59  *
60  * SUBROUTINE USSATC
61  * *****************
62  *----------------------------------------------------------------------------*/
63 
64 void CS_PROCF (ussatc, USSATC)
65 (
66  void
67 );
68 
69 /*----------------------------------------------------------------------------
70  * Get number of code coupling
71  *
72  * Fortran interface:
73  *
74  * SUBROUTINE NBCCPL
75  * *****************
76  *
77  * INTEGER NBRCPL : <-- : number of code couplings
78  *----------------------------------------------------------------------------*/
79 
80 void CS_PROCF (nbccpl, NBCCPL)
81 (
83 );
84 
85 /*----------------------------------------------------------------------------
86  * Set the list of cells and boundary faces associated to a coupling
87  * and a cloud of point.
88  *
89  * The local "support" cells and boundary faces are used to localize
90  * the values in the distant "coupled" cells and faces.
91  * Depending on the role of sender and/or receiver of the current process
92  * in the coupling, some of these sets can be empty or not.
93  *
94  * The cell values are always localized and interpolated on the distant
95  * "cells" support. The face values are localized and interpolated on
96  * the distant "face" support if present, or on the distant "cell" support
97  * if not.
98  *
99  * If the input arrays LCESUP and LFBSUP are not ordered, they will be
100  * orderd in output.
101  *
102  * Fortran interface:
103  *
104  * SUBROUTINE DEFCPL
105  * *****************
106  *
107  * INTEGER NUMCPL : --> : coupling number
108  *----------------------------------------------------------------------------*/
109 
110 void CS_PROCF (defloc, DEFLOC)
111 (
112  const cs_int_t *numcpl
113 );
114 
115 /*----------------------------------------------------------------------------
116  * Get the number of cells and boundary faces, "support", coupled and not
117  * localized associated to a given coupling
118  *
119  * Fortran interface:
120  *
121  * SUBROUTINE NBECPL
122  * *****************
123  *
124  * INTEGER NUMCPL : --> : coupling number
125  * INTEGER NCESUP : <-- : number of "support" cells
126  * INTEGER NFBSUP : <-- : number of "support" boundary faces
127  * INTEGER NCECPL : <-- : number of coupled cells
128  * INTEGER NFBCPL : <-- : number of coupled boundary faces
129  * INTEGER NCENCP : <-- : number of not coupled cells
130  * : : (since not localized)
131  * INTEGER NFBNCP : <-- : number of not coupled boundary faces
132  * : : (since not localized)
133  *----------------------------------------------------------------------------*/
134 
135 void CS_PROCF (nbecpl, NBECPL)
136 (
137  const cs_int_t *numcpl,
138  cs_int_t *ncesup,
139  cs_int_t *nfbsup,
140  cs_int_t *ncecpl,
141  cs_int_t *nfbcpl,
142  cs_int_t *ncencp,
143  cs_int_t *nfbncp
144 );
145 
146 /*----------------------------------------------------------------------------
147  * Get the lists of coupled cells and boundary faces (i.e. receiving)
148  * associated to a given coupling
149  *
150  * The number of cells and boundary faces, got with NBECPL(), are used
151  * for arguments coherency checks.
152  *
153  * Fortran interface:
154  *
155  * SUBROUTINE LELCPL
156  * *****************
157  *
158  * INTEGER NUMCPL : --> : coupling number
159  * INTEGER NCECPL : --> : number of coupled cells
160  * INTEGER NFBCPL : --> : number of coupled boundary faces
161  * INTEGER LCECPL(*) : <-- : list of coupled cells
162  * INTEGER LFBCPL(*) : <-- : list of coupled boundary faces
163  *----------------------------------------------------------------------------*/
164 
165 void CS_PROCF (lelcpl, LELCPL)
166 (
167  const cs_int_t *numcpl,
168  const cs_int_t *ncecpl,
169  const cs_int_t *nfbcpl,
170  cs_int_t *lcecpl,
171  cs_int_t *lfbcpl
172 );
173 
174 /*----------------------------------------------------------------------------
175  * Get the lists of not coupled cells and boundary faces (i.e. receiving but
176  * not localized) associated to a given coupling
177  *
178  * The number of cells and boundary faces, got with NBECPL(), are used
179  * for arguments coherency checks.
180  *
181  * Fortran interface:
182  *
183  * SUBROUTINE LENCPL
184  * *****************
185  *
186  * INTEGER NUMCPL : --> : coupling number
187  * INTEGER NCENCP : --> : number of not coupled cells
188  * INTEGER NFBNCP : --> : number of not coupled boundary faces
189  * INTEGER LCENCP(*) : <-- : list of not coupled cells
190  * INTEGER LFBNCP(*) : <-- : list of not coupled boundary faces
191  *----------------------------------------------------------------------------*/
192 
193 void CS_PROCF (lencpl, LENCPL)
194 (
195  const cs_int_t *numcpl,
196  const cs_int_t *ncencp,
197  const cs_int_t *nfbncp,
198  cs_int_t *lcencp,
199  cs_int_t *lfbncp
200 );
201 
202 /*----------------------------------------------------------------------------
203  * Get the number of distant point associated to a given coupling
204  * and localized on the local domain
205  *
206  * Fortran interface:
207  *
208  * SUBROUTINE NPDCPL
209  * *****************
210  *
211  * INTEGER NUMCPL : --> : coupling number
212  * INTEGER NCEDIS : <-- : number of distant cells
213  * INTEGER NFBDIS : <-- : numbre de distant boundary faces
214  *----------------------------------------------------------------------------*/
215 
216 void CS_PROCF (npdcpl, NPDCPL)
217 (
218  const cs_int_t *numcpl,
219  cs_int_t *ncedis,
220  cs_int_t *nfbdis
221 );
222 
223 /*----------------------------------------------------------------------------
224  * Get the distant points coordinates associated to a given coupling
225  * and a list of points, and the elements number and type (cell or face)
226  * "containing" this points.
227  *
228  * The number of distant points NBRPTS must be equal to one the arguments
229  * NCEDIS or NFBDIS given by NPDCPL(), and is given here for coherency checks
230  * between the arguments NUMCPL and ITYSUP.
231  *
232  * Fortran interface:
233  *
234  * SUBROUTINE COOCPL
235  * *****************
236  *
237  * INTEGER NUMCPL : --> : coupling number
238  * INTEGER NBRPTS : --> : number of distant points
239  * INTEGER ITYDIS : --> : 1 : access to the points associated
240  * : : to the distant cells
241  * : : 2 : access to the points associated
242  * : : to the distant boundary faces
243  * INTEGER ITYLOC : <-- : 1 : localization on the local cells
244  * : : 2 : localization on the local faces
245  * INTEGER LOCPTS(*) : <-- : "containing" number associated to
246  * : : each point
247  * DOUBLE PRECISION COOPTS(3,*) : <-- : distant point coordinates
248  *----------------------------------------------------------------------------*/
249 
250 void CS_PROCF (coocpl, COOCPL)
251 (
252  const cs_int_t *numcpl,
253  const cs_int_t *nbrpts,
254  const cs_int_t *itydis,
255  cs_int_t *ityloc,
256  cs_int_t *locpts,
257  cs_real_t *coopts,
258  cs_real_t *djppts,
259  cs_real_t *dofpts,
260  cs_real_t *pndpts
261 );
262 
263 /*----------------------------------------------------------------------------
264  * Get the weighting coefficient needed for a centered-like interpolation
265  * in the case of a coupling on boundary faces.
266  *
267  * Fortran interface:
268  *
269  * SUBROUTINE PONDCP
270  * *****************
271  *
272  * INTEGER NUMCPL : --> : coupling number
273  * INTEGER NBRCPL : --> : number of distant points
274  * INTEGER ITYLOC : <-- : 1 : localization on the local cells
275  * : : 2 : localization on the local faces
276  * DOUBLE PRECISION pndcpl(*) : <-- : weighting coefficients
277  *----------------------------------------------------------------------------*/
278 
279 void CS_PROCF (pondcp, PONDCP)
280 (
281  const cs_int_t *numcpl,
282  const cs_int_t *nbrcpl,
283  cs_int_t *ityloc,
284  cs_real_t *pndcpl,
285  cs_real_t *distof
286 );
287 
288 /*----------------------------------------------------------------------------
289  * Exchange a variable associated to a set of point and a coupling.
290  *
291  * Fortran interface:
292  *
293  * SUBROUTINE VARCPL
294  * *****************
295  *
296  * INTEGER NUMCPL : --> : coupling number
297  * INTEGER NBRDIS : --> : number of values to send
298  * INTEGER NBRLOC : --> : number of values to receive
299  * INTEGER ITYVAR : --> : 1 : variables defined at cells
300  * : : 2 : variables defined at faces
301  * INTEGER STRIDE : --> : 1 : for scalars
302  * : : 3 : for vectors
303  * DOUBLE PRECISION VARDIS(*) : --> : distant variable(to send)
304  * DOUBLE PRECISION VARLOC(*) : <-- : local variable (to receive)
305  *----------------------------------------------------------------------------*/
306 
307 void CS_PROCF (varcpl, VARCPL)
308 (
309  const cs_int_t *numcpl,
310  const cs_int_t *nbrdis,
311  const cs_int_t *nbrloc,
312  const cs_int_t *ityvar,
313  const cs_int_t *stride,
314  cs_real_t *vardis,
315  cs_real_t *varloc
316 );
317 
318 /*----------------------------------------------------------------------------
319  * Array of integers exchange, associated to a given coupling.
320  *
321  * It is assumed that the arrays have the same size and the same values on
322  * each group of processus (local and distant).
323  *
324  * Fortran interface:
325  *
326  * SUBROUTINE TBICPL
327  * *****************
328  *
329  * INTEGER NUMCPL : --> : coupling number
330  * INTEGER NBRDIS : --> : number of values to send
331  * INTEGER NBRLOC : --> : number of values to receive
332  * INTEGER TABDIS(*) : --> : distant values (to send)
333  * INTEGER TABLOC(*) : <-- : local values (to receive)
334  *----------------------------------------------------------------------------*/
335 
336 void CS_PROCF (tbicpl, TBICPL)
337 (
338  const cs_int_t *numcpl,
339  const cs_int_t *nbrdis,
340  const cs_int_t *nbrloc,
341  cs_int_t *vardis,
342  cs_int_t *varloc
343 );
344 
345 /*----------------------------------------------------------------------------
346  * Array of reals exchange, associated to a given coupling.
347  *
348  * It is assumed that the arrays have the same size and the same values on
349  * each group of processus (local and distant).
350  *
351  * Fortran interface:
352  *
353  * SUBROUTINE TBRCPL
354  * *****************
355  *
356  * INTEGER NUMCPL : --> : coupling number
357  * INTEGER NBRDIS : --> : number of values to send
358  * INTEGER NBRLOC : --> : number of values to receive
359  * DOUBLE PRECISION TABDIS(*) : --> : distant values (to send)
360  * DOUBLE PRECISION TABLOC(*) : <-- : local values (to receive)
361  *----------------------------------------------------------------------------*/
362 
363 void CS_PROCF (tbrcpl, TBRCPL)
364 (
365  const cs_int_t *numcpl,
366  const cs_int_t *nbrdis,
367  const cs_int_t *nbrloc,
368  cs_real_t *vardis,
369  cs_real_t *varloc
370 );
371 
372 /*----------------------------------------------------------------------------
373  * Compute the maximum value of an integer variable associated to a coupling.
374  *
375  * It is assumed that the integer value is the same for each group of
376  * processus (local and distant).
377  *
378  * Fortran interface:
379  *
380  * SUBROUTINE MXICPL
381  * *****************
382  *
383  * INTEGER NUMCPL : --> : coupling number
384  * INTEGER VALDIS : --> : distant value (to send)
385  * INTEGER VALMAX : <-- : local maximum (to receive)
386  *----------------------------------------------------------------------------*/
387 
388 void CS_PROCF (mxicpl, MXICPL)
389 (
390  const cs_int_t *const numcpl,
391  cs_int_t *const vardis,
392  cs_int_t *const varmax
393 );
394 
395 /*============================================================================
396  * Public function prototypes
397  *============================================================================*/
398 
399 /*----------------------------------------------------------------------------
400  * Define new Code_Saturne coupling.
401  *
402  * arguments:
403  * saturne_name <-- name of Code_Saturne instance, or NULL
404  * boundary_criteria <-- boundary face selection criteria, or NULL
405  * volume_criteria <-- volume cell selection criteria, or NULL
406  * verbosity <-- verbosity level
407  *----------------------------------------------------------------------------*/
408 
409 void
410 cs_sat_coupling_define(const char *saturne_name,
411  const char *boundary_cpl_criteria,
412  const char *volume_cpl_criteria,
413  const char *boundary_sup_criteria,
414  const char *volume_sup_criteria,
415  int verbosity);
416 
417 /*----------------------------------------------------------------------------
418  * Get number of Code_Saturne couplings.
419  *
420  * returns:
421  * number of Code_Saturne couplings
422  *----------------------------------------------------------------------------*/
423 
424 int
426 
427 /*----------------------------------------------------------------------------
428  * Get pointer to Code_Saturne coupling.
429  *
430  * parameters:
431  * coupling_id <-- Id (0 to n-1) of Code_Saturne coupling
432  *
433  * returns:
434  * pointer to Code_Saturne coupling structure
435  *----------------------------------------------------------------------------*/
436 
438 cs_sat_coupling_by_id(int coupling_id);
439 
440 /*----------------------------------------------------------------------------
441  * Create a sat_coupling_t structure.
442  *
443  * parameters:
444  * ref_axis <-- reference axis
445  * face_sel_criterion <-- criterion for selection of boundary faces
446  * cell_sel_criterion <-- criterion for selection of cells
447  * sat_name <-- Code_Saturne application name
448  * verbosity <-- verbosity level
449  *----------------------------------------------------------------------------*/
450 
451 void
452 cs_sat_coupling_add(const char *face_cpl_sel_c,
453  const char *cell_cpl_sel_c,
454  const char *face_sup_sel_c,
455  const char *cell_sup_sel_c,
456  const char *sat_name,
457  int verbosity);
458 
459 /*----------------------------------------------------------------------------
460  * Initialize Code_Saturne couplings.
461  *
462  * This function may be called once all couplings have been defined,
463  * and it will match defined couplings with available applications.
464  *----------------------------------------------------------------------------*/
465 
466 void
468 
469 /*----------------------------------------------------------------------------
470  * Destroy all couplings
471  *----------------------------------------------------------------------------*/
472 
473 void
475 
476 /*----------------------------------------------------------------------------*/
477 
479 
480 #endif /* __CS_COUPLAGE_H__ */
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:1139
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:1587
void nbccpl(cs_int_t *nbrcpl)
Definition: cs_sat_coupling.c:857
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void defloc(const cs_int_t *numcpl)
Definition: cs_sat_coupling.c:897
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:1753
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:1406
cs_sat_coupling_t * cs_sat_coupling_by_id(int coupling_id)
Definition: cs_sat_coupling.c:1960
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:1276
integer, save nbrcpl
number of couplings Code_Saturne / Code_Saturne
Definition: cplsat.f90:43
void npdcpl(const cs_int_t *numcpl, cs_int_t *ncedis, cs_int_t *nfbdis)
Definition: cs_sat_coupling.c:1346
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:1677
void cs_sat_coupling_define(const char *saturne_name, const char *boundary_cpl_criteria, const char *volume_cpl_criteria, const char *boundary_sup_criteria, const char *volume_sup_criteria, int verbosity)
Definition: cs_sat_coupling.c:1882
void cs_sat_coupling_all_init(void)
Definition: cs_sat_coupling.c:1979
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:1201
#define END_C_DECLS
Definition: cs_defs.h:430
void cs_sat_coupling_add(const char *face_cpl_sel_c, const char *cell_cpl_sel_c, const char *face_sup_sel_c, const char *cell_sup_sel_c, const char *sat_name, int verbosity)
Definition: cs_sat_coupling.c:2017
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:453
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:1508
void mxicpl(const cs_int_t *const numcpl, cs_int_t *const vardis, cs_int_t *const varmax)
Definition: cs_sat_coupling.c:1827
void ussatc(void)
Definition: cs_sat_coupling.c:838
void cs_sat_coupling_all_finalize(void)
Definition: cs_sat_coupling.c:2104
struct _cs_sat_coupling_t cs_sat_coupling_t
Definition: cs_sat_coupling.h:49
int cs_sat_coupling_n_couplings(void)
Definition: cs_sat_coupling.c:1944