146 qsat => atmos_saturation_dens2qsat_all
149 atmos_hydrometeor_lhv, &
150 atmos_hydrometeor_lhs, &
156 bulkflux_diagnose_surface
159 integer,
intent(in) :: IA, IS, IE
160 integer,
intent(in) :: JA, JS, JE
161 real(RP),
intent(in) :: TMPA (IA,JA)
162 real(RP),
intent(in) :: PRSA (IA,JA)
163 real(RP),
intent(in) :: WA (IA,JA)
164 real(RP),
intent(in) :: UA (IA,JA)
165 real(RP),
intent(in) :: VA (IA,JA)
166 real(RP),
intent(in) :: RHOA (IA,JA)
167 real(RP),
intent(in) :: QVA (IA,JA)
168 real(RP),
intent(in) :: LH (IA,JA)
169 real(RP),
intent(in) :: Z1 (IA,JA)
170 real(RP),
intent(in) :: PBL (IA,JA)
171 real(RP),
intent(in) :: RHOS (IA,JA)
172 real(RP),
intent(in) :: PRSS (IA,JA)
173 real(RP),
intent(in) :: RFLXD (IA,JA,N_RAD_DIR,N_RAD_RGN)
174 real(RP),
intent(in) :: TG (IA,JA)
175 real(RP),
intent(in) :: WSTR (IA,JA)
176 real(RP),
intent(in) :: QVEF (IA,JA)
177 real(RP),
intent(in) :: ALBEDO (IA,JA,N_RAD_DIR,N_RAD_RGN)
178 real(RP),
intent(in) :: Rb (IA,JA)
179 real(RP),
intent(in) :: TC_dZ (IA,JA)
180 real(RP),
intent(in) :: Z0M (IA,JA)
181 real(RP),
intent(in) :: Z0H (IA,JA)
182 real(RP),
intent(in) :: Z0E (IA,JA)
183 logical,
intent(in) :: calc_flag(IA,JA)
184 real(DP),
intent(in) :: dt_DP
185 character(len=*),
intent(in) :: model_name
187 real(RP),
intent(inout) :: TMPS (IA,JA)
189 real(RP),
intent(out) :: ZMFLX (IA,JA)
190 real(RP),
intent(out) :: XMFLX (IA,JA)
191 real(RP),
intent(out) :: YMFLX (IA,JA)
192 real(RP),
intent(out) :: SHFLX (IA,JA)
193 real(RP),
intent(out) :: LHFLX (IA,JA)
194 real(RP),
intent(out) :: QVFLX (IA,JA)
195 real(RP),
intent(out) :: GFLX (IA,JA)
196 real(RP),
intent(out) :: Ustar (IA,JA)
197 real(RP),
intent(out) :: Tstar (IA,JA)
198 real(RP),
intent(out) :: Qstar (IA,JA)
199 real(RP),
intent(out) :: Wstar (IA,JA)
200 real(RP),
intent(out) :: RLmo (IA,JA)
201 real(RP),
intent(out) :: U10 (IA,JA)
202 real(RP),
intent(out) :: V10 (IA,JA)
203 real(RP),
intent(out) :: T2 (IA,JA)
204 real(RP),
intent(out) :: Q2 (IA,JA)
206 real(RP),
parameter :: dTS0 = 1.0e-4_rp
207 real(RP),
parameter :: redf_min = 1.0e-3_rp
208 real(RP),
parameter :: redf_max = 1.0e+0_rp
209 real(RP),
parameter :: TFa = 0.5e+0_rp
210 real(RP),
parameter :: TFb = 1.1e+0_rp
212 real(RP) :: TMPS1(IA,JA)
234 real(RP) :: Uabs, dUabs
237 real(RP) :: QVsat, dQVsat
238 real(RP) :: QVS(IA,JA), dQVS
240 real(RP) :: FracU10(IA,JA), dFracU10
241 real(RP) :: FracT2 (IA,JA), dFracT2
242 real(RP) :: FracQ2 (IA,JA), dFracQ2
255 log_progress(*)
'coupler / physics / surface / SKIN'
267 tmps1(i,j) = tmps(i,j)
276 dt = real(dt_dp, kind=
rp)
277 olddts0 = max( 1.0_rp, cpl_phy_sfc_skin_dts_max * dt ) * 10.0_rp
303 if ( calc_flag(i,j) )
then
306 oldres = huge(0.0_rp)
311 do n = 1, cpl_phy_sfc_skin_itr_max
313 call qsat( tmps1(i,j), rhos(i,j), qvsat )
314 call qsat( tmps1(i,j)+dts0, rhos(i,j), dqvsat )
316 qvs(i,j) = ( 1.0_rp-qvef(i,j) ) * qva(i,j) &
317 + ( qvef(i,j) ) * qvsat
318 dqvs = ( 1.0_rp-qvef(i,j) ) * qva(i,j) &
319 + ( qvef(i,j) ) * dqvsat
321 uabs = sqrt( wa(i,j)**2 + ua(i,j)**2 +
va(i,j)**2 )
323 call bulkflux( tmpa(i,j), tmps1(i,j), &
324 prsa(i,j), prss(i,j), &
325 qva(i,j), qvs(i,j), &
326 uabs, z1(i,j), pbl(i,j), &
327 z0m(i,j), z0h(i,j), z0e(i,j), &
328 ustar(i,j), tstar(i,j), qstar(i,j), &
329 wstar(i,j), rlmo(i,j), ra, &
330 fracu10(i,j), fract2(i,j), fracq2(i,j) )
332 call bulkflux( tmpa(i,j), tmps1(i,j)+dts0, &
333 prsa(i,j), prss(i,j), &
335 uabs, z1(i,j), pbl(i,j), &
336 z0m(i,j), z0h(i,j), z0e(i,j), &
337 dustar, dtstar, dqstar, &
338 dwstar, drlmo, dra, &
339 dfracu10, dfract2, dfracq2, &
340 rlmo_in = rlmo(i,j), &
341 wstar_in = wstar(i,j) )
343 emis = ( 1.0_rp - albedo(i,j,i_r_diffuse,i_r_ir) ) * stb * tmps1(i,j)**4
345 lwd = rflxd(i,j,i_r_diffuse,i_r_ir)
346 lwu = rflxd(i,j,i_r_diffuse,i_r_ir) * albedo(i,j,i_r_diffuse,i_r_ir) + emis
347 swd = rflxd(i,j,i_r_direct ,i_r_nir) &
348 + rflxd(i,j,i_r_diffuse,i_r_nir) &
349 + rflxd(i,j,i_r_direct ,i_r_vis) &
350 + rflxd(i,j,i_r_diffuse,i_r_vis)
351 swu = rflxd(i,j,i_r_direct ,i_r_nir) * albedo(i,j,i_r_direct ,i_r_nir) &
352 + rflxd(i,j,i_r_diffuse,i_r_nir) * albedo(i,j,i_r_diffuse,i_r_nir) &
353 + rflxd(i,j,i_r_direct ,i_r_vis) * albedo(i,j,i_r_direct ,i_r_vis) &
354 + rflxd(i,j,i_r_diffuse,i_r_vis) * albedo(i,j,i_r_diffuse,i_r_vis)
357 flx_qv = min( - rhos(i,j) * ustar(i,j) * qstar(i,j) * ra / ( ra+rb(i,j) ), wstr(i,j)/dt )
358 res = swd - swu + lwd - lwu &
359 + cpdry * rhos(i,j) * ustar(i,j) * tstar(i,j) &
361 - tc_dz(i,j) * ( tmps1(i,j) - tg(i,j) )
364 dres = -4.0_rp * emis / tmps1(i,j) &
365 + cpdry * rhos(i,j) * ( ustar(i,j)*(dtstar-tstar(i,j))/dts0 + tstar(i,j)*(dustar-ustar(i,j))/dts0 ) &
366 - lh(i,j) * ( min( - rhos(i,j) * ( dustar * dqstar * dra / ( dra+rb(i,j) ) ), wstr(i,j)/dt ) - flx_qv ) / dts0 &
370 if ( abs(res ) < cpl_phy_sfc_skin_res_min &
371 .OR. abs(res/dres) < cpl_phy_sfc_skin_err_min )
then
376 if ( dres < 0.0_rp )
then
377 if ( abs(res) > abs(oldres) )
then
378 redf = max( tfa*abs(redf), redf_min )
380 redf = min( tfb*abs(redf), redf_max )
387 dts = - redf * res / dres
389 if ( res * oldres < 0.0_rp ) olddts = olddts * 0.8_rp
390 dts = sign( min( abs(dts), olddts ), dts )
392 tmps1(i,j) = tmps1(i,j) + dts
400 tmps1(i,j) = min( max( tmps1(i,j), &
401 tmps(i,j) - cpl_phy_sfc_skin_dts_max * dt ), &
402 tmps(i,j) + cpl_phy_sfc_skin_dts_max * dt )
404 if ( n > cpl_phy_sfc_skin_itr_max .and. debug )
then
407 log_warn(
"CPL_PHY_SFC_skin",*)
'surface tempearture was not converged. '
410 log_warn(
"CPL_PHY_SFC_skin",*)
'surface tempearture was not converged. ', trim(model_name)
412 log_warn_cont(
'(A,I32)' )
'number of i [no unit] :', i
413 log_warn_cont(
'(A,I32)' )
'number of j [no unit] :', j
415 log_warn_cont(
'(A,I32)' )
'loop number [no unit] :', n
416 log_warn_cont(
'(A,F32.16)')
'Residual [J/m2/s] :', res
417 log_warn_cont(
'(A,F32.16)')
'delta Residual [J/m2/s] :', dres
419 log_warn_cont(
'(A,F32.16)')
'temperature [K] :', tmpa(i,j)
420 log_warn_cont(
'(A,F32.16)')
'pressure [Pa] :', prsa(i,j)
421 log_warn_cont(
'(A,F32.16)')
'velocity w [m/s] :', wa(i,j)
422 log_warn_cont(
'(A,F32.16)')
'velocity u [m/s] :', ua(i,j)
423 log_warn_cont(
'(A,F32.16)')
'velocity v [m/s] :',
va(i,j)
424 log_warn_cont(
'(A,F32.16)')
'absolute velocity [m/s] :', uabs
425 log_warn_cont(
'(A,F32.16)')
'density [kg/m3] :', rhoa(i,j)
426 log_warn_cont(
'(A,F32.16)')
'water vapor mass ratio [kg/kg] :', qva(i,j)
427 log_warn_cont(
'(A,F32.16)')
'cell center height [m] :', z1(i,j)
428 log_warn_cont(
'(A,F32.16)')
'atmospheric mixing layer height [m] :', pbl(i,j)
429 log_warn_cont(
'(A,F32.16)')
'pressure at the surface [Pa] :', prss(i,j)
430 log_warn_cont(
'(A,F32.16)')
'downward radiation (IR, direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_ir )
431 log_warn_cont(
'(A,F32.16)')
'downward radiation (IR, diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_ir )
432 log_warn_cont(
'(A,F32.16)')
'downward radiation (NIR,direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_nir)
433 log_warn_cont(
'(A,F32.16)')
'downward radiation (NIR,diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_nir)
434 log_warn_cont(
'(A,F32.16)')
'downward radiation (VIS,direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_vis)
435 log_warn_cont(
'(A,F32.16)')
'downward radiation (VIS,diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_vis)
437 log_warn_cont(
'(A,F32.16)')
'soil temperature [K] :', tg(i,j)
438 log_warn_cont(
'(A,F32.16)')
'soil water [kg/m2] :', wstr(i,j)
439 log_warn_cont(
'(A,F32.16)')
'surface temperature [K] :', tmps(i,j)
440 log_warn_cont(
'(A,F32.16)')
'surface density [kg/m3] :', rhos(i,j)
441 log_warn_cont(
'(A,F32.16)')
'efficiency of evaporation [1] :', qvef(i,j)
442 log_warn_cont(
'(A,F32.16)')
'surface albedo (IR, direct ) [1] :', albedo(i,j,i_r_direct ,i_r_ir )
443 log_warn_cont(
'(A,F32.16)')
'surface albedo (IR, diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_ir )
444 log_warn_cont(
'(A,F32.16)')
'surface albedo (NIR,direct ) [1] :', albedo(i,j,i_r_direct ,i_r_nir)
445 log_warn_cont(
'(A,F32.16)')
'surface albedo (NIR,diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_nir)
446 log_warn_cont(
'(A,F32.16)')
'surface albedo (VIS,direct ) [1] :', albedo(i,j,i_r_direct ,i_r_vis)
447 log_warn_cont(
'(A,F32.16)')
'surface albedo (VIS,diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_vis)
448 log_warn_cont(
'(A,F32.16)')
'latent heat [J/kg] :', lh(i,j)
449 log_warn_cont(
'(A,F32.16)')
'stomata registance [1/s] :', rb(i,j)
450 log_warn_cont(
'(A,F32.16)')
'thermal conductivity / depth [J/m2/s/K] :', tc_dz(i,j)
451 log_warn_cont(
'(A,F32.16)')
'roughness length for momemtum [m] :', z0m(i,j)
452 log_warn_cont(
'(A,F32.16)')
'roughness length for heat [m] :', z0h(i,j)
453 log_warn_cont(
'(A,F32.16)')
'roughness length for vapor [m] :', z0e(i,j)
454 log_warn_cont(
'(A,F32.16)')
'time step [s] :', dt
456 log_warn_cont(
'(A,F32.16)')
'friction velocity [m/s] :', ustar(i,j)
457 log_warn_cont(
'(A,F32.16)')
'friction potential temperature [K] :', tstar(i,j)
458 log_warn_cont(
'(A,F32.16)')
'friction water vapor mass ratio [kg/kg] :', qstar(i,j)
459 log_warn_cont(
'(A,F32.16)')
'free convection velocity scale [m/s] :', wstar(i,j)
460 log_warn_cont(
'(A,F32.16)')
'd(friction velocity) [m/s] :', dustar
461 log_warn_cont(
'(A,F32.16)')
'd(friction potential temperature) [K] :', dtstar
462 log_warn_cont(
'(A,F32.16)')
'd(friction water vapor mass ratio) [kg/kg] :', dqstar
463 log_warn_cont(
'(A,F32.16)')
'd(free convection velocity scale) [m/s] :', dwstar
464 log_warn_cont(
'(A,F32.16)')
'next surface temperature [K] :', tmps1(i,j)
468 if ( .NOT. ( res > -1.0_rp .OR. res < 1.0_rp ) )
then
472 log_error(
"CPL_PHY_SFC_skin",*)
'NaN is detected for surface temperature. ', trim(model_name)
473 log_error_cont(
'(A,I32)' )
'number of i [no unit] :', i
474 log_error_cont(
'(A,I32)' )
'number of j [no unit] :', j
475 log_error_cont(
'(A,I32)' )
'loop number [no unit] :', n
476 log_error_cont(
'(A,F32.16)')
'temperature [K] :', tmpa(i,j)
477 log_error_cont(
'(A,F32.16)')
'pressure [Pa] :', prsa(i,j)
478 log_error_cont(
'(A,F32.16)')
'velocity w [m/s] :', wa(i,j)
479 log_error_cont(
'(A,F32.16)')
'velocity u [m/s] :', ua(i,j)
480 log_error_cont(
'(A,F32.16)')
'velocity v [m/s] :',
va(i,j)
481 log_error_cont(
'(A,F32.16)')
'absolute velocity [m/s] :', uabs
482 log_error_cont(
'(A,F32.16)')
'density [kg/m3] :', rhoa(i,j)
483 log_error_cont(
'(A,F32.16)')
'water vapor mass ratio [kg/kg] :', qva(i,j)
484 log_error_cont(
'(A,F32.16)')
'cell center height [m] :', z1(i,j)
485 log_error_cont(
'(A,F32.16)')
'atmospheric mixing layer height [m] :', pbl(i,j)
486 log_error_cont(
'(A,F32.16)')
'pressure at the surface [Pa] :', prss(i,j)
487 log_error_cont(
'(A,F32.16)')
'downward radiation (IR, direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_ir )
488 log_error_cont(
'(A,F32.16)')
'downward radiation (IR, diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_ir )
489 log_error_cont(
'(A,F32.16)')
'downward radiation (NIR,direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_nir)
490 log_error_cont(
'(A,F32.16)')
'downward radiation (NIR,diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_nir)
491 log_error_cont(
'(A,F32.16)')
'downward radiation (VIS,direct ) [J/m2/s] :', rflxd(i,j,i_r_direct ,i_r_vis)
492 log_error_cont(
'(A,F32.16)')
'downward radiation (VIS,diffuse) [J/m2/s] :', rflxd(i,j,i_r_diffuse,i_r_vis)
493 log_error_cont(
'(A,F32.16)')
'soil temperature [K] :', tg(i,j)
494 log_error_cont(
'(A,F32.16)')
'soil water [kg/m2] :', wstr(i,j)
495 log_error_cont(
'(A,F32.16)')
'surface temperature [K] :', tmps(i,j)
496 log_error_cont(
'(A,F32.16)')
'surface density [kg/m3] :', rhos(i,j)
497 log_error_cont(
'(A,F32.16)')
'efficiency of evaporation [1] :', qvef(i,j)
498 log_error_cont(
'(A,F32.16)')
'surface albedo (IR, direct ) [1] :', albedo(i,j,i_r_direct ,i_r_ir )
499 log_error_cont(
'(A,F32.16)')
'surface albedo (IR, diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_ir )
500 log_error_cont(
'(A,F32.16)')
'surface albedo (NIR,direct ) [1] :', albedo(i,j,i_r_direct ,i_r_nir)
501 log_error_cont(
'(A,F32.16)')
'surface albedo (NIR,diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_nir)
502 log_error_cont(
'(A,F32.16)')
'surface albedo (VIS,direct ) [1] :', albedo(i,j,i_r_direct ,i_r_vis)
503 log_error_cont(
'(A,F32.16)')
'surface albedo (VIS,diffuse) [1] :', albedo(i,j,i_r_diffuse,i_r_vis)
504 log_error_cont(
'(A,F32.16)')
'latent heat [J/kg] :', lh(i,j)
505 log_error_cont(
'(A,F32.16)')
'stomata registance [1/s] :', rb(i,j)
506 log_error_cont(
'(A,F32.16)')
'thermal conductivity / depth [J/m2/s/K] :', tc_dz(i,j)
507 log_error_cont(
'(A,F32.16)')
'roughness length for momemtum [m] :', z0m(i,j)
508 log_error_cont(
'(A,F32.16)')
'roughness length for heat [m] :', z0h(i,j)
509 log_error_cont(
'(A,F32.16)')
'roughness length for vapor [m] :', z0e(i,j)
510 log_error_cont(
'(A,F32.16)')
'time step [s] :', dt
511 log_error_cont(
'(A,F32.16)')
'friction velocity [m/s] :', ustar(i,j)
512 log_error_cont(
'(A,F32.16)')
'friction potential temperature [K] :', tstar(i,j)
513 log_error_cont(
'(A,F32.16)')
'friction water vapor mass ratio [kg/kg] :', qstar(i,j)
514 log_error_cont(
'(A,F32.16)')
'free convection velocity scale [m/s] :', wstar(i,j)
515 log_error_cont(
'(A,F32.16)')
'd(friction velocity) [m/s] :', dustar
516 log_error_cont(
'(A,F32.16)')
'd(friction potential temperature) [K] :', dtstar
517 log_error_cont(
'(A,F32.16)')
'd(friction water vapor mass ratio) [kg/kg] :', dqstar
518 log_error_cont(
'(A,F32.16)')
'd(free convection velocity scale) [m/s] :', dwstar
519 log_error_cont(
'(A,F32.16)')
'next surface temperature [K] :', tmps1(i,j)
526 tmps(i,j) = tmps1(i,j)
528 call qsat( tmps(i,j), rhos(i,j), qvsat )
530 qvs(i,j) = ( 1.0_rp-qvef(i,j) ) * qva(i,j) &
531 + ( qvef(i,j) ) * qvsat
533 call bulkflux( tmpa(i,j), tmps(i,j), &
534 prsa(i,j), prss(i,j), &
535 qva(i,j), qvs(i,j), &
536 uabs, z1(i,j), pbl(i,j), &
537 z0m(i,j), z0h(i,j), z0e(i,j), &
538 ustar(i,j), tstar(i,j), qstar(i,j), &
539 wstar(i,j), rlmo(i,j), ra, &
540 fracu10(i,j), fract2(i,j), fracq2(i,j) )
542 if ( uabs < eps )
then
547 mflux = - rhos(i,j) * ustar(i,j)**2
548 zmflx(i,j) = mflux * wa(i,j) / uabs
549 xmflx(i,j) = mflux * ua(i,j) / uabs
550 ymflx(i,j) = mflux *
va(i,j) / uabs
552 shflx(i,j) = -rhos(i,j) * ustar(i,j) * tstar(i,j) * cpdry
553 qvflx(i,j) = min( - rhos(i,j) * ustar(i,j) * qstar(i,j) * ra / ( ra+rb(i,j) ), wstr(i,j)/dt )
555 emis = ( 1.0_rp-albedo(i,j,i_r_diffuse,i_r_ir) ) * stb * tmps(i,j)**4
557 lwd = rflxd(i,j,i_r_diffuse,i_r_ir)
558 lwu = rflxd(i,j,i_r_diffuse,i_r_ir) * albedo(i,j,i_r_diffuse,i_r_ir) + emis
559 swd = rflxd(i,j,i_r_direct ,i_r_nir) &
560 + rflxd(i,j,i_r_diffuse,i_r_nir) &
561 + rflxd(i,j,i_r_direct ,i_r_vis) &
562 + rflxd(i,j,i_r_diffuse,i_r_vis)
563 swu = rflxd(i,j,i_r_direct ,i_r_nir) * albedo(i,j,i_r_direct ,i_r_nir) &
564 + rflxd(i,j,i_r_diffuse,i_r_nir) * albedo(i,j,i_r_diffuse,i_r_nir) &
565 + rflxd(i,j,i_r_direct ,i_r_vis) * albedo(i,j,i_r_direct ,i_r_vis) &
566 + rflxd(i,j,i_r_diffuse,i_r_vis) * albedo(i,j,i_r_diffuse,i_r_vis)
568 gflx(i,j) = tc_dz(i,j) * ( tmps(i,j) - tg(i,j) )
570 lhflx(i,j) = qvflx(i,j) * lh(i,j)
574 res = swd - swu + lwd - lwu - shflx(i,j) - lhflx(i,j) - gflx(i,j)
577 gflx(i,j) = gflx(i,j) + res
603 log_error(
"CPL_PHY_SFC_skin",*)
'NaN is detected for surface temperature. ', trim(model_name)
608 call bulkflux_diagnose_surface(
ia,
is,
ie,
ja,
js,
je, &
610 tmpa(:,:), qva(:,:), &
611 tmps(:,:), qvs(:,:), &
612 z1(:,:), z0m(:,:), z0h(:,:), z0e(:,:), &
613 u10(:,:), v10(:,:), t2(:,:), q2(:,:), &
614 mask = calc_flag(:,:), &
615 fracu10 = fracu10(:,:), &
616 fract2 = fract2(:,:), &
617 fracq2 = fracq2(:,:) )