From 22d781423baf9c36f4e4286474b056c99e8a0d35 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 23 May 2023 14:48:38 -0600 Subject: [PATCH 01/23] Add code mods needed to work with the latest version of the 'atmospheric_physics' external. --- Externals_CAM.cfg | 4 +- src/physics/cam/ref_pres.F90 | 8 +- src/physics/simple/held_suarez_cam.F90 | 37 ++-- src/physics/simple/kessler_cam.F90 | 234 +++++++++++++----------- src/physics/simple/physpkg.F90 | 4 +- src/utils/ccpp_constituent_prop_mod.F90 | 34 ++++ 6 files changed, 193 insertions(+), 128 deletions(-) create mode 100644 src/utils/ccpp_constituent_prop_mod.F90 diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 0770c68211..2e26984125 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -55,9 +55,9 @@ tag = ALI_ARMS_v1.0.1 required = True [atmos_phys] -tag = atmos_phys0_00_011 +branch = updated_standard_names protocol = git -repo_url = https://github.com/NCAR/atmospheric_physics +repo_url = https://github.com/nusbaume/atmospheric_physics required = True local_path = src/atmos_phys diff --git a/src/physics/cam/ref_pres.F90 b/src/physics/cam/ref_pres.F90 index 742652db11..f0d5994b81 100644 --- a/src/physics/cam/ref_pres.F90 +++ b/src/physics/cam/ref_pres.F90 @@ -1,14 +1,14 @@ module ref_pres !-------------------------------------------------------------------------- -! +! ! Provides access to reference pressures for use by the physics ! parameterizations. The pressures are provided by the dynamical core ! since it determines the grid used by the physics. -! +! ! Note that the init method for this module is called before the init ! method in physpkg; therefore, most physics modules can use these ! reference pressures during their init phases. -! +! !-------------------------------------------------------------------------- use shr_kind_mod, only: r8=>shr_kind_r8 @@ -25,7 +25,7 @@ module ref_pres ! surface pressure ('eta' coordinate) real(r8), protected :: ptop_ref ! Top of model -real(r8), protected :: psurf_ref ! Surface pressure +real(r8), protected :: psurf_ref ! reference pressure ! Number of top levels using pure pressure representation integer, protected :: num_pr_lev diff --git a/src/physics/simple/held_suarez_cam.F90 b/src/physics/simple/held_suarez_cam.F90 index 68df115d18..52b241c337 100644 --- a/src/physics/simple/held_suarez_cam.F90 +++ b/src/physics/simple/held_suarez_cam.F90 @@ -1,13 +1,13 @@ module held_suarez_cam - !----------------------------------------------------------------------- - ! + !----------------------------------------------------------------------- + ! ! Purpose: Implement idealized Held-Suarez forcings ! Held, I. M., and M. J. Suarez, 1994: 'A proposal for the ! intercomparison of the dynamical cores of atmospheric general ! circulation models.' ! Bulletin of the Amer. Meteor. Soc., vol. 75, pp. 1825-1830. - ! + ! !----------------------------------------------------------------------- use shr_kind_mod, only: r8 => shr_kind_r8 @@ -31,24 +31,22 @@ module held_suarez_cam real(r8), parameter :: ka = 1._r8/(86400._r8 * efolda) ! 1./efolding_time for temperature diss. real(r8), parameter :: ks = 1._r8/(86400._r8 * efolds) -!======================================================================= +!======================================================================= contains -!======================================================================= +!======================================================================= - subroutine held_suarez_init(pbuf2d) + subroutine held_suarez_init() use physics_buffer, only: physics_buffer_desc use cam_history, only: addfld, add_default - use physconst, only: cappa, cpair - use ref_pres, only: pref_mid_norm, psurf_ref + use ref_pres, only: psurf_ref use held_suarez_1994, only: held_suarez_1994_init - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - character(len=512) :: errmsg - integer :: errflg + ! Local variables + character(len=512) :: errmsg + integer :: errflg ! Set model constant values - call held_suarez_1994_init(pver, cappa, cpair, psurf_ref, pref_mid_norm, errmsg, errflg) + call held_suarez_1994_init(psurf_ref, errmsg, errflg) ! This field is added by radiation when full physics is used call addfld('QRS', (/ 'lev' /), 'A', 'K/s', & @@ -57,7 +55,8 @@ subroutine held_suarez_init(pbuf2d) end subroutine held_suarez_init subroutine held_suarez_tend(state, ptend, ztodt) - use air_composition, only: cpairv + use air_composition, only: cappav, cpairv + use ref_pres, only: pref_mid_norm use phys_grid, only: get_rlat_all_p use physics_types, only: physics_state, physics_ptend use physics_types, only: physics_ptend_init @@ -84,8 +83,9 @@ subroutine held_suarez_tend(state, ptend, ztodt) real(r8) :: pmid(pcols,pver) ! mid-point pressure integer :: i, k ! Longitude, level indices - character(len=512) :: errmsg - integer :: errflg + character(len=64) :: scheme_name ! CCPP-required variables (not used in CAM) + character(len=512) :: errmsg + integer :: errflg ! !----------------------------------------------------------------------- @@ -104,8 +104,9 @@ subroutine held_suarez_tend(state, ptend, ztodt) ! initialize individual parameterization tendencies call physics_ptend_init(ptend, state%psetcols, 'held_suarez', ls=.true., lu=.true., lv=.true.) - call held_suarez_1994_run(pver, ncol, clat, state%pmid, & - state%u, state%v, state%t, ptend%u, ptend%v, ptend%s, errmsg, errflg) + call held_suarez_1994_run(pver, ncol, pref_mid_norm, clat, cappav(:,:,lchnk), cpairv(:,:,lchnk), & + state%pmid, state%u, state%v, state%t, ptend%u, ptend%v, ptend%s, & + scheme_name, errmsg, errflg) ! Note, we assume that there are no subcolumns in simple physics pmid(:ncol,:) = ptend%s(:ncol, :)/cpairv(:ncol,:,lchnk) diff --git a/src/physics/simple/kessler_cam.F90 b/src/physics/simple/kessler_cam.F90 index d6319962f1..c70124aa48 100644 --- a/src/physics/simple/kessler_cam.F90 +++ b/src/physics/simple/kessler_cam.F90 @@ -39,22 +39,26 @@ end subroutine kessler_register !======================================================================================== - subroutine kessler_cam_init(pbuf2d) + subroutine kessler_cam_init() - use physconst, only: cpair, latvap,pstd, rair, rhoh2o + use physconst, only: latvap, rhoh2o + use ref_pres, only: psurf_ref use constituents, only: cnst_name, cnst_longname, bpcnst, apcnst - use cam_history, only: addfld, add_default, horiz_only + use cam_history, only: addfld, add_default use cam_abortutils, only: endrun - use state_converters, only: pres_to_density_dry_init - use kessler, only: kessler_init - use state_converters, only: calc_exner_init + use kessler, only: kessler_init - integer :: errflg - character(len=512) :: errmsg + ! + !---------------------------Local workspace----------------------------- + ! + integer :: errflg + character(len=512) :: errmsg - type(physics_buffer_desc), pointer :: pbuf2d(:,:) + ! + !----------------------------------------------------------------------- + ! errflg = 0 @@ -68,52 +72,43 @@ subroutine kessler_cam_init(pbuf2d) call add_default(cnst_name(ixrain), 1, ' ') ! Initialize Kessler with CAM physical constants - - if (errflg == 0) then - call kessler_init(cpair, latvap, pstd, rair, rhoh2o, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_cam_init error: Error returned from kessler_init: '//trim(errmsg)) - end if - end if - if (errflg == 0) then - call pres_to_density_dry_init(cpair, rair, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_cam_init error: Error returned from pres_to_density_dry_init: '//trim(errmsg)) - end if - end if - if (errflg == 0) then - call calc_exner_init(errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_cam_init error: Error returned from calc_exner_init: '//trim(errmsg)) - end if - end if + call kessler_init(latvap, psurf_ref, rhoh2o, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_cam_init error: Error returned from kessler_init: '//trim(errmsg)) + end if end subroutine kessler_cam_init !======================================================================================== subroutine kessler_tend(state, ptend, ztodt, pbuf) - !----------------------------------------------------------------------- - ! + !----------------------------------------------------------------------- + ! ! Purpose: Run Kessler physics (see kessler.F90) - ! + ! !----------------------------------------------------------------------- - use shr_kind_mod, only: SHR_KIND_CM - use physconst, only: cpair, rair, zvir - use physics_types, only: physics_state, physics_ptend - use physics_types, only: physics_ptend_init - use constituents, only: pcnst, cnst_name, cnst_type + use shr_kind_mod, only: SHR_KIND_CM + use ref_pres, only: psurf_ref + use physconst, only: rh2o + use air_composition, only: cpairv, rairv + use physics_types, only: physics_state, physics_ptend + use physics_types, only: physics_ptend_init + use constituents, only: pcnst, cnst_name, cnst_type use kessler, only: kessler_run - use state_converters, only: wet_to_dry_run - use state_converters, only: dry_to_wet_run - use state_converters, only: pres_to_density_dry_run + use state_converters, only: wet_to_dry_water_vapor_run + use state_converters, only: wet_to_dry_cloud_liquid_water_run + use state_converters, only: wet_to_dry_rain_run + use state_converters, only: dry_to_wet_water_vapor_run + use state_converters, only: dry_to_wet_cloud_liquid_water_run + use state_converters, only: dry_to_wet_rain_run use state_converters, only: temp_to_potential_temp_run use state_converters, only: calc_exner_run + use state_converters, only: calc_dry_air_ideal_gas_density_run use state_converters, only: potential_temp_to_temp_run - use cam_abortutils, only: endrun - use cam_history, only: outfld + use cam_abortutils, only: endrun + use cam_history, only: outfld ! arguments @@ -122,28 +117,36 @@ subroutine kessler_tend(state, ptend, ztodt, pbuf) type(physics_ptend), intent(out) :: ptend ! Package tendencies type(physics_buffer_desc), pointer :: pbuf(:) + ! !---------------------------Local workspace----------------------------- ! - integer :: lchnk ! chunk identifier - integer :: ncol ! number of atmospheric columns + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns integer :: lyr_surf integer :: lyr_toa - real(r8) :: rho(pcols,pver) ! Dry air density - real(r8) :: pk(pcols,pver) ! exner func. - real(r8) :: th(pcols,pver) ! Potential temp. - real(r8) :: temp(pcols,pver) ! temperature - real(r8) :: qv(pcols,pver) ! Water vapor - real(r8) :: qc(pcols,pver) ! Cloud water - real(r8) :: qr(pcols,pver) ! Rain water - integer :: k,rk ! vert. indices - logical :: lq(pcnst) ! Calc tendencies? - character(len=SHR_KIND_CM) :: errmsg + real(r8) :: zvirv(pcols,pver) ! ratio of water vapor to dry air constants - 1 + real(r8) :: rho(pcols,pver) ! Dry air density + real(r8) :: pk(pcols,pver) ! exner func. + real(r8) :: th(pcols,pver) ! Potential temp. + real(r8) :: temp(pcols,pver) ! temperature + real(r8) :: qv(pcols,pver) ! Water vapor mixing ratio wrt moist air + real(r8) :: qc(pcols,pver) ! Cloud water mixing ratio wrt moist air + real(r8) :: qr(pcols,pver) ! Rain mixing ratio wrt moist air + real(r8) :: qv_dry(pcols,pver) ! Water vapor mixing ratio wrt dry air + real(r8) :: qc_dry(pcols,pver) ! Cloud water mixing ratio wrt dry air + real(r8) :: qr_dry(pcols,pver) ! Rain mixing ratio wrt dry air - integer :: errflg + integer :: k,rk ! vert. indices + logical :: lq(pcnst) ! Calc tendencies? + character(len=SHR_KIND_CM) :: errmsg ! CCPP physics scheme error message + + integer :: errflg ! CCPP physics scheme error flag - real(r8), pointer :: prec_sed(:) ! total precip from cloud sedimentation - real(r8), pointer :: relhum(:,:) ! relative humidity + character(len=64) :: scheme_name ! CCPP physics scheme name (not used in CAM) + + real(r8), pointer :: prec_sed(:) ! total precip from cloud sedimentation + real(r8), pointer :: relhum(:,:) ! relative humidity integer :: i @@ -169,63 +172,90 @@ subroutine kessler_tend(state, ptend, ztodt, pbuf) call pbuf_get_field(pbuf, relhum_idx, relhum) do k = 1, pver - ! Create temporaries for state variables changed by Kessler routine - temp(:ncol,k) = state%t(:ncol,k) - qv(:ncol,k) = state%q(:ncol,k,1) - qc(:ncol,k) = state%q(:ncol,k,ixcldliq) - qr(:ncol,k) = state%q(:ncol,k,ixrain) + ! Create temporaries for state variables changed by Kessler routine + temp(:ncol,k) = state%t(:ncol,k) + qv(:ncol,k) = state%q(:ncol,k,1) + qc(:ncol,k) = state%q(:ncol,k,ixcldliq) + qr(:ncol,k) = state%q(:ncol,k,ixrain) + + !Also calculate gas constant ratio: + zvirv(:ncol,k) = rh2o/rairv(:ncol,k, lchnk) - 1._r8 end do - - if (errflg == 0) then - call calc_exner_run(ncol, pver, cpair, rair, state%pmid, pk, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from calc_exner_run: '//trim(errmsg)) - end if + + ! Calculate Exner function: + call calc_exner_run(ncol, pver, cpairv(:,:,lchnk), rairv(:,:,lchnk), psurf_ref, state%pmid, pk, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from calc_exner_run: '//trim(errmsg)) + end if + + ! Calculate potential temperature: + call temp_to_potential_temp_run(ncol, pver, temp, pk, th, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from temp_to_potential_temp_run: '//trim(errmsg)) end if - if (errflg == 0) then - call temp_to_potential_temp_run(ncol, pver, temp, pk, th, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from temp_to_potential_temp_run: '//trim(errmsg)) - end if + + ! Calculate density using ideal gas law: + call calc_dry_air_ideal_gas_density_run(ncol, pver, rairv(:,:,lchnk), state%pmiddry, temp, rho, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from pres_to_density_dry_run: '//trim(errmsg)) end if - if (errflg == 0) then - call pres_to_density_dry_run(ncol, pver, state%pmiddry, temp, rho, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from pres_to_density_dry_run: '//trim(errmsg)) - end if + + ! Convert moist air mixing ratios to dry air mixing ratios: + !--------------------------------------------------------- + call wet_to_dry_water_vapor_run(ncol, pver, state%pdel, state%pdeldry, qv, qv_dry, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from wet_to_dry_water_vapor_run: '//trim(errmsg)) end if - if (errflg == 0) then - call wet_to_dry_run(ncol, pver, state%pdel, state%pdeldry, qv, qc, qr, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from wet_to_dry_run: '//trim(errmsg)) - end if + + call wet_to_dry_cloud_liquid_water_run(ncol, pver, state%pdel, state%pdeldry, qc, qc_dry, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from wet_to_dry_cloud_liquid_water_run: '//trim(errmsg)) end if - if (errflg == 0) then - call kessler_run(ncol, pver, ztodt, lyr_surf, lyr_toa, & - rho, state%zm, pk, th, qv, qc, qr, prec_sed, relhum, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from kessler_run: '//trim(errmsg)) - end if + + call wet_to_dry_rain_run(ncol, pver, state%pdel, state%pdeldry, qr, qr_dry, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from wet_to_dry_rain_run: '//trim(errmsg)) end if - if (errflg == 0) then - call potential_temp_to_temp_run(ncol, pver, th, pk, temp, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from potential_temp_to_temp_run: '//trim(errmsg)) - end if + !--------------------------------------------------------- + + ! Run Kessler physics scheme: + call kessler_run(ncol, pver, ztodt, lyr_surf, lyr_toa, cpairv(:,:,lchnk), & + rairv(:,:,lchnk), rho, state%zm, pk, th, qv_dry, qc_dry, & + qr_dry, prec_sed, relhum, scheme_name, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from kessler_run: '//trim(errmsg)) end if - if (errflg == 0) then - call dry_to_wet_run(ncol, pver, state%pdel, state%pdeldry, qv, qc, qr, errmsg, errflg) - if (errflg /=0) then - call endrun('kessler_tend error: Error returned from dry_to_wet_run: '//trim(errmsg)) - end if + + ! Calculate air temperature from potential temperature: + call potential_temp_to_temp_run(ncol, pver, th, pk, temp, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from potential_temp_to_temp_run: '//trim(errmsg)) + end if + + ! Convert dry air mixing ratios to moist air mixing ratios: + !--------------------------------------------------------- + call dry_to_wet_water_vapor_run(ncol, pver, state%pdel, state%pdeldry, qv_dry, qv, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from dry_to_wet_water_vapor_run: '//trim(errmsg)) + end if + + call dry_to_wet_cloud_liquid_water_run(ncol, pver, state%pdel, state%pdeldry, qc_dry, qc, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from dry_to_wet_cloud_liquid_water_run: '//trim(errmsg)) + end if + + call dry_to_wet_rain_run(ncol, pver, state%pdel, state%pdeldry, qr_dry, qr, errmsg, errflg) + if (errflg /=0) then + call endrun('kessler_tend error: Error returned from dry_to_wet_rain_run: '//trim(errmsg)) end if + !--------------------------------------------------------- ! Back out tendencies from updated fields do k = 1, pver - ptend%s(:ncol,k) = (th(:ncol,k)*pk(:ncol,k) - state%t(:ncol,k)) * cpair / ztodt - ptend%q(:ncol,k,1) = (qv(:ncol,k) - state%q(:ncol,k,1)) / ztodt - ptend%q(:ncol,k,ixcldliq) = (qc(:ncol,k) - state%q(:ncol,k,ixcldliq)) / ztodt - ptend%q(:ncol,k,ixrain) = (qr(:ncol,k) - state%q(:ncol,k,ixrain)) / ztodt + ptend%s(:ncol,k) = (th(:ncol,k)*pk(:ncol,k) - state%t(:ncol,k)) * cpairv(:ncol,k,lchnk) / ztodt + ptend%q(:ncol,k,1) = (qv(:ncol,k) - state%q(:ncol,k,1)) / ztodt + ptend%q(:ncol,k,ixcldliq) = (qc(:ncol,k) - state%q(:ncol,k,ixcldliq)) / ztodt + ptend%q(:ncol,k,ixrain) = (qr(:ncol,k) - state%q(:ncol,k,ixrain)) / ztodt end do ! Output liquid tracers diff --git a/src/physics/simple/physpkg.F90 b/src/physics/simple/physpkg.F90 index 31c41def58..cb1e1027f4 100644 --- a/src/physics/simple/physpkg.F90 +++ b/src/physics/simple/physpkg.F90 @@ -259,9 +259,9 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) end if if (ideal_phys) then - call held_suarez_init(pbuf2d) + call held_suarez_init() else if (kessler_phys) then - call kessler_cam_init(pbuf2d) + call kessler_cam_init() else if (tj2016_phys) then call thatcher_jablonowski_init(pbuf2d) else if (frierson_phys) then diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/ccpp_constituent_prop_mod.F90 new file mode 100644 index 0000000000..7ee7211d9d --- /dev/null +++ b/src/utils/ccpp_constituent_prop_mod.F90 @@ -0,0 +1,34 @@ +! This module is a placeholder for the CCPP generated module of the same name +module ccpp_constituent_prop_mod + + implicit none + + !Define stub version of constituent properties mod + type, public :: ccpp_constituent_prop_ptr_t + contains + procedure :: standard_name => ccp_get_standard_name + end type ccpp_constituent_prop_ptr_t + +contains + + subroutine ccp_get_standard_name(this, std_name, errcode, errmsg) + ! Return this constituent's standard name + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(in) :: this + character(len=*), intent(out) :: std_name + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + std_name = 'Not Used!' + + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccp_get_standard_name + +end module ccpp_constituent_prop_mod From 9b1a538be6d03df47379b3878379296d0024fae1 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Wed, 21 Jun 2023 14:01:54 -0600 Subject: [PATCH 02/23] Replace 'geopotential_t' calculation with CCPP version for SE and MPAS. --- src/physics/cam/geopotential.F90 | 142 +++++++++--------------- src/physics/cam/physpkg.F90 | 12 +- src/physics/cam_dev/physpkg.F90 | 6 + src/physics/simple/physpkg.F90 | 6 + src/utils/ccpp_constituent_prop_mod.F90 | 130 +++++++++++++++++++--- 5 files changed, 187 insertions(+), 109 deletions(-) diff --git a/src/physics/cam/geopotential.F90 b/src/physics/cam/geopotential.F90 index 7672fc92e0..a6f2154807 100644 --- a/src/physics/cam/geopotential.F90 +++ b/src/physics/cam/geopotential.F90 @@ -7,7 +7,7 @@ module geopotential ! The hydrostatic matrix elements must be consistent with the dynamics algorithm. ! The diagonal element is the itegration weight from interface k+1 to midpoint k. ! The offdiagonal element is the weight between interfaces. -! +! ! Author: B.Boville, Feb 2001 from earlier code by Boville and S.J. Lin !--------------------------------------------------------------------------------- @@ -29,17 +29,19 @@ subroutine geopotential_t( & t , q , rair , gravit , zvir , & zi , zm , ncol ) -!----------------------------------------------------------------------- -! -! Purpose: -! Compute the geopotential height (above the surface) at the midpoints and +!----------------------------------------------------------------------- +! +! Purpose: +! Compute the geopotential height (above the surface) at the midpoints and ! interfaces using the input temperatures and pressures. ! !----------------------------------------------------------------------- -use ppgrid, only : pcols -use air_composition, only: thermodynamic_active_species_num -use air_composition, only: thermodynamic_active_species_idx, dry_air_species_num +use ppgrid, only: pcols +use constituents, only: pcnst, cnst_get_ind +use ccpp_constituent_prop_mod, only: ccpp_const_props !CCPP constituent properties array (stub version) +use geopotential_t, only: geopotential_t_run !CCPP version + !------------------------------Arguments-------------------------------- ! ! Input arguments @@ -65,6 +67,8 @@ subroutine geopotential_t( & ! !---------------------------Local variables----------------------------- ! + logical :: lagrang ! Lagrangian vertical coordinate flag + integer :: ixq ! state constituent array index for water vapor integer :: i,k,idx ! Lon, level indices, water species index real(r8) :: hkk(ncol) ! diagonal element of hydrostatic matrix real(r8) :: hkl(ncol) ! off-diagonal element @@ -74,28 +78,36 @@ subroutine geopotential_t( & real(r8) :: qfac(ncol,pver) ! factor to convert from wet to dry mixing ratio real(r8) :: sum_dry_mixing_ratio(ncol,pver)! sum of dry water mixing ratios + !CCPP-required variables (not used): + integer :: errflg + character(len=512) :: errmsg + ! !----------------------------------------------------------------------- ! - rog(:ncol,:) = rair(:ncol,:) / gravit - -! The surface height is zero by definition. - - do i = 1,ncol - zi(i,pverp) = 0.0_r8 - end do - - ! Compute zi, zm from bottom up. - ! Note, zi(i,k) is the interface above zm(i,k) + !Determine index for water vapor mass mixing ratio + call cnst_get_ind('Q', ixq) ! ! original code for backwards compatability with FV and EUL ! if (.not.(dycore_is('MPAS') .or. dycore_is('SE'))) then + + ! Compute zi, zm from bottom up. + ! Note, zi(i,k) is the interface above zm(i,k) + + !dray air gas constant over gravity + rog(:ncol,:) = rair(:ncol,:) / gravit + + ! The surface height is zero by definition. + do i = 1,ncol + zi(i,pverp) = 0.0_r8 + end do + do k = pver, 1, -1 - + ! First set hydrostatic elements consistent with dynamics - + if ((dycore_is('LR') .or. dycore_is('FV3'))) then do i = 1,ncol hkl(i) = piln(i,k+1) - piln(i,k) @@ -107,83 +119,33 @@ subroutine geopotential_t( & hkk(i) = 0.5_r8 * hkl(i) end do end if - - ! Now compute tv, zm, zi - - do i = 1,ncol - tvfac = 1._r8 + zvir(i,k) * q(i,k,1) - tv = t(i,k) * tvfac - - zm(i,k) = zi(i,k+1) + rog(i,k) * tv * hkk(i) - zi(i,k) = zi(i,k+1) + rog(i,k) * tv * hkl(i) - end do - end do - else - ! - ! For the computation of generalized virtual temperature (equation 16 - ! in Lauritzen et al. (2018); https://doi.org/10.1029/2017MS001257) - ! - ! Compute factor for converting wet to dry mixing ratio (eq.7) - ! - qfac = 1.0_r8 - do idx = dry_air_species_num + 1,thermodynamic_active_species_num - do k = 1,pver - do i = 1,ncol - qfac(i,k) = qfac(i,k)-q(i,k,thermodynamic_active_species_idx(idx)) - end do - end do - end do - qfac = 1.0_r8/qfac - - ! Compute sum of dry water mixing ratios - sum_dry_mixing_ratio = 1.0_r8 - do idx = dry_air_species_num + 1,thermodynamic_active_species_num - do k = 1,pver - do i = 1,ncol - sum_dry_mixing_ratio(i,k) = sum_dry_mixing_ratio(i,k)& - +q(i,k,thermodynamic_active_species_idx(idx))*qfac(i,k) - end do - end do - end do - sum_dry_mixing_ratio(:,:) = 1.0_r8/sum_dry_mixing_ratio(:,:) - ! Compute zi, zm from bottom up. - ! Note, zi(i,k) is the interface above zm(i,k) - do k = pver, 1, -1 - - ! First set hydrostatic elements consistent with dynamics - - ! - ! the outcommented code is left for when/if we will support - ! FV3 and/or FV with condensate loading - ! - -! if ((dycore_is('LR') .or. dycore_is('FV3'))) then -! do i = 1,ncol -! hkl(i) = piln(i,k+1) - piln(i,k) -! hkk(i) = 1._r8 - pint(i,k) * hkl(i) * rpdel(i,k) -! end do -! else!MPAS, SE or EUL - ! - ! For SE : pmid = 0.5*(pint(k+1)+pint(k)) - ! For MPAS : pmid is computed from theta_m, rhodry, etc. - ! - do i = 1,ncol - hkl(i) = pdel(i,k) / pmid(i,k) - hkk(i) = 0.5_r8 * hkl(i) - end do -! end if - + ! Now compute tv, zm, zi - + do i = 1,ncol - tvfac = (1._r8 + (zvir(i,k)+1.0_r8) * q(i,k,1)*qfac(i,k))*sum_dry_mixing_ratio(i,k) + tvfac = 1._r8 + zvir(i,k) * q(i,k,ixq) tv = t(i,k) * tvfac - + zm(i,k) = zi(i,k+1) + rog(i,k) * tv * hkk(i) zi(i,k) = zi(i,k+1) + rog(i,k) * tv * hkl(i) end do end do + else !Using MPAS or SE dycore + + !Determine vertical coordinate type, + !uncomment if FV (LR) or FV3 dycores allow for condensate loading. + !if ((dycore_is('LR') .or. dycore_is('FV3'))) then + ! lagrang = .true. + !else + lagrang = .false. + !end if + + !Use CCPP version of geopotential_t: + call geopotential_t_run(pver, lagrang, pver, 1, pverp, 1, & + pcnst, piln, pint, pmid, pdel, rpdel, t, q(:,:,ixq), q, & + ccpp_const_props, rair, gravit, zvir, zi, zm, ncol, & + errflg, errmsg) + end if - return end subroutine geopotential_t end module geopotential diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 706b9dcdee..7470856952 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -786,6 +786,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use phys_grid_ctem, only: phys_grid_ctem_init use cam_budget, only: cam_budget_init + use ccpp_constituent_prop_mod, only: ccpp_const_props_init + ! Input/output arguments type(physics_state), pointer :: phys_state(:) type(physics_tend ), pointer :: phys_tend(:) @@ -978,6 +980,10 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) end if + ! Initialize stub CCPP constituent properties array + ! for use in CCPP-ized physics schemes: + call ccpp_const_props_init() + ! Initialize qneg3 and qneg4 call qneg_init() @@ -989,7 +995,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) ! Initialize the budget capability call cam_budget_init() - + ! addfld calls for U, V tendency budget variables that are output in ! tphysac, tphysbc call addfld ( 'UTEND_DCONV', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by deep convection') @@ -1938,7 +1944,7 @@ subroutine tphysac (ztodt, cam_in, & else ! ! for moist-mixing ratio based dycores - ! + ! ! Note: this operation will NOT be reverted with set_wet_to_dry after set_dry_to_wet call ! call set_dry_to_wet(state) @@ -1960,7 +1966,7 @@ subroutine tphysac (ztodt, cam_in, & if (vc_dycore == vc_height.or.vc_dycore == vc_dry_pressure) then ! ! MPAS and SE specific scaling of temperature for enforcing energy consistency - ! (and to make sure that temperature dependent diagnostic tendencies + ! (and to make sure that temperature dependent diagnostic tendencies ! are computed correctly; e.g. dtcore) ! scaling(1:ncol,:) = cpairv(:ncol,:,lchnk)/cp_or_cv_dycore(:ncol,:,lchnk) diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index b288a17177..9048bcd864 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -769,6 +769,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use cam_budget, only: cam_budget_init use phys_grid_ctem, only: phys_grid_ctem_init + use ccpp_constituent_prop_mod, only: ccpp_const_props_init + ! Input/output arguments type(physics_state), pointer :: phys_state(:) type(physics_tend ), pointer :: phys_tend(:) @@ -947,6 +949,10 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) end if + ! Initialize stub CCPP constituent properties array + ! for use in CCPP-ized physics schemes: + call ccpp_const_props_init() + ! Initialize qneg3 and qneg4 call qneg_init() diff --git a/src/physics/simple/physpkg.F90 b/src/physics/simple/physpkg.F90 index cb1e1027f4..ed97dc56b3 100644 --- a/src/physics/simple/physpkg.F90 +++ b/src/physics/simple/physpkg.F90 @@ -209,6 +209,8 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use cam_snapshot, only: cam_snapshot_init use cam_budget, only: cam_budget_init + use ccpp_constituent_prop_mod, only: ccpp_const_props_init + ! Input/output arguments type(physics_state), pointer :: phys_state(:) type(physics_tend ), pointer :: phys_tend(:) @@ -277,6 +279,10 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call chem_init(phys_state,pbuf2d) end if + ! Initialize stub CCPP constituent properties array + ! for use in CCPP-ized physics schemes: + call ccpp_const_props_init() + ! Initialize qneg3 and qneg4 call qneg_init() diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/ccpp_constituent_prop_mod.F90 index 7ee7211d9d..fbfaf09f60 100644 --- a/src/utils/ccpp_constituent_prop_mod.F90 +++ b/src/utils/ccpp_constituent_prop_mod.F90 @@ -2,33 +2,131 @@ module ccpp_constituent_prop_mod implicit none + private !Define stub version of constituent properties mod type, public :: ccpp_constituent_prop_ptr_t + logical, private :: thermo_active = .false. contains - procedure :: standard_name => ccp_get_standard_name + procedure :: standard_name => ccpt_get_standard_name + procedure :: is_thermo_active => ccpt_is_thermo_active + procedure :: set_thermo_active => ccpt_set_thermo_active end type ccpp_constituent_prop_ptr_t + !CCPP properties init routine + public :: ccpp_const_props_init + + !Public properties DDT variable: + type(ccpp_constituent_prop_ptr_t), allocatable, public :: ccpp_const_props(:) + contains - subroutine ccp_get_standard_name(this, std_name, errcode, errmsg) - ! Return this constituent's standard name +!+++++++++++++++++++++++++++++++++++++++ +!CCPP constituent properties DDT methods +!+++++++++++++++++++++++++++++++++++++++ + + subroutine ccpt_get_standard_name(this, std_name, errcode, errmsg) + ! Return this constituent's standard name + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(in) :: this + character(len=*), intent(out) :: std_name + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + std_name = 'Not Used!' + + !Provide err values if requested: + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccpt_get_standard_name + + !------ + + subroutine ccpt_is_thermo_active(this, val_out, errcode, errmsg) + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(in) :: this + logical, intent(out) :: val_out + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + !Pass back thermo active property: + val_out = this%thermo_active + + !Provide err values if requested: + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccpt_is_thermo_active + + !------ + + subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) + ! Set whether this constituent is thermodynamically active, which + ! means that certain physics schemes will use this constitutent + ! when calculating thermodynamic quantities (e.g. enthalpy). + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(inout) :: this + logical, intent(in) :: thermo_flag + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + !Set thermodynamically active flag for this constituent: + this%thermo_active = thermo_flag + + !Provide err values if requested: + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccpt_set_thermo_active + +!+++++++++++++++++++++++++++++++++++++++++++++ +!CCPP constituents stub initialization routine +!+++++++++++++++++++++++++++++++++++++++++++++ + +subroutine ccpp_const_prop_init() + + !Use statements: + use constituents, only: pcnst + use cam_abortutils, only: handle_allocate_error + use air_composition, only: thermodynamic_active_species_idx + + !Local variables: + integer :: ierr + integer :: m + + character(len=*), parameter :: subname = 'ccpp_const_prop_init:' - ! Dummy arguments - class(ccpp_constituent_prop_ptr_t), intent(in) :: this - character(len=*), intent(out) :: std_name - integer, optional, intent(out) :: errcode - character(len=*), optional, intent(out) :: errmsg + !Allocate constituents object: + allocate(ccpp_const_props(pcnst), stat=ierr) - std_name = 'Not Used!' + !Check if allocation succeeded: + call handle_allocate_error(ierr, subname, 'ccpp_const_props(pcnst)') - if(present(errcode)) then - errcode = 0 - end if - if(present(errmsg)) then - errmsg = 'Still Not Used!' - end if + !Set "thermo_active" property: + do m = 1,pcnst + if (any(thermodynamic_active_species_idx == m)) then + call ccpp_const_props(m)%set_thermo_active(.true.) + else + call ccpp_const_props(m)%set_thermo_active(.false.) + end if + end do - end subroutine ccp_get_standard_name +end subroutine ccpp_const_prop_init end module ccpp_constituent_prop_mod From 675b6e59575d4f827fa3279f9a73b5e458dc6e3e Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 22 Jun 2023 09:58:00 -0600 Subject: [PATCH 03/23] Fix bugs needed to work with CCPP geopotential_t routine. --- src/physics/cam/geopotential.F90 | 11 +++++------ src/utils/ccpp_constituent_prop_mod.F90 | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/physics/cam/geopotential.F90 b/src/physics/cam/geopotential.F90 index a6f2154807..b073c2975a 100644 --- a/src/physics/cam/geopotential.F90 +++ b/src/physics/cam/geopotential.F90 @@ -39,9 +39,8 @@ subroutine geopotential_t( & use ppgrid, only: pcols use constituents, only: pcnst, cnst_get_ind -use ccpp_constituent_prop_mod, only: ccpp_const_props !CCPP constituent properties array (stub version) -use geopotential_t, only: geopotential_t_run !CCPP version - +use ccpp_constituent_prop_mod, only: ccpp_const_props !CCPP constituent properties array (stub version) +use geopotential_temp, only: geopotential_temp_run !CCPP version !------------------------------Arguments-------------------------------- ! ! Input arguments @@ -141,9 +140,9 @@ subroutine geopotential_t( & !end if !Use CCPP version of geopotential_t: - call geopotential_t_run(pver, lagrang, pver, 1, pverp, 1, & - pcnst, piln, pint, pmid, pdel, rpdel, t, q(:,:,ixq), q, & - ccpp_const_props, rair, gravit, zvir, zi, zm, ncol, & + call geopotential_temp_run(pver, lagrang, pver, 1, pverp, 1, & + pcnst, piln, pint, pmid, pdel, rpdel, t, q(:,:,ixq), q, & + ccpp_const_props, rair, gravit, zvir, zi, zm, ncol, & errflg, errmsg) end if diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/ccpp_constituent_prop_mod.F90 index fbfaf09f60..5b5b8e5f2e 100644 --- a/src/utils/ccpp_constituent_prop_mod.F90 +++ b/src/utils/ccpp_constituent_prop_mod.F90 @@ -14,7 +14,7 @@ module ccpp_constituent_prop_mod end type ccpp_constituent_prop_ptr_t !CCPP properties init routine - public :: ccpp_const_props_init + public :: ccpp_const_props_init !Public properties DDT variable: type(ccpp_constituent_prop_ptr_t), allocatable, public :: ccpp_const_props(:) @@ -99,7 +99,7 @@ end subroutine ccpt_set_thermo_active !CCPP constituents stub initialization routine !+++++++++++++++++++++++++++++++++++++++++++++ -subroutine ccpp_const_prop_init() +subroutine ccpp_const_props_init() !Use statements: use constituents, only: pcnst @@ -127,6 +127,6 @@ subroutine ccpp_const_prop_init() end if end do -end subroutine ccpp_const_prop_init +end subroutine ccpp_const_props_init end module ccpp_constituent_prop_mod From 628e516d858dd939ae748e0b0ad0c230a9d166dc Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 29 Sep 2023 11:11:45 -0600 Subject: [PATCH 04/23] Add 'water_species' property to fake const object. --- src/utils/ccpp_constituent_prop_mod.F90 | 66 +++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/ccpp_constituent_prop_mod.F90 index 5b5b8e5f2e..7e3e0001b8 100644 --- a/src/utils/ccpp_constituent_prop_mod.F90 +++ b/src/utils/ccpp_constituent_prop_mod.F90 @@ -7,10 +7,13 @@ module ccpp_constituent_prop_mod !Define stub version of constituent properties mod type, public :: ccpp_constituent_prop_ptr_t logical, private :: thermo_active = .false. + logical, private :: water_species = .false. contains procedure :: standard_name => ccpt_get_standard_name procedure :: is_thermo_active => ccpt_is_thermo_active + procedure :: is_water_species => ccpt_is_water_species procedure :: set_thermo_active => ccpt_set_thermo_active + procedure :: set_water_species => ccpt_set_water_species end type ccpp_constituent_prop_ptr_t !CCPP properties init routine @@ -51,7 +54,7 @@ end subroutine ccpt_get_standard_name subroutine ccpt_is_thermo_active(this, val_out, errcode, errmsg) ! Dummy arguments - class(ccpp_constituent_prop_ptr_t), intent(in) :: this + class(ccpp_constituent_prop_ptr_t), intent(in) :: this logical, intent(out) :: val_out integer, optional, intent(out) :: errcode character(len=*), optional, intent(out) :: errmsg @@ -71,6 +74,29 @@ end subroutine ccpt_is_thermo_active !------ + subroutine ccpt_is_water_species(this, val_out, errcode, errmsg) + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(in) :: this + logical, intent(out) :: val_out + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + !Pass back water species property: + val_out = this%water_species + + !Provide err values if requested: + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccpt_is_water_species_ + + !------ + subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) ! Set whether this constituent is thermodynamically active, which ! means that certain physics schemes will use this constitutent @@ -95,6 +121,32 @@ subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) end subroutine ccpt_set_thermo_active + !------ + + subroutine ccpt_set_water_species(this, water_flag, errcode, errmsg) + ! Set whether this constituent is a water species, which means + ! that this constituent represents a particular phase or type + ! of water in the atmosphere. + + ! Dummy arguments + class(ccpp_constituent_prop_ptr_t), intent(inout) :: this + logical, intent(in) :: water_flag + integer, optional, intent(out) :: errcode + character(len=*), optional, intent(out) :: errmsg + + !Set thermodynamically active flag for this constituent: + this%water_species = water_flag + + !Provide err values if requested: + if(present(errcode)) then + errcode = 0 + end if + if(present(errmsg)) then + errmsg = 'Still Not Used!' + end if + + end subroutine ccpt_set_water_species + !+++++++++++++++++++++++++++++++++++++++++++++ !CCPP constituents stub initialization routine !+++++++++++++++++++++++++++++++++++++++++++++ @@ -104,6 +156,7 @@ subroutine ccpp_const_props_init() !Use statements: use constituents, only: pcnst use cam_abortutils, only: handle_allocate_error + use air_composition, only: dry_air_species_num use air_composition, only: thermodynamic_active_species_idx !Local variables: @@ -120,10 +173,15 @@ subroutine ccpp_const_props_init() !Set "thermo_active" property: do m = 1,pcnst - if (any(thermodynamic_active_species_idx == m)) then + if(any(thermodynamic_active_species_idx == m)) then call ccpp_const_props(m)%set_thermo_active(.true.) - else - call ccpp_const_props(m)%set_thermo_active(.false.) + end if + end do + + !Set "water_species" property: + do m=1,pcnst + if(any(thermodynamic_active_species_idx(dry_air_species_num+1:) == m)) then + call ccpp_const_props(m)%set_water_species(.true.) end if end do From 15e603da58e2bcd306bc07608eaa1d0651d4cdab Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 29 Sep 2023 11:26:48 -0600 Subject: [PATCH 05/23] Replace SE dry static energy calculation with equivalent CCPP scheme. --- src/dynamics/se/dp_coupling.F90 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index 056eb45f93..e534b83eef 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -546,15 +546,17 @@ subroutine derived_phys_dry(phys_state, phys_tend, pbuf2d) use shr_const_mod, only: shr_const_rwv use phys_control, only: waccmx_is use geopotential, only: geopotential_t + use static_energy, only: update_dry_static_energy_run use check_energy, only: check_energy_timestep_init use hycoef, only: hyai, ps0 use shr_vmath_mod, only: shr_vmath_log use qneg_module, only: qneg3 use dyn_tests_utils, only: vc_dry_pressure + use shr_kind_mod, only: shr_kind_cx ! arguments type(physics_state), intent(inout), dimension(begchunk:endchunk) :: phys_state type(physics_tend ), intent(inout), dimension(begchunk:endchunk) :: phys_tend - type(physics_buffer_desc), pointer :: pbuf2d(:,:) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) ! local variables integer :: lchnk @@ -564,6 +566,10 @@ subroutine derived_phys_dry(phys_state, phys_tend, pbuf2d) integer :: m, i, k, ncol, m_cnst type(physics_buffer_desc), pointer :: pbuf_chnk(:) + + !Needed for "update_dry_static_energy" CCPP scheme + integer :: errflg + character(len=shr_kind_cx) :: errmsg !---------------------------------------------------------------------------- ! Evaluate derived quantities @@ -686,18 +692,15 @@ subroutine derived_phys_dry(phys_state, phys_tend, pbuf2d) end do ! Compute initial geopotential heights - based on full pressure - call geopotential_t (phys_state(lchnk)%lnpint, phys_state(lchnk)%lnpmid , phys_state(lchnk)%pint , & - phys_state(lchnk)%pmid , phys_state(lchnk)%pdel , phys_state(lchnk)%rpdel , & - phys_state(lchnk)%t , phys_state(lchnk)%q(:,:,:), rairv(:,:,lchnk), gravit, zvirv , & - phys_state(lchnk)%zi , phys_state(lchnk)%zm , ncol ) + call geopotential_t (phys_state(lchnk)%lnpint, phys_state(lchnk)%lnpmid , phys_state(lchnk)%pint, & + phys_state(lchnk)%pmid , phys_state(lchnk)%pdel , phys_state(lchnk)%rpdel , & + phys_state(lchnk)%t , phys_state(lchnk)%q(:,:,:), rairv(:,:,lchnk), gravit, zvirv , & + phys_state(lchnk)%zi , phys_state(lchnk)%zm , ncol) ! Compute initial dry static energy, include surface geopotential - do k = 1, pver - do i = 1, ncol - phys_state(lchnk)%s(i,k) = cpairv(i,k,lchnk)*phys_state(lchnk)%t(i,k) & - + gravit*phys_state(lchnk)%zm(i,k) + phys_state(lchnk)%phis(i) - end do - end do + call update_dry_static_energy_run(pver, phys_state(lchnk)%t, phys_state%zm, + phys_state(lchnk)%phis, phys_state(lchnk)%s, + cpairv(:,:,lchnk), errflg, errmsg) ! Ensure tracers are all positive call qneg3('D_P_COUPLING',lchnk ,ncol ,pcols ,pver , & From dd8b5368b33be31858b0dbb923bda58ead8d709e Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 2 Oct 2023 10:02:40 -0600 Subject: [PATCH 06/23] Fix bugs found during manual testing. --- src/dynamics/se/dp_coupling.F90 | 6 +++--- src/utils/ccpp_constituent_prop_mod.F90 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index e534b83eef..51f667864b 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -698,9 +698,9 @@ subroutine derived_phys_dry(phys_state, phys_tend, pbuf2d) phys_state(lchnk)%zi , phys_state(lchnk)%zm , ncol) ! Compute initial dry static energy, include surface geopotential - call update_dry_static_energy_run(pver, phys_state(lchnk)%t, phys_state%zm, - phys_state(lchnk)%phis, phys_state(lchnk)%s, - cpairv(:,:,lchnk), errflg, errmsg) + call update_dry_static_energy_run(pver, gravit, phys_state(lchnk)%t, phys_state(lchnk)%zm, & + phys_state(lchnk)%phis, phys_state(lchnk)%s, cpairv(:,:,lchnk), & + errflg, errmsg) ! Ensure tracers are all positive call qneg3('D_P_COUPLING',lchnk ,ncol ,pcols ,pver , & diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/ccpp_constituent_prop_mod.F90 index 7e3e0001b8..0df7af2e77 100644 --- a/src/utils/ccpp_constituent_prop_mod.F90 +++ b/src/utils/ccpp_constituent_prop_mod.F90 @@ -93,7 +93,7 @@ subroutine ccpt_is_water_species(this, val_out, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_is_water_species_ + end subroutine ccpt_is_water_species !------ From 81694866c4d923d2a143ade0760ac2c41f06367c Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 6 Oct 2023 10:26:01 -0600 Subject: [PATCH 07/23] Cheryl code review updates. --- bld/configure | 1 + src/dynamics/se/dp_coupling.F90 | 14 ++-- src/physics/cam/geopotential.F90 | 27 ++++--- .../ccpp_constituent_prop_mod.F90 | 74 +++++++++---------- src/utils/{ => cam_ccpp}/ccpp_kinds.F90 | 2 +- 5 files changed, 62 insertions(+), 56 deletions(-) rename src/utils/{ => cam_ccpp}/ccpp_constituent_prop_mod.F90 (70%) rename src/utils/{ => cam_ccpp}/ccpp_kinds.F90 (65%) diff --git a/bld/configure b/bld/configure index 262ac38e6d..d1f86cb03e 100755 --- a/bld/configure +++ b/bld/configure @@ -2269,6 +2269,7 @@ sub write_filepath print $fh "$camsrcdir/src/cpl/$cpl\n"; print $fh "$camsrcdir/src/control\n"; print $fh "$camsrcdir/src/utils\n"; + print $fh "$camsrcdir/src/utils/cam_ccpp\n"; print $fh "$camsrcdir/src/atmos_phys/utilities\n"; diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index 51f667864b..1d9fe6a83e 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -692,15 +692,17 @@ subroutine derived_phys_dry(phys_state, phys_tend, pbuf2d) end do ! Compute initial geopotential heights - based on full pressure - call geopotential_t (phys_state(lchnk)%lnpint, phys_state(lchnk)%lnpmid , phys_state(lchnk)%pint, & - phys_state(lchnk)%pmid , phys_state(lchnk)%pdel , phys_state(lchnk)%rpdel , & - phys_state(lchnk)%t , phys_state(lchnk)%q(:,:,:), rairv(:,:,lchnk), gravit, zvirv , & + call geopotential_t(phys_state(lchnk)%lnpint, phys_state(lchnk)%lnpmid , phys_state(lchnk)%pint, & + phys_state(lchnk)%pmid , phys_state(lchnk)%pdel , phys_state(lchnk)%rpdel , & + phys_state(lchnk)%t , phys_state(lchnk)%q(:,:,:), rairv(:,:,lchnk), gravit, zvirv , & phys_state(lchnk)%zi , phys_state(lchnk)%zm , ncol) ! Compute initial dry static energy, include surface geopotential - call update_dry_static_energy_run(pver, gravit, phys_state(lchnk)%t, phys_state(lchnk)%zm, & - phys_state(lchnk)%phis, phys_state(lchnk)%s, cpairv(:,:,lchnk), & - errflg, errmsg) + call update_dry_static_energy_run(pver, gravit, phys_state(lchnk)%t(1:ncol,:), & + phys_state(lchnk)%zm(1:ncol,:), & + phys_state(lchnk)%phis(1:ncol), & + phys_state(lchnk)%s(1:ncol,:), & + cpairv(1:ncol,:,lchnk), errflg, errmsg) ! Ensure tracers are all positive call qneg3('D_P_COUPLING',lchnk ,ncol ,pcols ,pver , & diff --git a/src/physics/cam/geopotential.F90 b/src/physics/cam/geopotential.F90 index b073c2975a..651c190d9b 100644 --- a/src/physics/cam/geopotential.F90 +++ b/src/physics/cam/geopotential.F90 @@ -92,10 +92,7 @@ subroutine geopotential_t( & ! if (.not.(dycore_is('MPAS') .or. dycore_is('SE'))) then - ! Compute zi, zm from bottom up. - ! Note, zi(i,k) is the interface above zm(i,k) - - !dray air gas constant over gravity + !dry air gas constant over gravity rog(:ncol,:) = rair(:ncol,:) / gravit ! The surface height is zero by definition. @@ -103,6 +100,8 @@ subroutine geopotential_t( & zi(i,pverp) = 0.0_r8 end do + ! Compute zi, zm from bottom up. + ! Note, zi(i,k) is the interface above zm(i,k) do k = pver, 1, -1 ! First set hydrostatic elements consistent with dynamics @@ -132,18 +131,22 @@ subroutine geopotential_t( & else !Using MPAS or SE dycore !Determine vertical coordinate type, - !uncomment if FV (LR) or FV3 dycores allow for condensate loading. - !if ((dycore_is('LR') .or. dycore_is('FV3'))) then - ! lagrang = .true. - !else + !NOTE: Currently the FV (LR) or FV3 dycores + ! do not allow for condensate loading, + ! so for now 'lagrang' will always be FALSE. + if ((dycore_is('LR') .or. dycore_is('FV3'))) then + lagrang = .true. + else lagrang = .false. - !end if + end if !Use CCPP version of geopotential_t: call geopotential_temp_run(pver, lagrang, pver, 1, pverp, 1, & - pcnst, piln, pint, pmid, pdel, rpdel, t, q(:,:,ixq), q, & - ccpp_const_props, rair, gravit, zvir, zi, zm, ncol, & - errflg, errmsg) + pcnst, piln(1:ncol,:), pint(1:ncol,:), pmid(1:ncol,:), & + pdel(1:ncol,:), rpdel(1:ncol,:), t(1:ncol,:), & + q(1:ncol,:,ixq), q(1:ncol,:,:), ccpp_const_props, & + rair(1:ncol,:), gravit, zvir(1:ncol,:), zi(1:ncol,:), & + zm(1:ncol,:), ncol, errflg, errmsg) end if end subroutine geopotential_t diff --git a/src/utils/ccpp_constituent_prop_mod.F90 b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 similarity index 70% rename from src/utils/ccpp_constituent_prop_mod.F90 rename to src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 index 0df7af2e77..1afe3cc75b 100644 --- a/src/utils/ccpp_constituent_prop_mod.F90 +++ b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 @@ -1,25 +1,25 @@ -! This module is a placeholder for the CCPP generated module of the same name +! This module is the CAM version of the CCPP generated module of the same name module ccpp_constituent_prop_mod implicit none private - !Define stub version of constituent properties mod + ! Define CAM version of constituent properties mod type, public :: ccpp_constituent_prop_ptr_t logical, private :: thermo_active = .false. logical, private :: water_species = .false. contains - procedure :: standard_name => ccpt_get_standard_name - procedure :: is_thermo_active => ccpt_is_thermo_active - procedure :: is_water_species => ccpt_is_water_species - procedure :: set_thermo_active => ccpt_set_thermo_active - procedure :: set_water_species => ccpt_set_water_species + procedure :: standard_name => ccp_get_standard_name + procedure :: is_thermo_active => ccp_is_thermo_active + procedure :: is_water_species => ccp_is_water_species + procedure :: set_thermo_active => ccp_set_thermo_active + procedure :: set_water_species => ccp_set_water_species end type ccpp_constituent_prop_ptr_t - !CCPP properties init routine + ! CCPP properties init routine public :: ccpp_const_props_init - !Public properties DDT variable: + ! Public properties DDT variable: type(ccpp_constituent_prop_ptr_t), allocatable, public :: ccpp_const_props(:) contains @@ -28,7 +28,7 @@ module ccpp_constituent_prop_mod !CCPP constituent properties DDT methods !+++++++++++++++++++++++++++++++++++++++ - subroutine ccpt_get_standard_name(this, std_name, errcode, errmsg) + subroutine ccp_get_standard_name(this, std_name, errcode, errmsg) ! Return this constituent's standard name ! Dummy arguments @@ -39,7 +39,7 @@ subroutine ccpt_get_standard_name(this, std_name, errcode, errmsg) std_name = 'Not Used!' - !Provide err values if requested: + ! Provide err values if requested: if(present(errcode)) then errcode = 0 end if @@ -47,11 +47,11 @@ subroutine ccpt_get_standard_name(this, std_name, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_get_standard_name + end subroutine ccp_get_standard_name !------ - subroutine ccpt_is_thermo_active(this, val_out, errcode, errmsg) + subroutine ccp_is_thermo_active(this, val_out, errcode, errmsg) ! Dummy arguments class(ccpp_constituent_prop_ptr_t), intent(in) :: this @@ -59,10 +59,10 @@ subroutine ccpt_is_thermo_active(this, val_out, errcode, errmsg) integer, optional, intent(out) :: errcode character(len=*), optional, intent(out) :: errmsg - !Pass back thermo active property: + ! Pass back thermo active property: val_out = this%thermo_active - !Provide err values if requested: + ! Provide err values if requested: if(present(errcode)) then errcode = 0 end if @@ -70,11 +70,11 @@ subroutine ccpt_is_thermo_active(this, val_out, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_is_thermo_active + end subroutine ccp_is_thermo_active !------ - subroutine ccpt_is_water_species(this, val_out, errcode, errmsg) + subroutine ccp_is_water_species(this, val_out, errcode, errmsg) ! Dummy arguments class(ccpp_constituent_prop_ptr_t), intent(in) :: this @@ -82,10 +82,10 @@ subroutine ccpt_is_water_species(this, val_out, errcode, errmsg) integer, optional, intent(out) :: errcode character(len=*), optional, intent(out) :: errmsg - !Pass back water species property: + ! Pass back water species property: val_out = this%water_species - !Provide err values if requested: + ! Provide err values if requested: if(present(errcode)) then errcode = 0 end if @@ -93,11 +93,11 @@ subroutine ccpt_is_water_species(this, val_out, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_is_water_species + end subroutine ccp_is_water_species !------ - subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) + subroutine ccp_set_thermo_active(this, thermo_flag, errcode, errmsg) ! Set whether this constituent is thermodynamically active, which ! means that certain physics schemes will use this constitutent ! when calculating thermodynamic quantities (e.g. enthalpy). @@ -108,10 +108,10 @@ subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) integer, optional, intent(out) :: errcode character(len=*), optional, intent(out) :: errmsg - !Set thermodynamically active flag for this constituent: + ! Set thermodynamically active flag for this constituent: this%thermo_active = thermo_flag - !Provide err values if requested: + ! Provide err values if requested: if(present(errcode)) then errcode = 0 end if @@ -119,11 +119,11 @@ subroutine ccpt_set_thermo_active(this, thermo_flag, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_set_thermo_active + end subroutine ccp_set_thermo_active !------ - subroutine ccpt_set_water_species(this, water_flag, errcode, errmsg) + subroutine ccp_set_water_species(this, water_flag, errcode, errmsg) ! Set whether this constituent is a water species, which means ! that this constituent represents a particular phase or type ! of water in the atmosphere. @@ -134,10 +134,10 @@ subroutine ccpt_set_water_species(this, water_flag, errcode, errmsg) integer, optional, intent(out) :: errcode character(len=*), optional, intent(out) :: errmsg - !Set thermodynamically active flag for this constituent: + ! Set thermodynamically active flag for this constituent: this%water_species = water_flag - !Provide err values if requested: + ! Provide err values if requested: if(present(errcode)) then errcode = 0 end if @@ -145,40 +145,40 @@ subroutine ccpt_set_water_species(this, water_flag, errcode, errmsg) errmsg = 'Still Not Used!' end if - end subroutine ccpt_set_water_species + end subroutine ccp_set_water_species -!+++++++++++++++++++++++++++++++++++++++++++++ -!CCPP constituents stub initialization routine -!+++++++++++++++++++++++++++++++++++++++++++++ +!+++++++++++++++++++++++++++++++++++++++++++++++++++++++ +!CAM-equivalent CCPP constituents initialization routine +!+++++++++++++++++++++++++++++++++++++++++++++++++++++++ subroutine ccpp_const_props_init() - !Use statements: + ! Use statements: use constituents, only: pcnst use cam_abortutils, only: handle_allocate_error use air_composition, only: dry_air_species_num use air_composition, only: thermodynamic_active_species_idx - !Local variables: + ! Local variables: integer :: ierr integer :: m character(len=*), parameter :: subname = 'ccpp_const_prop_init:' - !Allocate constituents object: + ! Allocate constituents object: allocate(ccpp_const_props(pcnst), stat=ierr) - !Check if allocation succeeded: + ! Check if allocation succeeded: call handle_allocate_error(ierr, subname, 'ccpp_const_props(pcnst)') - !Set "thermo_active" property: + ! Set "thermo_active" property: do m = 1,pcnst if(any(thermodynamic_active_species_idx == m)) then call ccpp_const_props(m)%set_thermo_active(.true.) end if end do - !Set "water_species" property: + ! Set "water_species" property: do m=1,pcnst if(any(thermodynamic_active_species_idx(dry_air_species_num+1:) == m)) then call ccpp_const_props(m)%set_water_species(.true.) diff --git a/src/utils/ccpp_kinds.F90 b/src/utils/cam_ccpp/ccpp_kinds.F90 similarity index 65% rename from src/utils/ccpp_kinds.F90 rename to src/utils/cam_ccpp/ccpp_kinds.F90 index 505001a625..c95c2b08c3 100644 --- a/src/utils/ccpp_kinds.F90 +++ b/src/utils/cam_ccpp/ccpp_kinds.F90 @@ -1,4 +1,4 @@ -! This module is a placeholder for the CCPP generated module of the same name +! This module is the CAM version of the CCPP generated module of the same name module ccpp_kinds use shr_kind_mod, only: kind_phys => shr_kind_r8 From 381269c8b72efeb832aa1d4931572e25c1f82ad6 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 13 Oct 2023 11:53:07 -0600 Subject: [PATCH 08/23] Additional Cheryl code review updates. --- Externals_CAM.cfg | 4 ++-- src/physics/cam/geopotential.F90 | 2 +- src/physics/cam/physpkg.F90 | 2 +- src/physics/cam_dev/physpkg.F90 | 2 +- src/physics/simple/held_suarez_cam.F90 | 6 ++++-- src/physics/simple/physpkg.F90 | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 2e26984125..aca9b83e22 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -55,9 +55,9 @@ tag = ALI_ARMS_v1.0.1 required = True [atmos_phys] -branch = updated_standard_names +tag = atmos_phys0_01_000 protocol = git -repo_url = https://github.com/nusbaume/atmospheric_physics +repo_url = https://github.com/NCAR/atmospheric_physics required = True local_path = src/atmos_phys diff --git a/src/physics/cam/geopotential.F90 b/src/physics/cam/geopotential.F90 index 651c190d9b..ad49e470c4 100644 --- a/src/physics/cam/geopotential.F90 +++ b/src/physics/cam/geopotential.F90 @@ -39,7 +39,7 @@ subroutine geopotential_t( & use ppgrid, only: pcols use constituents, only: pcnst, cnst_get_ind -use ccpp_constituent_prop_mod, only: ccpp_const_props !CCPP constituent properties array (stub version) +use ccpp_constituent_prop_mod, only: ccpp_const_props !CCPP constituent properties array (CAM version) use geopotential_temp, only: geopotential_temp_run !CCPP version !------------------------------Arguments-------------------------------- ! diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 7470856952..c7d5b2524b 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -980,7 +980,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) end if - ! Initialize stub CCPP constituent properties array + ! Initialize CAM CCPP constituent properties array ! for use in CCPP-ized physics schemes: call ccpp_const_props_init() diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index 9048bcd864..1c461c9a1c 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -949,7 +949,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) end if - ! Initialize stub CCPP constituent properties array + ! Initialize CAM CCPP constituent properties array ! for use in CCPP-ized physics schemes: call ccpp_const_props_init() diff --git a/src/physics/simple/held_suarez_cam.F90 b/src/physics/simple/held_suarez_cam.F90 index 52b241c337..86701daca7 100644 --- a/src/physics/simple/held_suarez_cam.F90 +++ b/src/physics/simple/held_suarez_cam.F90 @@ -104,8 +104,10 @@ subroutine held_suarez_tend(state, ptend, ztodt) ! initialize individual parameterization tendencies call physics_ptend_init(ptend, state%psetcols, 'held_suarez', ls=.true., lu=.true., lv=.true.) - call held_suarez_1994_run(pver, ncol, pref_mid_norm, clat, cappav(:,:,lchnk), cpairv(:,:,lchnk), & - state%pmid, state%u, state%v, state%t, ptend%u, ptend%v, ptend%s, & + call held_suarez_1994_run(pver, ncol, pref_mid_norm, clat, cappav(1:ncol,:,lchnk), & + cpairv(1:ncol,:,lchnk), & state%pmid(1:ncol,:), & + state%u(1:ncol,:), state%v(1:ncol,:), state%t(1:ncol,:), & + ptend%u(1:ncol,:), ptend%v(1:ncol,:), ptend%s(1:ncol,:), & scheme_name, errmsg, errflg) ! Note, we assume that there are no subcolumns in simple physics diff --git a/src/physics/simple/physpkg.F90 b/src/physics/simple/physpkg.F90 index ed97dc56b3..a296fd2fdb 100644 --- a/src/physics/simple/physpkg.F90 +++ b/src/physics/simple/physpkg.F90 @@ -279,7 +279,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call chem_init(phys_state,pbuf2d) end if - ! Initialize stub CCPP constituent properties array + ! Initialize CAM CCPP constituent properties array ! for use in CCPP-ized physics schemes: call ccpp_const_props_init() From 0013f8add777e33507fdc15e9d55f2ce59bc6b90 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 16 Oct 2023 10:07:33 -0600 Subject: [PATCH 09/23] Add missing 'ncol' bounds to CCPP physics input arguments. --- src/physics/simple/kessler_cam.F90 | 46 +++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/physics/simple/kessler_cam.F90 b/src/physics/simple/kessler_cam.F90 index c70124aa48..1831354c3f 100644 --- a/src/physics/simple/kessler_cam.F90 +++ b/src/physics/simple/kessler_cam.F90 @@ -183,68 +183,88 @@ subroutine kessler_tend(state, ptend, ztodt, pbuf) end do ! Calculate Exner function: - call calc_exner_run(ncol, pver, cpairv(:,:,lchnk), rairv(:,:,lchnk), psurf_ref, state%pmid, pk, errmsg, errflg) + call calc_exner_run(ncol, pver, cpairv(1:ncol,:,lchnk), rairv(1:ncol,:,lchnk), & + psurf_ref, state%pmid(1:ncol,:), pk(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from calc_exner_run: '//trim(errmsg)) end if ! Calculate potential temperature: - call temp_to_potential_temp_run(ncol, pver, temp, pk, th, errmsg, errflg) + call temp_to_potential_temp_run(ncol, pver, temp(1:ncol,:), pk(1:ncol,:), & + th(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from temp_to_potential_temp_run: '//trim(errmsg)) end if ! Calculate density using ideal gas law: - call calc_dry_air_ideal_gas_density_run(ncol, pver, rairv(:,:,lchnk), state%pmiddry, temp, rho, errmsg, errflg) + call calc_dry_air_ideal_gas_density_run(ncol, pver, rairv(1:ncol,:,lchnk), & + state%pmiddry(1:ncol,:), temp(1:ncol,:), & + rho(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from pres_to_density_dry_run: '//trim(errmsg)) end if ! Convert moist air mixing ratios to dry air mixing ratios: !--------------------------------------------------------- - call wet_to_dry_water_vapor_run(ncol, pver, state%pdel, state%pdeldry, qv, qv_dry, errmsg, errflg) + call wet_to_dry_water_vapor_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), qv(1:ncol,:), & + qv_dry(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from wet_to_dry_water_vapor_run: '//trim(errmsg)) end if - call wet_to_dry_cloud_liquid_water_run(ncol, pver, state%pdel, state%pdeldry, qc, qc_dry, errmsg, errflg) + call wet_to_dry_cloud_liquid_water_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), qc(1:ncol,:), & + qc_dry(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from wet_to_dry_cloud_liquid_water_run: '//trim(errmsg)) end if - call wet_to_dry_rain_run(ncol, pver, state%pdel, state%pdeldry, qr, qr_dry, errmsg, errflg) + call wet_to_dry_rain_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), qr(1:ncol,:), & + qr_dry(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from wet_to_dry_rain_run: '//trim(errmsg)) end if !--------------------------------------------------------- ! Run Kessler physics scheme: - call kessler_run(ncol, pver, ztodt, lyr_surf, lyr_toa, cpairv(:,:,lchnk), & - rairv(:,:,lchnk), rho, state%zm, pk, th, qv_dry, qc_dry, & - qr_dry, prec_sed, relhum, scheme_name, errmsg, errflg) + call kessler_run(ncol, pver, ztodt, lyr_surf, lyr_toa, cpairv(1:ncol,:,lchnk), & + rairv(1:ncol,:,lchnk), rho(1:ncol,:), state%zm(1:ncol,:), & + pk(1:ncol,:), th(1:ncol,:), qv_dry(1:ncol,:), qc_dry(1:ncol,:), & + qr_dry(1:ncol,:), prec_sed(1:ncol,:), relhum(1:ncol,:), & + scheme_name, errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from kessler_run: '//trim(errmsg)) end if ! Calculate air temperature from potential temperature: - call potential_temp_to_temp_run(ncol, pver, th, pk, temp, errmsg, errflg) + call potential_temp_to_temp_run(ncol, pver, th(1:ncol,:), pk(1:ncol,:), & + temp(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from potential_temp_to_temp_run: '//trim(errmsg)) end if ! Convert dry air mixing ratios to moist air mixing ratios: !--------------------------------------------------------- - call dry_to_wet_water_vapor_run(ncol, pver, state%pdel, state%pdeldry, qv_dry, qv, errmsg, errflg) + call dry_to_wet_water_vapor_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), qv_dry(1:ncol,:), & + qv(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from dry_to_wet_water_vapor_run: '//trim(errmsg)) end if - call dry_to_wet_cloud_liquid_water_run(ncol, pver, state%pdel, state%pdeldry, qc_dry, qc, errmsg, errflg) + call dry_to_wet_cloud_liquid_water_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), & + qc_dry(1:ncol,:), qc(1:ncol,:), errmsg, & + errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from dry_to_wet_cloud_liquid_water_run: '//trim(errmsg)) end if - call dry_to_wet_rain_run(ncol, pver, state%pdel, state%pdeldry, qr_dry, qr, errmsg, errflg) + call dry_to_wet_rain_run(ncol, pver, state%pdel(1:ncol,:), & + state%pdeldry(1:ncol,:), qr_dry(1:ncol,:), & + qr(1:ncol,:), errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from dry_to_wet_rain_run: '//trim(errmsg)) end if From 314e57bb29b5dbb81295e87f4c43d4087a2410f4 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 27 Oct 2023 09:04:43 -0600 Subject: [PATCH 10/23] Additional code review updates. --- src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 index 1afe3cc75b..0f9352df5d 100644 --- a/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 +++ b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 @@ -67,7 +67,7 @@ subroutine ccp_is_thermo_active(this, val_out, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Still Not Used!' + errmsg = 'Not Used!' end if end subroutine ccp_is_thermo_active @@ -90,7 +90,7 @@ subroutine ccp_is_water_species(this, val_out, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Still Not Used!' + errmsg = 'Not Used!' end if end subroutine ccp_is_water_species @@ -116,7 +116,7 @@ subroutine ccp_set_thermo_active(this, thermo_flag, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Still Not Used!' + errmsg = 'Not Used!' end if end subroutine ccp_set_thermo_active @@ -142,7 +142,7 @@ subroutine ccp_set_water_species(this, water_flag, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Still Not Used!' + errmsg = 'Not Used!' end if end subroutine ccp_set_water_species From 8b72ec91225e1262d897235198e019e87ef8a7ae Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 27 Oct 2023 09:11:08 -0600 Subject: [PATCH 11/23] Switch atmospheric_physics external to the new ESCOMP URL. --- Externals_CAM.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index aca9b83e22..95f77d01af 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -57,7 +57,7 @@ required = True [atmos_phys] tag = atmos_phys0_01_000 protocol = git -repo_url = https://github.com/NCAR/atmospheric_physics +repo_url = https://github.com/ESCOMP/atmospheric_physics required = True local_path = src/atmos_phys From 317d98a1cc11b7df650587bdb02aea801901f183 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 16 Oct 2023 12:10:30 -0400 Subject: [PATCH 12/23] Rename SE dycore time_mod to dyn_time_mod This commit renames time_mod in the SE dycore to dyn_time_mod in order to avoid naming conflicts with building with GEOS-Chem. All USE statements updated; zero differences in run output are expected. --- src/dynamics/se/dp_coupling.F90 | 2 +- src/dynamics/se/dycore/{time_mod.F90 => dyn_time_mod.F90} | 4 ++-- src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 | 2 +- src/dynamics/se/dycore/prim_advance_mod.F90 | 2 +- src/dynamics/se/dycore/prim_advection_mod.F90 | 2 +- src/dynamics/se/dycore/prim_driver_mod.F90 | 8 ++++---- src/dynamics/se/dycore/prim_init.F90 | 2 +- src/dynamics/se/dycore/prim_state_mod.F90 | 8 ++++---- src/dynamics/se/dyn_comp.F90 | 6 +++--- src/dynamics/se/dyn_grid.F90 | 4 ++-- src/dynamics/se/restart_dynamics.F90 | 2 +- src/dynamics/se/stepon.F90 | 8 ++++---- 12 files changed, 25 insertions(+), 25 deletions(-) rename src/dynamics/se/dycore/{time_mod.F90 => dyn_time_mod.F90} (98%) diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index 1d9fe6a83e..466188300d 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -54,7 +54,7 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) use phys_control, only: use_gw_front, use_gw_front_igw use hycoef, only: hyai, ps0 use fvm_mapping, only: dyn2phys_vector, dyn2phys_all_vars - use time_mod, only: timelevel_qdp + use dyn_time_mod, only: timelevel_qdp use control_mod, only: qsplit use test_fvm_mapping, only: test_mapping_overwrite_dyn_state, test_mapping_output_phys_state use prim_advance_mod, only: tot_energy_dyn diff --git a/src/dynamics/se/dycore/time_mod.F90 b/src/dynamics/se/dycore/dyn_time_mod.F90 similarity index 98% rename from src/dynamics/se/dycore/time_mod.F90 rename to src/dynamics/se/dycore/dyn_time_mod.F90 index fdd68af06a..c52fd1fcfa 100644 --- a/src/dynamics/se/dycore/time_mod.F90 +++ b/src/dynamics/se/dycore/dyn_time_mod.F90 @@ -1,4 +1,4 @@ -module time_mod +module dyn_time_mod !------------------ use shr_kind_mod, only: r8=>shr_kind_r8 !------------------ @@ -132,4 +132,4 @@ subroutine TimeLevel_update(tl,uptype) !$OMP BARRIER end subroutine TimeLevel_update -end module time_mod +end module dyn_time_mod diff --git a/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 b/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 index b5bcebd845..2492b00e88 100644 --- a/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 +++ b/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 @@ -6,7 +6,7 @@ module fvm_consistent_se_cslam use cam_abortutils, only: endrun use cam_logfile, only: iulog - use time_mod, only: timelevel_t + use dyn_time_mod, only: timelevel_t use element_mod, only: element_t use fvm_control_volume_mod, only: fvm_struct use hybrid_mod, only: hybrid_t, config_thread_region, get_loop_ranges, threadOwnsVertLevel diff --git a/src/dynamics/se/dycore/prim_advance_mod.F90 b/src/dynamics/se/dycore/prim_advance_mod.F90 index 1246b77e34..e244878654 100644 --- a/src/dynamics/se/dycore/prim_advance_mod.F90 +++ b/src/dynamics/se/dycore/prim_advance_mod.F90 @@ -53,7 +53,7 @@ subroutine prim_advance_exp(elem, fvm, deriv, hvcoord, hybrid,dt, tl, nets, net use element_mod, only: element_t use hybvcoord_mod, only: hvcoord_t use hybrid_mod, only: hybrid_t - use time_mod, only: TimeLevel_t, timelevel_qdp, tevolve + use dyn_time_mod, only: TimeLevel_t, timelevel_qdp, tevolve use fvm_control_volume_mod, only: fvm_struct use cam_thermo, only: get_kappa_dry use air_composition, only: thermodynamic_active_species_num diff --git a/src/dynamics/se/dycore/prim_advection_mod.F90 b/src/dynamics/se/dycore/prim_advection_mod.F90 index 7c54abc2cd..09d0c6ed78 100644 --- a/src/dynamics/se/dycore/prim_advection_mod.F90 +++ b/src/dynamics/se/dycore/prim_advection_mod.F90 @@ -23,7 +23,7 @@ module prim_advection_mod use element_mod, only: element_t use fvm_control_volume_mod, only: fvm_struct use hybvcoord_mod, only: hvcoord_t - use time_mod, only: TimeLevel_t, TimeLevel_Qdp + use dyn_time_mod, only: TimeLevel_t, TimeLevel_Qdp use control_mod, only: nu_q, nu_p, limiter_option, hypervis_subcycle_q, rsplit use edge_mod, only: edgevpack, edgevunpack, initedgebuffer, initedgesbuffer diff --git a/src/dynamics/se/dycore/prim_driver_mod.F90 b/src/dynamics/se/dycore/prim_driver_mod.F90 index af22869f24..baf62b455c 100644 --- a/src/dynamics/se/dycore/prim_driver_mod.F90 +++ b/src/dynamics/se/dycore/prim_driver_mod.F90 @@ -28,8 +28,8 @@ subroutine prim_init2(elem, fvm, hybrid, nets, nete, tl, hvcoord) use dimensions_mod, only: irecons_tracer, fvm_supercycling use dimensions_mod, only: fv_nphys, nc use parallel_mod, only: syncmp - use time_mod, only: timelevel_t, tstep, phys_tscale, nsplit, TimeLevel_Qdp - use time_mod, only: nsplit_baseline,rsplit_baseline + use dyn_time_mod, only: timelevel_t, tstep, phys_tscale, nsplit, TimeLevel_Qdp + use dyn_time_mod, only: nsplit_baseline,rsplit_baseline use prim_state_mod, only: prim_printstate use control_mod, only: runtype, topology, rsplit, qsplit, rk_stage_user, & nu, nu_q, nu_div, hypervis_subcycle, hypervis_subcycle_q, & @@ -218,7 +218,7 @@ subroutine prim_run_subcycle(elem, fvm, hybrid,nets,nete, dt, tl, hvcoord,nsubst ! ! use hybvcoord_mod, only : hvcoord_t - use time_mod, only: TimeLevel_t, timelevel_update, timelevel_qdp, nsplit + use dyn_time_mod, only: TimeLevel_t, timelevel_update, timelevel_qdp, nsplit use control_mod, only: statefreq,qsplit, rsplit, variable_nsplit use prim_advance_mod, only: applycamforcing use prim_advance_mod, only: tot_energy_dyn,compute_omega @@ -407,7 +407,7 @@ subroutine prim_step(elem, fvm, hybrid,nets,nete, dt, tl, hvcoord, rstep) ! tl%n0 time t + dt_q ! use hybvcoord_mod, only: hvcoord_t - use time_mod, only: TimeLevel_t, timelevel_update + use dyn_time_mod, only: TimeLevel_t, timelevel_update use control_mod, only: statefreq, qsplit, nu_p use thread_mod, only: omp_get_thread_num use prim_advance_mod, only: prim_advance_exp diff --git a/src/dynamics/se/dycore/prim_init.F90 b/src/dynamics/se/dycore/prim_init.F90 index afbd94869e..007aab79ac 100644 --- a/src/dynamics/se/dycore/prim_init.F90 +++ b/src/dynamics/se/dycore/prim_init.F90 @@ -28,7 +28,7 @@ subroutine prim_init1(elem, fvm, par, Tl) use element_mod, only: element_t, allocate_element_desc use fvm_mod, only: fvm_init1 use mesh_mod, only: MeshUseMeshFile - use time_mod, only: timelevel_init, timelevel_t + use dyn_time_mod, only: timelevel_init, timelevel_t use mass_matrix_mod, only: mass_matrix use derivative_mod, only: allocate_subcell_integration_matrix_cslam use derivative_mod, only: allocate_subcell_integration_matrix_physgrid diff --git a/src/dynamics/se/dycore/prim_state_mod.F90 b/src/dynamics/se/dycore/prim_state_mod.F90 index 2f4bcbb2db..be6046c829 100644 --- a/src/dynamics/se/dycore/prim_state_mod.F90 +++ b/src/dynamics/se/dycore/prim_state_mod.F90 @@ -4,7 +4,7 @@ module prim_state_mod use dimensions_mod, only: nlev, np, nc, qsize_d, ntrac_d use parallel_mod, only: ordered use hybrid_mod, only: hybrid_t - use time_mod, only: timelevel_t, TimeLevel_Qdp, time_at + use dyn_time_mod, only: timelevel_t, TimeLevel_Qdp, time_at use control_mod, only: qsplit, statediag_numtrac use global_norms_mod, only: global_integrals_general use element_mod, only: element_t @@ -24,7 +24,7 @@ subroutine prim_printstate(elem, tl,hybrid,nets,nete, fvm, omega_cn) use air_composition, only: thermodynamic_active_species_idx_dycore, dry_air_species_num use air_composition, only: thermodynamic_active_species_num,thermodynamic_active_species_idx use cam_control_mod, only: initial_run - use time_mod, only: tstep + use dyn_time_mod, only: tstep use control_mod, only: rsplit, qsplit use perf_mod, only: t_startf, t_stopf type (element_t), intent(inout) :: elem(:) @@ -345,10 +345,10 @@ end subroutine prim_printstate_cslam_gamma subroutine adjust_nsplit(elem, tl,hybrid,nets,nete, fvm, omega_cn) use dimensions_mod, only: ksponge_end use dimensions_mod, only: fvm_supercycling, fvm_supercycling_jet - use time_mod, only: tstep + use dyn_time_mod, only: tstep use control_mod, only: rsplit, qsplit use perf_mod, only: t_startf, t_stopf - use time_mod, only: nsplit, nsplit_baseline,rsplit_baseline + use dyn_time_mod, only: nsplit, nsplit_baseline,rsplit_baseline use control_mod, only: qsplit, rsplit use time_manager, only: get_step_size use cam_abortutils, only: endrun diff --git a/src/dynamics/se/dyn_comp.F90 b/src/dynamics/se/dyn_comp.F90 index ac46b8cc46..9d833c5741 100644 --- a/src/dynamics/se/dyn_comp.F90 +++ b/src/dynamics/se/dyn_comp.F90 @@ -42,7 +42,7 @@ module dyn_comp use dimensions_mod, only: qsize, use_cslam use element_mod, only: element_t, elem_state_t use fvm_control_volume_mod, only: fvm_struct -use time_mod, only: nsplit +use dyn_time_mod, only: nsplit use edge_mod, only: initEdgeBuffer, edgeVpack, edgeVunpack, FreeEdgeBuffer use edgetype_mod, only: EdgeBuffer_t use bndry_mod, only: bndry_exchange @@ -963,11 +963,11 @@ subroutine dyn_run(dyn_state) use air_composition, only: thermodynamic_active_species_idx_dycore use prim_driver_mod, only: prim_run_subcycle use dimensions_mod, only: cnst_name_gll - use time_mod, only: tstep, nsplit, timelevel_qdp + use dyn_time_mod, only: tstep, nsplit, timelevel_qdp use hybrid_mod, only: config_thread_region, get_loop_ranges use control_mod, only: qsplit, rsplit, ftype_conserve use thread_mod, only: horz_num_threads - use time_mod, only: tevolve + use dyn_time_mod, only: tevolve type(dyn_export_t), intent(inout) :: dyn_state diff --git a/src/dynamics/se/dyn_grid.F90 b/src/dynamics/se/dyn_grid.F90 index 766fb893d7..878db42e43 100644 --- a/src/dynamics/se/dyn_grid.F90 +++ b/src/dynamics/se/dyn_grid.F90 @@ -48,7 +48,7 @@ module dyn_grid use prim_init, only: prim_init1 use edge_mod, only: initEdgeBuffer use edgetype_mod, only: EdgeBuffer_t -use time_mod, only: TimeLevel_t +use dyn_time_mod, only: TimeLevel_t use dof_mod, only: UniqueCoords, UniquePoints implicit none @@ -133,7 +133,7 @@ subroutine dyn_grid_init() use hybrid_mod, only: hybrid_t, init_loop_ranges, & get_loop_ranges, config_thread_region use control_mod, only: qsplit, rsplit - use time_mod, only: tstep, nsplit + use dyn_time_mod, only: tstep, nsplit use fvm_mod, only: fvm_init2, fvm_init3, fvm_pg_init use dimensions_mod, only: irecons_tracer use comp_gll_ctr_vol, only: gll_grid_write diff --git a/src/dynamics/se/restart_dynamics.F90 b/src/dynamics/se/restart_dynamics.F90 index f5b3c6a0d8..c2ea4d4f5b 100644 --- a/src/dynamics/se/restart_dynamics.F90 +++ b/src/dynamics/se/restart_dynamics.F90 @@ -46,7 +46,7 @@ module restart_dynamics use dimensions_mod, only: np, npsq, ne, nlev, qsize, nelemd, nc, ntrac, use_cslam use dof_mod, only: UniquePoints use element_mod, only: element_t -use time_mod, only: tstep, TimeLevel_Qdp +use dyn_time_mod, only: tstep, TimeLevel_Qdp use edge_mod, only: initEdgeBuffer, edgeVpack, edgeVunpack, FreeEdgeBuffer use edgetype_mod, only: EdgeBuffer_t diff --git a/src/dynamics/se/stepon.F90 b/src/dynamics/se/stepon.F90 index 88dda66c3d..719428808b 100644 --- a/src/dynamics/se/stepon.F90 +++ b/src/dynamics/se/stepon.F90 @@ -99,7 +99,7 @@ subroutine stepon_run1( dtime_out, phys_state, phys_tend, & use dp_coupling, only: d_p_coupling use physics_buffer, only: physics_buffer_desc - use time_mod, only: tstep ! dynamics timestep + use dyn_time_mod, only: tstep ! dynamics timestep real(r8), intent(out) :: dtime_out ! Time-step type(physics_state), intent(inout) :: phys_state(begchunk:endchunk) @@ -152,7 +152,7 @@ subroutine stepon_run2(phys_state, phys_tend, dyn_in, dyn_out) use dp_coupling, only: p_d_coupling use dyn_grid, only: TimeLevel - use time_mod, only: TimeLevel_Qdp + use dyn_time_mod, only: TimeLevel_Qdp use control_mod, only: qsplit use prim_advance_mod, only: tot_energy_dyn @@ -207,7 +207,7 @@ subroutine stepon_run3(dtime, cam_out, phys_state, dyn_in, dyn_out) use dyn_comp, only: dyn_run use advect_tend, only: compute_adv_tends_xyz use dyn_grid, only: TimeLevel - use time_mod, only: TimeLevel_Qdp + use dyn_time_mod, only: TimeLevel_Qdp use control_mod, only: qsplit ! arguments real(r8), intent(in) :: dtime ! Time-step @@ -254,7 +254,7 @@ subroutine diag_dynvar_ic(elem, fvm) use cam_history, only: write_inithist, outfld, hist_fld_active, fieldname_len use dyn_grid, only: TimeLevel - use time_mod, only: TimeLevel_Qdp ! dynamics typestep + use dyn_time_mod, only: TimeLevel_Qdp ! dynamics typestep use control_mod, only: qsplit use hybrid_mod, only: config_thread_region, get_loop_ranges use hybrid_mod, only: hybrid_t From 358fda7f3d8d9f4950369fb22cff394046cb3cf0 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 18 Oct 2023 19:34:51 -0400 Subject: [PATCH 13/23] Rename to se_dyn_time_mod instead of dyn_time_mod Signed-off-by: Haipeng Lin --- src/dynamics/se/dp_coupling.F90 | 2 +- src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 | 2 +- src/dynamics/se/dycore/prim_advance_mod.F90 | 2 +- src/dynamics/se/dycore/prim_advection_mod.F90 | 2 +- src/dynamics/se/dycore/prim_driver_mod.F90 | 8 ++++---- src/dynamics/se/dycore/prim_init.F90 | 2 +- src/dynamics/se/dycore/prim_state_mod.F90 | 8 ++++---- .../se/dycore/{dyn_time_mod.F90 => se_dyn_time_mod.F90} | 4 ++-- src/dynamics/se/dyn_comp.F90 | 6 +++--- src/dynamics/se/dyn_grid.F90 | 4 ++-- src/dynamics/se/restart_dynamics.F90 | 2 +- src/dynamics/se/stepon.F90 | 8 ++++---- 12 files changed, 25 insertions(+), 25 deletions(-) rename src/dynamics/se/dycore/{dyn_time_mod.F90 => se_dyn_time_mod.F90} (98%) diff --git a/src/dynamics/se/dp_coupling.F90 b/src/dynamics/se/dp_coupling.F90 index 466188300d..61b7fc54e9 100644 --- a/src/dynamics/se/dp_coupling.F90 +++ b/src/dynamics/se/dp_coupling.F90 @@ -54,7 +54,7 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) use phys_control, only: use_gw_front, use_gw_front_igw use hycoef, only: hyai, ps0 use fvm_mapping, only: dyn2phys_vector, dyn2phys_all_vars - use dyn_time_mod, only: timelevel_qdp + use se_dyn_time_mod, only: timelevel_qdp use control_mod, only: qsplit use test_fvm_mapping, only: test_mapping_overwrite_dyn_state, test_mapping_output_phys_state use prim_advance_mod, only: tot_energy_dyn diff --git a/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 b/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 index 2492b00e88..5da18d76b8 100644 --- a/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 +++ b/src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 @@ -6,7 +6,7 @@ module fvm_consistent_se_cslam use cam_abortutils, only: endrun use cam_logfile, only: iulog - use dyn_time_mod, only: timelevel_t + use se_dyn_time_mod, only: timelevel_t use element_mod, only: element_t use fvm_control_volume_mod, only: fvm_struct use hybrid_mod, only: hybrid_t, config_thread_region, get_loop_ranges, threadOwnsVertLevel diff --git a/src/dynamics/se/dycore/prim_advance_mod.F90 b/src/dynamics/se/dycore/prim_advance_mod.F90 index e244878654..ed7a627ec4 100644 --- a/src/dynamics/se/dycore/prim_advance_mod.F90 +++ b/src/dynamics/se/dycore/prim_advance_mod.F90 @@ -53,7 +53,7 @@ subroutine prim_advance_exp(elem, fvm, deriv, hvcoord, hybrid,dt, tl, nets, net use element_mod, only: element_t use hybvcoord_mod, only: hvcoord_t use hybrid_mod, only: hybrid_t - use dyn_time_mod, only: TimeLevel_t, timelevel_qdp, tevolve + use se_dyn_time_mod, only: TimeLevel_t, timelevel_qdp, tevolve use fvm_control_volume_mod, only: fvm_struct use cam_thermo, only: get_kappa_dry use air_composition, only: thermodynamic_active_species_num diff --git a/src/dynamics/se/dycore/prim_advection_mod.F90 b/src/dynamics/se/dycore/prim_advection_mod.F90 index 09d0c6ed78..17ad85ba61 100644 --- a/src/dynamics/se/dycore/prim_advection_mod.F90 +++ b/src/dynamics/se/dycore/prim_advection_mod.F90 @@ -23,7 +23,7 @@ module prim_advection_mod use element_mod, only: element_t use fvm_control_volume_mod, only: fvm_struct use hybvcoord_mod, only: hvcoord_t - use dyn_time_mod, only: TimeLevel_t, TimeLevel_Qdp + use se_dyn_time_mod, only: TimeLevel_t, TimeLevel_Qdp use control_mod, only: nu_q, nu_p, limiter_option, hypervis_subcycle_q, rsplit use edge_mod, only: edgevpack, edgevunpack, initedgebuffer, initedgesbuffer diff --git a/src/dynamics/se/dycore/prim_driver_mod.F90 b/src/dynamics/se/dycore/prim_driver_mod.F90 index baf62b455c..6cfb52e356 100644 --- a/src/dynamics/se/dycore/prim_driver_mod.F90 +++ b/src/dynamics/se/dycore/prim_driver_mod.F90 @@ -28,8 +28,8 @@ subroutine prim_init2(elem, fvm, hybrid, nets, nete, tl, hvcoord) use dimensions_mod, only: irecons_tracer, fvm_supercycling use dimensions_mod, only: fv_nphys, nc use parallel_mod, only: syncmp - use dyn_time_mod, only: timelevel_t, tstep, phys_tscale, nsplit, TimeLevel_Qdp - use dyn_time_mod, only: nsplit_baseline,rsplit_baseline + use se_dyn_time_mod, only: timelevel_t, tstep, phys_tscale, nsplit, TimeLevel_Qdp + use se_dyn_time_mod, only: nsplit_baseline,rsplit_baseline use prim_state_mod, only: prim_printstate use control_mod, only: runtype, topology, rsplit, qsplit, rk_stage_user, & nu, nu_q, nu_div, hypervis_subcycle, hypervis_subcycle_q, & @@ -218,7 +218,7 @@ subroutine prim_run_subcycle(elem, fvm, hybrid,nets,nete, dt, tl, hvcoord,nsubst ! ! use hybvcoord_mod, only : hvcoord_t - use dyn_time_mod, only: TimeLevel_t, timelevel_update, timelevel_qdp, nsplit + use se_dyn_time_mod, only: TimeLevel_t, timelevel_update, timelevel_qdp, nsplit use control_mod, only: statefreq,qsplit, rsplit, variable_nsplit use prim_advance_mod, only: applycamforcing use prim_advance_mod, only: tot_energy_dyn,compute_omega @@ -407,7 +407,7 @@ subroutine prim_step(elem, fvm, hybrid,nets,nete, dt, tl, hvcoord, rstep) ! tl%n0 time t + dt_q ! use hybvcoord_mod, only: hvcoord_t - use dyn_time_mod, only: TimeLevel_t, timelevel_update + use se_dyn_time_mod, only: TimeLevel_t, timelevel_update use control_mod, only: statefreq, qsplit, nu_p use thread_mod, only: omp_get_thread_num use prim_advance_mod, only: prim_advance_exp diff --git a/src/dynamics/se/dycore/prim_init.F90 b/src/dynamics/se/dycore/prim_init.F90 index 007aab79ac..42a336f65c 100644 --- a/src/dynamics/se/dycore/prim_init.F90 +++ b/src/dynamics/se/dycore/prim_init.F90 @@ -28,7 +28,7 @@ subroutine prim_init1(elem, fvm, par, Tl) use element_mod, only: element_t, allocate_element_desc use fvm_mod, only: fvm_init1 use mesh_mod, only: MeshUseMeshFile - use dyn_time_mod, only: timelevel_init, timelevel_t + use se_dyn_time_mod, only: timelevel_init, timelevel_t use mass_matrix_mod, only: mass_matrix use derivative_mod, only: allocate_subcell_integration_matrix_cslam use derivative_mod, only: allocate_subcell_integration_matrix_physgrid diff --git a/src/dynamics/se/dycore/prim_state_mod.F90 b/src/dynamics/se/dycore/prim_state_mod.F90 index be6046c829..3075c0e125 100644 --- a/src/dynamics/se/dycore/prim_state_mod.F90 +++ b/src/dynamics/se/dycore/prim_state_mod.F90 @@ -4,7 +4,7 @@ module prim_state_mod use dimensions_mod, only: nlev, np, nc, qsize_d, ntrac_d use parallel_mod, only: ordered use hybrid_mod, only: hybrid_t - use dyn_time_mod, only: timelevel_t, TimeLevel_Qdp, time_at + use se_dyn_time_mod, only: timelevel_t, TimeLevel_Qdp, time_at use control_mod, only: qsplit, statediag_numtrac use global_norms_mod, only: global_integrals_general use element_mod, only: element_t @@ -24,7 +24,7 @@ subroutine prim_printstate(elem, tl,hybrid,nets,nete, fvm, omega_cn) use air_composition, only: thermodynamic_active_species_idx_dycore, dry_air_species_num use air_composition, only: thermodynamic_active_species_num,thermodynamic_active_species_idx use cam_control_mod, only: initial_run - use dyn_time_mod, only: tstep + use se_dyn_time_mod, only: tstep use control_mod, only: rsplit, qsplit use perf_mod, only: t_startf, t_stopf type (element_t), intent(inout) :: elem(:) @@ -345,10 +345,10 @@ end subroutine prim_printstate_cslam_gamma subroutine adjust_nsplit(elem, tl,hybrid,nets,nete, fvm, omega_cn) use dimensions_mod, only: ksponge_end use dimensions_mod, only: fvm_supercycling, fvm_supercycling_jet - use dyn_time_mod, only: tstep + use se_dyn_time_mod, only: tstep use control_mod, only: rsplit, qsplit use perf_mod, only: t_startf, t_stopf - use dyn_time_mod, only: nsplit, nsplit_baseline,rsplit_baseline + use se_dyn_time_mod, only: nsplit, nsplit_baseline,rsplit_baseline use control_mod, only: qsplit, rsplit use time_manager, only: get_step_size use cam_abortutils, only: endrun diff --git a/src/dynamics/se/dycore/dyn_time_mod.F90 b/src/dynamics/se/dycore/se_dyn_time_mod.F90 similarity index 98% rename from src/dynamics/se/dycore/dyn_time_mod.F90 rename to src/dynamics/se/dycore/se_dyn_time_mod.F90 index c52fd1fcfa..4dfd981661 100644 --- a/src/dynamics/se/dycore/dyn_time_mod.F90 +++ b/src/dynamics/se/dycore/se_dyn_time_mod.F90 @@ -1,4 +1,4 @@ -module dyn_time_mod +module se_dyn_time_mod !------------------ use shr_kind_mod, only: r8=>shr_kind_r8 !------------------ @@ -132,4 +132,4 @@ subroutine TimeLevel_update(tl,uptype) !$OMP BARRIER end subroutine TimeLevel_update -end module dyn_time_mod +end module se_dyn_time_mod diff --git a/src/dynamics/se/dyn_comp.F90 b/src/dynamics/se/dyn_comp.F90 index 9d833c5741..312349eb44 100644 --- a/src/dynamics/se/dyn_comp.F90 +++ b/src/dynamics/se/dyn_comp.F90 @@ -42,7 +42,7 @@ module dyn_comp use dimensions_mod, only: qsize, use_cslam use element_mod, only: element_t, elem_state_t use fvm_control_volume_mod, only: fvm_struct -use dyn_time_mod, only: nsplit +use se_dyn_time_mod, only: nsplit use edge_mod, only: initEdgeBuffer, edgeVpack, edgeVunpack, FreeEdgeBuffer use edgetype_mod, only: EdgeBuffer_t use bndry_mod, only: bndry_exchange @@ -963,11 +963,11 @@ subroutine dyn_run(dyn_state) use air_composition, only: thermodynamic_active_species_idx_dycore use prim_driver_mod, only: prim_run_subcycle use dimensions_mod, only: cnst_name_gll - use dyn_time_mod, only: tstep, nsplit, timelevel_qdp + use se_dyn_time_mod, only: tstep, nsplit, timelevel_qdp use hybrid_mod, only: config_thread_region, get_loop_ranges use control_mod, only: qsplit, rsplit, ftype_conserve use thread_mod, only: horz_num_threads - use dyn_time_mod, only: tevolve + use se_dyn_time_mod, only: tevolve type(dyn_export_t), intent(inout) :: dyn_state diff --git a/src/dynamics/se/dyn_grid.F90 b/src/dynamics/se/dyn_grid.F90 index 878db42e43..293f7402dd 100644 --- a/src/dynamics/se/dyn_grid.F90 +++ b/src/dynamics/se/dyn_grid.F90 @@ -48,7 +48,7 @@ module dyn_grid use prim_init, only: prim_init1 use edge_mod, only: initEdgeBuffer use edgetype_mod, only: EdgeBuffer_t -use dyn_time_mod, only: TimeLevel_t +use se_dyn_time_mod, only: TimeLevel_t use dof_mod, only: UniqueCoords, UniquePoints implicit none @@ -133,7 +133,7 @@ subroutine dyn_grid_init() use hybrid_mod, only: hybrid_t, init_loop_ranges, & get_loop_ranges, config_thread_region use control_mod, only: qsplit, rsplit - use dyn_time_mod, only: tstep, nsplit + use se_dyn_time_mod, only: tstep, nsplit use fvm_mod, only: fvm_init2, fvm_init3, fvm_pg_init use dimensions_mod, only: irecons_tracer use comp_gll_ctr_vol, only: gll_grid_write diff --git a/src/dynamics/se/restart_dynamics.F90 b/src/dynamics/se/restart_dynamics.F90 index c2ea4d4f5b..0c630c9336 100644 --- a/src/dynamics/se/restart_dynamics.F90 +++ b/src/dynamics/se/restart_dynamics.F90 @@ -46,7 +46,7 @@ module restart_dynamics use dimensions_mod, only: np, npsq, ne, nlev, qsize, nelemd, nc, ntrac, use_cslam use dof_mod, only: UniquePoints use element_mod, only: element_t -use dyn_time_mod, only: tstep, TimeLevel_Qdp +use se_dyn_time_mod, only: tstep, TimeLevel_Qdp use edge_mod, only: initEdgeBuffer, edgeVpack, edgeVunpack, FreeEdgeBuffer use edgetype_mod, only: EdgeBuffer_t diff --git a/src/dynamics/se/stepon.F90 b/src/dynamics/se/stepon.F90 index 719428808b..60e73a0ece 100644 --- a/src/dynamics/se/stepon.F90 +++ b/src/dynamics/se/stepon.F90 @@ -99,7 +99,7 @@ subroutine stepon_run1( dtime_out, phys_state, phys_tend, & use dp_coupling, only: d_p_coupling use physics_buffer, only: physics_buffer_desc - use dyn_time_mod, only: tstep ! dynamics timestep + use se_dyn_time_mod,only: tstep ! dynamics timestep real(r8), intent(out) :: dtime_out ! Time-step type(physics_state), intent(inout) :: phys_state(begchunk:endchunk) @@ -152,7 +152,7 @@ subroutine stepon_run2(phys_state, phys_tend, dyn_in, dyn_out) use dp_coupling, only: p_d_coupling use dyn_grid, only: TimeLevel - use dyn_time_mod, only: TimeLevel_Qdp + use se_dyn_time_mod, only: TimeLevel_Qdp use control_mod, only: qsplit use prim_advance_mod, only: tot_energy_dyn @@ -207,7 +207,7 @@ subroutine stepon_run3(dtime, cam_out, phys_state, dyn_in, dyn_out) use dyn_comp, only: dyn_run use advect_tend, only: compute_adv_tends_xyz use dyn_grid, only: TimeLevel - use dyn_time_mod, only: TimeLevel_Qdp + use se_dyn_time_mod,only: TimeLevel_Qdp use control_mod, only: qsplit ! arguments real(r8), intent(in) :: dtime ! Time-step @@ -254,7 +254,7 @@ subroutine diag_dynvar_ic(elem, fvm) use cam_history, only: write_inithist, outfld, hist_fld_active, fieldname_len use dyn_grid, only: TimeLevel - use dyn_time_mod, only: TimeLevel_Qdp ! dynamics typestep + use se_dyn_time_mod, only: TimeLevel_Qdp ! dynamics typestep use control_mod, only: qsplit use hybrid_mod, only: config_thread_region, get_loop_ranges use hybrid_mod, only: hybrid_t From a75745037db586217767137713f88c8b7e6abd29 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Fri, 27 Oct 2023 09:36:16 -0600 Subject: [PATCH 14/23] Update 'errmsg' strings to be empty for CAM-specific CCPP routines. --- src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 index 0f9352df5d..edbc4d59e9 100644 --- a/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 +++ b/src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 @@ -67,7 +67,7 @@ subroutine ccp_is_thermo_active(this, val_out, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Not Used!' + errmsg = '' end if end subroutine ccp_is_thermo_active @@ -90,7 +90,7 @@ subroutine ccp_is_water_species(this, val_out, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Not Used!' + errmsg = '' end if end subroutine ccp_is_water_species @@ -116,7 +116,7 @@ subroutine ccp_set_thermo_active(this, thermo_flag, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Not Used!' + errmsg = '' end if end subroutine ccp_set_thermo_active @@ -142,7 +142,7 @@ subroutine ccp_set_water_species(this, water_flag, errcode, errmsg) errcode = 0 end if if(present(errmsg)) then - errmsg = 'Not Used!' + errmsg = '' end if end subroutine ccp_set_water_species From 95cf22414ea3b412c2301b4cd0bd24bcad40b93b Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 30 Oct 2023 12:48:21 -0600 Subject: [PATCH 15/23] Fix dimension error in Kessler 'prec_sed' argument. --- src/physics/simple/kessler_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/simple/kessler_cam.F90 b/src/physics/simple/kessler_cam.F90 index 1831354c3f..93e961cd97 100644 --- a/src/physics/simple/kessler_cam.F90 +++ b/src/physics/simple/kessler_cam.F90 @@ -232,7 +232,7 @@ subroutine kessler_tend(state, ptend, ztodt, pbuf) call kessler_run(ncol, pver, ztodt, lyr_surf, lyr_toa, cpairv(1:ncol,:,lchnk), & rairv(1:ncol,:,lchnk), rho(1:ncol,:), state%zm(1:ncol,:), & pk(1:ncol,:), th(1:ncol,:), qv_dry(1:ncol,:), qc_dry(1:ncol,:), & - qr_dry(1:ncol,:), prec_sed(1:ncol,:), relhum(1:ncol,:), & + qr_dry(1:ncol,:), prec_sed(1:ncol), relhum(1:ncol,:), & scheme_name, errmsg, errflg) if (errflg /=0) then call endrun('kessler_tend error: Error returned from kessler_run: '//trim(errmsg)) From 6a5af17410b5b213d310994dc92d2aa913316909 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 30 Oct 2023 13:49:16 -0600 Subject: [PATCH 16/23] Remove badly-placed line continuation character. --- src/physics/simple/held_suarez_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/simple/held_suarez_cam.F90 b/src/physics/simple/held_suarez_cam.F90 index 86701daca7..78def4b354 100644 --- a/src/physics/simple/held_suarez_cam.F90 +++ b/src/physics/simple/held_suarez_cam.F90 @@ -105,7 +105,7 @@ subroutine held_suarez_tend(state, ptend, ztodt) call physics_ptend_init(ptend, state%psetcols, 'held_suarez', ls=.true., lu=.true., lv=.true.) call held_suarez_1994_run(pver, ncol, pref_mid_norm, clat, cappav(1:ncol,:,lchnk), & - cpairv(1:ncol,:,lchnk), & state%pmid(1:ncol,:), & + cpairv(1:ncol,:,lchnk), state%pmid(1:ncol,:), & state%u(1:ncol,:), state%v(1:ncol,:), state%t(1:ncol,:), & ptend%u(1:ncol,:), ptend%v(1:ncol,:), ptend%s(1:ncol,:), & scheme_name, errmsg, errflg) From 9cbff99ae73f346a3e62d48d8093c9f3b3a11471 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 31 Oct 2023 10:47:21 -0600 Subject: [PATCH 17/23] Update ChangeLog. --- doc/ChangeLog | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4a2c43d13f..7e45ac811b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,133 @@ =============================================================== +Tag name: cam6_3_134 +Originator(s): nusbaume, jimmielin +Date: 31 Oct 2023 +One-line Summary: Update atmospheric_physics external +Github PR URL: https://github.com/ESCOMP/CAM/pull/891 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +This PR updates the atmospheric_physics external in CAM, +which requires some source modifications on the CAM-side. +There has also been some replacement of CAM code with CCPP +physics routines in order to reduce duplication. + +This PR also fixes a bug found in Kessler where it was using +the wrong pressure when converting to/from potential temperature +via the exner function. + +Finally, this change also brings in a rename of the SE +dycore's 'time_mod' module to 'se_dyn_time_mod' in order +to avoid name collision with GEOS-Chem code. + +Fixes #752 -> Update atmospheric_physics external +Fixes #802 -> Kessler physics using inconsistent reference pressures + +Closes #904 -> Rename SE dycore time_mod to dyn_time_mod (PR) + +Describe any changes made to build system: + +Added the "src/utils/cam_ccpp" and "src/atmos_phys/utilities" directory +to the list of directories used during compilation. + +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: cacraigucar, PeterHjortLauritzen, jtruesdal, peverwhee + +List all files eliminated: + +R src/dynamics/se/dycore/time_mod.F90 + - Renamed to 'se_dyn_time_mod' +R src/utils/ccpp_kinds.F90 + - Moved to 'src/utils/cam_ccpp/ccpp_kinds.F90' + +List all files added and what they do: + +A src/utils/cam_ccpp/ccpp_constituent_prop_mod.F90 + - Creates a "CCPP Constituent Properties" object for CAM. + +List all existing files that have been modified, and describe the changes: + +M Externals_CAM.cfg + - Update 'atmospheric_physics' external + +M bld/configure + - Add 'src/utils/cam_ccpp' and 'src/atmos_phys/utilities' to build file paths + +M src/dynamics/se/dp_coupling.F90 + - Use CCPP-ized 'update_dry_static_energy_run' subroutine + +M src/physics/cam/geopotential.F90 + - Use CCPP-ized 'geopotential_temp_run' subroutine + +M src/physics/cam/ref_pres.F90 + - Update comment in order to avoid future confusion + +M src/physics/cam/physpkg.F90 +M src/physics/cam_dev/physpkg.F90 +M src/physics/simple/held_suarez_cam.F90 +M src/physics/simple/physpkg.F90 + - Update physics calls and add new const. prop. DDT to work with new + atmospheric_physics external + +M src/physics/simple/kessler_cam.F90 +- Update physics calls and add new const. prop. DDT to work with new + atmospheric_physics external. Also replace use of "standard pressure" + with "reference pressure" in order to avoid unphysical mismatches. + +M src/dynamics/se/dycore/fvm_consistent_se_cslam.F90 +M src/dynamics/se/dycore/prim_advance_mod.F90 +M src/dynamics/se/dycore/prim_advection_mod.F90 +M src/dynamics/se/dycore/prim_driver_mod.F90 +M src/dynamics/se/dycore/prim_init.F90 +M src/dynamics/se/dycore/prim_state_mod.F90 +M src/dynamics/se/stepon.F90 + - Replace 'time_mod' with 'se_dyn_time_mod' + +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. + +cheyenne/intel/aux_cam: + + All tests have NLCOMP failures due to changes in input data paths on Cheyenne. + + ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3 (Overall: FAIL) details: + FAIL ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3 NLCOMP + FAIL ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3 MODEL_BUILD time=3 + ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq9s (Overall: FAIL) details: + FAIL ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq9s NLCOMP + FAIL ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq9s COMPARE_base_rest + SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq3h (Overall: DIFF) details: + FAIL SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq3h NLCOMP + FAIL SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq3h BASELINE /glade/p/cesm/amwg/cesm_baselines/cam6_3_133: DIFF + - pre-existing failure + +izumi/nag/aux_cam: + + DAE_Vnuopc.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details: + FAIL DAE_Vnuopc.f45_f45_mg37.FHS94.izumi_nag.cam-dae RUN time=9 + - pre-existing failure + + ERS_Ln27_Vnuopc.ne5pg3_ne5pg3_mg37.FKESSLER.izumi_nag.cam-outfrq9s (Overall: DIFF) details: + FAIL ERS_Ln27_Vnuopc.ne5pg3_ne5pg3_mg37.FKESSLER.izumi_nag.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_3_133_nag: DIFF + - expected failure + +izumi/gnu/aux_cam: All PASS + +Summarize any changes to answers: + All compsets which use Kessler idealized physics + will have larger-than-roundoff answer changes due + to reference pressure bug fix. + +=============================================================== + Tag name: cam6_3_133 Originator(s): fvitt Date: 19 Oct 2023 From 8a07c9e37cb5028b08cf0c66d6505e9c60b691c0 Mon Sep 17 00:00:00 2001 From: James Edwards Date: Tue, 14 Nov 2023 06:46:14 -0700 Subject: [PATCH 18/23] removes svn sparse checkout and uses git sparse checkout for all repos, combine clubb and silhs into clubb --- Externals_CAM.cfg | 21 ++++++++------------- bld/configure | 4 ++-- src/physics/.clubb_sparse_checkout | 2 ++ src/physics/cosp2/.cosp_sparse_checkout | 1 + 4 files changed, 13 insertions(+), 15 deletions(-) create mode 100644 src/physics/.clubb_sparse_checkout create mode 100644 src/physics/cosp2/.cosp_sparse_checkout diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index f58df387ea..5e6527b5bd 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -14,23 +14,18 @@ required = True [cosp2] local_path = src/physics/cosp2/src -protocol = svn -repo_url = https://github.com/CFMIP/COSPv2.0/tags/ -tag = v2.1.4cesm/src +protocol = git +repo_url = https://github.com/CFMIP/COSPv2.0 +sparse = ../.cosp_sparse_checkout +tag = v2.1.4cesm required = True [clubb] local_path = src/physics/clubb -protocol = svn -repo_url = https://github.com/larson-group/clubb_release/tags/ -tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag/src/CLUBB_core -required = True - -[silhs] -local_path = src/physics/silhs -protocol = svn -repo_url = https://github.com/larson-group/clubb_release/tags/ -tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag/src/SILHS +protocol = git +repo_url = https://github.com/larson-group/clubb_release +sparse = ../.clubb_sparse_checkout +tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag required = True [pumas] diff --git a/bld/configure b/bld/configure index d1f86cb03e..7a7450b75f 100755 --- a/bld/configure +++ b/bld/configure @@ -2204,11 +2204,11 @@ sub write_filepath } if ($clubb_sgs) { - print $fh "$camsrcdir/src/physics/clubb\n"; + print $fh "$camsrcdir/src/physics/clubb/src/CLUBB_core\n"; } if ($silhs) { - print $fh "$camsrcdir/src/physics/silhs\n"; + print $fh "$camsrcdir/src/physics/clubb/src/SILHS\n"; } if ($phys_pkg eq 'cam_dev') { diff --git a/src/physics/.clubb_sparse_checkout b/src/physics/.clubb_sparse_checkout new file mode 100644 index 0000000000..9cb681b77a --- /dev/null +++ b/src/physics/.clubb_sparse_checkout @@ -0,0 +1,2 @@ +src/CLUBB_core +src/SILHS \ No newline at end of file diff --git a/src/physics/cosp2/.cosp_sparse_checkout b/src/physics/cosp2/.cosp_sparse_checkout new file mode 100644 index 0000000000..e8310385c5 --- /dev/null +++ b/src/physics/cosp2/.cosp_sparse_checkout @@ -0,0 +1 @@ +src \ No newline at end of file From 401b3383103ed81dbbfbd4dbca836387d065a7cf Mon Sep 17 00:00:00 2001 From: James Edwards Date: Tue, 14 Nov 2023 06:51:52 -0700 Subject: [PATCH 19/23] add final carrage returns --- src/physics/.clubb_sparse_checkout | 2 +- src/physics/cosp2/.cosp_sparse_checkout | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/.clubb_sparse_checkout b/src/physics/.clubb_sparse_checkout index 9cb681b77a..1299233a5e 100644 --- a/src/physics/.clubb_sparse_checkout +++ b/src/physics/.clubb_sparse_checkout @@ -1,2 +1,2 @@ src/CLUBB_core -src/SILHS \ No newline at end of file +src/SILHS diff --git a/src/physics/cosp2/.cosp_sparse_checkout b/src/physics/cosp2/.cosp_sparse_checkout index e8310385c5..85de9cf933 100644 --- a/src/physics/cosp2/.cosp_sparse_checkout +++ b/src/physics/cosp2/.cosp_sparse_checkout @@ -1 +1 @@ -src \ No newline at end of file +src From 5a2f611acb6020ebcc3a048421a09804c95c27b7 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 14 Nov 2023 08:59:48 -0700 Subject: [PATCH 20/23] Modify COSP2 checkout to remove un-used directories/files. --- Externals_CAM.cfg | 2 +- src/physics/cosp2/.cosp_sparse_checkout | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 5e6527b5bd..2881ce0093 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -13,7 +13,7 @@ tag = carma4_01 required = True [cosp2] -local_path = src/physics/cosp2/src +local_path = src/physics/cosp2 protocol = git repo_url = https://github.com/CFMIP/COSPv2.0 sparse = ../.cosp_sparse_checkout diff --git a/src/physics/cosp2/.cosp_sparse_checkout b/src/physics/cosp2/.cosp_sparse_checkout index 85de9cf933..4f00cd9a73 100644 --- a/src/physics/cosp2/.cosp_sparse_checkout +++ b/src/physics/cosp2/.cosp_sparse_checkout @@ -1 +1 @@ -src +/src/ From e8707d5a3bd96c7c0ad32c9adf8518313ef02bf7 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Tue, 14 Nov 2023 09:31:52 -0700 Subject: [PATCH 21/23] Fix paths, including a mistake introduced on my end. --- Externals_CAM.cfg | 2 +- bld/configure | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 2881ce0093..5e6527b5bd 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -13,7 +13,7 @@ tag = carma4_01 required = True [cosp2] -local_path = src/physics/cosp2 +local_path = src/physics/cosp2/src protocol = git repo_url = https://github.com/CFMIP/COSPv2.0 sparse = ../.cosp_sparse_checkout diff --git a/bld/configure b/bld/configure index 7a7450b75f..3fa950eef9 100755 --- a/bld/configure +++ b/bld/configure @@ -2305,13 +2305,13 @@ sub write_cosp_makefile CAM_BLD := $cam_bld COSP_PATH := $cam_dir/src/physics/cosp2 -ISCCP_PATH := $cam_dir/src/physics/cosp2/src/simulator/icarus -RS_PATH := $cam_dir/src/physics/cosp2/src/simulator/quickbeam -RT_PATH := $cam_dir/src/physics/cosp2/src/simulator/rttov -CS_PATH := $cam_dir/src/physics/cosp2/src/simulator/actsim -MISR_PATH := $cam_dir/src/physics/cosp2/src/simulator/MISR_simulator -MODIS_PATH := $cam_dir/src/physics/cosp2/src/simulator/MODIS_simulator -PARASOL_PATH := $cam_dir/src/physics/cosp2/src/simulator/parasol +ISCCP_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/icarus +RS_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/quickbeam +RT_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/rttov +CS_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/actsim +MISR_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/MISR_simulator +MODIS_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/MODIS_simulator +PARASOL_PATH := $cam_dir/src/physics/cosp2/src/src/simulator/parasol EOF From 07359951bcf09a31bdb796dbd88fbad9ab5a7332 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 16 Nov 2023 11:26:43 -0700 Subject: [PATCH 22/23] Fix COSP Makefile paths. --- src/physics/cosp2/Makefile.in | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/physics/cosp2/Makefile.in b/src/physics/cosp2/Makefile.in index 69a37713fa..881a1a5679 100644 --- a/src/physics/cosp2/Makefile.in +++ b/src/physics/cosp2/Makefile.in @@ -65,10 +65,10 @@ cosp_grLidar532_interface.o: cosp_kinds.o cosp_atlid_interface.o : cosp_kinds.o cosp_cloudsat_interface.o : cosp_kinds.o cosp_config.o quickbeam.o cosp_isccp_interface.o : cosp_kinds.o icarus.o -cosp_misr_interface.o : cosp_kinds.o +cosp_misr_interface.o : cosp_kinds.o cosp_modis_interface.o : cosp_kinds.o cosp_config.o modis_simulator.o cosp_rttov_interfaceSTUB.o : cosp_kinds.o cosp_config.o cosp_rttovSTUB.o -cosp_parasol_interface.o : cosp_kinds.o +cosp_parasol_interface.o : cosp_kinds.o cosp_rttovSTUB.o : cosp_kinds.o cosp_config.o cosp_constants.o MISR_simulator.o : cosp_kinds.o cosp_config.o cosp_stats.o modis_simulator.o : cosp_kinds.o cosp_config.o cosp_stats.o @@ -82,7 +82,7 @@ scops.o : cosp_kinds.o mo_rng.o cosp_errorHandling.o prec_scops.o : cosp_kinds.o cosp_config.o cosp_optics.o : cosp_kinds.o cosp_constants.o modis_simulator.o quickbeam_optics.o : cosp_kinds.o cosp_config.o cosp_constants.o quickbeam.o \ - cosp_errorHandling.o array_lib.o math_lib.o optics_lib.o + cosp_errorHandling.o array_lib.o math_lib.o optics_lib.o optics_lib.o : cosp_kinds.o cosp_errorHandling.o array_lib.o : cosp_kinds.o cosp_errorHandling.o math_lib.o : cosp_kinds.o array_lib.o mrgrnk.o @@ -107,37 +107,37 @@ quickbeam.o: $(RS_PATH)/quickbeam.F90 MISR_simulator.o : $(MISR_PATH)/MISR_simulator.F90 $(F90) $(F90FLAGS) -c $< -modis_simulator.o : $(MODIS_PATH)/modis_simulator.F90 +modis_simulator.o : $(MODIS_PATH)/modis_simulator.F90 $(F90) $(F90FLAGS) -c $< -cosp_rttov_interfaceSTUB.o : $(COSP_PATH)/src/simulator/cosp_rttov_interfaceSTUB.F90 +cosp_rttov_interfaceSTUB.o : $(COSP_PATH)/src/src/simulator/cosp_rttov_interfaceSTUB.F90 $(F90) $(F90FLAGS) -c $< -cosp_misr_interface.o : $(COSP_PATH)/src/simulator/cosp_misr_interface.F90 +cosp_misr_interface.o : $(COSP_PATH)/src/src/simulator/cosp_misr_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_modis_interface.o : $(COSP_PATH)/src/simulator/cosp_modis_interface.F90 +cosp_modis_interface.o : $(COSP_PATH)/src/src/simulator/cosp_modis_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_isccp_interface.o : $(COSP_PATH)/src/simulator/cosp_isccp_interface.F90 +cosp_isccp_interface.o : $(COSP_PATH)/src/src/simulator/cosp_isccp_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_calipso_interface.o : $(COSP_PATH)/src/simulator/cosp_calipso_interface.F90 +cosp_calipso_interface.o : $(COSP_PATH)/src/src/simulator/cosp_calipso_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_grLidar532_interface.o : $(COSP_PATH)/src/simulator/cosp_grLidar532_interface.F90 +cosp_grLidar532_interface.o : $(COSP_PATH)/src/src/simulator/cosp_grLidar532_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_atlid_interface.o : $(COSP_PATH)/src/simulator/cosp_atlid_interface.F90 +cosp_atlid_interface.o : $(COSP_PATH)/src/src/simulator/cosp_atlid_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_cloudsat_interface.o : $(COSP_PATH)/src/simulator/cosp_cloudsat_interface.F90 +cosp_cloudsat_interface.o : $(COSP_PATH)/src/src/simulator/cosp_cloudsat_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_parasol_interface.o : $(COSP_PATH)/src/simulator/cosp_parasol_interface.F90 +cosp_parasol_interface.o : $(COSP_PATH)/src/src/simulator/cosp_parasol_interface.F90 $(F90) $(F90FLAGS) -c $< -cosp_rttovSTUB.o : $(RT_PATH)/cosp_rttovSTUB.F90 +cosp_rttovSTUB.o : $(RT_PATH)/cosp_rttovSTUB.F90 $(F90) $(F90FLAGS) -c $< lidar_simulator.o : $(CS_PATH)/lidar_simulator.F90 @@ -146,19 +146,19 @@ lidar_simulator.o : $(CS_PATH)/lidar_simulator.F90 parasol.o : $(PARASOL_PATH)/parasol.F90 $(F90) $(F90FLAGS) -c $< -cosp_constants.o : $(COSP_PATH)/src/cosp_constants.F90 +cosp_constants.o : $(COSP_PATH)/src/src/cosp_constants.F90 $(F90) $(F90FLAGS) -c $< cosp_kinds.o : $(COSP_PATH)/cosp_kinds.F90 $(F90) $(F90FLAGS) -c $< -cosp_config.o : $(COSP_PATH)/src/cosp_config.F90 +cosp_config.o : $(COSP_PATH)/src/src/cosp_config.F90 $(F90) $(F90FLAGS) -c $< -cosp.o : $(COSP_PATH)/src/cosp.F90 +cosp.o : $(COSP_PATH)/src/src/cosp.F90 $(F90) $(F90FLAGS) -c $< -cosp_stats.o : $(COSP_PATH)/src/cosp_stats.F90 +cosp_stats.o : $(COSP_PATH)/src/src/cosp_stats.F90 $(F90) $(F90FLAGS) -c $< # COSPv1.4 interface From 5888903ea6158488314b8789236637e761e93290 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 16 Nov 2023 15:30:44 -0700 Subject: [PATCH 23/23] Update ChangeLog. --- doc/ChangeLog | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7e45ac811b..9436ef69ab 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,80 @@ =============================================================== +Tag name: cam6_3_135 +Originator(s): jedwards, nusbaume +Date: 16 Nov 2023 +One-line Summary: removes svn sparse checkout +Github PR URL: https://github.com/ESCOMP/CAM/pull/913 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +Use git sparse checkout for all repos, combine clubb and silhs into clubb. +git sparse checkout has been available in manage_externals since version 1.2.1. + +Fixes #912 -> cosp2 svn access to github support is ending soon + +Describe any changes made to build system: + +Build path were modified in the "configure" Perl script, as well +as in the COSP Makefile.in file, in order to account for the +new source code paths. + +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, gold2718 + +List all files eliminated: N/A + +List all files added and what they do: + +A src/physics/.clubb_sparse_checkout + - Provides information on how to do the git sparse checkout of CLUBB and SILHS + +A src/physics/cosp2/.cosp_sparse_checkout + - Provides information on how to do the git sparse checkout of COSP + +List all existing files that have been modified, and describe the changes: + +M Externals_CAM.cfg + - Change the Github-SVN bridge method to git sparse checkout + +M bld/configure + - Update source code paths for CLUBB, SILHS, and COSP + +M src/physics/cosp2/Makefile.in + - Update source code paths for relevant COSP files. + +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. + +cheyenne/intel/aux_cam: + + ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3 (Overall: FAIL) details: + FAIL ERP_Ln9_Vnuopc.C96_C96_mg17.F2000climo.cheyenne_intel.cam-outfrq9s_mg3 MODEL_BUILD time=3 + ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq9s (Overall: FAIL) details: + FAIL ERP_Ln9_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq9s COMPARE_base_rest + SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq3h (Overall: DIFF) details: + FAIL SMS_Lh12_Vnuopc.f09_f09_mg17.FCSD_HCO.cheyenne_intel.cam-outfrq3h BASELINE /glade/p/cesm/amwg/cesm_baselines/cam6_3_134: DIFF + - pre-existing failure + +izumi/nag/aux_cam: + + DAE_Vnuopc.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details: + FAIL DAE_Vnuopc.f45_f45_mg37.FHS94.izumi_nag.cam-dae RUN time=10 + - pre-existing failure + +izumi/gnu/aux_cam: ALL PASS + +Summarize any changes to answers: bit-for-bit unchanged + +=============================================================== + Tag name: cam6_3_134 Originator(s): nusbaume, jimmielin Date: 31 Oct 2023