Skip to content

Commit

Permalink
cleanup solar forcing and gas_concs init; bugfix in rrtmgp_inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Sep 1, 2023
1 parent d5b5473 commit f57e027
Show file tree
Hide file tree
Showing 18 changed files with 262 additions and 745 deletions.
8 changes: 4 additions & 4 deletions src/physics/cam/aer_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module aer_rad_props
use physics_types, only: physics_state

use physics_buffer, only: physics_buffer_desc
use radconstants, only: nrh, nswbands, nlwbands, idx_sw_diag, ot_length
use radconstants, only: nswbands, nlwbands, idx_sw_diag
use phys_prop, only: nrh, ot_length
use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_aer_mmr, &
rad_cnst_get_aer_props
use wv_saturation, only: qsat
Expand Down Expand Up @@ -304,16 +305,15 @@ end subroutine aer_rad_props_sw

subroutine aer_rad_props_lw(list_idx, state, pbuf, odap_aer)

use radconstants, only: ot_length

use physics_buffer, only : pbuf_get_field, pbuf_get_index, physics_buffer_desc
! Purpose: Compute aerosol transmissions needed in absorptivity/
! emissivity calculations

! lw extinction is the same representation for all
! species. If this changes, this routine will need to do something
! similar to the sw with routines like get_hygro_lw_abs

use physics_buffer, only : pbuf_get_field, pbuf_get_index, physics_buffer_desc

! Arguments
integer, intent(in) :: list_idx ! index of the climate or a diagnostic list
type(physics_state), intent(in), target :: state
Expand Down
11 changes: 9 additions & 2 deletions src/physics/cam/phys_prop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module phys_prop

use shr_kind_mod, only: r8 => shr_kind_r8
use spmd_utils, only: masterproc
use radconstants, only: nrh, nlwbands, nswbands, idx_sw_diag
use radconstants, only: nlwbands, nswbands, idx_sw_diag
use ioFileMod, only: getfil
use cam_pio_utils, only: cam_pio_openfile
use pio, only: file_desc_t, var_desc_t, pio_get_var, pio_inq_varid, &
Expand All @@ -26,6 +26,7 @@ module phys_prop
save

integer, parameter, public :: ot_length = 32

public :: &
physprop_accum_unique_files, &! Make a list of the unique set of files that contain properties
! This is an initialization step that must be done before calling physprop_init
Expand Down Expand Up @@ -105,6 +106,10 @@ module phys_prop
! array.
character(len=256), allocatable :: uniquefilenames(:)

! Number of evenly spaced intervals in rh used in this module and in the aer_rad_props module
! for calculations of aerosol hygroscopic growth.
integer, parameter, public :: nrh = 1000

!================================================================================================
contains
!================================================================================================
Expand Down Expand Up @@ -1106,6 +1111,8 @@ subroutine bulk_props_init(physprop, nc_id)

type(var_desc_T) :: vid

! ***N.B.*** RRTMGP hasn't set the value of idx_sw_diag when this routine is
! called. The debug option will need to be modified for RRTMGP.
logical :: debug = .true.

character(len=*), parameter :: subname = 'bulk_props_init'
Expand Down Expand Up @@ -1134,7 +1141,7 @@ subroutine bulk_props_init(physprop, nc_id)
ierr = pio_get_var(nc_id, vid, physprop%num_to_mass_aer)

! Output select data to log file
if (debug .and. masterproc) then
if (debug .and. masterproc .and. idx_sw_diag > 0) then
if (trim(physprop%aername) == 'SULFATE') then
write(iulog, '(2x, a)') '_______ hygroscopic growth in visible band _______'
call aer_optics_log_rh('SO4', physprop%sw_hygro_ext(:,idx_sw_diag), &
Expand Down
4 changes: 2 additions & 2 deletions src/physics/cam/rad_constituents.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ module rad_constituents
use physics_types, only: physics_state
use phys_control, only: use_simple_phys
use constituents, only: cnst_get_ind
use radconstants, only: nradgas, rad_gas_index, ot_length
use radconstants, only: nradgas, rad_gas_index
use phys_prop, only: physprop_accum_unique_files, physprop_init, &
physprop_get_id
physprop_get_id, ot_length
use cam_history, only: addfld, fieldname_len, outfld, horiz_only
use physics_buffer, only: physics_buffer_desc, pbuf_get_field, pbuf_get_index

Expand Down
17 changes: 0 additions & 17 deletions src/physics/camrt/radconstants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ module radconstants
public :: radconstants_init
public :: rad_gas_index

! optics files specify a type. What length is it?
integer, parameter, public :: ot_length = 32

! SHORTWAVE DATA

! number of shorwave spectral intervals
Expand All @@ -40,20 +37,6 @@ module radconstants

integer, parameter, public :: idx_lw_diag = 2 ! index to (H20 window) LW band


! Number of evenly spaced intervals in rh
! The globality of this mesh may not be necessary
! Perhaps it could be specific to the aerosol
! But it is difficult to see how refined it must be
! for lookup. This value was found to be sufficient
! for Sulfate and probably necessary to resolve the
! high variation near rh = 1. Alternative methods
! were found to be too slow.
! Optimal approach would be for cam to specify size of aerosol
! based on each aerosol's characteristics. Radiation
! should know nothing about hygroscopic growth!
integer, parameter, public :: nrh = 1000

! LONGWAVE DATA

! number of lw bands
Expand Down
2 changes: 1 addition & 1 deletion src/physics/rrtmg/cloud_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module cloud_rad_props
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag
use radconstants, only: nswbands, nlwbands, idx_sw_diag, idx_lw_diag
use cam_abortutils, only: endrun
use rad_constituents, only: iceopticsfile, liqopticsfile
use oldcloud, only: oldcloud_lw, old_liq_get_rad_props_lw, old_ice_get_rad_props_lw, oldcloud_init
Expand Down
2 changes: 1 addition & 1 deletion src/physics/rrtmg/ebert_curry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ebert_curry
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag, get_sw_spectral_boundaries
use radconstants, only: nswbands, nlwbands, idx_sw_diag, idx_lw_diag, get_sw_spectral_boundaries
use cam_abortutils, only: endrun
use cam_history, only: outfld

Expand Down
2 changes: 1 addition & 1 deletion src/physics/rrtmg/oldcloud.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module oldcloud
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag, get_sw_spectral_boundaries
use radconstants, only: nswbands, nlwbands, idx_sw_diag, idx_lw_diag, get_sw_spectral_boundaries
use cam_abortutils, only: endrun
use cam_history, only: outfld
use rad_constituents, only: iceopticsfile, liqopticsfile
Expand Down
16 changes: 0 additions & 16 deletions src/physics/rrtmg/radconstants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,6 @@ module radconstants

integer, parameter, public :: rrtmg_sw_cloudsim_band = 9 ! rrtmg band for .67 micron

! Number of evenly spaced intervals in rh
! The globality of this mesh may not be necessary
! Perhaps it could be specific to the aerosol
! But it is difficult to see how refined it must be
! for lookup. This value was found to be sufficient
! for Sulfate and probably necessary to resolve the
! high variation near rh = 1. Alternative methods
! were found to be too slow.
! Optimal approach would be for cam to specify size of aerosol
! based on each aerosol's characteristics. Radiation
! should know nothing about hygroscopic growth!
integer, parameter, public :: nrh = 1000

! LONGWAVE DATA

! These are indices to the band for diagnostic output
Expand Down Expand Up @@ -123,9 +110,6 @@ module radconstants
real(r8), public, parameter :: minmmr(nradgas) &
= epsilon(1._r8)

! Length of "optics type" string specified in optics files.
integer, parameter, public :: ot_length = 32

public :: rad_gas_index

public :: get_number_sw_bands, &
Expand Down
2 changes: 1 addition & 1 deletion src/physics/rrtmg/slingo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module slingo
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag, get_sw_spectral_boundaries
use radconstants, only: nswbands, nlwbands, idx_sw_diag, idx_lw_diag, get_sw_spectral_boundaries
use cam_abortutils, only: endrun
use cam_history, only: outfld

Expand Down
2 changes: 1 addition & 1 deletion src/physics/rrtmgp/cloud_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module cloud_rad_props
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag
use radconstants, only: nswbands, nlwbands, idx_sw_diag
use cam_abortutils, only: endrun
use rad_constituents, only: iceopticsfile, liqopticsfile
use oldcloud, only: oldcloud_lw, old_liq_get_rad_props_lw, old_ice_get_rad_props_lw, oldcloud_init
Expand Down
15 changes: 2 additions & 13 deletions src/physics/rrtmgp/ebert_curry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module ebert_curry
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag, get_sw_spectral_boundaries
use radconstants, only: nswbands, nlwbands, get_sw_spectral_boundaries
use cam_abortutils, only: endrun
use cam_history, only: outfld

Expand Down Expand Up @@ -143,10 +143,7 @@ subroutine cloud_rad_props_get_sw(state, pbuf, &
tau_w_g(:,1:ncol,:) = 0._r8
tau_w_f(:,1:ncol,:) = 0._r8


call ec_ice_optics_sw (state, pbuf, tau, tau_w, tau_w_g, tau_w_f, oldicewp=.true.)
! call outfld ('CI_OD_SW_OLD', ice_tau(idx_sw_diag,:,:), pcols, lchnk)


end subroutine cloud_rad_props_get_sw
!==============================================================================
Expand Down Expand Up @@ -182,7 +179,6 @@ subroutine cloud_rad_props_get_lw(state, pbuf, cld_abs_od, diagnosticindex, oldl
cld_abs_od = 0._r8

call ec_ice_get_rad_props_lw(state, pbuf, cld_abs_od, oldicewp=.true.)
!call outfld('CI_OD_LW_OLD', ice_tau_abs_od(idx_lw_diag ,:,:), pcols, lchnk)

end subroutine cloud_rad_props_get_lw

Expand Down Expand Up @@ -390,18 +386,11 @@ subroutine ec_ice_get_rad_props_lw(state, pbuf, abs_od, oldicewp)
cldtau(i,k) = kabs*cwp(i,k)
end do
end do
!

do lwband = 1,nlwbands
abs_od(lwband,1:ncol,1:pver)=cldtau(1:ncol,1:pver)
enddo

!if(oldicewp) then
! call outfld('CIWPTH_OLD',cicewp(:,:)/1000,pcols,lchnk)
!else
! call outfld('CIWPTH_OLD',iciwpth(:,:),pcols,lchnk)
!endif
!call outfld('CI_OD_LW_OLD',cldtau(:,:),pcols,lchnk)

end subroutine ec_ice_get_rad_props_lw
!==============================================================================

Expand Down
8 changes: 1 addition & 7 deletions src/physics/rrtmgp/oldcloud.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module oldcloud
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field
use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag, get_sw_spectral_boundaries
use radconstants, only: nswbands, nlwbands, get_sw_spectral_boundaries
use cam_abortutils, only: endrun
use cam_history, only: outfld
use rad_constituents, only: iceopticsfile, liqopticsfile
Expand Down Expand Up @@ -226,12 +226,6 @@ subroutine old_liquid_optics_sw(state, pbuf, liq_tau, liq_tau_w, liq_tau_w_g, li
end do ! End do k=1,pver
end do ! nswbands

!call outfld('CL_OD_SW_OLD',liq_tau(idx_sw_diag,:,:), pcols, lchnk)
!call outfld('REL_OLD',rel(:,:), pcols, lchnk)
!call outfld('CLWPTH_OLD',cliqwp(:,:), pcols, lchnk)
!call outfld('KEXT_OLD',kext(:,:), pcols, lchnk)


end subroutine old_liquid_optics_sw
!==============================================================================

Expand Down
Loading

0 comments on commit f57e027

Please sign in to comment.