9.2
general documentation
cs_thermal_model.h
Go to the documentation of this file.
1#ifndef CS_THERMAL_MODEL_H
2#define CS_THERMAL_MODEL_H
3
4/*============================================================================
5 * Base thermal model 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#include "base/cs_field.h"
36
37/*=============================================================================
38 * Macro definitions
39 *============================================================================*/
40
41/*============================================================================
42 * Type definitions
43 *============================================================================*/
44
45/*----------------------------------------------------------------------------
46 * Thermal model type
47 *----------------------------------------------------------------------------*/
48
49typedef enum {
50
58
60
61typedef enum {
62
66
68
69/* thermal model descriptor */
70/*--------------------------*/
71
72typedef struct {
73
76
77 /* Has kinetic source term correction */
79 int cflt; /* compute the thermal cfl condition */
80 int cflp; /* compute the pressure cfl condition */
83
85
86/*============================================================================
87 * Static global variables
88 *============================================================================*/
89
90/* Pointer to thermal model structure */
91
93
94/*=============================================================================
95 * Public function prototypes
96 *============================================================================*/
97
98/*----------------------------------------------------------------------------
99 * Provide access to cs_glob_thermal_model
100 *
101 * needed to initialize structure with GUI
102 *----------------------------------------------------------------------------*/
103
106
107/*----------------------------------------------------------------------------
108 * Return thermal field (temperature, enthalpy, total energy according to
109 * thermal model).
110 *
111 * returns:
112 * pointer to thermal field
113 *----------------------------------------------------------------------------*/
114
117
118/*----------------------------------------------------------------------------
119 * Print the thermal model structure to setup.log.
120 *----------------------------------------------------------------------------*/
121
122void
124
125/*----------------------------------------------------------------------------*/
129/*----------------------------------------------------------------------------*/
130
131void
133
134/*----------------------------------------------------------------------------*/
148/*----------------------------------------------------------------------------*/
149
150void
152 const cs_real_t cv[],
153 const cs_real_t temp[],
154 const cs_real_t pres[],
155 const cs_real_t fracv[],
156 const cs_real_t fracm[],
157 const cs_real_t frace[],
158 cs_real_t gdc2[]);
159
160/*----------------------------------------------------------------------------*/
176/*----------------------------------------------------------------------------*/
177
180 const cs_real_t temp,
181 const cs_real_t yw,
182 const cs_real_t rvsra,
183 const cs_real_t cva,
184 const cs_real_t cvv,
185 const cs_real_t cpl,
186 const cs_real_t l00);
187
188/*----------------------------------------------------------------------------*/
204/*----------------------------------------------------------------------------*/
205
208 const cs_real_t temp,
209 const cs_real_t yw,
210 const cs_real_t rvsra,
211 const cs_real_t cva,
212 const cs_real_t cvv,
213 const cs_real_t cpl,
214 const cs_real_t l00);
215
216/*----------------------------------------------------------------------------*/
226/*----------------------------------------------------------------------------*/
227
228void
230 const cs_real_t bmasfl[],
231 const cs_real_t vela[][3],
232 const cs_real_t vel[][3]);
233
234/*----------------------------------------------------------------------------*/
241/*----------------------------------------------------------------------------*/
242
243void
245 const cs_real_t cromk[]);
246
247/*----------------------------------------------------------------------------*/
253/*----------------------------------------------------------------------------*/
254
255void
257
258/*----------------------------------------------------------------------------*/
268/*----------------------------------------------------------------------------*/
269
270void
271cs_thermal_model_cflp(const cs_real_t croma[],
272 const cs_real_t trav2[][3],
273 const cs_real_t cvara_pr[],
274 const cs_real_t imasfl[],
275 cs_real_t cflp[]);
276
277/*----------------------------------------------------------------------------*/
290/*----------------------------------------------------------------------------*/
291
292void
293cs_thermal_model_cflt(const cs_real_t croma[],
294 const cs_real_t tempk[],
295 const cs_real_t tempka[],
296 const cs_real_t xcvv[],
297 const cs_real_t vel[][3],
298 const cs_real_t i_massflux[],
299 const cs_real_t b_massflux[],
300 cs_real_t cflt[]);
301
302/*----------------------------------------------------------------------------*/
307/*----------------------------------------------------------------------------*/
308
309void
311
312/*----------------------------------------------------------------------------*/
318/*----------------------------------------------------------------------------*/
319
320void
322
323/*----------------------------------------------------------------------------*/
332/*----------------------------------------------------------------------------*/
333
334void
336 const cs_real_t gradv[][3][3],
337 cs_real_t smbrs[]);
338
339/*----------------------------------------------------------------------------*/
353/*----------------------------------------------------------------------------*/
354
355void
357 const cs_real_t *pk1,
358 const cs_real_t th_scal[],
359 const cs_real_t cvar_pr[],
360 const cs_real_t cvara_pr[],
361 const cs_real_t yw[],
362 cs_real_t yv[],
363 cs_real_t temp[]);
364
365/*----------------------------------------------------------------------------*/
371/*----------------------------------------------------------------------------*/
372
373void
375
376/*----------------------------------------------------------------------------*/
377
378#endif /* CS_THERMAL_MODEL_H */
Field descriptor.
Definition: cs_field.h:275
#define CS_F_HOST_DEVICE
Definition: cs_defs.h:555
double cs_real_t
Floating-point value.
Definition: cs_defs.h:332
@ cv
Definition: cs_field_pointer.h:100
@ vel
Definition: cs_field_pointer.h:66
@ cp
Definition: cs_field_pointer.h:99
void cs_thermal_model_gamma_d_c_square(const cs_real_t cp[], const cs_real_t cv[], const cs_real_t temp[], const cs_real_t pres[], const cs_real_t fracv[], const cs_real_t fracm[], const cs_real_t frace[], cs_real_t gdc2[])
Compute the inverse of the square of sound velocity multiplied by gamma.
Definition: cs_thermal_model.cpp:295
void cs_thermal_model_log_setup(void)
Definition: cs_thermal_model.cpp:222
cs_field_t * cs_thermal_model_field(void)
Definition: cs_thermal_model.cpp:180
void cs_thermal_model_cv(cs_real_t *xcvv)
Compute the isochoric heat capacity.
Definition: cs_thermal_model.cpp:920
void cs_thermal_model_add_kst(cs_real_t smbrs[])
Add the kinetic source term if needed.
Definition: cs_thermal_model.cpp:679
void cs_thermal_model_pdivu(cs_real_t smbrs[])
Add the term pdivu to the thermal equation rhs.
Definition: cs_thermal_model.cpp:1259
cs_thermal_model_t * cs_get_glob_thermal_model(void)
Definition: cs_thermal_model.cpp:210
void cs_thermal_model_kinetic_st_finalize(const cs_real_t cromk1[], const cs_real_t cromk[])
Finalize the computation of the kinetic energy based source term.
Definition: cs_thermal_model.cpp:643
const cs_thermal_model_t * cs_glob_thermal_model
void cs_thermal_model_cflp(const cs_real_t croma[], const cs_real_t trav2[][3], const cs_real_t cvara_pr[], const cs_real_t imasfl[], cs_real_t cflp[])
Compute the CFL number related to the pressure equation.
Definition: cs_thermal_model.cpp:738
void cs_eos_predicted_rho(void)
Compute the density for an ideal gas or mixture of ideal gases (only used in the compressible algorit...
Definition: cs_thermal_model.cpp:852
void cs_thermal_model_cflt(const cs_real_t croma[], const cs_real_t tempk[], const cs_real_t tempka[], const cs_real_t xcvv[], const cs_real_t vel[][3], const cs_real_t i_massflux[], const cs_real_t b_massflux[], cs_real_t cflt[])
Compute the CFL number related to the thermal equation.
Definition: cs_thermal_model.cpp:1474
void cs_thermal_model_kinetic_st_prepare(const cs_real_t imasfl[], const cs_real_t bmasfl[], const cs_real_t vela[][3], const cs_real_t vel[][3])
First pass to compute the contribution of the kinetic energy based source term from the prediction st...
Definition: cs_thermal_model.cpp:532
void cs_thermal_model_newton_t(int method, const cs_real_t *pk1, const cs_real_t th_scal[], const cs_real_t cvar_pr[], const cs_real_t cvara_pr[], const cs_real_t yw[], cs_real_t yv[], cs_real_t temp[])
Perform the Newton method to compute the temperature from the internal energy.
Definition: cs_thermal_model.cpp:1030
CS_F_HOST_DEVICE cs_real_t cs_thermal_model_demdt_ecsnt(const cs_real_t pres, const cs_real_t temp, const cs_real_t yw, const cs_real_t rvsra, const cs_real_t cva, const cs_real_t cvv, const cs_real_t cpl, const cs_real_t l00)
Compute the derivative of the internal energy related to the temperature at constant internal energy.
Definition: cs_thermal_model.cpp:483
cs_temperature_scale_t
Definition: cs_thermal_model.h:61
@ CS_TEMPERATURE_SCALE_CELSIUS
Definition: cs_thermal_model.h:65
@ CS_TEMPERATURE_SCALE_KELVIN
Definition: cs_thermal_model.h:64
@ CS_TEMPERATURE_SCALE_NONE
Definition: cs_thermal_model.h:63
cs_thermal_model_variable_t
Definition: cs_thermal_model.h:49
@ CS_THERMAL_MODEL_ENTHALPY
Definition: cs_thermal_model.h:54
@ CS_THERMAL_MODEL_INTERNAL_ENERGY
Definition: cs_thermal_model.h:56
@ CS_THERMAL_MODEL_TEMPERATURE
Definition: cs_thermal_model.h:53
@ CS_THERMAL_MODEL_N_TYPES
Definition: cs_thermal_model.h:57
@ CS_THERMAL_MODEL_NONE
Definition: cs_thermal_model.h:52
@ CS_THERMAL_MODEL_TOTAL_ENERGY
Definition: cs_thermal_model.h:55
@ CS_THERMAL_MODEL_INIT
Definition: cs_thermal_model.h:51
CS_F_HOST_DEVICE cs_real_t cs_thermal_model_demdt(const cs_real_t pres, const cs_real_t temp, const cs_real_t yw, const cs_real_t rvsra, const cs_real_t cva, const cs_real_t cvv, const cs_real_t cpl, const cs_real_t l00)
Compute the derivative of the internal energy related to the temperature at constant pressure.
Definition: cs_thermal_model.cpp:434
void cs_thermal_model_init(void)
Initialize thermal variables if needed.
Definition: cs_thermal_model.cpp:271
void cs_thermal_model_dissipation(const cs_real_t vistot[], const cs_real_t gradv[][3][3], cs_real_t smbrs[])
Compute and add the dissipation term of the thermal equation to its right hand side.
Definition: cs_thermal_model.cpp:981
real(c_double), pointer, save rvsra
ratio gas constant h2o/ dry air
Definition: cstphy.f90:57
Thermal model descriptor.
Definition: cs_thermal_model.h:72
cs_thermal_model_variable_t thermal_variable
Definition: cs_thermal_model.h:74
cs_temperature_scale_t temperature_scale
Definition: cs_thermal_model.h:75
int cflp
Definition: cs_thermal_model.h:80
bool has_dissipation
Definition: cs_thermal_model.h:82
int cflt
Definition: cs_thermal_model.h:79
int has_kinetic_st
Definition: cs_thermal_model.h:78
bool has_pdivu
Definition: cs_thermal_model.h:81