# mus_mrt_d3q19_module Module

This module provides the definition and methods for MRT advection relaxation scheme. The LB equaton using MRT is f(t+dt,x+dx) = f - M^(-1) * S * ( (M*f) - m^(eq) )

The moments m(1:19) = M * f(1:19) are labeled as m( 1) = rho m( 2) = e = rho * (ux^2 + uy^2 + uz^2) m( 3) = epsilon m( 4) = jx = rho * ux m( 5) = qx m( 6) = jy = rho * uy m( 7) = qy m( 8) = jz = rho * uz m( 9) = qz m(10) = 3 * pxx = rho * (2ux^2 - uy^2 - uz^2) m(11) = 3 * Pixx m(12) = pzz = rho * (uy^2 - uz^2) m(13) = Piww m(14) = pxy = rho * ux * uy m(15) = pyz = rho * uy * uz m(16) = pzx = rho * uz * ux m(17) = mx m(18) = my m(19) = mz

The non-zero equilibirium moments are given by meq( 1) = rho meq( 2) = rho0 * ( ux^2 + uy^2 + uz^2 ) meq( 4) = rho0 * ux meq( 6) = rho0 * uy meq( 8) = rho0 * uz meq(10) = rho0 * ( 2*ux^2 - uy^2 - uz^2 ) meq(12) = rho0 * ( uy^2 - uz^2 ) meq(14) = rho0 * ux * uy meq(15) = rho0 * uy * uz meq(16) = rho0 * ux * uz

Density (rho) and velocity (ux, uy, uz) are conserved during collision. i.e. m(1) = meq(1) --> mneq(1) = 0 m(4) = meq(4) --> mneq(4) = 0 m(6) = meq(6) --> mneq(6) = 0 m(8) = meq(8) --> mneq(8) = 0

The collision parameters S correspondes to the omega in BGK model.

The MRT implementation here is taken from:\n J. Toelke, S. Freudiger, and M. Krafczyk, "An adaptive scheme using hierarchical grids for lattice Boltzmann multi-phase flow simulations," Comput. Fluids, vol. 35, pp. 820–830, 2006. \n Notice that the collision matrix S used in this papar corresponds to -omega in BGK model, because it express the LB equation is slightly different way. In this paper, the following notions are used:\n s(a) = s(2) s(b) = s(3) s(c) = s(5) = s(7) = s(9) s(d) = s(11) = s(13 s(e) = s(17) = s(18) = s(19) s(w) = s(10) = s(12) = s(14) = s(15) = s(16) It is suggested that, for D3Q19, s(a) = s(b) = s(c) = s(d) = s(e) = max( s(w), -1.0 )

SubGrid Stress model (SGS) The implementation here is taken from:\n M. Stiebler, M. Krafczyk, S. Freudiger, M. Geier "Lattice Boltzmann large eddy simulation of subcritical flows around a sphere on non-uniform grids", Computers and Mathematics with Applications, vol. 61 (2011), pp. 3475-3484 Equation 12:\n tau_{total} = 3 * nu0 + dt * 0.5 + 0.5 * ( sqrt( tau0*tau0 + 18 * Cs * Cs * dt * dt * Q ) - tau0 ) = 0.5 * ( tau0 + sqrt( tau0 * tau0 + 18 * Cs * Cs * dt * dt * Q) ) Q = sqrt( 2.0 * sum( Pi^{neq} * Pi^{neq} ) )

For single field LBM: QQ=nScalars

## Variables

TypeVisibilityAttributesNameInitial
integer, private, parameter:: QQ =19

Definition of the discrete velocity set

integer, private, parameter:: qN00 =1
integer, private, parameter:: q0N0 =2
integer, private, parameter:: q00N =3
integer, private, parameter:: q100 =4
integer, private, parameter:: q010 =5
integer, private, parameter:: q001 =6
integer, private, parameter:: q0NN =7
integer, private, parameter:: q0N1 =8
integer, private, parameter:: q01N =9
integer, private, parameter:: q011 =10
integer, private, parameter:: qN0N =11
integer, private, parameter:: q10N =12
integer, private, parameter:: qN01 =13
integer, private, parameter:: q101 =14
integer, private, parameter:: qNN0 =15
integer, private, parameter:: qN10 =16
integer, private, parameter:: q1N0 =17
integer, private, parameter:: q110 =18
integer, private, parameter:: q000 =19

## Subroutines

### public subroutine mrt_advRel_d3q19(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

Advection relaxation routine for the MRT model. This routine has roughly 260 FLOPS per elements.

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields

### public subroutine mrt_advRel_d3q19_incomp(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

Advection relaxation routine for the MRT model. This routine has roughly 205 FLOPS per element.

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields

### public subroutine mrt_advRel_d3q19_incomp_generic(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

No comment yet!

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields

### public subroutine mrt_advRel_d3q19_generic(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

No comment yet!

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields

### public subroutine mrt_advRel_generic(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

Unoptimized explicit implementation

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields

### public subroutine mrt_advRel_incomp_generic(fieldProp, inState, outState, auxField, neigh, nElems, nSolve, level, layout, params, varSys, derVarPos)

Unoptimized explicit implementation

Read more…

#### Arguments

TypeIntentOptionalAttributesName
type(mus_field_prop_type), intent(in) :: fieldProp(:)

Array of field properties (fluid or species)

real(kind=rk), intent(in) :: inState(nElems*varSys%nScalars)

input pdf vector

real(kind=rk), intent(out) :: outState(nElems*varSys%nScalars)

output pdf vector

real(kind=rk), intent(inout) :: auxField(nElems*varSys%nAuxScalars)

Auxiliary field computed from pre-collision state Is updated with correct velocity field for multicomponent models

integer, intent(in) :: neigh(nElems*layout%fStencil%QQ)

connectivity vector

integer, intent(in) :: nElems

number of elements in state Array

integer, intent(in) :: nSolve

number of elements solved in kernel

integer, intent(in) :: level

current level

type(mus_scheme_layout_type), intent(in) :: layout

current layout

type(mus_param_type), intent(in) :: params

global parameters

type(tem_varSys_type), intent(in) :: varSys

variable system definition

type(mus_derVarPos_type), intent(in) :: derVarPos(:)

position of derived quantities in varsys for all fields