"git@forge.nemo-ocean.eu:hatfield/nemo.git" did not exist on "66fb952320b8b44ab4000991170351c57fb912fd"
Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
FUNCTION qlw_net_sclr( pdwlw, pts, l_ice )
!!---------------------------------------------------------------------------------
!! *** FUNCTION qlw_net_sclr ***
!!
!! ** Purpose : Estimate of the net longwave flux at the surface
!!----------------------------------------------------------------------------------
REAL(wp) :: qlw_net_sclr
REAL(wp), INTENT(in) :: pdwlw !: downwelling longwave (aka infrared, aka thermal) radiation [W/m^2]
REAL(wp), INTENT(in) :: pts !: surface temperature [K]
LOGICAL, INTENT(in), OPTIONAL :: l_ice !: we are above ice
REAL(wp) :: zemiss, zt2
LOGICAL :: lice
!!----------------------------------------------------------------------------------
lice = .FALSE.
IF( PRESENT(l_ice) ) lice = l_ice
IF( lice ) THEN
zemiss = emiss_i
ELSE
zemiss = emiss_w
END IF
zt2 = pts*pts
qlw_net_sclr = zemiss*( pdwlw - stefan*zt2*zt2) ! zemiss used both as the IR albedo and IR emissivity...

Guillaume Samson
committed

Guillaume Samson
committed

Guillaume Samson
committed
REAL(wp), DIMENSION(jpi,jpj) :: qlw_net_vctr
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pdwlw !: downwelling longwave (aka infrared, aka thermal) radiation [W/m^2]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pts !: surface temperature [K]
LOGICAL, INTENT(in), OPTIONAL :: l_ice !: we are above ice
LOGICAL :: lice
INTEGER :: ji, jj
!!----------------------------------------------------------------------------------
lice = .FALSE.
IF( PRESENT(l_ice) ) lice = l_ice
DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )

Guillaume Samson
committed
qlw_net_vctr(ji,jj) = qlw_net_sclr( pdwlw(ji,jj) , pts(ji,jj), l_ice=lice )

Guillaume Samson
committed

Guillaume Samson
committed

Guillaume Samson
committed
REAL(wp), DIMENSION(jpi,jpj) :: z0_from_Cd !: roughness length [m]
REAL(wp) , INTENT(in) :: pzu !: reference height zu [m]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pCd !: (neutral or non-neutral) drag coefficient []
REAL(wp), DIMENSION(jpi,jpj), INTENT(in), OPTIONAL :: ppsi !: "Psi_m(pzu/L)" stability correction profile for momentum []
!!
!! If pCd is the NEUTRAL-STABILITY drag coefficient then ppsi must be 0 or not given
!! If pCd is the drag coefficient (in stable or unstable conditions) then pssi must be provided
!!----------------------------------------------------------------------------------
IF( PRESENT(ppsi) ) THEN
!! Cd provided is the actual Cd (not the neutral-stability CdN) :
z0_from_Cd = pzu * EXP( - ( vkarmn/SQRT(pCd(:,:)) + ppsi(:,:) ) ) !LB: ok, double-checked!
ELSE
!! Cd provided is the neutral-stability Cd, aka CdN :
z0_from_Cd = pzu * EXP( - vkarmn/SQRT(pCd(:,:)) ) !LB: ok, double-checked!
END IF

Guillaume Samson
committed

Guillaume Samson
committed

Guillaume Samson
committed
REAL(wp), DIMENSION(jpi,jpj) :: Cd_from_z0 !: (neutral or non-neutral) drag coefficient []
REAL(wp) , INTENT(in) :: pzu !: reference height zu [m]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0 !: roughness length [m]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in), OPTIONAL :: ppsi !: "Psi_m(pzu/L)" stability correction profile for momentum []
!!
!! If we want to return the NEUTRAL-STABILITY drag coefficient then ppsi must be 0 or not given
!! If we want to return the stability-corrected Cd (i.e. in stable or unstable conditions) then pssi must be provided
!!----------------------------------------------------------------------------------
IF( PRESENT(ppsi) ) THEN
!! The Cd we return is the actual Cd (not the neutral-stability CdN) :
Cd_from_z0 = 1._wp / ( LOG( pzu / pz0(:,:) ) - ppsi(:,:) )
ELSE
!! The Cd we return is the neutral-stability Cd, aka CdN :
Cd_from_z0 = 1._wp / LOG( pzu / pz0(:,:) )
END IF
Cd_from_z0 = vkarmn2 * Cd_from_z0 * Cd_from_z0

Guillaume Samson
committed
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
END FUNCTION Cd_from_z0
FUNCTION f_m_louis_sclr( pzu, pRib, pCdn, pz0 )
!!----------------------------------------------------------------------------------
!! Stability correction function for MOMENTUM
!! Louis (1979)
!!----------------------------------------------------------------------------------
REAL(wp) :: f_m_louis_sclr ! term "f_m" in Eq.(6) when option "Louis" rather than "Psi(zeta) is chosen, Lupkes & Gryanik (2015),
REAL(wp), INTENT(in) :: pzu ! reference height (height for pwnd) [m]
REAL(wp), INTENT(in) :: pRib ! Bulk Richardson number
REAL(wp), INTENT(in) :: pCdn ! neutral drag coefficient
REAL(wp), INTENT(in) :: pz0 ! roughness length [m]
!!----------------------------------------------------------------------------------
REAL(wp) :: ztu, zts, zstab
!!----------------------------------------------------------------------------------
zstab = 0.5 + SIGN(0.5_wp, pRib) ; ! Unstable (Ri<0) => zstab = 0 | Stable (Ri>0) => zstab = 1
!
ztu = pRib / ( 1._wp + 3._wp * rc2_louis * pCdn * SQRT( ABS( -pRib * ( pzu / pz0 + 1._wp) ) ) ) ! ABS is just here for when it's stable conditions and ztu is not used anyways
zts = pRib / SQRT( ABS( 1._wp + pRib ) ) ! ABS is just here for when it's UNstable conditions and zts is not used anyways
!
f_m_louis_sclr = (1._wp - zstab) * ( 1._wp - ram_louis * ztu ) & ! Unstable Eq.(A6)
& + zstab * 1._wp / ( 1._wp + ram_louis * zts ) ! Stable Eq.(A7)
!
END FUNCTION f_m_louis_sclr

Guillaume Samson
committed

Guillaume Samson
committed
REAL(wp), DIMENSION(jpi,jpj) :: f_m_louis_vctr
REAL(wp), INTENT(in) :: pzu
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pRib
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pCdn
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0
INTEGER :: ji, jj

Guillaume Samson
committed

Guillaume Samson
committed
f_m_louis_vctr(ji,jj) = f_m_louis_sclr( pzu, pRib(ji,jj), pCdn(ji,jj), pz0(ji,jj) )

Guillaume Samson
committed
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
END FUNCTION f_m_louis_vctr
FUNCTION f_h_louis_sclr( pzu, pRib, pChn, pz0 )
!!----------------------------------------------------------------------------------
!! Stability correction function for HEAT
!! Louis (1979)
!!----------------------------------------------------------------------------------
REAL(wp) :: f_h_louis_sclr ! term "f_h" in Eq.(6) when option "Louis" rather than "Psi(zeta) is chosen, Lupkes & Gryanik (2015),
REAL(wp), INTENT(in) :: pzu ! reference height (height for pwnd) [m]
REAL(wp), INTENT(in) :: pRib ! Bulk Richardson number
REAL(wp), INTENT(in) :: pChn ! neutral heat transfer coefficient
REAL(wp), INTENT(in) :: pz0 ! roughness length [m]
!!----------------------------------------------------------------------------------
REAL(wp) :: ztu, zts, zstab
!!----------------------------------------------------------------------------------
zstab = 0.5 + SIGN(0.5_wp, pRib) ; ! Unstable (Ri<0) => zstab = 0 | Stable (Ri>0) => zstab = 1
!
ztu = pRib / ( 1._wp + 3._wp * rc2_louis * pChn * SQRT( ABS(-pRib * ( pzu / pz0 + 1._wp) ) ) )
zts = pRib / SQRT( ABS( 1._wp + pRib ) )
!
f_h_louis_sclr = (1._wp - zstab) * ( 1._wp - rah_louis * ztu ) & ! Unstable Eq.(A6)
& + zstab * 1._wp / ( 1._wp + rah_louis * zts ) ! Stable Eq.(A7) !#LB: in paper it's "ram_louis" and not "rah_louis" typo or what????
!
END FUNCTION f_h_louis_sclr

Guillaume Samson
committed

Guillaume Samson
committed
REAL(wp), DIMENSION(jpi,jpj) :: f_h_louis_vctr
REAL(wp), INTENT(in) :: pzu
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pRib
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pChn
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0
INTEGER :: ji, jj

Guillaume Samson
committed

Guillaume Samson
committed
f_h_louis_vctr(ji,jj) = f_h_louis_sclr( pzu, pRib(ji,jj), pChn(ji,jj), pz0(ji,jj) )

Guillaume Samson
committed

Guillaume Samson
committed
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
FUNCTION UN10_from_ustar( pzu, pUzu, pus, ppsi )
!!----------------------------------------------------------------------------------
!! Provides the neutral-stability wind speed at 10 m
!!----------------------------------------------------------------------------------
REAL(wp), DIMENSION(jpi,jpj) :: UN10_from_ustar !: neutral stability wind speed at 10m [m/s]
REAL(wp), INTENT(in) :: pzu !: measurement heigh of wind speed [m]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pUzu !: bulk wind speed at height pzu m [m/s]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pus !: friction velocity [m/s]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ppsi !: "Psi_m(pzu/L)" stability correction profile for momentum []
!!----------------------------------------------------------------------------------
UN10_from_ustar(:,:) = pUzu(:,:) - pus(:,:)/vkarmn * ( LOG(pzu/10._wp) - ppsi(:,:) )
!!
END FUNCTION UN10_from_ustar
FUNCTION UN10_from_CD( pzu, pUb, pCd, ppsi )
!!----------------------------------------------------------------------------------
!! Provides the neutral-stability wind speed at 10 m
!!----------------------------------------------------------------------------------
REAL(wp), DIMENSION(jpi,jpj) :: UN10_from_CD !: [m/s]
REAL(wp), INTENT(in) :: pzu !: measurement heigh of bulk wind speed
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pUb !: bulk wind speed at height pzu m [m/s]
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pCd !: drag coefficient
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: ppsi !: "Psi_m(pzu/L)" stability correction profile for momentum []
!!----------------------------------------------------------------------------------
!! Reminder: UN10 = u*/vkarmn * log(10/z0)
!! and: u* = sqrt(Cd) * Ub
!! u*/vkarmn * log( 10 / z0 )
UN10_from_CD(:,:) = SQRT(pCd(:,:))*pUb/vkarmn * LOG( 10._wp / z0_from_Cd( pzu, pCd(:,:), ppsi=ppsi(:,:) ) )
!!
END FUNCTION UN10_from_CD
FUNCTION z0tq_LKB( iflag, pRer, pz0 )
!!---------------------------------------------------------------------------------
!! *** FUNCTION z0tq_LKB ***
!!
!! ** Purpose : returns the "temperature/humidity roughness lengths"
!! * iflag==1 => temperature => returns: z_{0t}
!! * iflag==2 => humidity => returns: z_{0q}
!! from roughness reynold number "pRer" (i.e. [z_0 u*]/Nu_{air})
!! between 0 and 1000. Out of range "pRer" indicated by prt=-999.
!! and roughness length (for momentum)
!!
!! Based on Liu et al. (1979) JAS 36 1722-1723s
!!
!! Note: this is what is used into COARE 2.5 to estimate z_{0t} and z_{0q}
!!
!! ** Author: L. Brodeau, April 2020 / AeroBulk (https://github.com/brodeau/aerobulk/)
!!----------------------------------------------------------------------------------
REAL(wp), DIMENSION(jpi,jpj) :: z0tq_LKB
INTEGER, INTENT(in) :: iflag !: 1 => dealing with temperature; 2 => dealing with humidity
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pRer !: roughness Reynolds number [z_0 u*]/Nu_{air}
REAL(wp), DIMENSION(jpi,jpj), INTENT(in) :: pz0 !: roughness length (for momentum) [m]
!-------------------------------------------------------------------
! Scalar Re_r relation from Liu et al.
REAL(wp), DIMENSION(8,2), PARAMETER :: &
& XA = RESHAPE( (/ 0.177, 1.376, 1.026, 1.625, 4.661, 34.904, 1667.19, 5.88e5, &
& 0.292, 1.808, 1.393, 1.956, 4.994, 30.709, 1448.68, 2.98e5 /), (/8,2/) )
!!
REAL(wp), DIMENSION(8,2), PARAMETER :: &
& XB = RESHAPE( (/ 0., 0.929, -0.599, -1.018, -1.475, -2.067, -2.907, -3.935, &
& 0., 0.826, -0.528, -0.870, -1.297, -1.845, -2.682, -3.616 /), (/8,2/) )
!!
REAL(wp), DIMENSION(0:8), PARAMETER :: &
& XRAN = (/ 0., 0.11, 0.825, 3.0, 10.0, 30.0, 100., 300., 1000. /)
!-------------------------------------------------------------------
!
!-------------------------------------------------------------------
! Scalar Re_r relation from Moana Wave data.
!
! real*8 A(9,2),B(9,2),RAN(9),pRer,prt
! integer iflag
! DATA A/0.177,2.7e3,1.03,1.026,1.625,4.661,34.904,1667.19,5.88E5,
! & 0.292,3.7e3,1.4,1.393,1.956,4.994,30.709,1448.68,2.98E5/
! DATA B/0.,4.28,0,-0.599,-1.018,-1.475,-2.067,-2.907,-3.935,
! & 0.,4.28,0,-0.528,-0.870,-1.297,-1.845,-2.682,-3.616/
! DATA RAN/0.11,.16,1.00,3.0,10.0,30.0,100.,300.,1000./
!-------------------------------------------------------------------
LOGICAL :: lfound=.FALSE.
REAL(wp) :: zrr
INTEGER :: ji, jj, jm
z0tq_LKB(:,:) = -999._wp
DO_2D( nn_hls, nn_hls, nn_hls, nn_hls )
zrr = pRer(ji,jj)
lfound = .FALSE.
IF( (zrr > 0.).AND.(zrr < 1000.) ) THEN
jm = 0
DO WHILE ( .NOT. lfound )
jm = jm + 1
lfound = ( (zrr > XRAN(jm-1)) .AND. (zrr <= XRAN(jm)) )
END DO
z0tq_LKB(ji,jj) = XA(jm,iflag)*zrr**XB(jm,iflag) * pz0(ji,jj)/zrr
END IF
END_2D
z0tq_LKB(:,:) = MIN( MAX(ABS(z0tq_LKB(:,:)), 1.E-9) , 0.05_wp )
END FUNCTION z0tq_LKB

Guillaume Samson
committed