mus_turbulence_module Module

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


Uses

  • module~~mus_turbulence_module~~UsesGraph module~mus_turbulence_module mus_turbulence_module module~tem_construction_module tem_construction_module module~mus_turbulence_module->module~tem_construction_module module~aot_table_module aot_table_module module~mus_turbulence_module->module~aot_table_module module~aotus_module aotus_module module~mus_turbulence_module->module~aotus_module module~mus_scheme_layout_module mus_scheme_layout_module module~mus_turbulence_module->module~mus_scheme_layout_module module~tem_comm_module tem_comm_module module~mus_turbulence_module->module~tem_comm_module module~tem_tools_module tem_tools_module module~mus_turbulence_module->module~tem_tools_module module~tem_logging_module tem_logging_module module~mus_turbulence_module->module~tem_logging_module module~mus_graddata_module mus_gradData_module module~mus_turbulence_module->module~mus_graddata_module module~env_module env_module module~mus_turbulence_module->module~env_module module~tem_aux_module tem_aux_module module~mus_turbulence_module->module~tem_aux_module module~mus_scheme_layout_module->module~aot_table_module module~mus_scheme_layout_module->module~aotus_module module~mus_scheme_layout_module->module~tem_tools_module module~mus_scheme_layout_module->module~tem_logging_module module~mus_scheme_layout_module->module~env_module module~mus_scheme_layout_module->module~tem_aux_module module~tem_stencil_module tem_stencil_module module~mus_scheme_layout_module->module~tem_stencil_module module~tem_comm_env_module tem_comm_env_module module~mus_scheme_layout_module->module~tem_comm_env_module mpi mpi module~mus_scheme_layout_module->mpi module~mus_moments_type_module mus_moments_type_module module~mus_scheme_layout_module->module~mus_moments_type_module module~tem_grow_array_module tem_grow_array_module module~mus_scheme_layout_module->module~tem_grow_array_module module~tem_dyn_array_module tem_dyn_array_module module~mus_scheme_layout_module->module~tem_dyn_array_module module~aot_out_module aot_out_module module~mus_scheme_layout_module->module~aot_out_module module~tem_param_module tem_param_module module~mus_scheme_layout_module->module~tem_param_module module~mus_graddata_module->module~tem_construction_module module~mus_graddata_module->module~tem_logging_module module~mus_graddata_module->module~env_module module~mus_graddata_module->module~tem_aux_module module~tem_debug_module tem_debug_module module~mus_graddata_module->module~tem_debug_module module~mus_graddata_module->module~tem_stencil_module module~mus_graddata_module->module~tem_param_module module~mus_moments_type_module->module~env_module module~tem_matrix_module tem_matrix_module module~mus_moments_type_module->module~tem_matrix_module

Used by

  • module~~mus_turbulence_module~~UsedByGraph module~mus_turbulence_module mus_turbulence_module module~mus_relaxationparam_module mus_relaxationParam_module module~mus_relaxationparam_module->module~mus_turbulence_module module~mus_turb_viscosity_module mus_turb_viscosity_module module~mus_turb_viscosity_module->module~mus_turbulence_module module~mus_smagorinsky_module mus_Smagorinsky_module module~mus_turb_viscosity_module->module~mus_smagorinsky_module module~mus_vreman_module mus_Vreman_module module~mus_turb_viscosity_module->module~mus_vreman_module module~mus_wale_module mus_WALE_module module~mus_turb_viscosity_module->module~mus_wale_module module~mus_smagorinsky_module->module~mus_turbulence_module module~mus_vreman_module->module~mus_turbulence_module module~mus_fluid_module mus_fluid_module module~mus_fluid_module->module~mus_turbulence_module module~mus_fluid_module->module~mus_relaxationparam_module module~mus_fluid_module->module~mus_turb_viscosity_module module~mus_turbulence_var_module mus_turbulence_var_module module~mus_turbulence_var_module->module~mus_turbulence_module module~mus_wale_module->module~mus_turbulence_module module~mus_variable_module mus_variable_module module~mus_variable_module->module~mus_turbulence_var_module module~mus_aux_module mus_aux_module module~mus_aux_module->module~mus_relaxationparam_module module~mus_aux_module->module~mus_fluid_module module~mus_interpolate_quadratic_module mus_interpolate_quadratic_module module~mus_interpolate_quadratic_module->module~mus_relaxationparam_module module~mus_interpolate_quadratic_module->module~mus_fluid_module module~mus_interpolate_d3q27_module mus_interpolate_d3q27_module module~mus_interpolate_d3q27_module->module~mus_fluid_module module~mus_interpolate_d2q9_module mus_interpolate_d2q9_module module~mus_interpolate_d2q9_module->module~mus_fluid_module module~mus_interpolate_average_module mus_interpolate_average_module module~mus_interpolate_average_module->module~mus_relaxationparam_module module~mus_interpolate_average_module->module~mus_fluid_module module~mus_field_module mus_field_module module~mus_field_module->module~mus_fluid_module module~mus_interpolate_compact_module mus_interpolate_compact_module module~mus_interpolate_compact_module->module~mus_fluid_module module~mus_interpolate_debug_module mus_interpolate_debug_module module~mus_interpolate_debug_module->module~mus_fluid_module module~mus_dynloadbal_module mus_dynLoadBal_module module~mus_dynloadbal_module->module~mus_fluid_module module~mus_tools_module mus_tools_module module~mus_tools_module->module~mus_relaxationparam_module module~mus_interpolate_d3q19_module mus_interpolate_d3q19_module module~mus_interpolate_d3q19_module->module~mus_fluid_module module~mus_flow_module mus_flow_module module~mus_flow_module->module~mus_fluid_module module~mus_hvs_aux_module mus_hvs_aux_module module~mus_hvs_aux_module->module~mus_fluid_module module~mus_field_prop_module mus_field_prop_module module~mus_field_prop_module->module~mus_fluid_module module~mus_interpolate_linear_module mus_interpolate_linear_module module~mus_interpolate_linear_module->module~mus_relaxationparam_module module~mus_interpolate_linear_module->module~mus_fluid_module

Contents


Abstract Interfaces

abstract interface

interface to calculate subgrid scale turbulent eddy viscosity

  • private subroutine proc_calc_turb_visc_fromGradU(turbVisc, turbConfig, gradData, auxField, velPos, nSolve, nAuxScalars, dxL, dtL)

    This function computes turbulent viscosity from gradient U

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=rk), intent(out) :: turbVisc(:)

    output: 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

abstract interface

interface to calculate subgrid scale turbulent eddy viscosity

  • private subroutine proc_calc_turb_visc_fromPreColPDF(turbVisc, turbConfig, state, neigh, auxField, densPos, velPos, nSize, nSolve, nScalars, nAuxScalars, layout, dxL, dtL, viscKine)

    This function compute turbulent viscosity from pre-collision PDF

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=rk), intent(out) :: turbVisc(:)

    output: 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


Derived Types

Contains turbulence information loaded from config file

Components

TypeVisibilityAttributesNameInitial
character(len=labelLen), private :: model

turbulence model type

type(les_coeff_type), private :: coeff

les model coefficients

logical, private :: 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, private :: useKolmogorovScale =.true.

Use Kolmogorov scale for interpolation turbulent viscosity for multilevel

type, public :: mus_turbulence_data_type

Contains velocity and gradient data to compute eddy viscosity

Components

TypeVisibilityAttributesNameInitial
type(tem_communication_type), private :: sendBuffer

Communication buffers to communicate visoscity field Local Fluids required by remote processes

type(tem_communication_type), private :: recvBuffer

My halos which are fluids on remote processes

type(tem_communication_type), private :: sendBufferFromCoarser

Local ghostFromCoarser required by remote processes

type(tem_communication_type), private :: sendBufferFromFiner

Local ghostFromFiner required by remote processes

type(tem_communication_type), private :: recvBufferFromCoarser

My halos which are ghostFromCoarser on remote processes

type(tem_communication_type), private :: recvBufferFromFiner

My halos which are ghostFromFiner on remote processes

real(kind=rk), private, 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.

Read more…

type, public :: mus_turbulence_type

Contains information required to compute eddy viscosity

Components

TypeVisibilityAttributesNameInitial
logical, private :: active

is true if turbulence table is defined

type(mus_turbulence_config_type), private :: config

information loaded from config file

type(mus_turbulence_data_type), private, allocatable:: dataOnLvl(:)

contains level-wise turbulence data to compute eddy viscosity size: minlevel:maxLevel

type(mus_turbulence_visc_proc_type), private :: calcVisc

contains turbulence viscosity function pointers

real(kind=rk), private :: 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), private :: 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

type, private :: les_coeff_type

Contains large Eddy Turbulence (LES) model coefficients

Components

TypeVisibilityAttributesNameInitial
real(kind=rk), private :: C_s

Smagorinsky constant. C_s = sqrt(C_k sqrt(C_k/C_e) ) = 0.16778594 = 0.17

real(kind=rk), private :: C_w

Model constant for WALE (Wall-Adapting Local Eddy-Viscosity) default: 0.5

real(kind=rk), private :: C_v

Model constant for Vreman model In literature: C_v = sqrt(2.5) C_s = 0.27

real(kind=rk), private :: C_e

Modal constant for turbulent kinetic energy dissipation rate default: 1.048

real(kind=rk), private :: 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

Components

TypeVisibilityAttributesNameInitial
procedure(proc_calc_turb_visc_fromGradU), private, 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), private, 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.


Subroutines

public subroutine mus_load_turbulence(me, conf, parent)

load turbulence table

Arguments

TypeIntentOptionalAttributesName
type(mus_turbulence_type), intent(out) :: me

fluid type

type(flu_state) :: conf

lua state

integer, intent(in), optional :: parent

parent handle

public subroutine mus_init_turbulenceData(me, turbConfig, levelDesc, pattern, nSize)

This initialize turbulence data type which includes velocity array and communication buffer

Arguments

TypeIntentOptionalAttributesName
type(mus_turbulence_data_type), intent(out) :: me

turbulence data

type(mus_turbulence_config_type), intent(in) :: turbConfig

tubulence configuration

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

public subroutine mus_turb_calcVisc(turbData, turbConfig, calcTurbVisc, state, neigh, auxField, gradData, densPos, velPos, nSize, nSolve, nScalars, nAuxScalars, layout, dxL, dtL, viscKine)

This routine compute turbulence viscosity and stores in turbulence data type

Arguments

TypeIntentOptionalAttributesName
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