MOM6 near-bottom hWght mass-weighting fractions of one face
(MASS_WEIGHT_IN_PRESSURE_GRADIENT): the distance by which the
layer top of one column sits below the other column’s bed, scaled
by the squared relative thickness contrast. Zero ⇒ plain linear
interpolation (hwt_ll = hwt_rr = 1, hwt_lr = hwt_rl = 0).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in) | :: | mass_weight |
Mass weighting on? |
||
| real(kind=wp), | intent(in) | :: | e_bed_l |
Bed heights of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | e_bed_r |
Bed heights of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | e_top_l |
Layer top heights of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | e_top_r |
Layer top heights of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | h_l |
Layer thicknesses of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | h_r |
Layer thicknesses of the left / right column (m). |
||
| real(kind=wp), | intent(in) | :: | h_neglect |
Negligible thickness (m). |
||
| real(kind=wp), | intent(out) | :: | hwt_ll |
MOM6 |
||
| real(kind=wp), | intent(out) | :: | hwt_lr |
MOM6 |
||
| real(kind=wp), | intent(out) | :: | hwt_rr |
MOM6 |
||
| real(kind=wp), | intent(out) | :: | hwt_rl |
MOM6 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | hwght | ||||
| real(kind=wp), | private | :: | hwl | ||||
| real(kind=wp), | private | :: | hwr | ||||
| real(kind=wp), | private | :: | idenom_hw | ||||
| logical, | private | :: | use_hw |
pure subroutine fv_mom6_mass_weights(mass_weight, e_bed_l, e_bed_r, e_top_l, e_top_r, & h_l, h_r, h_neglect, & hwt_ll, hwt_lr, hwt_rr, hwt_rl) !$acc routine seq !! MOM6 near-bottom `hWght` mass-weighting fractions of one face !! (`MASS_WEIGHT_IN_PRESSURE_GRADIENT`): the distance by which the !! layer top of one column sits below the other column's bed, scaled !! by the squared relative thickness contrast. Zero ⇒ plain linear !! interpolation (`hwt_ll = hwt_rr = 1`, `hwt_lr = hwt_rl = 0`). logical, intent(in) :: mass_weight !! Mass weighting on? real(wp), intent(in) :: e_bed_l, e_bed_r !! Bed heights of the left / right column (m). real(wp), intent(in) :: e_top_l, e_top_r !! Layer top heights of the left / right column (m). real(wp), intent(in) :: h_l, h_r !! Layer thicknesses of the left / right column (m). real(wp), intent(in) :: h_neglect !! Negligible thickness (m). real(wp), intent(out) :: hwt_ll, hwt_lr, hwt_rr, hwt_rl !! MOM6 `hWt_LL/LR/RR/RL`. real(wp) :: hwght, hwl, hwr, idenom_hw logical :: use_hw ! Branch-free: the weighted fractions are formed unconditionally and ! SELECTED where `hwght > 0` (else plain linear interpolation) -- the ! same numbers as the branched form, and a CPU compiler can vectorise ! the face loops that call this. `h_neglect > 0` keeps the unselected ! arithmetic finite. hwght = 0.0_wp if (mass_weight) hwght = max(0.0_wp, e_bed_r - e_top_l, e_bed_l - e_top_r) use_hw = hwght > 0.0_wp hwl = h_l + h_neglect hwr = h_r + h_neglect hwght = hwght*((hwl - hwr)/(hwl + hwr))**2 idenom_hw = 1.0_wp/(hwght*(hwr + hwl) + hwl*hwr) hwt_ll = merge((hwght*hwl + hwr*hwl)*idenom_hw, 1.0_wp, use_hw) hwt_lr = merge((hwght*hwr)*idenom_hw, 0.0_wp, use_hw) hwt_rr = merge((hwght*hwr + hwr*hwl)*idenom_hw, 1.0_wp, use_hw) hwt_rl = merge((hwght*hwl)*idenom_hw, 0.0_wp, use_hw) end subroutine fv_mom6_mass_weights