My Project
programmer's documentation
cs_ctwr_air_props.h
Go to the documentation of this file.
1 #ifndef __CS_CTWR_AIR_PROPS_H__
2 #define __CS_CTWR_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-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  * Structure definition
46  *============================================================================*/
47 
48 /* Structure associated to general properties */
49 
50 typedef struct {
51 
52  cs_real_t humidity0; /* Reference humidity */
53  cs_real_t cp_a; /* Capacite calorifique de l air */
54  cs_real_t cp_v; /* Capacite calorifique de la vapeur */
55  cs_real_t cp_l; /* Capacite calorifique de l eau */
56  cs_real_t hv0; /* Chaleur latente */
57  cs_real_t rho_l; /* Masse volumique de l eau */
58  cs_real_t lambda_h; /* Humid air conductivity */
59  cs_real_t lambda_l; /* Water conductivity */
60  cs_real_t droplet_diam; /* Drop diameter for rain zones */
61 
63 
65 
66 /*============================================================================
67  * Public function prototypes for Fortran API
68  *============================================================================*/
69 
70 /*----------------------------------------------------------------------------
71  * Calculation of the air humidity at saturation for a given temperature
72  *
73  * Fortran interface:
74  *
75  * SUBROUTINE XSATH
76  * ****************
77  *
78  * DOUBLE PRECISION TH : <- : temperature in Celsius degree
79  * DOUBLE PRECISION XSAT : -> : absolute humidity of saturated air
80  *----------------------------------------------------------------------------*/
81 
82 void CS_PROCF (xsath, XSATH)
83 (
84  const cs_real_t *th,
85  const cs_real_t *p0,
87 );
88 
89 /*----------------------------------------------------------------------------
90  * Calculation of the derivative of the absolute humidity at saturation
91  *
92  * Fortran interface:
93  *
94  * SUBROUTINE DXSATH
95  * *****************
96  *
97  * DOUBLE PRECISION TH : <- : temperature in Celsius degree
98  * DOUBLE PRECISION DXSAT : -> : derivative of the humidity of saturated air
99  *----------------------------------------------------------------------------*/
100 
101 void CS_PROCF (dxsath, DXSATH)
102 (
103  const cs_real_t *th,
104  const cs_real_t *p0,
106 );
107 
108 /*----------------------------------------------------------------------------
109  * Calculation of the density of humid air
110  *
111  * Fortran interface:
112  *
113  * SUBROUTINE RHO_HUMIDAIR
114  * **********************
115  *
116  * DOUBLE PRECISION HUMID : <- : absolute humidity of humid air
117  * DOUBLE PRECISION R0 : <- : reference density of humid air
118  * DOUBLE PRECISION T0 : <- : reference temperature of humid air
119  * DOUBLE PRECISION MOLMASSRAT : <- : dry air to water vapour molecular mass ratio
120  * DOUBLE PRECISION T_H : <- : temperature of humid air in Celsius
121  *
122  * DOUBLE PRECISION RHO_HUMIDAIR : -> : density of humid air
123  *----------------------------------------------------------------------------*/
124 
125 void CS_PROCF (rho_humidair, RHO_HUMIDAIR)
126 (
127  const cs_real_t *humid,
128  const cs_real_t *r0,
129  const cs_real_t *p0,
130  const cs_real_t *t0,
131  const cs_real_t *molmassrat,
132  const cs_real_t *t_h,
134 );
135 
136 /*----------------------------------------------------------------------------
137  * Calculation of the Cp of humid air
138  *
139  * Fortran interface:
140  *
141  * SUBROUTINE CP_HUMIDAIR
142  * **********************
143  *
144  * DOUBLE PRECISION HUMID : <- : absolute humidity of humid air
145  * DOUBLE PRECISION HUMID_SAT : <- : absolute humidity of saturated humid air
146  *
147  * DOUBLE PRECISION CP_HUMIDAIR : -> : specific heat of humid air
148  *----------------------------------------------------------------------------*/
149 
150 void CS_PROCF (cp_humidair, CP_HUMIDAIR)
151 (
152  const cs_real_t *humid,
155 );
156 
157 /*----------------------------------------------------------------------------
158  * Calculation of the specific enthalpy of humid air
159  *
160  * Fortran interface:
161  *
162  * SUBROUTINE H_HUMIDAIR
163  * *********************
164  *
165  * DOUBLE PRECISION CP_HUMIDAIR : <- : specific heat of humid air
166  * DOUBLE PRECISION HUMID : <- : absolute humidity of humid air
167  * DOUBLE PRECISION HUMID_SAT : <- : absolute humidity of saturated humid air
168  * DOUBLE PRECISION T_HUMIDAIR : <- : humid air temperature in Celsius (in Celsius)
169  *
170  * DOUBLE PRECISION H_HUMIDAIR : -> : specific enthalpy of humid air
171  *----------------------------------------------------------------------------*/
172 
173 void CS_PROCF (h_humidair, H_HUMIDAIR)
174 (
175  const cs_real_t *cp_humidair,
176  const cs_real_t *humid,
177  const cs_real_t *humid_sat,
178  const cs_real_t *t_humidair,
180 );
181 
182 /*----------------------------------------------------------------------------
183  * Calculation of the temperature of humid air
184  *
185  * Fortran interface:
186  *
187  * SUBROUTINE T_HUMIDAIR
188  * *********************
189  *
190  * DOUBLE PRECISION CP_HUMIDAIR : <- : specific heat of humid air
191  * DOUBLE PRECISION HUMID : <- : absolute humidity of humid air
192  * DOUBLE PRECISION HUMID_SAT : <- : absolute humidity of saturated humid air
193  * DOUBLE PRECISION H_HUMIDAIR : <- : specific enthalpy of humid air
194  *
195  * DOUBLE PRECISION T_HUMIDAIR : -> : humid air temperature in Celsius (in Celsius)
196  *----------------------------------------------------------------------------*/
197 
198 void CS_PROCF (t_humidair, T_HUMIDAIR)
199 (
200  const cs_real_t *cp_humidair,
201  const cs_real_t *humid,
202  const cs_real_t *humid_sat,
203  const cs_real_t *h_humidair,
205 );
206 
207 /*----------------------------------------------------------------------------
208  * Calculation of the specific enthalpy of liquid water
209  *
210  * Fortran interface:
211  *
212  * SUBROUTINE H_LIQUIDWATER
213  * ************************
214  *
215  * DOUBLE PRECISION T_LIQWATER : <- : liquid water temperature (in Celsius)
216  *
217  * DOUBLE PRECISION H_LIQWATER : -> : specific enthalpy of liquid water
218  *----------------------------------------------------------------------------*/
219 
220 void CS_PROCF (h_liqwater, H_LIQUWATER)
221 (
222  const cs_real_t *t_liqwater,
224 );
225 
226 /*----------------------------------------------------------------------------
227  * Calculation of the specific enthalpy of humid air at a
228  * specified humidity and temperature
229  *
230  * Fortran interface:
231  *
232  * SUBROUTINE H_HUMIDAIR_FIXED
233  * ***************************
234  *
235  * DOUBLE PRECISION T_AIR : <- : humid air temperature (in Celsius)
236  * DOUBLE PRECISION X_AIR : <- : humid air humidity
237  *
238  * DOUBLE PRECISION H_AIR : -> : specific enthalpy of humid air
239  *----------------------------------------------------------------------------*/
240 
241 void CS_PROCF (h_humidair_fixed, H_HUMIDAIR_FIXED)(
242  const cs_real_t *x_air,
243  const cs_real_t *t_air,
245 
246 /*============================================================================
247  * Prototypes of public function
248  *============================================================================*/
249 
250 /*----------------------------------------------------------------------------
251  * Calculation of the air humidity at saturation for a given temperature
252  *
253  * parameters:
254  * th <-- temperature in Celsius degree
255  *
256  * returns:
257  * absolute humidity of saturated air
258  *----------------------------------------------------------------------------*/
259 
260 cs_real_t
262  const cs_real_t p0);
263 
264 /*----------------------------------------------------------------------------
265  * Calculation of moist air mass enthalpy
266  *
267  * parameters:
268  * xair <-- absolute humidity of saturated air
269  * tair <-- air temperature in Celsius degree
270  *
271  * returns:
272  * air mass enthalpy
273  *----------------------------------------------------------------------------*/
274 
275 cs_real_t
276 cs_ctwr_enthair(const cs_real_t xair,
277  const cs_real_t tair);
278 
279 /*----------------------------------------------------------------------------*/
287 /*----------------------------------------------------------------------------*/
288 
289 cs_real_t
290 cs_ctwr_h_l(const cs_real_t t_l);
291 
292 /*----------------------------------------------------------------------------
293  * Calculation water vapour mass enthalpy
294  *
295  * parameters:
296  * tvap <-- water vapour temperature in Celsius degree
297  *
298  * returns:
299  * water vapour mass enthalpy
300  *----------------------------------------------------------------------------*/
301 
302 cs_real_t
303 cs_ctwr_hvap(const cs_real_t t_vap);
304 
305 /*----------------------------------------------------------------------------
306  * Calculation of the derivate of the absolute humidity at saturation
307  *
308  * parameters:
309  * th <-- temperature in Celsius degree
310  *
311  * returns:
312  * derivative of the humidity of saturated air
313  *----------------------------------------------------------------------------*/
314 
315 cs_real_t
317  const cs_real_t p0);
318 
319 /*----------------------------------------------------------------------------*/
332 /*----------------------------------------------------------------------------*/
333 
334 cs_real_t
336  const cs_real_t rho0,
337  const cs_real_t p0,
338  const cs_real_t t0,
339  const cs_real_t molmassrat,
340  const cs_real_t t_h);
341 
342 /*----------------------------------------------------------------------------
343  * Calculation of the Cp of humid air
344  *
345  * parameters:
346  * humid <-- absolute humidity of humid air
347  * humid_sat <-- absolute humidity of saturated humid air
348  *
349  * returns:
350  * cp_h <-- specific heat of humid air
351  *----------------------------------------------------------------------------*/
352 
353 cs_real_t
355  const cs_real_t humid_sat);
356 
357 /*----------------------------------------------------------------------------
358  * Calculation of the specific enthalpy of humid air
359  *
360  * parameters:
361  * cp_h <-- Cp of humid air
362  * humid <-- absolute humidity of humid air
363  * humid_sat <-- absolute humidity of saturated humid air
364  * t_h <-- humid air temperature in Celsius (in Celsius)
365  *
366  * returns:
367  * h_h <-- specific enthalpy of humid air
368  *----------------------------------------------------------------------------*/
369 
370 cs_real_t
371 cs_ctwr_h_humidair(const cs_real_t cp_h,
372  const cs_real_t humid,
373  const cs_real_t humid_sat,
374  const cs_real_t t_h);
375 
376 /*----------------------------------------------------------------------------
377  * Calculation of the temperature of humid air
378  *
379  * parameters:
380  * cp_h <-- Cp of humid air
381  * humid <-- absolute humidity of humid air
382  * humid_sat <-- absolute humidity of saturated humid air
383  * h_h <-- humid air enthalpy
384  *
385  * returns:
386  * t_h <-- temperature of humid air (in Celsius)
387  *----------------------------------------------------------------------------*/
388 
389 cs_real_t
390 cs_ctwr_t_humidair(const cs_real_t cp_h,
391  const cs_real_t humid,
392  const cs_real_t humid_sat,
393  const cs_real_t h_h);
394 
395 /*----------------------------------------------------------------------------
396  * Calculation of the temperature of liquid water
397  *
398  * parameters:
399  * h_liqwater <-- specific enthalpy of liquid water
400  *
401  * returns:
402  * liquid water temperature (in Celsius)
403  *----------------------------------------------------------------------------*/
404 
405 cs_real_t
407 
408 /*----------------------------------------------------------------------------
409  * Calculation of the specific enthalpy of liquid water
410  *
411  * parameters:
412  * t_l <-- liquid water temperature (in Celsius)
413  *
414  * returns:
415  * specific enthalpy of liquid water
416  *----------------------------------------------------------------------------*/
417 
418 cs_real_t
419 cs_ctwr_h_liqwater(const cs_real_t t_liqwater);
420 
421 /*----------------------------------------------------------------------------*/
422 
424 
425 #endif /* __CS_CTWR_AIR_PROPERTIES_H__ */
h_humidair_fixed
void const cs_real_t cs_real_t * h_humidair_fixed
Definition: cs_ctwr_air_props.h:243
cs_ctwr_fluid_props_t::cp_v
cs_real_t cp_v
Definition: cs_ctwr_air_props.h:54
h_humidair
void const cs_real_t const cs_real_t const cs_real_t cs_real_t * h_humidair
Definition: cs_ctwr_air_props.h:176
humid_sat
void const cs_real_t * humid_sat
Definition: cs_ctwr_air_props.h:153
t0
void const cs_real_t const cs_real_t const cs_real_t * t0
Definition: cs_ctwr_air_props.h:128
cs_ctwr_fluid_props_t::cp_a
cs_real_t cp_a
Definition: cs_ctwr_air_props.h:53
h_liqwater
void cs_real_t * h_liqwater
Definition: cs_ctwr_air_props.h:224
CS_PROCF
void CS_PROCF(xsath, XSATH)(const cs_real_t *th
cs_ctwr_fluid_props_t::lambda_l
cs_real_t lambda_l
Definition: cs_ctwr_air_props.h:59
molmassrat
void const cs_real_t const cs_real_t const cs_real_t const cs_real_t * molmassrat
Definition: cs_ctwr_air_props.h:128
cs_ctwr_t_liqwater
cs_real_t cs_ctwr_t_liqwater(const cs_real_t h_liqwater)
Calculation of the temperature of liquid water.
Definition: cs_ctwr_air_props.c:744
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_ctwr_fluid_props_t::droplet_diam
cs_real_t droplet_diam
Definition: cs_ctwr_air_props.h:60
cs_ctwr_t_humidair
cs_real_t cs_ctwr_t_humidair(const cs_real_t cp_h, const cs_real_t humid, const cs_real_t humid_sat, const cs_real_t h_h)
Calculation of the temperature of humid air.
Definition: cs_ctwr_air_props.c:716
cs_ctwr_cp_humidair
cs_real_t cs_ctwr_cp_humidair(const cs_real_t humid, const cs_real_t humid_sat)
Calculation of the Cp of humid air.
Definition: cs_ctwr_air_props.c:652
dxsat
void const cs_real_t cs_real_t * dxsat
Definition: cs_ctwr_air_props.h:104
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
cs_glob_ctwr_props
cs_ctwr_fluid_props_t * cs_glob_ctwr_props
Definition: cs_ctwr_air_props.c:84
cs_ctwr_xsath
cs_real_t cs_ctwr_xsath(const cs_real_t th, const cs_real_t p0)
Calculation of the air humidity at saturation for a given temperature.
Definition: cs_ctwr_air_props.c:349
r0
void const cs_real_t * r0
Definition: cs_ctwr_air_props.h:128
cs_ctwr_fluid_props_t::lambda_h
cs_real_t lambda_h
Definition: cs_ctwr_air_props.h:58
cs_ctwr_dxsath
cs_real_t cs_ctwr_dxsath(const cs_real_t th, const cs_real_t p0)
Calculation of the derivate of the absolute humidity at saturation.
Definition: cs_ctwr_air_props.c:502
ppthch::th
double precision, dimension(npot), save th
temperature (in K)
Definition: ppthch.f90:118
t_air
void const cs_real_t * t_air
Definition: cs_ctwr_air_props.h:243
cs_ctwr_fluid_props_t::hv0
cs_real_t hv0
Definition: cs_ctwr_air_props.h:56
cs_ctwr_h_l
cs_real_t cs_ctwr_h_l(const cs_real_t t_l)
Calculation water mass enthalpy.
Definition: cs_ctwr_air_props.c:461
cs_ctwr_rho_humidair
cs_real_t cs_ctwr_rho_humidair(const cs_real_t x, const cs_real_t rho0, const cs_real_t p0, const cs_real_t t0, const cs_real_t molmassrat, const cs_real_t t_h)
Calculation of the density of humid air.
Definition: cs_ctwr_air_props.c:607
cs_ctwr_hvap
cs_real_t cs_ctwr_hvap(const cs_real_t t_vap)
Calculation water vapour mass enthalpy.
Definition: cs_ctwr_air_props.c:479
cs_ctwr_fluid_props_t::rho_l
cs_real_t rho_l
Definition: cs_ctwr_air_props.h:57
cs_ctwr_h_humidair
cs_real_t cs_ctwr_h_humidair(const cs_real_t cp_h, const cs_real_t humid, const cs_real_t humid_sat, const cs_real_t t_h)
Calculation of the specific enthalpy of humid air.
Definition: cs_ctwr_air_props.c:683
t_h
void const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t * t_h
Definition: cs_ctwr_air_props.h:128
cs_ctwr_h_liqwater
cs_real_t cs_ctwr_h_liqwater(const cs_real_t t_liqwater)
Calculation of the specific enthalpy of liquid water.
Definition: cs_ctwr_air_props.c:764
rho_humidair
void const cs_real_t const cs_real_t const cs_real_t const cs_real_t const cs_real_t cs_real_t * rho_humidair
Definition: cs_ctwr_air_props.h:128
cs_ctwr_fluid_props_t
Definition: cs_ctwr_air_props.h:50
cs_ctwr_fluid_props_t::cp_l
cs_real_t cp_l
Definition: cs_ctwr_air_props.h:55
t_l
Definition: cs_field_pointer.h:203
humid
void const cs_real_t * humid
Definition: cs_ctwr_air_props.h:176
cs_ctwr_fluid_props_t::humidity0
cs_real_t humidity0
Definition: cs_ctwr_air_props.h:52
cs_ctwr_enthair
cs_real_t cs_ctwr_enthair(const cs_real_t xair, const cs_real_t tair)
Calculation of moist air mass enthalpy.
Definition: cs_ctwr_air_props.c:437
p0
void const cs_real_t * p0
Definition: cs_ctwr_air_props.h:85
cp_humidair
void const cs_real_t cs_real_t * cp_humidair
Definition: cs_ctwr_air_props.h:153
xsat
void const cs_real_t cs_real_t * xsat
Definition: cs_ctwr_air_props.h:85
cs_base.h
t_humidair
void const cs_real_t const cs_real_t const cs_real_t * t_humidair
Definition: cs_ctwr_air_props.h:176