Skip to content

Commit

Permalink
Fixed potential issue in Thompson MP scheme. Cleaned up a tad.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinswales committed Jun 7, 2019
1 parent 893ce88 commit 52cb3a0
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 101 deletions.
70 changes: 35 additions & 35 deletions physics/GFS_rrtmgp_post.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ subroutine GFS_rrtmgp_post_init ()
end subroutine GFS_rrtmgp_post_init

!> \section arg_table_GFS_rrtmgp_post_run Argument Table
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |-------------------|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|----------|------|----------------------|-----------|--------|----------|
!! | Model | GFS_control_type_instance | Fortran DDT containing FV3-GFS model control parameters | DDT | 0 | GFS_control_type | | in | F |
!! | Grid | GFS_grid_type_instance | Fortran DDT containing FV3-GFS grid and interpolation related data | DDT | 0 | GFS_grid_type | | in | F |
!! | Diag | GFS_diag_type_instance | Fortran DDT containing FV3-GFS diagnotics data | DDT | 0 | GFS_diag_type | | inout | F |
!! | Radtend | GFS_radtend_type_instance | Fortran DDT containing FV3-GFS radiation tendencies | DDT | 0 | GFS_radtend_type | | inout | F |
!! | Statein | GFS_statein_type_instance | Fortran DDT containing FV3-GFS prognostic state data in from dycore | DDT | 0 | GFS_statein_type | | in | F |
!! | Coupling | GFS_coupling_type_instance | Fortran DDT containing FV3-GFS fields to/from coupling with other components | DDT | 0 | GFS_coupling_type | | inout | F |
!! | scmpsw | components_of_surface_downward_shortwave_fluxes | derived type for special components of surface downward shortwave fluxes | W m-2 | 1 | cmpfsw_type | | inout | T |
!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | raddt | time_step_for_radiation | radiation time step | s | 0 | real | kind_phys | in | F |
!! | aerodp | atmosphere_optical_thickness_due_to_ambient_aerosol_particles | vertical integrated optical depth for various aerosol species | none | 2 | real | kind_phys | in | F |
!! | cldsa | cloud_area_fraction_for_radiation | fraction of clouds for low, middle, high, total and BL | frac | 2 | real | kind_phys | in | F |
!! | mtopa | model_layer_number_at_cloud_top | vertical indices for low, middle and high cloud tops | index | 2 | integer | | in | F |
!! | mbota | model_layer_number_at_cloud_base | vertical indices for low, middle and high cloud bases | index | 2 | integer | | in | F |
!! | cloud_fraction | total_cloud_fraction | layer total cloud fraction | frac | 2 | real | kind_phys | in | F |
!! | cldtaulw | cloud_optical_depth_layers_at_10mu_band | approx 10mu band layer cloud optical depth | none | 2 | real | kind_phys | in | F |
!! | cldtausw | cloud_optical_depth_layers_at_0.55mu_band | approx .55mu band layer cloud optical depth | none | 2 | real | kind_phys | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!! | local_name | standard_name | long_name | units | rank | type | kind | intent | optional |
!! |----------------|---------------------------------------------------------------|------------------------------------------------------------------------------|----------|------|-------------------|-----------|--------|----------|
!! | Model | GFS_control_type_instance | Fortran DDT containing FV3-GFS model control parameters | DDT | 0 | GFS_control_type | | in | F |
!! | Grid | GFS_grid_type_instance | Fortran DDT containing FV3-GFS grid and interpolation related data | DDT | 0 | GFS_grid_type | | in | F |
!! | Diag | GFS_diag_type_instance | Fortran DDT containing FV3-GFS diagnotics data | DDT | 0 | GFS_diag_type | | inout | F |
!! | Radtend | GFS_radtend_type_instance | Fortran DDT containing FV3-GFS radiation tendencies | DDT | 0 | GFS_radtend_type | | inout | F |
!! | Statein | GFS_statein_type_instance | Fortran DDT containing FV3-GFS prognostic state data in from dycore | DDT | 0 | GFS_statein_type | | in | F |
!! | Coupling | GFS_coupling_type_instance | Fortran DDT containing FV3-GFS fields to/from coupling with other components | DDT | 0 | GFS_coupling_type | | inout | F |
!! | scmpsw | components_of_surface_downward_shortwave_fluxes | derived type for special components of surface downward shortwave fluxes | W m-2 | 1 | cmpfsw_type | | inout | T |
!! | ncol | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F |
!! | raddt | time_step_for_radiation | radiation time step | s | 0 | real | kind_phys | in | F |
!! | aerodp | atmosphere_optical_thickness_due_to_ambient_aerosol_particles | vertical integrated optical depth for various aerosol species | none | 2 | real | kind_phys | in | F |
!! | cldsa | cloud_area_fraction_for_radiation | fraction of clouds for low, middle, high, total and BL | frac | 2 | real | kind_phys | in | F |
!! | mtopa | model_layer_number_at_cloud_top | vertical indices for low, middle and high cloud tops | index | 2 | integer | | in | F |
!! | mbota | model_layer_number_at_cloud_base | vertical indices for low, middle and high cloud bases | index | 2 | integer | | in | F |
!! | cloud_fraction | total_cloud_fraction | layer total cloud fraction | frac | 2 | real | kind_phys | in | F |
!! | cldtaulw | cloud_optical_depth_layers_at_10mu_band | approx 10mu band layer cloud optical depth | none | 2 | real | kind_phys | in | F |
!! | cldtausw | cloud_optical_depth_layers_at_0.55mu_band | approx .55mu band layer cloud optical depth | none | 2 | real | kind_phys | in | F |
!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F |
!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F |
!!
subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
Coupling, scmpsw, im, raddt, aerodp, &
cldsa, mtopa, mbota, cloud_fraction, cldtaulw, cldtausw, errmsg, errflg)
subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, Coupling, scmpsw, &
ncol, raddt, aerodp, cldsa, mtopa, mbota, cloud_fraction, cldtaulw, cldtausw, &
errmsg, errflg)

! Inputs
type(GFS_control_type), intent(in) :: &
Expand All @@ -66,22 +66,22 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
type(GFS_diag_type), intent(inout) :: &
Diag ! Fortran DDT containing FV3-GFS diagnotics data
integer, intent(in) :: &
im ! Horizontal loop extent
ncol ! Horizontal loop extent
real(kind_phys), intent(in) :: &
raddt ! Radiation time step
real(kind_phys), dimension(size(Grid%xlon,1),NSPC1), intent(in) :: &
real(kind_phys), dimension(ncol,NSPC1), intent(in) :: &
aerodp ! Vertical integrated optical depth for various aerosol species
real(kind_phys), dimension(size(Grid%xlon,1),5), intent(in) :: &
real(kind_phys), dimension(ncol,5), intent(in) :: &
cldsa ! Fraction of clouds for low, middle, high, total and BL
integer, dimension(size(Grid%xlon,1),3), intent(in) ::&
integer, dimension(ncol,3), intent(in) ::&
mbota, & ! vertical indices for low, middle and high cloud tops
mtopa ! vertical indices for low, middle and high cloud bases
real(kind_phys), dimension(size(Grid%xlon,1),Model%levs), intent(in) :: &
real(kind_phys), dimension(ncol,Model%levs), intent(in) :: &
cloud_fraction, & ! Total cloud fraction in each layer
cldtausw, & ! approx .55mu band layer cloud optical depth
cldtaulw ! approx 10.mu band layer cloud optical depth
! Inputs (optional)
type(cmpfsw_type), dimension(size(Grid%xlon,1)), intent(inout), optional :: &
type(cmpfsw_type), dimension(ncol), intent(inout), optional :: &
scmpsw ! 2D surface fluxes, components:
! uvbfc - total sky downward uv-b flux at (W/m2)
! uvbf0 - clear sky downward uv-b flux at (W/m2)
Expand Down Expand Up @@ -119,7 +119,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &

if (Model%lssav) then
if (Model%lsswr) then
do i=1,im
do i=1,ncol
Diag%fluxr(i,34) = Diag%fluxr(i,34) + Model%fhswr*aerodp(i,1) ! total aod at 550nm
Diag%fluxr(i,35) = Diag%fluxr(i,35) + Model%fhswr*aerodp(i,2) ! DU aod at 550nm
Diag%fluxr(i,36) = Diag%fluxr(i,36) + Model%fhswr*aerodp(i,3) ! BC aod at 550nm
Expand All @@ -131,7 +131,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &

! Save LW TOA and SFC fluxes
if (Model%lslwr) then
do i=1,im
do i=1,ncol
! LW all-sky fluxes
Diag%fluxr(i,1 ) = Diag%fluxr(i,1 ) + Model%fhlwr * Diag%topflw(i)%upfxc ! total sky top lw up
Diag%fluxr(i,19) = Diag%fluxr(i,19) + Model%fhlwr * Radtend%sfcflw(i)%dnfxc ! total sky sfc lw dn
Expand All @@ -146,7 +146,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
! Save sw toa and sfc fluxes with proper diurnal sw wgt. coszen=mean cosz over daylight
! part of sw calling interval, while coszdg= mean cosz over entire interval
if (Model%lsswr) then
do i = 1, IM
do i = 1, NCOL
if (Radtend%coszen(i) > 0.) then
! SW all-sky fluxes
tem0d = Model%fhswr * Radtend%coszdg(i) / Radtend%coszen(i)
Expand Down Expand Up @@ -174,7 +174,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
! --- save total and boundary layer clouds

if (Model%lsswr .or. Model%lslwr) then
do i=1,im
do i=1,ncol
Diag%fluxr(i,17) = Diag%fluxr(i,17) + raddt * cldsa(i,4)
Diag%fluxr(i,18) = Diag%fluxr(i,18) + raddt * cldsa(i,5)
enddo
Expand All @@ -184,7 +184,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
! --- save interface pressure (pa) of top/bot

do j = 1, 3
do i = 1, IM
do i = 1, NCOL
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j)
ibtc = mbota(i,j)
Expand All @@ -209,7 +209,7 @@ subroutine GFS_rrtmgp_post_run (Model, Grid, Diag, Radtend, Statein, &
! if (.not. Model%uni_cld) then
if (Model%lgocart .or. Model%ldiag3d) then
do k = 1, Model%levs
Coupling%cldcovi(1:im,k) = cloud_fraction(1:im,k)
Coupling%cldcovi(1:ncol,k) = cloud_fraction(1:ncol,k)
enddo
endif
endif ! end_if_lssav
Expand Down
Loading

0 comments on commit 52cb3a0

Please sign in to comment.