[888] | 1 | MODULE sbcssr |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE sbcssr *** |
---|
[1524] | 4 | !! Surface module : heat and fresh water fluxes a restoring term toward observed SST/SSS |
---|
[888] | 5 | !!====================================================================== |
---|
[1524] | 6 | !! History : 3.0 ! 2006-06 (G. Madec) Original code |
---|
[1482] | 7 | !! 3.2 ! 2009-04 (B. Lemaire) Introduce iom_put |
---|
[888] | 8 | !!---------------------------------------------------------------------- |
---|
| 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
[3625] | 11 | !! sbc_ssr : add to sbc a restoring term toward SST/SSS climatology |
---|
[4990] | 12 | !! sbc_ssr_init : initialisation of surface restoring |
---|
[888] | 13 | !!---------------------------------------------------------------------- |
---|
[3625] | 14 | USE oce ! ocean dynamics and tracers |
---|
| 15 | USE dom_oce ! ocean space and time domain |
---|
| 16 | USE sbc_oce ! surface boundary condition |
---|
| 17 | USE phycst ! physical constants |
---|
| 18 | USE sbcrnf ! surface boundary condition : runoffs |
---|
[4990] | 19 | ! |
---|
[3625] | 20 | USE fldread ! read input fields |
---|
[6140] | 21 | USE in_out_manager ! I/O manager |
---|
[3625] | 22 | USE iom ! I/O manager |
---|
| 23 | USE lib_mpp ! distribued memory computing library |
---|
| 24 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 25 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[888] | 26 | |
---|
| 27 | IMPLICIT NONE |
---|
| 28 | PRIVATE |
---|
| 29 | |
---|
[3764] | 30 | PUBLIC sbc_ssr ! routine called in sbcmod |
---|
| 31 | PUBLIC sbc_ssr_init ! routine called in sbcmod |
---|
[12276] | 32 | PUBLIC sbc_ssr_alloc ! routine called in sbcmod |
---|
[888] | 33 | |
---|
[2715] | 34 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: erp !: evaporation damping [kg/m2/s] |
---|
| 35 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: qrp !: heat flux damping [w/m2] |
---|
[12276] | 36 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: coefice !: under ice relaxation coefficient |
---|
[1524] | 37 | |
---|
[4147] | 38 | ! !!* Namelist namsbc_ssr * |
---|
| 39 | INTEGER, PUBLIC :: nn_sstr ! SST/SSS restoring indicator |
---|
| 40 | INTEGER, PUBLIC :: nn_sssr ! SST/SSS restoring indicator |
---|
| 41 | REAL(wp) :: rn_dqdt ! restoring factor on SST and SSS |
---|
| 42 | REAL(wp) :: rn_deds ! restoring factor on SST and SSS |
---|
| 43 | LOGICAL :: ln_sssr_bnd ! flag to bound erp term |
---|
| 44 | REAL(wp) :: rn_sssr_bnd ! ABS(Max./Min.) value of erp term [mm/day] |
---|
[12276] | 45 | INTEGER :: nn_sssr_ice ! Control of restoring under ice |
---|
[1524] | 46 | |
---|
| 47 | REAL(wp) , ALLOCATABLE, DIMENSION(:) :: buffer ! Temporary buffer for exchange |
---|
[1106] | 48 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_sst ! structure of input SST (file informations, fields read) |
---|
| 49 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_sss ! structure of input SSS (file informations, fields read) |
---|
[888] | 50 | |
---|
[12377] | 51 | !! * Substitutions |
---|
| 52 | # include "do_loop_substitute.h90" |
---|
[888] | 53 | !!---------------------------------------------------------------------- |
---|
[9598] | 54 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[1156] | 55 | !! $Id$ |
---|
[10068] | 56 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[888] | 57 | !!---------------------------------------------------------------------- |
---|
| 58 | CONTAINS |
---|
| 59 | |
---|
| 60 | SUBROUTINE sbc_ssr( kt ) |
---|
| 61 | !!--------------------------------------------------------------------- |
---|
| 62 | !! *** ROUTINE sbc_ssr *** |
---|
| 63 | !! |
---|
| 64 | !! ** Purpose : Add to heat and/or freshwater fluxes a damping term |
---|
| 65 | !! toward observed SST and/or SSS. |
---|
| 66 | !! |
---|
| 67 | !! ** Method : - Read namelist namsbc_ssr |
---|
| 68 | !! - Read observed SST and/or SSS |
---|
| 69 | !! - at each nscb time step |
---|
| 70 | !! add a retroaction term on qns (nn_sstr = 1) |
---|
[3625] | 71 | !! add a damping term on sfx (nn_sssr = 1) |
---|
| 72 | !! add a damping term on emp (nn_sssr = 2) |
---|
[888] | 73 | !!--------------------------------------------------------------------- |
---|
| 74 | INTEGER, INTENT(in ) :: kt ! ocean time step |
---|
| 75 | !! |
---|
| 76 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 77 | REAL(wp) :: zerp ! local scalar for evaporation damping |
---|
| 78 | REAL(wp) :: zqrp ! local scalar for heat flux damping |
---|
[1601] | 79 | REAL(wp) :: zsrp ! local scalar for unit conversion of rn_deds factor |
---|
[1554] | 80 | REAL(wp) :: zerp_bnd ! local scalar for unit conversion of rn_epr_max factor |
---|
[888] | 81 | INTEGER :: ierror ! return error code |
---|
| 82 | !! |
---|
| 83 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
| 84 | TYPE(FLD_N) :: sn_sst, sn_sss ! informations about the fields to be read |
---|
| 85 | !!---------------------------------------------------------------------- |
---|
[1524] | 86 | ! |
---|
[888] | 87 | IF( nn_sstr + nn_sssr /= 0 ) THEN |
---|
[1524] | 88 | ! |
---|
| 89 | IF( nn_sstr == 1) CALL fld_read( kt, nn_fsbc, sf_sst ) ! Read SST data and provides it at kt |
---|
| 90 | IF( nn_sssr >= 1) CALL fld_read( kt, nn_fsbc, sf_sss ) ! Read SSS data and provides it at kt |
---|
| 91 | ! |
---|
[888] | 92 | ! ! ========================= ! |
---|
| 93 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! Add restoring term ! |
---|
| 94 | ! ! ========================= ! |
---|
| 95 | ! |
---|
[3625] | 96 | IF( nn_sstr == 1 ) THEN !* Temperature restoring term |
---|
[13295] | 97 | DO_2D( 1, 1, 1, 1 ) |
---|
[12377] | 98 | zqrp = rn_dqdt * ( sst_m(ji,jj) - sf_sst(1)%fnow(ji,jj,1) ) * tmask(ji,jj,1) |
---|
| 99 | qns(ji,jj) = qns(ji,jj) + zqrp |
---|
| 100 | qrp(ji,jj) = zqrp |
---|
| 101 | END_2D |
---|
[888] | 102 | ENDIF |
---|
| 103 | ! |
---|
[12276] | 104 | IF( nn_sssr /= 0 .AND. nn_sssr_ice /= 1 ) THEN |
---|
| 105 | ! use fraction of ice ( fr_i ) to adjust relaxation under ice if nn_sssr_ice .ne. 1 |
---|
| 106 | ! n.b. coefice is initialised and fixed to 1._wp if nn_sssr_ice = 1 |
---|
[13295] | 107 | DO_2D( 1, 1, 1, 1 ) |
---|
[12377] | 108 | SELECT CASE ( nn_sssr_ice ) |
---|
| 109 | CASE ( 0 ) ; coefice(ji,jj) = 1._wp - fr_i(ji,jj) ! no/reduced damping under ice |
---|
| 110 | CASE DEFAULT ; coefice(ji,jj) = 1._wp + ( nn_sssr_ice - 1 ) * fr_i(ji,jj) ! reinforced damping (x nn_sssr_ice) under ice ) |
---|
| 111 | END SELECT |
---|
| 112 | END_2D |
---|
[12276] | 113 | ENDIF |
---|
| 114 | ! |
---|
[3625] | 115 | IF( nn_sssr == 1 ) THEN !* Salinity damping term (salt flux only (sfx)) |
---|
[1601] | 116 | zsrp = rn_deds / rday ! from [mm/day] to [kg/m2/s] |
---|
[13295] | 117 | DO_2D( 1, 1, 1, 1 ) |
---|
[12377] | 118 | zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) ) & ! No damping in vicinity of river mouths |
---|
| 119 | & * coefice(ji,jj) & ! Optional control of damping under sea-ice |
---|
| 120 | & * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) ) * tmask(ji,jj,1) |
---|
| 121 | sfx(ji,jj) = sfx(ji,jj) + zerp ! salt flux |
---|
| 122 | erp(ji,jj) = zerp / MAX( sss_m(ji,jj), 1.e-20 ) ! converted into an equivalent volume flux (diagnostic only) |
---|
| 123 | END_2D |
---|
[1601] | 124 | ! |
---|
[3625] | 125 | ELSEIF( nn_sssr == 2 ) THEN !* Salinity damping term (volume flux (emp) and associated heat flux (qns) |
---|
[1601] | 126 | zsrp = rn_deds / rday ! from [mm/day] to [kg/m2/s] |
---|
[1554] | 127 | zerp_bnd = rn_sssr_bnd / rday ! - - |
---|
[13295] | 128 | DO_2D( 1, 1, 1, 1 ) |
---|
[12377] | 129 | zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) ) & ! No damping in vicinity of river mouths |
---|
| 130 | & * coefice(ji,jj) & ! Optional control of damping under sea-ice |
---|
| 131 | & * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) ) & |
---|
| 132 | & / MAX( sss_m(ji,jj), 1.e-20 ) * tmask(ji,jj,1) |
---|
[13226] | 133 | IF( ln_sssr_bnd ) zerp = SIGN( 1.0_wp, zerp ) * MIN( zerp_bnd, ABS(zerp) ) |
---|
[12377] | 134 | emp(ji,jj) = emp (ji,jj) + zerp |
---|
| 135 | qns(ji,jj) = qns(ji,jj) - zerp * rcp * sst_m(ji,jj) |
---|
| 136 | erp(ji,jj) = zerp |
---|
| 137 | END_2D |
---|
[888] | 138 | ENDIF |
---|
| 139 | ! |
---|
| 140 | ENDIF |
---|
| 141 | ! |
---|
| 142 | ENDIF |
---|
| 143 | ! |
---|
| 144 | END SUBROUTINE sbc_ssr |
---|
[3764] | 145 | |
---|
| 146 | |
---|
| 147 | SUBROUTINE sbc_ssr_init |
---|
| 148 | !!--------------------------------------------------------------------- |
---|
| 149 | !! *** ROUTINE sbc_ssr_init *** |
---|
| 150 | !! |
---|
| 151 | !! ** Purpose : initialisation of surface damping term |
---|
| 152 | !! |
---|
| 153 | !! ** Method : - Read namelist namsbc_ssr |
---|
| 154 | !! - Read observed SST and/or SSS if required |
---|
| 155 | !!--------------------------------------------------------------------- |
---|
| 156 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 157 | REAL(wp) :: zerp ! local scalar for evaporation damping |
---|
| 158 | REAL(wp) :: zqrp ! local scalar for heat flux damping |
---|
| 159 | REAL(wp) :: zsrp ! local scalar for unit conversion of rn_deds factor |
---|
| 160 | REAL(wp) :: zerp_bnd ! local scalar for unit conversion of rn_epr_max factor |
---|
| 161 | INTEGER :: ierror ! return error code |
---|
| 162 | !! |
---|
| 163 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
| 164 | TYPE(FLD_N) :: sn_sst, sn_sss ! informations about the fields to be read |
---|
[12276] | 165 | NAMELIST/namsbc_ssr/ cn_dir, nn_sstr, nn_sssr, rn_dqdt, rn_deds, sn_sst, & |
---|
| 166 | & sn_sss, ln_sssr_bnd, rn_sssr_bnd, nn_sssr_ice |
---|
[4147] | 167 | INTEGER :: ios |
---|
[3764] | 168 | !!---------------------------------------------------------------------- |
---|
| 169 | ! |
---|
[9169] | 170 | IF(lwp) THEN |
---|
| 171 | WRITE(numout,*) |
---|
| 172 | WRITE(numout,*) 'sbc_ssr : SST and/or SSS damping term ' |
---|
| 173 | WRITE(numout,*) '~~~~~~~ ' |
---|
| 174 | ENDIF |
---|
| 175 | ! |
---|
[4147] | 176 | READ ( numnam_ref, namsbc_ssr, IOSTAT = ios, ERR = 901) |
---|
[11536] | 177 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_ssr in reference namelist' ) |
---|
[3764] | 178 | |
---|
[4147] | 179 | READ ( numnam_cfg, namsbc_ssr, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 180 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namsbc_ssr in configuration namelist' ) |
---|
[4624] | 181 | IF(lwm) WRITE ( numond, namsbc_ssr ) |
---|
[3764] | 182 | |
---|
| 183 | IF(lwp) THEN !* control print |
---|
| 184 | WRITE(numout,*) ' Namelist namsbc_ssr :' |
---|
[9168] | 185 | WRITE(numout,*) ' SST restoring term (Yes=1) nn_sstr = ', nn_sstr |
---|
| 186 | WRITE(numout,*) ' dQ/dT (restoring magnitude on SST) rn_dqdt = ', rn_dqdt, ' W/m2/K' |
---|
[9169] | 187 | WRITE(numout,*) ' SSS damping term (Yes=1, salt flux) nn_sssr = ', nn_sssr |
---|
[3764] | 188 | WRITE(numout,*) ' (Yes=2, volume flux) ' |
---|
[9168] | 189 | WRITE(numout,*) ' dE/dS (restoring magnitude on SST) rn_deds = ', rn_deds, ' mm/day' |
---|
| 190 | WRITE(numout,*) ' flag to bound erp term ln_sssr_bnd = ', ln_sssr_bnd |
---|
| 191 | WRITE(numout,*) ' ABS(Max./Min.) erp threshold rn_sssr_bnd = ', rn_sssr_bnd, ' mm/day' |
---|
[12276] | 192 | WRITE(numout,*) ' Cntrl of surface restoration under ice nn_sssr_ice = ', nn_sssr_ice |
---|
| 193 | WRITE(numout,*) ' ( 0 = no restoration under ice)' |
---|
| 194 | WRITE(numout,*) ' ( 1 = restoration everywhere )' |
---|
| 195 | WRITE(numout,*) ' (>1 = enhanced restoration under ice )' |
---|
[3764] | 196 | ENDIF |
---|
| 197 | ! |
---|
| 198 | IF( nn_sstr == 1 ) THEN !* set sf_sst structure & allocate arrays |
---|
| 199 | ! |
---|
| 200 | ALLOCATE( sf_sst(1), STAT=ierror ) |
---|
| 201 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sst structure' ) |
---|
| 202 | ALLOCATE( sf_sst(1)%fnow(jpi,jpj,1), STAT=ierror ) |
---|
| 203 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sst now array' ) |
---|
| 204 | ! |
---|
| 205 | ! fill sf_sst with sn_sst and control print |
---|
[7646] | 206 | CALL fld_fill( sf_sst, (/ sn_sst /), cn_dir, 'sbc_ssr', 'SST restoring term toward SST data', 'namsbc_ssr', no_print ) |
---|
[3764] | 207 | IF( sf_sst(1)%ln_tint ) ALLOCATE( sf_sst(1)%fdta(jpi,jpj,1,2), STAT=ierror ) |
---|
| 208 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sst data array' ) |
---|
| 209 | ! |
---|
| 210 | ENDIF |
---|
| 211 | ! |
---|
| 212 | IF( nn_sssr >= 1 ) THEN !* set sf_sss structure & allocate arrays |
---|
| 213 | ! |
---|
| 214 | ALLOCATE( sf_sss(1), STAT=ierror ) |
---|
| 215 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sss structure' ) |
---|
| 216 | ALLOCATE( sf_sss(1)%fnow(jpi,jpj,1), STAT=ierror ) |
---|
| 217 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sss now array' ) |
---|
| 218 | ! |
---|
| 219 | ! fill sf_sss with sn_sss and control print |
---|
[7646] | 220 | CALL fld_fill( sf_sss, (/ sn_sss /), cn_dir, 'sbc_ssr', 'SSS restoring term toward SSS data', 'namsbc_ssr', no_print ) |
---|
[3764] | 221 | IF( sf_sss(1)%ln_tint ) ALLOCATE( sf_sss(1)%fdta(jpi,jpj,1,2), STAT=ierror ) |
---|
| 222 | IF( ierror > 0 ) CALL ctl_stop( 'STOP', 'sbc_ssr: unable to allocate sf_sss data array' ) |
---|
| 223 | ! |
---|
| 224 | ENDIF |
---|
| 225 | ! |
---|
[12276] | 226 | coefice(:,:) = 1._wp ! Initialise coefice to 1._wp ; will not need to be changed if nn_sssr_ice=1 |
---|
[3764] | 227 | ! !* Initialize qrp and erp if no restoring |
---|
| 228 | IF( nn_sstr /= 1 ) qrp(:,:) = 0._wp |
---|
| 229 | IF( nn_sssr /= 1 .OR. nn_sssr /= 2 ) erp(:,:) = 0._wp |
---|
| 230 | ! |
---|
| 231 | END SUBROUTINE sbc_ssr_init |
---|
[12276] | 232 | |
---|
| 233 | INTEGER FUNCTION sbc_ssr_alloc() |
---|
| 234 | !!---------------------------------------------------------------------- |
---|
| 235 | !! *** FUNCTION sbc_ssr_alloc *** |
---|
| 236 | !!---------------------------------------------------------------------- |
---|
| 237 | sbc_ssr_alloc = 0 ! set to zero if no array to be allocated |
---|
| 238 | IF( .NOT. ALLOCATED( erp ) ) THEN |
---|
| 239 | ALLOCATE( qrp(jpi,jpj), erp(jpi,jpj), coefice(jpi,jpj), STAT= sbc_ssr_alloc ) |
---|
| 240 | ! |
---|
| 241 | IF( lk_mpp ) CALL mpp_sum ( 'sbcssr', sbc_ssr_alloc ) |
---|
| 242 | IF( sbc_ssr_alloc /= 0 ) CALL ctl_warn('sbc_ssr_alloc: failed to allocate arrays.') |
---|
| 243 | ! |
---|
| 244 | ENDIF |
---|
| 245 | END FUNCTION |
---|
[888] | 246 | |
---|
| 247 | !!====================================================================== |
---|
| 248 | END MODULE sbcssr |
---|