Code_Saturne
CFD tool
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-2012 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 
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 centred-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  * DOUBLE PRECISION VARDIS(*) : --> : distant variable(to send)
302  * DOUBLE PRECISION VARLOC(*) : <-- : local variable (to receive)
303  *----------------------------------------------------------------------------*/
304 
305 void CS_PROCF (varcpl, VARCPL)
306 (
307  const cs_int_t *numcpl,
308  const cs_int_t *nbrdis,
309  const cs_int_t *nbrloc,
310  const cs_int_t *ityvar,
311  cs_real_t *vardis,
312  cs_real_t *varloc
313 );
314 
315 /*----------------------------------------------------------------------------
316  * Array of integers exchange, associated to a given coupling.
317  *
318  * It is assumed that the arrays have the same size and the same values on
319  * each group of processus (local and distant).
320  *
321  * Fortran interface:
322  *
323  * SUBROUTINE TBICPL
324  * *****************
325  *
326  * INTEGER NUMCPL : --> : coupling number
327  * INTEGER NBRDIS : --> : number of values to send
328  * INTEGER NBRLOC : --> : number of values to receive
329  * INTEGER TABDIS(*) : --> : distant values (to send)
330  * INTEGER TABLOC(*) : <-- : local values (to receive)
331  *----------------------------------------------------------------------------*/
332 
333 void CS_PROCF (tbicpl, TBICPL)
334 (
335  const cs_int_t *numcpl,
336  const cs_int_t *nbrdis,
337  const cs_int_t *nbrloc,
338  cs_int_t *vardis,
339  cs_int_t *varloc
340 );
341 
342 /*----------------------------------------------------------------------------
343  * Array of reals exchange, associated to a given coupling.
344  *
345  * It is assumed that the arrays have the same size and the same values on
346  * each group of processus (local and distant).
347  *
348  * Fortran interface:
349  *
350  * SUBROUTINE TBRCPL
351  * *****************
352  *
353  * INTEGER NUMCPL : --> : coupling number
354  * INTEGER NBRDIS : --> : number of values to send
355  * INTEGER NBRLOC : --> : number of values to receive
356  * DOUBLE PRECISION TABDIS(*) : --> : distant values (to send)
357  * DOUBLE PRECISION TABLOC(*) : <-- : local values (to receive)
358  *----------------------------------------------------------------------------*/
359 
360 void CS_PROCF (tbrcpl, TBRCPL)
361 (
362  const cs_int_t *numcpl,
363  const cs_int_t *nbrdis,
364  const cs_int_t *nbrloc,
365  cs_real_t *vardis,
366  cs_real_t *varloc
367 );
368 
369 /*----------------------------------------------------------------------------
370  * Compute the maximum value of an integer variable associated to a coupling.
371  *
372  * It is assumed that the integer value is the same for each group of
373  * processus (local and distant).
374  *
375  * Fortran interface:
376  *
377  * SUBROUTINE MXICPL
378  * *****************
379  *
380  * INTEGER NUMCPL : --> : coupling number
381  * INTEGER VALDIS : --> : distant value (to send)
382  * INTEGER VALMAX : <-- : local maximum (to receive)
383  *----------------------------------------------------------------------------*/
384 
385 void CS_PROCF (mxicpl, MXICPL)
386 (
387  const cs_int_t *const numcpl,
388  cs_int_t *const vardis,
389  cs_int_t *const varmax
390 );
391 
392 /*============================================================================
393  * Public function prototypes
394  *============================================================================*/
395 
396 /*----------------------------------------------------------------------------
397  * Define new Code_Saturne coupling.
398  *
399  * arguments:
400  * saturne_name <-- name of Code_Saturne instance, or NULL
401  * boundary_criteria <-- boundary face selection criteria, or NULL
402  * volume_criteria <-- volume cell selection criteria, or NULL
403  * verbosity <-- verbosity level
404  *----------------------------------------------------------------------------*/
405 
406 void
407 cs_sat_coupling_define(const char *saturne_name,
408  const char *boundary_cpl_criteria,
409  const char *volume_cpl_criteria,
410  const char *boundary_sup_criteria,
411  const char *volume_sup_criteria,
412  int verbosity);
413 
414 /*----------------------------------------------------------------------------
415  * Get number of Code_Saturne couplings.
416  *
417  * returns:
418  * number of Code_Saturne couplings
419  *----------------------------------------------------------------------------*/
420 
421 int
423 
424 /*----------------------------------------------------------------------------
425  * Get pointer to Code_Saturne coupling.
426  *
427  * parameters:
428  * coupling_id <-- Id (0 to n-1) of Code_Saturne coupling
429  *
430  * returns:
431  * pointer to Code_Saturne coupling structure
432  *----------------------------------------------------------------------------*/
433 
435 cs_sat_coupling_by_id(int coupling_id);
436 
437 /*----------------------------------------------------------------------------
438  * Create a sat_coupling_t structure.
439  *
440  * parameters:
441  * ref_axis <-- reference axis
442  * face_sel_criterion <-- criterion for selection of boundary faces
443  * cell_sel_criterion <-- criterion for selection of cells
444  * sat_name <-- Code_Saturne application name
445  * verbosity <-- verbosity level
446  *----------------------------------------------------------------------------*/
447 
448 void
449 cs_sat_coupling_add(const char *face_cpl_sel_c,
450  const char *cell_cpl_sel_c,
451  const char *face_sup_sel_c,
452  const char *cell_sup_sel_c,
453  const char *sat_name,
454  int verbosity);
455 
456 /*----------------------------------------------------------------------------
457  * Initialize Code_Saturne couplings.
458  *
459  * This function may be called once all couplings have been defined,
460  * and it will match defined couplings with available applications.
461  *----------------------------------------------------------------------------*/
462 
463 void
465 
466 /*----------------------------------------------------------------------------
467  * Destroy all couplings
468  *----------------------------------------------------------------------------*/
469 
470 void
472 
473 /*----------------------------------------------------------------------------*/
474 
476 
477 #endif /* __CS_COUPLAGE_H__ */
integer, save nbrcpl
Definition: cplsat.f90:39
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:1125
void varcpl(const cs_int_t *numcpl, const cs_int_t *nbrdis, const cs_int_t *nbrloc, const cs_int_t *ityvar, cs_real_t *vardis, cs_real_t *varloc)
Definition: cs_sat_coupling.c:1571
void nbccpl(cs_int_t *nbrcpl)
Definition: cs_sat_coupling.c:855
#define BEGIN_C_DECLS
Definition: cs_defs.h:365
void defloc(const cs_int_t *numcpl)
Definition: cs_sat_coupling.c:895
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:1736
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:1392
int cs_int_t
Definition: cs_defs.h:263
cs_sat_coupling_t * cs_sat_coupling_by_id(int coupling_id)
Definition: cs_sat_coupling.c:1943
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:1262
void npdcpl(const cs_int_t *numcpl, cs_int_t *ncedis, cs_int_t *nfbdis)
Definition: cs_sat_coupling.c:1332
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:1660
double precision, dimension(nvppmx), save varmax
Definition: entsor.f90:193
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:1865
typedefBEGIN_C_DECLS struct _cs_sat_coupling_t cs_sat_coupling_t
Definition: cs_sat_coupling.h:49
void cs_sat_coupling_all_init(void)
Definition: cs_sat_coupling.c:1962
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:1187
#define END_C_DECLS
Definition: cs_defs.h:366
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:2000
double cs_real_t
Definition: cs_defs.h:264
#define CS_PROCF(x, y)
Definition: cs_defs.h:379
int verbosity
Definition: cs_sat_coupling.c:128
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:1494
void mxicpl(const cs_int_t *const numcpl, cs_int_t *const vardis, cs_int_t *const varmax)
Definition: cs_sat_coupling.c:1810
void ussatc(void)
Definition: cs_sat_coupling.c:836
char * sat_name
Definition: cs_sat_coupling.c:104
void cs_sat_coupling_all_finalize(void)
Definition: cs_sat_coupling.c:2087
Definition: cs_sat_coupling.c:102
int cs_sat_coupling_n_couplings(void)
Definition: cs_sat_coupling.c:1927