Skip to content

Commit

Permalink
Merge branch 'dtc/develop' of https://github.com/NCAR/ccpp-physics in…
Browse files Browse the repository at this point in the history
…to rrtmgp-dev
  • Loading branch information
dustinswales committed Nov 20, 2019
2 parents 50b82a5 + a7c38a6 commit d2799f4
Show file tree
Hide file tree
Showing 30 changed files with 8,146 additions and 1,066 deletions.
64 changes: 57 additions & 7 deletions physics/GFS_GWD_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ module GFS_GWD_generic_pre

contains

!> \section arg_table_GFS_GWD_generic_pre_init Argument Table
!!
subroutine GFS_GWD_generic_pre_init()
end subroutine GFS_GWD_generic_pre_init

Expand Down Expand Up @@ -105,12 +103,64 @@ subroutine GFS_GWD_generic_pre_run( &
end subroutine GFS_GWD_generic_pre_run
!> @}

! \ingroup GFS_ogwd
! \brief Brief description of the subroutine
!
!> \section arg_table_GFS_GWD_generic_pre_finalize Argument Table
!!
subroutine GFS_GWD_generic_pre_finalize()
end subroutine GFS_GWD_generic_pre_finalize

end module GFS_GWD_generic_pre

!> This module contains the CCPP-compliant orographic gravity wave drag post
!! interstitial codes.
module GFS_GWD_generic_post

contains


subroutine GFS_GWD_generic_post_init()
end subroutine GFS_GWD_generic_post_init

!! \section arg_table_GFS_GWD_generic_post_run Argument Table
!! \htmlinclude GFS_GWD_generic_post_run.html
!!
!! \section general General Algorithm
!! \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)

use machine, only : kind_phys
implicit none

logical, intent(in) :: lssav, ldiag3d

real(kind=kind_phys), intent(in) :: dusfcg(:), dvsfcg(:)
real(kind=kind_phys), intent(in) :: dudt(:,:), dvdt(:,:), dtdt(:,:)
real(kind=kind_phys), intent(in) :: dtf

real(kind=kind_phys), intent(inout) :: dugwd(:), dvgwd(:)
real(kind=kind_phys), intent(inout) :: du3dt(:,:), dv3dt(:,:), dt3dt(:,:)

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

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (lssav) then
dugwd(:) = dugwd(:) + dusfcg(:)*dtf
dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf

if (ldiag3d) then
du3dt(:,:) = du3dt(:,:) + dudt(:,:) * dtf
dv3dt(:,:) = dv3dt(:,:) + dvdt(:,:) * dtf
dt3dt(:,:) = dt3dt(:,:) + dtdt(:,:) * dtf
endif
endif

end subroutine GFS_GWD_generic_post_run
!> @}

subroutine GFS_GWD_generic_post_finalize()
end subroutine GFS_GWD_generic_post_finalize

end module GFS_GWD_generic_post
137 changes: 137 additions & 0 deletions physics/GFS_GWD_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,140 @@
[ccpp-arg-table]
name = GFS_GWD_generic_pre_finalize
type = scheme

########################################################################
[ccpp-arg-table]
name = GFS_GWD_generic_post_run
type = scheme
[lssav]
standard_name = flag_diagnostics
long_name = flag for calculating diagnostic fields
units = flag
dimensions = ()
type = logical
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
[dtf]
standard_name = time_step_for_dynamics
long_name = dynamics time step
units = s
dimensions = ()
type = real
kind = kind_phys
intent = in
optional = F
[dusfcg]
standard_name = instantaneous_x_stress_due_to_gravity_wave_drag
long_name = zonal surface stress due to orographic gravity wave drag
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dvsfcg]
standard_name = instantaneous_y_stress_due_to_gravity_wave_drag
long_name = meridional surface stress due to orographic gravity wave drag
units = Pa
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
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
intent = in
optional = F
[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
intent = in
optional = F
[dtdt]
standard_name = tendency_of_air_temperature_due_to_model_physics
long_name = air temperature tendency due to model physics
units = K s-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[dugwd]
standard_name = time_integral_of_x_stress_due_to_gravity_wave_drag
long_name = integral over time of zonal stress due to gravity wave drag
units = Pa s
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[dvgwd]
standard_name = time_integral_of_y_stress_due_to_gravity_wave_drag
long_name = integral over time of meridional stress due to gravity wave drag
units = Pa s
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = inout
optional = F
[du3dt]
standard_name = cumulative_change_in_x_wind_due_to_orographic_gravity_wave_drag
long_name = cumulative change in zonal wind due to orographic gravity wave drag
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_orographic_gravity_wave_drag
long_name = cumulative change in meridional wind due to orographic gravity wave drag
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_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
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
optional = F
[errflg]
standard_name = ccpp_error_flag
long_name = error flag for error handling in CCPP
units = flag
dimensions = ()
type = integer
intent = out
optional = F
4 changes: 0 additions & 4 deletions physics/GFS_PBL_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,6 @@ subroutine GFS_PBL_generic_post_run (im, levs, nvdiff, ntrac,
dkt_cpl(1:im,1:levs-1) = dkt(1:im,1:levs-1)
endif

if(cplflx)then
write(*,*)'Fatal error: CCPP is not ready for cplflx=true!!'
stop
endif

! --- ... coupling insertion

Expand Down
39 changes: 38 additions & 1 deletion physics/GFS_SCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ 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, cplchm, &
frain, gt0, gq0_water_vapor, save_t, save_qv, dqdti, dt3dt, dq3dt, clw, errmsg, errflg)
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, &
imfshalcnv, imfshalcnv_sas, imfshalcnv_samf, errmsg, errflg)

use machine, only: kind_phys

Expand All @@ -85,6 +88,19 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, cplchm, &
real(kind=kind_phys), dimension(:,:), intent(inout) :: dt3dt, dq3dt
real(kind=kind_phys), dimension(im,levs,nn), intent(inout) :: clw

! Post code for SAS/SAMF
integer, intent(in) :: npdf3d, num_p3d, ncnvcld3d
logical, intent(in) :: shcnvcw
real(kind=kind_phys), dimension(im), intent(in) :: rain1
real(kind=kind_phys), dimension(im,levs), intent(in) :: cnvw, cnvc
real(kind=kind_phys), dimension(im), intent(inout) :: rainc, cnvprcp, cnvprcpb
! 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.
real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d
integer, intent(in) :: imfshalcnv, imfshalcnv_sas, imfshalcnv_samf

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

Expand All @@ -95,6 +111,27 @@ subroutine GFS_SCNV_generic_post_run (im, levs, nn, lssav, ldiag3d, cplchm, &
errmsg = ''
errflg = 0

if (imfshalcnv==imfshalcnv_sas .or. imfshalcnv==imfshalcnv_samf) then
do i=1,im
rainc(i) = rainc(i) + frain * rain1(i)
enddo
! 'cnvw' and 'cnvc' are set to zero before computation starts:
if (shcnvcw .and. num_p3d == 4 .and. npdf3d == 3) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw_phy_f3d(i,k) + cnvw(i,k)
cnvc_phy_f3d(i,k) = cnvc_phy_f3d(i,k) + cnvc(i,k)
enddo
enddo
elseif (npdf3d == 0 .and. ncnvcld3d == 1) then
do k=1,levs
do i=1,im
cnvw_phy_f3d(i,k) = cnvw_phy_f3d(i,k) + cnvw(i,k)
enddo
enddo
endif
endif

if (lssav) then
if (ldiag3d) then
do k=1,levs
Expand Down
Loading

0 comments on commit d2799f4

Please sign in to comment.