Second-order centred finite-volume slope of a layer scalar (MOM6
fv_diff; Colella & Woodward 1984). Returns the cell-centred difference
across layer k given the three layer thicknesses and values.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | hkm1 |
layer thicknesses (above/centre/below) |
||
| real(kind=wp), | intent(in) | :: | hk |
layer thicknesses (above/centre/below) |
||
| real(kind=wp), | intent(in) | :: | hkp1 |
layer thicknesses (above/centre/below) |
||
| real(kind=wp), | intent(in) | :: | skm1 |
layer scalar values |
||
| real(kind=wp), | intent(in) | :: | sk |
layer scalar values |
||
| real(kind=wp), | intent(in) | :: | skp1 |
layer scalar values |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | h_sum | ||||
| real(kind=wp), | private | :: | hm | ||||
| real(kind=wp), | private | :: | hp |
pure function redi_fv_diff(hkm1, hk, hkp1, skm1, sk, skp1) result(d) !$acc routine seq real(wp), intent(in) :: hkm1, hk, hkp1 !! layer thicknesses (above/centre/below) real(wp), intent(in) :: skm1, sk, skp1 !! layer scalar values real(wp) :: d real(wp) :: h_sum, hp, hm h_sum = (hkm1 + hkp1) + hk if (h_sum /= 0.0_wp) h_sum = 1.0_wp/h_sum hm = hkm1 + hk if (hm /= 0.0_wp) hm = 1.0_wp/hm hp = hkp1 + hk if (hp /= 0.0_wp) hp = 1.0_wp/hp d = (hk*h_sum)*((2.0_wp*hkm1 + hk)*hp*(skp1 - sk) & + (2.0_wp*hkp1 + hk)*hm*(sk - skm1)) end function redi_fv_diff