Compute alpha coefficients.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(alpha_coefficients_m), | intent(inout) | :: | self | Alpha coefficients. |
||
integer(kind=I_P), | intent(in) | :: | S | Number of stencils used. |
||
real(kind=R_P), | intent(in) | :: | weight_opt(1:2,0:S-1) | Optimal weight of the stencil. |
||
real(kind=R_P), | intent(in) | :: | IS(1:2,0:S-1) | Smoothness indicators of the stencils. |
||
real(kind=R_P), | intent(in) | :: | eps | Parameter for avoiding divided by zero. |
||
integer(kind=I_P), | intent(in) | :: | f1 | Faces to be computed. |
||
integer(kind=I_P), | intent(in) | :: | f2 | Faces to be computed. |
pure subroutine compute(self, S, weight_opt, IS, eps, f1, f2)
!< Compute alpha coefficients.
class(alpha_coefficients_m), intent(inout) :: self !< Alpha coefficients.
integer(I_P), intent(in) :: S !< Number of stencils used.
real(R_P), intent(in) :: weight_opt(1: 2, 0: S - 1) !< Optimal weight of the stencil.
real(R_P), intent(in) :: IS(1: 2, 0: S - 1) !< Smoothness indicators of the stencils.
real(R_P), intent(in) :: eps !< Parameter for avoiding divided by zero.
integer(I_P), intent(in) :: f1, f2 !< Faces to be computed.
integer(I_P) :: f, s1 !< Counters.
self%alpha_tot = 0._R_P
call self%alpha_base%compute(S=S, weight_opt=weight_opt, IS=IS, eps=eps, f1=f1, f2=f2)
do s1=0, S - 1 ! stencil loops
do f=f1, f2 ! 1 => left interface (i-1/2), 2 => right interface (i+1/2)
self%alpha_coef(f, s1) = &
(self%alpha_base%alpha_coef(f, s1) * (weight_opt(f, s1) + weight_opt(f, s1) * weight_opt(f, s1) - &
3._R_P * weight_opt(f, s1) * self%alpha_base%alpha_coef(f, s1) + self%alpha_base%alpha_coef(f, s1) * &
self%alpha_base%alpha_coef(f, s1))) / &
(weight_opt(f, s1) * weight_opt(f, s1) + self%alpha_base%alpha_coef(f, s1) * &
(1._R_P - 2._R_P * weight_opt(f, s1)))
self%alpha_tot(f) = self%alpha_tot(f) + self%alpha_coef(f, s1)
enddo
enddo
endsubroutine compute