programmer's documentation
cs_syr_coupling.h
Go to the documentation of this file.
1 #ifndef __CS_SYR_COUPLING_H__
2 #define __CS_SYR_COUPLING_H__
3 
4 /*============================================================================
5  * SYRTHES 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 
40 #include "cs_base.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*=============================================================================
47  * Local Macro Definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Structure definition
52  *============================================================================*/
53 
54 /*============================================================================
55  * Global variables definition
56  *============================================================================*/
57 
58 /*============================================================================
59  * Public function prototypes for Fortran API
60  *============================================================================*/
61 
62 /*----------------------------------------------------------------------------
63  * Get number of SYRTHES couplings.
64  *
65  * Fortran Interface:
66  *
67  * SUBROUTINE NBCSYR
68  * *****************
69  *
70  * INTEGER n_couplings : <-- : number of SYRTHES couplings
71  *----------------------------------------------------------------------------*/
72 
73 void CS_PROCF(nbcsyr, NBCSYR)
74 (
75  cs_int_t *const n_couplings
76 );
77 
78 /*----------------------------------------------------------------------------
79  * Test if the given SYRTHES coupling number is a surface coupling
80  * Return 1 if true else 0
81  *
82  * Fortran Interface:
83  *
84  * SUBROUTINE TSURSY
85  * *****************
86  *
87  * INTEGER cplnum : <-- : number of the SYRTHES coupling
88  * INTEGER issurf : --> : 1 if surface coupling else 0
89  *----------------------------------------------------------------------------*/
90 
91 void CS_PROCF(tsursy, TSURSY)
92 (
93  cs_int_t *const cplnum,
94  cs_int_t *issurf
95 );
96 
97 /*----------------------------------------------------------------------------
98  * Test if the given SYRTHES coupling number is a volume coupling
99  * Return 1 if true else 0
100  *
101  * Fortran Interface:
102  *
103  * SUBROUTINE TVOLSY
104  * *****************
105  *
106  * INTEGER cplnum : <-- : number of the SYRTHES coupling
107  * INTEGER issurf : --> : 1 if volume coupling else 0
108  *----------------------------------------------------------------------------*/
109 
110 void CS_PROCF(tvolsy, TVOLSY)
111 (
112  cs_int_t *const cplnum,
113  cs_int_t *isvol
114 );
115 
116 /*----------------------------------------------------------------------------
117  * Create nodal coupled mesh.
118  * Send vertices's coordinates and connectivity of coupled mesh.
119  *
120  * Fortran Interface:
121  *
122  * SUBROUTINE GEOSYR
123  * *****************
124  *----------------------------------------------------------------------------*/
125 
126 void CS_PROCF(geosyr, GEOSYR)
127 (
128  void
129 );
130 
131 /*----------------------------------------------------------------------------
132  * Get number of coupled elements with SYRTHES.
133  *
134  * Fortran Interface:
135  *
136  * SUBROUTINE NBESYR
137  * *****************
138  *
139  * INTEGER coupl_num : --> : coupling number
140  * INTEGER mode : --> : 0 (surface); 1 (volume)
141  * INTEGER n_coupl_elts : <-- : number of coupled elements
142  *----------------------------------------------------------------------------*/
143 
144 void CS_PROCF(nbesyr, NBESYR)
145 (
146  const cs_int_t *coupl_num,
147  const cs_int_t *mode,
148  cs_int_t *n_coupl_elts
149 );
150 
151 /*----------------------------------------------------------------------------
152  * Get local numbering of coupled elements
153  *
154  * Fortran interface:
155  *
156  * SUBROUTINE LELTSY
157  * *****************
158  *
159  * INTEGER coupl_num : --> : coupling number
160  * INTEGER mode : --> : 0 (surface); 1 (volume)
161  * INTEGER coupl_elt_list : <-- : list of coupled elements
162  *----------------------------------------------------------------------------*/
163 
164 void CS_PROCF(leltsy, LELTSY)
165 (
166  const cs_int_t *coupl_num,
167  const cs_int_t *mode,
168  cs_lnum_t *coupl_elt_list
169 );
170 
171 /*----------------------------------------------------------------------------
172  * User function wrapper for definition of SYRTHES couplings
173  *
174  * Fortran Interface:
175  *
176  * SUBROUTINE USSYRC
177  * *****************
178  *----------------------------------------------------------------------------*/
179 
180 void CS_PROCF (ussyrc, USSYRC)
181 (
182  void
183 );
184 
185 /*----------------------------------------------------------------------------
186  * Receive coupling variables from SYRTHES
187  *
188  * Fortran Interface:
189  *
190  * SUBROUTINE VARSYI
191  * *****************
192  *
193  * INTEGER NUMSYR : --> : Number of SYRTHES coupling
194  * INTEGER MODE : --> : 0 (surface); 1 (volume)
195  * DOUBLE PRECISION TSOLID : <-- : Solid temperature
196  *----------------------------------------------------------------------------*/
197 
198 void CS_PROCF (varsyi, VARSYI)
199 (
200  cs_int_t *numsyr,
201  cs_int_t *mode,
202  cs_real_t *tsolid
203 );
204 
205 /*----------------------------------------------------------------------------
206  * Send coupling variables to SYRTHES
207  *
208  * Fortran Interface:
209  *
210  * SUBROUTINE VARSYO
211  * *****************
212  *
213  * INTEGER NUMSYR : --> : Number of SYRTHES coupling
214  * INTEGER MODE : --> : 0 (surface); 1 (volume)
215  * INTEGER LSTELT : --> : List of coupled elements
216  * DOUBLE PRECISION TFLUID : --> : Fluid temperature
217  * DOUBLE PRECISION HFLUID : --> : Exchange coefficient
218  *----------------------------------------------------------------------------*/
219 
220 void CS_PROCF (varsyo, VARSYO)
221 (
222  cs_int_t *numsyr,
223  cs_int_t *mode,
224  cs_int_t *lstelt,
225  cs_real_t *tfluid,
226  cs_real_t *hfluid
227 );
228 
229 /*----------------------------------------------------------------------------
230  * Compute the explicit/implicit contribution to source terms in case of
231  * volume coupling with SYRTHES4
232  *
233  * Fortran Interface:
234  *
235  * SUBROUTINE CTBVSY
236  * *****************
237  *
238  * INTEGER NUMSYR : --> : Number of SYRTHES coupling
239  * DOUBLE PRECISION TFLUID : --> : Fluid temperature
240  * DOUBLE PRECISION CTBIMP : <-> : Implicit contribution
241  * DOUBLE PRECISION CTBEXP : <-> : Explicit contribution
242  *----------------------------------------------------------------------------*/
243 
244 void CS_PROCF (ctbvsy, CTBVSY)
245 (
246  cs_int_t *numsyr,
247  cs_real_t *tfluid,
248  cs_real_t *ctbimp,
249  cs_real_t *ctbexp
250 );
251 
252 /*============================================================================
253  * Public function prototypes
254  *============================================================================*/
255 
256 /*----------------------------------------------------------------------------
257  * Define new SYRTHES coupling.
258  *
259  * In the case of a single Code_Saturne and single SYRTHES instance, the
260  * syrthes_name argument is ignored.
261  *
262  * In case of multiple couplings, a coupling will be matched with available
263  * SYRTHES instances based on the syrthes_name argument.
264  *
265  * arguments:
266  * syrthes_name <-- name of SYRTHES instance
267  * boundary_criteria <-- boundary face selection criteria, or NULL
268  * volume_criteria <-- volume cell selection criteria, or NULL
269  * projection_axis <-- 'x', 'y', or 'y' for 2D projection axis (case
270  * independent), or ' ' for standard 3D coupling
271  * allow_nonmatching <-- allow nearest-neighbor mapping where matching
272  * within tolerance is not available
273  * tolerance <-- addition to local extents of each element
274  * extent = base_extent * (1 + tolerance)
275  * verbosity <-- verbosity level
276  * visualization <-- visualization output level (0 or 1)
277  *----------------------------------------------------------------------------*/
278 
279 void
280 cs_syr_coupling_define(const char *syrthes_name,
281  const char *boundary_criteria,
282  const char *volume_criteria,
283  char projection_axis,
284  bool allow_nonmatching,
285  float tolerance,
286  int verbosity,
287  int visualization);
288 
289 /*----------------------------------------------------------------------------
290  * Initialize SYRTHES couplings.
291  *
292  * This function may be called once all couplings have been defined,
293  * and it will match defined couplings with available applications.
294  *----------------------------------------------------------------------------*/
295 
296 void
298 
299 /*----------------------------------------------------------------------------
300  * Finalize all SYRTHES couplings.
301  *----------------------------------------------------------------------------*/
302 
303 void
305 
306 /*----------------------------------------------------------------------------
307  * Return number of SYRTHES couplings.
308  *
309  * return:
310  * number of SYRTHES couplings defined
311  *----------------------------------------------------------------------------*/
312 
313 int
315 
316 /*----------------------------------------------------------------------------
317  * Set conservativity forcing flag to True (1) or False (0) for all defined
318  * SYRTHES couplings
319  *
320  * parameter:
321  * flag <-- Conservativity forcing flag to set
322  *----------------------------------------------------------------------------*/
323 
324 void
326 
327 /*----------------------------------------------------------------------------
328  * Set explicit treatment for the source terms in SYRTHES volume couplings
329  *----------------------------------------------------------------------------*/
330 
331 void
333 
334 /*----------------------------------------------------------------------------*/
335 
337 
338 #endif /* __CS_SYR_COUPLING_H__ */
void cs_syr_coupling_all_finalize(void)
Definition: cs_syr_coupling.c:948
void varsyo(cs_int_t *numsyr, cs_int_t *mode, cs_int_t *lstelt, cs_real_t *tfluid, cs_real_t *hfluid)
Definition: cs_syr_coupling.c:750
void varsyi(cs_int_t *numsyr, cs_int_t *mode, cs_real_t *tsolid)
Definition: cs_syr_coupling.c:714
int cs_syr_coupling_n_couplings(void)
Definition: cs_syr_coupling.c:961
void nbesyr(const cs_int_t *coupl_num, const cs_int_t *mode, cs_int_t *n_coupl_elts)
Definition: cs_syr_coupling.c:628
void cs_syr_coupling_all_init(void)
Definition: cs_syr_coupling.c:919
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
void leltsy(const cs_int_t *coupl_num, const cs_int_t *mode, cs_lnum_t *coupl_elt_list)
Definition: cs_syr_coupling.c:663
void cs_syr_coupling_set_explicit_treatment(void)
Definition: cs_syr_coupling.c:993
void ctbvsy(cs_int_t *numsyr, cs_real_t *tfluid, cs_real_t *ctbimp, cs_real_t *ctbexp)
Definition: cs_syr_coupling.c:788
void cs_syr_coupling_set_conservativity(int flag)
Definition: cs_syr_coupling.c:982
void ussyrc(void)
Definition: cs_syr_coupling.c:693
void cs_syr_coupling_define(const char *syrthes_name, const char *boundary_criteria, const char *volume_criteria, char projection_axis, bool allow_nonmatching, float tolerance, int verbosity, int visualization)
Definition: cs_syr_coupling.c:840
void geosyr(void)
Definition: cs_syr_coupling.c:600
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
#define END_C_DECLS
Definition: cs_defs.h:430
double cs_real_t
Definition: cs_defs.h:296
#define CS_PROCF(x, y)
Definition: cs_defs.h:453
void nbcsyr(cs_int_t *const n_couplings)
Definition: cs_syr_coupling.c:449
void tsursy(cs_int_t *const cplnum, cs_int_t *issurf)
Definition: cs_syr_coupling.c:470
void tvolsy(cs_int_t *const cplnum, cs_int_t *isvol)
Definition: cs_syr_coupling.c:536