From bdf4f8e4e9b88f1e846753e47abafa2df7eae24c Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Thu, 19 Dec 2019 20:13:30 +0000 Subject: [PATCH 01/12] add qdiag3d support --- physics/GFS_MP_generic.F90 | 31 ++++++++++++++++++++----------- physics/GFS_MP_generic.meta | 16 ++++++++++++++++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/physics/GFS_MP_generic.F90 b/physics/GFS_MP_generic.F90 index a7afa2ee0..ea2ef6c16 100644 --- a/physics/GFS_MP_generic.F90 +++ b/physics/GFS_MP_generic.F90 @@ -16,13 +16,13 @@ end subroutine GFS_MP_generic_pre_init !> \section arg_table_GFS_MP_generic_pre_run Argument Table !! \htmlinclude GFS_MP_generic_pre_run.html !! - subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, do_aw, ntcw, nncl, ntrac, gt0, gq0, save_t, save_q, errmsg, errflg) + subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, ntrac, gt0, gq0, save_t, save_q, errmsg, errflg) ! use machine, only: kind_phys implicit none integer, intent(in) :: im, levs, ntcw, nncl, ntrac - logical, intent(in) :: ldiag3d, do_aw + logical, intent(in) :: ldiag3d, qdiag3d, do_aw real(kind=kind_phys), dimension(im, levs), intent(in) :: gt0 real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: gq0 @@ -42,12 +42,14 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, do_aw, ntcw, nncl, ntrac, g do k=1,levs do i=1,im save_t(i,k) = gt0(i,k) - save_q(1:im,:,1) = gq0(1:im,:,1) enddo enddo - do n=ntcw,ntcw+nncl-1 - save_q(1:im,:,n) = gq0(1:im,:,n) - enddo + if(do_aw .or. (qdiag3d .and. ldiag3d)) then + save_q(1:im,:,1) = gq0(1:im,:,1) + do n=ntcw,ntcw+nncl-1 + save_q(1:im,:,n) = gq0(1:im,:,n) + enddo + endif endif end subroutine GFS_MP_generic_pre_run @@ -81,7 +83,7 @@ end subroutine GFS_MP_generic_post_init !> \section gfs_mp_gen GFS MP Generic Post General Algorithm !> @{ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, & - imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires, cal_pre, lssav, ldiag3d, cplflx, cplchm, con_g, dtf, frain, rainc, rain1, & + imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires, cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm, con_g, dtf, frain, rainc, rain1, & rann, xlat, xlon, gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, rain0, ice0, snow0, & graupel0, del, rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, sr, cnvprcp, totprcp, totice, & totsnw, totgrp, cnvprcpb, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, & @@ -94,7 +96,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt integer, intent(in) :: im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_mg, imp_physics_fer_hires - logical, intent(in) :: cal_pre, lssav, ldiag3d, cplflx, cplchm + logical, intent(in) :: cal_pre, lssav, ldiag3d, qdiag3d, cplflx, cplchm real(kind=kind_phys), intent(in) :: dtf, frain, con_g real(kind=kind_phys), dimension(im), intent(in) :: rainc, rain1, xlat, xlon, tsfc @@ -110,8 +112,9 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt srflag, cnvprcp, totprcp, totice, totsnw, totgrp, cnvprcpb, & totprcpb, toticeb, totsnwb, totgrpb, rain_cpl, rainc_cpl, & snow_cpl, pwat - ! These arrays are only allocated if ldiag3d is .true. - real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt + + real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt ! only if ldiag3d + real(kind=kind_phys), dimension(:,:), intent(inout) :: dq3dt ! only if ldiag3d and qdiag3d ! Stochastic physics / surface perturbations logical, intent(in) :: do_sppt @@ -256,9 +259,15 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain -! dq3dt(i,k) = dq3dt(i,k) + (gq0(i,k,1)-save_qv(i,k)) * frain enddo enddo + if (qdiag3d) then + do k=1,levs + do i=1,im + dq3dt(i,k) = dq3dt(i,k) + (gq0(i,k,1)-save_qv(i,k)) * frain + enddo + enddo + endif endif endif diff --git a/physics/GFS_MP_generic.meta b/physics/GFS_MP_generic.meta index 3a11a9983..1ac030bc7 100644 --- a/physics/GFS_MP_generic.meta +++ b/physics/GFS_MP_generic.meta @@ -30,6 +30,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = logical flag for 3D tracer diagnostics + units = flag + dimensions = () + type = logical + intent = in + optional = F [do_aw] standard_name = flag_for_Arakawa_Wu_adjustment long_name = flag for Arakawa Wu scale-aware adjustment @@ -266,6 +274,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = logical flag for 3D tracer diagnostics + units = flag + dimensions = () + type = logical + intent = in + optional = F [cplflx] standard_name = flag_for_flux_coupling long_name = flag controlling cplflx collection (default off) From a48681459256779bdf2a95b6fb46916afd6df158 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Fri, 27 Dec 2019 19:03:29 +0000 Subject: [PATCH 02/12] several missing changes for qdiag3d support --- physics/GFS_PBL_generic.F90 | 19 +++++++++++++++++-- physics/GFS_PBL_generic.meta | 8 ++++++++ physics/GFS_SCNV_generic.F90 | 32 +++++++++++++++++++------------- physics/GFS_SCNV_generic.meta | 16 ++++++++++++++++ physics/rayleigh_damp.f | 25 +++++++++++++++++++------ physics/rayleigh_damp.meta | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 114 insertions(+), 21 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index 4bebae589..d31dbafec 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -281,7 +281,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, trans_aero, ntchs, ntchm, & imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg, & imp_physics_fer_hires, & - ltaerosol, cplflx, cplchm, lssav, ldiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & + ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu, & dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, & dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, dqsfc_diag, & @@ -299,7 +299,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, logical, intent(in) :: trans_aero integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6 integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires - logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, lsidea + logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu real(kind=kind_phys), intent(in) :: dtf @@ -571,6 +571,21 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, dv3dt_OGWD(i,k) = dv3dt_OGWD(i,k) - dvdt(i,k) * dtf enddo enddo + if (qdiag3d) then + do k=1,levs + do i=1,im + tem = dqdt(i,k,ntqv) * dtf + dq3dt(i,k) = dq3dt(i,k) + tem + enddo + enddo + if (ntoz > 0) then + do k=1,levs + do i=1,im + dq3dt_ozone(i,k) = dq3dt_ozone(i,k) + dqdt(i,k,ntoz) * dtf + enddo + enddo + endif + endif endif endif ! end if_lssav diff --git a/physics/GFS_PBL_generic.meta b/physics/GFS_PBL_generic.meta index 51764e04d..ae86b0dce 100644 --- a/physics/GFS_PBL_generic.meta +++ b/physics/GFS_PBL_generic.meta @@ -617,6 +617,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [lsidea] standard_name = flag_idealized_physics long_name = flag for idealized physics diff --git a/physics/GFS_SCNV_generic.F90 b/physics/GFS_SCNV_generic.F90 index 0cb1ac06f..1cbff590e 100644 --- a/physics/GFS_SCNV_generic.F90 +++ b/physics/GFS_SCNV_generic.F90 @@ -14,7 +14,7 @@ end subroutine GFS_SCNV_generic_pre_finalize !> \section arg_table_GFS_SCNV_generic_pre_run Argument Table !! \htmlinclude GFS_SCNV_generic_pre_run.html !! - subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, gt0, gq0_water_vapor, & + subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gt0, gq0_water_vapor, & save_t, save_qv, errmsg, errflg) use machine, only: kind_phys @@ -22,7 +22,7 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, gt0, gq0_water_vapor, & implicit none integer, intent(in) :: im, levs - logical, intent(in) :: ldiag3d + logical, intent(in) :: ldiag3d, qdiag3d real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, gq0_water_vapor real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t, save_qv @@ -41,14 +41,14 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, gt0, gq0_water_vapor, & save_t(i,k) = gt0(i,k) enddo enddo - endif -! if (ldiag3d) then -! do k=1,levs -! do i=1,im -! save_qv(i,k) = gq0_water_vapor(i,k) -! enddo -! enddo -! endif + if (qdiag3d) then + do k=1,levs + do i=1,im + save_qv(i,k) = gq0_water_vapor(i,k) + enddo + enddo + endif + endif end subroutine GFS_SCNV_generic_pre_run @@ -67,7 +67,7 @@ end subroutine GFS_SCNV_generic_post_finalize !> \section arg_table_GFS_SCNV_generic_post_run Argument Table !! \htmlinclude GFS_SCNV_generic_post_run.html !! - subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, cplchm, & + subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cplchm, & frain, gt0, gq0_water_vapor, save_t, save_qv, dqdti, dt3dt, dq3dt, clw, & shcnvcw, rain1, npdf3d, num_p3d, ncnvcld3d, cnvc, cnvw, & rainc, cnvprcp, cnvprcpb, cnvw_phy_f3d, cnvc_phy_f3d, & @@ -78,7 +78,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, cplchm, & implicit none integer, intent(in) :: im, levs, nn - logical, intent(in) :: lssav, ldiag3d, cplchm + logical, intent(in) :: lssav, ldiag3d, qdiag3d, cplchm real(kind=kind_phys), intent(in) :: frain real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, gq0_water_vapor real(kind=kind_phys), dimension(im,levs), intent(in) :: save_t, save_qv @@ -137,9 +137,15 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, cplchm, & do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k) - save_t(i,k)) * frain -! dq3dt(i,k) = dq3dt(i,k) + (gq0_water_vapor(i,k) - save_qv(i,k)) * frain enddo enddo + if (qdiag3d) then + do k=1,levs + do i=1,im + dq3dt(i,k) = dq3dt(i,k) + (gq0_water_vapor(i,k) - save_qv(i,k)) * frain + enddo + enddo + endif endif endif ! end if_lssav ! diff --git a/physics/GFS_SCNV_generic.meta b/physics/GFS_SCNV_generic.meta index 79f4eab11..24dd7236d 100644 --- a/physics/GFS_SCNV_generic.meta +++ b/physics/GFS_SCNV_generic.meta @@ -25,6 +25,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [gt0] standard_name = air_temperature_updated_by_physics long_name = temperature updated by physics @@ -115,6 +123,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [ldiag3d] standard_name = flag_diagnostics_3D long_name = flag for 3d diagnostic fields diff --git a/physics/rayleigh_damp.f b/physics/rayleigh_damp.f index 3231a16d8..814704385 100644 --- a/physics/rayleigh_damp.f +++ b/physics/rayleigh_damp.f @@ -25,7 +25,9 @@ end subroutine rayleigh_damp_init !> @{ subroutine rayleigh_damp_run ( & & lsidea,IM,IX,KM,A,B,C,U1,V1,DT,CP, & - & LEVR,pgr,PRSL,PRSLRD0,ral_ts,errmsg,errflg) + & LEVR,pgr,PRSL,PRSLRD0,ral_ts, & + & ldiag3d,du3dt,dv3dt,dt3dt, & + & errmsg,errflg) ! ! ******************************************************************** ! -----> I M P L E M E N T A T I O N V E R S I O N <---------- @@ -66,12 +68,15 @@ subroutine rayleigh_damp_run ( & USE MACHINE , ONLY : kind_phys implicit none ! - logical,intent(in) :: lsidea + logical,intent(in) :: lsidea,ldiag3d integer,intent(in) :: im, ix, km,levr real(kind=kind_phys),intent(in) :: DT, CP, PRSLRD0, ral_ts real(kind=kind_phys),intent(in) :: pgr(im), PRSL(IX,KM) real(kind=kind_phys),intent(in) :: U1(IX,KM), V1(IX,KM) real(kind=kind_phys),intent(inout) :: A(IX,KM), B(IX,KM), C(IX,KM) + real(kind=kind_phys),intent(inout) :: du3dt(IX,KM) + real(kind=kind_phys),intent(inout) :: dv3dt(IX,KM) + real(kind=kind_phys),intent(inout) :: dt3dt(IX,KM) character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -79,7 +84,7 @@ subroutine rayleigh_damp_run ( & real(kind=kind_phys), parameter :: cons1=1.0, cons2=2.0, half=0.5 real(kind=kind_phys) DTAUX, DTAUY, wrk1, rtrd1, rfactrd, wrk2 &, ENG0, ENG1, tem1, tem2, dti, hfbcpdt, rtrd - real(kind=kind_phys) tx1(im) + real(kind=kind_phys) tx1(im), deltaA, deltaB, deltaC integer i, k ! ! Initialize CCPP error handling variables @@ -112,9 +117,17 @@ subroutine rayleigh_damp_run ( & tem1 = U1(I,K) + DTAUX tem2 = V1(I,K) + DTAUY ENG1 = tem1*tem1 + tem2*tem2 - A(I,K) = A(I,K) + DTAUY * dti - B(I,K) = B(I,K) + DTAUX * dti - C(I,K) = C(I,K) + max((ENG0-ENG1),0.0) * hfbcpdt + deltaA = DTAUY * dti + deltaB = DTAUX * dti + deltaC = max((ENG0-ENG1),0.0) * hfbcpdt + A(I,K) = A(I,K) + deltaA + B(I,K) = B(I,K) + deltaB + C(I,K) = C(I,K) + deltaC + IF(ldiag3d) THEN + dv3dt(I,K) = dv3dt(I,K) + deltaA + du3dt(I,K) = du3dt(I,K) + deltaB + dt3dt(I,K) = dt3dt(I,K) + deltaC + ENDIF ENDDO ENDDO diff --git a/physics/rayleigh_damp.meta b/physics/rayleigh_damp.meta index ec08802e8..2f9d81ed5 100644 --- a/physics/rayleigh_damp.meta +++ b/physics/rayleigh_damp.meta @@ -145,6 +145,41 @@ kind = kind_phys intent = in optional = F +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for calculating 3-D diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F +[du3dt] + standard_name = cumulative_change_in_x_wind_due_to_rayleigh_damping + long_name = cumulative change in zonal wind due to Rayleigh damping + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout + optional = F +[dv3dt] + standard_name = cumulative_change_in_y_wind_due_to_rayleigh_damping + long_name = cumulative change in meridional wind due to Rayleigh damping + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout + optional = F +[dt3dt] + standard_name = cumulative_change_in_temperature_due_to_rayleigh_damping + long_name = cumulative change in temperature due to Rayleigh damping + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout + optional = F [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP From a77488d3801117720d947242196e824a2f6e409c Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Fri, 3 Jan 2020 15:53:12 +0000 Subject: [PATCH 03/12] Further bug fixes to tendency accumulation --- physics/GFS_DCNV_generic.F90 | 18 ++++++++---- physics/GFS_DCNV_generic.meta | 16 +++++++++++ physics/GFS_GWD_generic.F90 | 21 ++++++++------ physics/GFS_GWD_generic.meta | 40 ++++++++++++++++++++++++++ physics/cires_ugwp.F90 | 36 +++++++++++++++++++++-- physics/cires_ugwp.meta | 54 +++++++++++++++++++++++++++++++++++ physics/gwdc.f | 11 +++---- physics/ozphys.f | 32 ++++++++++----------- physics/ozphys.meta | 8 ++++++ 9 files changed, 198 insertions(+), 38 deletions(-) diff --git a/physics/GFS_DCNV_generic.F90 b/physics/GFS_DCNV_generic.F90 index 0acfbd19e..eb6e277d5 100644 --- a/physics/GFS_DCNV_generic.F90 +++ b/physics/GFS_DCNV_generic.F90 @@ -17,7 +17,7 @@ end subroutine GFS_DCNV_generic_pre_finalize !! \htmlinclude GFS_DCNV_generic_pre_run.html !! #endif - subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, & + subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, do_ca, & isppt_deep, gu0, gv0, gt0, gq0_water_vapor, & save_u, save_v, save_t, save_qv, ca_deep, & errmsg, errflg) @@ -27,7 +27,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, implicit none integer, intent(in) :: im, levs - logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, isppt_deep + logical, intent(in) :: ldiag3d, do_cnvgwd, do_ca, isppt_deep, qdiag3d real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0 real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0 real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0 @@ -70,7 +70,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca, enddo endif - if (ldiag3d .or. isppt_deep) then + if (( ldiag3d .and. qdiag3d) .or. isppt_deep) then do k=1,levs do i=1,im save_qv(i,k) = gq0_water_vapor(i,k) @@ -95,7 +95,7 @@ end subroutine GFS_DCNV_generic_post_finalize !> \section arg_table_GFS_DCNV_generic_post_run Argument Table !! \htmlinclude GFS_DCNV_generic_post_run.html !! - subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_ca, & + subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, cscnv, do_ca, & isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, & gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, & rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, & @@ -107,7 +107,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c implicit none integer, intent(in) :: im, levs - logical, intent(in) :: lssav, ldiag3d, ras, cscnv, do_ca, isppt_deep + logical, intent(in) :: lssav, ldiag3d, ras, cscnv, do_ca, isppt_deep, qdiag3d real(kind=kind_phys), intent(in) :: frain, dtf real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d @@ -179,7 +179,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain -! dq3dt(i,k) = dq3dt(i,k) + (gq0_water_vapor(i,k)-save_qv(i,k)) * frain du3dt(i,k) = du3dt(i,k) + (gu0(i,k)-save_u(i,k)) * frain dv3dt(i,k) = dv3dt(i,k) + (gv0(i,k)-save_v(i,k)) * frain @@ -188,6 +187,13 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c ! det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * (con_g*frain) enddo enddo + if(qdiag3d) then + do k=1,levs + do i=1,im + dq3dt(i,k) = dq3dt(i,k) + (gq0_water_vapor(i,k)-save_qv(i,k)) * frain + enddo + enddo + endif endif ! if (ldiag3d) endif ! if (lssav) diff --git a/physics/GFS_DCNV_generic.meta b/physics/GFS_DCNV_generic.meta index eae53a910..c5c006e88 100644 --- a/physics/GFS_DCNV_generic.meta +++ b/physics/GFS_DCNV_generic.meta @@ -25,6 +25,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [do_cnvgwd] standard_name = flag_for_convective_gravity_wave_drag long_name = flag for convective gravity wave drag (gwd) @@ -184,6 +192,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [ras] standard_name = flag_for_ras_deep_convection long_name = flag for ras convection scheme diff --git a/physics/GFS_GWD_generic.F90 b/physics/GFS_GWD_generic.F90 index 0915dd170..a90ccecb3 100644 --- a/physics/GFS_GWD_generic.F90 +++ b/physics/GFS_GWD_generic.F90 @@ -19,7 +19,8 @@ subroutine GFS_GWD_generic_pre_run( & & im, levs, nmtvr, mntvar, & & oc, oa4, clx, theta, & & sigma, gamma, elvmax, lssav, ldiag3d, & - & dtdt, dt3dt, dtf, errmsg, errflg) + & dudt, dvdt, dtdt, du3dt, dv3dt, dt3dt, dtf, & + & gwd_generic_tend, errmsg, errflg) use machine, only : kind_phys implicit none @@ -31,10 +32,10 @@ subroutine GFS_GWD_generic_pre_run( & & oc(im), oa4(im,4), clx(im,4), & & theta(im), sigma(im), gamma(im), elvmax(im) - logical, intent(in) :: lssav, ldiag3d - real(kind=kind_phys), intent(in) :: dtdt(im,levs) + logical, intent(in) :: lssav, ldiag3d, gwd_generic_tend + real(kind=kind_phys), intent(in) :: dtdt(im,levs), dudt(im,levs), dvdt(im,levs) ! dt3dt only allocated only if ldiag3d is .true. - real(kind=kind_phys), intent(inout) :: dt3dt(:,:) + real(kind=kind_phys), intent(inout) :: dt3dt(:,:), du3dt(:,:), dv3dt(:,:) real(kind=kind_phys), intent(in) :: dtf character(len=*), intent(out) :: errmsg @@ -91,10 +92,13 @@ subroutine GFS_GWD_generic_pre_run( & endif ! end if_nmtvr if (lssav) then - if (ldiag3d) then + if (ldiag3d .and. gwd_generic_tend) then + write(0,*) 'gwd_generic_tend' do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) - dtdt(i,k)*dtf + du3dt(i,k) = du3dt(i,k) - dudt(i,k)*dtf + dv3dt(i,k) = dv3dt(i,k) - dvdt(i,k)*dtf enddo enddo endif @@ -125,12 +129,12 @@ end subroutine GFS_GWD_generic_post_init !! \section detailed Detailed Algorithm !! @{ subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, dvdt, dtdt, & - & dugwd, dvgwd, du3dt, dv3dt, dt3dt, errmsg, errflg) + & dugwd, dvgwd, du3dt, dv3dt, dt3dt, gwd_generic_tend, errmsg, errflg) use machine, only : kind_phys implicit none - logical, intent(in) :: lssav, ldiag3d + logical, intent(in) :: lssav, ldiag3d, gwd_generic_tend real(kind=kind_phys), intent(in) :: dusfcg(:), dvsfcg(:) real(kind=kind_phys), intent(in) :: dudt(:,:), dvdt(:,:), dtdt(:,:) @@ -150,7 +154,8 @@ subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, d dugwd(:) = dugwd(:) + dusfcg(:)*dtf dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf - if (ldiag3d) then + if (ldiag3d .and. gwd_generic_tend) then + write(0,*) 'gwd_generic_tend' du3dt(:,:) = du3dt(:,:) + dudt(:,:) * dtf dv3dt(:,:) = dv3dt(:,:) + dvdt(:,:) * dtf dt3dt(:,:) = dt3dt(:,:) + dtdt(:,:) * dtf diff --git a/physics/GFS_GWD_generic.meta b/physics/GFS_GWD_generic.meta index 94a4abab1..b87f398ab 100644 --- a/physics/GFS_GWD_generic.meta +++ b/physics/GFS_GWD_generic.meta @@ -118,6 +118,20 @@ type = logical intent = in optional = F +[dudt] + standard_name = tendency_of_x_wind_due_to_model_physics + long_name = zonal wind tendency due to model physics + units = m s-2 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[dvdt] + standard_name = tendency_of_y_wind_due_to_model_physics + long_name = meridional wind tendency due to model physics + units = m s-2 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [dtdt] standard_name = tendency_of_air_temperature_due_to_model_physics long_name = updated tendency of the temperature @@ -127,6 +141,20 @@ kind = kind_phys intent = in optional = F +[du3dt] + standard_name = cumulative_change_in_x_wind_due_to_orographic_gravity_wave_drag + long_name = cumulative change in x wind due to orographic gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[dv3dt] + standard_name = cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag + long_name = cumulative change in y wind due to orographic gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [dt3dt] standard_name = cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag long_name = cumulative change in temperature due to orographic gravity wave drag @@ -145,6 +173,12 @@ kind = kind_phys intent = in optional = F +[gwd_generic_tend] + standard_name = true_if_GFS_GWD_generic_should_calculate_tendencies + long_name = true if GFS_GWD_generic should calculate tendencies + units = flag + dimensions = () + type = logical [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP @@ -287,6 +321,12 @@ kind = kind_phys intent = inout optional = F +[gwd_generic_tend] + standard_name = true_if_GFS_GWD_generic_should_calculate_tendencies + long_name = true if GFS_GWD_generic should calculate tendencies + units = flag + dimensions = () + type = logical [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/cires_ugwp.F90 b/physics/cires_ugwp.F90 index c15697e68..1daa10af5 100644 --- a/physics/cires_ugwp.F90 +++ b/physics/cires_ugwp.F90 @@ -149,7 +149,9 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr tau_tofd, tau_mtb, tau_ogw, tau_ngw, zmtb, zlwb, zogw, & dudt_mtb,dudt_ogw, dudt_tms, du3dt_mtb, du3dt_ogw, du3dt_tms, & dudt, dvdt, dtdt, rdxzb, con_g, con_pi, con_cp, con_rd, con_rv, con_fvirt, & - rain, ntke, q_tke, dqdt_tke, lprnt, ipr, errmsg, errflg) + rain, ntke, q_tke, dqdt_tke, lprnt, ipr, & + ldu3dt_ogw, ldv3dt_ogw, ldt3dt_ogw, ldu3dt_cgw, ldv3dt_cgw, ldt3dt_cgw, & + ldiag3d, lssav, errmsg, errflg) implicit none @@ -172,6 +174,12 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr real(kind=kind_phys), intent(out), dimension(im) :: tau_mtb, tau_ogw, tau_tofd, tau_ngw real(kind=kind_phys), intent(out), dimension(im, levs):: gw_dudt, gw_dvdt, gw_dtdt, gw_kdis real(kind=kind_phys), intent(out), dimension(im, levs):: dudt_mtb, dudt_ogw, dudt_tms + + ! These arrays are only allocated if ldiag=.true. + real(kind=kind_phys), intent(inout), dimension(im, levs) :: ldu3dt_ogw, ldv3dt_ogw, ldt3dt_ogw + real(kind=kind_phys), intent(inout), dimension(im, levs) :: ldu3dt_cgw, ldv3dt_cgw, ldt3dt_cgw + logical, intent(in) :: ldiag3d, lssav + ! These arrays only allocated if ldiag_ugwp = .true. real(kind=kind_phys), intent(out), dimension(:,:) :: du3dt_mtb, du3dt_ogw, du3dt_tms @@ -263,6 +271,18 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr endif ! do_ugwp + + if(ldiag3d .and. lssav) then + do k=1,levs + do i=1,im + ldu3dt_ogw(i,k) = ldu3dt_ogw(i,k) + Pdudt(i,k)*dtp + ldv3dt_ogw(i,k) = ldv3dt_ogw(i,k) + Pdvdt(i,k)*dtp + ldt3dt_ogw(i,k) = ldt3dt_ogw(i,k) + Pdtdt(i,k)*dtp + enddo + enddo + endif + + if (cdmbgwd(3) > 0.0) then ! 2) non-stationary GW-scheme with GMAO/MERRA GW-forcing @@ -338,8 +358,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr dudt_mtb = 0. ; dudt_ogw = 0. ; dudt_tms = 0. endif - return - +#if 0 !============================================================================= ! make "ugwp eddy-diffusion" update for gw_dtdt/gw_dudt/gw_dvdt by solving ! vert diffusion equations & update "Statein%tgrs, Statein%ugrs, Statein%vgrs" @@ -358,6 +377,17 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr gw_dtdt = gw_dtdt*(1.-pked) + ed_dtdt*pked gw_dvdt = gw_dvdt*(1.-pked) + ed_dvdt*pked gw_dudt = gw_dudt*(1.-pked) + ed_dudt*pked +#endif + + if(ldiag3d .and. lssav) then + do k=1,levs + do i=1,im + ldu3dt_cgw(i,k) = ldu3dt_cgw(i,k) + (gw_dudt(i,k) - Pdudt(i,k))*dtp + ldv3dt_cgw(i,k) = ldv3dt_cgw(i,k) + (gw_dvdt(i,k) - Pdvdt(i,k))*dtp + ldt3dt_cgw(i,k) = ldt3dt_cgw(i,k) + (gw_dtdt(i,k) - Pdtdt(i,k))*dtp + enddo + enddo + endif end subroutine cires_ugwp_run diff --git a/physics/cires_ugwp.meta b/physics/cires_ugwp.meta index 7f1118016..005327005 100644 --- a/physics/cires_ugwp.meta +++ b/physics/cires_ugwp.meta @@ -850,6 +850,60 @@ type = integer intent = in optional = F +[ldu3dt_ogw] + standard_name = cumulative_change_in_x_wind_due_to_orographic_gravity_wave_drag + long_name = cumulative change in x wind due to orographic gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldv3dt_ogw] + standard_name = cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag + long_name = cumulative change in y wind due to orographic gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldt3dt_ogw] + standard_name = cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag + long_name = cumulative change in temperature due to orographic gravity wave drag + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldu3dt_cgw] + standard_name = cumulative_change_in_x_wind_due_to_convective_gravity_wave_drag + long_name = cumulative change in x wind due to convective gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldv3dt_cgw] + standard_name = cumulative_change_in_y_wind_due_to_convective_gravity_wave_drag + long_name = cumulative change in y wind due to convective gravity wave drag + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldt3dt_cgw] + standard_name = cumulative_change_in_temperature_due_to_convective_gravity_wave_drag + long_name = cumulative change in temperature due to convective gravity wave drag + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/gwdc.f b/physics/gwdc.f index 9909a3100..ad3aa3bf7 100644 --- a/physics/gwdc.f +++ b/physics/gwdc.f @@ -1498,13 +1498,14 @@ subroutine gwdc_post_run( & if (lssav) then dugwd(:) = dugwd(:) + tauctx(:)*dtf dvgwd(:) = dvgwd(:) + taucty(:)*dtf - - if (ldiag3d) then - du3dt(:,:) = du3dt(:,:) + gwdcu(:,:) * dtf - dv3dt(:,:) = dv3dt(:,:) + gwdcv(:,:) * dtf - endif endif ! end if_lssav + if (ldiag3d) then + write(0,*) 'update gwdc tend' + du3dt(:,:) = du3dt(:,:) + gwdcu(:,:) * dtf + dv3dt(:,:) = dv3dt(:,:) + gwdcv(:,:) * dtf + endif + ! --- ... update the wind components with gwdc tendencies do k = 1, levs diff --git a/physics/ozphys.f b/physics/ozphys.f index 02296ee79..8ca13b99f 100644 --- a/physics/ozphys.f +++ b/physics/ozphys.f @@ -51,7 +51,7 @@ end subroutine ozphys_finalize !> @{ subroutine ozphys_run ( & & ix, im, levs, ko3, dt, oz, tin, po3, & - & prsl, prdout, oz_coeff, delp, ldiag3d, & + & prsl, prdout, oz_coeff, delp, ldiag3d, qdiag3d, & & ozp1, ozp2, ozp3, ozp4, con_g, me, errmsg, errflg) ! ! this code assumes that both prsl and po3 are from bottom to top @@ -72,7 +72,7 @@ subroutine ozphys_run ( & & prsl(ix,levs), tin(ix,levs), delp(ix,levs), & & con_g real :: gravi - logical, intent(in) :: ldiag3d + logical, intent(in) :: ldiag3d, qdiag3d character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -157,12 +157,12 @@ subroutine ozphys_run ( & oz(i,l) = (ozib(i) + prod(i,1)*dt) / (1.0 + prod(i,2)*dt) enddo ! - !if (ldiag3d) then ! ozone change diagnostics - ! do i=1,im - ! ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt - ! ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) - ! enddo - !endif + if (ldiag3d .and. qdiag3d) then ! ozone change diagnostics + do i=1,im + ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt + ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) + enddo + endif endif !> - Calculate the 4 terms of prognostic ozone change during time \a dt: !! - ozp1(:,:) - Ozone production from production/loss ratio @@ -178,14 +178,14 @@ subroutine ozphys_run ( & ! &,' ozib=',ozib(i),' l=',l,' tin=',tin(i,l),'colo3=',colo3(i,l+1) oz(i,l) = (ozib(i) + tem*dt) / (1.0 + prod(i,2)*dt) enddo - !if (ldiag3d) then ! ozone change diagnostics - ! do i=1,im - ! ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt - ! ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) - ! ozp3(i,l) = ozp3(i,l) + prod(i,3)*tin(i,l)*dt - ! ozp4(i,l) = ozp4(i,l) + prod(i,4)*colo3(i,l+1)*dt - ! enddo - !endif + if(ldiag3d .and. qdiag3d) then + do i=1,im + ozp1(i,l) = ozp1(i,l) + prod(i,1)*dt + ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) + ozp3(i,l) = ozp3(i,l) + prod(i,3)*tin(i,l)*dt + ozp4(i,l) = ozp4(i,l) + prod(i,4)*colo3(i,l+1)*dt + enddo + endif endif enddo ! vertical loop diff --git a/physics/ozphys.meta b/physics/ozphys.meta index 9f7a3870d..8cce5c266 100644 --- a/physics/ozphys.meta +++ b/physics/ozphys.meta @@ -147,6 +147,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [ozp1] standard_name = cumulative_change_in_ozone_concentration_due_to_production_and_loss_rate long_name = cumulative change in ozone concentration due to production and loss rate From a227ad0d7e4c67e7ad6e74b770e4786f189af008 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Mon, 6 Jan 2020 19:54:18 +0000 Subject: [PATCH 04/12] fix several bugs mentioned in code review --- physics/GFS_GWD_generic.F90 | 2 -- physics/GFS_GWD_generic.meta | 5 +++++ physics/GFS_MP_generic.F90 | 16 +++++++++++++--- physics/GFS_MP_generic.meta | 9 +++++++++ physics/cires_ugwp.meta | 7 +++++++ physics/gwdc.f | 1 - 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/physics/GFS_GWD_generic.F90 b/physics/GFS_GWD_generic.F90 index a90ccecb3..f05fa508f 100644 --- a/physics/GFS_GWD_generic.F90 +++ b/physics/GFS_GWD_generic.F90 @@ -93,7 +93,6 @@ subroutine GFS_GWD_generic_pre_run( & if (lssav) then if (ldiag3d .and. gwd_generic_tend) then - write(0,*) 'gwd_generic_tend' do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) - dtdt(i,k)*dtf @@ -155,7 +154,6 @@ subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, d dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf if (ldiag3d .and. gwd_generic_tend) then - write(0,*) 'gwd_generic_tend' du3dt(:,:) = du3dt(:,:) + dudt(:,:) * dtf dv3dt(:,:) = dv3dt(:,:) + dvdt(:,:) * dtf dt3dt(:,:) = dt3dt(:,:) + dtdt(:,:) * dtf diff --git a/physics/GFS_GWD_generic.meta b/physics/GFS_GWD_generic.meta index b87f398ab..782adfa59 100644 --- a/physics/GFS_GWD_generic.meta +++ b/physics/GFS_GWD_generic.meta @@ -125,6 +125,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [dvdt] standard_name = tendency_of_y_wind_due_to_model_physics long_name = meridional wind tendency due to model physics @@ -132,6 +133,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [dtdt] standard_name = tendency_of_air_temperature_due_to_model_physics long_name = updated tendency of the temperature @@ -148,6 +150,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [dv3dt] standard_name = cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag long_name = cumulative change in y wind due to orographic gravity wave drag @@ -155,6 +158,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [dt3dt] standard_name = cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag long_name = cumulative change in temperature due to orographic gravity wave drag @@ -179,6 +183,7 @@ units = flag dimensions = () type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/GFS_MP_generic.F90 b/physics/GFS_MP_generic.F90 index ea2ef6c16..521a8b6ac 100644 --- a/physics/GFS_MP_generic.F90 +++ b/physics/GFS_MP_generic.F90 @@ -16,7 +16,7 @@ end subroutine GFS_MP_generic_pre_init !> \section arg_table_GFS_MP_generic_pre_run Argument Table !! \htmlinclude GFS_MP_generic_pre_run.html !! - subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, ntrac, gt0, gq0, save_t, save_q, errmsg, errflg) + subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, ntrac, gt0, gq0, save_t, save_qv, save_q, errmsg, errflg) ! use machine, only: kind_phys @@ -26,7 +26,7 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, real(kind=kind_phys), dimension(im, levs), intent(in) :: gt0 real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: gq0 - real(kind=kind_phys), dimension(im, levs), intent(inout) :: save_t + real(kind=kind_phys), dimension(im, levs), intent(inout) :: save_t, save_qv real(kind=kind_phys), dimension(im, levs, ntrac), intent(inout) :: save_q character(len=*), intent(out) :: errmsg @@ -44,7 +44,17 @@ subroutine GFS_MP_generic_pre_run(im, levs, ldiag3d, qdiag3d, do_aw, ntcw, nncl, save_t(i,k) = gt0(i,k) enddo enddo - if(do_aw .or. (qdiag3d .and. ldiag3d)) then + if(qdiag3d) then + do k=1,levs + do i=1,im + ! Here, gq0(...,1) is used instead of gq0_water_vapor + ! to be consistent with the GFS_MP_generic_post_run + ! code. + save_qv(i,k) = gq0(i,k,1) + enddo + enddo + endif + if(do_aw) then save_q(1:im,:,1) = gq0(1:im,:,1) do n=ntcw,ntcw+nncl-1 save_q(1:im,:,n) = gq0(1:im,:,n) diff --git a/physics/GFS_MP_generic.meta b/physics/GFS_MP_generic.meta index 1ac030bc7..3c8574f95 100644 --- a/physics/GFS_MP_generic.meta +++ b/physics/GFS_MP_generic.meta @@ -97,6 +97,15 @@ kind = kind_phys intent = inout optional = F +[save_qv] + standard_name = water_vapor_specific_humidity_save + long_name = water vapor specific humidity before entering a physics scheme + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out + optional = F [save_q] standard_name = tracer_concentration_save long_name = tracer concentration before entering a physics scheme diff --git a/physics/cires_ugwp.meta b/physics/cires_ugwp.meta index 005327005..32c64145f 100644 --- a/physics/cires_ugwp.meta +++ b/physics/cires_ugwp.meta @@ -857,6 +857,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldv3dt_ogw] standard_name = cumulative_change_in_y_wind_due_to_orographic_gravity_wave_drag long_name = cumulative change in y wind due to orographic gravity wave drag @@ -864,6 +865,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldt3dt_ogw] standard_name = cumulative_change_in_temperature_due_to_orographic_gravity_wave_drag long_name = cumulative change in temperature due to orographic gravity wave drag @@ -871,6 +873,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldu3dt_cgw] standard_name = cumulative_change_in_x_wind_due_to_convective_gravity_wave_drag long_name = cumulative change in x wind due to convective gravity wave drag @@ -878,6 +881,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldv3dt_cgw] standard_name = cumulative_change_in_y_wind_due_to_convective_gravity_wave_drag long_name = cumulative change in y wind due to convective gravity wave drag @@ -885,6 +889,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldt3dt_cgw] standard_name = cumulative_change_in_temperature_due_to_convective_gravity_wave_drag long_name = cumulative change in temperature due to convective gravity wave drag @@ -892,6 +897,7 @@ dimensions = (horizontal_dimension,vertical_dimension) type = real kind = kind_phys + intent = inout [ldiag3d] standard_name = flag_diagnostics_3D long_name = flag for 3d diagnostic fields @@ -904,6 +910,7 @@ units = flag dimensions = () type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/gwdc.f b/physics/gwdc.f index ad3aa3bf7..314aa4d44 100644 --- a/physics/gwdc.f +++ b/physics/gwdc.f @@ -1501,7 +1501,6 @@ subroutine gwdc_post_run( & endif ! end if_lssav if (ldiag3d) then - write(0,*) 'update gwdc tend' du3dt(:,:) = du3dt(:,:) + gwdcu(:,:) * dtf dv3dt(:,:) = dv3dt(:,:) + gwdcv(:,:) * dtf endif From 4367882dcf5da5e9086c19f11be35d38005cc017 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Tue, 14 Jan 2020 01:21:35 +0000 Subject: [PATCH 05/12] Move PBL tendencies into the PBL run subroutine. --- physics/GFS_PBL_generic.F90 | 5 +-- physics/GFS_PBL_generic.meta | 7 ++++ physics/moninedmf.f | 36 ++++++++++++++++--- physics/moninedmf.meta | 67 ++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 6 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index d31dbafec..cd4a30849 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -281,7 +281,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, trans_aero, ntchs, ntchm, & imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg, & imp_physics_fer_hires, & - ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & + ltaerosol, cplflx, cplchm, lssav, pbl_generic_tend, ldiag3d, qdiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu, & dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, & dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, dqsfc_diag, & @@ -301,6 +301,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu + logical, intent(in) :: pbl_generic_tend real(kind=kind_phys), intent(in) :: dtf real(kind=kind_phys), intent(in) :: rd, cp, fvirt, hvap @@ -552,7 +553,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, ! & dtf,' kdt=',kdt,' lat=',lat ! endif - if (ldiag3d) then + if (ldiag3d .and. pbl_generic_tend) then if (lsidea) then dt3dt(1:im,:) = dt3dt(1:im,:) + dtdt(1:im,:)*dtf else diff --git a/physics/GFS_PBL_generic.meta b/physics/GFS_PBL_generic.meta index ae86b0dce..4256049dd 100644 --- a/physics/GFS_PBL_generic.meta +++ b/physics/GFS_PBL_generic.meta @@ -601,6 +601,13 @@ type = logical intent = in optional = F +[pbl_generic_tend] + standard_name = true_if_GFS_PBL_generic_should_calculate_tendencies + long_name = true if GFS_PBL_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [lssav] standard_name = flag_diagnostics long_name = logical flag for storing diagnostics diff --git a/physics/moninedmf.f b/physics/moninedmf.f index 1084aa426..2bd19580a 100644 --- a/physics/moninedmf.f +++ b/physics/moninedmf.f @@ -64,7 +64,9 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & & prsi,del,prsl,prslk,phii,phil,delt,dspheat, & & dusfc,dvsfc,dtsfc,dqsfc,hpbl,hgamt,hgamq,dkt, & & kinver,xkzm_m,xkzm_h,xkzm_s,lprnt,ipr, & - & xkzminv,moninq_fac,errmsg,errflg) + & xkzminv,moninq_fac,lssav,ldiag3d,qdiag3d,lsidea,ntoz, & + & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL, & + & errmsg,errflg) ! use machine , only : kind_phys use funcphys , only : fpvs @@ -74,16 +76,18 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & ! ! arguments ! - logical, intent(in) :: lprnt + logical, intent(in) :: lprnt,lssav,ldiag3d,qdiag3d,lsidea integer, intent(in) :: ipr - integer, intent(in) :: ix, im, km, ntrac, ntcw, kinver(im) + integer, intent(in) :: ix, im, km, ntrac, ntcw, kinver(im), ntoz integer, intent(out) :: kpbl(im) ! real(kind=kind_phys), intent(in) :: delt, xkzm_m, xkzm_h, xkzm_s real(kind=kind_phys), intent(in) :: xkzminv, moninq_fac real(kind=kind_phys), intent(inout) :: dv(im,km), du(im,km), & - & tau(im,km), rtg(im,km,ntrac) + & tau(im,km), rtg(im,km,ntrac)\ + real(kind=kind_phys), intent(inout), dimension(ix,km) :: & + & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL real(kind=kind_phys), intent(in) :: & & u1(ix,km), v1(ix,km), & & t1(ix,km), q1(ix,km,ntrac), & @@ -1037,6 +1041,17 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & rtg(i,k,1) = rtg(i,k,1)+qtend dtsfc(i) = dtsfc(i)+cont*del(i,k)*ttend dqsfc(i) = dqsfc(i)+conq*del(i,k)*qtend + if(lssav .and. ldiag3d) then + if(lsidea) then + dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + ttend*rdt + else + dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + & + & ((ttend-hlw(i,k)-hsw(i,k)*xmu(i))*rdt) + endif + if(qdiag3d) then + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + qtend*rdt + endif + endif enddo enddo if(ntrac >= 2) then @@ -1049,6 +1064,15 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & enddo enddo enddo + if(lssav .and. ldiag3d .and. ntoz>0 .and. qdiag3d) then + is = (ntoz-1) * km + do k = 1, km + do i = 1, im + qtend = (a2(i,k+is)-q1(i,k,kk))*rdt + do3dt(i,k,kk) = do3dt(i,k,kk)+qtend + enddo + enddo + endif endif ! ! compute tke dissipation rate @@ -1150,6 +1174,10 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & dv(i,k) = dv(i,k) + vtend dusfc(i) = dusfc(i) + conw*del(i,k)*utend dvsfc(i) = dvsfc(i) + conw*del(i,k)*vtend + if(lssav .and. ldiag3d) then + du3dt_PBL(i,k) = du3dt_PBL(i,k) + utend*delt + dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + vtend*delt + endif ! ! for dissipative heating for ecmwf model ! diff --git a/physics/moninedmf.meta b/physics/moninedmf.meta index 47875640f..2027008fc 100644 --- a/physics/moninedmf.meta +++ b/physics/moninedmf.meta @@ -499,6 +499,73 @@ kind = kind_phys intent = in optional = F +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical + intent = in +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[lsidea] + standard_name = flag_idealized_physics + long_name = flag for idealized physics + units = flag + dimensions = () + type = logical +[ntoz] + standard_name = index_for_ozone + long_name = tracer index for ozone mixing ratio + units = index + dimensions = () + type = integer + intent = in + optional = F +[du3dt_PBL] + standard_name = cumulative_change_in_x_wind_due_to_PBL + long_name = cumulative change in x wind due to PBL + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_PBL] + standard_name = cumulative_change_in_y_wind_due_to_PBL + long_name = cumulative change in y wind due to PBL + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_PBL] + standard_name = cumulative_change_in_temperature_due_to_PBL + long_name = cumulative change in temperature due to PBL + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_PBL] + standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_PBL + long_name = cumulative change in water vapor specific humidity due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP From 2850217b2efafbda2cafa8a9b01af82348ee2cda Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Tue, 14 Jan 2020 01:26:13 +0000 Subject: [PATCH 06/12] add a missing intent(in) to physics/moninedmf.meta --- physics/moninedmf.meta | 1 + 1 file changed, 1 insertion(+) diff --git a/physics/moninedmf.meta b/physics/moninedmf.meta index 2027008fc..07b389219 100644 --- a/physics/moninedmf.meta +++ b/physics/moninedmf.meta @@ -526,6 +526,7 @@ units = flag dimensions = () type = logical + intent = in [ntoz] standard_name = index_for_ozone long_name = tracer index for ozone mixing ratio From d5a527841cfb07f0fe94f6fd2816264c39060655 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Thu, 16 Jan 2020 00:33:10 +0000 Subject: [PATCH 07/12] add ldiag3d and qdiag3d support to physics/module_MYNNPBL_wrapper.F90 and physics/moninedmf.f --- physics/module_MYNNPBL_wrapper.F90 | 126 ++++++++++++++++++---------- physics/module_MYNNPBL_wrapper.meta | 38 +++++++-- physics/moninedmf.f | 10 +-- physics/moninedmf.meta | 8 ++ 4 files changed, 123 insertions(+), 59 deletions(-) diff --git a/physics/module_MYNNPBL_wrapper.F90 b/physics/module_MYNNPBL_wrapper.F90 index 36c9e55de..471c99f50 100644 --- a/physics/module_MYNNPBL_wrapper.F90 +++ b/physics/module_MYNNPBL_wrapper.F90 @@ -25,7 +25,7 @@ end subroutine mynnedmf_wrapper_finalize SUBROUTINE mynnedmf_wrapper_run( & & ix,im,levs, & & flag_init,flag_restart, & - & lssav, ldiag3d, lsidea, & + & lssav, ldiag3d, qdiag3d, lsidea,& & delt,dtf,dx,zorl, & & phii,u,v,omega,t3d, & & qgrs_water_vapor, & @@ -56,7 +56,8 @@ SUBROUTINE mynnedmf_wrapper_run( & & dqdt_ice_cloud, dqdt_ozone, & & dqdt_cloud_droplet_num_conc, dqdt_ice_num_conc, & & dqdt_water_aer_num_conc, dqdt_ice_aer_num_conc, & - & dt3dt, du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, & + & du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, & + & do3dt_PBL, dq3dt_PBL, dt3dt_PBL, & & htrsw, htrlw, xmu, & & grav_settling, bl_mynn_tkebudget, bl_mynn_tkeadvect, & & bl_mynn_cloudpdf, bl_mynn_mixlength, & @@ -154,7 +155,7 @@ SUBROUTINE mynnedmf_wrapper_run( & character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg - LOGICAL, INTENT(IN) :: lssav, ldiag3d, lsidea + LOGICAL, INTENT(IN) :: lssav, ldiag3d, lsidea, qdiag3d ! NAMELIST OPTIONS (INPUT): LOGICAL, INTENT(IN) :: bl_mynn_tkeadvect, ltaerosol, & lprnt, do_mynnsfclay @@ -224,8 +225,9 @@ SUBROUTINE mynnedmf_wrapper_run( & & RTHRATEN real(kind=kind_phys), dimension(im,levs), intent(out) :: & & Tsq, Qsq, Cov, exch_h, exch_m - real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, & - & du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD + real(kind=kind_phys), dimension(:,:), intent(inout) :: & + & du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, & + & do3dt_PBL, dq3dt_PBL, dt3dt_PBL real(kind=kind_phys), dimension(im), intent(in) :: xmu real(kind=kind_phys), dimension(im, levs), intent(in) :: htrsw, htrlw !LOCAL @@ -285,7 +287,7 @@ SUBROUTINE mynnedmf_wrapper_run( & endif ! Assign variables for each microphysics scheme - if (imp_physics == imp_physics_wsm6) then + init_if_imp_physics: if (imp_physics == imp_physics_wsm6) then ! WSM6 FLAG_QI = .true. FLAG_QNI= .false. @@ -314,7 +316,7 @@ SUBROUTINE mynnedmf_wrapper_run( & enddo elseif (imp_physics == imp_physics_thompson) then ! Thompson - if(ltaerosol) then + tmp_init_if_aer: if(ltaerosol) then FLAG_QI = .true. FLAG_QNI= .true. FLAG_QC = .true. @@ -366,7 +368,7 @@ SUBROUTINE mynnedmf_wrapper_run( & qnifa(i,k) = 0. enddo enddo - endif + endif tmp_init_if_aer elseif (imp_physics == imp_physics_gfdl) then ! GFDL MP FLAG_QI = .true. @@ -420,7 +422,7 @@ SUBROUTINE mynnedmf_wrapper_run( & qnifa(i,k) = 0. enddo enddo - endif + endif init_if_imp_physics if (lprnt)write(0,*)"prepping MYNN-EDMF variables..." @@ -436,7 +438,7 @@ SUBROUTINE mynnedmf_wrapper_run( & pattern_spp_pbl(i,k)=0.0 enddo enddo - do i=1,im + big_init_i_loop: do i=1,im if (slmsk(i)==1. .or. slmsk(i)==2.) then !sea/land/ice mask (=0/1/2) in FV3 xland(i)=1.0 !but land/water = (1/2) in SFCLAY_mynn else @@ -479,9 +481,9 @@ SUBROUTINE mynnedmf_wrapper_run( & ! qsfc(i)=qss(i) ! ps(i)=pgr(i) ! wspd(i)=wind(i) - enddo + enddo big_init_i_loop - if (lprnt) then + lprnt_before: if (lprnt) then print* write(0,*)"===CALLING mynn_bl_driver; input:" print*,"bl_mynn_tkebudget=",bl_mynn_tkebudget," bl_mynn_tkeadvect=",bl_mynn_tkeadvect @@ -518,7 +520,7 @@ SUBROUTINE mynnedmf_wrapper_run( & !print*,"exch_h:",exch_h(1,1),exch_h(1,2),exch_h(1,levs) ! - intent(out) !print*,"exch_m:",exch_m(1,1),exch_m(1,2),exch_m(1,levs) ! - intent(out) print*,"max cf_bl:",maxval(cldfra_bl(1,:)) - endif + endif lprnt_before CALL mynn_bl_driver( & @@ -591,6 +593,26 @@ SUBROUTINE mynnedmf_wrapper_run( & dvdt(i,k) = dvdt(i,k) + RVBLTEN(i,k) enddo enddo + accum_duvt3dt: if(lssav) then + if(ldiag3d) then + do k = 1, levs + do i = 1, im + du3dt_PBL(i,k) = du3dt_PBL(i,k) + RUBLTEN(i,k)*dtf + dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + RVBLTEN(i,k)*dtf + enddo + enddo + endif + if_lsidea: if (lsidea) then + dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + RTHBLTEN(i,k)*exner(i,k)*dtf + elseif(ldiag3d) then + do k=1,levs + do i=1,im + tem = RTHBLTEN(i,k)*exner(i,k) - (htrlw(i,k)+htrsw(i,k)*xmu(i)) + dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + tem*dtf + enddo + enddo + endif if_lsidea + endif accum_duvt3dt !Update T, U and V: !do k = 1, levs ! do i = 1, im @@ -601,7 +623,7 @@ SUBROUTINE mynnedmf_wrapper_run( & !enddo !DO moist/scalar/tracer tendencies: - if (imp_physics == imp_physics_wsm6) then + if_imp_physics: if (imp_physics == imp_physics_wsm6) then ! WSM6 do k=1,levs do i=1,im @@ -611,6 +633,13 @@ SUBROUTINE mynnedmf_wrapper_run( & !dqdt_ozone(i,k) = 0.0 enddo enddo + if(lssav .and. ldiag3d .and. qdiag3d) then + do k=1,levs + do i=1,im + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + dqdt_water_vapor(i,k)*dtf + enddo + enddo + endif !Update moist species: !do k=1,levs ! do i=1,im @@ -622,8 +651,8 @@ SUBROUTINE mynnedmf_wrapper_run( & !enddo elseif (imp_physics == imp_physics_thompson) then ! Thompson-Aerosol - if(ltaerosol) then - do k=1,levs + thmp_if_ltaerosol: if(ltaerosol) then + thmp_aer_tend: do k=1,levs do i=1,im dqdt_water_vapor(i,k) = RQVBLTEN(i,k)/(1.0 + qv(i,k)) dqdt_liquid_cloud(i,k) = RQCBLTEN(i,k)/(1.0 + qv(i,k)) @@ -634,7 +663,14 @@ SUBROUTINE mynnedmf_wrapper_run( & dqdt_water_aer_num_conc(i,k) = RQNWFABLTEN(i,k) dqdt_ice_aer_num_conc(i,k) = RQNIFABLTEN(i,k) enddo - enddo + enddo thmp_aer_tend + if(lssav .and. ldiag3d .and. qdiag3d) then + do k=1,levs + do i=1,im + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + dqdt_water_vapor(i,k)*dtf + enddo + enddo + endif !do k=1,levs ! do i=1,im ! qgrs_water_vapor(i,k) = qgrs_water_vapor(i,k) + (RQVBLTEN(i,k)/(1.0+RQVBLTEN(i,k)))*delt @@ -649,7 +685,7 @@ SUBROUTINE mynnedmf_wrapper_run( & !enddo else !Thompson (2008) - do k=1,levs + thmp_noaer_tend: do k=1,levs do i=1,im dqdt_water_vapor(i,k) = RQVBLTEN(i,k)/(1.0 + qv(i,k)) dqdt_liquid_cloud(i,k) = RQCBLTEN(i,k)/(1.0 + qv(i,k)) @@ -657,7 +693,14 @@ SUBROUTINE mynnedmf_wrapper_run( & dqdt_ice_num_conc(i,k) = RQNIBLTEN(i,k) !dqdt_ozone(i,k) = 0.0 enddo - enddo + enddo thmp_noaer_tend + if(lssav .and. ldiag3d .and. qdiag3d) then + do k=1,levs + do i=1,im + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + dqdt_water_vapor(i,k)*dtf + enddo + enddo + endif !do k=1,levs ! do i=1,im ! qgrs_water_vapor(i,k) = qgrs_water_vapor(i,k) + (RQVBLTEN(i,k)/(1.0+RQVBLTEN(i,k)))*delt @@ -667,10 +710,10 @@ SUBROUTINE mynnedmf_wrapper_run( & ! !dqdt_ozone(i,k) = 0.0 ! enddo !enddo - endif !end thompson choice + endif thmp_if_ltaerosol !end thompson choice elseif (imp_physics == imp_physics_gfdl) then ! GFDL MP - do k=1,levs + gfdl_mp_tend: do k=1,levs do i=1,im dqdt_water_vapor(i,k) = RQVBLTEN(i,k)/(1.0 + qv(i,k)) dqdt_liquid_cloud(i,k) = RQCBLTEN(i,k)/(1.0 + qv(i,k)) @@ -680,7 +723,14 @@ SUBROUTINE mynnedmf_wrapper_run( & !dqdt_graupel(i,k) = 0.0 !dqdt_ozone(i,k) = 0.0 enddo - enddo + enddo gfdl_mp_tend + if(lssav .and. ldiag3d .and. qdiag3d) then + do k=1,levs + do i=1,im + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + dqdt_water_vapor(i,k)*dtf + enddo + enddo + endif !do k=1,levs ! do i=1,im ! qgrs_water_vapor(i,k) = qgrs_water_vapor(i,k) + (RQVBLTEN(i,k)/(1.0+RQVBLTEN(i,k)))*delt @@ -702,30 +752,16 @@ SUBROUTINE mynnedmf_wrapper_run( & !dqdt_ozone(i,k) = 0.0 enddo enddo - endif - - if (lssav .and. ldiag3d) then - if (lsidea) then - dt3dt(1:im,:) = dt3dt(1:im,:) + dtdt(1:im,:)*dtf - else - do k=1,levs - do i=1,im - tem = dtdt(i,k) - (htrlw(i,k)+htrsw(i,k)*xmu(i)) - dt3dt(i,k) = dt3dt(i,k) + tem*dtf + if(lssav .and. ldiag3d .and. qdiag3d) then + do k=1,levs + do i=1,im + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + dqdt_water_vapor(i,k)*dtf + enddo enddo - enddo - endif - do k=1,levs - do i=1,im - du3dt_PBL(i,k) = du3dt_PBL(i,k) + dudt(i,k) * dtf - du3dt_OGWD(i,k) = du3dt_OGWD(i,k) - dudt(i,k) * dtf - dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + dvdt(i,k) * dtf - dv3dt_OGWD(i,k) = dv3dt_OGWD(i,k) - dvdt(i,k) * dtf - enddo - enddo - endif + endif + endif if_imp_physics - if (lprnt) then + lprnt_after: if (lprnt) then print* print*,"===Finished with mynn_bl_driver; output:" print*,"T:",t3d(1,1),t3d(1,2),t3d(1,levs) @@ -764,7 +800,7 @@ SUBROUTINE mynnedmf_wrapper_run( & print*,"ktop_shallow:",ktop_shallow(1)," maxmf:",maxmf(1) print*,"nup:",nupdraft(1) print* - endif + endif lprnt_after END SUBROUTINE mynnedmf_wrapper_run diff --git a/physics/module_MYNNPBL_wrapper.meta b/physics/module_MYNNPBL_wrapper.meta index 61a9ccb70..68de977c5 100644 --- a/physics/module_MYNNPBL_wrapper.meta +++ b/physics/module_MYNNPBL_wrapper.meta @@ -57,6 +57,12 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical [lsidea] standard_name = flag_idealized_physics long_name = flag for idealized physics @@ -692,15 +698,6 @@ kind = kind_phys intent = inout optional = F -[dt3dt] - standard_name = cumulative_change_in_temperature_due_to_PBL - long_name = cumulative change in temperature due to PBL - units = K - dimensions = (horizontal_dimension,vertical_dimension) - type = real - kind = kind_phys - intent = inout - optional = F [du3dt_PBL] standard_name = cumulative_change_in_x_wind_due_to_PBL long_name = cumulative change in x wind due to PBL @@ -737,6 +734,29 @@ kind = kind_phys intent = inout optional = F +[do3dt_PBL] + standard_name = cumulative_change_in_ozone_mixing_ratio_due_to_PBL + long_name = cumulative change in ozone mixing ratio due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_PBL] + standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_PBL + long_name = cumulative change in water vapor specific humidity due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_PBL] + standard_name = cumulative_change_in_temperature_due_to_PBL + long_name = cumulative change in temperature due to PBL + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [htrsw] standard_name = tendency_of_air_temperature_due_to_shortwave_heating_on_radiation_timestep long_name = total sky sw heating rate diff --git a/physics/moninedmf.f b/physics/moninedmf.f index 2bd19580a..f6558a861 100644 --- a/physics/moninedmf.f +++ b/physics/moninedmf.f @@ -65,7 +65,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & & dusfc,dvsfc,dtsfc,dqsfc,hpbl,hgamt,hgamq,dkt, & & kinver,xkzm_m,xkzm_h,xkzm_s,lprnt,ipr, & & xkzminv,moninq_fac,lssav,ldiag3d,qdiag3d,lsidea,ntoz, & - & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL, & + & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL,do3dt_PBL, & & errmsg,errflg) ! use machine , only : kind_phys @@ -85,9 +85,9 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & real(kind=kind_phys), intent(in) :: delt, xkzm_m, xkzm_h, xkzm_s real(kind=kind_phys), intent(in) :: xkzminv, moninq_fac real(kind=kind_phys), intent(inout) :: dv(im,km), du(im,km), & - & tau(im,km), rtg(im,km,ntrac)\ + & tau(im,km), rtg(im,km,ntrac) real(kind=kind_phys), intent(inout), dimension(ix,km) :: & - & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL + & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL,do3dt_PBL real(kind=kind_phys), intent(in) :: & & u1(ix,km), v1(ix,km), & & t1(ix,km), q1(ix,km,ntrac), & @@ -1046,7 +1046,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + ttend*rdt else dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + & - & ((ttend-hlw(i,k)-hsw(i,k)*xmu(i))*rdt) + & ((ttend-hlw(i,k)-swh(i,k)*xmu(i))*rdt) endif if(qdiag3d) then dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + qtend*rdt @@ -1069,7 +1069,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & do k = 1, km do i = 1, im qtend = (a2(i,k+is)-q1(i,k,kk))*rdt - do3dt(i,k,kk) = do3dt(i,k,kk)+qtend + do3dt_PBL(i,k) = do3dt_PBL(i,k)+qtend enddo enddo endif diff --git a/physics/moninedmf.meta b/physics/moninedmf.meta index 07b389219..b5a6947c3 100644 --- a/physics/moninedmf.meta +++ b/physics/moninedmf.meta @@ -567,6 +567,14 @@ type = real kind = kind_phys intent = inout +[do3dt_PBL] + standard_name = cumulative_change_in_ozone_mixing_ratio_due_to_PBL + long_name = cumulative change in ozone mixing ratio due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP From c23b8d19c31b68869b15c0d0bc1367fa4e991234 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Tue, 28 Jan 2020 23:06:20 +0000 Subject: [PATCH 08/12] Add ozone tendencies to ozphys_2015 --- physics/ozphys_2015.f | 23 ++++++++++++----------- physics/ozphys_2015.meta | 8 ++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/physics/ozphys_2015.f b/physics/ozphys_2015.f index 3126313dc..766cfdd62 100644 --- a/physics/ozphys_2015.f +++ b/physics/ozphys_2015.f @@ -55,7 +55,8 @@ end subroutine ozphys_2015_finalize !!\author June 2015 - Shrinivas Moorthi subroutine ozphys_2015_run ( & & ix, im, levs, ko3, dt, oz, tin, po3, & - & prsl, prdout, pl_coeff, delp, ldiag3d, & + & prsl, prdout, pl_coeff, delp, & + & ldiag3d, qdiag3d, & & ozp1,ozp2,ozp3,ozp4,con_g, & & me, errmsg, errflg) ! @@ -80,7 +81,7 @@ subroutine ozphys_2015_run ( & integer, intent(out) :: errflg integer k,kmax,kmin,l,i,j - logical ldiag3d, flg(im) + logical ldiag3d, flg(im), qdiag3d real(kind=kind_phys) pmax, pmin, tem, temp real(kind=kind_phys) wk1(im), wk2(im), wk3(im),prod(im,pl_coeff), & & ozib(im), colo3(im,levs+1), coloz(im,levs+1),& @@ -163,16 +164,16 @@ subroutine ozphys_2015_run ( & !ccpp ozo(i,l) = (ozib(i) + tem*dt) / (1.0 - prod(i,2)*dt) oz(i,l) = (ozib(i) + tem*dt) / (1.0 - prod(i,2)*dt) enddo -! if (ldiag3d) then ! ozone change diagnostics -! do i=1,im -! ozp1(i,l) = ozp1(i,l) + (prod(i,1)-prod(i,2)*prod(i,6))*dt + if (ldiag3d .and. qdiag3d) then ! ozone change diagnostics + do i=1,im + ozp1(i,l) = ozp1(i,l) + (prod(i,1)-prod(i,2)*prod(i,6))*dt !!ccpp ozp(i,l,2) = ozp(i,l,2) + (ozo(i,l) - ozib(i)) -! ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) -! ozp3(i,l) = ozp3(i,l) + prod(i,3)*(tin(i,l)-prod(i,5))*dt -! ozp4(i,l) = ozp4(i,l) + prod(i,4) -! & * (colo3(i,l)-coloz(i,l))*dt -! enddo -! endif + ozp2(i,l) = ozp2(i,l) + (oz(i,l) - ozib(i)) + ozp3(i,l) = ozp3(i,l) + prod(i,3)*(tin(i,l)-prod(i,5))*dt + ozp4(i,l) = ozp4(i,l) + prod(i,4) + & * (colo3(i,l)-coloz(i,l))*dt + enddo + endif enddo ! vertical loop ! return diff --git a/physics/ozphys_2015.meta b/physics/ozphys_2015.meta index 51f8e76f4..eedfe3ca2 100644 --- a/physics/ozphys_2015.meta +++ b/physics/ozphys_2015.meta @@ -147,6 +147,14 @@ type = logical intent = in optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F [ozp1] standard_name = cumulative_change_in_ozone_concentration_due_to_production_and_loss_rate long_name = cumulative change in ozone concentration due to production and loss rate From 15f36e7b1b8d72c18cc82660ca6657b5b0e3c63f Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Thu, 6 Feb 2020 15:44:53 +0000 Subject: [PATCH 09/12] Correct tendency flag names, implement some more diagnostic tendencies, implement model/ccpp/total tendencies. --- physics/GFS_DCNV_generic.F90 | 5 +- physics/GFS_DCNV_generic.meta | 7 ++ physics/GFS_GWD_generic.F90 | 12 +- physics/GFS_GWD_generic.meta | 4 +- physics/GFS_PBL_generic.F90 | 6 +- physics/GFS_PBL_generic.meta | 2 +- physics/GFS_SCNV_generic.F90 | 5 +- physics/GFS_SCNV_generic.meta | 7 ++ physics/cires_ugwp.F90 | 11 +- physics/cires_ugwp.meta | 7 ++ physics/cu_gf_driver.F90 | 39 +++++- physics/cu_gf_driver.meta | 92 +++++++++++++++ physics/model_tend_post.F90 | 105 +++++++++++++++++ physics/model_tend_post.meta | 216 ++++++++++++++++++++++++++++++++++ physics/model_tend_pre.F90 | 75 ++++++++++++ physics/model_tend_pre.meta | 215 +++++++++++++++++++++++++++++++++ physics/moninedmf.f | 12 +- physics/moninedmf.meta | 7 ++ physics/rayleigh_damp.f | 6 +- physics/satmedmfvdif.F | 19 ++- physics/satmedmfvdif.meta | 47 ++++++++ physics/total_tend.F90 | 75 ++++++++++++ physics/total_tend.meta | 191 ++++++++++++++++++++++++++++++ 23 files changed, 1135 insertions(+), 30 deletions(-) create mode 100644 physics/model_tend_post.F90 create mode 100644 physics/model_tend_post.meta create mode 100644 physics/model_tend_pre.F90 create mode 100644 physics/model_tend_pre.meta create mode 100644 physics/total_tend.F90 create mode 100644 physics/total_tend.meta diff --git a/physics/GFS_DCNV_generic.F90 b/physics/GFS_DCNV_generic.F90 index eb6e277d5..42d9987c3 100644 --- a/physics/GFS_DCNV_generic.F90 +++ b/physics/GFS_DCNV_generic.F90 @@ -99,7 +99,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, cs isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, & gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, & rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, & - cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, & + cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend, & cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg) use machine, only: kind_phys @@ -108,6 +108,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, cs integer, intent(in) :: im, levs logical, intent(in) :: lssav, ldiag3d, ras, cscnv, do_ca, isppt_deep, qdiag3d + logical, intent(in) :: flag_for_dcnv_generic_tend real(kind=kind_phys), intent(in) :: frain, dtf real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d @@ -175,7 +176,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, cs cldwrk (i) = cldwrk (i) + cld1d(i) * dtf enddo - if (ldiag3d) then + if (ldiag3d .and. flag_for_dcnv_generic_tend) then do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k)-save_t(i,k)) * frain diff --git a/physics/GFS_DCNV_generic.meta b/physics/GFS_DCNV_generic.meta index c5c006e88..5d940c8a4 100644 --- a/physics/GFS_DCNV_generic.meta +++ b/physics/GFS_DCNV_generic.meta @@ -544,6 +544,13 @@ kind = kind_phys intent = inout optional = F +[flag_for_dcnv_generic_tend] + standard_name = true_if_GFS_DCNV_generic_should_calculate_tendencies + long_name = true if GFS_DCNV_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [tconvtend] standard_name = tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep long_name = tendency of air temperature due to deep convection diff --git a/physics/GFS_GWD_generic.F90 b/physics/GFS_GWD_generic.F90 index f05fa508f..963269329 100644 --- a/physics/GFS_GWD_generic.F90 +++ b/physics/GFS_GWD_generic.F90 @@ -20,7 +20,7 @@ subroutine GFS_GWD_generic_pre_run( & & oc, oa4, clx, theta, & & sigma, gamma, elvmax, lssav, ldiag3d, & & dudt, dvdt, dtdt, du3dt, dv3dt, dt3dt, dtf, & - & gwd_generic_tend, errmsg, errflg) + & flag_for_gwd_generic_tend, errmsg, errflg) use machine, only : kind_phys implicit none @@ -32,7 +32,7 @@ subroutine GFS_GWD_generic_pre_run( & & oc(im), oa4(im,4), clx(im,4), & & theta(im), sigma(im), gamma(im), elvmax(im) - logical, intent(in) :: lssav, ldiag3d, gwd_generic_tend + logical, intent(in) :: lssav, ldiag3d, flag_for_gwd_generic_tend real(kind=kind_phys), intent(in) :: dtdt(im,levs), dudt(im,levs), dvdt(im,levs) ! dt3dt only allocated only if ldiag3d is .true. real(kind=kind_phys), intent(inout) :: dt3dt(:,:), du3dt(:,:), dv3dt(:,:) @@ -92,7 +92,7 @@ subroutine GFS_GWD_generic_pre_run( & endif ! end if_nmtvr if (lssav) then - if (ldiag3d .and. gwd_generic_tend) then + if (ldiag3d .and. flag_for_gwd_generic_tend) then do k=1,levs do i=1,im dt3dt(i,k) = dt3dt(i,k) - dtdt(i,k)*dtf @@ -128,12 +128,12 @@ end subroutine GFS_GWD_generic_post_init !! \section detailed Detailed Algorithm !! @{ subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, dvdt, dtdt, & - & dugwd, dvgwd, du3dt, dv3dt, dt3dt, gwd_generic_tend, errmsg, errflg) + & dugwd, dvgwd, du3dt, dv3dt, dt3dt, flag_for_gwd_generic_tend, errmsg, errflg) use machine, only : kind_phys implicit none - logical, intent(in) :: lssav, ldiag3d, gwd_generic_tend + logical, intent(in) :: lssav, ldiag3d, flag_for_gwd_generic_tend real(kind=kind_phys), intent(in) :: dusfcg(:), dvsfcg(:) real(kind=kind_phys), intent(in) :: dudt(:,:), dvdt(:,:), dtdt(:,:) @@ -153,7 +153,7 @@ subroutine GFS_GWD_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, d dugwd(:) = dugwd(:) + dusfcg(:)*dtf dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf - if (ldiag3d .and. gwd_generic_tend) then + if (ldiag3d .and. flag_for_gwd_generic_tend) then du3dt(:,:) = du3dt(:,:) + dudt(:,:) * dtf dv3dt(:,:) = dv3dt(:,:) + dvdt(:,:) * dtf dt3dt(:,:) = dt3dt(:,:) + dtdt(:,:) * dtf diff --git a/physics/GFS_GWD_generic.meta b/physics/GFS_GWD_generic.meta index 782adfa59..13a0d7b49 100644 --- a/physics/GFS_GWD_generic.meta +++ b/physics/GFS_GWD_generic.meta @@ -177,7 +177,7 @@ kind = kind_phys intent = in optional = F -[gwd_generic_tend] +[flag_for_gwd_generic_tend] standard_name = true_if_GFS_GWD_generic_should_calculate_tendencies long_name = true if GFS_GWD_generic should calculate tendencies units = flag @@ -326,7 +326,7 @@ kind = kind_phys intent = inout optional = F -[gwd_generic_tend] +[flag_for_gwd_generic_tend] standard_name = true_if_GFS_GWD_generic_should_calculate_tendencies long_name = true if GFS_GWD_generic should calculate tendencies units = flag diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index cd4a30849..f0ab372a4 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -281,7 +281,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, trans_aero, ntchs, ntchm, & imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, imp_physics_zhao_carr, imp_physics_mg, & imp_physics_fer_hires, & - ltaerosol, cplflx, cplchm, lssav, pbl_generic_tend, ldiag3d, qdiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & + ltaerosol, cplflx, cplchm, lssav, flag_for_pbl_generic_tend, ldiag3d, qdiag3d, lsidea, hybedmf, do_shoc, satmedmf, shinhong, do_ysu, & dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu, & dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, & dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, dqsfc_diag, & @@ -301,7 +301,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu - logical, intent(in) :: pbl_generic_tend + logical, intent(in) :: flag_for_pbl_generic_tend real(kind=kind_phys), intent(in) :: dtf real(kind=kind_phys), intent(in) :: rd, cp, fvirt, hvap @@ -553,7 +553,7 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, ! & dtf,' kdt=',kdt,' lat=',lat ! endif - if (ldiag3d .and. pbl_generic_tend) then + if (ldiag3d .and. flag_for_pbl_generic_tend) then if (lsidea) then dt3dt(1:im,:) = dt3dt(1:im,:) + dtdt(1:im,:)*dtf else diff --git a/physics/GFS_PBL_generic.meta b/physics/GFS_PBL_generic.meta index 4256049dd..ab4eca5da 100644 --- a/physics/GFS_PBL_generic.meta +++ b/physics/GFS_PBL_generic.meta @@ -601,7 +601,7 @@ type = logical intent = in optional = F -[pbl_generic_tend] +[flag_for_pbl_generic_tend] standard_name = true_if_GFS_PBL_generic_should_calculate_tendencies long_name = true if GFS_PBL_generic should calculate tendencies units = flag diff --git a/physics/GFS_SCNV_generic.F90 b/physics/GFS_SCNV_generic.F90 index 1cbff590e..3aecee8f3 100644 --- a/physics/GFS_SCNV_generic.F90 +++ b/physics/GFS_SCNV_generic.F90 @@ -71,6 +71,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl frain, gt0, gq0_water_vapor, save_t, save_qv, dqdti, dt3dt, dq3dt, clw, & shcnvcw, rain1, npdf3d, num_p3d, ncnvcld3d, cnvc, cnvw, & rainc, cnvprcp, cnvprcpb, cnvw_phy_f3d, cnvc_phy_f3d, & + flag_for_scnv_generic_tend, & imfshalcnv, imfshalcnv_sas, imfshalcnv_samf, errmsg, errflg) use machine, only: kind_phys @@ -78,7 +79,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl implicit none integer, intent(in) :: im, levs, nn - logical, intent(in) :: lssav, ldiag3d, qdiag3d, cplchm + logical, intent(in) :: lssav, ldiag3d, qdiag3d, cplchm, flag_for_scnv_generic_tend real(kind=kind_phys), intent(in) :: frain real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, gq0_water_vapor real(kind=kind_phys), dimension(im,levs), intent(in) :: save_t, save_qv @@ -132,7 +133,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl endif endif - if (lssav) then + if (lssav .and. flag_for_scnv_generic_tend) then if (ldiag3d) then do k=1,levs do i=1,im diff --git a/physics/GFS_SCNV_generic.meta b/physics/GFS_SCNV_generic.meta index 24dd7236d..52538d3e8 100644 --- a/physics/GFS_SCNV_generic.meta +++ b/physics/GFS_SCNV_generic.meta @@ -332,6 +332,13 @@ kind = kind_phys intent = inout optional = F +[flag_for_scnv_generic_tend] + standard_name = true_if_GFS_SCNV_generic_should_calculate_tendencies + long_name = true if GFS_SCNV_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [imfshalcnv] standard_name = flag_for_mass_flux_shallow_convection_scheme long_name = flag for mass-flux shallow convection scheme diff --git a/physics/cires_ugwp.F90 b/physics/cires_ugwp.F90 index 1daa10af5..91b9b35f3 100644 --- a/physics/cires_ugwp.F90 +++ b/physics/cires_ugwp.F90 @@ -151,7 +151,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr dudt, dvdt, dtdt, rdxzb, con_g, con_pi, con_cp, con_rd, con_rv, con_fvirt, & rain, ntke, q_tke, dqdt_tke, lprnt, ipr, & ldu3dt_ogw, ldv3dt_ogw, ldt3dt_ogw, ldu3dt_cgw, ldv3dt_cgw, ldt3dt_cgw, & - ldiag3d, lssav, errmsg, errflg) + ldiag3d, lssav, flag_for_gwd_generic_tend, errmsg, errflg) implicit none @@ -159,6 +159,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr integer, intent(in) :: me, master, im, levs, ntrac, kdt, lonr, nmtvr integer, intent(in), dimension(im) :: kpbl real(kind=kind_phys), intent(in), dimension(im) :: oro, oro_uf, hprime, oc, theta, sigma, gamma + logical, intent(in) :: flag_for_gwd_generic_tend ! elvmax is intent(in) for CIRES UGWP, but intent(inout) for GFS GWDPS real(kind=kind_phys), intent(inout), dimension(im) :: elvmax real(kind=kind_phys), intent(in), dimension(im, 4) :: clx, oa4 @@ -176,8 +177,8 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr real(kind=kind_phys), intent(out), dimension(im, levs):: dudt_mtb, dudt_ogw, dudt_tms ! These arrays are only allocated if ldiag=.true. - real(kind=kind_phys), intent(inout), dimension(im, levs) :: ldu3dt_ogw, ldv3dt_ogw, ldt3dt_ogw - real(kind=kind_phys), intent(inout), dimension(im, levs) :: ldu3dt_cgw, ldv3dt_cgw, ldt3dt_cgw + real(kind=kind_phys), intent(inout), dimension(:,:) :: ldu3dt_ogw, ldv3dt_ogw, ldt3dt_ogw + real(kind=kind_phys), intent(inout), dimension(:,:) :: ldu3dt_cgw, ldv3dt_cgw, ldt3dt_cgw logical, intent(in) :: ldiag3d, lssav ! These arrays only allocated if ldiag_ugwp = .true. @@ -272,7 +273,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr endif ! do_ugwp - if(ldiag3d .and. lssav) then + if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend) then do k=1,levs do i=1,im ldu3dt_ogw(i,k) = ldu3dt_ogw(i,k) + Pdudt(i,k)*dtp @@ -379,7 +380,7 @@ subroutine cires_ugwp_run(do_ugwp, me, master, im, levs, ntrac, dtp, kdt, lonr gw_dudt = gw_dudt*(1.-pked) + ed_dudt*pked #endif - if(ldiag3d .and. lssav) then + if(ldiag3d .and. lssav .and. .not. flag_for_gwd_generic_tend) then do k=1,levs do i=1,im ldu3dt_cgw(i,k) = ldu3dt_cgw(i,k) + (gw_dudt(i,k) - Pdudt(i,k))*dtp diff --git a/physics/cires_ugwp.meta b/physics/cires_ugwp.meta index 32c64145f..6720bd7c7 100644 --- a/physics/cires_ugwp.meta +++ b/physics/cires_ugwp.meta @@ -911,6 +911,13 @@ dimensions = () type = logical intent = in +[flag_for_gwd_generic_tend] + standard_name = true_if_GFS_GWD_generic_should_calculate_tendencies + long_name = true if GFS_GWD_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/cu_gf_driver.F90 b/physics/cu_gf_driver.F90 index 53e26fb46..3f5e6ef78 100644 --- a/physics/cu_gf_driver.F90 +++ b/physics/cu_gf_driver.F90 @@ -75,7 +75,10 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, & hbot,htop,kcnv,xland,hfx2,qfx2,cliw,clcw, & pbl,ud_mf,dd_mf,dt_mf,cnvw_moist,cnvc,imfshalcnv, & nwfa,con_rd,gq0,ntinc,ntlnc,imp_physics,imp_physics_thompson, & - errmsg,errflg) + flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend, & + du3dt_SCNV,dv3dt_SCNV,dt3dt_SCNV,dq3dt_SCNV, & + du3dt_DCNV,dv3dt_DCNV,dt3dt_DCNV,dq3dt_DCNV, & + ldiag3d,qdiag3d,errmsg,errflg) !------------------------------------------------------------- implicit none integer, parameter :: maxiens=1 @@ -97,6 +100,8 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, & !------------------------------------------------------------- integer :: its,ite, jts,jte, kts,kte integer, intent(in ) :: im,ix,km,ntracer + logical, intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend + logical, intent(in ) :: ldiag3d,qdiag3d real(kind=kind_phys), dimension( ix , km ), intent(in ) :: forcet,forceqv_spechum,w,phil real(kind=kind_phys), dimension( ix , km ), intent(inout ) :: t,us,vs @@ -106,6 +111,10 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, & real(kind=kind_phys), dimension( ix , km ), intent(out ) :: cnvw_moist,cnvc real(kind=kind_phys), dimension( ix , km ), intent(inout ) :: cliw, clcw + real(kind=kind_phys), dimension( : , : ), intent(inout ) :: & + du3dt_SCNV,dv3dt_SCNV,dt3dt_SCNV,dq3dt_SCNV, & + du3dt_DCNV,dv3dt_DCNV,dt3dt_DCNV,dq3dt_DCNV + ! change from ix to im integer, dimension (im), intent(inout) :: hbot,htop,kcnv integer, dimension (im), intent(in) :: xland @@ -879,6 +888,34 @@ subroutine cu_gf_driver_run(ntracer,garea,im,ix,km,dt,cactiv, & qv_spechum = qv/(1.0_kind_phys+qv) cnvw_moist = cnvw/(1.0_kind_phys+qv) ! +! Diagnostic tendency updates +! + if(ldiag3d) then + if(.not.flag_for_scnv_generic_tend) then + do k=kts,ktf + do i=its,itf + du3dt_SCNV(i,k) = du3dt_SCNV(i,k) + outus(i,k) * dt + dv3dt_SCNV(i,k) = dv3dt_SCNV(i,k) + outvs(i,k) * dt + dt3dt_SCNV(i,k) = dt3dt_SCNV(i,k) + outts(i,k) * dt + if(qdiag3d) then + dq3dt_SCNV(i,k) = dq3dt_SCNV(i,k) + outqs(i,k) * dt + endif + enddo + enddo + endif + if(.not.flag_for_dcnv_generic_tend) then + do k=kts,ktf + do i=its,itf + du3dt_DCNV(i,k) = du3dt_DCNV(i,k) + (outu(i,k)+outum(i,k)) * dt + dv3dt_DCNV(i,k) = dv3dt_DCNV(i,k) + (outv(i,k)+outvm(i,k)) * dt + dt3dt_DCNV(i,k) = dt3dt_DCNV(i,k) + (outt(i,k)+outtm(i,k)) * dt + if(qdiag3d) then + dq3dt_DCNV(i,k) = dq3dt_DCNV(i,k) + (outq(i,k)+outqm(i,k)) * dt + endif + enddo + enddo + endif + endif end subroutine cu_gf_driver_run !> @} end module cu_gf_driver diff --git a/physics/cu_gf_driver.meta b/physics/cu_gf_driver.meta index d3687a352..c75d944ee 100644 --- a/physics/cu_gf_driver.meta +++ b/physics/cu_gf_driver.meta @@ -417,6 +417,98 @@ type = integer intent = in optional = F +[flag_for_scnv_generic_tend] + standard_name = true_if_GFS_SCNV_generic_should_calculate_tendencies + long_name = true if GFS_SCNV_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in +[flag_for_dcnv_generic_tend] + standard_name = true_if_GFS_DCNV_generic_should_calculate_tendencies + long_name = true if GFS_DCNV_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in +[du3dt_SCNV] + standard_name = cumulative_change_in_x_wind_due_to_shal_convection + long_name = cumulative change in x wind due to shallow convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_SCNV] + standard_name = cumulative_change_in_y_wind_due_to_shal_convection + long_name = cumulative change in y wind due to shallow convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_SCNV] + standard_name = cumulative_change_in_temperature_due_to_shal_convection + long_name = cumulative change in temperature due to shallow convection + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_SCNV] + standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_shal_convection + long_name = cumulative change in water vapor specific humidity due to shallow convection + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_DCNV] + standard_name = cumulative_change_in_x_wind_due_to_deep_convection + long_name = cumulative change in x wind due to deep convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_DCNV] + standard_name = cumulative_change_in_y_wind_due_to_deep_convection + long_name = cumulative change in y wind due to deep convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_DCNV] + standard_name = cumulative_change_in_temperature_due_to_deep_convection + long_name = cumulative change in temperature due to deep convection + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_DCNV] + standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_deep_convection + long_name = cumulative change in water vapor specific humidity due to deep convection + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/model_tend_post.F90 b/physics/model_tend_post.F90 new file mode 100644 index 000000000..8ae7b6844 --- /dev/null +++ b/physics/model_tend_post.F90 @@ -0,0 +1,105 @@ +!>\file model_tend_post.F90 +!! Calculates tendencies from all processes outside of CPPP + +module model_tend_post + +contains + + subroutine model_tend_post_init() + end subroutine model_tend_post_init + + subroutine model_tend_post_finalize() + end subroutine model_tend_post_finalize + + !> \section arg_table_model_tend_post_run Argument Table + !! \htmlinclude model_tend_post_run.html + !! + subroutine model_tend_post_run(kdt, & + gt0,gu0,gv0, gq0_water_vapor, & + t_start,u_start,v_start,q_start, & + t_end, u_end, v_end, q_end, & + dt3dt_ccpp, du3dt_ccpp, dv3dt_ccpp, dq3dt_ccpp, & +! dt3dt_total, du3dt_total, dv3dt_total, dq3dt_total, & + im, levs, ntrac, index_for_water_vapor, & + lssav, ldiag3d, qdiag3d, errmsg,errflg) + use machine, only: kind_phys + implicit none + + real(kind=kind_phys), dimension(:,:), intent(in) :: gt0, gu0, gv0, gq0_water_vapor + real(kind=kind_phys), dimension(:,:), intent(in) :: t_start, u_start, v_start + real(kind=kind_phys), dimension(:,:), intent(in) :: q_start + real(kind=kind_phys), dimension(:,:), intent(inout) :: t_end, u_end, v_end + real(kind=kind_phys), dimension(:,:), intent(inout) :: q_end + real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt_ccpp, dv3dt_ccpp + real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt_ccpp, dq3dt_ccpp + ! real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt_total, dv3dt_total + ! real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt_total, dq3dt_total + + integer, intent(in) :: im, levs, ntrac, kdt + integer, intent(in) :: index_for_water_vapor + + logical, intent(in) :: lssav, qdiag3d, ldiag3d + + character(len=*), intent(out) :: errmsg + integer, intent(out) :: errflg + + real(kind=kind_phys) :: dt + integer :: i,k + + ! Initialize CCPP error handling variables + errmsg = '' + errflg = 0 + + diag_enabled: if(lssav .and. ldiag3d) then + if(any(gt0(1:im,1:levs)<1e-3)) then + print *,'error: temperatures less than 1e-3' + endif + if(all(abs(gu0(1:im,1:levs))<1e-3)) then + print *,'error: all u wind is near zero' + endif + if(all(abs(gv0(1:im,1:levs))<1e-3)) then + print *,'error: all v wind is near zero' + endif + + if(any(t_start(1:im,1:levs)<1e-3)) then + print *,'error: start temperatures less than 1e-3' + endif + if(all(abs(u_start(1:im,1:levs))<1e-3)) then + print *,'error: all start u wind is near zero' + endif + if(all(abs(v_start(1:im,1:levs))<1e-3)) then + print *,'error: all start v wind is near zero' + endif + + do k=1,levs + do i=1,im + ! if(t_end(i,k)>1e-3 .and. gt0(i,k)>1e-3) then + ! dt3dt_total(i,k) = dt3dt_total(i,k) + gt0(i,k)-t_end(i,k) + ! du3dt_total(i,k) = du3dt_total(i,k) + gu0(i,k)-u_end(i,k) + ! dv3dt_total(i,k) = dv3dt_total(i,k) + gv0(i,k)-v_end(i,k) + ! if(qdiag3d) then + ! dq3dt_total(i,k) = dq3dt_total(i,k) + gq0_water_vapor(i,k)-q_end(i,k) + ! endif + ! endif + t_end(i,k) = gt0(i,k) + u_end(i,k) = gu0(i,k) + v_end(i,k) = gv0(i,k) + if(qdiag3d) then + q_end(i,k) = gq0_water_vapor(i,k) + endif + if(t_end(i,k)>1e-3 .and. t_start(i,k)>1e-3) then + dt3dt_ccpp(i,k) = dt3dt_ccpp(i,k) + t_end(i,k)-t_start(i,k) + du3dt_ccpp(i,k) = du3dt_ccpp(i,k) + u_end(i,k)-u_start(i,k) + dv3dt_ccpp(i,k) = dv3dt_ccpp(i,k) + v_end(i,k)-v_start(i,k) + if(qdiag3d) then + dq3dt_ccpp(i,k) = dq3dt_ccpp(i,k) + q_end(i,k)-q_start(i,k) + endif + endif + enddo + enddo + + endif diag_enabled + + end subroutine model_tend_post_run + +end module model_tend_post diff --git a/physics/model_tend_post.meta b/physics/model_tend_post.meta new file mode 100644 index 000000000..a97fa4dad --- /dev/null +++ b/physics/model_tend_post.meta @@ -0,0 +1,216 @@ +[ccpp-arg-table] + name = model_tend_post_init + type = scheme +[ccpp-arg-table] + name = model_tend_post_finalize + type = scheme +[ccpp-arg-table] + name = model_tend_post_run + type = scheme +[kdt] + standard_name = index_of_time_step + long_name = current forecast iteration + units = index + dimensions = () + type = integer + intent = in + optional = F +[gt0] + standard_name = air_temperature_updated_by_physics + long_name = temperature updated by physics + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gu0] + standard_name = x_wind_updated_by_physics + long_name = zonal wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gv0] + standard_name = y_wind_updated_by_physics + long_name = meridional wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gq0_water_vapor] + standard_name = water_vapor_specific_humidity_updated_by_physics + long_name = water vapor specific humidity updated by physics + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[t_start] + standard_name = temperature_at_start_of_ccpp + long_name = temperature at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[u_start] + standard_name = x_wind_at_start_of_ccpp + long_name = x wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[v_start] + standard_name = y_wind_at_start_of_ccpp + long_name = y wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[q_start] + standard_name = water_vapor_specific_humidity_at_start_of_ccpp + long_name = water vapor specific humidity at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[t_end] + standard_name = temperature_at_end_of_ccpp + long_name = temperature at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[u_end] + standard_name = x_wind_at_end_of_ccpp + long_name = x wind at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[v_end] + standard_name = y_wind_at_end_of_ccpp + long_name = y wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[q_end] + standard_name = water_vapor_specific_humidity_at_end_of_ccpp + long_name = water vapor specific humidity at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_ccpp] + standard_name = cumulative_change_in_temperature_from_ccpp + long_name = cumulative change in temperature from CCPP + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_ccpp] + standard_name = cumulative_change_in_x_wind_from_ccpp + long_name = cumulative change in x wind from CCPP + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_ccpp] + standard_name = cumulative_change_in_y_wind_from_ccpp + long_name = cumulative change in y wind from CCPP + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_ccpp] + standard_name = cumulative_change_in_water_vapor_specific_humidity_from_CCPP + long_name = cumulative change in water vapor specific humidity from CCPP + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[im] + standard_name = horizontal_loop_extent + long_name = horizontal loop extent + units = count + dimensions = () + type = integer + intent = in +[levs] + standard_name = vertical_dimension + long_name = vertical layer dimension + units = count + dimensions = () + type = integer + intent = in +[ntrac] + standard_name = number_of_tracers + long_name = number of tracers + units = count + dimensions = () + type = integer + intent = in +[index_for_water_vapor] + standard_name = index_for_water_vapor + long_name = tracer index for water vapor (specific humidity) + units = index + dimensions = () + type = integer + intent = in +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical + intent = in +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[errmsg] + standard_name = ccpp_error_message + long_name = error message for error handling in CCPP + units = none + dimensions = () + type = character + kind = len=* + intent = out +[errflg] + standard_name = ccpp_error_flag + long_name = error flag for error handling in CCPP + units = flag + dimensions = () + type = integer + intent = out + + + + + + + diff --git a/physics/model_tend_pre.F90 b/physics/model_tend_pre.F90 new file mode 100644 index 000000000..94ad2ee1a --- /dev/null +++ b/physics/model_tend_pre.F90 @@ -0,0 +1,75 @@ +!>\file model_tend_pre.F90 +!! Calculates tendencies from all processes outside of CPPP + +module model_tend_pre + +contains + +!> \section arg_table_model_tend_pre_init Argument Table +!! +subroutine model_tend_pre_init() +end subroutine model_tend_pre_init + +!> \section arg_table_model_tend_pre_finalize Argument Table +!! +subroutine model_tend_pre_finalize() +end subroutine model_tend_pre_finalize + +!> \section arg_table_model_tend_pre_run Argument Table +!! \htmlinclude model_tend_pre_run.html +!! +subroutine model_tend_pre_run(dtp, kdt, & + tgrs,ugrs,vgrs,qvgrs, t_start,u_start,v_start,q_start, & + dt3dt_model,du3dt_model,dv3dt_model,dq3dt_model, & + t_end,u_end,v_end,q_end, & + im, levs, ntrac, & + lssav, ldiag3d, qdiag3d, errmsg,errflg) + use machine, only: kind_phys + implicit none + + real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs, ugrs, vgrs, qvgrs + real(kind=kind_phys), dimension(:,:), intent(out) :: t_start, u_start, v_start + real(kind=kind_phys), dimension(:,:), intent(out) :: q_start + real(kind=kind_phys), dimension(:,:), intent(out) :: t_end, u_end, v_end + real(kind=kind_phys), dimension(:,:), intent(out) :: q_end + real(kind=kind_phys), dimension(:,:), intent(inout) :: & + dt3dt_model,du3dt_model,dv3dt_model,dq3dt_model + + integer, intent(in) :: im, levs, ntrac, kdt + + logical, intent(in) :: lssav, qdiag3d, ldiag3d + + real(kind=kind_phys) :: dtp + + character(len=*), intent(out) :: errmsg + integer, intent(out) :: errflg + + integer :: i, k + + ! Initialize CCPP error handling variables + errmsg = '' + errflg = 0 + + if(Lssav .and. ldiag3d) then + do k=1,levs + do i=1,im + t_start(i,k) = tgrs(i,k) + u_start(i,k) = ugrs(i,k) + v_start(i,k) = vgrs(i,k) + if(qdiag3d) then + q_start(i,k) = qvgrs(i,k) + endif + if(t_start(i,k)>1e-3 .and. t_end(i,k)>1e-3) then + dt3dt_model(i,k) = dt3dt_model(i,k) + (t_start(i,k)-t_end(i,k)) + du3dt_model(i,k) = du3dt_model(i,k) + (u_start(i,k)-u_end(i,k)) + dv3dt_model(i,k) = dv3dt_model(i,k) + (v_start(i,k)-v_end(i,k)) + if(qdiag3d) then + dq3dt_model(i,k) = dq3dt_model(i,k) + (q_start(i,k)-q_end(i,k)) + endif + endif + enddo + enddo + endif +end subroutine model_tend_pre_run + +end module model_tend_pre diff --git a/physics/model_tend_pre.meta b/physics/model_tend_pre.meta new file mode 100644 index 000000000..0cbb9b4e9 --- /dev/null +++ b/physics/model_tend_pre.meta @@ -0,0 +1,215 @@ +[ccpp-arg-table] + name = model_tend_pre_init + type = scheme + +######################################################################## +[ccpp-arg-table] + name = model_tend_pre_finalize + type = scheme + +######################################################################## +[ccpp-arg-table] + name = model_tend_pre_run + type = scheme +[dtp] + standard_name = time_step_for_physics + long_name = physics timestep + units = s + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F +[kdt] + standard_name = index_of_time_step + long_name = current forecast iteration + units = index + dimensions = () + type = integer + intent = in + optional = F +[tgrs] + standard_name = air_temperature + long_name = model layer mean temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[ugrs] + standard_name = x_wind + long_name = zonal wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[vgrs] + standard_name = y_wind + long_name = meridional wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[qvgrs] + standard_name = water_vapor_specific_humidity + long_name = water vapor specific humidity + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[t_start] + standard_name = temperature_at_start_of_ccpp + long_name = temperature at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out +[u_start] + standard_name = x_wind_at_start_of_ccpp + long_name = x wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out +[v_start] + standard_name = y_wind_at_start_of_ccpp + long_name = y wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out +[q_start] + standard_name = water_vapor_specific_humidity_at_start_of_ccpp + long_name = water vapor specific humidity at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out +[dt3dt_model] + standard_name = cumulative_change_in_temperature_from_model + long_name = cumulative change in temperature from model + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_model] + standard_name = cumulative_change_in_x_wind_from_model + long_name = cumulative change in x wind from model + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_model] + standard_name = cumulative_change_in_y_wind_from_model + long_name = cumulative change in y wind from model + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_model] + standard_name = cumulative_change_in_water_vapor_specific_humidity_from_model + long_name = cumulative change in water vapor specific humidity from model + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[t_end] + standard_name = temperature_at_end_of_ccpp + long_name = temperature at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[u_end] + standard_name = x_wind_at_end_of_ccpp + long_name = x wind at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[v_end] + standard_name = y_wind_at_end_of_ccpp + long_name = y wind at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[q_end] + standard_name = water_vapor_specific_humidity_at_end_of_ccpp + long_name = water vapor specific humidity at end of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[im] + standard_name = horizontal_loop_extent + long_name = horizontal loop extent + units = count + dimensions = () + type = integer + intent = in +[levs] + standard_name = vertical_dimension + long_name = vertical layer dimension + units = count + dimensions = () + type = integer + intent = in +[ntrac] + standard_name = number_of_tracers + long_name = number of tracers + units = count + dimensions = () + type = integer + intent = in +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical + intent = in +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[errmsg] + standard_name = ccpp_error_message + long_name = error message for error handling in CCPP + units = none + dimensions = () + type = character + kind = len=* + intent = out +[errflg] + standard_name = ccpp_error_flag + long_name = error flag for error handling in CCPP + units = flag + dimensions = () + type = integer + intent = out diff --git a/physics/moninedmf.f b/physics/moninedmf.f index f6558a861..d3fd9e45e 100644 --- a/physics/moninedmf.f +++ b/physics/moninedmf.f @@ -66,7 +66,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & & kinver,xkzm_m,xkzm_h,xkzm_s,lprnt,ipr, & & xkzminv,moninq_fac,lssav,ldiag3d,qdiag3d,lsidea,ntoz, & & du3dt_PBL,dv3dt_PBL,dt3dt_PBL,dq3dt_PBL,do3dt_PBL, & - & errmsg,errflg) + & flag_for_pbl_generic_tend, errmsg,errflg) ! use machine , only : kind_phys use funcphys , only : fpvs @@ -77,6 +77,7 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & ! arguments ! logical, intent(in) :: lprnt,lssav,ldiag3d,qdiag3d,lsidea + logical, intent(in) :: flag_for_pbl_generic_tend integer, intent(in) :: ipr integer, intent(in) :: ix, im, km, ntrac, ntcw, kinver(im), ntoz integer, intent(out) :: kpbl(im) @@ -1041,7 +1042,8 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & rtg(i,k,1) = rtg(i,k,1)+qtend dtsfc(i) = dtsfc(i)+cont*del(i,k)*ttend dqsfc(i) = dqsfc(i)+conq*del(i,k)*qtend - if(lssav .and. ldiag3d) then + if(lssav .and. ldiag3d .and. .not. & + & flag_for_pbl_generic_tend) then if(lsidea) then dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + ttend*rdt else @@ -1064,7 +1066,8 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & enddo enddo enddo - if(lssav .and. ldiag3d .and. ntoz>0 .and. qdiag3d) then + if(lssav .and. ldiag3d .and. ntoz>0 .and. qdiag3d .and. & + & flag_for_pbl_generic_tend) then is = (ntoz-1) * km do k = 1, km do i = 1, im @@ -1174,7 +1177,8 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & dv(i,k) = dv(i,k) + vtend dusfc(i) = dusfc(i) + conw*del(i,k)*utend dvsfc(i) = dvsfc(i) + conw*del(i,k)*vtend - if(lssav .and. ldiag3d) then + if(lssav .and. ldiag3d .and. .not. & + & flag_for_pbl_generic_tend) then du3dt_PBL(i,k) = du3dt_PBL(i,k) + utend*delt dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + vtend*delt endif diff --git a/physics/moninedmf.meta b/physics/moninedmf.meta index b5a6947c3..6a923d36b 100644 --- a/physics/moninedmf.meta +++ b/physics/moninedmf.meta @@ -575,6 +575,13 @@ type = real kind = kind_phys intent = inout +[flag_for_pbl_generic_tend] + standard_name = true_if_GFS_PBL_generic_should_calculate_tendencies + long_name = true if GFS_PBL_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/rayleigh_damp.f b/physics/rayleigh_damp.f index 814704385..8ef5aa947 100644 --- a/physics/rayleigh_damp.f +++ b/physics/rayleigh_damp.f @@ -74,9 +74,9 @@ subroutine rayleigh_damp_run ( & real(kind=kind_phys),intent(in) :: pgr(im), PRSL(IX,KM) real(kind=kind_phys),intent(in) :: U1(IX,KM), V1(IX,KM) real(kind=kind_phys),intent(inout) :: A(IX,KM), B(IX,KM), C(IX,KM) - real(kind=kind_phys),intent(inout) :: du3dt(IX,KM) - real(kind=kind_phys),intent(inout) :: dv3dt(IX,KM) - real(kind=kind_phys),intent(inout) :: dt3dt(IX,KM) + real(kind=kind_phys),intent(inout) :: du3dt(:,:) + real(kind=kind_phys),intent(inout) :: dv3dt(:,:) + real(kind=kind_phys),intent(inout) :: dt3dt(:,:) character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg diff --git a/physics/satmedmfvdif.F b/physics/satmedmfvdif.F index 5900349e9..64d2c4517 100644 --- a/physics/satmedmfvdif.F +++ b/physics/satmedmfvdif.F @@ -60,7 +60,9 @@ subroutine satmedmfvdif_run(ix,im,km,ntrac,ntcw,ntiw,ntke, & & tsea,heat,evap,stress,spd1,kpbl, & & prsi,del,prsl,prslk,phii,phil,delt, & & dspheat,dusfc,dvsfc,dtsfc,dqsfc,hpbl, & - & kinver,xkzm_m,xkzm_h,xkzm_s,errmsg,errflg) + & kinver,xkzm_m,xkzm_h,xkzm_s, & + & dt3dt_PBL,du3dt_PBL,dv3dt_PBL,dq3dt_PBL,do3dt_PBL, & + & ldiag3d,qdiag3d,errmsg,errflg) ! use machine , only : kind_phys use funcphys , only : fpvs @@ -71,6 +73,10 @@ subroutine satmedmfvdif_run(ix,im,km,ntrac,ntcw,ntiw,ntke, & integer, intent(in) :: ix, im, km, ntrac, ntcw, ntiw, ntke integer, intent(in) :: kinver(im) integer, intent(out) :: kpbl(im) +! + logical, intent(in) :: ldiag3d, qdiag3d + real(kind=kind_phys), intent(inout), dimension(:,:) :: & + & dt3dt_PBL,du3dt_PBL,dv3dt_PBL,dq3dt_PBL,do3dt_PBL ! real(kind=kind_phys), intent(in) :: grav,rd,cp,rv,hvap,hfus,fv, & & eps,epsm1 @@ -1391,6 +1397,12 @@ subroutine satmedmfvdif_run(ix,im,km,ntrac,ntcw,ntiw,ntke, & rtg(i,k,1) = rtg(i,k,1)+qtend dtsfc(i) = dtsfc(i)+cont*del(i,k)*ttend dqsfc(i) = dqsfc(i)+conq*del(i,k)*qtend + if(ldiag3d) then + dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + ttend*delt + if(qdiag3d) then + dq3dt_PBL(i,k) = dq3dt_PBL(i,k) + qtend*delt + endif + endif enddo enddo ! @@ -1491,8 +1503,13 @@ subroutine satmedmfvdif_run(ix,im,km,ntrac,ntcw,ntiw,ntke, & dv(i,k) = dv(i,k)+vtend dusfc(i) = dusfc(i)+conw*del(i,k)*utend dvsfc(i) = dvsfc(i)+conw*del(i,k)*vtend + if(ldiag3d) then + du3dt_PBL(i,k) = du3dt_PBL(i,k) + utend*delt + dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + vtend*delt + endif enddo enddo + ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !> -# Save PBL height for diagnostic purpose diff --git a/physics/satmedmfvdif.meta b/physics/satmedmfvdif.meta index 63480e01b..28cb942c0 100644 --- a/physics/satmedmfvdif.meta +++ b/physics/satmedmfvdif.meta @@ -551,6 +551,53 @@ kind = kind_phys intent = in optional = F +[dt3dt_PBL] + standard_name = cumulative_change_in_temperature_due_to_PBL + long_name = cumulative change in temperature due to PBL + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[du3dt_PBL] + standard_name = cumulative_change_in_x_wind_due_to_PBL + long_name = cumulative change in x wind due to PBL + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[dv3dt_PBL] + standard_name = cumulative_change_in_y_wind_due_to_PBL + long_name = cumulative change in y wind due to PBL + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[dq3dt_PBL] + standard_name = cumulative_change_in_water_vapor_specific_humidity_due_to_PBL + long_name = cumulative change in water vapor specific humidity due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[do3dt_PBL] + standard_name = cumulative_change_in_ozone_mixing_ratio_due_to_PBL + long_name = cumulative change in ozone mixing ratio due to PBL + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/total_tend.F90 b/physics/total_tend.F90 new file mode 100644 index 000000000..c7c5dfe28 --- /dev/null +++ b/physics/total_tend.F90 @@ -0,0 +1,75 @@ +!>\file total_tend.F90 +!! Calculates tendencies from all processes outside of CPPP + +module total_tend + +contains + +!> \section arg_table_total_tend_init Argument Table +!! +subroutine total_tend_init() +end subroutine total_tend_init + +!> \section arg_table_total_tend_finalize Argument Table +!! +subroutine total_tend_finalize() +end subroutine total_tend_finalize + +!> \section arg_table_total_tend_run Argument Table +!! \htmlinclude total_tend_run.html +!! +subroutine total_tend_run(dtp, kdt, & + tgrs,ugrs,vgrs,qvgrs, t_start,u_start,v_start,q_start, & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total, & + im, levs, ntrac, & + lssav, ldiag3d, qdiag3d, errmsg,errflg) + use machine, only: kind_phys + implicit none + + real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs, ugrs, vgrs, qvgrs + real(kind=kind_phys), dimension(:,:), intent(out) :: t_start, u_start, v_start + real(kind=kind_phys), dimension(:,:), intent(out) :: q_start + real(kind=kind_phys), dimension(:,:), intent(inout) :: & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total + + integer, intent(in) :: im, levs, ntrac, kdt + + logical, intent(in) :: lssav, qdiag3d, ldiag3d + + real(kind=kind_phys) :: dtp + + character(len=*), intent(out) :: errmsg + integer, intent(out) :: errflg + + integer :: i, k, good + + ! Initialize CCPP error handling variables + errmsg = '' + errflg = 0 + + good=0 + + if(Lssav .and. ldiag3d) then + print *,'total_tend_run' + do k=1,levs + do i=1,im + if(t_start(i,k)>1e-3 .and. tgrs(i,k)>1e-3) then + good=good+1 + dt3dt_total(i,k) = dt3dt_total(i,k) + tgrs(i,k)-t_start(i,k) + du3dt_total(i,k) = du3dt_total(i,k) + ugrs(i,k)-u_start(i,k) + dv3dt_total(i,k) = dv3dt_total(i,k) + vgrs(i,k)-v_start(i,k) + if(qdiag3d) then + dq3dt_total(i,k) = dq3dt_total(i,k) + qvgrs(i,k)-q_start(i,k) + endif + endif + t_start(i,k)=tgrs(i,k) + u_start(i,k)=ugrs(i,k) + v_start(i,k)=vgrs(i,k) + q_start(i,k)=qvgrs(i,k) + enddo + enddo + print *,'total tend valid points: ',good + endif +end subroutine total_tend_run + +end module total_tend diff --git a/physics/total_tend.meta b/physics/total_tend.meta new file mode 100644 index 000000000..a64fd872b --- /dev/null +++ b/physics/total_tend.meta @@ -0,0 +1,191 @@ +[ccpp-arg-table] + name = total_tend_pre_init + type = scheme + +######################################################################## +[ccpp-arg-table] + name = total_tend_pre_finalize + type = scheme + +######################################################################## +[ccpp-arg-table] + name = total_tend_pre_run + type = scheme +[dtp] + standard_name = time_step_for_physics + long_name = physics timestep + units = s + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F +[kdt] + standard_name = index_of_time_step + long_name = current forecast iteration + units = index + dimensions = () + type = integer + intent = in + optional = F +[tgrs] + standard_name = air_temperature + long_name = model layer mean temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[ugrs] + standard_name = x_wind + long_name = zonal wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[vgrs] + standard_name = y_wind + long_name = meridional wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[qvgrs] + standard_name = water_vapor_specific_humidity + long_name = water vapor specific humidity + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[t_start] + standard_name = temperature_at_start_of_ccpp + long_name = temperature at start of ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = out +[t_start] + standard_name = temperature_at_total_check_point + long_name = temperature when model total is calculated in ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[u_start] + standard_name = x_wind_at_total_check_point + long_name = x when model total is calculated in ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[v_start] + standard_name = y_wind_at_total_check_point + long_name = y when model total is calculated in ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[q_start] + standard_name = water_vapor_specific_humidity_at_total_check_point + long_name = water vapor specific humidity when model total is calculated in ccpp + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dt3dt_total] + standard_name = cumulative_change_in_temperature + long_name = cumulative change in temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_total] + standard_name = cumulative_change_in_x_wind + long_name = cumulative change in x wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_total] + standard_name = cumulative_change_in_y_wind + long_name = cumulative change in y wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_total] + standard_name = cumulative_change_in_water_vapor_specific_humidity + long_name = cumulative change in water vapor specific humidity + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[im] + standard_name = horizontal_loop_extent + long_name = horizontal loop extent + units = count + dimensions = () + type = integer + intent = in +[levs] + standard_name = vertical_dimension + long_name = vertical layer dimension + units = count + dimensions = () + type = integer + intent = in +[ntrac] + standard_name = number_of_tracers + long_name = number of tracers + units = count + dimensions = () + type = integer + intent = in +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical + intent = in +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in +[errmsg] + standard_name = ccpp_error_message + long_name = error message for error handling in CCPP + units = none + dimensions = () + type = character + kind = len=* + intent = out +[errflg] + standard_name = ccpp_error_flag + long_name = error flag for error handling in CCPP + units = flag + dimensions = () + type = integer + intent = out From 1a3c4d1d020bc9edca46a1911232156143cf3001 Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Thu, 13 Feb 2020 18:28:44 +0000 Subject: [PATCH 10/12] All gfs v15p2 and v16beta 3d diagnostic tendencies look reasonable --- physics/GFS_SCNV_generic.F90 | 41 ++++++++++------ physics/GFS_SCNV_generic.meta | 91 +++++++++++++++++++++++++++++++++++ physics/model_tend_post.F90 | 13 +---- physics/model_tend_pre.F90 | 2 + physics/moninedmf.f | 3 +- physics/total_tend.F90 | 4 +- physics/total_tend.meta | 14 ++---- 7 files changed, 128 insertions(+), 40 deletions(-) diff --git a/physics/GFS_SCNV_generic.F90 b/physics/GFS_SCNV_generic.F90 index 3aecee8f3..5496d0f48 100644 --- a/physics/GFS_SCNV_generic.F90 +++ b/physics/GFS_SCNV_generic.F90 @@ -14,18 +14,18 @@ end subroutine GFS_SCNV_generic_pre_finalize !> \section arg_table_GFS_SCNV_generic_pre_run Argument Table !! \htmlinclude GFS_SCNV_generic_pre_run.html !! - subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gt0, gq0_water_vapor, & - save_t, save_qv, errmsg, errflg) + subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gu0, gv0, gt0, gq0_water_vapor, & + save_u, save_v, save_t, save_qv, flag_for_scnv_generic_tend, errmsg, errflg) use machine, only: kind_phys implicit none integer, intent(in) :: im, levs - logical, intent(in) :: ldiag3d, qdiag3d - real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, gq0_water_vapor + logical, intent(in) :: ldiag3d, qdiag3d, flag_for_scnv_generic_tend + real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0, gv0, gt0, gq0_water_vapor - real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t, save_qv + real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_u, save_v, save_t, save_qv character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -35,9 +35,12 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gt0, gq0_water_ errmsg = '' errflg = 0 - if (ldiag3d) then + save_fields: if (ldiag3d .and. flag_for_scnv_generic_tend) then + print *,'save fields in GFS_SCNV_generic_pre_run' do k=1,levs do i=1,im + save_u(i,k) = gu0(i,k) + save_v(i,k) = gv0(i,k) save_t(i,k) = gt0(i,k) enddo enddo @@ -48,7 +51,7 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gt0, gq0_water_ enddo enddo endif - endif + endif save_fields end subroutine GFS_SCNV_generic_pre_run @@ -68,7 +71,7 @@ end subroutine GFS_SCNV_generic_post_finalize !! \htmlinclude GFS_SCNV_generic_post_run.html !! subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cplchm, & - frain, gt0, gq0_water_vapor, save_t, save_qv, dqdti, dt3dt, dq3dt, clw, & + frain, gu0, gv0, gt0, gq0_water_vapor, save_u, save_v, save_t, save_qv, dqdti, du3dt, dv3dt, dt3dt, dq3dt, clw, & shcnvcw, rain1, npdf3d, num_p3d, ncnvcld3d, cnvc, cnvw, & rainc, cnvprcp, cnvprcpb, cnvw_phy_f3d, cnvc_phy_f3d, & flag_for_scnv_generic_tend, & @@ -81,12 +84,12 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl integer, intent(in) :: im, levs, nn logical, intent(in) :: lssav, ldiag3d, qdiag3d, cplchm, flag_for_scnv_generic_tend real(kind=kind_phys), intent(in) :: frain - real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, gq0_water_vapor - real(kind=kind_phys), dimension(im,levs), intent(in) :: save_t, save_qv + real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0, gv0, gt0, gq0_water_vapor + real(kind=kind_phys), dimension(im,levs), intent(in) :: save_u, save_v, save_t, save_qv ! dqdti, dt3dt, dq3dt, only allocated if ldiag3d == .true. real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti - real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt + real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt, dv3dt, dt3dt, dq3dt real(kind=kind_phys), dimension(im,levs,nn), intent(inout) :: clw ! Post code for SAS/SAMF @@ -112,7 +115,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl errmsg = '' errflg = 0 - if (imfshalcnv==imfshalcnv_sas .or. imfshalcnv==imfshalcnv_samf) then + update_cnvw_cnvc: if (imfshalcnv==imfshalcnv_sas .or. imfshalcnv==imfshalcnv_samf) then do i=1,im rainc(i) = rainc(i) + frain * rain1(i) enddo @@ -131,13 +134,19 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl enddo enddo endif - endif + endif update_cnvw_cnvc - if (lssav .and. flag_for_scnv_generic_tend) then + diagtend: if (lssav .and. flag_for_scnv_generic_tend) then + print *,'diagtend in GFS_SCNV_generic.F90' + if(frain<1e-5) then + print *,'bad frain: ',frain + endif if (ldiag3d) then do k=1,levs do i=1,im - dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k) - save_t(i,k)) * frain + du3dt(i,k) = du3dt(i,k) + (gu0(i,k) - save_u(i,k)) * frain + dv3dt(i,k) = dv3dt(i,k) + (gv0(i,k) - save_v(i,k)) * frain + dt3dt(i,k) = dt3dt(i,k) + (gt0(i,k) - save_t(i,k)) * frain enddo enddo if (qdiag3d) then @@ -148,7 +157,7 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl enddo endif endif - endif ! end if_lssav + endif diagtend ! if (cplchm) then do k=1,levs diff --git a/physics/GFS_SCNV_generic.meta b/physics/GFS_SCNV_generic.meta index 52538d3e8..f1312bfc6 100644 --- a/physics/GFS_SCNV_generic.meta +++ b/physics/GFS_SCNV_generic.meta @@ -33,6 +33,24 @@ type = logical intent = in optional = F +[gu0] + standard_name = x_wind_updated_by_physics + long_name = updated x-direction wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in + optional = F +[gv0] + standard_name = y_wind_updated_by_physics + long_name = updated y-direction wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in + optional = F [gt0] standard_name = air_temperature_updated_by_physics long_name = temperature updated by physics @@ -51,6 +69,22 @@ kind = kind_phys intent = in optional = F +[save_u] + standard_name = x_wind_save + long_name = x-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[save_v] + standard_name = y_wind_save + long_name = y-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in [save_t] standard_name = air_temperature_save long_name = air temperature before entering a physics scheme @@ -69,6 +103,13 @@ kind = kind_phys intent = inout optional = F +[flag_for_scnv_generic_tend] + standard_name = true_if_GFS_SCNV_generic_should_calculate_tendencies + long_name = true if GFS_SCNV_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP @@ -156,6 +197,24 @@ kind = kind_phys intent = in optional = F +[gu0] + standard_name = x_wind_updated_by_physics + long_name = updated x-direction wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in + optional = F +[gv0] + standard_name = y_wind_updated_by_physics + long_name = updated y-direction wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in + optional = F [gt0] standard_name = air_temperature_updated_by_physics long_name = temperature updated by physics @@ -174,6 +233,22 @@ kind = kind_phys intent = in optional = F +[save_u] + standard_name = x_wind_save + long_name = x-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[save_v] + standard_name = y_wind_save + long_name = y-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in [save_t] standard_name = air_temperature_save long_name = air temperature before entering a physics scheme @@ -201,6 +276,22 @@ kind = kind_phys intent = inout optional = F +[du3dt] + standard_name = cumulative_change_in_x_wind_due_to_shal_convection + long_name = cumulative change in x wind due to shallow convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt] + standard_name = cumulative_change_in_y_wind_due_to_shal_convection + long_name = cumulative change in y wind due to shallow convection + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout [dt3dt] standard_name = cumulative_change_in_temperature_due_to_shal_convection long_name = cumulative change in temperature due to shal conv. diff --git a/physics/model_tend_post.F90 b/physics/model_tend_post.F90 index 8ae7b6844..509c4a834 100644 --- a/physics/model_tend_post.F90 +++ b/physics/model_tend_post.F90 @@ -19,7 +19,6 @@ subroutine model_tend_post_run(kdt, & t_start,u_start,v_start,q_start, & t_end, u_end, v_end, q_end, & dt3dt_ccpp, du3dt_ccpp, dv3dt_ccpp, dq3dt_ccpp, & -! dt3dt_total, du3dt_total, dv3dt_total, dq3dt_total, & im, levs, ntrac, index_for_water_vapor, & lssav, ldiag3d, qdiag3d, errmsg,errflg) use machine, only: kind_phys @@ -32,8 +31,6 @@ subroutine model_tend_post_run(kdt, & real(kind=kind_phys), dimension(:,:), intent(inout) :: q_end real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt_ccpp, dv3dt_ccpp real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt_ccpp, dq3dt_ccpp - ! real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt_total, dv3dt_total - ! real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt_total, dq3dt_total integer, intent(in) :: im, levs, ntrac, kdt integer, intent(in) :: index_for_water_vapor @@ -50,6 +47,8 @@ subroutine model_tend_post_run(kdt, & errmsg = '' errflg = 0 + print *, 'in model_tend_post_run' + diag_enabled: if(lssav .and. ldiag3d) then if(any(gt0(1:im,1:levs)<1e-3)) then print *,'error: temperatures less than 1e-3' @@ -73,14 +72,6 @@ subroutine model_tend_post_run(kdt, & do k=1,levs do i=1,im - ! if(t_end(i,k)>1e-3 .and. gt0(i,k)>1e-3) then - ! dt3dt_total(i,k) = dt3dt_total(i,k) + gt0(i,k)-t_end(i,k) - ! du3dt_total(i,k) = du3dt_total(i,k) + gu0(i,k)-u_end(i,k) - ! dv3dt_total(i,k) = dv3dt_total(i,k) + gv0(i,k)-v_end(i,k) - ! if(qdiag3d) then - ! dq3dt_total(i,k) = dq3dt_total(i,k) + gq0_water_vapor(i,k)-q_end(i,k) - ! endif - ! endif t_end(i,k) = gt0(i,k) u_end(i,k) = gu0(i,k) v_end(i,k) = gv0(i,k) diff --git a/physics/model_tend_pre.F90 b/physics/model_tend_pre.F90 index 94ad2ee1a..e3a9db943 100644 --- a/physics/model_tend_pre.F90 +++ b/physics/model_tend_pre.F90 @@ -50,6 +50,8 @@ subroutine model_tend_pre_run(dtp, kdt, & errmsg = '' errflg = 0 + print *,'in model_tend_pre_run' + if(Lssav .and. ldiag3d) then do k=1,levs do i=1,im diff --git a/physics/moninedmf.f b/physics/moninedmf.f index d3fd9e45e..bfe8d512f 100644 --- a/physics/moninedmf.f +++ b/physics/moninedmf.f @@ -1068,7 +1068,8 @@ subroutine hedmf_run (ix,im,km,ntrac,ntcw,dv,du,tau,rtg, & enddo if(lssav .and. ldiag3d .and. ntoz>0 .and. qdiag3d .and. & & flag_for_pbl_generic_tend) then - is = (ntoz-1) * km + kk = ntoz + is = (kk-1) * km do k = 1, km do i = 1, im qtend = (a2(i,k+is)-q1(i,k,kk))*rdt diff --git a/physics/total_tend.F90 b/physics/total_tend.F90 index c7c5dfe28..7950c6b90 100644 --- a/physics/total_tend.F90 +++ b/physics/total_tend.F90 @@ -49,8 +49,10 @@ subroutine total_tend_run(dtp, kdt, & good=0 + print *,'entered total_tend_run' + if(Lssav .and. ldiag3d) then - print *,'total_tend_run' + print *,'if = TRUE in total_tend_run' do k=1,levs do i=1,im if(t_start(i,k)>1e-3 .and. tgrs(i,k)>1e-3) then diff --git a/physics/total_tend.meta b/physics/total_tend.meta index a64fd872b..873bc1c61 100644 --- a/physics/total_tend.meta +++ b/physics/total_tend.meta @@ -1,15 +1,15 @@ [ccpp-arg-table] - name = total_tend_pre_init + name = total_tend_init type = scheme ######################################################################## [ccpp-arg-table] - name = total_tend_pre_finalize + name = total_tend_finalize type = scheme ######################################################################## [ccpp-arg-table] - name = total_tend_pre_run + name = total_tend_run type = scheme [dtp] standard_name = time_step_for_physics @@ -60,14 +60,6 @@ type = real kind = kind_phys intent = in -[t_start] - standard_name = temperature_at_start_of_ccpp - long_name = temperature at start of ccpp - units = K - dimensions = (horizontal_dimension,vertical_dimension) - type = real - kind = kind_phys - intent = out [t_start] standard_name = temperature_at_total_check_point long_name = temperature when model total is calculated in ccpp From b4918a451256eb4f811851c7973bfee7e26f0c8c Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Wed, 4 Mar 2020 20:06:02 +0000 Subject: [PATCH 11/12] Model tendencies add up to total change in 3 hours for the gfs v16 beta suite --- physics/GFS_PBL_generic.F90 | 70 +++++++++++------ physics/GFS_PBL_generic.meta | 142 +++++++++++++++++++++++++++++++++-- physics/model_tend_post.F90 | 27 +++++-- physics/model_tend_post.meta | 32 ++++++++ physics/model_tend_pre.F90 | 92 ++++++++++++++++++++--- physics/model_tend_pre.meta | 64 ++++++++++++++++ physics/total_tend.F90 | 37 ++++++--- physics/total_tend.meta | 32 ++++++++ 8 files changed, 439 insertions(+), 57 deletions(-) diff --git a/physics/GFS_PBL_generic.F90 b/physics/GFS_PBL_generic.F90 index f0ab372a4..f023a103a 100644 --- a/physics/GFS_PBL_generic.F90 +++ b/physics/GFS_PBL_generic.F90 @@ -84,7 +84,8 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef, trans_aero, ntchs, ntchm, & imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6, & imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires, cplchm, ltaerosol, hybedmf, do_shoc, & - satmedmf, qgrs, vdftra, errmsg, errflg) + satmedmf, qgrs, vdftra, save_u, save_v, save_t, save_q, ldiag3d, qdiag3d, lssav, & + ugrs, vgrs, tgrs, errmsg, errflg) use machine, only : kind_phys use GFS_PBL_generic_common, only : set_aerosol_tracer_index @@ -94,13 +95,16 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, integer, intent(in) :: im, levs, nvdiff, ntrac integer, intent(in) :: ntqv, ntcw, ntiw, ntrw, ntsw, ntlnc, ntinc, ntrnc, ntsnc, ntgnc integer, intent(in) :: ntwa, ntia, ntgl, ntoz, ntke, ntkev, nqrimef,ntchs, ntchm - logical, intent(in) :: trans_aero + logical, intent(in) :: trans_aero, ldiag3d, qdiag3d, lssav integer, intent(in) :: imp_physics, imp_physics_gfdl, imp_physics_thompson, imp_physics_wsm6 integer, intent(in) :: imp_physics_zhao_carr, imp_physics_mg, imp_physics_fer_hires logical, intent(in) :: cplchm, ltaerosol, hybedmf, do_shoc, satmedmf real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: qgrs + real(kind=kind_phys), dimension(im, levs), intent(in) :: ugrs, vgrs, tgrs real(kind=kind_phys), dimension(im, levs, nvdiff), intent(inout) :: vdftra + real(kind=kind_phys), dimension(im, levs), intent(out) :: save_u, save_v, save_t + real(kind=kind_phys), dimension(im, levs, ntrac), intent(out) :: save_q character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -258,6 +262,24 @@ subroutine GFS_PBL_generic_pre_run (im, levs, nvdiff, ntrac, ! endif + if(ldiag3d .and. lssav) then + do k=1,levs + do i=1,im + save_t(i,k) = tgrs(i,k) + save_u(i,k) = ugrs(i,k) + save_v(i,k) = vgrs(i,k) + enddo + enddo + if(qdiag3d) then + do k=1,levs + do i=1,im + save_q(i,k,ntqv) = qgrs(i,k,ntqv) + save_q(i,k,ntoz) = qgrs(i,k,ntoz) + enddo + enddo + endif + endif + end subroutine GFS_PBL_generic_pre_run end module GFS_PBL_generic_pre @@ -285,9 +307,10 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, dvdftra, dusfc1, dvsfc1, dtsfc1, dqsfc1, dtf, dudt, dvdt, dtdt, htrsw, htrlw, xmu, & dqdt, dusfc_cpl, dvsfc_cpl, dtsfc_cpl, & dqsfc_cpl, dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, dusfc_diag, dvsfc_diag, dtsfc_diag, dqsfc_diag, & - dusfci_diag, dvsfci_diag, dtsfci_diag, dqsfci_diag, dt3dt, du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, dq3dt, & + dusfci_diag, dvsfci_diag, dtsfci_diag, dqsfci_diag, dt3dt, du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, dq3dt,& dq3dt_ozone, rd, cp,fvirt, hvap, t1, q1, prsl, hflx, ushfsfci, oceanfrac, fice, dusfc_cice, dvsfc_cice, dtsfc_cice, & - dqsfc_cice, wet, dry, icy, wind, stress_ocn, hflx_ocn, evap_ocn, ugrs1, vgrs1, dkt_cpl, dkt, errmsg, errflg) + dqsfc_cice, wet, dry, icy, wind, stress_ocn, hflx_ocn, evap_ocn, ugrs1, vgrs1, dkt_cpl, dkt, & + ugrs, vgrs, tgrs, qgrs, save_u, save_v, save_t, save_q, errmsg, errflg) use machine, only : kind_phys use GFS_PBL_generic_common, only : set_aerosol_tracer_index @@ -302,6 +325,9 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, logical, intent(in) :: ltaerosol, cplflx, cplchm, lssav, ldiag3d, qdiag3d, lsidea logical, intent(in) :: hybedmf, do_shoc, satmedmf, shinhong, do_ysu logical, intent(in) :: flag_for_pbl_generic_tend + + real(kind=kind_phys), dimension(im, levs), intent(in) :: save_u, save_v, save_t + real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: save_q real(kind=kind_phys), intent(in) :: dtf real(kind=kind_phys), intent(in) :: rd, cp, fvirt, hvap @@ -309,6 +335,10 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, real(kind=kind_phys), dimension(:,:), intent(in) :: prsl real(kind=kind_phys), dimension(:), intent(in) :: dusfc_cice, dvsfc_cice, dtsfc_cice, dqsfc_cice, & wind, stress_ocn, hflx_ocn, evap_ocn, ugrs1, vgrs1 + + real(kind=kind_phys), dimension(im, levs, ntrac), intent(in) :: qgrs + real(kind=kind_phys), dimension(im, levs), intent(in) :: ugrs, vgrs, tgrs + real(kind=kind_phys), dimension(im, levs, nvdiff), intent(in) :: dvdftra real(kind=kind_phys), dimension(im), intent(in) :: dusfc1, dvsfc1, dtsfc1, dqsfc1, xmu real(kind=kind_phys), dimension(im, levs), intent(in) :: dudt, dvdt, dtdt, htrsw, htrlw @@ -553,39 +583,29 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac, ! & dtf,' kdt=',kdt,' lat=',lat ! endif - if (ldiag3d .and. flag_for_pbl_generic_tend) then + if (ldiag3d .and. flag_for_pbl_generic_tend .and. lssav) then if (lsidea) then dt3dt(1:im,:) = dt3dt(1:im,:) + dtdt(1:im,:)*dtf else do k=1,levs do i=1,im - tem = dtdt(i,k) - (htrlw(i,k)+htrsw(i,k)*xmu(i)) - dt3dt(i,k) = dt3dt(i,k) + tem*dtf + dt3dt(i,k) = dt3dt(i,k) + (tgrs(i,k) - save_t(i,k)) enddo enddo endif do k=1,levs do i=1,im - du3dt_PBL(i,k) = du3dt_PBL(i,k) + dudt(i,k) * dtf - du3dt_OGWD(i,k) = du3dt_OGWD(i,k) - dudt(i,k) * dtf - dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + dvdt(i,k) * dtf - dv3dt_OGWD(i,k) = dv3dt_OGWD(i,k) - dvdt(i,k) * dtf + du3dt_PBL(i,k) = du3dt_PBL(i,k) + (ugrs(i,k) - save_u(i,k)) + dv3dt_PBL(i,k) = dv3dt_PBL(i,k) + (vgrs(i,k) - save_v(i,k)) enddo enddo - if (qdiag3d) then - do k=1,levs - do i=1,im - tem = dqdt(i,k,ntqv) * dtf - dq3dt(i,k) = dq3dt(i,k) + tem - enddo - enddo - if (ntoz > 0) then - do k=1,levs - do i=1,im - dq3dt_ozone(i,k) = dq3dt_ozone(i,k) + dqdt(i,k,ntoz) * dtf - enddo - enddo - endif + if(qdiag3d) then + do k=1,levs + do i=1,im + dq3dt(i,k) = dq3dt(i,k) + (qgrs(i,k,ntqv)-save_q(i,k,ntqv)) + dq3dt_ozone(i,k) = dq3dt_ozone(i,k) + (qgrs(i,k,ntoz)-save_q(i,k,ntoz)) + enddo + enddo endif endif diff --git a/physics/GFS_PBL_generic.meta b/physics/GFS_PBL_generic.meta index ab4eca5da..54c661125 100644 --- a/physics/GFS_PBL_generic.meta +++ b/physics/GFS_PBL_generic.meta @@ -307,6 +307,78 @@ kind = kind_phys intent = inout optional = F +[save_u] + standard_name = x_wind_save + long_name = x-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_v] + standard_name = y_wind_save + long_name = y-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_t] + standard_name = air_temperature_save + long_name = air temperature before entering a physics scheme + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_q] + standard_name = tracer_concentration_save + long_name = tracer concentration before entering a physics scheme + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension,number_of_tracers) + type = real + kind = kind_phys +[ldiag3d] + standard_name = flag_diagnostics_3D + long_name = flag for 3d diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F +[qdiag3d] + standard_name = flag_tracer_diagnostics_3D + long_name = flag for 3d tracer diagnostic fields + units = flag + dimensions = () + type = logical + intent = in + optional = F +[lssav] + standard_name = flag_diagnostics + long_name = logical flag for storing diagnostics + units = flag + dimensions = () + type = logical + intent = in +[ugrs] + standard_name = x_wind + long_name = zonal wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[vgrs] + standard_name = y_wind + long_name = meridional wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[tgrs] + standard_name = air_temperature + long_name = model layer mean temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP @@ -601,13 +673,6 @@ type = logical intent = in optional = F -[flag_for_pbl_generic_tend] - standard_name = true_if_GFS_PBL_generic_should_calculate_tendencies - long_name = true if GFS_PBL_generic should calculate tendencies - units = flag - dimensions = () - type = logical - intent = in [lssav] standard_name = flag_diagnostics long_name = logical flag for storing diagnostics @@ -616,6 +681,13 @@ type = logical intent = in optional = F +[flag_for_pbl_generic_tend] + standard_name = true_if_GFS_PBL_generic_should_calculate_tendencies + long_name = true if GFS_PBL_generic should calculate tendencies + units = flag + dimensions = () + type = logical + intent = in [ldiag3d] standard_name = flag_diagnostics_3D long_name = flag for 3d diagnostic fields @@ -1235,6 +1307,62 @@ kind = kind_phys intent = in optional = F +[ugrs] + standard_name = x_wind + long_name = zonal wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[vgrs] + standard_name = y_wind + long_name = meridional wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[tgrs] + standard_name = air_temperature + long_name = model layer mean temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[qgrs] + standard_name = tracer_concentration + long_name = model layer mean tracer concentration + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension,number_of_tracers) + type = real + kind = kind_phys +[save_u] + standard_name = x_wind_save + long_name = x-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_v] + standard_name = y_wind_save + long_name = y-wind before entering a physics scheme + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_t] + standard_name = air_temperature_save + long_name = air temperature before entering a physics scheme + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys +[save_q] + standard_name = tracer_concentration_save + long_name = tracer concentration before entering a physics scheme + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension,number_of_tracers) + type = real + kind = kind_phys [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/physics/model_tend_post.F90 b/physics/model_tend_post.F90 index 509c4a834..a06997f5e 100644 --- a/physics/model_tend_post.F90 +++ b/physics/model_tend_post.F90 @@ -19,6 +19,7 @@ subroutine model_tend_post_run(kdt, & t_start,u_start,v_start,q_start, & t_end, u_end, v_end, q_end, & dt3dt_ccpp, du3dt_ccpp, dv3dt_ccpp, dq3dt_ccpp, & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total, & im, levs, ntrac, index_for_water_vapor, & lssav, ldiag3d, qdiag3d, errmsg,errflg) use machine, only: kind_phys @@ -29,8 +30,9 @@ subroutine model_tend_post_run(kdt, & real(kind=kind_phys), dimension(:,:), intent(in) :: q_start real(kind=kind_phys), dimension(:,:), intent(inout) :: t_end, u_end, v_end real(kind=kind_phys), dimension(:,:), intent(inout) :: q_end - real(kind=kind_phys), dimension(:,:), intent(inout) :: du3dt_ccpp, dv3dt_ccpp - real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt_ccpp, dq3dt_ccpp + real(kind=kind_phys), dimension(:,:), intent(inout) :: & + dt3dt_ccpp,du3dt_ccpp,dv3dt_ccpp,dq3dt_ccpp, & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total integer, intent(in) :: im, levs, ntrac, kdt integer, intent(in) :: index_for_water_vapor @@ -40,7 +42,7 @@ subroutine model_tend_post_run(kdt, & character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg - real(kind=kind_phys) :: dt + real(kind=kind_phys) :: dt, change integer :: i,k ! Initialize CCPP error handling variables @@ -79,11 +81,22 @@ subroutine model_tend_post_run(kdt, & q_end(i,k) = gq0_water_vapor(i,k) endif if(t_end(i,k)>1e-3 .and. t_start(i,k)>1e-3) then - dt3dt_ccpp(i,k) = dt3dt_ccpp(i,k) + t_end(i,k)-t_start(i,k) - du3dt_ccpp(i,k) = du3dt_ccpp(i,k) + u_end(i,k)-u_start(i,k) - dv3dt_ccpp(i,k) = dv3dt_ccpp(i,k) + v_end(i,k)-v_start(i,k) + change=t_end(i,k)-t_start(i,k) + dt3dt_ccpp(i,k) = dt3dt_ccpp(i,k) + change + !dt3dt_total(i,k) = dt3dt_total(i,k) + change + + change=u_end(i,k)-u_start(i,k) + du3dt_ccpp(i,k) = du3dt_ccpp(i,k) + change + !du3dt_total(i,k) = du3dt_total(i,k) + change + + change=v_end(i,k)-v_start(i,k) + dv3dt_ccpp(i,k) = dv3dt_ccpp(i,k) + change + !dv3dt_total(i,k) = dv3dt_total(i,k) + change + if(qdiag3d) then - dq3dt_ccpp(i,k) = dq3dt_ccpp(i,k) + q_end(i,k)-q_start(i,k) + change=q_end(i,k)-q_start(i,k) + dq3dt_ccpp(i,k) = dq3dt_ccpp(i,k) + change + !dq3dt_total(i,k) = dq3dt_total(i,k) + change endif endif enddo diff --git a/physics/model_tend_post.meta b/physics/model_tend_post.meta index a97fa4dad..8a730059f 100644 --- a/physics/model_tend_post.meta +++ b/physics/model_tend_post.meta @@ -143,6 +143,38 @@ type = real kind = kind_phys intent = inout +[dt3dt_total] + standard_name = cumulative_change_in_temperature + long_name = cumulative change in temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_total] + standard_name = cumulative_change_in_x_wind + long_name = cumulative change in x wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_total] + standard_name = cumulative_change_in_y_wind + long_name = cumulative change in y wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_total] + standard_name = cumulative_change_in_water_vapor_specific_humidity + long_name = cumulative change in water vapor specific humidity + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout [im] standard_name = horizontal_loop_extent long_name = horizontal loop extent diff --git a/physics/model_tend_pre.F90 b/physics/model_tend_pre.F90 index e3a9db943..198a0ac75 100644 --- a/physics/model_tend_pre.F90 +++ b/physics/model_tend_pre.F90 @@ -15,12 +15,62 @@ end subroutine model_tend_pre_init subroutine model_tend_pre_finalize() end subroutine model_tend_pre_finalize +! subroutine model_tend_pre_run(diag, statein, stateout, control, & +! errmsg, errflg) +! implicit none +! use GFS_typedefs, only: GFS_statein_type, GFS_stateout_type, GFS_diag_type, GFS_control_type + +! type(GFS_diag_type), intent(inout) :: diag +! type(GFS_statein_type), intent(in) :: statein +! type(GFS_stateout_type), intent(in) :: stateout +! type(GFS_control_type), intent(in) :: control + +! character(len=*), intent(out) :: errmsg +! integer, intent(out) :: errflg + +! integer :: i, k + +! ! Initialize CCPP error handling variables +! errmsg = '' +! errflg = 0 + +! print *,'in model_tend_pre_run' + +! if(control%Lssav .and. control%ldiag3d) then +! do k=1,control%levs +! do i=1,control%im +! diag%t_start(i,k) = statein%tgrs(i,k) +! diag%u_start(i,k) = statein%ugrs(i,k) +! v_start(i,k) = vgrs(i,k) +! if(qdiag3d) then +! q_start(i,k) = qvgrs(i,k) +! endif +! if(t_start(i,k)>1e-3 .and. t_end(i,k)>1e-3) then +! dt3dt_model(i,k) = dt3dt_model(i,k) + (t_start(i,k)-t_end(i,k)) +! du3dt_model(i,k) = du3dt_model(i,k) + (u_start(i,k)-u_end(i,k)) +! dv3dt_model(i,k) = dv3dt_model(i,k) + (v_start(i,k)-v_end(i,k)) +! if(qdiag3d) then +! dq3dt_model(i,k) = dq3dt_model(i,k) + (q_start(i,k)-q_end(i,k)) +! endif +! endif +! enddo +! enddo +! endif + +! end subroutine model_tend_pre_run + + + !> \section arg_table_model_tend_pre_run Argument Table !! \htmlinclude model_tend_pre_run.html !! + subroutine model_tend_pre_run(dtp, kdt, & - tgrs,ugrs,vgrs,qvgrs, t_start,u_start,v_start,q_start, & + tgrs,ugrs,vgrs,qvgrs, & + gt0,gu0,gv0, gq0_water_vapor, & + t_start,u_start,v_start,q_start, & dt3dt_model,du3dt_model,dv3dt_model,dq3dt_model, & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total, & t_end,u_end,v_end,q_end, & im, levs, ntrac, & lssav, ldiag3d, qdiag3d, errmsg,errflg) @@ -28,22 +78,24 @@ subroutine model_tend_pre_run(dtp, kdt, & implicit none real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs, ugrs, vgrs, qvgrs + real(kind=kind_phys), dimension(:,:), intent(in) :: gt0, gu0, gv0, gq0_water_vapor real(kind=kind_phys), dimension(:,:), intent(out) :: t_start, u_start, v_start real(kind=kind_phys), dimension(:,:), intent(out) :: q_start real(kind=kind_phys), dimension(:,:), intent(out) :: t_end, u_end, v_end real(kind=kind_phys), dimension(:,:), intent(out) :: q_end real(kind=kind_phys), dimension(:,:), intent(inout) :: & - dt3dt_model,du3dt_model,dv3dt_model,dq3dt_model + dt3dt_model,du3dt_model,dv3dt_model,dq3dt_model, & + dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total integer, intent(in) :: im, levs, ntrac, kdt logical, intent(in) :: lssav, qdiag3d, ldiag3d - real(kind=kind_phys) :: dtp + real(kind=kind_phys) :: dtp, change character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg - + logical :: logical integer :: i, k ! Initialize CCPP error handling variables @@ -52,9 +104,17 @@ subroutine model_tend_pre_run(dtp, kdt, & print *,'in model_tend_pre_run' + logical = .false. + if(Lssav .and. ldiag3d) then do k=1,levs do i=1,im + ! t_start(i,k) = gt0(i,k) + ! u_start(i,k) = gu0(i,k) + ! v_start(i,k) = gv0(i,k) + ! if(qdiag3d) then + ! q_start(i,k) = gq0_water_vapor(i,k) + ! endif t_start(i,k) = tgrs(i,k) u_start(i,k) = ugrs(i,k) v_start(i,k) = vgrs(i,k) @@ -62,11 +122,25 @@ subroutine model_tend_pre_run(dtp, kdt, & q_start(i,k) = qvgrs(i,k) endif if(t_start(i,k)>1e-3 .and. t_end(i,k)>1e-3) then - dt3dt_model(i,k) = dt3dt_model(i,k) + (t_start(i,k)-t_end(i,k)) - du3dt_model(i,k) = du3dt_model(i,k) + (u_start(i,k)-u_end(i,k)) - dv3dt_model(i,k) = dv3dt_model(i,k) + (v_start(i,k)-v_end(i,k)) - if(qdiag3d) then - dq3dt_model(i,k) = dq3dt_model(i,k) + (q_start(i,k)-q_end(i,k)) + if(t_end(i,k)/=t_start(i,k)) then + logical=.true. + change=t_start(i,k)-t_end(i,k) + dt3dt_model(i,k) = dt3dt_model(i,k) + change + !dt3dt_total(i,k) = dt3dt_total(i,k) + change + + change=u_start(i,k)-u_end(i,k) + du3dt_model(i,k) = du3dt_model(i,k) + change + !du3dt_total(i,k) = du3dt_total(i,k) + change + + change=v_start(i,k)-v_end(i,k) + dv3dt_model(i,k) = dv3dt_model(i,k) + change + !dv3dt_total(i,k) = dv3dt_total(i,k) + change + + if(qdiag3d) then + change=q_start(i,k)-q_end(i,k) + dq3dt_model(i,k) = dq3dt_model(i,k) + change + !dq3dt_total(i,k) = dq3dt_total(i,k) + change + endif endif endif enddo diff --git a/physics/model_tend_pre.meta b/physics/model_tend_pre.meta index 0cbb9b4e9..7ec047161 100644 --- a/physics/model_tend_pre.meta +++ b/physics/model_tend_pre.meta @@ -60,6 +60,38 @@ type = real kind = kind_phys intent = in +[gt0] + standard_name = air_temperature_updated_by_physics + long_name = temperature updated by physics + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gu0] + standard_name = x_wind_updated_by_physics + long_name = zonal wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gv0] + standard_name = y_wind_updated_by_physics + long_name = meridional wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gq0_water_vapor] + standard_name = water_vapor_specific_humidity_updated_by_physics + long_name = water vapor specific humidity updated by physics + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in [t_start] standard_name = temperature_at_start_of_ccpp long_name = temperature at start of ccpp @@ -124,6 +156,38 @@ type = real kind = kind_phys intent = inout +[dt3dt_total] + standard_name = cumulative_change_in_temperature + long_name = cumulative change in temperature + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[du3dt_total] + standard_name = cumulative_change_in_x_wind + long_name = cumulative change in x wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dv3dt_total] + standard_name = cumulative_change_in_y_wind + long_name = cumulative change in y wind + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout +[dq3dt_total] + standard_name = cumulative_change_in_water_vapor_specific_humidity + long_name = cumulative change in water vapor specific humidity + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = inout [t_end] standard_name = temperature_at_end_of_ccpp long_name = temperature at end of ccpp diff --git a/physics/total_tend.F90 b/physics/total_tend.F90 index 7950c6b90..8369c304b 100644 --- a/physics/total_tend.F90 +++ b/physics/total_tend.F90 @@ -21,11 +21,13 @@ end subroutine total_tend_finalize subroutine total_tend_run(dtp, kdt, & tgrs,ugrs,vgrs,qvgrs, t_start,u_start,v_start,q_start, & dt3dt_total,du3dt_total,dv3dt_total,dq3dt_total, & + gt0,gu0,gv0, gq0_water_vapor, & im, levs, ntrac, & lssav, ldiag3d, qdiag3d, errmsg,errflg) use machine, only: kind_phys implicit none + real(kind=kind_phys), dimension(:,:), intent(in) :: gt0, gu0, gv0, gq0_water_vapor real(kind=kind_phys), dimension(:,:), intent(in) :: tgrs, ugrs, vgrs, qvgrs real(kind=kind_phys), dimension(:,:), intent(out) :: t_start, u_start, v_start real(kind=kind_phys), dimension(:,:), intent(out) :: q_start @@ -55,19 +57,36 @@ subroutine total_tend_run(dtp, kdt, & print *,'if = TRUE in total_tend_run' do k=1,levs do i=1,im - if(t_start(i,k)>1e-3 .and. tgrs(i,k)>1e-3) then + if(t_start(i,k)>1e-3 .and. gt0(i,k)>1e-3) then good=good+1 - dt3dt_total(i,k) = dt3dt_total(i,k) + tgrs(i,k)-t_start(i,k) - du3dt_total(i,k) = du3dt_total(i,k) + ugrs(i,k)-u_start(i,k) - dv3dt_total(i,k) = dv3dt_total(i,k) + vgrs(i,k)-v_start(i,k) + dt3dt_total(i,k) = dt3dt_total(i,k) + (gt0(i,k)-t_start(i,k)) + du3dt_total(i,k) = du3dt_total(i,k) + (gu0(i,k)-u_start(i,k)) + dv3dt_total(i,k) = dv3dt_total(i,k) + (gv0(i,k)-v_start(i,k)) if(qdiag3d) then - dq3dt_total(i,k) = dq3dt_total(i,k) + qvgrs(i,k)-q_start(i,k) + dq3dt_total(i,k) = dq3dt_total(i,k) + (gq0_water_vapor(i,k)-q_start(i,k)) endif endif - t_start(i,k)=tgrs(i,k) - u_start(i,k)=ugrs(i,k) - v_start(i,k)=vgrs(i,k) - q_start(i,k)=qvgrs(i,k) + t_start(i,k)=gt0(i,k) + u_start(i,k)=gu0(i,k) + v_start(i,k)=gv0(i,k) + if(qdiag3d) then + q_start(i,k)=gq0_water_vapor(i,k) + endif + ! if(t_start(i,k)>1e-3 .and. tgrs(i,k)>1e-3) then + ! good=good+1 + ! dt3dt_total(i,k) = dt3dt_total(i,k) + (tgrs(i,k)-t_start(i,k)) + ! du3dt_total(i,k) = du3dt_total(i,k) + (ugrs(i,k)-u_start(i,k)) + ! dv3dt_total(i,k) = dv3dt_total(i,k) + (vgrs(i,k)-v_start(i,k)) + ! if(qdiag3d) then + ! dq3dt_total(i,k) = dq3dt_total(i,k) + (qvgrs(i,k)-q_start(i,k)) + ! endif + ! endif + ! t_start(i,k)=tgrs(i,k) + ! u_start(i,k)=ugrs(i,k) + ! v_start(i,k)=vgrs(i,k) + ! if(qdiag3d) then + ! q_start(i,k)=qvgrs(i,k) + ! endif enddo enddo print *,'total tend valid points: ',good diff --git a/physics/total_tend.meta b/physics/total_tend.meta index 873bc1c61..82e49a081 100644 --- a/physics/total_tend.meta +++ b/physics/total_tend.meta @@ -124,6 +124,38 @@ type = real kind = kind_phys intent = inout +[gt0] + standard_name = air_temperature_updated_by_physics + long_name = temperature updated by physics + units = K + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gu0] + standard_name = x_wind_updated_by_physics + long_name = zonal wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gv0] + standard_name = y_wind_updated_by_physics + long_name = meridional wind updated by physics + units = m s-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in +[gq0_water_vapor] + standard_name = water_vapor_specific_humidity_updated_by_physics + long_name = water vapor specific humidity updated by physics + units = kg kg-1 + dimensions = (horizontal_dimension,vertical_dimension) + type = real + kind = kind_phys + intent = in [im] standard_name = horizontal_loop_extent long_name = horizontal loop extent From abde3d01f61e20a64e6605f8ac2dfd7a9aff6fba Mon Sep 17 00:00:00 2001 From: "samuel.trahan" Date: Wed, 4 Mar 2020 22:28:16 +0000 Subject: [PATCH 12/12] Remove debug prints and commented-out code. One piece of commented-out code is retained, and this commit adds an explanatory comment --- physics/GFS_SCNV_generic.F90 | 5 ---- physics/model_tend_post.F90 | 22 ----------------- physics/model_tend_pre.F90 | 46 ------------------------------------ physics/total_tend.F90 | 5 +--- 4 files changed, 1 insertion(+), 77 deletions(-) diff --git a/physics/GFS_SCNV_generic.F90 b/physics/GFS_SCNV_generic.F90 index 5496d0f48..82b0818fd 100644 --- a/physics/GFS_SCNV_generic.F90 +++ b/physics/GFS_SCNV_generic.F90 @@ -36,7 +36,6 @@ subroutine GFS_SCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, gu0, gv0, gt0, errflg = 0 save_fields: if (ldiag3d .and. flag_for_scnv_generic_tend) then - print *,'save fields in GFS_SCNV_generic_pre_run' do k=1,levs do i=1,im save_u(i,k) = gu0(i,k) @@ -137,10 +136,6 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, qdiag3d, cpl endif update_cnvw_cnvc diagtend: if (lssav .and. flag_for_scnv_generic_tend) then - print *,'diagtend in GFS_SCNV_generic.F90' - if(frain<1e-5) then - print *,'bad frain: ',frain - endif if (ldiag3d) then do k=1,levs do i=1,im diff --git a/physics/model_tend_post.F90 b/physics/model_tend_post.F90 index a06997f5e..0ff43f9eb 100644 --- a/physics/model_tend_post.F90 +++ b/physics/model_tend_post.F90 @@ -49,29 +49,7 @@ subroutine model_tend_post_run(kdt, & errmsg = '' errflg = 0 - print *, 'in model_tend_post_run' - diag_enabled: if(lssav .and. ldiag3d) then - if(any(gt0(1:im,1:levs)<1e-3)) then - print *,'error: temperatures less than 1e-3' - endif - if(all(abs(gu0(1:im,1:levs))<1e-3)) then - print *,'error: all u wind is near zero' - endif - if(all(abs(gv0(1:im,1:levs))<1e-3)) then - print *,'error: all v wind is near zero' - endif - - if(any(t_start(1:im,1:levs)<1e-3)) then - print *,'error: start temperatures less than 1e-3' - endif - if(all(abs(u_start(1:im,1:levs))<1e-3)) then - print *,'error: all start u wind is near zero' - endif - if(all(abs(v_start(1:im,1:levs))<1e-3)) then - print *,'error: all start v wind is near zero' - endif - do k=1,levs do i=1,im t_end(i,k) = gt0(i,k) diff --git a/physics/model_tend_pre.F90 b/physics/model_tend_pre.F90 index 198a0ac75..f88b4d789 100644 --- a/physics/model_tend_pre.F90 +++ b/physics/model_tend_pre.F90 @@ -15,52 +15,6 @@ end subroutine model_tend_pre_init subroutine model_tend_pre_finalize() end subroutine model_tend_pre_finalize -! subroutine model_tend_pre_run(diag, statein, stateout, control, & -! errmsg, errflg) -! implicit none -! use GFS_typedefs, only: GFS_statein_type, GFS_stateout_type, GFS_diag_type, GFS_control_type - -! type(GFS_diag_type), intent(inout) :: diag -! type(GFS_statein_type), intent(in) :: statein -! type(GFS_stateout_type), intent(in) :: stateout -! type(GFS_control_type), intent(in) :: control - -! character(len=*), intent(out) :: errmsg -! integer, intent(out) :: errflg - -! integer :: i, k - -! ! Initialize CCPP error handling variables -! errmsg = '' -! errflg = 0 - -! print *,'in model_tend_pre_run' - -! if(control%Lssav .and. control%ldiag3d) then -! do k=1,control%levs -! do i=1,control%im -! diag%t_start(i,k) = statein%tgrs(i,k) -! diag%u_start(i,k) = statein%ugrs(i,k) -! v_start(i,k) = vgrs(i,k) -! if(qdiag3d) then -! q_start(i,k) = qvgrs(i,k) -! endif -! if(t_start(i,k)>1e-3 .and. t_end(i,k)>1e-3) then -! dt3dt_model(i,k) = dt3dt_model(i,k) + (t_start(i,k)-t_end(i,k)) -! du3dt_model(i,k) = du3dt_model(i,k) + (u_start(i,k)-u_end(i,k)) -! dv3dt_model(i,k) = dv3dt_model(i,k) + (v_start(i,k)-v_end(i,k)) -! if(qdiag3d) then -! dq3dt_model(i,k) = dq3dt_model(i,k) + (q_start(i,k)-q_end(i,k)) -! endif -! endif -! enddo -! enddo -! endif - -! end subroutine model_tend_pre_run - - - !> \section arg_table_model_tend_pre_run Argument Table !! \htmlinclude model_tend_pre_run.html !! diff --git a/physics/total_tend.F90 b/physics/total_tend.F90 index 8369c304b..24d5c92ef 100644 --- a/physics/total_tend.F90 +++ b/physics/total_tend.F90 @@ -51,10 +51,7 @@ subroutine total_tend_run(dtp, kdt, & good=0 - print *,'entered total_tend_run' - if(Lssav .and. ldiag3d) then - print *,'if = TRUE in total_tend_run' do k=1,levs do i=1,im if(t_start(i,k)>1e-3 .and. gt0(i,k)>1e-3) then @@ -72,6 +69,7 @@ subroutine total_tend_run(dtp, kdt, & if(qdiag3d) then q_start(i,k)=gq0_water_vapor(i,k) endif + ! Alternative is to use the state in: ! if(t_start(i,k)>1e-3 .and. tgrs(i,k)>1e-3) then ! good=good+1 ! dt3dt_total(i,k) = dt3dt_total(i,k) + (tgrs(i,k)-t_start(i,k)) @@ -89,7 +87,6 @@ subroutine total_tend_run(dtp, kdt, & ! endif enddo enddo - print *,'total tend valid points: ',good endif end subroutine total_tend_run