9.2
general documentation
cs_air_props.h
Go to the documentation of this file.
1#ifndef CS_AIR_PROPS_H
2#define CS_AIR_PROPS_H
3
4/*============================================================================
5 * Specific laws for air properties (temperature, enthalpy)
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 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#include <math.h>
35
36/*----------------------------------------------------------------------------
37 * Local headers
38 *----------------------------------------------------------------------------*/
39
40#include "base/cs_base.h"
41
42/*============================================================================
43 * Structure definition
44 *============================================================================*/
45
46/* Structure associated to general properties */
47
48typedef struct {
49
65
67
68/*============================================================================
69 * Public function prototypes for Fortran API
70 *============================================================================*/
71
72/*============================================================================
73 * Prototypes of public function
74 *============================================================================*/
75
76/*----------------------------------------------------------------------------*/
84/*----------------------------------------------------------------------------*/
85
88
89/*----------------------------------------------------------------------------*/
97/*----------------------------------------------------------------------------*/
98
101
102/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112
115 cs_real_t p0);
116
117/*----------------------------------------------------------------------------*/
126/*----------------------------------------------------------------------------*/
127
130 cs_real_t x_s);
131
132/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144
147 cs_real_t x,
148 cs_real_t x_s,
149 cs_real_t t_h);
150
151/*----------------------------------------------------------------------------*/
162/*----------------------------------------------------------------------------*/
163
166 cs_real_t x,
167 cs_real_t x_s,
168 cs_real_t h_h);
169
170/*----------------------------------------------------------------------------*/
178/*----------------------------------------------------------------------------*/
179
182
183/*----------------------------------------------------------------------------*/
191/*----------------------------------------------------------------------------*/
192
195
196/*----------------------------------------------------------------------------*/
205/*----------------------------------------------------------------------------*/
206
209{
210 cs_real_t a1, b1, c1, ps, pv;
211
212 /* T between -20 and 0 degrees C */
213
214 if (t_c <= 0.) {
215
216 a1 = 6.4147;
217 b1 = 22.376;
218 c1 = 271.68;
219
220 /* Warning if T less than -20 degrees C */
221
222 ps = a1 + (b1 * t_c)/(c1 + t_c);
223 pv = exp(ps);
224
225 }
226
227 /* T between 0 and 40 degrees C */
228
229 else if (t_c <= 40.) {
230
231 a1 = 6.4147;
232 b1 = 17.438;
233 c1 = 239.78;
234 ps = a1 + (b1 * t_c)/(c1 + t_c);
235 pv = exp(ps);
236 }
237
238 /* T between 40 and 80 degrees C */
239
240 else {
241
242 const cs_real_t t0 = 273.16;
243 const cs_real_t ax = 8.2969;
244 const cs_real_t ay = 4.76955;
245 const cs_real_t a0 = 0.78614;
246 const cs_real_t a2 = 5.028;
247 const cs_real_t a3 = 0.000150475;
248 const cs_real_t a4 = 0.00042873;
249 cs_real_t tt, px, py, g1, g2, g3, g4;
250
251 a1 = 10.7954;
252
253 tt = t_c/t0;
254 /* T greater than 80 degrees C, clipped at 80°C */
255 if (t_c > 80.)
256 tt = 80./t0;
257 px = ax * tt;
258 py = ay * tt/(1. + tt);
259 g1 = a1 * tt/(1. + tt);
260 g2 = -a2 * log10(1. + tt);
261 g3 = a3 * (1. - 1./pow(10.,px));
262 g4 = a4 * (pow(10., py) - 1.);
263 ps = a0 + g1 + g2 + g3 + g4;
264 pv = pow(10., ps) * 100.;
265
266 }
267
268 return pv;
269}
270
271/*----------------------------------------------------------------------------*/
280/*----------------------------------------------------------------------------*/
281
284 cs_real_t p)
285{
286 cs_real_t pv;
287 cs_real_t x_s = 0.;
288
289 /* Warning if T less than -20 degrees C */
290 /* T between -20 and 80 degrees C */
291
292 if ((t_c <= 80.)) {
293
294 pv = cs_air_pwv_sat(t_c);
295 x_s = 0.622 * pv/(p-pv);
296
297 }
298
299 /* T more than 80 degrees C */
300
301 else if (t_c > 80.) {
302
303 x_s = 0.5 + 0.001*t_c;
304
305 }
306
307 return x_s;
308}
309
310/*----------------------------------------------------------------------------*/
320/*----------------------------------------------------------------------------*/
321
324 cs_real_t p);
325
326/*----------------------------------------------------------------------------*/
335/*----------------------------------------------------------------------------*/
336
339
340/*----------------------------------------------------------------------------*/
349/*----------------------------------------------------------------------------*/
350
353
354/*----------------------------------------------------------------------------*/
366/*----------------------------------------------------------------------------*/
367
368void
370 cs_real_t t_liq,
371 cs_real_t p,
372 cs_real_t *yw_liq,
373 cs_real_t *t_h,
374 cs_real_t *rho_h,
375 cs_real_t *beta_h);
376
377/*----------------------------------------------------------------------------*/
390/*----------------------------------------------------------------------------*/
391
394 cs_real_t rho0,
397 cs_real_t molmassrat,
398 cs_real_t t_h);
399
400/*----------------------------------------------------------------------------*/
401
402#endif /* CS_AIR_PROPERTIES_H */
cs_real_t cs_liq_h_to_t(cs_real_t h_l)
Calculation of the temperature of liquid water.
Definition: cs_air_props.cpp:352
cs_air_fluid_props_t * cs_glob_air_props
Definition: cs_air_props.cpp:87
cs_real_t cs_air_yw_sat(cs_real_t t_c, cs_real_t p)
Calculation of the air water mass fraction at saturation for a given temperature.
Definition: cs_air_props.cpp:395
cs_real_t cs_air_cp_humidair(cs_real_t x, cs_real_t x_s)
Calculation of the Cp of humid air.
Definition: cs_air_props.cpp:260
cs_real_t cs_liq_t_to_h(cs_real_t t_l)
Calculation of the specific enthalpy of liquid water.
Definition: cs_air_props.cpp:373
void cs_rho_humidair(cs_real_t yw_h, cs_real_t t_liq, cs_real_t p, cs_real_t *yw_liq, cs_real_t *t_h, cs_real_t *rho_h, cs_real_t *beta_h)
Calculation of the density of humid air.
Definition: cs_air_props.cpp:466
cs_real_t cs_air_x_to_yw(const cs_real_t x)
Convert the absolute humidity of humid air to the air water mass fraction qwt = Ym = mw/mh.
Definition: cs_air_props.cpp:420
cs_real_t cs_air_h_l(cs_real_t t_l)
Calculation water mass enthalpy.
Definition: cs_air_props.cpp:125
cs_real_t cs_air_rho_humidair(cs_real_t x, cs_real_t rho0, cs_real_t p0, cs_real_t t0, cs_real_t molmassrat, cs_real_t t_h)
Calculation of the density of humid air.
Definition: cs_air_props.cpp:552
cs_real_t cs_air_yw_to_x(cs_real_t qw)
Convert the air water mass fraction qwt = Ym = mw/mh to the absolute humidity of humid air.
Definition: cs_air_props.cpp:441
CS_F_HOST_DEVICE cs_real_t cs_air_pwv_sat(cs_real_t t_c)
Computes the saturation water vapor pressure function of the temperature (in Celsius)
Definition: cs_air_props.h:208
CS_F_HOST_DEVICE cs_real_t cs_air_x_sat(cs_real_t t_c, cs_real_t p)
Calculation of the air humidity at saturation for a given temperature.
Definition: cs_air_props.h:283
cs_real_t cs_air_hvap(cs_real_t t_vap)
Calculation water vapor mass enthalpy.
Definition: cs_air_props.cpp:143
cs_real_t cs_air_dxsath(cs_real_t th, cs_real_t p0)
Calculation of the derivate of the absolute humidity at saturation.
Definition: cs_air_props.cpp:167
cs_real_t cs_air_t_humidair(cs_real_t cp_h, cs_real_t x, cs_real_t x_s, cs_real_t h_h)
Calculation of the temperature of humid air.
Definition: cs_air_props.cpp:324
cs_real_t cs_air_h_humidair(cs_real_t cp_h, cs_real_t x, cs_real_t x_s, cs_real_t t_h)
Calculation of the specific enthalpy of humid air.
Definition: cs_air_props.cpp:291
#define CS_F_HOST_DEVICE
Definition: cs_defs.h:555
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
@ p
Definition: cs_field_pointer.h:63
real(c_double), pointer, save ps
reference pressure (to compute potential temp: 1.0d+5)
Definition: atincl.f90:129
real(c_double), pointer, save p0
reference pressure for the total pressure.
Definition: cstphy.f90:60
real(c_double), pointer, save t0
reference temperature.
Definition: cstphy.f90:68
Definition: cs_air_props.h:48
cs_real_t cp_l
Definition: cs_air_props.h:53
cs_real_t cp_v
Definition: cs_air_props.h:52
cs_real_t humidity0
Definition: cs_air_props.h:50
cs_real_t molar_mass_dry_air
Definition: cs_air_props.h:59
cs_real_t sigma
Definition: cs_air_props.h:62
cs_real_t droplet_diam
Definition: cs_air_props.h:58
cs_real_t lambda_l
Definition: cs_air_props.h:57
cs_real_t molmass_rat
Definition: cs_air_props.h:60
cs_real_t rho_l
Definition: cs_air_props.h:55
cs_real_t cp_a
Definition: cs_air_props.h:51
cs_real_t lambda_h
Definition: cs_air_props.h:56
cs_real_t hv0
Definition: cs_air_props.h:54