1 #ifndef __CS_PHYSICAL_CONSTANTS_H__
2 #define __CS_PHYSICAL_CONSTANTS_H__
3 
4 /*============================================================================
5  * Base physical constants data.
6  *============================================================================*/
7 
8 /*
9   This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11   Copyright (C) 1998-2021 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 "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
38 BEGIN_C_DECLS
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /* physical constants descriptor */
49 /*-------------------------------*/
50 
51 typedef struct {
52 
53   cs_real_t     gravity[3];        /* gravity vector */
54   int           icorio;            /* Coriolis source terms indicator */
55 
56 } cs_physical_constants_t;
57 
58 /* fluid properties descriptor */
59 /*-----------------------------*/
60 
61 typedef struct {
62 
63   int           ixyzp0;       /* indicator for filling of reference point for
64                                  total pressure */
65   int           icp;          /* property index of the isobaric specific heat */
66   int           icv;          /* property index of the isochoric specific
67                                  heat */
68   int           irovar;       /* variable density field */
69   int           ivivar;       /* variable viscosity field */
70   int           ivsuth;       /* Sutherland law for laminar viscosity and
71                                  thermal conductivity in gas mix spec. phys. */
72   double        ro0;          /* reference density */
73   double        viscl0;       /* reference molecular dynamic viscosity */
74   double        viscv0;       /* reference volume viscosity
75                                  (for compressible model) */
76   double        p0;           /* reference pressure for the total pressure */
77   double        pred0;        /* reference value for the reduced pressure */
78   double        xyzp0[3];     /* reference point coordinates for the total
79                                  pressure */
80   double        t0;           /* reference temperature */
81   double        cp0;          /* reference specific heat at constant pressure */
82   double        cv0;          /* reference specific heat at constant volume */
83   double        lambda0;      /* reference heat conductivity */
84 
85   double        r_pg_cnst;    /* Perfect Gas R constant */
86   double        rvsra;        /* ratio gaz constant h2o/ dry air */
87   double        clatev;       /* latent heat of evaporation: */
88   double        xmasmr;       /* molar mass of the perfect gas in kg/mol
89                                  (if ieos=1) */
90   int           ipthrm;       /* Uniform variable thermodynamic pressure for the
91                                  low-Mach algorithm */
92   double        pther;        /* uniform thermodynamic pressure for the low-Mach
93                                  algorithm */
94   double        pthera;       /* thermodynamic pressure for the previous time
95                                  step */
96   double        pthermax;     /* thermodynamic maximum pressure for user
97                                  clipping, used to model a venting effect */
98   double        sleak;        /* Leak surface */
99   double        kleak;        /* Leak head loss (2.9 by default, from Idelcick) */
100   double        roref;        /* Initial reference density */
101 
102 } cs_fluid_properties_t;
103 
104 /*============================================================================
105  * Static global variables
106  *============================================================================*/
107 
108 /* Physical constants */
109 
110 extern const double cs_physical_constants_r; /* Ideal gas constant (J/mol/K) */
111 extern const double cs_physical_constants_kb; /* Boltzmann constant (J/K) */
112 extern const double cs_physical_constants_celsius_to_kelvin; /* Celsius to
113                                                                 Kelvin*/
114 extern const double cs_physical_constants_stephan; /* Stephan constant
115                                                      (W/m2/K4)*/
116 
117 /* Pointer to main physical constants structure */
118 
119 extern const cs_physical_constants_t  *cs_glob_physical_constants;
120 
121 /* Pointer to main fluid properties structure */
122 
123 extern const cs_fluid_properties_t  *cs_glob_fluid_properties;
124 
125 /*=============================================================================
126  * Public function prototypes
127  *============================================================================*/
128 
129 /*----------------------------------------------------------------------------
130  * Provide access to cs_glob_physical_constants
131  *
132  * needed to initialize structure with GUI
133  *----------------------------------------------------------------------------*/
134 
135 cs_physical_constants_t *
136 cs_get_glob_physical_constants(void);
137 
138 /*----------------------------------------------------------------------------
139  * Provide access to cs_glob_fluid_properties
140  *
141  * needed to initialize structure with GUI
142  *----------------------------------------------------------------------------*/
143 
144 cs_fluid_properties_t *
145 cs_get_glob_fluid_properties(void);
146 
147 /*----------------------------------------------------------------------------
148  * Print the physical constants structure to setup.log.
149  *----------------------------------------------------------------------------*/
150 
151 void
152 cs_physical_constants_log_setup(void);
153 
154 /*----------------------------------------------------------------------------
155  * Print the fluid properties structure to setup.log.
156  *----------------------------------------------------------------------------*/
157 
158 void
159 cs_fluid_properties_log_setup(void);
160 
161 /*----------------------------------------------------------------------------*/
162 
163 END_C_DECLS
164 
165 #endif /* __CS_PHYSICAL_CONSTANTS_H__ */
166