8.3
general documentation
cs_thermal_system.h
Go to the documentation of this file.
1#ifndef __CS_THERMAL_SYSTEM_H__
2#define __CS_THERMAL_SYSTEM_H__
3
4/*============================================================================
5 * Functions to handle cs_thermal_system_t structure
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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 * Local headers
30 *----------------------------------------------------------------------------*/
31
32#include "cs_advection_field.h"
33#include "cs_equation.h"
34#include "cs_field.h"
35#include "cs_property.h"
36#include "cs_mesh.h"
37#include "cs_source_term.h"
38#include "cs_time_step.h"
39#include "cs_xdef.h"
40
41/*----------------------------------------------------------------------------*/
42
44
45/*============================================================================
46 * Macro definitions
47 *============================================================================*/
48
49/* Generic name given to fields and equations related to this module */
50
51#define CS_THERMAL_EQNAME "thermal_equation"
52#define CS_THERMAL_CP_NAME "thermal_capacity"
53#define CS_THERMAL_LAMBDA_NAME "thermal_conductivity"
54
66#define CS_THERMAL_POST_ENTHALPY (1 << 0) /* 1 */
67
72/*=============================================================================
73 * Structure and type definitions
74 *============================================================================*/
75
77
106typedef enum {
107
108 CS_THERMAL_MODEL_STEADY = 1<<0, /* = 1 */
110
111 /* Main variable to consider (by default the temperature in Kelvin)
112 ---------------------------------------------------------------- */
113
117
118 /* Treatment of the diffusion term
119 ------------------------------- */
120
122
123 /* Additional bit settings
124 ----------------------- */
125
126 CS_THERMAL_MODEL_IN_CELSIUS = 1<<7 /* = 128 */
127
129
130/* Set of parameters related to the thermal module */
131
132typedef struct {
133
134 cs_flag_t model; /* Choice of modelling */
135 cs_flag_t numeric; /* General numerical options */
136 cs_flag_t post; /* Post-processing options */
137
138 /* Equation associated to this module */
139 /* ---------------------------------- */
140
142
143 /* Properties associated to this module */
144 /* ------------------------------------ */
145
146 cs_property_t *unsteady_property; /* Property of the unsteady term: rho.cp */
147 cs_property_t *lambda; /* Thermal conductivity */
148 cs_property_t *cp; /* Heat capacity */
149 cs_property_t *rho; /* Mass density (may be shared) */
150 cs_property_t *kappa; /* lambda/cp may be null*/
151
152 /* value of lambda/cp in each cell (allocated if the related property kappa
153 * is non-null and defined by array) */
155
156 /* Fields associated to this module */
157 /* -------------------------------- */
158
162
163 /* Additional members */
164 /* ------------------ */
165
167
168 /* N.B.: Other reference values for properties are stored within each
169 * property structure */
170
172
173/*============================================================================
174 * Public function prototypes
175 *============================================================================*/
176
177/*----------------------------------------------------------------------------*/
184/*----------------------------------------------------------------------------*/
185
188
189/*----------------------------------------------------------------------------*/
196/*----------------------------------------------------------------------------*/
197
198void
200
201/*----------------------------------------------------------------------------*/
207/*----------------------------------------------------------------------------*/
208
211
212/*----------------------------------------------------------------------------*/
219/*----------------------------------------------------------------------------*/
220
221bool
223
224/*----------------------------------------------------------------------------*/
230/*----------------------------------------------------------------------------*/
231
232bool
234
235/*----------------------------------------------------------------------------*/
245/*----------------------------------------------------------------------------*/
246
249 cs_flag_t numeric,
250 cs_flag_t post);
251
252/*----------------------------------------------------------------------------*/
256/*----------------------------------------------------------------------------*/
257
258void
260
261/*----------------------------------------------------------------------------*/
265/*----------------------------------------------------------------------------*/
266
269
270/*----------------------------------------------------------------------------*/
276/*----------------------------------------------------------------------------*/
277
278cs_real_t *
280
281/*----------------------------------------------------------------------------*/
287/*----------------------------------------------------------------------------*/
288
289void
291
292/*----------------------------------------------------------------------------*/
300/*----------------------------------------------------------------------------*/
301
302void
304 const cs_cdo_quantities_t *quant,
305 const cs_time_step_t *time_step);
306
307/*----------------------------------------------------------------------------*/
316/*----------------------------------------------------------------------------*/
317
318void
320 const cs_cdo_connect_t *connect,
321 const cs_cdo_quantities_t *quant,
322 const cs_time_step_t *time_step);
323
324/*----------------------------------------------------------------------------*/
334/*----------------------------------------------------------------------------*/
335
336void
337cs_thermal_system_compute(bool cur2prev,
338 const cs_mesh_t *mesh,
339 const cs_cdo_connect_t *connect,
340 const cs_cdo_quantities_t *quant,
341 const cs_time_step_t *time_step);
342
343/*----------------------------------------------------------------------------*/
353/*----------------------------------------------------------------------------*/
354
355void
357 const cs_cdo_connect_t *connect,
358 const cs_cdo_quantities_t *quant,
359 const cs_time_step_t *ts);
360
361/*----------------------------------------------------------------------------*/
371/*----------------------------------------------------------------------------*/
372
373void
375 const cs_cdo_connect_t *connect,
376 const cs_cdo_quantities_t *quant,
377 const cs_time_step_t *ts,
378 bool cur2prev);
379
380/*----------------------------------------------------------------------------*/
387/*----------------------------------------------------------------------------*/
388
389void
391 const cs_cdo_quantities_t *cdoq);
392
393/*----------------------------------------------------------------------------*/
415/*----------------------------------------------------------------------------*/
416
417void
419 int mesh_id,
420 int cat_id,
421 int ent_flag[5],
422 cs_lnum_t n_cells,
423 cs_lnum_t n_i_faces,
424 cs_lnum_t n_b_faces,
425 const cs_lnum_t cell_ids[],
426 const cs_lnum_t i_face_ids[],
427 const cs_lnum_t b_face_ids[],
428 const cs_time_step_t *time_step);
429
430/*----------------------------------------------------------------------------*/
434/*----------------------------------------------------------------------------*/
435
436void
438
439/*----------------------------------------------------------------------------*/
443/*----------------------------------------------------------------------------*/
444
445void
447
448/*----------------------------------------------------------------------------*/
449
451
452#endif /* __CS_THERMAL_SYSTEM_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
unsigned short int cs_flag_t
Definition: cs_defs.h:344
void cs_thermal_system_compute_steady_state(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Build and solve a steady-state thermal system.
Definition: cs_thermal_system.cpp:653
void cs_thermal_system_destroy(void)
Free the main structure related to the thermal system.
Definition: cs_thermal_system.cpp:451
cs_real_t * cs_thermal_system_get_face_temperature(void)
Retrieve the current temperature at face values.
Definition: cs_thermal_system.cpp:500
void cs_thermal_system_extra_op(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
Predefined extra-operations for the thermal system.
Definition: cs_thermal_system.cpp:842
cs_flag_t cs_thermal_model_type_t
Definition: cs_thermal_system.h:76
cs_thermal_model_type_bit_t
Bit values for physical modelling related to thermal system.
Definition: cs_thermal_system.h:106
@ CS_THERMAL_MODEL_IN_CELSIUS
Definition: cs_thermal_system.h:126
@ CS_THERMAL_MODEL_STEADY
Definition: cs_thermal_system.h:108
@ CS_THERMAL_MODEL_USE_TOTAL_ENERGY
Definition: cs_thermal_system.h:116
@ CS_THERMAL_MODEL_ANISOTROPIC_CONDUCTIVITY
Definition: cs_thermal_system.h:121
@ CS_THERMAL_MODEL_NAVSTO_ADVECTION
Definition: cs_thermal_system.h:109
@ CS_THERMAL_MODEL_USE_TEMPERATURE
Definition: cs_thermal_system.h:114
@ CS_THERMAL_MODEL_USE_ENTHALPY
Definition: cs_thermal_system.h:115
void cs_thermal_system_update(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, bool cur2prev)
Update the quantities related to the thermal module.
Definition: cs_thermal_system.cpp:812
cs_thermal_system_t * cs_thermal_system_activate(cs_flag_t model, cs_flag_t numeric, cs_flag_t post)
Allocate and initialize the thermal system.
Definition: cs_thermal_system.cpp:292
bool cs_thermal_system_is_activated(void)
Check if the resolution of the thermal system has been activated.
Definition: cs_thermal_system.cpp:271
void cs_thermal_system_log_setup(void)
Summary of the main options related to cs_thermal_system_t structure.
Definition: cs_thermal_system.cpp:915
void cs_thermal_system_set_reference_temperature(cs_real_t ref)
Set the value of the reference temperature associated to the thermal system.
Definition: cs_thermal_system.cpp:213
void cs_thermal_system_init_values(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts)
Set an initial values for all quantities related to this module This is done after the setup step.
Definition: cs_thermal_system.cpp:780
cs_real_t cs_thermal_system_get_reference_temperature(void)
Retrieve the value of the reference temperature associated to a thermal system.
Definition: cs_thermal_system.cpp:192
bool cs_thermal_system_needs_navsto(void)
Does the thermal system rely on the advection field associated to the Navier-Stokes equations ?
Definition: cs_thermal_system.cpp:251
void cs_thermal_system_extra_post(void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *time_step)
Predefined post-processing output for the thermal system. The prototype of this function is fixed sin...
Definition: cs_thermal_system.cpp:879
void cs_thermal_system_finalize_setup(const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Last step of the setup of the thermal system.
Definition: cs_thermal_system.cpp:624
void cs_thermal_system_cht_boundary_conditions_setup(void)
Initialize structures and/or boundary conditions used for CHT coupling.
Definition: cs_thermal_system.cpp:956
void cs_thermal_system_compute(bool cur2prev, const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step)
Build and solve the thermal system.
Definition: cs_thermal_system.cpp:686
void cs_thermal_system_init_setup(void)
Start setting-up the thermal system At this stage, numerical settings should be completely determined...
Definition: cs_thermal_system.cpp:532
cs_flag_t cs_thermal_system_get_model(void)
Retrieve the model flag related to a thermal system.
Definition: cs_thermal_system.cpp:233
cs_equation_t * cs_thermal_system_get_equation(void)
Retrieve the main equation related to the thermal system.
Definition: cs_thermal_system.cpp:481
Definition: mesh.f90:26
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:139
Main structure to handle the discretization and the resolution of an equation.
Field descriptor.
Definition: cs_field.h:131
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.
Definition: cs_thermal_system.h:132
cs_field_t * total_energy
Definition: cs_thermal_system.h:161
cs_flag_t numeric
Definition: cs_thermal_system.h:135
cs_field_t * enthalpy
Definition: cs_thermal_system.h:160
cs_real_t ref_temperature
Definition: cs_thermal_system.h:166
cs_equation_t * thermal_eq
Definition: cs_thermal_system.h:141
cs_flag_t post
Definition: cs_thermal_system.h:136
cs_property_t * unsteady_property
Definition: cs_thermal_system.h:146
cs_field_t * temperature
Definition: cs_thermal_system.h:159
cs_property_t * rho
Definition: cs_thermal_system.h:149
cs_property_t * lambda
Definition: cs_thermal_system.h:147
cs_flag_t model
Definition: cs_thermal_system.h:134
cs_real_t * kappa_array
Definition: cs_thermal_system.h:154
cs_property_t * kappa
Definition: cs_thermal_system.h:150
cs_property_t * cp
Definition: cs_thermal_system.h:148
time step descriptor
Definition: cs_time_step.h:64