This module contains data types, function and routines for turbulence model. Especially the routine to compute turbulent eddy viscosity for different turbulence model
author: Kannan Masilamani
interface to calculate subgrid scale turbulent eddy viscosity
This function computes turbulent viscosity from gradient U
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(out) | :: | turbVisc(:) |
output is turbulent viscosity |
||
type(mus_turbulence_config_type), | intent(in) | :: | turbConfig |
turbulence config contains oefficients |
||
type(mus_gradData_type), | intent(in) | :: | gradData |
gradient data |
||
real(kind=rk), | intent(in) | :: | auxField(:) |
Auxiliary field variable array |
||
integer, | intent(in) | :: | velPos(3) |
position of velocity components in auxField |
||
integer, | intent(in) | :: | nSolve |
Number of element to solve in this level |
||
integer, | intent(in) | :: | nAuxScalars |
number of scalars in auxField array |
||
real(kind=rk), | intent(in) | :: | dxL |
turbulence coefficients current level lattice element size |
||
real(kind=rk), | intent(in) | :: | dtL |
current level lattice time step size |
||
type(mus_Grad_type), | intent(in) | :: | Grad |
Object that contains pointers to calculate gradients |
interface to calculate subgrid scale turbulent eddy viscosity
This function compute turbulent viscosity from pre-collision PDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(out) | :: | turbVisc(:) |
output is turbulent viscosity |
||
type(mus_turbulence_config_type), | intent(in) | :: | turbConfig |
turbulence type is implicitly passed to access turbulence coefficients |
||
real(kind=rk), | intent(in) | :: | state(:) |
state array |
||
integer, | intent(in) | :: | neigh(:) |
neigh array to obtain precollision pdf |
||
real(kind=rk), | intent(in) | :: | auxField(:) |
Auxiliary field variable array |
||
integer, | intent(in) | :: | densPos |
position of density in auxField |
||
integer, | intent(in) | :: | velPos(3) |
position of velocity components in auxField |
||
integer, | intent(in) | :: | nSize |
number of elements in state array |
||
integer, | intent(in) | :: | nSolve |
Number of element to solve in this level |
||
integer, | intent(in) | :: | nScalars |
number of scalars in state array |
||
integer, | intent(in) | :: | nAuxScalars |
number of scalars in auxField array |
||
type(mus_scheme_layout_type), | intent(in) | :: | layout |
scheme layout |
||
real(kind=rk), | intent(in) | :: | dxL |
current level lattice element size |
||
real(kind=rk), | intent(in) | :: | dtL |
current level lattice time step size |
||
real(kind=rk), | intent(in) | :: | viscKine(:) |
Background kinematic viscosity divided by dtL |
Contains turbulence information loaded from config file
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=labelLen), | public | :: | model |
turbulence model type |
|||
type(les_coeff_type), | public | :: | coeff |
les model coefficients |
|||
logical, | public | :: | compSR_fromPDF | = | .false. |
To compute strain-rate from non-equilibrium PDF for Smagorinsky les model. If true then velocity and grad data are not required |
|
logical, | public | :: | useKolmogorovScale | = | .true. |
Use Kolmogorov scale for interpolation turbulent viscosity for multilevel |
Contains velocity and gradient data to compute eddy viscosity
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(tem_communication_type), | public | :: | sendBuffer |
Communication buffers to communicate visoscity field Local Fluids required by remote processes |
|||
type(tem_communication_type), | public | :: | recvBuffer |
My halos which are fluids on remote processes |
|||
type(tem_communication_type), | public | :: | sendBufferFromCoarser |
Local ghostFromCoarser required by remote processes |
|||
type(tem_communication_type), | public | :: | sendBufferFromFiner |
Local ghostFromFiner required by remote processes |
|||
type(tem_communication_type), | public | :: | recvBufferFromCoarser |
My halos which are ghostFromCoarser on remote processes |
|||
type(tem_communication_type), | public | :: | recvBufferFromFiner |
My halos which are ghostFromFiner on remote processes |
|||
real(kind=rk), | public, | allocatable | :: | visc(:) |
Normalized turbulence viscosity i.e. viscosity scaled to current level i.e. visc/dtL Size: nSize (nFluids+nGhosts+nHalos) Used gradData to compute viscosity for nFluids and nGhosts. This viscosity is interpolated and scaled for setting nonEq term interpolation routines. The source element of interpolation might be halo so they are communicated. |
Contains information required to compute eddy viscosity
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | active |
is true if turbulence table is defined |
|||
type(mus_turbulence_config_type), | public | :: | config |
information loaded from config file |
|||
type(mus_turbulence_data_type), | public, | allocatable | :: | dataOnLvl(:) |
contains level-wise turbulence data to compute eddy viscosity size: minlevel:maxLevel |
||
type(mus_turbulence_visc_proc_type), | public | :: | calcVisc |
contains turbulence viscosity function pointers |
|||
real(kind=rk), | public | :: | fac_c2f |
Factor to scale normalized turbulent viscosity from coarse to fine depending on whether useKolmogorovScale true or false if useKolmogorovScale fac_c2f = 1/2^(1/3) else fac_c2f = 1/2 How to use: v^s_f = fac_c2f v^s_c |
|||
real(kind=rk), | public | :: | fac_f2c |
Factor to scale normalized turbulent viscosity from fine to coarse depending on whether useKolmogorovScale true or false if useKolmogorovScale fac_f2c = 2^(1/3) else fac_f2c = 2 How to use: v^s_c = fac_f2c v^s_f |
Contains large Eddy Turbulence (LES) model coefficients
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | public | :: | C_s |
Smagorinsky constant. C_s = sqrt(C_k sqrt(C_k/C_e) ) = 0.16778594 = 0.17 |
|||
real(kind=rk), | public | :: | C_w |
Model constant for WALE (Wall-Adapting Local Eddy-Viscosity) default: 0.5 |
|||
real(kind=rk), | public | :: | C_v |
Model constant for Vreman model In literature: C_v = sqrt(2.5) C_s = 0.27 |
|||
real(kind=rk), | public | :: | C_e |
Modal constant for turbulent kinetic energy dissipation rate default: 1.048 |
|||
real(kind=rk), | public | :: | C_k |
Model constant for eddy-viscosity coefficient default: 0.094_rk https://caefn.com/openfoam/smagorinsky-sgs-model |
Contains function pointers to obtain normalized turbulence viscosity. Viscosity is normalized to current level i.e. v_s = v/dt
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
procedure(proc_calc_turb_visc_fromGradU), | public, | pointer, nopass | :: | fromGradU | => | null() |
this procedure compute eddy viscosity from velocity field depending turbulence and lbm (compressible/incompressible) models |
procedure(proc_calc_turb_visc_fromPreColPDF), | public, | pointer, nopass | :: | fromPreColPDF | => | null() |
this procedure compute eddy viscosity from preCollision PDF. It is used for Smagorinsky model which depends only on strain rate that can be calculated using local nonEquilibrium. Is assigned when compSR_fromPDF is .true. |
load turbulence table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_turbulence_type), | intent(out) | :: | me |
fluid type |
||
type(flu_State) | :: | conf |
lua state |
|||
integer, | intent(in), | optional | :: | parent |
parent handle |
This initialize turbulence data type which includes velocity array and communication buffer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_turbulence_data_type), | intent(out) | :: | me |
turbulence data |
||
type(tem_levelDesc_type), | intent(in) | :: | levelDesc |
levelDesc to access communication buffers of state array |
||
type(tem_commPattern_type), | intent(in) | :: | pattern |
communication pattern |
||
integer, | intent(in) | :: | nSize |
Number of elements in state array |
This routine compute turbulence viscosity and stores in turbulence data type
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_turbulence_data_type), | intent(inout) | :: | turbData |
turbulence data type |
||
type(mus_turbulence_config_type), | intent(in) | :: | turbConfig |
turbulence configuration |
||
type(mus_turbulence_visc_proc_type), | intent(in) | :: | calcTurbVisc |
turbulence function |
||
real(kind=rk), | intent(in) | :: | state(:) |
state array |
||
integer, | intent(in) | :: | neigh(:) |
neigh array to obtain precollision pdf |
||
real(kind=rk), | intent(in) | :: | auxField(:) |
Auxiliary field variable array |
||
type(mus_gradData_type), | intent(in) | :: | gradData |
gradient data |
||
integer, | intent(in) | :: | densPos |
position of density in auxField |
||
integer, | intent(in) | :: | velPos(3) |
position of velocity components in auxField |
||
integer, | intent(in) | :: | nSize |
number of elements in state array |
||
integer, | intent(in) | :: | nSolve |
Number of element to solve in this level |
||
integer, | intent(in) | :: | nScalars |
number of scalars in state array |
||
integer, | intent(in) | :: | nAuxScalars |
number of scalars in auxField array |
||
type(mus_scheme_layout_type), | intent(in) | :: | layout |
scheme layout |
||
real(kind=rk), | intent(in) | :: | dxL |
lattice element size in current level |
||
real(kind=rk), | intent(in) | :: | dtL |
current level lattice time step size |
||
real(kind=rk), | intent(in) | :: | viscKine(:) |
Background kinematic viscosity divided by dtL |
||
type(mus_Grad_type), | intent(in) | :: | Grad |
Object that contains pointers to calculate gradients |
This routine update turbulent viscosity of boundary elements from RANS viscosity computed in turbulent_wall boundary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(mus_turbulence_data_type), | intent(inout) | :: | turbData |
turbulence data type |
||
real(kind=rk), | intent(in) | :: | viscTurbWall(:) |
Turbulent viscosity on turbulent wall boundary computed in set boundary |
||
integer, | intent(in) | :: | nElems_bnd |
Number of elements in turbulent_wall boundary |
||
integer, | intent(in) | :: | elemPos(:) |
Position of boundary element in levelwise total list or state array |