[6723] | 1 | MODULE sbcblk_algo_ecmwf |
---|
| 2 | !!====================================================================== |
---|
[12377] | 3 | !! *** MODULE sbcblk_algo_ecmwf *** |
---|
| 4 | !! Computes: |
---|
[6723] | 5 | !! * bulk transfer coefficients C_D, C_E and C_H |
---|
| 6 | !! * air temp. and spec. hum. adjusted from zt (2m) to zu (10m) if needed |
---|
| 7 | !! * the effective bulk wind speed at 10m U_blk |
---|
| 8 | !! => all these are used in bulk formulas in sbcblk.F90 |
---|
| 9 | !! |
---|
[12377] | 10 | !! Using the bulk formulation/param. of IFS of ECMWF (cycle 40r1) |
---|
[6723] | 11 | !! based on IFS doc (avaible online on the ECMWF's website) |
---|
| 12 | !! |
---|
| 13 | !! Routine turb_ecmwf maintained and developed in AeroBulk |
---|
[12377] | 14 | !! (https://github.com/brodeau/aerobulk) |
---|
[6723] | 15 | !! |
---|
[12377] | 16 | !! ** Author: L. Brodeau, June 2019 / AeroBulk (https://github.com/brodeau/aerobulk) |
---|
[6723] | 17 | !!---------------------------------------------------------------------- |
---|
[6727] | 18 | !! History : 4.0 ! 2016-02 (L.Brodeau) Original code |
---|
[6723] | 19 | !!---------------------------------------------------------------------- |
---|
[6727] | 20 | |
---|
| 21 | !!---------------------------------------------------------------------- |
---|
[6723] | 22 | !! turb_ecmwf : computes the bulk turbulent transfer coefficients |
---|
| 23 | !! adjusts t_air and q_air from zt to zu m |
---|
| 24 | !! returns the effective bulk wind speed at 10m |
---|
| 25 | !!---------------------------------------------------------------------- |
---|
| 26 | USE oce ! ocean dynamics and tracers |
---|
| 27 | USE dom_oce ! ocean space and time domain |
---|
| 28 | USE phycst ! physical constants |
---|
| 29 | USE iom ! I/O manager library |
---|
| 30 | USE lib_mpp ! distribued memory computing library |
---|
| 31 | USE in_out_manager ! I/O manager |
---|
| 32 | USE prtctl ! Print control |
---|
| 33 | USE sbcwave, ONLY : cdn_wave ! wave module |
---|
[9570] | 34 | #if defined key_si3 || defined key_cice |
---|
[6723] | 35 | USE sbc_ice ! Surface boundary condition: ice fields |
---|
| 36 | #endif |
---|
| 37 | USE lib_fortran ! to use key_nosignedzero |
---|
| 38 | |
---|
| 39 | USE sbc_oce ! Surface boundary condition: ocean fields |
---|
[12377] | 40 | USE sbcblk_phy ! all thermodynamics functions, rho_air, q_sat, etc... !LB |
---|
| 41 | USE sbcblk_skin_ecmwf ! cool-skin/warm layer scheme !LB |
---|
[6723] | 42 | |
---|
| 43 | IMPLICIT NONE |
---|
| 44 | PRIVATE |
---|
| 45 | |
---|
[12377] | 46 | PUBLIC :: SBCBLK_ALGO_ECMWF_INIT, TURB_ECMWF |
---|
| 47 | !! * Substitutions |
---|
| 48 | # include "do_loop_substitute.h90" |
---|
[6723] | 49 | |
---|
[12377] | 50 | !! ECMWF own values for given constants, taken form IFS documentation... |
---|
[6723] | 51 | REAL(wp), PARAMETER :: charn0 = 0.018 ! Charnock constant (pretty high value here !!! |
---|
| 52 | ! ! => Usually 0.011 for moderate winds) |
---|
| 53 | REAL(wp), PARAMETER :: zi0 = 1000. ! scale height of the atmospheric boundary layer...1 |
---|
| 54 | REAL(wp), PARAMETER :: Beta0 = 1. ! gustiness parameter ( = 1.25 in COAREv3) |
---|
| 55 | REAL(wp), PARAMETER :: alpha_M = 0.11 ! For roughness length (smooth surface term) |
---|
| 56 | REAL(wp), PARAMETER :: alpha_H = 0.40 ! (Chapter 3, p.34, IFS doc Cy31r1) |
---|
| 57 | REAL(wp), PARAMETER :: alpha_Q = 0.62 ! |
---|
[12377] | 58 | |
---|
| 59 | INTEGER , PARAMETER :: nb_itt = 10 ! number of itterations |
---|
| 60 | |
---|
[6723] | 61 | !!---------------------------------------------------------------------- |
---|
| 62 | CONTAINS |
---|
| 63 | |
---|
[12377] | 64 | |
---|
| 65 | SUBROUTINE sbcblk_algo_ecmwf_init(l_use_cs, l_use_wl) |
---|
| 66 | !!--------------------------------------------------------------------- |
---|
| 67 | !! *** FUNCTION sbcblk_algo_ecmwf_init *** |
---|
| 68 | !! |
---|
| 69 | !! INPUT : |
---|
| 70 | !! ------- |
---|
| 71 | !! * l_use_cs : use the cool-skin parameterization |
---|
| 72 | !! * l_use_wl : use the warm-layer parameterization |
---|
| 73 | !!--------------------------------------------------------------------- |
---|
| 74 | LOGICAL , INTENT(in) :: l_use_cs ! use the cool-skin parameterization |
---|
| 75 | LOGICAL , INTENT(in) :: l_use_wl ! use the warm-layer parameterization |
---|
| 76 | INTEGER :: ierr |
---|
| 77 | !!--------------------------------------------------------------------- |
---|
| 78 | IF( l_use_wl ) THEN |
---|
| 79 | ierr = 0 |
---|
| 80 | ALLOCATE ( dT_wl(jpi,jpj), Hz_wl(jpi,jpj), STAT=ierr ) |
---|
| 81 | IF( ierr > 0 ) CALL ctl_stop( ' SBCBLK_ALGO_ECMWF_INIT => allocation of dT_wl & Hz_wl failed!' ) |
---|
| 82 | dT_wl(:,:) = 0._wp |
---|
| 83 | Hz_wl(:,:) = rd0 ! (rd0, constant, = 3m is default for Zeng & Beljaars) |
---|
| 84 | ENDIF |
---|
| 85 | IF( l_use_cs ) THEN |
---|
| 86 | ierr = 0 |
---|
| 87 | ALLOCATE ( dT_cs(jpi,jpj), STAT=ierr ) |
---|
| 88 | IF( ierr > 0 ) CALL ctl_stop( ' SBCBLK_ALGO_ECMWF_INIT => allocation of dT_cs failed!' ) |
---|
| 89 | dT_cs(:,:) = -0.25_wp ! First guess of skin correction |
---|
| 90 | ENDIF |
---|
| 91 | END SUBROUTINE sbcblk_algo_ecmwf_init |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | SUBROUTINE turb_ecmwf( kt, zt, zu, T_s, t_zt, q_s, q_zt, U_zu, l_use_cs, l_use_wl, & |
---|
| 96 | & Cd, Ch, Ce, t_zu, q_zu, U_blk, & |
---|
| 97 | & Cdn, Chn, Cen, & |
---|
| 98 | & Qsw, rad_lw, slp, pdT_cs, & ! optionals for cool-skin (and warm-layer) |
---|
| 99 | & pdT_wl, pHz_wl ) ! optionals for warm-layer only |
---|
[12615] | 100 | !!---------------------------------------------------------------------------------- |
---|
[6723] | 101 | !! *** ROUTINE turb_ecmwf *** |
---|
| 102 | !! |
---|
| 103 | !! ** Purpose : Computes turbulent transfert coefficients of surface |
---|
[12377] | 104 | !! fluxes according to IFS doc. (cycle 45r1) |
---|
[6723] | 105 | !! If relevant (zt /= zu), adjust temperature and humidity from height zt to zu |
---|
[12377] | 106 | !! Returns the effective bulk wind speed at zu to be used in the bulk formulas |
---|
[6723] | 107 | !! |
---|
[12377] | 108 | !! Applies the cool-skin warm-layer correction of the SST to T_s |
---|
| 109 | !! if the net shortwave flux at the surface (Qsw), the downwelling longwave |
---|
| 110 | !! radiative fluxes at the surface (rad_lw), and the sea-leve pressure (slp) |
---|
| 111 | !! are provided as (optional) arguments! |
---|
[6723] | 112 | !! |
---|
| 113 | !! INPUT : |
---|
| 114 | !! ------- |
---|
[12377] | 115 | !! * kt : current time step (starts at 1) |
---|
[6723] | 116 | !! * zt : height for temperature and spec. hum. of air [m] |
---|
[12377] | 117 | !! * zu : height for wind speed (usually 10m) [m] |
---|
[6723] | 118 | !! * t_zt : potential air temperature at zt [K] |
---|
| 119 | !! * q_zt : specific humidity of air at zt [kg/kg] |
---|
[12377] | 120 | !! * U_zu : scalar wind speed at zu [m/s] |
---|
| 121 | !! * l_use_cs : use the cool-skin parameterization |
---|
| 122 | !! * l_use_wl : use the warm-layer parameterization |
---|
[6723] | 123 | !! |
---|
[12377] | 124 | !! INPUT/OUTPUT: |
---|
| 125 | !! ------------- |
---|
| 126 | !! * T_s : always "bulk SST" as input [K] |
---|
| 127 | !! -> unchanged "bulk SST" as output if CSWL not used [K] |
---|
| 128 | !! -> skin temperature as output if CSWL used [K] |
---|
[6723] | 129 | !! |
---|
[12377] | 130 | !! * q_s : SSQ aka saturation specific humidity at temp. T_s [kg/kg] |
---|
| 131 | !! -> doesn't need to be given a value if skin temp computed (in case l_use_cs=True or l_use_wl=True) |
---|
| 132 | !! -> MUST be given the correct value if not computing skint temp. (in case l_use_cs=False or l_use_wl=False) |
---|
| 133 | !! |
---|
| 134 | !! OPTIONAL INPUT: |
---|
| 135 | !! --------------- |
---|
| 136 | !! * Qsw : net solar flux (after albedo) at the surface (>0) [W/m^2] |
---|
| 137 | !! * rad_lw : downwelling longwave radiation at the surface (>0) [W/m^2] |
---|
| 138 | !! * slp : sea-level pressure [Pa] |
---|
| 139 | !! |
---|
| 140 | !! OPTIONAL OUTPUT: |
---|
| 141 | !! ---------------- |
---|
| 142 | !! * pdT_cs : SST increment "dT" for cool-skin correction [K] |
---|
| 143 | !! * pdT_wl : SST increment "dT" for warm-layer correction [K] |
---|
| 144 | !! * pHz_wl : thickness of warm-layer [m] |
---|
| 145 | !! |
---|
[6723] | 146 | !! OUTPUT : |
---|
| 147 | !! -------- |
---|
| 148 | !! * Cd : drag coefficient |
---|
| 149 | !! * Ch : sensible heat coefficient |
---|
| 150 | !! * Ce : evaporation coefficient |
---|
| 151 | !! * t_zu : pot. air temperature adjusted at wind height zu [K] |
---|
| 152 | !! * q_zu : specific humidity of air // [kg/kg] |
---|
[12377] | 153 | !! * U_blk : bulk wind speed at zu [m/s] |
---|
[6723] | 154 | !! |
---|
| 155 | !! |
---|
[12377] | 156 | !! ** Author: L. Brodeau, June 2019 / AeroBulk (https://github.com/brodeau/aerobulk/) |
---|
[6723] | 157 | !!---------------------------------------------------------------------------------- |
---|
[12377] | 158 | INTEGER, INTENT(in ) :: kt ! current time step |
---|
[6723] | 159 | REAL(wp), INTENT(in ) :: zt ! height for t_zt and q_zt [m] |
---|
| 160 | REAL(wp), INTENT(in ) :: zu ! height for U_zu [m] |
---|
[12377] | 161 | REAL(wp), INTENT(inout), DIMENSION(jpi,jpj) :: T_s ! sea surface temperature [Kelvin] |
---|
[6723] | 162 | REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: t_zt ! potential air temperature [Kelvin] |
---|
[12377] | 163 | REAL(wp), INTENT(inout), DIMENSION(jpi,jpj) :: q_s ! sea surface specific humidity [kg/kg] |
---|
| 164 | REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: q_zt ! specific air humidity at zt [kg/kg] |
---|
[6723] | 165 | REAL(wp), INTENT(in ), DIMENSION(jpi,jpj) :: U_zu ! relative wind module at zu [m/s] |
---|
[12377] | 166 | LOGICAL , INTENT(in ) :: l_use_cs ! use the cool-skin parameterization |
---|
| 167 | LOGICAL , INTENT(in ) :: l_use_wl ! use the warm-layer parameterization |
---|
[6723] | 168 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: Cd ! transfer coefficient for momentum (tau) |
---|
| 169 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: Ch ! transfer coefficient for sensible heat (Q_sens) |
---|
| 170 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: Ce ! transfert coefficient for evaporation (Q_lat) |
---|
| 171 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: t_zu ! pot. air temp. adjusted at zu [K] |
---|
| 172 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: q_zu ! spec. humidity adjusted at zu [kg/kg] |
---|
[12377] | 173 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: U_blk ! bulk wind speed at zu [m/s] |
---|
[9019] | 174 | REAL(wp), INTENT( out), DIMENSION(jpi,jpj) :: Cdn, Chn, Cen ! neutral transfer coefficients |
---|
[6723] | 175 | ! |
---|
[12377] | 176 | REAL(wp), INTENT(in ), OPTIONAL, DIMENSION(jpi,jpj) :: Qsw ! [W/m^2] |
---|
| 177 | REAL(wp), INTENT(in ), OPTIONAL, DIMENSION(jpi,jpj) :: rad_lw ! [W/m^2] |
---|
| 178 | REAL(wp), INTENT(in ), OPTIONAL, DIMENSION(jpi,jpj) :: slp ! [Pa] |
---|
| 179 | REAL(wp), INTENT( out), OPTIONAL, DIMENSION(jpi,jpj) :: pdT_cs |
---|
| 180 | REAL(wp), INTENT( out), OPTIONAL, DIMENSION(jpi,jpj) :: pdT_wl ! [K] |
---|
| 181 | REAL(wp), INTENT( out), OPTIONAL, DIMENSION(jpi,jpj) :: pHz_wl ! [m] |
---|
| 182 | ! |
---|
[6723] | 183 | INTEGER :: j_itt |
---|
[12377] | 184 | LOGICAL :: l_zt_equal_zu = .FALSE. ! if q and t are given at same height as U |
---|
[6723] | 185 | ! |
---|
[12615] | 186 | REAL(wp), DIMENSION(jpi,jpj) :: u_star, t_star, q_star |
---|
| 187 | REAL(wp), DIMENSION(jpi,jpj) :: dt_zu, dq_zu |
---|
| 188 | REAL(wp), DIMENSION(jpi,jpj) :: znu_a !: Nu_air, Viscosity of air |
---|
[12377] | 189 | REAL(wp), DIMENSION(jpi,jpj) :: Linv !: 1/L (inverse of Monin Obukhov length... |
---|
| 190 | REAL(wp), DIMENSION(jpi,jpj) :: z0, z0t, z0q |
---|
[6723] | 191 | ! |
---|
[12377] | 192 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zsst ! to back up the initial bulk SST |
---|
[6723] | 193 | ! |
---|
[12377] | 194 | REAL(wp), DIMENSION(jpi,jpj) :: func_m, func_h |
---|
| 195 | REAL(wp), DIMENSION(jpi,jpj) :: ztmp0, ztmp1, ztmp2 |
---|
| 196 | CHARACTER(len=40), PARAMETER :: crtnm = 'turb_ecmwf@sbcblk_algo_ecmwf.F90' |
---|
| 197 | !!---------------------------------------------------------------------------------- |
---|
| 198 | IF( kt == nit000 ) CALL SBCBLK_ALGO_ECMWF_INIT(l_use_cs, l_use_wl) |
---|
| 199 | |
---|
[12615] | 200 | l_zt_equal_zu = ( ABS(zu - zt) < 0.01_wp ) ! testing "zu == zt" is risky with double precision |
---|
[6723] | 201 | |
---|
[12377] | 202 | !! Initializations for cool skin and warm layer: |
---|
| 203 | IF( l_use_cs .AND. (.NOT.(PRESENT(Qsw) .AND. PRESENT(rad_lw) .AND. PRESENT(slp))) ) & |
---|
| 204 | & CALL ctl_stop( '['//TRIM(crtnm)//'] => ' , 'you need to provide Qsw, rad_lw & slp to use cool-skin param!' ) |
---|
[6723] | 205 | |
---|
[12377] | 206 | IF( l_use_wl .AND. (.NOT.(PRESENT(Qsw) .AND. PRESENT(rad_lw) .AND. PRESENT(slp))) ) & |
---|
| 207 | & CALL ctl_stop( '['//TRIM(crtnm)//'] => ' , 'you need to provide Qsw, rad_lw & slp to use warm-layer param!' ) |
---|
| 208 | |
---|
| 209 | IF( l_use_cs .OR. l_use_wl ) THEN |
---|
| 210 | ALLOCATE ( zsst(jpi,jpj) ) |
---|
| 211 | zsst = T_s ! backing up the bulk SST |
---|
| 212 | IF( l_use_cs ) T_s = T_s - 0.25_wp ! First guess of correction |
---|
| 213 | q_s = rdct_qsat_salt*q_sat(MAX(T_s, 200._wp), slp) ! First guess of q_s |
---|
| 214 | ENDIF |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | ! Identical first gess as in COARE, with IFS parameter values though... |
---|
| 218 | ! |
---|
[6723] | 219 | !! First guess of temperature and humidity at height zu: |
---|
[12377] | 220 | t_zu = MAX( t_zt , 180._wp ) ! who knows what's given on masked-continental regions... |
---|
| 221 | q_zu = MAX( q_zt , 1.e-6_wp ) ! " |
---|
[6723] | 222 | |
---|
| 223 | !! Pot. temp. difference (and we don't want it to be 0!) |
---|
[12377] | 224 | dt_zu = t_zu - T_s ; dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) |
---|
| 225 | dq_zu = q_zu - q_s ; dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) |
---|
[6723] | 226 | |
---|
[12377] | 227 | znu_a = visc_air(t_zu) ! Air viscosity (m^2/s) at zt given from temperature in (K) |
---|
[6723] | 228 | |
---|
[12377] | 229 | U_blk = SQRT(U_zu*U_zu + 0.5_wp*0.5_wp) ! initial guess for wind gustiness contribution |
---|
[6723] | 230 | |
---|
[12377] | 231 | ztmp0 = LOG( zu*10000._wp) ! optimization: 10000. == 1/z0 (with z0 first guess == 0.0001) |
---|
| 232 | ztmp1 = LOG(10._wp*10000._wp) ! " " " |
---|
| 233 | u_star = 0.035_wp*U_blk*ztmp1/ztmp0 ! (u* = 0.035*Un10) |
---|
[6723] | 234 | |
---|
[12377] | 235 | z0 = charn0*u_star*u_star/grav + 0.11_wp*znu_a/u_star |
---|
| 236 | z0 = MIN( MAX(ABS(z0), 1.E-9) , 1._wp ) ! (prevents FPE from stupid values from masked region later on) |
---|
[6723] | 237 | |
---|
[12377] | 238 | z0t = 1._wp / ( 0.1_wp*EXP(vkarmn/(0.00115/(vkarmn/ztmp1))) ) |
---|
| 239 | z0t = MIN( MAX(ABS(z0t), 1.E-9) , 1._wp ) ! (prevents FPE from stupid values from masked region later on) |
---|
| 240 | |
---|
[6723] | 241 | Cd = (vkarmn/ztmp0)**2 ! first guess of Cd |
---|
| 242 | |
---|
[12377] | 243 | ztmp0 = vkarmn*vkarmn/LOG(zt/z0t)/Cd |
---|
[6723] | 244 | |
---|
[12377] | 245 | ztmp2 = Ri_bulk( zu, T_s, t_zu, q_s, q_zu, U_blk ) ! Bulk Richardson Number (BRN) |
---|
[6723] | 246 | |
---|
[12377] | 247 | !! First estimate of zeta_u, depending on the stability, ie sign of BRN (ztmp2): |
---|
| 248 | ztmp1 = 0.5 + SIGN( 0.5_wp , ztmp2 ) |
---|
[6723] | 249 | func_m = ztmp0*ztmp2 ! temporary array !! |
---|
[12377] | 250 | func_h = (1._wp-ztmp1) * (func_m/(1._wp+ztmp2/(-zu/(zi0*0.004_wp*Beta0**3)))) & ! BRN < 0 ! temporary array !!! func_h == zeta_u |
---|
| 251 | & + ztmp1 * (func_m*(1._wp + 27._wp/9._wp*ztmp2/func_m)) ! BRN > 0 |
---|
| 252 | !#LB: should make sure that the "func_m" of "27./9.*ztmp2/func_m" is "ztmp0*ztmp2" and not "ztmp0==vkarmn*vkarmn/LOG(zt/z0t)/Cd" ! |
---|
[6723] | 253 | |
---|
| 254 | !! First guess M-O stability dependent scaling params.(u*,t*,q*) to estimate z0 and z/L |
---|
[12377] | 255 | ztmp0 = vkarmn/(LOG(zu/z0t) - psi_h_ecmwf(func_h)) |
---|
[6723] | 256 | |
---|
[12377] | 257 | u_star = MAX ( U_blk*vkarmn/(LOG(zu) - LOG(z0) - psi_m_ecmwf(func_h)) , 1.E-9 ) ! (MAX => prevents FPE from stupid values from masked region later on) |
---|
[6723] | 258 | t_star = dt_zu*ztmp0 |
---|
| 259 | q_star = dq_zu*ztmp0 |
---|
| 260 | |
---|
[12377] | 261 | ! What needs to be done if zt /= zu: |
---|
[6723] | 262 | IF( .NOT. l_zt_equal_zu ) THEN |
---|
| 263 | !! First update of values at zu (or zt for wind) |
---|
| 264 | ztmp0 = psi_h_ecmwf(func_h) - psi_h_ecmwf(zt*func_h/zu) ! zt*func_h/zu == zeta_t |
---|
[12377] | 265 | ztmp1 = LOG(zt/zu) + ztmp0 |
---|
[6723] | 266 | t_zu = t_zt - t_star/vkarmn*ztmp1 |
---|
| 267 | q_zu = q_zt - q_star/vkarmn*ztmp1 |
---|
[12377] | 268 | q_zu = (0.5_wp + SIGN(0.5_wp,q_zu))*q_zu !Makes it impossible to have negative humidity : |
---|
[6723] | 269 | ! |
---|
[12377] | 270 | dt_zu = t_zu - T_s ; dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) |
---|
| 271 | dq_zu = q_zu - q_s ; dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) |
---|
[6723] | 272 | ENDIF |
---|
| 273 | |
---|
| 274 | |
---|
| 275 | !! => that was same first guess as in COARE... |
---|
| 276 | |
---|
| 277 | |
---|
| 278 | !! First guess of inverse of Monin-Obukov length (1/L) : |
---|
[12377] | 279 | Linv = One_on_L( t_zu, q_zu, u_star, t_star, q_star ) |
---|
[6723] | 280 | |
---|
| 281 | !! Functions such as u* = U_blk*vkarmn/func_m |
---|
[12377] | 282 | ztmp0 = zu*Linv |
---|
| 283 | func_m = LOG(zu) - LOG(z0) - psi_m_ecmwf(ztmp0) + psi_m_ecmwf( z0*Linv) |
---|
| 284 | func_h = LOG(zu) - LOG(z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(z0t*Linv) |
---|
[6723] | 285 | |
---|
| 286 | !! ITERATION BLOCK |
---|
| 287 | DO j_itt = 1, nb_itt |
---|
| 288 | |
---|
| 289 | !! Bulk Richardson Number at z=zu (Eq. 3.25) |
---|
[12377] | 290 | ztmp0 = Ri_bulk( zu, T_s, t_zu, q_s, q_zu, U_blk ) ! Bulk Richardson Number (BRN) |
---|
[6723] | 291 | |
---|
| 292 | !! New estimate of the inverse of the Monin-Obukhon length (Linv == zeta/zu) : |
---|
[12377] | 293 | Linv = ztmp0*func_m*func_m/func_h / zu ! From Eq. 3.23, Chap.3.2.3, IFS doc - Cy40r1 |
---|
| 294 | !! Note: it is slightly different that the L we would get with the usual |
---|
| 295 | Linv = SIGN( MIN(ABS(Linv),200._wp), Linv ) ! (prevent FPE from stupid values from masked region later on...) |
---|
[6723] | 296 | |
---|
| 297 | !! Update func_m with new Linv: |
---|
[12377] | 298 | func_m = LOG(zu) -LOG(z0) - psi_m_ecmwf(zu*Linv) + psi_m_ecmwf(z0*Linv) ! LB: should be "zu+z0" rather than "zu" alone, but z0 is tiny wrt zu! |
---|
[6723] | 299 | |
---|
| 300 | !! Need to update roughness lengthes: |
---|
| 301 | u_star = U_blk*vkarmn/func_m |
---|
| 302 | ztmp2 = u_star*u_star |
---|
| 303 | ztmp1 = znu_a/u_star |
---|
[12377] | 304 | z0 = MIN( ABS( alpha_M*ztmp1 + charn0*ztmp2/grav ) , 0.001_wp) |
---|
| 305 | z0t = MIN( ABS( alpha_H*ztmp1 ) , 0.001_wp) ! eq.3.26, Chap.3, p.34, IFS doc - Cy31r1 |
---|
| 306 | z0q = MIN( ABS( alpha_Q*ztmp1 ) , 0.001_wp) |
---|
[6723] | 307 | |
---|
[12377] | 308 | !! Update wind at zu with convection-related wind gustiness in unstable conditions (Chap. 3.2, IFS doc - Cy40r1, Eq.3.17 and Eq.3.18 + Eq.3.8) |
---|
| 309 | ztmp2 = Beta0*Beta0*ztmp2*(MAX(-zi0*Linv/vkarmn,0._wp))**(2._wp/3._wp) ! square of wind gustiness contribution (combining Eq. 3.8 and 3.18, hap.3, IFS doc - Cy31r1) |
---|
| 310 | !! ! Only true when unstable (L<0) => when ztmp0 < 0 => explains "-" before zi0 |
---|
| 311 | U_blk = MAX(SQRT(U_zu*U_zu + ztmp2), 0.2_wp) ! include gustiness in bulk wind speed |
---|
[6723] | 312 | ! => 0.2 prevents U_blk to be 0 in stable case when U_zu=0. |
---|
| 313 | |
---|
| 314 | |
---|
| 315 | !! Need to update "theta" and "q" at zu in case they are given at different heights |
---|
| 316 | !! as well the air-sea differences: |
---|
| 317 | IF( .NOT. l_zt_equal_zu ) THEN |
---|
| 318 | !! Arrays func_m and func_h are free for a while so using them as temporary arrays... |
---|
[12377] | 319 | func_h = psi_h_ecmwf(zu*Linv) ! temporary array !!! |
---|
| 320 | func_m = psi_h_ecmwf(zt*Linv) ! temporary array !!! |
---|
[6723] | 321 | |
---|
| 322 | ztmp2 = psi_h_ecmwf(z0t*Linv) |
---|
| 323 | ztmp0 = func_h - ztmp2 |
---|
[12377] | 324 | ztmp1 = vkarmn/(LOG(zu) - LOG(z0t) - ztmp0) |
---|
[6723] | 325 | t_star = dt_zu*ztmp1 |
---|
| 326 | ztmp2 = ztmp0 - func_m + ztmp2 |
---|
| 327 | ztmp1 = LOG(zt/zu) + ztmp2 |
---|
| 328 | t_zu = t_zt - t_star/vkarmn*ztmp1 |
---|
| 329 | |
---|
| 330 | ztmp2 = psi_h_ecmwf(z0q*Linv) |
---|
| 331 | ztmp0 = func_h - ztmp2 |
---|
[12377] | 332 | ztmp1 = vkarmn/(LOG(zu) - LOG(z0q) - ztmp0) |
---|
[6723] | 333 | q_star = dq_zu*ztmp1 |
---|
| 334 | ztmp2 = ztmp0 - func_m + ztmp2 |
---|
[12377] | 335 | ztmp1 = LOG(zt/zu) + ztmp2 |
---|
[6723] | 336 | q_zu = q_zt - q_star/vkarmn*ztmp1 |
---|
[12377] | 337 | ENDIF |
---|
[6723] | 338 | |
---|
[12377] | 339 | !! Updating because of updated z0 and z0t and new Linv... |
---|
| 340 | ztmp0 = zu*Linv |
---|
| 341 | func_m = log(zu) - LOG(z0 ) - psi_m_ecmwf(ztmp0) + psi_m_ecmwf(z0 *Linv) |
---|
| 342 | func_h = log(zu) - LOG(z0t) - psi_h_ecmwf(ztmp0) + psi_h_ecmwf(z0t*Linv) |
---|
[9019] | 343 | |
---|
[6723] | 344 | |
---|
[12377] | 345 | IF( l_use_cs ) THEN |
---|
| 346 | !! Cool-skin contribution |
---|
[6723] | 347 | |
---|
[12377] | 348 | CALL UPDATE_QNSOL_TAU( zu, T_s, q_s, t_zu, q_zu, u_star, t_star, q_star, U_zu, U_blk, slp, rad_lw, & |
---|
| 349 | & ztmp1, ztmp0, Qlat=ztmp2) ! Qnsol -> ztmp1 / Tau -> ztmp0 |
---|
[6723] | 350 | |
---|
[12377] | 351 | CALL CS_ECMWF( Qsw, ztmp1, u_star, zsst ) ! Qnsol -> ztmp1 |
---|
| 352 | |
---|
| 353 | T_s(:,:) = zsst(:,:) + dT_cs(:,:)*tmask(:,:,1) |
---|
| 354 | IF( l_use_wl ) T_s(:,:) = T_s(:,:) + dT_wl(:,:)*tmask(:,:,1) |
---|
| 355 | q_s(:,:) = rdct_qsat_salt*q_sat(MAX(T_s(:,:), 200._wp), slp(:,:)) |
---|
| 356 | |
---|
| 357 | ENDIF |
---|
| 358 | |
---|
| 359 | IF( l_use_wl ) THEN |
---|
| 360 | !! Warm-layer contribution |
---|
| 361 | CALL UPDATE_QNSOL_TAU( zu, T_s, q_s, t_zu, q_zu, u_star, t_star, q_star, U_zu, U_blk, slp, rad_lw, & |
---|
| 362 | & ztmp1, ztmp2) ! Qnsol -> ztmp1 / Tau -> ztmp2 |
---|
| 363 | CALL WL_ECMWF( Qsw, ztmp1, u_star, zsst ) |
---|
| 364 | !! Updating T_s and q_s !!! |
---|
| 365 | T_s(:,:) = zsst(:,:) + dT_wl(:,:)*tmask(:,:,1) ! |
---|
| 366 | IF( l_use_cs ) T_s(:,:) = T_s(:,:) + dT_cs(:,:)*tmask(:,:,1) |
---|
| 367 | q_s(:,:) = rdct_qsat_salt*q_sat(MAX(T_s(:,:), 200._wp), slp(:,:)) |
---|
| 368 | ENDIF |
---|
| 369 | |
---|
| 370 | IF( l_use_cs .OR. l_use_wl .OR. (.NOT. l_zt_equal_zu) ) THEN |
---|
| 371 | dt_zu = t_zu - T_s ; dt_zu = SIGN( MAX(ABS(dt_zu),1.E-6_wp), dt_zu ) |
---|
| 372 | dq_zu = q_zu - q_s ; dq_zu = SIGN( MAX(ABS(dq_zu),1.E-9_wp), dq_zu ) |
---|
| 373 | ENDIF |
---|
| 374 | |
---|
| 375 | END DO !DO j_itt = 1, nb_itt |
---|
| 376 | |
---|
[6723] | 377 | Cd = vkarmn*vkarmn/(func_m*func_m) |
---|
| 378 | Ch = vkarmn*vkarmn/(func_m*func_h) |
---|
[12377] | 379 | ztmp2 = log(zu/z0q) - psi_h_ecmwf(zu*Linv) + psi_h_ecmwf(z0q*Linv) ! func_q |
---|
| 380 | Ce = vkarmn*vkarmn/(func_m*ztmp2) |
---|
[6723] | 381 | |
---|
[12377] | 382 | Cdn = vkarmn*vkarmn / (log(zu/z0 )*log(zu/z0 )) |
---|
| 383 | Chn = vkarmn*vkarmn / (log(zu/z0t)*log(zu/z0t)) |
---|
| 384 | Cen = vkarmn*vkarmn / (log(zu/z0q)*log(zu/z0q)) |
---|
[9019] | 385 | |
---|
[12377] | 386 | IF( l_use_cs .AND. PRESENT(pdT_cs) ) pdT_cs = dT_cs |
---|
| 387 | IF( l_use_wl .AND. PRESENT(pdT_wl) ) pdT_wl = dT_wl |
---|
| 388 | IF( l_use_wl .AND. PRESENT(pHz_wl) ) pHz_wl = Hz_wl |
---|
[6723] | 389 | |
---|
[12377] | 390 | IF( l_use_cs .OR. l_use_wl ) DEALLOCATE ( zsst ) |
---|
[6723] | 391 | |
---|
[12377] | 392 | END SUBROUTINE turb_ecmwf |
---|
| 393 | |
---|
| 394 | |
---|
[6723] | 395 | FUNCTION psi_m_ecmwf( pzeta ) |
---|
| 396 | !!---------------------------------------------------------------------------------- |
---|
| 397 | !! Universal profile stability function for momentum |
---|
| 398 | !! ECMWF / as in IFS cy31r1 documentation, available online |
---|
| 399 | !! at ecmwf.int |
---|
| 400 | !! |
---|
| 401 | !! pzeta : stability paramenter, z/L where z is altitude measurement |
---|
| 402 | !! and L is M-O length |
---|
| 403 | !! |
---|
[12377] | 404 | !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) |
---|
[6723] | 405 | !!---------------------------------------------------------------------------------- |
---|
| 406 | REAL(wp), DIMENSION(jpi,jpj) :: psi_m_ecmwf |
---|
| 407 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pzeta |
---|
| 408 | ! |
---|
| 409 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 410 | REAL(wp) :: zzeta, zx, ztmp, psi_unst, psi_stab, stab |
---|
| 411 | !!---------------------------------------------------------------------------------- |
---|
[13571] | 412 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[12615] | 413 | ! |
---|
| 414 | zzeta = MIN( pzeta(ji,jj) , 5._wp ) !! Very stable conditions (L positif and big!): |
---|
| 415 | ! |
---|
| 416 | ! Unstable (Paulson 1970): |
---|
| 417 | ! eq.3.20, Chap.3, p.33, IFS doc - Cy31r1 |
---|
| 418 | zx = SQRT(ABS(1._wp - 16._wp*zzeta)) |
---|
| 419 | ztmp = 1._wp + SQRT(zx) |
---|
| 420 | ztmp = ztmp*ztmp |
---|
| 421 | psi_unst = LOG( 0.125_wp*ztmp*(1._wp + zx) ) & |
---|
| 422 | & -2._wp*ATAN( SQRT(zx) ) + 0.5_wp*rpi |
---|
| 423 | ! |
---|
| 424 | ! Unstable: |
---|
| 425 | ! eq.3.22, Chap.3, p.33, IFS doc - Cy31r1 |
---|
| 426 | psi_stab = -2._wp/3._wp*(zzeta - 5._wp/0.35_wp)*EXP(-0.35_wp*zzeta) & |
---|
| 427 | & - zzeta - 2._wp/3._wp*5._wp/0.35_wp |
---|
| 428 | ! |
---|
| 429 | ! Combining: |
---|
| 430 | stab = 0.5_wp + SIGN(0.5_wp, zzeta) ! zzeta > 0 => stab = 1 |
---|
| 431 | ! |
---|
| 432 | psi_m_ecmwf(ji,jj) = (1._wp - stab) * psi_unst & ! (zzeta < 0) Unstable |
---|
| 433 | & + stab * psi_stab ! (zzeta > 0) Stable |
---|
| 434 | ! |
---|
[12377] | 435 | END_2D |
---|
[6723] | 436 | END FUNCTION psi_m_ecmwf |
---|
| 437 | |
---|
[12377] | 438 | |
---|
[6723] | 439 | FUNCTION psi_h_ecmwf( pzeta ) |
---|
| 440 | !!---------------------------------------------------------------------------------- |
---|
| 441 | !! Universal profile stability function for temperature and humidity |
---|
| 442 | !! ECMWF / as in IFS cy31r1 documentation, available online |
---|
| 443 | !! at ecmwf.int |
---|
| 444 | !! |
---|
| 445 | !! pzeta : stability paramenter, z/L where z is altitude measurement |
---|
| 446 | !! and L is M-O length |
---|
| 447 | !! |
---|
[12377] | 448 | !! ** Author: L. Brodeau, June 2016 / AeroBulk (https://github.com/brodeau/aerobulk/) |
---|
[6723] | 449 | !!---------------------------------------------------------------------------------- |
---|
| 450 | REAL(wp), DIMENSION(jpi,jpj) :: psi_h_ecmwf |
---|
| 451 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pzeta |
---|
| 452 | ! |
---|
| 453 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 454 | REAL(wp) :: zzeta, zx, psi_unst, psi_stab, stab |
---|
| 455 | !!---------------------------------------------------------------------------------- |
---|
| 456 | ! |
---|
[13571] | 457 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[12615] | 458 | ! |
---|
| 459 | zzeta = MIN(pzeta(ji,jj) , 5._wp) ! Very stable conditions (L positif and big!): |
---|
| 460 | ! |
---|
| 461 | zx = ABS(1._wp - 16._wp*zzeta)**.25 ! this is actually (1/phi_m)**2 !!! |
---|
| 462 | ! ! eq.3.19, Chap.3, p.33, IFS doc - Cy31r1 |
---|
| 463 | ! Unstable (Paulson 1970) : |
---|
| 464 | psi_unst = 2._wp*LOG(0.5_wp*(1._wp + zx*zx)) ! eq.3.20, Chap.3, p.33, IFS doc - Cy31r1 |
---|
| 465 | ! |
---|
| 466 | ! Stable: |
---|
| 467 | psi_stab = -2._wp/3._wp*(zzeta - 5._wp/0.35_wp)*EXP(-0.35_wp*zzeta) & ! eq.3.22, Chap.3, p.33, IFS doc - Cy31r1 |
---|
| 468 | & - ABS(1._wp + 2._wp/3._wp*zzeta)**1.5_wp - 2._wp/3._wp*5._wp/0.35_wp + 1._wp |
---|
| 469 | ! LB: added ABS() to avoid NaN values when unstable, which contaminates the unstable solution... |
---|
| 470 | ! |
---|
| 471 | stab = 0.5_wp + SIGN(0.5_wp, zzeta) ! zzeta > 0 => stab = 1 |
---|
| 472 | ! |
---|
| 473 | ! |
---|
| 474 | psi_h_ecmwf(ji,jj) = (1._wp - stab) * psi_unst & ! (zzeta < 0) Unstable |
---|
| 475 | & + stab * psi_stab ! (zzeta > 0) Stable |
---|
| 476 | ! |
---|
[12377] | 477 | END_2D |
---|
[6723] | 478 | END FUNCTION psi_h_ecmwf |
---|
| 479 | |
---|
| 480 | |
---|
| 481 | !!====================================================================== |
---|
| 482 | END MODULE sbcblk_algo_ecmwf |
---|