Skip to content

Commit

Permalink
Some more cleanup and documenting. Added initialization routine for c…
Browse files Browse the repository at this point in the history
…loud-sampling routines.
  • Loading branch information
dustinswales committed Dec 13, 2019
1 parent 0ea0a12 commit 8c46c34
Show file tree
Hide file tree
Showing 13 changed files with 452 additions and 425 deletions.
4 changes: 2 additions & 2 deletions physics/rrtmgp_lw_aerosol_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ subroutine rrtmgp_lw_aerosol_optics_run(doLWrad, nCol, nLev, nTracer, p_lev, p_l
type(ty_optical_props_1scl),intent(out) :: &
lw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau)
integer, intent(out) :: &
errflg !
errflg ! CCPP error flag
character(len=*), intent(out) :: &
errmsg !
errmsg ! CCPP error message

! Local variables
real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), NF_AELW) :: &
Expand Down
310 changes: 156 additions & 154 deletions physics/rrtmgp_lw_cloud_optics.F90

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions physics/rrtmgp_lw_cloud_sampling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ module rrtmgp_lw_cloud_sampling
! #########################################################################################
! SUBROUTINE mcica_init
! #########################################################################################
subroutine rrtmgp_lw_cloud_sampling_init()
!! \section arg_table_rrtmgp_lw_cloud_sampling_init
!! \htmlinclude rrtmgp_lw_cloud_sampling.html
!!
subroutine rrtmgp_lw_cloud_sampling_init(lw_gas_props, ipsdlw0)
! Inputs
type(ty_gas_optics_rrtmgp),intent(in) :: &
lw_gas_props ! RRTMGP DDT: K-distribution data
! Outputs
integer, intent(out) :: &
ipsdlw0 ! Initial permutation seed for McICA

! Set initial permutation seed for McICA, initially set to number of G-points
ipsdlw0 = lw_gas_props%get_ngpt()

end subroutine rrtmgp_lw_cloud_sampling_init

! #########################################################################################
Expand Down Expand Up @@ -46,9 +59,9 @@ subroutine rrtmgp_lw_cloud_sampling_run(doLWrad, nCol, nLev, ipsdlw0, icseed_lw,

! Outputs
character(len=*), intent(out) :: &
errmsg ! Error message
errmsg ! CCPP error message
integer, intent(out) :: &
errflg ! Error code
errflg ! CCPP error code
type(ty_optical_props_1scl),intent(out) :: &
lw_optical_props_clouds ! RRTMGP DDT: Shortwave optical properties (cloudy atmosphere)

Expand Down
21 changes: 21 additions & 0 deletions physics/rrtmgp_lw_cloud_sampling.meta
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
[ccpp-arg-table]
name = rrtmgp_lw_cloud_sampling_init
type = scheme
[lw_gas_props]
standard_name = coefficients_for_lw_gas_optics
long_name = DDT containing spectral information for RRTMGP LW radiation scheme
units = DDT
dimensions = ()
type = ty_gas_optics_rrtmgp
intent = in
optional = F
[ipsdlw0]
standard_name = initial_permutation_seed_lw
long_name = initial seed for McICA LW
units = none
dimensions = ()
type = integer
intent = out
optional = F

######################################################
[ccpp-arg-table]
name = rrtmgp_lw_cloud_sampling_run
type = scheme
Expand Down
55 changes: 20 additions & 35 deletions physics/rrtmgp_lw_gas_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module rrtmgp_lw_gas_optics
!! \htmlinclude rrtmgp_lw_gas_optics.html
!!
subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp_nGases, &
active_gases_array, mpicomm, mpirank, mpiroot, lw_gas_props, ipsdlw0, errmsg, errflg)
active_gases_array, mpicomm, mpirank, mpiroot, lw_gas_props, errmsg, errflg)
use netcdf

#ifdef MPI
Expand All @@ -40,12 +40,11 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp

! Outputs
character(len=*), intent(out) :: &
errmsg ! Error message
errmsg ! CCPP error message
integer, intent(out) :: &
errflg, & ! Error code
ipsdlw0 !
errflg ! CCPP error code
type(ty_gas_optics_rrtmgp),intent(out) :: &
lw_gas_props ! RRTMGP DDT:
lw_gas_props ! RRTMGP DDT: longwave spectral information

! Variables that will be passed to gas_optics%load()
type(ty_gas_concs) :: &
Expand All @@ -67,7 +66,7 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp
temp_ref_t ! Standard spectroscopic reference temperature [K]
real(kind_phys), dimension(:), allocatable :: &
press_ref, & ! Pressures for reference atmosphere; press_ref(# reference layers) [Pa]
temp_ref ! Remperatures for reference atmosphere; temp_ref(# reference layers) [K]
temp_ref ! Temperatures for reference atmosphere; temp_ref(# reference layers) [K]
real(kind_phys), dimension(:,:), allocatable :: &
band_lims, & ! Beginning and ending wavenumber [cm -1] for each band
totplnk ! Integrated Planck function by band
Expand All @@ -85,9 +84,9 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp
character(len=32), dimension(:), allocatable :: &
gas_names, & ! Names of absorbing gases
gas_minor, & ! Name of absorbing minor gas
identifier_minor, & ! unique string identifying minor gas
minor_gases_lower, & ! names of minor absorbing gases in lower atmosphere
minor_gases_upper, & ! names of minor absorbing gases in upper atmosphere
identifier_minor, & ! Unique string identifying minor gas
minor_gases_lower, & ! Names of minor absorbing gases in lower atmosphere
minor_gases_upper, & ! Names of minor absorbing gases in upper atmosphere
scaling_gas_lower, & ! Absorption also depends on the concentration of this gas
scaling_gas_upper ! Absorption also depends on the concentration of this gas
logical(wl), dimension(:), allocatable :: &
Expand All @@ -98,27 +97,16 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp

! Dimensions
integer :: &
ntemps, & !
npress, & !
ngpts_lw, & !
nabsorbers, & !
nextrabsorbers, & !
nminorabsorbers, & !
nmixingfracs, & !
nlayers, & !
nbnds, & !
npairs, & !
ninternalSourcetemps, & !
nminor_absorber_intervals_lower, & !
nminor_absorber_intervals_upper, & !
ncontributors_lower, & !
ncontributors_upper !
ntemps, npress, ngpts_lw, nabsorbers, nextrabsorbers, nminorabsorbers,&
nmixingfracs, nlayers, nbnds, npairs, ninternalSourcetemps, &
nminor_absorber_intervals_lower, nminor_absorber_intervals_upper, &
ncontributors_lower, ncontributors_upper

! Local variables
integer :: ncid_lw,dimID,varID,status,iGas
integer,dimension(:),allocatable :: temp1,temp2,temp3,temp4, temp_log_array1, temp_log_array2, temp_log_array3, temp_log_array4
integer :: ncid_lw, dimID, varID, status, iGas
integer,dimension(:),allocatable :: temp1, temp2, temp3, temp4, &
temp_log_array1, temp_log_array2, temp_log_array3, temp_log_array4
character(len=264) :: lw_gas_props_file
integer,parameter :: max_strlen=256
#ifdef MPI
integer :: ierr
#endif
Expand Down Expand Up @@ -402,9 +390,6 @@ subroutine rrtmgp_lw_gas_optics_init(rrtmgp_root_dir, rrtmgp_lw_file_gas, rrtmgp
scaling_gas_upper, scale_by_complement_lower, scale_by_complement_upper, &
kminor_start_lower, kminor_start_upper, totplnk, planck_frac, rayl_lower, rayl_upper))

! Set initial permutation seed for McICA, initially set to number of G-points
ipsdlw0 = lw_gas_props%get_ngpt()

end subroutine rrtmgp_lw_gas_optics_init

! #########################################################################################
Expand Down Expand Up @@ -433,17 +418,17 @@ subroutine rrtmgp_lw_gas_optics_run(doLWrad, nCol, nLev, lw_gas_props, p_lay, p_
real(kind_phys), dimension(ncol), intent(in) :: &
skt ! Surface(skin) temperature (K)
type(ty_gas_concs),intent(in) :: &
gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr)
gas_concentrations ! RRTMGP DDT: trace gas concentrations (vmr)

! Output
character(len=*), intent(out) :: &
errmsg ! Error message
errmsg ! CCPP error message
integer, intent(out) :: &
errflg ! Error code
errflg ! CCPP error code
type(ty_optical_props_1scl),intent(out) :: &
lw_optical_props_clrsky ! RRTMGP DDT:
lw_optical_props_clrsky ! RRTMGP DDT: longwave clear-sky radiative properties
type(ty_source_func_lw),intent(out) :: &
sources ! RRTMGP DDT:
sources ! RRTMGP DDT: longwave source functions

! Initialize CCPP error handling variables
errmsg = ''
Expand Down
8 changes: 0 additions & 8 deletions physics/rrtmgp_lw_gas_optics.meta
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@
type = integer
intent = out
optional = F
[ipsdlw0]
standard_name = initial_permutation_seed_lw
long_name = initial seed for McICA LW
units = none
dimensions = ()
type = integer
intent = out
optional = F
[lw_gas_props]
standard_name = coefficients_for_lw_gas_optics
long_name = DDT containing spectral information for RRTMGP LW radiation scheme
Expand Down
4 changes: 2 additions & 2 deletions physics/rrtmgp_lw_rte.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ subroutine rrtmgp_lw_rte_run(doLWrad, nCol, nLev, p_lay, t_lay, p_lev, skt, lw_g
real(kind_phys), dimension(ncol), intent(in) :: &
skt ! Surface(skin) temperature (K)
type(ty_gas_optics_rrtmgp),intent(in) :: &
lw_gas_props ! DDT containing LW spectral information
lw_gas_props ! RRTMGP DDT: longwave spectral information
real(kind_phys), dimension(lw_gas_props%get_nband(),ncol), intent(in) :: &
sfc_emiss_byband ! Surface emissivity in each band
type(ty_source_func_lw),intent(in) :: &
sources
sources ! RRTMGP DDT: longwave source functions
type(ty_optical_props_1scl),intent(inout) :: &
lw_optical_props_clrsky ! RRTMGP DDT: longwave clear-sky radiative properties
type(ty_optical_props_1scl),intent(in) :: &
Expand Down
4 changes: 2 additions & 2 deletions physics/rrtmgp_sw_aerosol_optics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ subroutine rrtmgp_sw_aerosol_optics_run(doSWrad, nCol, nLev, nTracer, nDay, idxd
type(ty_optical_props_2str),intent(out) :: &
sw_optical_props_aerosol ! RRTMGP DDT: Longwave aerosol optical properties (tau)
integer, intent(out) :: &
errflg !
errflg ! CCPP error flag
character(len=*), intent(out) :: &
errmsg !
errmsg ! CCPP error message

! Local variables
real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), NF_AELW) :: &
Expand Down
Loading

0 comments on commit 8c46c34

Please sign in to comment.