Return the highest feasible reconstruction rung for one face.
Internal rung scale (higher = more accurate): 4 = WENO9 (needs avail_up >= 5, avail_down >= 4) 3 = WENO7 (needs avail_up >= 4, avail_down >= 3) 2 = WENO5 (needs avail_up >= 3, avail_down >= 2) 1 = PLM (needs avail_up >= 2, avail_down >= 1) 0 = donor (needs avail_up >= 1) -1 = no data (should never happen at interior cells)
rung_max is the PUBLIC TRACER_RECON_* code plus one:
WENO5(1) → rung_max_internal = 2
WENO7(2) → rung_max_internal = 3
WENO9(3) → rung_max_internal = 4
The kernel maps the public code to rung_max with recon + 1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | avail_up |
Interior cells from domain-west to face (including upwind cell c). |
||
| integer, | intent(in) | :: | avail_down |
Interior cells from face downwind side to domain-east. |
||
| integer, | intent(in) | :: | rung_max |
Maximum internal rung allowed (4 = WENO9, 3 = WENO7, 2 = WENO5). |
pure function recon_rung_for_face(avail_up, avail_down, rung_max) result(rung) !! Return the highest feasible reconstruction rung for one face. !! !! Internal rung scale (higher = more accurate): !! 4 = WENO9 (needs avail_up >= 5, avail_down >= 4) !! 3 = WENO7 (needs avail_up >= 4, avail_down >= 3) !! 2 = WENO5 (needs avail_up >= 3, avail_down >= 2) !! 1 = PLM (needs avail_up >= 2, avail_down >= 1) !! 0 = donor (needs avail_up >= 1) !! -1 = no data (should never happen at interior cells) !! !! rung_max is the PUBLIC TRACER_RECON_* code plus one: !! WENO5(1) → rung_max_internal = 2 !! WENO7(2) → rung_max_internal = 3 !! WENO9(3) → rung_max_internal = 4 !! The kernel maps the public code to rung_max with `recon + 1`. !$acc routine seq integer, intent(in) :: avail_up !! Interior cells from domain-west to face (including upwind cell c). integer, intent(in) :: avail_down !! Interior cells from face downwind side to domain-east. integer, intent(in) :: rung_max !! Maximum internal rung allowed (4 = WENO9, 3 = WENO7, 2 = WENO5). integer :: rung if (rung_max >= 4 .and. avail_up >= 5 .and. avail_down >= 4) then rung = 4 else if (rung_max >= 3 .and. avail_up >= 4 .and. avail_down >= 3) then rung = 3 else if (rung_max >= 2 .and. avail_up >= 3 .and. avail_down >= 2) then rung = 2 else if (avail_up >= 2 .and. avail_down >= 1) then rung = 1 else if (avail_up >= 1) then rung = 0 else rung = -1 end if end function recon_rung_for_face