7.0
general documentation
cs_syr4_coupling.h
Go to the documentation of this file.
1 #ifndef __CS_SYR4_COUPLING_H__
2 #define __CS_SYR4_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-2021 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 "cs_base.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*=============================================================================
45  * Local Macro Definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Structure definition
50  *============================================================================*/
51 
52 /* Structure associated to Syrthes coupling */
53 
54 typedef struct _cs_syr4_coupling_t cs_syr4_coupling_t;
55 
56 /*============================================================================
57  * Global variables definition
58  *============================================================================*/
59 
60 /*============================================================================
61  * Public function prototypes for Fortran API
62  *============================================================================*/
63 
64 /*----------------------------------------------------------------------------
65  * Compute the implicit/explicit contribution for source terms in a SYRTHES
66  * volume coupling
67  *
68  * Fortran Interface:
69  *
70  * SUBROUTINE CTBVSY (NUMSYR, TFLUID, CTBIMP, CTBEXP)
71  * *****************
72  *
73  * INTEGER NUMSYR : --> : Number of SYRTHES coupling
74  * DOUBLE PRECISION TFLUID : --> : Fluid temperature
75  * DOUBLE PRECISION CTBIMP : --> : Implicit contribution
76  * DOUBLE PRECISION CTBEXP : --> : Explicit contribution
77  *----------------------------------------------------------------------------*/
78 
79 void CS_PROCF (ctbvsy, CTBVSY)
80 (
81  int *numsyr,
82  cs_real_t *tfluid,
83  cs_real_t *ctbimp,
84  cs_real_t *ctbexp
85 );
86 
87 /*============================================================================
88  * Public function prototypes
89  *============================================================================*/
90 
91 /*----------------------------------------------------------------------------
92  * Get number of SYRTHES couplings.
93  *
94  * returns:
95  * number of SYRTHES couplings
96  *----------------------------------------------------------------------------*/
97 
98 int
100 
101 /*----------------------------------------------------------------------------
102  * Get pointer to SYRTHES coupling.
103  *
104  * parameters:
105  * coupling_id <-- Id (0 to n-1) of SYRTHES coupling
106  *
107  * returns:
108  * pointer to SYRTHES coupling structure
109  *----------------------------------------------------------------------------*/
110 
112 cs_syr4_coupling_by_id(int coupling_id);
113 
114 /*----------------------------------------------------------------------------
115  * Create or redefine a syr4_coupling_t structure.
116  *
117  * If a structure is redefined, associated locations are reset.
118  *
119  * parameters:
120  * dim <-- spatial mesh dimension
121  * ref_axis <-- reference axis
122  * syr_name <-- SYRTHES application name
123  * allow_nonmatching <-- nearest-neighbor search for non-matching faces flag
124  * tolerance <-- addition to local extents of each element
125  * extent = base_extent * (1 + tolerance)
126  * verbosity <-- verbosity level
127  * visualization <-- visualization output flag
128  *----------------------------------------------------------------------------*/
129 
132  int ref_axis,
133  const char *syr_name,
134  bool allow_nonmatching,
135  float tolerance,
136  int verbosity,
137  int visualization);
138 
139 /*----------------------------------------------------------------------------
140  * Add a mesh location to a syr4_coupling_t structure.
141  *
142  * parameters:
143  * syr_coupling <-- SYRTHES coupling structure
144  * location_id <-- id of mesh location to add (boundary faces or cells)
145  *----------------------------------------------------------------------------*/
146 
147 void
149  int location_id);
150 
151 /*----------------------------------------------------------------------------
152  * Destroy cs_syr4_coupling_t structures
153  *----------------------------------------------------------------------------*/
154 
155 void
157 
158 /*----------------------------------------------------------------------------
159  * Get name of SYRTHES coupling.
160  *
161  * parameters:
162  * syr_coupling <-- SYRTHES coupling structure
163  *
164  * returns:
165  * pointer to SYRTHES coupling name
166  *----------------------------------------------------------------------------*/
167 
168 const char *
170 
171 /*----------------------------------------------------------------------------
172  * Set conservativity forcing flag to True (1) or False (0) for all defined
173  * SYRTHES couplings
174  *
175  * parameter:
176  * flag <-- Conservativity forcing flag to set
177  *----------------------------------------------------------------------------*/
178 
179 void
181 
182 /*----------------------------------------------------------------------------
183  * Set explicit treatment for the source terms in SYRTHES volume couplings
184  *----------------------------------------------------------------------------*/
185 
186 void
188 
189 /*----------------------------------------------------------------------------
190  * Initialize communicator for SYRTHES coupling
191  *
192  * parameters:
193  * syr_coupling <-> Syrthes coupling structure
194  * coupling_id <-- id of this coupling (for log file message)
195  * syr_root_rank <-- SYRTHES root rank
196  * n_syr_ranks <-- Number of ranks associated with SYRTHES
197  *----------------------------------------------------------------------------*/
198 
199 void
201  int coupling_id,
202  int syr_root_rank,
203  int n_syr_ranks);
204 
205 /*----------------------------------------------------------------------------
206  * Define coupled mesh and send it to SYRTHES
207  *
208  * Optional post-processing output is also built at this stage.
209  *
210  * parameters:
211  * syr_coupling <-- SYRTHES coupling structure
212  *----------------------------------------------------------------------------*/
213 
214 void
216 
217 /*----------------------------------------------------------------------------
218  * Return 1 if this coupling is a surface coupling else 0
219  *
220  * parameters:
221  * syr_coupling <-- SYRTHES coupling structure
222  *
223  * returns:
224  * 1 or 0
225  *----------------------------------------------------------------------------*/
226 
227 int
228 cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling);
229 
230 /*----------------------------------------------------------------------------
231  * Return 1 if this coupling is a volume coupling else 0
232  *
233  * parameters:
234  * syr_coupling <-- SYRTHES coupling structure
235  *
236  * returns:
237  * 1 or 0
238  *----------------------------------------------------------------------------*/
239 
240 int
241 cs_syr4_coupling_is_vol(const cs_syr4_coupling_t *syr_coupling);
242 
243 /*----------------------------------------------------------------------------
244  * Get number of associated coupled elements in main mesh
245  *
246  * parameters:
247  * syr_coupling <-- SYRTHES coupling structure
248  * mode <-- 0 (surface); 1 (volume)
249  *
250  * returns:
251  * number of vertices in coupled mesh
252  *----------------------------------------------------------------------------*/
253 
254 cs_lnum_t
256  int mode);
257 
258 /*----------------------------------------------------------------------------
259  * Get local numbering of coupled elements
260  *
261  * parameters:
262  * syr_coupling <-- SYRTHES coupling structure
263  * cpl_elt_ids --> List of coupled elements (0 to n-1)
264  * mode <-- 0 (surface); 1 (volume)
265  *----------------------------------------------------------------------------*/
266 
267 void
269  cs_lnum_t cpl_elt_ids[],
270  int mode);
271 
272 /*----------------------------------------------------------------------------
273  * Receive coupling variables from SYRTHES
274  *
275  * parameters:
276  * syr_coupling <-- SYRTHES coupling structure
277  * tsolid --> solid temperature
278  * mode <-- 0: surface coupling; 1: volume coupling
279  *----------------------------------------------------------------------------*/
280 
281 void
283  cs_real_t tsolid[],
284  int mode);
285 
286 /*----------------------------------------------------------------------------
287  * Send coupling variables to SYRTHES
288  *
289  * parameters:
290  * syr_coupling <-- SYRTHES coupling structure
291  * cpl_elt_ids <-- ids of coupled elements
292  * tf <-- fluid temperature
293  * hf <-- fluid heat exchange coef. (numerical or user-defined)
294  * mode <-- 0: surface coupling; 1: volume coupling
295  *----------------------------------------------------------------------------*/
296 
297 void
299  const cs_lnum_t cpl_elt_ids[],
300  cs_real_t tf[],
301  cs_real_t hf[],
302  int mode);
303 
304 /*----------------------------------------------------------------------------
305  * Compute the explicit/implicit contribution to source terms in case of
306  * volume coupling with SYRTHES4
307  *
308  * parameters:
309  * syr_coupling <-- SYRTHES coupling structure
310  * tf <-- fluid temperature
311  * ctbimp <-> implicit contribution
312  * ctbexp <-> explicit contribution
313  *----------------------------------------------------------------------------*/
314 
315 void
317  const cs_real_t tf[],
318  cs_real_t ctbimp[],
319  cs_real_t ctbexp[]);
320 
321 /*----------------------------------------------------------------------------*/
322 
324 
325 #endif /* __CS_SYR4_COUPLING_H__ */
cs_syr4_coupling_t * cs_syr4_coupling_by_id(int coupling_id)
Definition: cs_syr4_coupling.c:1341
void cs_syr4_coupling_set_explicit_treatment(void)
Definition: cs_syr4_coupling.c:1567
void cs_syr4_coupling_all_destroy(void)
Definition: cs_syr4_coupling.c:1487
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
int cs_syr4_coupling_is_vol(const cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1718
cs_syr4_coupling_t * cs_syr4_coupling_define(int dim, int ref_axis, const char *syr_name, bool allow_nonmatching, float tolerance, int verbosity, int visualization)
Definition: cs_syr4_coupling.c:1369
void cs_syr4_coupling_recv_tsolid(cs_syr4_coupling_t *syr_coupling, cs_real_t tsolid[], int mode)
Definition: cs_syr4_coupling.c:1806
void cs_syr4_coupling_set_conservativity(int flag)
Definition: cs_syr4_coupling.c:1557
double cs_real_t
Floating-point value.
Definition: cs_defs.h:307
void cs_syr4_coupling_ts_contrib(const cs_syr4_coupling_t *syr_coupling, const cs_real_t tf[], cs_real_t ctbimp[], cs_real_t ctbexp[])
Definition: cs_syr4_coupling.c:1935
int cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1695
int cs_syr4_coupling_n_couplings(void)
Definition: cs_syr4_coupling.c:1325
void cs_syr4_coupling_send_tf_hf(cs_syr4_coupling_t *syr_coupling, const cs_lnum_t cpl_elt_ids[], cs_real_t tf[], cs_real_t hf[], int mode)
Definition: cs_syr4_coupling.c:1857
void cs_syr4_coupling_add_location(cs_syr4_coupling_t *syr_coupling, int location_id)
Definition: cs_syr4_coupling.c:1460
void cs_syr4_coupling_init_mesh(cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1643
void cs_syr4_coupling_get_elt_ids(const cs_syr4_coupling_t *syr_coupling, cs_lnum_t cpl_elt_ids[], int mode)
Definition: cs_syr4_coupling.c:1774
void ctbvsy(int *numsyr, cs_real_t *tfluid, cs_real_t *ctbimp, cs_real_t *ctbexp)
const char * cs_syr4_coupling_get_name(cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1538
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
#define END_C_DECLS
Definition: cs_defs.h:496
#define CS_PROCF(x, y)
Definition: cs_defs.h:509
void cs_syr4_coupling_init_comm(cs_syr4_coupling_t *syr_coupling, int coupling_id, int syr_root_rank, int n_syr_ranks)
Definition: cs_syr4_coupling.c:1583
struct _cs_syr4_coupling_t cs_syr4_coupling_t
Definition: cs_syr4_coupling.h:54
cs_lnum_t cs_syr4_coupling_get_n_elts(const cs_syr4_coupling_t *syr_coupling, int mode)
Definition: cs_syr4_coupling.c:1742