Cumulative open area of a face from the deepest along-face point
up to interface height eta, per unit face length (m — it is
the vertical integral of porous_open_width). Layer-averaged
open fractions are differences of this function divided by the
layer thickness, which is exact (no quadrature error) because
d(area)/d(eta) = porous_open_width(eta) identically.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | d_min |
Deepest along-face topographic height (m, positive up). |
||
| real(kind=wp), | intent(in) | :: | d_max |
Shallowest along-face topographic height (m, positive up). |
||
| real(kind=wp), | intent(in) | :: | d_avg |
Mean along-face topographic height (m, positive up). |
||
| real(kind=wp), | intent(in) | :: | eta |
Interface height at the face (m, positive up). |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | drange | ||||
| real(kind=wp), | private | :: | m | ||||
| real(kind=wp), | private | :: | zeta |
pure function porous_cum_area(d_min, d_max, d_avg, eta) result(area) !! Cumulative open area of a face from the deepest along-face point !! up to interface height `eta`, per unit face length (m — it is !! the vertical integral of `porous_open_width`). Layer-averaged !! open fractions are differences of this function divided by the !! layer thickness, which is exact (no quadrature error) because !! `d(area)/d(eta) = porous_open_width(eta)` identically. real(wp), intent(in) :: d_min !! Deepest along-face topographic height (m, positive up). real(wp), intent(in) :: d_max !! Shallowest along-face topographic height (m, positive up). real(wp), intent(in) :: d_avg !! Mean along-face topographic height (m, positive up). real(wp), intent(in) :: eta !! Interface height at the face (m, positive up). real(wp) :: area real(wp) :: m, zeta, drange if (eta <= d_min) then area = 0.0_wp else if (eta > d_max) then ! Above the sill the face is fully open, so the integral grows ! linearly; the offset `d_avg` is what makes the mean height of ! the fit equal the prescribed `d_avg`. area = eta - d_avg else if (d_avg <= d_min) then ! Degenerate m = 0 (step at d_min): fully open above it, so the ! integral is the same linear form the above-d_max branch uses. area = eta - d_avg else if (d_avg >= d_max) then ! Degenerate m = 1 (step at d_max): nothing open below it. area = 0.0_wp else drange = d_max - d_min m = (d_avg - d_min)/drange zeta = (eta - d_min)/drange if (m < 0.5_wp) then area = drange*((1.0_wp - m)*zeta**(1.0_wp/(1.0_wp - m))) else if (m > 0.5_wp) then area = drange*(zeta - m + m*((1.0_wp - zeta)**(1.0_wp/m))) else area = drange*(0.5_wp*zeta*zeta) end if end if end function porous_cum_area