6.2
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 4 coupling
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2020 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 a syr4_coupling_t structure.
116  *
117  * parameters:
118  * dim <-- spatial mesh dimension
119  * ref_axis <-- reference axis
120  * face_sel_criterion <-- criterion for selection of boundary faces
121  * cell_sel_criterion <-- criterion for selection of cells
122  * app_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 
130 void
131 cs_syr4_coupling_add(int dim,
132  int ref_axis,
133  const char *face_sel_criterion,
134  const char *cell_sel_criterion,
135  const char *app_name,
136  bool allow_nonmatching,
137  float tolerance,
138  int verbosity,
139  int visualization);
140 
141 /*----------------------------------------------------------------------------
142  * Destroy cs_syr4_coupling_t structures
143  *----------------------------------------------------------------------------*/
144 
145 void
147 
148 /*----------------------------------------------------------------------------
149  * Get name of SYRTHES coupling.
150  *
151  * parameters:
152  * syr_coupling <-- SYRTHES coupling structure
153  *
154  * returns:
155  * pointer to SYRTHES coupling name
156  *----------------------------------------------------------------------------*/
157 
158 const char *
160 
161 /*----------------------------------------------------------------------------
162  * Set conservativity forcing flag to True (1) or False (0) for all defined
163  * SYRTHES couplings
164  *
165  * parameter:
166  * flag <-- Conservativity forcing flag to set
167  *----------------------------------------------------------------------------*/
168 
169 void
171 
172 /*----------------------------------------------------------------------------
173  * Set explicit treatment for the source terms in SYRTHES volume couplings
174  *----------------------------------------------------------------------------*/
175 
176 void
178 
179 /*----------------------------------------------------------------------------
180  * Initialize communicator for SYRTHES coupling
181  *
182  * parameters:
183  * syr_coupling <-> Syrthes coupling structure
184  * coupling_id <-- id of this coupling (for log file message)
185  * syr_root_rank <-- SYRTHES root rank
186  * n_syr_ranks <-- Number of ranks associated with SYRTHES
187  *----------------------------------------------------------------------------*/
188 
189 void
191  int coupling_id,
192  int syr_root_rank,
193  int n_syr_ranks);
194 
195 /*----------------------------------------------------------------------------
196  * Define coupled mesh and send it to SYRTHES
197  *
198  * Optional post-processing output is also built at this stage.
199  *
200  * parameters:
201  * syr_coupling <-- SYRTHES coupling structure
202  *----------------------------------------------------------------------------*/
203 
204 void
206 
207 /*----------------------------------------------------------------------------
208  * Return 1 if this coupling is a surface coupling else 0
209  *
210  * parameters:
211  * syr_coupling <-- SYRTHES coupling structure
212  *
213  * returns:
214  * 1 or 0
215  *----------------------------------------------------------------------------*/
216 
217 int
218 cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling);
219 
220 /*----------------------------------------------------------------------------
221  * Return 1 if this coupling is a volume coupling else 0
222  *
223  * parameters:
224  * syr_coupling <-- SYRTHES coupling structure
225  *
226  * returns:
227  * 1 or 0
228  *----------------------------------------------------------------------------*/
229 
230 int
231 cs_syr4_coupling_is_vol(const cs_syr4_coupling_t *syr_coupling);
232 
233 /*----------------------------------------------------------------------------
234  * Get number of associated coupled elements in main mesh
235  *
236  * parameters:
237  * syr_coupling <-- SYRTHES coupling structure
238  * mode <-- 0 (surface); 1 (volume)
239  *
240  * returns:
241  * number of vertices in coupled mesh
242  *----------------------------------------------------------------------------*/
243 
244 cs_lnum_t
246  int mode);
247 
248 /*----------------------------------------------------------------------------
249  * Get local numbering of coupled elements
250  *
251  * parameters:
252  * syr_coupling <-- SYRTHES coupling structure
253  * cpl_elt_ids --> List of coupled elements (0 to n-1)
254  * mode <-- 0 (surface); 1 (volume)
255  *----------------------------------------------------------------------------*/
256 
257 void
259  cs_lnum_t cpl_elt_ids[],
260  int mode);
261 
262 /*----------------------------------------------------------------------------
263  * Receive coupling variables from SYRTHES
264  *
265  * parameters:
266  * syr_coupling <-- SYRTHES coupling structure
267  * tsolid --> solid temperature
268  * mode <-- 0: surface coupling; 1: volume coupling
269  *----------------------------------------------------------------------------*/
270 
271 void
273  cs_real_t tsolid[],
274  int mode);
275 
276 /*----------------------------------------------------------------------------
277  * Send coupling variables to SYRTHES
278  *
279  * parameters:
280  * syr_coupling <-- SYRTHES coupling structure
281  * cpl_elt_ids <-- ids of coupled elements
282  * tf <-- fluid temperature
283  * hf <-- fluid heat exchange coef. (numerical or user-defined)
284  * mode <-- 0: surface coupling; 1: volume coupling
285  *----------------------------------------------------------------------------*/
286 
287 void
289  const cs_lnum_t cpl_elt_ids[],
290  cs_real_t tf[],
291  cs_real_t hf[],
292  int mode);
293 
294 /*----------------------------------------------------------------------------
295  * Compute the explicit/implicit contribution to source terms in case of
296  * volume coupling with SYRTHES4
297  *
298  * parameters:
299  * syr_coupling <-- SYRTHES coupling structure
300  * tf <-- fluid temperature
301  * ctbimp <-> implicit contribution
302  * ctbexp <-> explicit contribution
303  *----------------------------------------------------------------------------*/
304 
305 void
307  const cs_real_t tf[],
308  cs_real_t ctbimp[],
309  cs_real_t ctbexp[]);
310 
311 /*----------------------------------------------------------------------------*/
312 
314 
315 #endif /* __CS_SYR4_COUPLING_H__ */
cs_syr4_coupling_t * cs_syr4_coupling_by_id(int coupling_id)
Definition: cs_syr4_coupling.c:1317
void cs_syr4_coupling_set_explicit_treatment(void)
Definition: cs_syr4_coupling.c:1510
void cs_syr4_coupling_all_destroy(void)
Definition: cs_syr4_coupling.c:1426
#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:1659
void cs_syr4_coupling_recv_tsolid(cs_syr4_coupling_t *syr_coupling, cs_real_t tsolid[], int mode)
Definition: cs_syr4_coupling.c:1747
void cs_syr4_coupling_set_conservativity(int flag)
Definition: cs_syr4_coupling.c:1500
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:1876
int cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1636
int cs_syr4_coupling_n_couplings(void)
Definition: cs_syr4_coupling.c:1301
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:1798
void cs_syr4_coupling_init_mesh(cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1586
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:1715
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:1481
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_add(int dim, int ref_axis, const char *face_sel_criterion, const char *cell_sel_criterion, const char *app_name, bool allow_nonmatching, float tolerance, int verbosity, int visualization)
Definition: cs_syr4_coupling.c:1345
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:1526
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:1683