8.1
general documentation
cs_ctwr.h
Go to the documentation of this file.
1 #ifndef __CS_CTWR_H__
2 #define __CS_CTWR_H__
3 
4 /*============================================================================
5  * Cooling towers related functions
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2023 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  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "fvm_nodal.h"
35 
36 #include "cs_base.h"
37 #include "cs_halo.h"
38 #include "cs_mesh.h"
39 #include "cs_mesh_quantities.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Local Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Type definitions
55  *============================================================================*/
56 
59 typedef enum {
60 
63  CS_CTWR_MERKEL = 2
66 
69 typedef enum {
70 
76 
77 typedef struct _cs_ctwr_zone_t cs_ctwr_zone_t;
78 
83 /*----------------------------------------------------------------------------
84  * Cooling Tower model options descriptor
85  *----------------------------------------------------------------------------*/
86 
87 typedef struct {
88 
90  bool has_rain;
94 
95 /*============================================================================
96  * Static global variables
97  *============================================================================*/
98 
99 /* Pointer to cooling tower model options structure */
101 
102 /*============================================================================
103  * Public function definitions
104  *============================================================================*/
105 
106 /*----------------------------------------------------------------------------
107  * Add variables fields
108  *----------------------------------------------------------------------------*/
109 
110 void
112 
113 /*----------------------------------------------------------------------------
114  * Add property fields
115  *----------------------------------------------------------------------------*/
116 
117 void
119 
120 /*----------------------------------------------------------------------------
121  * Automatic boundary condition for cooling towers
122  *----------------------------------------------------------------------------*/
123 
124 void
125 cs_ctwr_bcond(void);
126 
127 /*----------------------------------------------------------------------------
128  * Initialize cooling towers fields, stage 0
129  *----------------------------------------------------------------------------*/
130 
131 void
133 
134 /*----------------------------------------------------------------------------
135  * Initialize cooling towers fields, stage 1
136  *----------------------------------------------------------------------------*/
137 
138 void
140 
141 /*----------------------------------------------------------------------------
142  * Provide access to cs_ctwr_option
143  *----------------------------------------------------------------------------*/
144 
147 
148 /*----------------------------------------------------------------------------*/
165 /*----------------------------------------------------------------------------*/
166 
167 void
168 cs_ctwr_define(const char zone_criteria[],
169  int z_id,
170  cs_ctwr_zone_type_t zone_type,
171  cs_real_t delta_t,
172  cs_real_t relax,
173  cs_real_t t_l_bc,
174  cs_real_t q_l_bc,
175  cs_real_t xap,
176  cs_real_t xnp,
177  cs_real_t surface,
178  cs_real_t xleak_fac);
179 
180 /*----------------------------------------------------------------------------*/
184 /*----------------------------------------------------------------------------*/
185 
186 void
188 
189 /*----------------------------------------------------------------------------*/
199 /*----------------------------------------------------------------------------*/
200 
201 void
203 
204 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 void
212 
213 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 void
220 cs_ctwr_build_all(void);
221 
222 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
228 void
229 cs_ctwr_all_destroy(void);
230 
231 /*----------------------------------------------------------------------------*/
235 /*----------------------------------------------------------------------------*/
236 
237 void
238 cs_ctwr_log_setup(void);
239 
240 /*----------------------------------------------------------------------------*/
244 /*----------------------------------------------------------------------------*/
245 
246 void
247 cs_ctwr_log_balance(void);
248 
249 /*----------------------------------------------------------------------------*/
258 /*----------------------------------------------------------------------------*/
259 
260 void
262  cs_real_t t0,
263  cs_real_t p0,
264  cs_real_t molmassrat);
265 
266 /*----------------------------------------------------------------------------*/
276 /*----------------------------------------------------------------------------*/
277 
278 void
280  cs_real_t t0,
281  cs_real_t p0,
282  cs_real_t humidity0,
283  cs_real_t molmassrat);
284 
285 /*----------------------------------------------------------------------------*/
292 /*----------------------------------------------------------------------------*/
293 
294 void
295 cs_ctwr_init_flow_vars(cs_real_t liq_mass_flow[]);
296 
297 /*----------------------------------------------------------------------------*/
306 /*----------------------------------------------------------------------------*/
307 
308 void
310  cs_real_t t0,
311  cs_real_t p0);
312 
313 /*----------------------------------------------------------------------------*/
322 /*----------------------------------------------------------------------------*/
323 
324 void
325 cs_ctwr_source_term(int f_id,
326  cs_real_t exp_st[],
327  cs_real_t imp_st[]);
328 
329 /*----------------------------------------------------------------------------*/
337 /*----------------------------------------------------------------------------*/
338 
339 void
341 
342 /*----------------------------------------------------------------------------
343  * Get pointer to exchange area.
344  *
345  * parameters:
346  * ct_id <-- Id (0 to n-1) of exchange area
347  *
348  * returns:
349  * pointer to exchange area structure
350  *----------------------------------------------------------------------------*/
351 
353 cs_ctwr_by_id(int ct_id);
354 
355 /*----------------------------------------------------------------------------*/
356 
358 
359 #endif /* __CS_CTWR_H__ */
void cs_ctwr_add_property_fields(void)
Definition: cs_ctwr.c:724
void cs_ctwr_log_balance(void)
Perform balances in packing zones.
Definition: cs_ctwr.c:1670
void cs_ctwr_fields_init1(void)
Definition: cs_ctwr.c:1191
void cs_ctwr_define(const char zone_criteria[], int z_id, cs_ctwr_zone_type_t zone_type, cs_real_t delta_t, cs_real_t relax, cs_real_t t_l_bc, cs_real_t q_l_bc, cs_real_t xap, cs_real_t xnp, cs_real_t surface, cs_real_t xleak_fac)
Define a cooling tower exchange zone.
Definition: cs_ctwr.c:1255
void cs_ctwr_add_variable_fields(void)
Definition: cs_ctwr.c:418
void cs_ctwr_bulk_mass_source_term(cs_real_t mass_source[])
Phase change mass source term from the evaporating liquid to the bulk, humid air.
Definition: cs_ctwr.c:3674
void cs_ctwr_init_flow_vars(cs_real_t liq_mass_flow[])
Initialize the flow variables relevant to the cooling tower scalars inside the packing zones.
Definition: cs_ctwr.c:2066
void cs_ctwr_restart_field_vars(cs_real_t rho0, cs_real_t t0, cs_real_t p0, cs_real_t humidity0, cs_real_t molmassrat)
Reset the field variables based on the restart values.
Definition: cs_ctwr.c:2312
void cs_ctwr_all_destroy(void)
Destroy cs_ctwr_t structures.
Definition: cs_ctwr.c:1547
void cs_ctwr_source_term(int f_id, cs_real_t exp_st[], cs_real_t imp_st[])
Phase change source terms - Exchange terms between the injected liquid and the water vapor phase in t...
Definition: cs_ctwr.c:2878
void cs_ctwr_bcond(void)
Definition: cs_ctwr.c:986
cs_ctwr_option_t * cs_get_glob_ctwr_option(void)
Definition: cs_ctwr.c:1230
cs_ctwr_zone_t * cs_ctwr_by_id(int ct_id)
Definition: cs_ctwr.c:3707
void cs_ctwr_init_field_vars(cs_real_t rho0, cs_real_t t0, cs_real_t p0, cs_real_t molmassrat)
Initialize the field variables.
Definition: cs_ctwr.c:1870
cs_ctwr_zone_type_t
Definition: cs_ctwr.h:69
@ CS_CTWR_INJECTION
Definition: cs_ctwr.h:73
@ CS_CTWR_COUNTER_CURRENT
Definition: cs_ctwr.h:71
@ CS_CTWR_CROSS_CURRENT
Definition: cs_ctwr.h:72
cs_ctwr_model_t
Definition: cs_ctwr.h:59
@ CS_CTWR_MERKEL
Definition: cs_ctwr.h:63
@ CS_CTWR_NONE
Definition: cs_ctwr.h:61
@ CS_CTWR_POPPE
Definition: cs_ctwr.h:62
void cs_ctwr_field_pointer_map(void)
Map fields used by the cooling tower module to pointers.
Definition: cs_ctwr.c:1421
void cs_ctwr_fields_init0(void)
Definition: cs_ctwr.c:1111
void cs_ctwr_phyvar_update(cs_real_t rho0, cs_real_t t0, cs_real_t p0)
Update the thermo physical properties fields for the humid air and the liquid.
Definition: cs_ctwr.c:2556
void cs_ctwr_build_all(void)
Define the cells belonging to the different packing zones.
Definition: cs_ctwr.c:1517
void cs_ctwr_transport_vars(int iflag)
Convert injected liquid scalars from and to their transported form.
void cs_ctwr_define_zones(void)
Define zones.
Definition: cs_ctwr.c:1449
const cs_ctwr_option_t * cs_glob_ctwr_option
void cs_ctwr_log_setup(void)
Log Packing zone definition setup information.
Definition: cs_ctwr.c:1575
struct _cs_ctwr_zone_t cs_ctwr_zone_t
Definition: cs_ctwr.h:77
#define BEGIN_C_DECLS
Definition: cs_defs.h:514
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:515
real(c_double), pointer, save p0
reference pressure for the total pressure.
Definition: cstphy.f90:170
real(c_double), pointer, save t0
reference temperature.
Definition: cstphy.f90:217
Definition: cs_ctwr.h:87
cs_ctwr_model_t evap_model
Definition: cs_ctwr.h:89
bool has_rain
Definition: cs_ctwr.h:90
bool solve_rain_velocity
Definition: cs_ctwr.h:91