CCPP SciDoc v7.0.x  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
sfc_diag_post.F90
1
3
6
7 contains
8
11#if 0
12
15#endif
16 subroutine sfc_diag_post_run (im, lsm, lsm_noahmp, opt_diag, dry, lssav, dtf, con_eps, con_epsm1, pgr,&
17 t2mmp,q2mp, t2m, q2m, u10m, v10m, tmpmin, tmpmax, spfhmin, spfhmax, &
18 wind10mmax, u10mmax, v10mmax, dpt2m, errmsg, errflg)
19
20 use machine, only: kind_phys, kind_dbl_prec
21
22 implicit none
23
24 integer, intent(in) :: im, lsm, lsm_noahmp,opt_diag
25 logical, intent(in) :: lssav
26 real(kind=kind_phys), intent(in) :: dtf, con_eps, con_epsm1
27 logical , dimension(:), intent(in) :: dry
28 real(kind=kind_phys), dimension(:), intent(in) :: pgr, u10m, v10m
29 real(kind=kind_phys), dimension(:), intent(inout) :: t2m, q2m, tmpmin, tmpmax, spfhmin, spfhmax
30 real(kind=kind_phys), dimension(:), intent(in), optional :: t2mmp, q2mp
31 real(kind=kind_phys), dimension(:), intent(inout) :: wind10mmax, u10mmax, v10mmax, dpt2m
32
33 character(len=*), intent(out) :: errmsg
34 integer, intent(out) :: errflg
35
36 integer :: i
37 real(kind=kind_dbl_prec) :: tem ! made dbl prec always, JM 20211104
38
39 ! Initialize CCPP error handling variables
40 errmsg = ''
41 errflg = 0
42
43 if (lsm == lsm_noahmp) then
44 if (opt_diag == 2 .or. opt_diag == 3) then
45 do i=1,im
46 if(dry(i)) then
47 t2m(i) = t2mmp(i)
48 q2m(i) = q2mp(i)
49 endif
50 enddo
51 endif
52 endif
53
54 if (lssav) then
55 do i=1,im
56 tmpmax(i) = max(tmpmax(i),t2m(i))
57 tmpmin(i) = min(tmpmin(i),t2m(i))
58 spfhmax(i) = max(spfhmax(i),q2m(i))
59 spfhmin(i) = min(spfhmin(i),q2m(i))
60 enddo
61 ! Find max wind speed then decompose
62 do i=1, im
63 tem = sqrt(u10m(i)*u10m(i) + v10m(i)*v10m(i))
64 if (tem > wind10mmax(i)) then
65 wind10mmax(i) = tem
66 u10mmax(i) = u10m(i)
67 v10mmax(i) = v10m(i)
68 endif
69 ! Compute dew point, first using vapor pressure
70 tem = max(pgr(i) * q2m(i) / ( con_eps - con_epsm1 *q2m(i)), 1.d-8)
71 dpt2m(i) = 243.5_kind_dbl_prec / &
72 ( ( 17.67_kind_dbl_prec / log(tem/611.2_kind_dbl_prec) ) - 1.) + 273.14
73 enddo
74 endif
75
76 end subroutine sfc_diag_post_run
78 end module sfc_diag_post
subroutine sfc_diag_post_run(im, lsm, lsm_noahmp, opt_diag, dry, lssav, dtf, con_eps, con_epsm1, pgr, t2mmp, q2mp, t2m, q2m, u10m, v10m, tmpmin, tmpmax, spfhmin, spfhmax, wind10mmax, u10mmax, v10mmax, dpt2m, errmsg, errflg)
This module contains code related to the surface diagnostic scheme.