Skip to content

Commit

Permalink
Merge pull request #9 from dustinswales/rrtmgp-dev
Browse files Browse the repository at this point in the history
Created new rrtmgp-dev(2) branch. Something got corrupted.
  • Loading branch information
dustinswales authored Dec 4, 2019
2 parents f895fc0 + 10191cd commit 993508d
Show file tree
Hide file tree
Showing 40 changed files with 11,350 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
# Auto-generated include files in Fortran code
*.inc
physics/*cap.F90
physics/*.xml
*.cmake
*.mk
*.html
physics/rte-rrtmgp
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "physics/rte-rrtmgp"]
path = physics/rte-rrtmgp
url = https://[email protected]/dustinswales/rte-rrtmgp
branch = rrtmgp-CCPP
41 changes: 39 additions & 2 deletions physics/GFS_rrtmg_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module GFS_rrtmg_pre

public GFS_rrtmg_pre_run

contains

!> \defgroup GFS_rrtmg_pre GFS RRTMG Scheme Pre
Expand Down Expand Up @@ -155,6 +154,8 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
rhly, tvly,qstl, vvel, clw, ciw, prslk1, tem2da, &
cldcov, deltaq, cnvc, cnvw, &
effrl, effri, effrr, effrs
real (kind=kind_phys) :: clwmin, clwm, clwt, onemrh, value, tem1, tem2, tem3
real (kind=kind_phys), parameter :: xrc3 = 100.

real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+LTP+1) :: tem2db
! real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+LTP+1) :: hz
Expand Down Expand Up @@ -273,7 +274,7 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
tracer1(:,k1,j) = max(0.0, Statein%qgrs(:,k2,j))
enddo
enddo
!

if (ivflip == 0) then ! input data from toa to sfc
do i = 1, IM
plvl(i,1+kd) = 0.01 * Statein%prsi(i,1) ! pa to mb (hpa)
Expand Down Expand Up @@ -591,6 +592,7 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
enddo
endif
!

if (Model%uni_cld) then
if (Model%effr_in) then
do k=1,lm
Expand Down Expand Up @@ -694,6 +696,40 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
ccnd(1:IM,1:LMK,1) = ccnd(1:IM,1:LMK,1) + cnvw(1:IM,1:LMK)
endif

if (Model%imp_physics == 10) then
ccnd(1:IM,1:LMK,1) = ccnd(1:IM,1:LMK,1) + cnvw(1:IM,1:LMK) + ccnd(1:IM,1:LMK,2)
endif

if (Model%uni_cld) then
if (Model%effr_in) then
do k=1,lm
k1 = k + kd
do i=1,im
cldcov(i,k1) = Tbd%phy_f3d(i,k,Model%indcld)
effrl(i,k1) = Tbd%phy_f3d(i,k,2)
effri(i,k1) = Tbd%phy_f3d(i,k,3)
effrr(i,k1) = Tbd%phy_f3d(i,k,4)
effrs(i,k1) = Tbd%phy_f3d(i,k,5)
enddo
enddo
else
do k=1,lm
k1 = k + kd
do i=1,im
cldcov(i,k1) = Tbd%phy_f3d(i,k,Model%indcld)
if (tracer1(i,k,ntcw) .gt. 0 .or. tracer1(i,k,ntiw) .gt. 0) then
cldcov(i,k1) = 0.1
else
cldcov(i,k1) = 0.0
endif
enddo
enddo
endif
elseif (Model%imp_physics == Model%imp_physics_gfdl) then ! GFDL MP
cldcov(1:IM,1+kd:LM+kd) = tracer1(1:IM,1:LM,Model%ntclamt)
else ! neither of the other two cases
cldcov = 0.0
endif

if (Model%imp_physics == 99 .or. Model%imp_physics == 10) then ! zhao/moorthi's prognostic cloud scheme
! or unified cloud and/or with MG microphysics
Expand Down Expand Up @@ -784,6 +820,7 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
enddo
enddo


! mg, sfc-perts
! --- scale random patterns for surface perturbations with
! perturbation size
Expand Down
69 changes: 69 additions & 0 deletions physics/GFS_rrtmgp_gas_optics.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
!> \file GFS_rrtmgp_gas_optics.f90
!! This file contains
module GFS_rrtmgp_gas_optics
use machine, only: kind_phys
use GFS_typedefs, only: GFS_control_type,GFS_radtend_type

public GFS_rrtmgp_gas_optics_init,GFS_rrtmgp_gas_optics_run,GFS_rrtmgp_gas_optics_finalize
contains

!! \section arg_table_GFS_rrtmgp_gas_optics_init
!! \htmlinclude GFS_rrtmgp_gas_optics.html
!!

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_gas_optics_init()
! #########################################################################################
subroutine GFS_rrtmgp_gas_optics_init(Model, Radtend, errmsg, errflg)
! Inputs
type(GFS_control_type), intent(in) :: &
Model ! DDT containing model control parameters
type(GFS_radtend_type), intent(inout) :: &
Radtend ! Fortran DDT containing FV3-GFS radiation tendencies
! Outputs
character(len=*), intent(out) :: &
errmsg ! Error message
integer, intent(out) :: &
errflg ! Error flag

! Local variables
character(len=1) :: tempstr
integer :: ij, count
integer,dimension(Model%ngases,2) :: gasIndices

! Initialize
errmsg = ''
errflg = 0

! Which gases are active? Provided via physics namelist.
if (len(Model%active_gases) .gt. 0) then

! Pull out gas names from list...
! First grab indices in character array corresponding to start:end of gas name.
gasIndices(1,1)=1
count=1
do ij=1,len(Model%active_gases)
tempstr=trim(Model%active_gases(ij:ij))
if (tempstr .eq. '_') then
gasIndices(count,2)=ij-1
gasIndices(count+1,1)=ij+1
count=count+1
endif
enddo
gasIndices(Model%ngases,2)=len(trim(Model%active_gases))
! Now extract the gas names
do ij=1,Model%ngases
Radtend%active_gases(ij) = Model%active_gases(gasIndices(ij,1):gasIndices(ij,2))
enddo
endif
end subroutine GFS_rrtmgp_gas_optics_init
!
subroutine GFS_rrtmgp_gas_optics_run()


end subroutine GFS_rrtmgp_gas_optics_run
!
subroutine GFS_rrtmgp_gas_optics_finalize()
end subroutine GFS_rrtmgp_gas_optics_finalize
!
end module GFS_rrtmgp_gas_optics
46 changes: 46 additions & 0 deletions physics/GFS_rrtmgp_gas_optics.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_init
type = scheme
[Model]
standard_name = GFS_control_type_instance
long_name = instance of derived type GFS_control_type
units = DDT
dimensions = ()
type = GFS_control_type
intent = in
optional = F
[Radtend]
standard_name = GFS_radtend_type_instance
long_name = instance of derived type GFS_radtend_type
units = DDT
dimensions = ()
type = GFS_radtend_type
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

########################################################################
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_run
type = scheme

########################################################################
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_finalize
type = scheme
Loading

0 comments on commit 993508d

Please sign in to comment.