1 #ifndef __CS_TURBULENCE_MODEL_H__ 2 #define __CS_TURBULENCE_MODEL_H__ 3 4 /*============================================================================ 5 * Base turbulence model 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 /*---------------------------------------------------------------------------- 49 * turbulence models 50 *----------------------------------------------------------------------------*/ 51 52 typedef enum { 53 54 CS_TURB_NONE = 0, 55 CS_TURB_MIXING_LENGTH = 10, 56 CS_TURB_K_EPSILON = 20, 57 CS_TURB_K_EPSILON_LIN_PROD = 21, 58 CS_TURB_K_EPSILON_LS = 22, 59 CS_TURB_K_EPSILON_QUAD = 23, 60 CS_TURB_RIJ_EPSILON_LRR = 30, 61 CS_TURB_RIJ_EPSILON_SSG = 31, 62 CS_TURB_RIJ_EPSILON_EBRSM = 32, 63 CS_TURB_LES_SMAGO_CONST = 40, 64 CS_TURB_LES_SMAGO_DYN = 41, 65 CS_TURB_LES_WALE = 42, 66 CS_TURB_V2F_PHI = 50, 67 CS_TURB_V2F_BL_V2K = 51, 68 CS_TURB_K_OMEGA = 60, 69 CS_TURB_SPALART_ALLMARAS = 70 70 71 } cs_turb_model_type_t; 72 73 /*---------------------------------------------------------------------------- 74 * turbulence type of model 75 *----------------------------------------------------------------------------*/ 76 77 enum { 78 79 CS_TURB_TYPE_NONE = 0, 80 CS_TURB_RANS = 1, 81 CS_TURB_LES = 2, 82 CS_TURB_HYBRID = 3 83 84 }; 85 86 /*---------------------------------------------------------------------------- 87 * turbulence order of model 88 *----------------------------------------------------------------------------*/ 89 90 enum { 91 92 CS_TURB_ALGEBRAIC = 0, 93 CS_TURB_FIRST_ORDER = 1, 94 CS_TURB_SECOND_ORDER = 2 95 96 }; 97 98 /*---------------------------------------------------------------------------- 99 * hybrid models 100 *----------------------------------------------------------------------------*/ 101 102 enum { 103 104 CS_HYBRID_NONE = 0, 105 CS_HYBRID_DES = 1, 106 CS_HYBRID_DDES = 2, 107 CS_HYBRID_SAS = 3 108 109 }; 110 111 /* turbulence model general options descriptor */ 112 /*---------------------------------------------*/ 113 114 typedef struct { 115 116 int iturb; /* turbulence model 117 CS_TURB_NONE: no turbulence model (laminar flow) 118 CS_TURB_MIXING_LENGTH: mixing length model 119 CS_TURB_K_EPSILON: standard k-epsilon model 120 CS_TURB_K_EPSILON_LIN_PROD: k-epsilon model with 121 Linear Production (LP) correction 122 CS_TURB_K_EPSILON_LS: Launder-Sharma low Re 123 k-epsilon model 124 CS_TURB_K_EPSILON_QUAD: Baglietto et al. low Re 125 k epsilon model 126 CS_TURB_RIJ_EPSILON_LRR: Rij-epsilon (LRR) 127 CS_TURB_RIJ_EPSILON_SSG: Rij-epsilon (SSG) 128 CS_TURB_RIJ_EPSILON_EBRSM: Rij-epsilon (EBRSM) 129 CS_TURB_LES_SMAGO_CONST: LES 130 (constant Smagorinsky model) 131 CS_TURB_LES_SMAGO_DYN: LES ("classical" dynamic 132 Smagorisky model) 133 CS_TURB_LES_WALE: LES (WALE) 134 CS_TURB_V2F_PHI: v2f phi-model 135 CS_TURB_V2F_BL_V2K: v2f BL-v2-k 136 CS_TURB_K_OMEGA: k-omega SST 137 CS_TURB_SPALART_ALLMARAS: Spalart-Allmaras model */ 138 int itytur; /* class of turbulence model (integer value 139 iturb/10) */ 140 int hybrid_turb; /* Type of Hybrid Turbulence Model 141 - CS_HYBRID_NONE: No model 142 - CS_HYBRID_DES: Detached Eddy Simulation 143 - CS_HYBRID_DDES: Delayed Detached Eddy 144 Simulation 145 - CS_HYBRID_SAM: Scale Adaptive Model */ 146 int type; /* Type of turbulence modelling: 147 - CS_TURB_NONE: No model 148 - CS_TURB_RANS: RANS modelling 149 - CS_TURB_LES: LES modelling 150 - CS_TURB_HYBRID: RANS -- LES modelling */ 151 int order; /* Order of the turbulence model: 152 - CS_TURB_ALGEBRAIC: 0th order algebraik model 153 - CS_TURB_FIRST_ORDER: 1st order Eddy Viscosity 154 type models 155 - CS_TURB_SECOND_ORDER: 2nd order Differential 156 Reynolds Stress type models */ 157 } cs_turb_model_t; 158 159 /* Reference values for turbulence structure and associated pointer */ 160 /*------------------------------------------------------------------*/ 161 162 typedef struct { 163 164 double almax; /* characteristic macroscopic length of the 165 domain */ 166 double uref; /* characteristic flow velocity */ 167 168 } cs_turb_ref_values_t; 169 170 /* RANS turbulence model descriptor */ 171 /*----------------------------------*/ 172 173 typedef struct { 174 175 int irccor; /* activation of rotation/curvature correction for 176 an eddy viscosity turbulence models 177 - 0: false 178 - 1: true */ 179 int itycor; /* type of rotation/curvature correction for an 180 eddy viscosity turbulence models 181 - 1: Cazalbou correction (default when irccor=1 182 and itytur=2 or 5) 183 - 2: Spalart-Shur correction (default when 184 irccor=1 and iturb=60 or 70) */ 185 int idirsm; /* turbulent diffusion model for second moment 186 closure 187 - 0: scalar diffusivity (Shir model) 188 - 1: tensorial diffusivity (Daly and Harlow 189 model, default model) */ 190 int iclkep; /* clipping of k and epsilon 191 - 0: absolute value clipping 192 - 1: coupled clipping based on physical 193 relationships */ 194 int igrhok; /* take (2/3 rho grad k) in the momentum 195 equation 196 - 1: true 197 - 0: false (default) */ 198 int igrake; /* buoyant term in k-epsilon 199 - 1: true (default if rho is variable) 200 - 0: false */ 201 int igrari; /* buoyant term in Rij-epsilon 202 - 1: true (default if rho is variable) 203 - 0: false */ 204 int ikecou; /* partially coupled version of 205 k-epsilon (only for iturb=20) 206 - 1: true (default) 207 - 0: false */ 208 int reinit_turb; /* Advanced re-init for EBRSM and k-omega models 209 - 1: true (default) 210 - 0: false */ 211 int irijco; /* coupled solving of Rij 212 - 1: true 213 - 0: false (default) */ 214 int irijnu; /* pseudo eddy viscosity in the matrix of momentum 215 equation to partially implicit div( rho R ) 216 - 1: true 217 - 0: false (default) */ 218 int irijrb; /* accurate treatment of R at the boundary (see 219 \ref condli) 220 - 1: true 221 - 0: false (default) */ 222 int irijec; /* wall echo term of R 223 - 1: true 224 - 0: false (default) */ 225 int idifre; /* whole treatment of the diagonal part of the 226 diffusion tensor of R and epsilon 227 - 1: true (default) 228 - 0: simplified treatment */ 229 int iclsyr; /* partial implicitation of symmetry BCs of R 230 - 1: true (default) 231 - 0: false */ 232 int iclptr; /* partial implicitation of wall BCs of R 233 - 1: true 234 - 0: false (default) */ 235 double xlomlg; /* mixing length */ 236 237 } cs_turb_rans_model_t; 238 239 /* LES turbulence model descriptor */ 240 /*---------------------------------*/ 241 242 typedef struct { 243 244 int idries; /* Van Driest smoothing at the wall (only for 245 itytur=4) 246 - 1: true 247 - 0: false */ 248 249 } cs_turb_les_model_t; 250 251 /*============================================================================ 252 * Static global variables 253 *============================================================================*/ 254 255 /* Pointer to main turbulence model descriptor structure */ 256 257 extern const cs_turb_model_t *cs_glob_turb_model; 258 259 /* Pointer to reference values for turbulence descriptor structure */ 260 261 extern const cs_turb_ref_values_t *cs_glob_turb_ref_values; 262 263 /* Pointer to RANS turbulence model descriptor structure */ 264 265 extern const cs_turb_rans_model_t *cs_glob_turb_rans_model; 266 267 /* Pointer to LES turbulence model descriptor structure */ 268 269 extern const cs_turb_les_model_t *cs_glob_turb_les_model; 270 271 /* Constant for turbulence models */ 272 273 extern const double cs_turb_xkappa; 274 extern const double cs_turb_vdriest; 275 extern const double cs_turb_cstlog; 276 extern const double cs_turb_cstlog_rough; 277 extern double cs_turb_cstlog_alpha; 278 extern const double cs_turb_apow; 279 extern const double cs_turb_bpow; 280 extern double cs_turb_dpow; 281 extern double cs_turb_cmu; 282 extern double cs_turb_cmu025; 283 extern double cs_turb_ce1; 284 extern double cs_turb_ce2; 285 extern double cs_turb_ce4; 286 extern double cs_turb_crij1; 287 extern double cs_turb_crij2; 288 extern double cs_turb_crij3; 289 extern const double cs_turb_crijp1; 290 extern const double cs_turb_crijp2; 291 extern const double cs_turb_cssge2; 292 extern const double cs_turb_cssgs1; 293 extern const double cs_turb_cssgs2; 294 extern const double cs_turb_cssgr1; 295 extern const double cs_turb_cssgr2; 296 extern const double cs_turb_cssgr3; 297 extern const double cs_turb_cssgr4; 298 extern const double cs_turb_cssgr5; 299 extern const double cs_turb_cebms1; 300 extern const double cs_turb_cebms2; 301 extern const double cs_turb_cebmr1, cebmr2, cebmr3, cebmr4, cebmr5; 302 extern double cs_turb_csrij; 303 extern const double cs_turb_cebme2; 304 extern const double cs_turb_cebmmu; 305 extern const double cs_turb_xcl; 306 extern const double cs_turb_xa1; 307 extern const double cs_turb_xct; 308 extern const double cs_turb_xceta; 309 extern const double cs_turb_cpale1; 310 extern const double cs_turb_cpale2; 311 extern const double cs_turb_cpale3; 312 extern const double cs_turb_cpale4; 313 extern const double cs_turb_cpalc1; 314 extern const double cs_turb_cpalc2; 315 extern const double cs_turb_cpalct; 316 extern const double cs_turb_cpalcl; 317 extern const double cs_turb_cpalet; 318 extern const double cs_turb_ckwsk1; 319 extern const double cs_turb_ckwsk2; 320 extern const double cs_turb_ckwsw1; 321 extern const double cs_turb_ckwsw2; 322 extern const double cs_turb_ckwbt1; 323 extern const double cs_turb_ckwbt2; 324 extern double cs_turb_ckwgm1; 325 extern double cs_turb_ckwgm2; 326 extern const double cs_turb_ckwa1; 327 extern const double cs_turb_ckwc1; 328 extern double cs_turb_cddes; 329 extern const double cs_turb_csas; 330 extern const double cs_turb_csas_eta2; 331 extern const double cs_turb_cnl1; 332 extern const double cs_turb_cnl2; 333 extern const double cs_turb_cnl3; 334 extern const double cs_turb_cnl4; 335 extern const double cs_turb_cnl5; 336 extern const double cs_turb_csab1; 337 extern const double cs_turb_csab2; 338 extern const double cs_turb_csasig; 339 extern const double cs_turb_csav1; 340 extern double cs_turb_csaw1; 341 extern const double cs_turb_csaw2; 342 extern const double cs_turb_csaw3; 343 extern const double cs_turb_cssr1; 344 extern const double cs_turb_cssr2; 345 extern const double cs_turb_cssr3; 346 extern const double cs_turb_ccaze2; 347 extern const double cs_turb_ccazsc; 348 extern const double cs_turb_ccaza; 349 extern const double cs_turb_ccazb; 350 extern const double cs_turb_ccazc; 351 extern const double cs_turb_ccazd; 352 extern const double cs_turb_xlesfl; 353 extern const double cs_turb_ales; 354 extern const double cs_turb_bles; 355 extern double cs_turb_csmago; 356 extern double cs_turb_xlesfd; 357 extern double cs_turb_csmago_max; 358 extern double cs_turb_csmago_min; 359 extern double cs_turb_cdries; 360 extern const double cs_turb_cv2fa1; 361 extern const double cs_turb_cv2fe2; 362 extern const double cs_turb_cv2fc1; 363 extern const double cs_turb_cv2fc2; 364 extern const double cs_turb_cv2fct; 365 extern const double cs_turb_cv2fcl; 366 extern const double cs_turb_cv2fet; 367 extern double cs_turb_cwale; 368 extern const double cs_turb_xiafm; 369 extern const double cs_turb_etaafm; 370 extern const double cs_turb_c1trit; 371 extern const double cs_turb_c2trit; 372 extern const double cs_turb_c3trit; 373 extern const double cs_turb_c4trit; 374 extern const double cs_turb_cthafm; 375 extern const double cs_turb_cthdfm; 376 377 /*============================================================================= 378 * Public function prototypes 379 *============================================================================*/ 380 381 /*---------------------------------------------------------------------------- 382 * Initialize turbulence model structures 383 *----------------------------------------------------------------------------*/ 384 385 void 386 cs_turb_model_init(void); 387 388 /*---------------------------------------------------------------------------- 389 * Set type and order of the turbulence model 390 *----------------------------------------------------------------------------*/ 391 392 void 393 cs_set_type_order_turbulence_model(void); 394 395 /*---------------------------------------------------------------------------- 396 * Set global pointer to turbulence model structure 397 *----------------------------------------------------------------------------*/ 398 399 void 400 cs_set_glob_turb_model(void); 401 402 /*---------------------------------------------------------------------------- 403 * Provide write access to turbulence model structure 404 *----------------------------------------------------------------------------*/ 405 406 cs_turb_model_t * 407 cs_get_glob_turb_model(void); 408 409 /*---------------------------------------------------------------------------- 410 * Compute turbulence model constants, 411 * some of which may depend on the model choice. 412 *----------------------------------------------------------------------------*/ 413 414 void 415 cs_turb_compute_constants(void); 416 417 /*---------------------------------------------------------------------------- 418 * Provide access to cs_glob_turb_ref_values 419 * 420 * needed to initialize structure with GUI 421 *----------------------------------------------------------------------------*/ 422 423 cs_turb_ref_values_t * 424 cs_get_glob_turb_ref_values(void); 425 426 /*---------------------------------------------------------------------------- 427 * Provide access to cs_glob_turb_rans_model 428 * 429 * needed to initialize structure with GUI 430 *----------------------------------------------------------------------------*/ 431 432 cs_turb_rans_model_t * 433 cs_get_glob_turb_rans_model(void); 434 435 /*---------------------------------------------------------------------------- 436 * Provide access to cs_glob_turb_les_model 437 * 438 * needed to initialize structure with GUI 439 *----------------------------------------------------------------------------*/ 440 441 cs_turb_les_model_t * 442 cs_get_glob_turb_les_model(void); 443 444 /*----------------------------------------------------------------------------* 445 * Print the turbulence model parameters to setup.log. 446 *----------------------------------------------------------------------------*/ 447 448 void 449 cs_turb_model_log_setup(void); 450 451 /*----------------------------------------------------------------------------* 452 * Print the turbulent constants to setup.log. 453 *----------------------------------------------------------------------------*/ 454 455 void 456 cs_turb_constants_log_setup(void); 457 458 /*----------------------------------------------------------------------------* 459 * Clip turbulent fluxes 460 *----------------------------------------------------------------------------*/ 461 462 void 463 cs_clip_turbulent_fluxes(int flux_id, 464 int ivartt); 465 466 /*----------------------------------------------------------------------------*/ 467 468 END_C_DECLS 469 470 #endif /* __CS_TURBULENCE_MODEL_H__ */ 471