Skip to content

Commit

Permalink
Merge pull request #1135 from jimmielin/hplin/tropopause_find
Browse files Browse the repository at this point in the history
cam6_4_037: Implementation of CCPP-ized tropopause_find with compatibility with current CAM
  • Loading branch information
jimmielin authored Oct 1, 2024
2 parents 5860b08 + d21b2d0 commit cf436f7
Show file tree
Hide file tree
Showing 23 changed files with 340 additions and 1,087 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
[submodule "atmos_phys"]
path = src/atmos_phys
url = https://github.com/ESCOMP/atmospheric_physics
fxtag = atmos_phys0_04_001
fxtag = atmos_phys0_05_000
fxrequired = AlwaysRequired
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics

Expand Down
1 change: 1 addition & 0 deletions bld/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,7 @@ sub write_filepath
print $fh "$camsrcdir/src/physics/cam\n";

#Add the CCPP'ized subdirectories
print $fh "$camsrcdir/src/atmos_phys/tropopause_find\n";
print $fh "$camsrcdir/src/atmos_phys/zhang_mcfarlane\n";
print $fh "$camsrcdir/src/atmos_phys/dry_adiabatic_adjust\n";

Expand Down
81 changes: 81 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
Tag name: cam6_4_037
Originator(s): jimmielin
Date: Sep 30, 2024
One-line Summary: Implementation of CCPP-compliant tropopause_find
Github PR URL: https://github.com/ESCOMP/CAM/pull/1135

Purpose of changes (include the issue number and title text for each relevant GitHub issue):
- CCPP-ization of tropopause_find: https://github.com/ESCOMP/CAM/issues/1121

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the boundary datasets: N/A

Describe any substantial timing or memory changes: N/A

Code reviewed by: nusbaume, cacraigucar

List all files eliminated: N/A

List all files added and what they do: N/A

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

Update atmos_phys external for tropopause_find (tag atmos_phys0_05_000):
M .gitmodules
M bld/configure
M src/atmos_phys

CAM interface code for compatibility with CCPP-ized tropopause_find while retaining all existing functionality b4b:
M src/physics/cam/tropopause.F90

Updates to subroutine calls for CCPP-ization, including only passing in active columns:
M src/chemistry/geoschem/chemistry.F90
M src/chemistry/mozart/chemistry.F90
M src/chemistry/utils/modal_aero_wateruptake.F90
M src/chemistry/utils/prescribed_strataero.F90
M src/chemistry/utils/prescribed_volcaero.F90
M src/physics/cam/aer_rad_props.F90
M src/physics/cam/aerosol_optics_cam.F90
M src/physics/cam/clubb_intr.F90
M src/physics/cam/micro_pumas_cam.F90
M src/physics/cam/nucleate_ice_cam.F90
M src/physics/cam/physpkg.F90
M src/physics/cam/radiation_data.F90
M src/physics/cam/rk_stratiform.F90
M src/physics/cam7/micro_pumas_cam.F90
M src/physics/cam7/physpkg.F90
M src/physics/camrt/radiation.F90
M src/physics/carma/models/meteor_impact/carma_model_mod.F90
M src/physics/carma/models/tholin/carma_model_mod.F90
M src/physics/rrtmg/radiation.F90
M src/physics/rrtmgp/radiation.F90


If there were any failures reported from running test_driver.sh on any test
platform, and checkin with these failures has been OK'd by the gatekeeper,
then copy the lines from the td.*.status files for the failed tests to the
appropriate machine below. All failed tests must be justified.

derecho/intel/aux_cam:

ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL)
- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856
note: the SMS test for FCSD_HCO may fail b4b occasionally and was resubmitted for this tag.

SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: PEND)
- pre-existing failures -- need fix in CLM external

derecho/nvhpc/aux_cam: ALL PASS

izumi/nag/aux_cam:

DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL)
- pre-existing failure - issue #670

izumi/gnu/aux_cam: ALL PASS

Summarize any changes to answers: bit-for-bit

===============================================================

Tag name: cam6_4_036
Expand Down
4 changes: 2 additions & 2 deletions src/chemistry/geoschem/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1823,7 +1823,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
use short_lived_species, only : get_short_lived_species_gc, set_short_lived_species_gc
use spmd_utils, only : masterproc
use time_manager, only : Get_Curr_Calday, Get_Curr_Date ! For computing SZA
use tropopause, only : Tropopause_findChemTrop, Tropopause_Find
use tropopause, only : Tropopause_findChemTrop
use wv_saturation, only : QSat
#if defined( MODAL_AERO )
use aero_model, only : aero_model_gasaerexch ! Aqueous chemistry and aerosol growth
Expand Down Expand Up @@ -2588,7 +2588,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
ENDDO

! Retrieve tropopause level
Trop_Lev = 0.0e+0_r8
Trop_Lev = 0
CALL Tropopause_FindChemTrop(state, Trop_Lev)
! Back out the pressure
Trop_P = 1000.0e+0_r8
Expand Down
10 changes: 7 additions & 3 deletions src/chemistry/mozart/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
use mo_gas_phase_chemdr, only : gas_phase_chemdr
use camsrfexch, only : cam_in_t, cam_out_t
use perf_mod, only : t_startf, t_stopf
use tropopause, only : tropopause_findChemTrop, tropopause_find
use tropopause, only : tropopause_findChemTrop, tropopause_find_cam
use mo_drydep, only : drydep_update
use mo_neu_wetdep, only : neu_wetdep_tend
use aerodep_flx, only : aerodep_flx_prescribed
Expand Down Expand Up @@ -1220,11 +1220,15 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
!-----------------------------------------------------------------------
! get tropopause level
!-----------------------------------------------------------------------
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
tropLev(:) = 0
tropLevChem(:) = 0
!REMOVECAM_END
if (.not.chem_use_chemtrop) then
call tropopause_find(state,tropLev)
call tropopause_find_cam(state,tropLev)
tropLevChem=tropLev
else
call tropopause_find(state,tropLev)
call tropopause_find_cam(state,tropLev)
call tropopause_findChemTrop(state, tropLevChem)
endif

Expand Down
7 changes: 5 additions & 2 deletions src/chemistry/utils/modal_aero_wateruptake.F90
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ subroutine modal_aero_wateruptake_dr(state, pbuf, list_idx_in, dgnumdry_m, dgnum

use time_manager, only: is_first_step
use cam_history, only: outfld, fieldname_len
use tropopause, only: tropopause_find, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE
use tropopause, only: tropopause_find_cam, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE
! Arguments
type(physics_state), target, intent(in) :: state ! Physics state variables
type(physics_buffer_desc), pointer :: pbuf(:) ! physics buffer
Expand Down Expand Up @@ -318,7 +318,10 @@ subroutine modal_aero_wateruptake_dr(state, pbuf, list_idx_in, dgnumdry_m, dgnum

if (modal_strat_sulfate) then
! get tropopause level
call tropopause_find(state, tropLev, primary=TROP_ALG_HYBSTOB, backup=TROP_ALG_CLIMATE)
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
tropLev(:) = 0
!REMOVECAM_END
call tropopause_find_cam(state, tropLev, primary=TROP_ALG_HYBSTOB, backup=TROP_ALG_CLIMATE)
endif

h2ommr => state%q(:,:,1)
Expand Down
3 changes: 3 additions & 0 deletions src/chemistry/utils/prescribed_strataero.F90
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ subroutine prescribed_strataero_adv( state, pbuf2d)
area(:ncol,:) = area_fact*area(:ncol,:)

! this definition of tropopause is consistent with what is used in chemistry
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
tropLev = 0
!REMOVECAM_END
call tropopause_findChemTrop(state(c), tropLev)

do i = 1,ncol
Expand Down
7 changes: 5 additions & 2 deletions src/chemistry/utils/prescribed_volcaero.F90
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ subroutine prescribed_volcaero_adv( state, pbuf2d)
use cam_history, only : outfld
use physconst, only : mwdry ! molecular weight dry air ~ kg/kmole
use physconst, only : boltz, gravit ! J/K/molecule
use tropopause, only : tropopause_find, TROP_ALG_TWMO, TROP_ALG_CLIMATE
use tropopause, only : tropopause_find_cam

use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_chunk

Expand Down Expand Up @@ -260,7 +260,10 @@ subroutine prescribed_volcaero_adv( state, pbuf2d)
call pbuf_get_field(pbuf_chnk, fields(1)%pbuf_ndx, data)
data(:ncol,:) = to_mmr(:ncol,:) * data(:ncol,:) ! mmr

call tropopause_find(state(c), tropLev, primary=TROP_ALG_TWMO, backup=TROP_ALG_CLIMATE)
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
tropLev(:) = 0
!REMOVECAM_END
call tropopause_find_cam(state(c), tropLev)
do i = 1,ncol
do k = 1,pver
! set to zero below tropopause
Expand Down
7 changes: 5 additions & 2 deletions src/physics/cam/aer_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ subroutine aer_rad_props_sw(list_idx, state, pbuf, nnite, idxnite, &
! Return bulk layer tau, omega, g, f for all spectral intervals.

use physics_buffer, only : physics_buffer_desc
use tropopause, only : tropopause_find
use tropopause, only : tropopause_find_cam
! Arguments
integer, intent(in) :: list_idx ! index of the climate or a diagnostic list
type(physics_state), intent(in), target :: state
Expand Down Expand Up @@ -229,7 +229,10 @@ subroutine aer_rad_props_sw(list_idx, state, pbuf, nnite, idxnite, &
tau_w_f(1:ncol,:,:) = 0._r8
end if

call tropopause_find(state, troplev)
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev = 0
!REMOVECAM_END
call tropopause_find_cam(state, troplev)

! Contributions from bulk aerosols.
do iaerosol = 1, numaerosols
Expand Down
7 changes: 5 additions & 2 deletions src/physics/cam/aerosol_optics_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,14 @@ subroutine aerosol_optics_cam_sw(list_idx, state, pbuf, nnite, idxnite, tauxar,

nullify(aero_optics)

call tropopause_findChemTrop(state, troplev)

lchnk = state%lchnk
ncol = state%ncol

!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
!REMOVECAM_END
call tropopause_findChemTrop(state, troplev)

mass(:ncol,:) = state%pdeldry(:ncol,:)*rga
air_density(:ncol,:) = state%pmid(:ncol,:)/(rair*state%t(:ncol,:))

Expand Down
3 changes: 3 additions & 0 deletions src/physics/cam/clubb_intr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, &

call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq)

!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
!REMOVECAM_END
call tropopause_findChemTrop(state, troplev)

! Initialize EDMF outputs
Expand Down
9 changes: 7 additions & 2 deletions src/physics/cam/micro_pumas_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ subroutine micro_pumas_cam_tend(state, ptend, dtime, pbuf)

use physics_buffer, only: pbuf_col_type_index
use subcol, only: subcol_field_avg
use tropopause, only: tropopause_find, TROP_ALG_CPP, TROP_ALG_NONE, NOTFOUND
use tropopause, only: tropopause_find_cam, TROP_ALG_CPP, TROP_ALG_NONE, NOTFOUND
use wv_saturation, only: qsat
use infnan, only: nan, assignment(=)

Expand Down Expand Up @@ -2164,7 +2164,12 @@ subroutine micro_pumas_cam_tend(state, ptend, dtime, pbuf)
cp_dt(:ncol) = 0._r8
cp_dz(:ncol) = 0._r8

call tropopause_find(state_loc, troplev, primary=TROP_ALG_CPP, backup=TROP_ALG_NONE, &
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
cp_z(:) = 0._r8
cp_t(:) = 0._r8
!REMOVECAM_END
call tropopause_find_cam(state_loc, troplev, primary=TROP_ALG_CPP, backup=TROP_ALG_NONE, &
tropZ=cp_z, tropT=cp_t)

do i = 1, ncol
Expand Down
3 changes: 3 additions & 0 deletions src/physics/cam/nucleate_ice_cam.F90
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ subroutine nucleate_ice_cam_calc( &
! Use the same criteria that is used in chemistry and in CLUBB (for cloud fraction)
! to determine whether to use tropospheric or stratospheric settings. Include the
! tropopause level so that the cold point tropopause will use the stratospheric values.
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
!REMOVECAM_END
call tropopause_findChemTrop(state, troplev)

if ((nucleate_ice_subgrid .eq. -1._r8) .or. (nucleate_ice_subgrid_strat .eq. -1._r8)) then
Expand Down
8 changes: 6 additions & 2 deletions src/physics/cam/radiation_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ subroutine rad_data_read(indata, phys_state, pbuf2d, cam_in, recno )
use camsrfexch, only: cam_in_t
use physics_buffer, only: pbuf_get_field, pbuf_old_tim_idx
use constituents, only: cnst_get_ind
use tropopause, only: tropopause_find, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE
use tropopause, only: tropopause_find_cam, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE

implicit none

Expand Down Expand Up @@ -984,7 +984,11 @@ subroutine rad_data_read(indata, phys_state, pbuf2d, cam_in, recno )
call pbuf_get_field(pbuf, qrsin_idx, qrsin)
call pbuf_get_field(pbuf, qrlin_idx, qrlin)

call tropopause_find(phys_state(c), troplev, tropP=tropp(:), primary=TROP_ALG_CLIMATE, &
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
tropp(:) = 0._r8
!REMOVECAM_END
call tropopause_find_cam(phys_state(c), troplev, tropP=tropp, primary=TROP_ALG_CLIMATE, &
backup=TROP_ALG_CLIMATE)

qrsin(:,:) = qrs_ptrs(c)%array(:,:)
Expand Down
7 changes: 5 additions & 2 deletions src/physics/cam/rk_stratiform.F90
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ subroutine rk_stratiform_tend( &
use cldwat, only: pcond
use pkg_cldoptics, only: cldefr
use phys_control, only: cam_physpkg_is
use tropopause, only: tropopause_find, TROP_ALG_TWMO, TROP_ALG_CLIMATE
use tropopause, only: tropopause_find_cam
use phys_grid, only: get_rlat_all_p
use physconst, only: pi

Expand Down Expand Up @@ -626,7 +626,10 @@ subroutine rk_stratiform_tend( &
end if

if ( do_psrhmin ) then
call tropopause_find(state, troplev, primary=TROP_ALG_TWMO, backup=TROP_ALG_CLIMATE)
!REMOVECAM - no longer need this when CAM is retired and pcols no longer exists
troplev(:) = 0
!REMOVECAM_END
call tropopause_find_cam(state, troplev)
call get_rlat_all_p(lchnk,ncol,rlat)
dlat(:ncol) = rlat(:ncol)*rad2deg
endif
Expand Down
Loading

0 comments on commit cf436f7

Please sign in to comment.