MUSCL reconstruction in primitive variables for two faces using a 5-point stencil. Returns uL(:,iface), uR(:,iface) for iface=1 (between cells 2-3) and iface=2 (between 3-4).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | u(nw_phys,5) | |||
| integer, | intent(in) | :: | typelim | |||
| real(kind=dp), | intent(out) | :: | uL(nw_phys,2) | |||
| real(kind=dp), | intent(out) | :: | uR(nw_phys,2) |
pure subroutine muscl_reconstruct_prim(u, typelim, uL, uR) use mod_limiter, only: limiter_minmod, limiter_vanleer, limiter_mcbeta, limiter_koren real(dp), intent(in) :: u(nw_phys,5) integer, intent(in) :: typelim real(dp), intent(out) :: uL(nw_phys,2), uR(nw_phys,2) real(dp) :: sig(nw_phys,3) ! slopes at cells 2,3,4 integer :: iw select case (typelim) case (limiter_minmod) do iw=1,nw_phys sig(iw,1) = minmod (u(iw,2)-u(iw,1), u(iw,3)-u(iw,2)) ! cell 2 sig(iw,2) = minmod (u(iw,3)-u(iw,2), u(iw,4)-u(iw,3)) ! cell 3 sig(iw,3) = minmod (u(iw,4)-u(iw,3), u(iw,5)-u(iw,4)) ! cell 4 end do case (limiter_vanleer) do iw=1,nw_phys sig(iw,1) = vanleer(u(iw,2)-u(iw,1), u(iw,3)-u(iw,2)) sig(iw,2) = vanleer(u(iw,3)-u(iw,2), u(iw,4)-u(iw,3)) sig(iw,3) = vanleer(u(iw,4)-u(iw,3), u(iw,5)-u(iw,4)) end do case (limiter_mcbeta) do iw=1,nw_phys sig(iw,1) = mcbeta(u(iw,2)-u(iw,1), u(iw,3)-u(iw,2)) sig(iw,2) = mcbeta(u(iw,3)-u(iw,2), u(iw,4)-u(iw,3)) sig(iw,3) = mcbeta(u(iw,4)-u(iw,3), u(iw,5)-u(iw,4)) end do case (limiter_koren) do iw=1,nw_phys sig(iw,1) = koren(u(iw,2)-u(iw,1), u(iw,3)-u(iw,2)) sig(iw,2) = koren(u(iw,3)-u(iw,2), u(iw,4)-u(iw,3)) sig(iw,3) = koren(u(iw,4)-u(iw,3), u(iw,5)-u(iw,4)) end do case default ! Fallback: Godunov (piecewise constant) do iw=1,nw_phys sig(iw,1)=0._dp sig(iw,2)=0._dp sig(iw,3)=0._dp end do end select ! Face 1: between cells 2 and 3 uL(:,1) = u(:,2) + 0.5_dp*sig(:,1) uR(:,1) = u(:,3) - 0.5_dp*sig(:,2) ! Face 2: between cells 3 and 4 uL(:,2) = u(:,3) + 0.5_dp*sig(:,2) uR(:,2) = u(:,4) - 0.5_dp*sig(:,3) ! The slopes above were limited slot by slot, so a state can come out ! inadmissible or -- where the physics carries auxiliary variables -- ! internally inconsistent. Repair it here, once, rather than in each of the ! three Riemann solvers: this is the single producer of face states. call fix_prim_state(uL(:,1)) call fix_prim_state(uR(:,1)) call fix_prim_state(uL(:,2)) call fix_prim_state(uR(:,2)) end subroutine muscl_reconstruct_prim