Add residual due to source terms of the SST-BC transition model
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(-2:dims%imx+2, -2:dims%jmx+2, -2:dims%kmx+2, 1:dims%n_var) | :: | qp | Store primitive variable at cell center |
|
real(kind=wp), | intent(inout), | dimension(:, :, :, :) | :: | residue | Store residue at each cell-center |
|
type(celltype), | intent(in), | dimension(-2:dims%imx+2,-2:dims%jmx+2,-2:dims%kmx+2) | :: | cells | Input cell quantities: volume |
|
type(flowtype), | intent(in) | :: | flow | Information about fluid flow: freestream-speed, ref-viscosity,etc. |
||
type(extent), | intent(in) | :: | dims | Extent of the domain:imx,jmx,kmx |
subroutine add_sst_bc_source(qp, residue, cells, flow, dims)
!< Add residual due to source terms of the SST-BC transition model
implicit none
type(extent), intent(in) :: dims
!< Extent of the domain:imx,jmx,kmx
type(flowtype), intent(in) :: flow
!< Information about fluid flow: freestream-speed, ref-viscosity,etc.
real(wp), dimension(-2:dims%imx+2, -2:dims%jmx+2, -2:dims%kmx+2, 1:dims%n_var), intent(in) :: qp
!< Store primitive variable at cell center
real(wp), dimension(:, :, :, :), intent(inout) :: residue
!< Store residue at each cell-center
type(celltype), dimension(-2:dims%imx+2,-2:dims%jmx+2,-2:dims%kmx+2), intent(in) :: cells
!< Input cell quantities: volume
integer :: i,j,k
real(wp) :: CD
!< cross-diffusion term
real(wp) :: F1
!< single cell blending function
real(wp) :: vort
!< vorticity magnitude
real(wp) :: S_k
!< Total source term in TKE equation
real(wp) :: S_w
!< Total source term in Omega equation
real(wp) :: D_k
!< Destruction term in TKE equation
real(wp) :: D_w
!< Destruction term in Omega equation
real(wp) :: P_k
!< Production term in TKE equation
real(wp) :: P_w
!< production term in Omega equation
real(wp) :: lamda
!< addtion source term in Omega equation
real(wp) :: TuL
!< local turbulence intensity
!--------BC model -----
real(wp) :: chi_1=0.002
real(wp) :: chi_2=5.0
real(wp) :: nu_BC
real(wp) :: nu_cr
real(wp) :: nu_t
real(wp) :: re_v
real(wp) :: re_theta
real(wp) :: re_theta_t
real(wp) :: term1
real(wp) :: term2
real(wp) :: term_exponential
real(wp) :: gamma_BC
!< intermittency function
real(wp) :: vmag
!< velocity magnitude
real(wp) :: density
!< single cell Density
real(wp) :: tk
!< single cell TKE
real(wp) :: tw
!< single cell omega
do k = 1,dims%kmx-1
do j = 1,dims%jmx-1
do i = 1,dims%imx-1
density = qp(i,j,k,1)
tk = qp(i,j,k,6)
tw = qp(i,j,k,7)
! __ vorticity __
vort = sqrt( ((gradw_y(i,j,k)- gradv_z(i,j,k))**2 &
+ (gradu_z(i,j,k)- gradw_x(i,j,k))**2 &
+ (gradv_x(i,j,k)- gradu_y(i,j,k))**2 &
)&
)
CD = 2*density*sigma_w2*(gradtk_x(i,j,k)*gradtw_x(i,j,k)&
+ gradtk_y(i,j,k)*gradtw_y(i,j,k)&
+ gradtk_z(i,j,k)*gradtw_z(i,j,k)&
)/tw
!CD = max(CD, 1e-20)
F1 = sst_F1(i,j,k)
sigma_k = sigma_k1*F1 + sigma_k2*(1. - F1)
sigma_w = sigma_w1*F1 + sigma_w1*(1. - F1)
gama = gama1*F1 + gama2*(1. - F1)
beta = beta1*F1 + beta2*(1. - F1)
! ____ Dissipation term ___
D_k = bstar*density*tw*tk
D_w = beta*density*tw**2
! ____ PRODUCTION term____
P_k = mu_t(i,j,k)*(vort**2)
P_k = min(P_k,20.0*D_k)
P_w = (density*gama/mu_t(i,j,k))*P_k
! ____ cross diffusion term ___
lamda = (1. - F1)*CD
! ____Transition modeling ____
!------ BC model ---
vmag = sqrt(SUM(qp(i,j,k,2:4)**2))
chi_1 = 0.002
chi_2 = 5.0
nu_t = mu_t(i,j,k)/density
nu_cr = chi_2/flow%Reynolds_number
nu_bc = nu_t/(vmag*dist(i,j,k))
TuL = flow%tu_inf !local turbulence intensity might not work for BC model
re_v = density*dist(i,j,k)*dist(i,j,k)*vort/mu(i,j,k)
re_theta = re_v/2.193
re_theta_t = (803.73*((TuL + 0.6067)**(-1.027)))
term1 = sqrt(max(re_theta-re_theta_t,0.)/(chi_1*re_theta_t))
term2 = sqrt(max(nu_BC-nu_cr,0.0)/nu_cr)
term_exponential = (term1 + term2)
gamma_BC = 1.0 - exp(-term_exponential)
P_k = gamma_BC*P_k
S_k = P_k - D_k !Source term TKE
S_w = P_w - D_w +lamda !source term omega
S_k = S_k * cells(i, j, k)%volume
S_w = S_w * cells(i, j, k)%volume
residue(i, j, k, 6) = residue(i, j, k, 6) - S_k
residue(i, j, k, 7) = residue(i, j, k, 7) - S_w
end do
end do
end do
end subroutine add_sst_bc_source