9.2
general documentation
cs_physical_constants.h
Go to the documentation of this file.
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-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 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_defs.h"
35
36/*----------------------------------------------------------------------------*/
37
39
40/*=============================================================================
41 * Macro definitions
42 *============================================================================*/
43
44/*============================================================================
45 * Type definitions
46 *============================================================================*/
47
48/* physical constants descriptor */
49/*-------------------------------*/
50
51typedef struct {
52
53 cs_real_t gravity[3]; /* gravity vector in m.s^-2 */
54 int icorio; /* Coriolis source terms indicator */
55
57
58/* fluid properties descriptor */
59/*-----------------------------*/
60
61typedef 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 iviscv; /* property field id for volume viscosity
69 (for compressible model) */
70 int irovar; /* variable density field */
71 int ivivar; /* variable viscosity field */
72 int ivsuth; /* Sutherland law for laminar viscosity and
73 thermal conductivity in gas mix spec. phys. */
74 double ro0; /* reference density */
75 double viscl0; /* reference molecular dynamic viscosity */
76 double viscv0; /* reference volume viscosity
77 (for compressible model) */
78 double p0; /* reference pressure for the total pressure */
79 double pred0; /* reference value for the reduced pressure */
80 double xyzp0[3]; /* reference point coordinates for the total
81 pressure */
82 int p0_face_id; /* face id of the pressure reference */
83 int p0_rank_id; /* rank id of the pressure reference */
84 double t0; /* reference temperature */
85 double cp0; /* reference specific heat at constant pressure */
86 double cv0; /* reference specific heat at constant volume */
87 double cpv0; /* reference specific heat at constant volume
88 for water vapor */
89 double cvl; /* reference specific for liquid water */
90 double l00; /* Latent heat */
91 double lambda0; /* reference heat conductivity */
92
93 double r_pg_cnst; /* perfect gas specific constant in J/kg/K */
94 double r_v_cnst; /* water vapor specific constant in J/kg/K */
95 double rvsra; /* ratio gas constant h2o / dry air */
96 double clatev; /* latent heat of evaporation */
97 double xmasmr; /* molar mass of the perfect gas in kg/mol
98 (if ieos=1) */
99 int ipthrm; /* uniform variable thermodynamic pressure for the
100 low-Mach algorithm */
101 double pther; /* uniform thermodynamic pressure for the low-Mach
102 algorithm */
103 double pthera; /* thermodynamic pressure for the previous time
104 step */
105 double pthermax; /* thermodynamic maximum pressure for user
106 clipping, used to model a venting effect */
107 double eint0; /* reference internal energy for the barotropic
108 compressible module. */
109 double sleak; /* leak surface */
110 double kleak; /* leak head loss (2.9 by default, from Idelcick) */
111 double roref; /* Initial reference density */
112
114
115/*============================================================================
116 * Static global variables
117 *============================================================================*/
118
119/* Physical constants */
120
121#if (defined(__NVCC__) && defined(__CUDA_ARCH__)) \
122 || (defined(__HIPCC__) && defined(__HIP_DEVICE_COMPILE__)) \
123 || defined(SYCL_LANGUAGE_VERSION) \
124 || defined(HAVE_OPENMP_TARGET)
125
126/* On GPU, global variables are usually not accessible. */
127
128#define cs_physical_constants_r 8.31446261815324
129#define cs_physical_constants_kb 1.380649e-23
130#define cs_physical_constants_celsius_to_kelvin 273.15
131#define cs_physical_constants_stephan 5.6703e-8
132#define cs_physical_constants_avogadro 6.02214076e23
133
134#else
135
136/* General constants accessible on CPU */
137
138extern const double cs_physical_constants_r; /* Ideal gas constant (J/mol/K) */
139extern const double cs_physical_constants_kb; /* Boltzmann constant (J/K) */
140extern const double cs_physical_constants_celsius_to_kelvin; /* Celsius to
141 Kelvin*/
142extern const double cs_physical_constants_stephan; /* Stephan constant
143 (W/m2/K4)*/
144extern const double cs_physical_constants_avogadro; /* Avogadro constant
145 (1/mol) */
146#endif
147
148/* Pointer to main physical constants structure */
149
151
152/* Pointer to main fluid properties structure */
153
155
156/*=============================================================================
157 * Public function prototypes
158 *============================================================================*/
159
160/*----------------------------------------------------------------------------
161 * Provide access to cs_glob_physical_constants
162 *
163 * needed to initialize structure with GUI
164 *----------------------------------------------------------------------------*/
165
168
169/*----------------------------------------------------------------------------
170 * Provide access to cs_glob_fluid_properties
171 *
172 * needed to initialize structure with GUI
173 *----------------------------------------------------------------------------*/
174
177
178/*----------------------------------------------------------------------------
179 * Print the physical constants structure to setup.log.
180 *----------------------------------------------------------------------------*/
181
182void
184
185/*----------------------------------------------------------------------------
186 * Print the fluid properties structure to setup.log.
187 *----------------------------------------------------------------------------*/
188
189void
191
192/*----------------------------------------------------------------------------*/
193
195
196#endif /* CS_PHYSICAL_CONSTANTS_H */
#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
const double cs_physical_constants_stephan
Definition: cs_physical_constants.cpp:451
void cs_physical_constants_log_setup(void)
Definition: cs_physical_constants.cpp:568
const double cs_physical_constants_r
Definition: cs_physical_constants.cpp:438
const double cs_physical_constants_kb
Definition: cs_physical_constants.cpp:442
const double cs_physical_constants_celsius_to_kelvin
Definition: cs_physical_constants.cpp:446
const double cs_physical_constants_avogadro
Definition: cs_physical_constants.cpp:455
const cs_fluid_properties_t * cs_glob_fluid_properties
Definition: cs_physical_constants.cpp:462
const cs_physical_constants_t * cs_glob_physical_constants
Definition: cs_physical_constants.cpp:459
void cs_fluid_properties_log_setup(void)
Definition: cs_physical_constants.cpp:599
cs_physical_constants_t * cs_get_glob_physical_constants(void)
Definition: cs_physical_constants.cpp:543
cs_fluid_properties_t * cs_get_glob_fluid_properties(void)
Definition: cs_physical_constants.cpp:556
Fluid properties descriptor.
Definition: cs_physical_constants.h:61
int ivivar
Definition: cs_physical_constants.h:71
double kleak
Definition: cs_physical_constants.h:110
double viscl0
Definition: cs_physical_constants.h:75
int icp
Definition: cs_physical_constants.h:65
double pthermax
Definition: cs_physical_constants.h:105
double sleak
Definition: cs_physical_constants.h:109
double l00
Definition: cs_physical_constants.h:90
int p0_face_id
Definition: cs_physical_constants.h:82
double eint0
Definition: cs_physical_constants.h:107
double ro0
Definition: cs_physical_constants.h:74
double cv0
Definition: cs_physical_constants.h:86
double pthera
Definition: cs_physical_constants.h:103
int iviscv
Definition: cs_physical_constants.h:68
double viscv0
Definition: cs_physical_constants.h:76
double cpv0
Definition: cs_physical_constants.h:87
double r_pg_cnst
Definition: cs_physical_constants.h:93
double xmasmr
Definition: cs_physical_constants.h:97
double cvl
Definition: cs_physical_constants.h:89
double rvsra
Definition: cs_physical_constants.h:95
int irovar
Definition: cs_physical_constants.h:70
double pred0
Definition: cs_physical_constants.h:79
int ipthrm
Definition: cs_physical_constants.h:99
int ixyzp0
Definition: cs_physical_constants.h:63
int icv
Definition: cs_physical_constants.h:66
double pther
Definition: cs_physical_constants.h:101
double clatev
Definition: cs_physical_constants.h:96
double t0
Definition: cs_physical_constants.h:84
double r_v_cnst
Definition: cs_physical_constants.h:94
double cp0
Definition: cs_physical_constants.h:85
double lambda0
Definition: cs_physical_constants.h:91
double roref
Definition: cs_physical_constants.h:111
double p0
Definition: cs_physical_constants.h:78
int p0_rank_id
Definition: cs_physical_constants.h:83
int ivsuth
Definition: cs_physical_constants.h:72
Physical constants descriptor.
Definition: cs_physical_constants.h:51
int icorio
Definition: cs_physical_constants.h:54