Skip to content

Commit

Permalink
Merge pull request #1 from climbfuji/update_anning_mg3_v1_pr
Browse files Browse the repository at this point in the history
Update MG3_v1 PR
  • Loading branch information
AnningCheng-NOAA authored Mar 20, 2020
2 parents b745df8 + e99cfb1 commit bdc185a
Show file tree
Hide file tree
Showing 122 changed files with 22,830 additions and 3,941 deletions.
30 changes: 18 additions & 12 deletions physics/GFS_DCNV_generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ 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, do_cnvgwd, do_ca, cplchm,&
isppt_deep, gu0, gv0, gt0, gq0_water_vapor, &
save_u, save_v, save_t, save_qv, ca_deep, &
errmsg, errflg)
dqdti, errmsg, errflg)

use machine, only: kind_phys
use machine, only: kind_phys

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, cplchm, isppt_deep
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
Expand All @@ -37,9 +37,12 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t
real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_qv
real(kind=kind_phys), dimension(im), intent(in) :: ca_deep
! dqdti only allocated if cplchm is .true.
real(kind=kind_phys), dimension(:,:), intent(inout) :: dqdti
character(len=*), intent(out) :: errmsg
integer, intent(out) :: errflg

real(kind=kind_phys), parameter :: zero = 0.0d0
integer :: i, k

! Initialize CCPP error handling variables
Expand Down Expand Up @@ -70,14 +73,18 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, do_cnvgwd, do_ca,
enddo
endif

if (ldiag3d .or. isppt_deep) then
if (ldiag3d .or. cplchm .or. isppt_deep) then
do k=1,levs
do i=1,im
save_qv(i,k) = gq0_water_vapor(i,k)
enddo
enddo
endif

if (cplchm) then
dqdti = zero
endif

end subroutine GFS_DCNV_generic_pre_run

end module GFS_DCNV_generic_pre
Expand All @@ -97,7 +104,7 @@ end subroutine GFS_DCNV_generic_post_finalize
!!
subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, 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, &
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, &
cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg)
Expand All @@ -115,7 +122,6 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0, gv0, gt0, gq0_water_vapor
real(kind=kind_phys), dimension(im,levs), intent(in) :: ud_mf, dd_mf, dt_mf
real(kind=kind_phys), intent(in) :: con_g
real(kind=kind_phys), dimension(im,levs), intent(in) :: clw_ice, clw_liquid
integer, intent(in) :: npdf3d, num_p3d, ncnvcld3d

real(kind=kind_phys), dimension(im), intent(inout) :: rainc, cldwrk
Expand Down Expand Up @@ -144,7 +150,7 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, ras, cscnv, do_c
if (.not. ras .and. .not. cscnv) then
if(do_ca) then
do i=1,im
cape(i)=cld1d(i)
cape(i) = cld1d(i)
enddo
endif
if (npdf3d == 3 .and. num_p3d == 4) then
Expand Down Expand Up @@ -179,13 +185,13 @@ 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
! 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

! 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)
! 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 ! if (ldiag3d)
Expand Down
35 changes: 17 additions & 18 deletions physics/GFS_DCNV_generic.meta
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
type = logical
intent = in
optional = F
[cplchm]
standard_name = flag_for_chemistry_coupling
long_name = flag controlling cplchm collection (default off)
units = flag
dimensions = ()
type = logical
intent = in
optional = F
[isppt_deep]
standard_name = flag_for_combination_of_sppt_with_isppt_deep
long_name = switch for combination with isppt_deep.
Expand Down Expand Up @@ -130,6 +138,15 @@
kind = kind_phys
intent = in
optional = F
[dqdti]
standard_name = instantaneous_water_vapor_specific_humidity_tendency_due_to_convection
long_name = instantaneous moisture tendency due to convection
units = kg kg-1 s-1
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
Expand Down Expand Up @@ -360,24 +377,6 @@
kind = kind_phys
intent = in
optional = F
[clw_ice]
standard_name = ice_water_mixing_ratio_convective_transport_tracer
long_name = moist (dry+vapor, no condensates) mixing ratio of ice water in the convectively transported tracer array
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[clw_liquid]
standard_name = cloud_condensed_water_mixing_ratio_convective_transport_tracer
long_name = moist (dry+vapor, no condensates) mixing ratio of cloud water (condensate) in the convectively transported tracer array
units = kg kg-1
dimensions = (horizontal_dimension,vertical_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[npdf3d]
standard_name = number_of_3d_arrays_associated_with_pdf_based_clouds
long_name = number of 3d arrays associated with pdf based clouds/mp
Expand Down
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
Loading

0 comments on commit bdc185a

Please sign in to comment.