8.2
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-2024 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 /* Cooling tower exchange zone structure definition */
78 /*--------------------------------------------------*/
79 
81 
82  int num; /* Exchange zone number */
83  char *criteria; /* Exchange zone selection criteria */
84  int z_id; /* id of the volume zone */
85  char *name; /* Exchange zone name */
86  char *file_name; /* Exchange zone budget file name */
87  cs_ctwr_zone_type_t type; /* Zone type */
88 
89  cs_real_t hmin; /* Minimum vertical height of exchange zone */
90  cs_real_t hmax; /* Maximum height of exchange zone */
91  cs_real_t delta_t; /* Temperature delta required for exchange zone
92  if positive */
93  cs_real_t relax; /* Relaxation of the imposed temperature */
94 
95  cs_real_t t_l_bc; /* Water entry temperature */
96  cs_real_t q_l_bc; /* Water flow */
97 
98  cs_real_t xap; /* Exchange law a_0 coefficient */
99  cs_real_t xnp; /* Exchange law n exponent */
100 
101  cs_real_t surface_in; /* Water inlet surface */
102  cs_real_t surface_out; /* Water outlet surface */
103  cs_real_t surface; /* Total surface */
104 
105  cs_real_t xleak_fac; /* Leakage factor (ratio of outlet/inlet
106  flow rate) */
107  cs_real_t v_liq_pack; /* Vertical liquid film velocity in packing */
108 
109  cs_lnum_t n_cells; /* Number of air cells belonging to the zone */
110  cs_real_t vol_f; /* Cooling tower zone total volume */
111 
112  int up_ct_id; /* Id of upstream exchange zone (if any) */
113 
114  cs_lnum_t n_inlet_faces; /* Number of inlet faces */
115  cs_lnum_t n_outlet_faces; /* Number of outlet faces */
116  cs_lnum_t *inlet_faces_ids; /* List of inlet faces */
117  cs_lnum_t *outlet_faces_ids; /* List of outlet faces */
118 
119  cs_lnum_t n_outlet_cells; /* Number of outlet cells */
120  cs_lnum_t *outlet_cells_ids; /* List of outlet cells */
121 
122  cs_real_t p_in; /* Average inlet pressure */
123  cs_real_t p_out; /* Average outlet pressure */
124  cs_real_t q_l_in; /* Water entry flow */
125  cs_real_t q_l_out; /* Water exit flow */
126  cs_real_t t_l_in; /* Mean water entry temperature */
127  cs_real_t t_l_out; /* Mean water exit temperature */
128  cs_real_t h_l_in; /* Mean water entry enthalpy */
129  cs_real_t h_l_out; /* Mean water exit enthalpy */
130  cs_real_t t_h_in; /* Mean air entry temperature */
131  cs_real_t t_h_out; /* Mean air exit temperature */
132  cs_real_t xair_e; /* Mean air entry humidity */
133  cs_real_t xair_s; /* Mean air exit humidity */
134  cs_real_t h_h_in; /* Mean air entry enthalpy */
135  cs_real_t h_h_out; /* Mean air exit enthalpy */
136  cs_real_t q_h_in; /* Air entry flow */
137  cs_real_t q_h_out; /* Air exit flow */
138 
139 };
140 
141 typedef struct _cs_ctwr_zone_t cs_ctwr_zone_t;
142 
147 /*----------------------------------------------------------------------------
148  * Cooling Tower model options descriptor
149  *----------------------------------------------------------------------------*/
150 
151 typedef struct {
152 
154  bool has_rain;
161 
162 
163 /*============================================================================
164  * Static global variables
165  *============================================================================*/
166 
167 /* Pointer to cooling tower model options structure */
169 
170 /* Make number of cooling towers zones accessible */
171 
172 /*============================================================================
173  * Public function definitions
174  *============================================================================*/
175 
176 /*----------------------------------------------------------------------------
177  * Provide access to cs_ctwr_option
178  *----------------------------------------------------------------------------*/
179 
182 
183 /*----------------------------------------------------------------------------
184  * Provide access to cs_ctwr_zone
185  *----------------------------------------------------------------------------*/
186 
187 cs_ctwr_zone_t **
189 
190 /*----------------------------------------------------------------------------
191  * Provide access to number of ct zones
192  *----------------------------------------------------------------------------*/
193 
194 int *
196 
197 
198 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
218 cs_ctwr_define(const char zone_criteria[],
219  int z_id,
220  cs_ctwr_zone_type_t zone_type,
221  cs_real_t delta_t,
222  cs_real_t relax,
223  cs_real_t t_l_bc,
224  cs_real_t q_l_bc,
225  cs_real_t xap,
226  cs_real_t xnp,
227  cs_real_t surface,
228  cs_real_t xleak_fac);
229 
230 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
238 
239 /*----------------------------------------------------------------------------*/
243 /*----------------------------------------------------------------------------*/
244 
245 void
247 
248 /*----------------------------------------------------------------------------*/
252 /*----------------------------------------------------------------------------*/
253 
254 void
255 cs_ctwr_build_all(void);
256 
257 /*----------------------------------------------------------------------------*/
261 /*----------------------------------------------------------------------------*/
262 
263 void
264 cs_ctwr_all_destroy(void);
265 
266 /*----------------------------------------------------------------------------*/
270 /*----------------------------------------------------------------------------*/
271 
272 void
273 cs_ctwr_log_setup(void);
274 
275 /*----------------------------------------------------------------------------*/
279 /*----------------------------------------------------------------------------*/
280 
281 void
282 cs_ctwr_log_balance(void);
283 
284 /*----------------------------------------------------------------------------*/
292 /*----------------------------------------------------------------------------*/
293 
294 void
296 
297 /*----------------------------------------------------------------------------
298  * Get pointer to exchange area.
299  *
300  * parameters:
301  * ct_id <-- Id (0 to n-1) of exchange area
302  *
303  * returns:
304  * pointer to exchange area structure
305  *----------------------------------------------------------------------------*/
306 
307 cs_ctwr_zone_t *
308 cs_ctwr_by_id(int ct_id);
309 
310 /*----------------------------------------------------------------------------*/
311 
313 
314 #endif /* __CS_CTWR_H__ */
void cs_ctwr_log_balance(void)
Perform balances in packing zones.
Definition: cs_ctwr.c:739
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:349
int * cs_get_glob_ctwr_n_zones(void)
Definition: cs_ctwr.c:324
void cs_ctwr_all_destroy(void)
Destroy cs_ctwr_t structures.
Definition: cs_ctwr.c:616
cs_ctwr_option_t * cs_get_glob_ctwr_option(void)
Definition: cs_ctwr.c:304
cs_ctwr_zone_t * cs_ctwr_by_id(int ct_id)
cs_ctwr_zone_t ** cs_get_glob_ctwr_zone(void)
Definition: cs_ctwr.c:314
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_variables.c:761
void cs_ctwr_build_all(void)
Define the cells belonging to the different packing zones.
Definition: cs_ctwr.c:586
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:518
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:644
#define BEGIN_C_DECLS
Definition: cs_defs.h:528
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
#define END_C_DECLS
Definition: cs_defs.h:529
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
Definition: cs_ctwr.h:80
cs_real_t q_h_out
Definition: cs_ctwr.h:137
cs_real_t h_l_in
Definition: cs_ctwr.h:128
cs_real_t t_l_bc
Definition: cs_ctwr.h:95
cs_lnum_t n_outlet_faces
Definition: cs_ctwr.h:115
cs_ctwr_zone_type_t type
Definition: cs_ctwr.h:87
cs_real_t q_l_out
Definition: cs_ctwr.h:125
cs_real_t relax
Definition: cs_ctwr.h:93
cs_lnum_t * outlet_faces_ids
Definition: cs_ctwr.h:117
cs_real_t v_liq_pack
Definition: cs_ctwr.h:107
cs_real_t t_h_in
Definition: cs_ctwr.h:130
cs_real_t surface
Definition: cs_ctwr.h:103
cs_real_t q_l_bc
Definition: cs_ctwr.h:96
cs_lnum_t * inlet_faces_ids
Definition: cs_ctwr.h:116
char * name
Definition: cs_ctwr.h:85
cs_lnum_t n_outlet_cells
Definition: cs_ctwr.h:119
cs_real_t vol_f
Definition: cs_ctwr.h:110
cs_lnum_t * outlet_cells_ids
Definition: cs_ctwr.h:120
cs_lnum_t n_inlet_faces
Definition: cs_ctwr.h:114
cs_real_t hmax
Definition: cs_ctwr.h:90
int z_id
Definition: cs_ctwr.h:84
cs_lnum_t n_cells
Definition: cs_ctwr.h:109
char * criteria
Definition: cs_ctwr.h:83
char * file_name
Definition: cs_ctwr.h:86
int num
Definition: cs_ctwr.h:82
cs_real_t surface_in
Definition: cs_ctwr.h:101
cs_real_t t_h_out
Definition: cs_ctwr.h:131
cs_real_t xair_s
Definition: cs_ctwr.h:133
cs_real_t xap
Definition: cs_ctwr.h:98
cs_real_t q_l_in
Definition: cs_ctwr.h:124
cs_real_t t_l_in
Definition: cs_ctwr.h:126
cs_real_t q_h_in
Definition: cs_ctwr.h:136
cs_real_t surface_out
Definition: cs_ctwr.h:102
cs_real_t hmin
Definition: cs_ctwr.h:89
cs_real_t delta_t
Definition: cs_ctwr.h:91
cs_real_t h_l_out
Definition: cs_ctwr.h:129
int up_ct_id
Definition: cs_ctwr.h:112
cs_real_t h_h_in
Definition: cs_ctwr.h:134
cs_real_t t_l_out
Definition: cs_ctwr.h:127
cs_real_t xair_e
Definition: cs_ctwr.h:132
cs_real_t p_in
Definition: cs_ctwr.h:122
cs_real_t h_h_out
Definition: cs_ctwr.h:135
cs_real_t xleak_fac
Definition: cs_ctwr.h:105
cs_real_t xnp
Definition: cs_ctwr.h:99
cs_real_t p_out
Definition: cs_ctwr.h:123
Definition: cs_ctwr.h:151
cs_ctwr_model_t evap_model
Definition: cs_ctwr.h:153
bool has_rain
Definition: cs_ctwr.h:154
bool solve_rain_velocity
Definition: cs_ctwr.h:155
bool air_rain_friction
Definition: cs_ctwr.h:157
bool rain_to_packing
Definition: cs_ctwr.h:158