9.1
general documentation
cs_cdo_turbulence.h
Go to the documentation of this file.
1#ifndef __CS_CDO_TURBULENCE_H__
2#define __CS_CDO_TURBULENCE_H__
3
4/*============================================================================
5 * Functions to handle the resolution of the turbulence modelling
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2025 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 "cdo/cs_cdo_connect.h"
34#include "cdo/cs_equation.h"
35#include "base/cs_field.h"
36#include "mesh/cs_mesh.h"
37#include "cdo/cs_property.h"
38#include "base/cs_time_step.h"
40
41/*----------------------------------------------------------------------------*/
42
44
45/*============================================================================
46 * Macro definitions
47 *============================================================================*/
48
49#define CS_NAVSTO_TOTAL_VISCOSITY "total_viscosity"
50#define CS_NAVSTO_LAM_VISCOSITY "laminar_viscosity"
51#define CS_NAVSTO_TURB_VISCOSITY "turbulent_viscosity"
52
53/*============================================================================
54 * Type definitions
55 *============================================================================*/
56
64typedef struct {
65
72
80
88
94
100
102
109typedef struct _cs_turbulence_t cs_turbulence_t;
110
111/*============================================================================
112 * Function pointer definition
113 *============================================================================*/
114
115/*----------------------------------------------------------------------------*/
124/*----------------------------------------------------------------------------*/
125
126typedef void *
128
129/*----------------------------------------------------------------------------*/
137/*----------------------------------------------------------------------------*/
138
139typedef void *
140(cs_turb_free_context_t)(void *turb_context);
141
142/*----------------------------------------------------------------------------*/
154/*----------------------------------------------------------------------------*/
155
156typedef void
158 const cs_cdo_connect_t *connect,
159 const cs_cdo_quantities_t *quant,
160 const cs_time_step_t *time_step,
161 cs_turbulence_t *tbs);
162
163/*----------------------------------------------------------------------------*/
173/*----------------------------------------------------------------------------*/
174
175typedef void
177 const cs_cdo_connect_t *connect,
178 const cs_cdo_quantities_t *quant,
179 const cs_time_step_t *time_step,
180 const cs_turbulence_t *tbs);
181
189
201
206
217
223
229
235
240
247 /* \var mu_t_field
248 * Field related to the turbulent viscosity
249 */
250
252
258
275 void *context;
276
282
288
294
301
308
309};
310
311/*============================================================================
312 * Public function prototypes
313 *============================================================================*/
314
315/*----------------------------------------------------------------------------*/
322/*----------------------------------------------------------------------------*/
323
326
327/*----------------------------------------------------------------------------*/
335/*----------------------------------------------------------------------------*/
336
339
340/*----------------------------------------------------------------------------*/
346/*----------------------------------------------------------------------------*/
347
348void
349cs_turbulence_free(cs_turbulence_t **p_turb_struct);
350
351/*----------------------------------------------------------------------------*/
358/*----------------------------------------------------------------------------*/
359
360void
362 cs_equation_t *mom_eq);
363
364/*----------------------------------------------------------------------------*/
375/*----------------------------------------------------------------------------*/
376
377void
379 const cs_cdo_connect_t *connect,
380 const cs_cdo_quantities_t *quant,
381 const cs_time_step_t *time_step,
382 cs_turbulence_t *tbs);
383
384/*----------------------------------------------------------------------------*/
390/*----------------------------------------------------------------------------*/
391
392void
394
395/*----------------------------------------------------------------------------*/
405/*----------------------------------------------------------------------------*/
406
407void
409 const cs_cdo_connect_t *connect,
410 const cs_cdo_quantities_t *quant,
411 const cs_time_step_t *time_step,
412 cs_turbulence_t *tbs);
413
414/*----------------------------------------------------------------------------*/
423/*----------------------------------------------------------------------------*/
424
425void *
427
428/*----------------------------------------------------------------------------*/
436/*----------------------------------------------------------------------------*/
437
438void *
440
441/*----------------------------------------------------------------------------*/
453/*----------------------------------------------------------------------------*/
454
455void
457 const cs_cdo_connect_t *connect,
458 const cs_cdo_quantities_t *quant,
459 const cs_time_step_t *time_step,
460 cs_turbulence_t *tbs);
461
462
463/*----------------------------------------------------------------------------*/
474/*----------------------------------------------------------------------------*/
475
476void
478 const cs_cdo_connect_t *connect,
479 const cs_cdo_quantities_t *quant,
480 const cs_time_step_t *time_step,
481 const cs_turbulence_t *tbs);
482
483/*----------------------------------------------------------------------------*/
494/*----------------------------------------------------------------------------*/
495
496void
498 const cs_cdo_connect_t *connect,
499 const cs_cdo_quantities_t *quant,
500 const cs_time_step_t *time_step,
501 const cs_turbulence_t *tbs);
502
503/*----------------------------------------------------------------------------*/
516/*----------------------------------------------------------------------------*/
517
518void
520 const double nu,
521 const double k,
522 const double hfc,
523 const double uct,
524 cs_real_t *res);
525
526/*----------------------------------------------------------------------------*/
527
528/*----------------------------------------------------------------------------*/
535/*----------------------------------------------------------------------------*/
536
537bool
539
541
542#endif /* __CS_CDO_TURBULENCE_H__ */
void cs_turbulence_finalize_setup(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, cs_turbulence_t *tbs)
Finalize the setup of the turbulence modelling and especially the equations/properties and other rela...
Definition: cs_cdo_turbulence.cpp:518
void cs_turbulence_set_shared_from_fv(cs_turbulence_t *tbs, bool is_shared)
Indicate whether use Legacy solved turbulent viscosity.
Definition: cs_cdo_turbulence.cpp:636
void cs_turbulence_init_setup(cs_turbulence_t *tbs, cs_equation_t *mom_eq)
Initialize the structure managing the turbulence modelling.
Definition: cs_cdo_turbulence.cpp:398
void * cs_turb_free_k_eps_context(void *tbc)
Free the context structure related to the k-epsilon turbulence model.
Definition: cs_cdo_turbulence.cpp:786
void *() cs_turb_free_context_t(void *turb_context)
Free the context structure related to a given turbulence modelling.
Definition: cs_cdo_turbulence.h:140
void * cs_turb_init_k_eps_context(const cs_turb_model_t *tbm)
Allocate and initialize the context structure related to the k-epsilon turbulence model.
Definition: cs_cdo_turbulence.cpp:688
bool cs_turb_wall_functions_is_activated(const cs_turbulence_param_t *turbulence)
Return true if a wall function is used for turbulence.
Definition: cs_cdo_turbulence.cpp:1060
void cs_turb_compute_wall_bc_coeffs(const cs_equation_param_t *eqp, const double nu, const double k, const double hfc, const double uct, cs_real_t *res)
Function used to define the exchange coefficients for tangential and normal components.
Definition: cs_cdo_turbulence.cpp:1026
void cs_turbulence_free(cs_turbulence_t **p_turb_struct)
Free the structure managing the turbulence modelling.
Definition: cs_cdo_turbulence.cpp:370
void() cs_turb_compute_t(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, cs_turbulence_t *tbs)
Compute for the current time step the new state for the turbulence model. This means that all related...
Definition: cs_cdo_turbulence.h:157
void cs_turb_update_shared_legacy(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, const cs_turbulence_t *tbs)
Update for the current time step the new state for the turbulence model. directly update the turbulen...
Definition: cs_cdo_turbulence.cpp:886
cs_turbulence_t * cs_turbulence_create(cs_turbulence_param_t *tbp)
Allocate the structure managing the turbulence modelling.
Definition: cs_cdo_turbulence.cpp:319
void *() cs_turb_init_context_t(const cs_turb_model_t *tbm)
Allocate and initialize the context structure related to a given turbulence modelling.
Definition: cs_cdo_turbulence.h:127
void cs_turbulence_init_values(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, cs_turbulence_t *tbs)
Initialize the values of quantities related to a turbulence model.
Definition: cs_cdo_turbulence.cpp:655
void() cs_turb_update_t(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, const cs_turbulence_t *tbs)
Update properties, arrays related to the turbulent variables.
Definition: cs_cdo_turbulence.h:176
cs_turbulence_param_t * cs_turbulence_param_create(void)
Allocate the structure storing the set of parameters for the turbulence modelling.
Definition: cs_cdo_turbulence.cpp:285
void cs_turb_compute_k_eps(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, cs_turbulence_t *tbs)
Compute for the current time step the new state for the turbulence model. This means that all related...
Definition: cs_cdo_turbulence.cpp:936
void cs_turb_update_k_eps(const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, const cs_turbulence_t *tbs)
Update for the current time step the new state for the turbulence model. This is used to update the t...
Definition: cs_cdo_turbulence.cpp:812
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
double cs_real_t
Floating-point value.
Definition: cs_defs.h:357
#define END_C_DECLS
Definition: cs_defs.h:555
@ k
Definition: cs_field_pointer.h:72
Definition: mesh.f90:26
Definition: cs_cdo_turbulence.h:188
cs_property_t * mu_l
Definition: cs_cdo_turbulence.h:228
cs_turb_update_t * update
Definition: cs_cdo_turbulence.h:307
void * context
Definition: cs_cdo_turbulence.h:275
cs_turb_compute_t * compute_steady
Definition: cs_cdo_turbulence.h:300
cs_turbulence_param_t * param
Definition: cs_cdo_turbulence.h:200
cs_turb_free_context_t * free_context
Definition: cs_cdo_turbulence.h:287
cs_equation_t * mom_eq
Definition: cs_cdo_turbulence.h:205
cs_property_t * mu_t
Definition: cs_cdo_turbulence.h:234
cs_turb_init_context_t * init_context
Definition: cs_cdo_turbulence.h:281
cs_turb_compute_t * compute
Definition: cs_cdo_turbulence.h:293
cs_field_t * mu_t_field
Definition: cs_cdo_turbulence.h:251
cs_property_t * rho
Definition: cs_cdo_turbulence.h:216
cs_field_t * rij
Definition: cs_cdo_turbulence.h:257
cs_real_t * mu_tot_array
Definition: cs_cdo_turbulence.h:239
cs_property_t * mu_tot
Definition: cs_cdo_turbulence.h:222
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:145
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:194
Main structure to handle the discretization and the resolution of an equation.
Field descriptor.
Definition: cs_field.h:156
Definition: cs_mesh.h:85
Structure associated to the definition of a property relying on the cs_xdef_t structure.
time step descriptor
Definition: cs_time_step.h:64
LES turbulence model descriptor.
Definition: cs_turbulence_model.h:275
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:130
RANS turbulence model descriptor.
Definition: cs_turbulence_model.h:198
Definition: cs_turbulence_model.h:187
Structure storing the parameters related to the resolution of the turbulence modelling....
Definition: cs_cdo_turbulence.h:64
cs_turb_les_model_t * les_param
Definition: cs_cdo_turbulence.h:87
cs_turb_ref_values_t * reference_values
Definition: cs_cdo_turbulence.h:93
cs_turb_model_t * model
Definition: cs_cdo_turbulence.h:71
cs_turb_rans_model_t * rans_param
Definition: cs_cdo_turbulence.h:79
bool shared_from_legacy
Definition: cs_cdo_turbulence.h:99
Structure storing the parameters related to the resolution of the turbulence modelling....