[11395] | 1 | MODULE isftbl |
---|
[11403] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE isftbl *** |
---|
| 4 | !! isftbl module : compute properties of top boundary layer |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 4.1 ! 2019-09 (P. Mathiot) original code |
---|
| 7 | !!---------------------------------------------------------------------- |
---|
[11395] | 8 | |
---|
[11403] | 9 | !!---------------------------------------------------------------------- |
---|
| 10 | !! isftbl : routine to compute : |
---|
| 11 | !! - geometry of the ice shelf tbl (isf_tbl_lvl, isftbl_ktop, isftbl_kbot) |
---|
| 12 | !! (top and bottom level, thickness and fraction of deepest level affected) |
---|
| 13 | !! - tbl averaged properties (isf_tbl, isf_tbl_avg) |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[11395] | 15 | |
---|
[12077] | 16 | USE isf_oce ! ice shelf variables |
---|
[11852] | 17 | |
---|
[11876] | 18 | USE dom_oce ! vertical scale factor and depth |
---|
[11395] | 19 | |
---|
[11403] | 20 | IMPLICIT NONE |
---|
[11395] | 21 | |
---|
[11403] | 22 | PRIVATE |
---|
[11395] | 23 | |
---|
[11541] | 24 | PUBLIC isf_tbl, isf_tbl_avg, isf_tbl_lvl, isf_tbl_ktop, isf_tbl_kbot |
---|
[11403] | 25 | |
---|
[11395] | 26 | CONTAINS |
---|
| 27 | |
---|
[12068] | 28 | SUBROUTINE isf_tbl( Kmm, pvarin, pvarout, cd_ptin, ktop, phtbl, kbot, pfrac ) |
---|
[11403] | 29 | !!-------------------------------------------------------------------- |
---|
| 30 | !! *** SUBROUTINE isf_tbl *** |
---|
[11395] | 31 | !! |
---|
| 32 | !! ** Purpose : compute mean T/S/U/V in the boundary layer at T- point |
---|
| 33 | !! |
---|
[11541] | 34 | !! ** Method : Average properties over a specific thickness |
---|
| 35 | !! |
---|
| 36 | !! ** Reference : inspired from : Losch, Modeling ice shelf cavities in a z coordinate ocean general circulation model |
---|
| 37 | !! https://doi.org/10.1029/2007JC004368 , 2008 |
---|
| 38 | !! |
---|
[11395] | 39 | !!-------------------------- OUT ------------------------------------- |
---|
[11403] | 40 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pvarout ! 2d average of pvarin |
---|
[11395] | 41 | !!-------------------------- IN ------------------------------------- |
---|
[12068] | 42 | INTEGER , INTENT(in ) :: Kmm ! ocean time level index |
---|
[11403] | 43 | CHARACTER(len=1) , INTENT(in ) :: cd_ptin ! point of variable in/out |
---|
| 44 | REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: pvarin ! 3d variable to average over the tbl |
---|
[11495] | 45 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level |
---|
| 46 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl ! tbl thickness |
---|
[11403] | 47 | !!-------------------------- IN OPTIONAL ----------------------------- |
---|
[11495] | 48 | INTEGER, DIMENSION(jpi,jpj), OPTIONAL, INTENT(in ) :: kbot ! bottom level |
---|
| 49 | REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in ) :: pfrac ! fraction of bottom cell affected by tbl |
---|
[11395] | 50 | !!-------------------------------------------------------------------- |
---|
[11844] | 51 | INTEGER :: ji, jj ! loop index |
---|
| 52 | INTEGER , DIMENSION(jpi,jpj) :: ikbot ! bottom level of the tbl |
---|
| 53 | REAL(wp), DIMENSION(jpi,jpj) :: zvarout ! 2d average of pvarin |
---|
| 54 | REAL(wp), DIMENSION(jpi,jpj) :: zhtbl ! thickness of the tbl |
---|
| 55 | REAL(wp), DIMENSION(jpi,jpj) :: zfrac ! thickness of the tbl |
---|
[11403] | 56 | !!-------------------------------------------------------------------- |
---|
[11395] | 57 | ! |
---|
| 58 | SELECT CASE ( cd_ptin ) |
---|
| 59 | CASE ( 'U' ) |
---|
| 60 | ! |
---|
[11495] | 61 | ! copy phtbl (phtbl is INTENT in as we don't want to change it) |
---|
| 62 | zhtbl = phtbl |
---|
[11395] | 63 | ! |
---|
[11495] | 64 | ! compute tbl lvl and thickness |
---|
[12068] | 65 | CALL isf_tbl_lvl( hu(:,:,Kmm), e3u(:,:,:,Kmm), ktop, ikbot, zhtbl, zfrac ) |
---|
[11495] | 66 | ! |
---|
[11395] | 67 | ! compute tbl property at U point |
---|
[12068] | 68 | CALL isf_tbl_avg( miku, ikbot, zhtbl, zfrac, e3u(:,:,:,Kmm), pvarin, zvarout ) |
---|
[11395] | 69 | ! |
---|
| 70 | ! compute tbl property at T point |
---|
[11844] | 71 | pvarout(1,:) = 0._wp |
---|
[11395] | 72 | DO jj = 1, jpj |
---|
| 73 | DO ji = 2, jpi |
---|
[11844] | 74 | pvarout(ji,jj) = 0.5_wp * (zvarout(ji,jj) + zvarout(ji-1,jj)) |
---|
[11395] | 75 | END DO |
---|
| 76 | END DO |
---|
[11844] | 77 | ! lbclnk not needed as a final communication is done after the computation of fwf |
---|
[11395] | 78 | ! |
---|
| 79 | CASE ( 'V' ) |
---|
| 80 | ! |
---|
[11495] | 81 | ! copy phtbl (phtbl is INTENT in as we don't want to change it) |
---|
| 82 | zhtbl = phtbl |
---|
[11395] | 83 | ! |
---|
[11495] | 84 | ! compute tbl lvl and thickness |
---|
[12068] | 85 | CALL isf_tbl_lvl( hv(:,:,Kmm), e3v(:,:,:,Kmm), ktop, ikbot, zhtbl, zfrac ) |
---|
[11495] | 86 | ! |
---|
[11395] | 87 | ! compute tbl property at V point |
---|
[12068] | 88 | CALL isf_tbl_avg( mikv, ikbot, zhtbl, zfrac, e3v(:,:,:,Kmm), pvarin, zvarout ) |
---|
[11395] | 89 | ! |
---|
| 90 | ! pvarout is an averaging of wet point |
---|
[11844] | 91 | pvarout(:,1) = 0._wp |
---|
[11395] | 92 | DO jj = 2, jpj |
---|
| 93 | DO ji = 1, jpi |
---|
[11844] | 94 | pvarout(ji,jj) = 0.5_wp * (zvarout(ji,jj) + zvarout(ji,jj-1)) |
---|
[11395] | 95 | END DO |
---|
| 96 | END DO |
---|
[11844] | 97 | ! lbclnk not needed as a final communication is done after the computation of fwf |
---|
[11395] | 98 | ! |
---|
| 99 | CASE ( 'T' ) |
---|
| 100 | ! |
---|
| 101 | ! compute tbl property at T point |
---|
[12068] | 102 | CALL isf_tbl_avg( ktop, kbot, phtbl, pfrac, e3t(:,:,:,Kmm), pvarin, pvarout ) |
---|
[11395] | 103 | ! |
---|
| 104 | END SELECT |
---|
| 105 | ! |
---|
| 106 | END SUBROUTINE isf_tbl |
---|
| 107 | |
---|
| 108 | SUBROUTINE isf_tbl_avg( ktop, kbot, phtbl, pfrac, pe3, pvarin, pvarout ) |
---|
[11403] | 109 | !!-------------------------------------------------------------------- |
---|
[11541] | 110 | !! *** ROUTINE isf_tbl_avg *** |
---|
[11395] | 111 | !! |
---|
| 112 | !! ** Purpose : compute mean property in the boundary layer |
---|
| 113 | !! |
---|
[11403] | 114 | !! ** Method : Depth average is made between the top level ktop and the bottom level kbot |
---|
| 115 | !! over a thickness phtbl. The bottom level is partially counted (pfrac). |
---|
| 116 | !! |
---|
[11395] | 117 | !!-------------------------- OUT ------------------------------------- |
---|
[11403] | 118 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pvarout ! tbl property averaged over phtbl between level ktop and kbot |
---|
[11395] | 119 | !!-------------------------- IN ------------------------------------- |
---|
[11403] | 120 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop, kbot ! top and bottom level of the top boundary layer |
---|
| 121 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl, pfrac ! fraction of bottom level to be affected by the tbl |
---|
| 122 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
| 123 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pvarin ! tbl property to average between ktop, kbot over phtbl |
---|
| 124 | !!-------------------------------------------------------------------- |
---|
[11395] | 125 | INTEGER :: ji,jj,jk ! loop indices |
---|
| 126 | INTEGER :: ikt, ikb ! top and bottom levels |
---|
[11403] | 127 | !!-------------------------------------------------------------------- |
---|
[11395] | 128 | ! |
---|
| 129 | ! compute tbl top.bottom level and thickness |
---|
| 130 | DO jj = 1,jpj |
---|
| 131 | DO ji = 1,jpi |
---|
| 132 | ! |
---|
| 133 | ! tbl top/bottom indices initialisation |
---|
| 134 | ikt = ktop(ji,jj) ; ikb = kbot(ji,jj) |
---|
| 135 | ! |
---|
| 136 | ! level fully include in the ice shelf boundary layer |
---|
| 137 | pvarout(ji,jj) = SUM( pvarin(ji,jj,ikt:ikb-1) * pe3(ji,jj,ikt:ikb-1) ) / phtbl(ji,jj) |
---|
| 138 | ! |
---|
| 139 | ! level partially include in ice shelf boundary layer |
---|
| 140 | pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,ikb) * pe3(ji,jj,ikb) / phtbl(ji,jj) * pfrac(ji,jj) |
---|
| 141 | ! |
---|
| 142 | END DO |
---|
| 143 | END DO |
---|
| 144 | |
---|
| 145 | END SUBROUTINE isf_tbl_avg |
---|
| 146 | |
---|
| 147 | SUBROUTINE isf_tbl_lvl( phw, pe3, ktop, kbot, phtbl, pfrac ) |
---|
[11403] | 148 | !!-------------------------------------------------------------------- |
---|
[11395] | 149 | !! *** ROUTINE isf_tbl_lvl *** |
---|
| 150 | !! |
---|
[11541] | 151 | !! ** Purpose : - compute bottom level off the top boundary layer |
---|
[11395] | 152 | !! - thickness of the top boundary layer |
---|
[11541] | 153 | !! - fraction of the bottom level affected by the tbl |
---|
[11395] | 154 | !! |
---|
[11495] | 155 | !!-------------------------- OUT -------------------------------------- |
---|
[11403] | 156 | INTEGER, DIMENSION(jpi,jpj) , INTENT( out) :: kbot ! bottom level of the top boundary layer |
---|
[11495] | 157 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pfrac ! fraction of bottom level in the tbl |
---|
| 158 | !!-------------------------- IN -------------------------------------- |
---|
[11403] | 159 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level of the top boundary layer |
---|
| 160 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phw ! water column thickness |
---|
| 161 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
[11495] | 162 | !!-------------------------- INOUT ------------------------------------ |
---|
| 163 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(inout) :: phtbl ! top boundary layer thickness |
---|
[11395] | 164 | !!--------------------------------------------------------------------- |
---|
| 165 | INTEGER :: ji,jj,jk |
---|
| 166 | INTEGER :: ikt, ikb |
---|
| 167 | !!--------------------------------------------------------------------- |
---|
| 168 | ! |
---|
| 169 | ! get htbl |
---|
| 170 | DO jj = 1,jpj |
---|
| 171 | DO ji = 1,jpi |
---|
| 172 | ! |
---|
| 173 | ! tbl top/bottom indices initialisation |
---|
| 174 | ikt = ktop(ji,jj) |
---|
| 175 | ! |
---|
| 176 | ! limit the tbl to water thickness. |
---|
| 177 | phtbl(ji,jj) = MIN( phtbl(ji,jj), phw(ji,jj) ) |
---|
| 178 | ! |
---|
| 179 | ! thickness of boundary layer must be at least the top level thickness |
---|
| 180 | phtbl(ji,jj) = MAX( phtbl(ji,jj), pe3(ji,jj,ikt) ) |
---|
| 181 | ! |
---|
| 182 | END DO |
---|
| 183 | END DO |
---|
| 184 | ! |
---|
| 185 | ! get ktbl |
---|
[11541] | 186 | CALL isf_tbl_kbot(ktop, phtbl, pe3, kbot) |
---|
[11395] | 187 | ! |
---|
| 188 | ! get pfrac |
---|
| 189 | DO jj = 1,jpj |
---|
| 190 | DO ji = 1,jpi |
---|
| 191 | ! |
---|
| 192 | ! tbl top/bottom indices initialisation |
---|
| 193 | ikt = ktop(ji,jj) ; ikb = kbot(ji,jj) |
---|
| 194 | ! |
---|
| 195 | ! proportion of the bottom cell included in ice shelf boundary layer |
---|
| 196 | pfrac(ji,jj) = ( phtbl(ji,jj) - SUM( pe3(ji,jj,ikt:ikb-1) ) ) / pe3(ji,jj,ikb) |
---|
| 197 | ! |
---|
| 198 | END DO |
---|
| 199 | END DO |
---|
| 200 | ! |
---|
| 201 | END SUBROUTINE isf_tbl_lvl |
---|
| 202 | ! |
---|
[11541] | 203 | SUBROUTINE isf_tbl_kbot(ktop, phtbl, pe3, kbot) |
---|
[11403] | 204 | !!-------------------------------------------------------------------- |
---|
[11541] | 205 | !! *** ROUTINE isf_tbl_bot *** |
---|
[11403] | 206 | !! |
---|
| 207 | !! ** Purpose : compute bottom level of the isf top boundary layer |
---|
| 208 | !! |
---|
[11395] | 209 | !!-------------------------- OUT ------------------------------------- |
---|
[11403] | 210 | INTEGER, DIMENSION(jpi,jpj) , INTENT( out) :: kbot ! bottom level of the top boundary layer |
---|
[11395] | 211 | !!-------------------------- IN ------------------------------------- |
---|
[11403] | 212 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl ! top boundary layer thickness |
---|
| 213 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level of the top boundary layer |
---|
| 214 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
| 215 | !!-------------------------------------------------------------------- |
---|
[11395] | 216 | INTEGER :: ji, jj |
---|
| 217 | INTEGER :: ikt, ikb |
---|
[11403] | 218 | !!-------------------------------------------------------------------- |
---|
[11395] | 219 | ! |
---|
| 220 | ! phtbl need to be bounded by water column thickness before |
---|
[11494] | 221 | ! test: if htbl = water column thickness, should return mbathy |
---|
| 222 | ! test: if htbl = 0 should return ktop (phtbl cap to e3t(ji,jj,1)) |
---|
[11403] | 223 | ! |
---|
[11395] | 224 | ! get ktbl |
---|
| 225 | DO jj = 1,jpj |
---|
| 226 | DO ji = 1,jpi |
---|
| 227 | ! |
---|
| 228 | ! determine the deepest level influenced by the boundary layer |
---|
| 229 | ikt = ktop(ji,jj) |
---|
| 230 | ikb = ikt |
---|
| 231 | DO WHILE ( SUM(pe3(ji,jj,ikt:ikb-1)) < phtbl(ji,jj ) ) ; ikb = ikb + 1 ; END DO |
---|
| 232 | kbot(ji,jj) = ikb - 1 |
---|
| 233 | ! |
---|
| 234 | END DO |
---|
| 235 | END DO |
---|
| 236 | ! |
---|
[11541] | 237 | END SUBROUTINE isf_tbl_kbot |
---|
[11395] | 238 | ! |
---|
[11541] | 239 | SUBROUTINE isf_tbl_ktop(pdep, ktop) |
---|
[11403] | 240 | !!-------------------------------------------------------------------- |
---|
[11541] | 241 | !! *** ROUTINE isf_tbl_top *** |
---|
[11395] | 242 | !! |
---|
| 243 | !! ** Purpose : compute top level of the isf top boundary layer in case of an ice shelf parametrisation |
---|
| 244 | !! |
---|
| 245 | !!-------------------------- OUT ------------------------------------- |
---|
[11403] | 246 | INTEGER, DIMENSION(jpi,jpj), INTENT( out) :: ktop ! top level affected by the ice shelf parametrisation |
---|
[11395] | 247 | !!-------------------------- IN ------------------------------------- |
---|
[11876] | 248 | REAL(wp), DIMENSION(jpi,jpj), INTENT(inout) :: pdep ! top depth of the parametrisation influence |
---|
[11403] | 249 | !!-------------------------------------------------------------------- |
---|
[11395] | 250 | INTEGER :: ji,jj |
---|
| 251 | INTEGER :: ikt |
---|
[11403] | 252 | !!-------------------------------------------------------------------- |
---|
| 253 | ! |
---|
[11876] | 254 | ! if we need to recompute the top level at every time stepcompute top level (z*, z~) |
---|
[12068] | 255 | ! in case of weak ht variation we can assume the top level of htbl to be constant |
---|
[11876] | 256 | ! => only done using gdepw_0 |
---|
[11395] | 257 | ! be sure pdep is already correctly bounded |
---|
| 258 | ! test: this routine run on isfdraft should return mikt |
---|
| 259 | ! test: this routine run with pdep = 0 should return 1 |
---|
[11403] | 260 | ! |
---|
[11395] | 261 | DO ji = 1, jpi |
---|
| 262 | DO jj = 1, jpj |
---|
[11876] | 263 | ! comput ktop |
---|
[11395] | 264 | ikt = 2 |
---|
[11876] | 265 | DO WHILE ( gdepw_0(ji,jj,ikt) <= pdep(ji,jj ) ) ; ikt = ikt + 1 ; END DO |
---|
[11395] | 266 | ktop(ji,jj) = ikt - 1 |
---|
[11876] | 267 | ! |
---|
| 268 | ! update pdep |
---|
| 269 | pdep(ji,jj) = gdepw_0(ji,jj,ktop(ji,jj)) |
---|
[11395] | 270 | END DO |
---|
| 271 | END DO |
---|
| 272 | ! |
---|
[11541] | 273 | END SUBROUTINE isf_tbl_ktop |
---|
[11395] | 274 | |
---|
| 275 | END MODULE isftbl |
---|