8.0
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  * PLE library headers
32  *----------------------------------------------------------------------------*/
33 
34 #include <ple_locator.h>
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "fvm_nodal.h"
41 
42 #include "cs_base.h"
43 #include "cs_halo.h"
44 #include "cs_mesh.h"
45 #include "cs_mesh_quantities.h"
46 
47 /*----------------------------------------------------------------------------*/
48 
50 
51 /*============================================================================
52  * Local Macro definitions
53  *============================================================================*/
54 
55 /*============================================================================
56  * Type definitions
57  *============================================================================*/
58 
59 /*============================================================================
60  * Type definitions
61  *============================================================================*/
62 
65 typedef enum {
66 
69  CS_CTWR_MERKEL = 2
72 
75 typedef enum {
76 
81 
82 typedef struct _cs_ctwr_zone_t cs_ctwr_zone_t;
83 
88 /*----------------------------------------------------------------------------
89  * Cooling Tower model options descriptor
90  *----------------------------------------------------------------------------*/
91 
92 typedef struct {
94  bool has_rain;
96 
97 /*============================================================================
98  * Static global variables
99  *============================================================================*/
100 
101 /* Pointer to cooling tower model options structure */
103 
104 /*============================================================================
105  * Public function definitions
106  *============================================================================*/
107 
108 /*----------------------------------------------------------------------------
109  * Add variables fields
110  *----------------------------------------------------------------------------*/
111 
112 void
114 
115 /*----------------------------------------------------------------------------
116  * Add property fields
117  *----------------------------------------------------------------------------*/
118 
119 void
121 
122 /*----------------------------------------------------------------------------
123  * Automatic boundary condition for cooling towers
124  *----------------------------------------------------------------------------*/
125 
126 void
127 cs_ctwr_bcond(void);
128 
129 /*----------------------------------------------------------------------------
130  * Initialize cooling towers fields, stage 0
131  *----------------------------------------------------------------------------*/
132 
133 void
135 
136 /*----------------------------------------------------------------------------
137  * Initialize cooling towers fields, stage 1
138  *----------------------------------------------------------------------------*/
139 
140 void
142 
143 
144 /*----------------------------------------------------------------------------
145  * Provide access to cs_ctwr_option
146  *----------------------------------------------------------------------------*/
147 
150 
151 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
169 void
170 cs_ctwr_define(const char zone_criteria[],
171  cs_ctwr_zone_type_t zone_type,
172  cs_real_t delta_t,
173  cs_real_t relax,
174  cs_real_t t_l_bc,
175  cs_real_t q_l_bc,
176  cs_real_t xap,
177  cs_real_t xnp,
178  cs_real_t surface,
179  cs_real_t xleak_fac);
180 
181 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 void
189 
190 /*----------------------------------------------------------------------------*/
200 /*----------------------------------------------------------------------------*/
201 
202 void
204 
205 /*----------------------------------------------------------------------------*/
210 /*----------------------------------------------------------------------------*/
211 
212 void
214 
215 /*----------------------------------------------------------------------------*/
220 /*----------------------------------------------------------------------------*/
221 
222 void
223 cs_ctwr_build_all(void);
224 
225 /*----------------------------------------------------------------------------*/
229 /*----------------------------------------------------------------------------*/
230 
231 void
232 cs_ctwr_all_destroy(void);
233 
234 /*----------------------------------------------------------------------------*/
238 /*----------------------------------------------------------------------------*/
239 
240 void
241 cs_ctwr_log_setup(void);
242 
243 /*----------------------------------------------------------------------------*/
247 /*----------------------------------------------------------------------------*/
248 
249 void
250 cs_ctwr_log_balance(void);
251 
252 /*----------------------------------------------------------------------------*/
261 /*----------------------------------------------------------------------------*/
262 
263 void
265  cs_real_t t0,
266  cs_real_t p0,
267  cs_real_t molmassrat);
268 
269 /*----------------------------------------------------------------------------*/
279 /*----------------------------------------------------------------------------*/
280 
281 void
283  cs_real_t t0,
284  cs_real_t p0,
285  cs_real_t humidity0,
286  cs_real_t molmassrat);
287 
288 /*----------------------------------------------------------------------------*/
295 /*----------------------------------------------------------------------------*/
296 
297 void
298 cs_ctwr_init_flow_vars(cs_real_t liq_mass_flow[]);
299 
300 /*----------------------------------------------------------------------------*/
309 /*----------------------------------------------------------------------------*/
310 
311 void
313  cs_real_t t0,
314  cs_real_t p0);
315 
316 /*----------------------------------------------------------------------------*/
325 /*----------------------------------------------------------------------------*/
326 
327 void
328 cs_ctwr_source_term(int f_id,
329  cs_real_t exp_st[],
330  cs_real_t imp_st[]);
331 
332 /*----------------------------------------------------------------------------*/
340 /*----------------------------------------------------------------------------*/
341 
342 void
344 
345 /*----------------------------------------------------------------------------
346  * Get pointer to exchange area.
347  *
348  * parameters:
349  * ct_id <-- Id (0 to n-1) of exchange area
350  *
351  * returns:
352  * pointer to exchange area structure
353  *----------------------------------------------------------------------------*/
354 
356 cs_ctwr_by_id(int ct_id);
357 
358 /*----------------------------------------------------------------------------*/
359 
361 
362 #endif /* __CS_CTWR_H__ */
void cs_ctwr_add_property_fields(void)
Definition: cs_ctwr.c:610
void cs_ctwr_log_balance(void)
Perform balances in packing zones.
Definition: cs_ctwr.c:1329
void cs_ctwr_fields_init1(void)
Definition: cs_ctwr.c:917
void cs_ctwr_add_variable_fields(void)
Definition: cs_ctwr.c:336
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:2876
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:1700
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:1943
void cs_ctwr_all_destroy(void)
Destroy cs_ctwr_t structures.
Definition: cs_ctwr.c:1223
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:2367
void cs_ctwr_bcond(void)
Definition: cs_ctwr.c:714
cs_ctwr_option_t * cs_get_glob_ctwr_option(void)
Definition: cs_ctwr.c:957
cs_ctwr_zone_t * cs_ctwr_by_id(int ct_id)
Definition: cs_ctwr.c:2909
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:1512
cs_ctwr_zone_type_t
Definition: cs_ctwr.h:75
@ CS_CTWR_COUNTER_CURRENT
Definition: cs_ctwr.h:77
@ CS_CTWR_CROSS_CURRENT
Definition: cs_ctwr.h:78
cs_ctwr_model_t
Definition: cs_ctwr.h:65
@ CS_CTWR_MERKEL
Definition: cs_ctwr.h:69
@ CS_CTWR_NONE
Definition: cs_ctwr.h:67
@ CS_CTWR_POPPE
Definition: cs_ctwr.h:68
void cs_ctwr_field_pointer_map(void)
Map fields used by the cooling tower module to pointers.
Definition: cs_ctwr.c:1125
void cs_ctwr_define(const char zone_criteria[], 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:981
void cs_ctwr_fields_init0(void)
Definition: cs_ctwr.c:835
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:2167
void cs_ctwr_build_all(void)
Define the cells belonging to the different packing zones.
Definition: cs_ctwr.c:1194
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:1150
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:1253
struct _cs_ctwr_zone_t cs_ctwr_zone_t
Definition: cs_ctwr.h:82
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
#define END_C_DECLS
Definition: cs_defs.h:510
real(c_double), pointer, save p0
reference pressure for the total pressure.
Definition: cstphy.f90:167
real(c_double), pointer, save t0
reference temperature.
Definition: cstphy.f90:214
Definition: cs_ctwr.h:92
int evap_model
Definition: cs_ctwr.h:93
bool has_rain
Definition: cs_ctwr.h:94