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

tracer tendency diagnostics and related bug fixes #681

Merged
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c332b82
remove all d*3dt variables and switch to dtend (these changes are tot…
SamuelTrahanNOAA Jan 4, 2021
aac67fb
Changes to make the first test case run to completion in debug mode.
SamuelTrahanNOAA Jan 12, 2021
3e8d727
Changes needed to get identical output in debug mode for these tests,…
SamuelTrahanNOAA Jan 14, 2021
5c3a521
Changes needed for new 3d diagnostic tendency arrays in some schemes.
SamuelTrahanNOAA Jan 15, 2021
127d7e4
Five suites output nearly all of the tendencies for convection, PBL, …
SamuelTrahanNOAA Jan 22, 2021
3ccad89
merge gsl/develop
SamuelTrahanNOAA Feb 1, 2021
520f97f
Revert a change mistakenly applied
SamuelTrahanNOAA Feb 1, 2021
f1c2a8e
Merge gsl/develop
SamuelTrahanNOAA Feb 23, 2021
4333db0
Diagnostics match dX3dt version for all five targeted suites.
SamuelTrahanNOAA Mar 2, 2021
ca076e5
New tendencies work, except maybe TKE and CLD_AMT
SamuelTrahanNOAA Mar 4, 2021
5e169e8
Rename many variables
SamuelTrahanNOAA Mar 24, 2021
9c509c4
Fix syntax errors, indentation errors, and variable names.
SamuelTrahanNOAA Mar 29, 2021
ff49546
dtend(:,:,1) is used, dtend_o3_photochem sums all four ozphys values,…
SamuelTrahanNOAA Mar 29, 2021
52d8404
merge gsl/develop
SamuelTrahanNOAA Apr 1, 2021
1057ff4
Corrections to argument lists after merge
SamuelTrahanNOAA Apr 5, 2021
4043ea9
Revert an accidental change to GFS_debug.F90
SamuelTrahanNOAA Apr 7, 2021
959e76b
Point to the correct hash of rte-rrtmgp
SamuelTrahanNOAA Apr 7, 2021
2aa3ce2
Fix whitespace issues.
SamuelTrahanNOAA Apr 12, 2021
417ec2d
Merge pull request #81 from SamuelTrahanNOAA/features/more-diag-tend
SamuelTrahanNOAA Apr 12, 2021
94bf989
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into HEAD
climbfuji May 20, 2021
1da8710
Bug fixes from merge of main into gsl/develop
climbfuji May 21, 2021
378a905
Merge pull request #89 from climbfuji/update_gsl_develop_from_main
DomHeinzeller May 21, 2021
2f38f27
Bug fixes to dtend support:
SamuelTrahanNOAA May 24, 2021
9be7b2e
Merge gsl/develop
SamuelTrahanNOAA May 24, 2021
6d75cde
Remove some debug prints
SamuelTrahanNOAA May 24, 2021
9346bb7
dtend: add drag_suite tendencies and fix many bugs in convection tend…
SamuelTrahanNOAA May 28, 2021
462a870
Merge branch 'main' of https://github.com/NCAR/ccpp-physics into HEAD
climbfuji May 31, 2021
09494e6
Several bug fixes to UGWP v1 and GSL drag suite related to updated te…
climbfuji Jun 1, 2021
df632d8
Add missing variables to physics/GFS_debug.F90, comment out erroneous…
climbfuji Jun 2, 2021
10ab813
Fix b4b issue for restart runs with RUC LSM
climbfuji Jun 2, 2021
ef5db31
More bug fixes related to tendencies in physics/unified_ugwp.F90
climbfuji Jun 3, 2021
40ad71e
Merge pull request #93 from climbfuji/update_gsl_develop_from_main_20…
SamuelTrahanNOAA Jun 7, 2021
0d5dd21
Add diagnostic 3D tendencies for all tracers, and refactor diagnostic…
SamuelTrahanNOAA Jun 9, 2021
8ed3401
Merge remote-tracking branch 'community/main' into HEAD
SamuelTrahanNOAA Jun 22, 2021
74382e5
Merge community/main
SamuelTrahanNOAA Jul 15, 2021
69b8c2e
Revert unintended changes after merge
SamuelTrahanNOAA Jul 19, 2021
8474f91
Revert CODEOWNERS to community version
SamuelTrahanNOAA Jul 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# These owners will be the default owners for everything in the repo.
#* @defunkt
* @climbfuji @llpcarson @grantfirl @JulieSchramm
* @DomHeinzeller
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change.


# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
Expand Down
166 changes: 113 additions & 53 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,35 @@ end subroutine GFS_DCNV_generic_pre_finalize
!! \section arg_table_GFS_DCNV_generic_pre_run Argument Table
!! \htmlinclude GFS_DCNV_generic_pre_run.html
!!
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplchm,&
gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, &
errmsg, errflg)
subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplchm, &
gu0, gv0, gt0, gq0, nsamftrac, ntqv, &
save_u, save_v, save_t, save_q, clw, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl, &
ntgnc, cscnv, satmedmf, trans_trac, ras, ntrac, &
dtidx, index_of_process_dcnv, errmsg, errflg)

use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
integer, intent(in) :: im, levs, nsamftrac, ntqv, index_of_process_dcnv, dtidx(:,:), &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc
logical, intent(in) :: ldiag3d, qdiag3d, do_cnvgwd, cplchm
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0
real(kind=kind_phys), dimension(:,:), intent(in) :: gv0
real(kind=kind_phys), dimension(:,:), intent(in) :: gt0
real(kind=kind_phys), dimension(:,:), intent(inout) :: gq0_water_vapor
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_u
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_v
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_t
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_qv
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0
real(kind=kind_phys), dimension(:,:), intent(in) :: gv0
real(kind=kind_phys), dimension(:,:), intent(in) :: gt0
real(kind=kind_phys), dimension(:,:,:), intent(inout) :: gq0
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_u
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_v
real(kind=kind_phys), dimension(:,:), intent(inout) :: save_t
real(kind=kind_phys), dimension(:,:,:), intent(inout) :: save_q
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

logical, intent(in) :: cscnv, satmedmf, trans_trac, ras
real(kind=kind_phys), parameter :: zero = 0.0d0
integer :: i, k
real(kind=kind_phys), dimension(:,:,:), intent(in) :: clw

integer :: i, k, n, tracers

! Initialize CCPP error handling variables
errmsg = ''
Expand All @@ -61,11 +66,26 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, qdiag3d, do_cnvgwd, cplc
endif

if ((ldiag3d.and.qdiag3d) .or. cplchm) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
enddo
enddo
if (cscnv .or. satmedmf .or. trans_trac .or. ras) then
tracers = 2
do n=2,ntrac
if ( n /= ntcw .and. n /= ntiw .and. n /= ntclamt .and. &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc) then
tracers = tracers + 1
if(dtidx(100+n,index_of_process_dcnv)>0) then
save_q(:,:,n) = clw(:,:,tracers)
endif
endif
enddo
else
do n=2,ntrac
if(dtidx(100+n,index_of_process_dcnv)>0) then
save_q(:,:,n) = gq0(:,:,n)
endif
enddo
endif ! end if_ras or cfscnv or samf
save_q(:,:,ntqv) = gq0(:,:,ntqv)
endif

end subroutine GFS_DCNV_generic_pre_run
Expand All @@ -85,44 +105,51 @@ 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, qdiag3d, ras, cscnv, &
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, npdf3d, num_p3d, ncnvcld3d, &
rainc, cldwrk, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend, errmsg, errflg)
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, &
cscnv, frain, rain1, dtf, cld1d, save_u, save_v, save_t, gu0, gv0, gt0, &
ud_mf, dd_mf, dt_mf, con_g, npdf3d, num_p3d, ncnvcld3d, nsamftrac, &
rainc, cldwrk, upd_mf, dwn_mf, det_mf, dtend, dtidx, index_of_process_dcnv, &
index_of_temperature, index_of_x_wind, index_of_y_wind, ntqv, gq0, save_q, &
cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, flag_for_dcnv_generic_tend, &
ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntgnc, ntrac,clw, &
satmedmf, trans_trac, errmsg, errflg)


use machine, only: kind_phys

implicit none

integer, intent(in) :: im, levs
integer, intent(in) :: im, levs, nsamftrac
logical, intent(in) :: lssav, ldiag3d, qdiag3d, ras, cscnv
logical, intent(in) :: flag_for_dcnv_generic_tend

real(kind=kind_phys), intent(in) :: frain, dtf
real(kind=kind_phys), dimension(:), intent(in) :: rain1, cld1d
real(kind=kind_phys), dimension(:,:), intent(in) :: save_u, save_v, save_t, save_qv
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0, gv0, gt0, gq0_water_vapor
real(kind=kind_phys), dimension(:,:), intent(in) :: ud_mf, dd_mf, dt_mf
real(kind=kind_phys), dimension(:), intent(in) :: rain1, cld1d
real(kind=kind_phys), dimension(:,:), intent(in) :: save_u, save_v, save_t
real(kind=kind_phys), dimension(:,:), intent(in) :: gu0, gv0, gt0
real(kind=kind_phys), dimension(:,:,:), intent(in) :: gq0, save_q
real(kind=kind_phys), dimension(:,:), intent(in) :: ud_mf, dd_mf, dt_mf
real(kind=kind_phys), intent(in) :: con_g
integer, intent(in) :: npdf3d, num_p3d, ncnvcld3d
logical, intent(in) :: satmedmf, trans_trac

real(kind=kind_phys), dimension(:), intent(inout) :: rainc, cldwrk
! dt3dt, dq3dt, du3dt, dv3dt upd_mf, dwn_mf, det_mf only allocated if ldiag3d == .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt, du3dt, dv3dt
real(kind=kind_phys), dimension(:), intent(inout) :: rainc, cldwrk
real(kind=kind_phys), dimension(:,:), intent(inout) :: upd_mf, dwn_mf, det_mf
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw, cnvc
! The following arrays may not be allocated, depending on certain flags and microphysics schemes.
! Since Intel 15 crashes when passing unallocated arrays to arrays defined with explicit shape,
! use assumed-shape arrays. Note that Intel 18 and GNU 6.2.0-8.1.0 tolerate explicit-shape arrays
! as long as these do not get used when not allocated (it is still invalid Fortran code, though).

real(kind=kind_phys), dimension(:,:,:), intent(inout) :: dtend
integer, intent(in) :: dtidx(:,:), index_of_process_dcnv, index_of_temperature, &
index_of_x_wind, index_of_y_wind, ntqv
integer, intent(in) :: ntcw,ntiw,ntclamt,ntrw,ntsw,ntrnc,ntsnc,ntgl,ntrac,ntgnc
real(kind=kind_phys), dimension(:,:,:), intent(in) :: clw


real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d

character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

integer :: i, k
integer :: i, k, n, idtend, tracers

! Initialize CCPP error handling variables
errmsg = ''
Expand Down Expand Up @@ -158,23 +185,56 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, qdiag3d, ras, cs
enddo

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
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
idtend=dtidx(index_of_temperature,index_of_process_dcnv)
if(idtend>=1) then
dtend(:,:,idtend) = dtend(:,:,idtend) + (gt0-save_t)*frain
endif

idtend=dtidx(index_of_x_wind,index_of_process_dcnv)
if(idtend>=1) then
dtend(:,:,idtend) = dtend(:,:,idtend) + (gu0-save_u)*frain
endif

idtend=dtidx(index_of_y_wind,index_of_process_dcnv)
if(idtend>=1) then
dtend(:,:,idtend) = dtend(:,:,idtend) + (gv0-save_v)*frain
endif

if (cscnv .or. satmedmf .or. trans_trac .or. ras) then
tracers = 2
do n=2,ntrac
if ( n /= ntcw .and. n /= ntiw .and. n /= ntclamt .and. &
n /= ntrw .and. n /= ntsw .and. n /= ntrnc .and. &
n /= ntsnc .and. n /= ntgl .and. n /= ntgnc) then
tracers = tracers + 1
idtend = dtidx(100+n,index_of_process_dcnv)
if(idtend>0) then
dtend(:,:,idtend) = dtend(:,:,idtend) + clw(:,:,tracers)-save_q(:,:,n) * frain
endif
endif
enddo
else
do n=2,ntrac
idtend = dtidx(100+n,index_of_process_dcnv)
if(idtend>0) then
dtend(:,:,idtend) = dtend(:,:,idtend) + (gq0(:,:,n)-save_q(:,:,n))*frain
endif
enddo
enddo
endif
idtend = dtidx(100+ntqv, index_of_process_dcnv)
if(idtend>=1) then
dtend(:,:,idtend) = dtend(:,:,idtend) + (gq0(:,:,ntqv) - save_q(:,:,ntqv)) * frain
endif

! convective mass fluxes
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
! convective mass fluxes
upd_mf(i,k) = upd_mf(i,k) + ud_mf(i,k) * (con_g*frain)
dwn_mf(i,k) = dwn_mf(i,k) + dd_mf(i,k) * (con_g*frain)
det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * (con_g*frain)
enddo
enddo
do k=1,levs
do i=1,im
upd_mf(i,k) = upd_mf(i,k) + ud_mf(i,k) * (con_g*frain)
dwn_mf(i,k) = dwn_mf(i,k) + dd_mf(i,k) * (con_g*frain)
det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * (con_g*frain)
enddo
enddo
endif
endif ! if (ldiag3d)

Expand Down
Loading