My Project
programmer's 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-2019 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  cs_int_t *numsyr,
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(cs_int_t 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  * Set conservativity forcing flag to True (1) or False (0) for all defined
150  * SYRTHES couplings
151  *
152  * parameter:
153  * flag <-- Conservativity forcing flag to set
154  *----------------------------------------------------------------------------*/
155 
156 void
158 
159 /*----------------------------------------------------------------------------
160  * Set explicit treatment for the source terms in SYRTHES volume couplings
161  *----------------------------------------------------------------------------*/
162 
163 void
165 
166 /*----------------------------------------------------------------------------
167  * Initialize communicator for SYRTHES coupling
168  *
169  * parameters:
170  * syr_coupling <-> Syrthes coupling structure
171  * coupling_id <-- id of this coupling (for log file message)
172  * syr_root_rank <-- SYRTHES root rank
173  * n_syr_ranks <-- Number of ranks associated with SYRTHES
174  *----------------------------------------------------------------------------*/
175 
176 void
178  int coupling_id,
179  int syr_root_rank,
180  int n_syr_ranks);
181 
182 /*----------------------------------------------------------------------------
183  * Define coupled mesh and send it to SYRTHES
184  *
185  * Optional post-processing output is also built at this stage.
186  *
187  * parameters:
188  * syr_coupling <-- SYRTHES coupling structure
189  *----------------------------------------------------------------------------*/
190 
191 void
193 
194 /*----------------------------------------------------------------------------
195  * Return 1 if this coupling is a surface coupling else 0
196  *
197  * parameters:
198  * syr_coupling <-- SYRTHES coupling structure
199  *
200  * returns:
201  * 1 or 0
202  *----------------------------------------------------------------------------*/
203 
204 int
205 cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling);
206 
207 /*----------------------------------------------------------------------------
208  * Return 1 if this coupling is a volume 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_vol(const cs_syr4_coupling_t *syr_coupling);
219 
220 /*----------------------------------------------------------------------------
221  * Get number of associated coupled elements in main mesh
222  *
223  * parameters:
224  * syr_coupling <-- SYRTHES coupling structure
225  * mode <-- 0 (surface); 1 (volume)
226  *
227  * returns:
228  * number of vertices in coupled mesh
229  *----------------------------------------------------------------------------*/
230 
231 cs_lnum_t
233  int mode);
234 
235 /*----------------------------------------------------------------------------
236  * Get local numbering of coupled elements
237  *
238  * parameters:
239  * syr_coupling <-- SYRTHES coupling structure
240  * cpl_elt_lst --> List of coupled elements (1 to n)
241  * mode <-- 0 (surface); 1 (volume)
242  *----------------------------------------------------------------------------*/
243 
244 void
246  cs_int_t cpl_elt_lst[],
247  int mode);
248 
249 /*----------------------------------------------------------------------------
250  * Receive coupling variables from SYRTHES
251  *
252  * parameters:
253  * syr_coupling <-- SYRTHES coupling structure
254  * tsolid --> solid temperature
255  * mode <-- 0: surface coupling; 1: volume coupling
256  *----------------------------------------------------------------------------*/
257 
258 void
260  cs_real_t tsolid[],
261  int mode);
262 
263 /*----------------------------------------------------------------------------
264  * Send coupling variables to SYRTHES
265  *
266  * parameters:
267  * syr_coupling <-- SYRTHES coupling structure
268  * cpl_elt_list <-- list of coupled boundary faces
269  * tf <-- fluid temperature
270  * hf <-- fluid heat exchange coef. (numerical or user-defined)
271  * mode <-- 0 (surface); 1 (volume)
272  *----------------------------------------------------------------------------*/
273 
274 void
276  const cs_lnum_t cpl_elt_lst[],
277  cs_real_t tf[],
278  cs_real_t hf[],
279  int mode);
280 
281 /*----------------------------------------------------------------------------
282  * Compute the explicit/implicit contribution to source terms in case of
283  * volume coupling with SYRTHES4
284  *
285  * parameters:
286  * syr_coupling <-- SYRTHES coupling structure
287  * tf <-- fluid temperature
288  * ctbimp <-> implicit contribution
289  * ctbexp <-> explicit contribution
290  *----------------------------------------------------------------------------*/
291 
292 void
294  const cs_real_t tf[],
295  cs_real_t ctbimp[],
296  cs_real_t ctbexp[]);
297 
298 /*----------------------------------------------------------------------------*/
299 
301 
302 #endif /* __CS_SYR4_COUPLING_H__ */
cs_syr4_coupling_all_destroy
void cs_syr4_coupling_all_destroy(void)
Definition: cs_syr4_coupling.c:1425
cs_syr4_coupling_get_elt_list
void cs_syr4_coupling_get_elt_list(const cs_syr4_coupling_t *syr_coupling, cs_int_t cpl_elt_lst[], int mode)
Definition: cs_syr4_coupling.c:1693
cs_syr4_coupling_set_conservativity
void cs_syr4_coupling_set_conservativity(int flag)
Definition: cs_syr4_coupling.c:1478
cs_syr4_coupling_init_comm
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:1504
cs_syr4_coupling_recv_tsolid
void cs_syr4_coupling_recv_tsolid(cs_syr4_coupling_t *syr_coupling, cs_real_t tsolid[], int mode)
Definition: cs_syr4_coupling.c:1726
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_syr4_coupling_is_vol
int cs_syr4_coupling_is_vol(const cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1637
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
tfluid
void cs_real_t * tfluid
Definition: cs_syr4_coupling.h:82
CS_PROCF
void CS_PROCF(ctbvsy, CTBVSY)(cs_int_t *numsyr
mode
void const cs_int_t * mode
Definition: cs_syr_coupling.h:132
tsolid
void cs_int_t cs_real_t * tsolid
Definition: cs_syr_coupling.h:172
cs_syr4_coupling_is_surf
int cs_syr4_coupling_is_surf(const cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1614
cs_syr4_coupling_n_couplings
int cs_syr4_coupling_n_couplings(void)
Definition: cs_syr4_coupling.c:1300
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_syr4_coupling_by_id
cs_syr4_coupling_t * cs_syr4_coupling_by_id(cs_int_t coupling_id)
Definition: cs_syr4_coupling.c:1316
ctbexp
void cs_real_t cs_real_t cs_real_t * ctbexp
Definition: cs_syr4_coupling.h:82
cs_syr4_coupling_init_mesh
void cs_syr4_coupling_init_mesh(cs_syr4_coupling_t *syr_coupling)
Definition: cs_syr4_coupling.c:1564
cs_int_t
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:301
ctbimp
void cs_real_t cs_real_t * ctbimp
Definition: cs_syr4_coupling.h:82
cs_syr4_coupling_add
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:1344
cs_syr4_coupling_t
struct _cs_syr4_coupling_t cs_syr4_coupling_t
Definition: cs_syr4_coupling.h:54
cs_syr4_coupling_ts_contrib
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:1855
cs_syr4_coupling_set_explicit_treatment
void cs_syr4_coupling_set_explicit_treatment(void)
Definition: cs_syr4_coupling.c:1488
cs_syr4_coupling_send_tf_hf
void cs_syr4_coupling_send_tf_hf(cs_syr4_coupling_t *syr_coupling, const cs_lnum_t cpl_elt_lst[], cs_real_t tf[], cs_real_t hf[], int mode)
Definition: cs_syr4_coupling.c:1777
cs_base.h
cs_syr4_coupling_get_n_elts
cs_lnum_t cs_syr4_coupling_get_n_elts(const cs_syr4_coupling_t *syr_coupling, int mode)
Definition: cs_syr4_coupling.c:1661