Skip to content

Commit

Permalink
remove src dependencies on SPCAM
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-eaton committed Dec 31, 2024
1 parent 4ed8390 commit 8bf2946
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 317 deletions.
38 changes: 26 additions & 12 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ Describe any substantial timing or memory changes:
Code reviewed by:

List all files eliminated:
src/physics/spcam/*
src/physics/spcam/crm/*
src/physics/spcam/crm/ADV_MPDATA/*
src/physics/spcam/crm/CLUBB/*
src/physics/spcam/crm/MICRO_M2005/*
src/physics/spcam/crm/MICRO_SAM1MOM/*
src/physics/spcam/crm/SGS_CLUBBkvhkvm/*
src/physics/spcam/crm/SGS_TKE/*
src/physics/spcam/ecpp/*
src/physics/cam/spcam_drivers.F90
src/physics/spcam/*
src/physics/spcam/crm/*
src/physics/spcam/crm/ADV_MPDATA/*
src/physics/spcam/crm/CLUBB/*
src/physics/spcam/crm/MICRO_M2005/*
src/physics/spcam/crm/MICRO_SAM1MOM/*
src/physics/spcam/crm/SGS_CLUBBkvhkvm/*
src/physics/spcam/crm/SGS_TKE/*
src/physics/spcam/ecpp/*
. remove all SPCAM source and drivers


List all files added and what they do:
List all files added and what they do: none

List all existing files that have been modified, and describe the changes:

Expand Down Expand Up @@ -86,7 +87,20 @@ cime_config/config_pes.xml
cime_config/testdefs/testlist_cam.xml
. remove tests for SPCAM*


src/chemistry/modal_aero/aero_model.F90
src/physics/cam/cloud_diagnostics.F90
src/physics/cam/cloud_fraction.F90
src/physics/cam/conv_water.F90
src/physics/cam/convect_deep.F90
src/physics/cam/convect_shallow.F90
src/physics/cam/diffusion_solver.F90
src/physics/cam/microp_driver.F90
src/physics/cam/ndrop.F90
src/physics/cam/phys_control.F90
src/physics/cam/physpkg.F90
src/physics/cam/pkg_cldoptics.F90
src/physics/cam/vertical_diffusion.F90
. remove dependecies on SPCAM_sam1mom and SPCAM_m2005


If there were any failures reported from running test_driver.sh on any test
Expand Down
44 changes: 16 additions & 28 deletions src/chemistry/modal_aero/aero_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1006,15 +1006,13 @@ subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_
real(r8), pointer :: fldcw(:,:)
real(r8), pointer :: sulfeq(:,:,:)

logical :: is_spcam_m2005
!
! ... initialize nh3
!
if ( nh3_ndx > 0 ) then
nh3_beg = vmr(1:ncol,:,nh3_ndx)
end if
!
is_spcam_m2005 = cam_physpkg_is('spcam_m2005')

call pbuf_get_field(pbuf, dgnum_idx, dgnum)
call pbuf_get_field(pbuf, dgnumwet_idx, dgnumwet )
Expand Down Expand Up @@ -1046,14 +1044,13 @@ subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_
!
call qqcw2vmr( lchnk, vmrcw, mbar, ncol, loffset, pbuf )

if (.not. is_spcam_m2005) then ! regular CAM
dvmrdt(:ncol,:,:) = vmr(:ncol,:,:)
dvmrcwdt(:ncol,:,:) = vmrcw(:ncol,:,:)
dvmrdt(:ncol,:,:) = vmr(:ncol,:,:)
dvmrcwdt(:ncol,:,:) = vmrcw(:ncol,:,:)

! aqueous chemistry ...

if( has_sox ) then
call setsox( &
if( has_sox ) then
call setsox( &
ncol, &
lchnk, &
loffset, &
Expand All @@ -1076,21 +1073,21 @@ subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_
aqso4_o3 &
)

do n = 1, ntot_amode
l = lptr_so4_cw_amode(n)
if (l > 0) then
call outfld( trim(cnst_name_cw(l))//'AQSO4', aqso4(:ncol,n), ncol, lchnk)
call outfld( trim(cnst_name_cw(l))//'AQH2SO4', aqh2so4(:ncol,n), ncol, lchnk)
end if
end do
do n = 1, ntot_amode
l = lptr_so4_cw_amode(n)
if (l > 0) then
call outfld( trim(cnst_name_cw(l))//'AQSO4', aqso4(:ncol,n), ncol, lchnk)
call outfld( trim(cnst_name_cw(l))//'AQH2SO4', aqh2so4(:ncol,n), ncol, lchnk)
end if
end do

call outfld( 'AQSO4_H2O2', aqso4_h2o2(:ncol), ncol, lchnk)
call outfld( 'AQSO4_O3', aqso4_o3(:ncol), ncol, lchnk)
call outfld( 'XPH_LWC', xphlwc(:ncol,:), ncol, lchnk )
call outfld( 'AQSO4_H2O2', aqso4_h2o2(:ncol), ncol, lchnk)
call outfld( 'AQSO4_O3', aqso4_o3(:ncol), ncol, lchnk)
call outfld( 'XPH_LWC', xphlwc(:ncol,:), ncol, lchnk )

endif
endif

! Tendency due to aqueous chemistry
! Tendency due to aqueous chemistry
dvmrdt = (vmr - dvmrdt) / delt
dvmrcwdt = (vmrcw - dvmrcwdt) / delt
do m = 1, gas_pcnst
Expand All @@ -1102,15 +1099,6 @@ subroutine aero_model_gasaerexch( loffset, ncol, lchnk, troplev, delt, reaction_
call outfld( name, wrk(:ncol), ncol, lchnk )
enddo

else if (is_spcam_m2005) then ! SPCAM ECPP
! when ECPP is used, aqueous chemistry is done in ECPP,
! and not updated here.
! Minghuai Wang, 2010-02 ([email protected])
!
dvmrdt = 0.0_r8
dvmrcwdt = 0.0_r8
endif

! do gas-aerosol exchange (h2so4, msa, nh3 condensation)

if (ndx_h2so4 > 0) then
Expand Down
39 changes: 13 additions & 26 deletions src/physics/cam/cloud_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module cloud_diagnostics
integer :: dei_idx, mu_idx, lambda_idx, iciwp_idx, iclwp_idx, cld_idx ! index into pbuf for cloud fields
integer :: ixcldice, ixcldliq, rei_idx, rel_idx

logical :: do_cld_diag, mg_clouds, rk_clouds, camrt_rad, spcam_m2005_clouds, spcam_sam1mom_clouds
logical :: do_cld_diag, camrt_rad
logical :: one_mom_clouds, two_mom_clouds

integer :: cicewp_idx = -1
Expand All @@ -45,8 +45,6 @@ module cloud_diagnostics
! Index fields for precipitation efficiency.
integer :: acpr_idx, acgcme_idx, acnum_idx

logical :: use_spcam

contains

!===============================================================================
Expand All @@ -59,12 +57,8 @@ subroutine cloud_diagnostics_register

call phys_getopts(radiation_scheme_out=rad_pkg,microp_scheme_out=microp_pgk)
camrt_rad = rad_pkg .eq. 'camrt'
rk_clouds = microp_pgk == 'RK'
mg_clouds = microp_pgk == 'MG'
spcam_m2005_clouds = microp_pgk == 'SPCAM_m2005'
spcam_sam1mom_clouds = microp_pgk == 'SPCAM_sam1mom'
one_mom_clouds = (rk_clouds .or. spcam_sam1mom_clouds)
two_mom_clouds = (mg_clouds .or. spcam_m2005_clouds)
one_mom_clouds = microp_pgk == 'RK'
two_mom_clouds = microp_pgk == 'MG'

if (one_mom_clouds) then
call pbuf_add_field('CLDEMIS','physpkg', dtype_r8,(/pcols,pver/), cldemis_idx)
Expand Down Expand Up @@ -110,8 +104,6 @@ subroutine cloud_diagnostics_init(pbuf2d)
! grid box total cloud ice water mixing ratio (kg/kg)
gb_totcldicemr_idx = pbuf_get_index('GB_TOTCLDICEMR')

call phys_getopts(use_spcam_out=use_spcam)

if (two_mom_clouds) then

! initialize to zero
Expand Down Expand Up @@ -152,10 +144,10 @@ subroutine cloud_diagnostics_init(pbuf2d)

if (.not.do_cld_diag) return

if (rk_clouds) then
if (one_mom_clouds) then
wpunits = 'gram/m2'
sampling_seq='rad_lwsw'
else if (two_mom_clouds .or. spcam_sam1mom_clouds) then
else if (two_mom_clouds) then
wpunits = 'kg/m2'
sampling_seq=''
end if
Expand Down Expand Up @@ -206,7 +198,7 @@ subroutine cloud_diagnostics_init(pbuf2d)
call add_default ('TGCLDLWP', 1, ' ')
call add_default ('TGCLDIWP', 1, ' ')
call add_default ('TGCLDCWP', 1, ' ')
if(rk_clouds) then
if(one_mom_clouds) then
if (camrt_rad) then
call add_default ('EMIS', 1, ' ')
else
Expand Down Expand Up @@ -452,12 +444,10 @@ subroutine cloud_diagnostics_calc(state, pbuf)
! Determine parameters for maximum/random overlap
call cldovrlap(lchnk, ncol, state%pint, cld, nmxrgn, pmxrgn)

if(.not. use_spcam) then ! in spcam, these diagnostics are calcluated in crm_physics.F90
! Cloud cover diagnostics (done in radiation_tend for camrt)
! Cloud cover diagnostics (done in radiation_tend for camrt)
if (.not.camrt_rad) then
call cloud_cover_diags_out(lchnk, ncol, cld, state%pmid, nmxrgn, pmxrgn )
endif
end if

tgicewp(:ncol) = 0._r8
tgliqwp(:ncol) = 0._r8
Expand Down Expand Up @@ -503,15 +493,12 @@ subroutine cloud_diagnostics_calc(state, pbuf)

endif

if (.not. use_spcam) then
! for spcam, these are diagnostics in crm_physics.F90
call outfld('GCLDLWP' ,gwp , pcols,lchnk)
call outfld('TGCLDCWP',tgwp , pcols,lchnk)
call outfld('TGCLDLWP',tgliqwp, pcols,lchnk)
call outfld('TGCLDIWP',tgicewp, pcols,lchnk)
call outfld('ICLDTWP' ,cwp , pcols,lchnk)
call outfld('ICLDIWP' ,cicewp , pcols,lchnk)
endif
call outfld('GCLDLWP' ,gwp , pcols,lchnk)
call outfld('TGCLDCWP',tgwp , pcols,lchnk)
call outfld('TGCLDLWP',tgliqwp, pcols,lchnk)
call outfld('TGCLDIWP',tgicewp, pcols,lchnk)
call outfld('ICLDTWP' ,cwp , pcols,lchnk)
call outfld('ICLDIWP' ,cicewp , pcols,lchnk)

! Compute total preciptable water in column (in mm)
tpw(:ncol) = 0.0_r8
Expand Down
7 changes: 3 additions & 4 deletions src/physics/cam/cloud_fraction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ subroutine cldfrc_init
macrop_scheme_out = macrop_scheme )

! Limit CAM5 cloud physics to below top cloud level.
if ( .not. (macrop_scheme == "rk" .or. macrop_scheme == "SPCAM_sam1mom")) top_lev = trop_cloud_top_lev
if ( .not. macrop_scheme == "rk") top_lev = trop_cloud_top_lev

! Turn off inversion_cld if any UW PBL scheme is being used
if ( (eddy_scheme .eq. 'diag_TKE' ) .or. (shallow_scheme .eq. 'UW' ) .or.&
(shallow_scheme .eq. 'SPCAM_m2005') ) then
if ( eddy_scheme .eq. 'diag_TKE' .or. shallow_scheme .eq. 'UW' ) then
inversion_cld_off = .true.
else
inversion_cld_off = .false.
Expand All @@ -218,7 +217,7 @@ subroutine cldfrc_init
if ( masterproc ) then
write(iulog,*)'tuning parameters cldfrc_init: inversion_cld_off',inversion_cld_off
write(iulog,*)'tuning parameters cldfrc_init: dp1',dp1,'dp2',dp2,'sh1',sh1,'sh2',sh2
if (shallow_scheme .ne. 'UW' .or. shallow_scheme .eq. 'SPCAM_m2005' ) then
if (shallow_scheme .ne. 'UW') then
write(iulog,*)'tuning parameters cldfrc_init: rhminl',rhminl,'rhminl_adj_land',rhminl_adj_land, &
'rhminh',rhminh,'premit',premit,'premib',premib
write(iulog,*)'tuning parameters cldfrc_init: iceopt',iceopt,'icecrit',icecrit
Expand Down
2 changes: 1 addition & 1 deletion src/physics/cam/conv_water.F90
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ subroutine conv_water_4rad(state, pbuf)

! Select radiation constants (effective radii) for emissivity averaging.

if( microp_scheme == 'RK' .or. microp_scheme == 'SPCAM_sam1mom') then
if( microp_scheme == 'RK') then
kabsi = 0.005_r8 + 1._r8/rei(i,k)
else
kabsi = 0.005_r8 + 1._r8/min(max(13._r8,rei(i,k)),130._r8)
Expand Down
3 changes: 0 additions & 3 deletions src/physics/cam/convect_deep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ subroutine convect_deep_init(pref_edge)
call zm_conv_init(pref_edge)
case('UNICON')
if (masterproc) write(iulog,*)'convect_deep: deep convection done by UNICON'
case('SPCAM')
if (masterproc) write(iulog,*)'convect_deep: deep convection done by SPCAM'
return
case default
if (masterproc) write(iulog,*)'WARNING: convect_deep: no deep convection scheme. May fail.'
end select
Expand Down
6 changes: 0 additions & 6 deletions src/physics/cam/convect_shallow.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ subroutine convect_shallow_register

call phys_getopts( shallow_scheme_out = shallow_scheme, microp_scheme_out = microp_scheme)

! SPCAM registers its own fields
if (shallow_scheme == 'SPCAM') return

call pbuf_add_field('ICWMRSH', 'physpkg' ,dtype_r8,(/pcols,pver/), icwmrsh_idx )
call pbuf_add_field('RPRDSH', 'physpkg' ,dtype_r8,(/pcols,pver/), rprdsh_idx )
call pbuf_add_field('RPRDTOT', 'physpkg' ,dtype_r8,(/pcols,pver/), rprdtot_idx )
Expand Down Expand Up @@ -165,9 +162,6 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
integer k
character(len=16) :: eddy_scheme

! SPCAM does its own convection
if (shallow_scheme == 'SPCAM') return

! ------------------------------------------------- !
! Variables for detailed abalysis of UW-ShCu scheme !
! ------------------------------------------------- !
Expand Down
Loading

0 comments on commit 8bf2946

Please sign in to comment.