Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix diagnostic PBL and convective tendencies #489

Merged
merged 9 commits into from
Sep 30, 2020
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
endif()

# Remove files with special compiler flags from list of files with standard compiler flags
list(REMOVE_ITEM SCHEMES ${SCHEMES_SFX_OPT})
if (SCHEMES_SFX_OPT)
list(REMOVE_ITEM SCHEMES ${SCHEMES_SFX_OPT})
endif(SCHEMES_SFX_OPT)
# Assign standard compiler flags to all remaining schemes and caps
SET_SOURCE_FILES_PROPERTIES(${SCHEMES} ${CAPS}
PROPERTIES COMPILE_FLAGS "${CMAKE_Fortran_FLAGS_OPT}")
Expand Down
20 changes: 12 additions & 8 deletions physics/cu_gf_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -868,23 +868,27 @@ subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,cactiv, &
if(ishallow_g3.eq.1 .and. .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
du3dt_SCNV(i,k) = du3dt_SCNV(i,k) + cutens(i)*outus(i,k) * dt
dv3dt_SCNV(i,k) = dv3dt_SCNV(i,k) + cutens(i)*outvs(i,k) * dt
dt3dt_SCNV(i,k) = dt3dt_SCNV(i,k) + cutens(i)*outts(i,k) * dt
if(qdiag3d) then
dq3dt_SCNV(i,k) = dq3dt_SCNV(i,k) + outqs(i,k) * dt
tem = cutens(i)*outqs(i,k)* dt
tem = tem/(1.0_kind_phys+tem)
dq3dt_SCNV(i,k) = dq3dt_SCNV(i,k) + tem
endif
enddo
enddo
endif
if((ideep.eq.1. .or. imid_gf.eq.1) .and. .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
du3dt_DCNV(i,k) = du3dt_DCNV(i,k) + (cuten(i)*outu(i,k)+cutenm(i)*outum(i,k)) * dt
dv3dt_DCNV(i,k) = dv3dt_DCNV(i,k) + (cuten(i)*outv(i,k)+cutenm(i)*outvm(i,k)) * dt
dt3dt_DCNV(i,k) = dt3dt_DCNV(i,k) + (cuten(i)*outt(i,k)+cutenm(i)*outtm(i,k)) * dt
if(qdiag3d) then
dq3dt_DCNV(i,k) = dq3dt_DCNV(i,k) + (outq(i,k)+outqm(i,k)) * dt
tem = (cuten(i)*outq(i,k) + cutenm(i)*outqm(i,k))* dt
tem = tem/(1.0_kind_phys+tem)
dq3dt_DCNV(i,k) = dq3dt_DCNV(i,k) + tem
endif
enddo
enddo
Expand Down
26 changes: 24 additions & 2 deletions physics/module_MYJPBL_wrapper.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ SUBROUTINE myjpbl_wrapper_run( &
& dusfc,dvsfc,dtsfc,dqsfc, &
& dkt,xkzm_m, xkzm_h,xkzm_s, gamt,gamq, &
& con_cp,con_g,con_rd, &
& me, lprnt, errmsg, errflg )
& me, lprnt, dt3dt_PBL, du3dt_PBL, dv3dt_PBL, &
& dq3dt_PBL, gen_tend, ldiag3d, qdiag3d, &
& errmsg, errflg )

!

Expand Down Expand Up @@ -79,7 +81,7 @@ SUBROUTINE myjpbl_wrapper_run( &
integer,intent(in) :: im, levs
integer,intent(in) :: kdt, me
integer,intent(in) :: ntrac,ntke,ntcw,ntiw,ntrw,ntsw,ntgl
logical,intent(in) :: restart,do_myjsfc,lprnt
logical,intent(in) :: restart,do_myjsfc,lprnt,ldiag3d,qdiag3d,gen_tend
real(kind=kind_phys),intent(in) :: con_cp, con_g, con_rd
real(kind=kind_phys),intent(in) :: dt_phs, xkzm_m, xkzm_h, xkzm_s

Expand Down Expand Up @@ -111,6 +113,8 @@ SUBROUTINE myjpbl_wrapper_run( &
dudt, dvdt, dtdt
real(kind=kind_phys),dimension(im,levs-1),intent(out) :: &
dkt
real(kind=kind_phys),dimension(:,:),intent(inout) :: &
du3dt_PBL, dv3dt_PBL, dt3dt_PBL, dq3dt_PBL

!MYJ-4D
real(kind=kind_phys),dimension(im,levs,ntrac),intent(inout) :: &
Expand Down Expand Up @@ -576,6 +580,24 @@ SUBROUTINE myjpbl_wrapper_run( &
dqdt(i,k,ntcw)=dqdt(i,k,ntcw)+rqcblten(i,k1)
end do
end do
if (ldiag3d .and. .not. gen_tend) then
do k=1,levs
k1=levs+1-k
do i=1,im
du3dt_PBL(i,k) = rublten(i,k1)*dt_phs
dv3dt_PBL(i,k) = rvblten(i,k1)*dt_phs
dt3dt_PBL(i,k) = rthblten(i,k1)*exner(i,k1)*dt_phs
end do
end do
if (qdiag3d) then
do k=1,levs
k1=levs+1-k
do i=1,im
dq3dt_PBL(i,k) = rqvblten(i,k1)*dt_phs
end do
end do
end if
end if

if (lprnt1) then

Expand Down
53 changes: 53 additions & 0 deletions physics/module_MYJPBL_wrapper.meta
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,59 @@
type = logical
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_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
[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_loop_extent,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_loop_extent,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_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
[gen_tend]
standard_name = flag_for_generic_planetary_boundary_layer_tendency
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
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
Expand Down
68 changes: 20 additions & 48 deletions physics/module_MYNNPBL_wrapper.F90
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ 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, &
& flag_for_pbl_generic_tend, &
& du3dt_PBL, du3dt_OGWD, dv3dt_PBL, dv3dt_OGWD, &
& do3dt_PBL, dq3dt_PBL, dt3dt_PBL, &
& htrsw, htrlw, xmu, &
Expand Down Expand Up @@ -190,7 +191,8 @@ SUBROUTINE mynnedmf_wrapper_run( &

! NAMELIST OPTIONS (INPUT):
LOGICAL, INTENT(IN) :: bl_mynn_tkeadvect, ltaerosol, &
lprnt, do_mynnsfclay
lprnt, do_mynnsfclay, &
flag_for_pbl_generic_tend
INTEGER, INTENT(IN) :: &
& bl_mynn_cloudpdf, &
& bl_mynn_mixlength, &
Expand Down Expand Up @@ -700,24 +702,22 @@ SUBROUTINE mynnedmf_wrapper_run( &
enddo
enddo
accum_duvt3dt: if(lssav) then
if(ldiag3d) then
if(ldiag3d .and. .not. flag_for_pbl_generic_tend) 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

if (lsidea .or. (ldiag3d .and. .not. flag_for_pbl_generic_tend)) then
do k = 1, levs
do i = 1, im
dt3dt_PBL(i,k) = dt3dt_PBL(i,k) + RTHBLTEN(i,k)*exner(i,k)*dtf
enddo
enddo
endif
endif accum_duvt3dt
!Update T, U and V:
!do k = 1, levs
Expand All @@ -739,13 +739,6 @@ 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
Expand All @@ -770,13 +763,6 @@ SUBROUTINE mynnedmf_wrapper_run( &
dqdt_ice_aer_num_conc(i,k) = RQNIFABLTEN(i,k)
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
!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
Expand All @@ -800,13 +786,6 @@ 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
!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
Expand All @@ -830,13 +809,6 @@ 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
!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
Expand All @@ -858,15 +830,15 @@ 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
endif


if(lssav .and. (ldiag3d .and. qdiag3d .and. .not. flag_for_pbl_generic_tend)) 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

if (lprnt) then
print*
Expand Down
18 changes: 13 additions & 5 deletions physics/module_MYNNPBL_wrapper.meta
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,19 @@
kind = kind_phys
intent = inout
optional = F
[flag_for_pbl_generic_tend]
standard_name = flag_for_generic_planetary_boundary_layer_tendency
long_name = true if GFS_PBL_generic should calculate tendencies
units = flag
dimensions = ()
type = logical
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)
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
Expand All @@ -1025,7 +1033,7 @@
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)
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
Expand All @@ -1043,7 +1051,7 @@
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)
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
Expand All @@ -1052,7 +1060,7 @@
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)
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
Expand All @@ -1061,7 +1069,7 @@
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)
dimensions = (horizontal_loop_extent,vertical_dimension)
type = real
kind = kind_phys
intent = inout
Expand Down
2 changes: 1 addition & 1 deletion physics/module_bl_mynn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3132,7 +3132,7 @@ SUBROUTINE mynn_tendencies(kts,kte, &
& 0.5*dtz(k)*(s_aw(k)-s_aw(k+1))
c(k)= -dtz(k)*khdz(k+1)*rhoinv(k) - 0.5*dtz(k)*s_aw(k+1)
d(k)=thl(k) + tcd(k)*delt + dtz(k)*(s_awthl(k)-s_awthl(k+1)) + &
& + diss_heat(k)*delt*dheat_opt + &
& diss_heat(k)*delt*dheat_opt + &
& sub_thl(k)*delt + det_thl(k)*delt
ENDDO

Expand Down
Loading