From 5d10dfd8373fc59b23594f140c30bcbf62c60ec3 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Tue, 30 Apr 2024 00:24:20 -0600 Subject: [PATCH 01/12] dadadj ccpp updates --- bld/configure | 1 + src/control/cam_snapshot_common.F90 | 2 +- src/physics/cam/dadadj.F90 | 174 ---------------------------- src/physics/cam/dadadj_cam.F90 | 98 +++++++++------- src/physics/cam/physpkg.F90 | 4 +- src/physics/cam_dev/physpkg.F90 | 4 +- 6 files changed, 61 insertions(+), 222 deletions(-) delete mode 100644 src/physics/cam/dadadj.F90 diff --git a/bld/configure b/bld/configure index e2fb784495..05f1d7155c 100755 --- a/bld/configure +++ b/bld/configure @@ -2304,6 +2304,7 @@ sub write_filepath #Add the CCPP'ized subdirectories print $fh "$camsrcdir/src/atmos_phys/zhang_mcfarlane\n"; + print $fh "$camsrcdir/src/atmos_phys/dadadj\n"; # Dynamics package and test utilities print $fh "$camsrcdir/src/dynamics/$dyn\n"; diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index f2a4780619..81e8694006 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -86,7 +86,7 @@ module cam_snapshot_common type (snapshot_type) :: tend_snapshot(6) type (snapshot_type) :: cam_in_snapshot(30) type (snapshot_type) :: cam_out_snapshot(30) -type (snapshot_type_nd) :: pbuf_snapshot(250) +type (snapshot_type_nd) :: pbuf_snapshot(300) contains diff --git a/src/physics/cam/dadadj.F90 b/src/physics/cam/dadadj.F90 deleted file mode 100644 index b9762f8f5f..0000000000 --- a/src/physics/cam/dadadj.F90 +++ /dev/null @@ -1,174 +0,0 @@ -module dadadj -!----------------------------------------------------------------------- -! -! Purpose: -! GFDL style dry adiabatic adjustment -! -! Method: -! if stratification is unstable, adjustment to the dry adiabatic lapse -! rate is forced subject to the condition that enthalpy is conserved. -! -! Author: J.Hack -! -!----------------------------------------------------------------------- - -use shr_kind_mod, only: r8 => shr_kind_r8 - -implicit none -private -save - -public :: & - dadadj_initial, & - dadadj_calc - -integer :: nlvdry ! number of layers from top of model to apply the adjustment -integer :: niter ! number of iterations for convergence - -!=============================================================================== -contains -!=============================================================================== - -subroutine dadadj_initial(nlvdry_in, niter_in) - - integer, intent(in) :: nlvdry_in - integer, intent(in) :: niter_in - - nlvdry = nlvdry_in - niter = niter_in - -end subroutine dadadj_initial - -!=============================================================================== - -subroutine dadadj_calc( & - ncol, pmid, pint, pdel, cappav, t, & - q, dadpdf, icol_err) - - ! Arguments - - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: pmid(:,:) ! pressure at model levels - real(r8), intent(in) :: pint(:,:) ! pressure at model interfaces - real(r8), intent(in) :: pdel(:,:) ! vertical delta-p - real(r8), intent(in) :: cappav(:,:) ! variable Kappa - - real(r8), intent(inout) :: t(:,:) ! temperature (K) - real(r8), intent(inout) :: q(:,:) ! specific humidity - - real(r8), intent(out) :: dadpdf(:,:) ! PDF of where adjustments happened - - integer, intent(out) :: icol_err ! index of column in which error occurred - - !---------------------------Local workspace----------------------------- - - integer :: i,k ! longitude, level indices - integer :: jiter ! iteration index - - real(r8), allocatable :: c1dad(:) ! intermediate constant - real(r8), allocatable :: c2dad(:) ! intermediate constant - real(r8), allocatable :: c3dad(:) ! intermediate constant - real(r8), allocatable :: c4dad(:) ! intermediate constant - real(r8) :: gammad ! dry adiabatic lapse rate (deg/Pa) - real(r8) :: zeps ! convergence criterion (deg/Pa) - real(r8) :: rdenom ! reciprocal of denominator of expression - real(r8) :: dtdp ! delta-t/delta-p - real(r8) :: zepsdp ! zeps*delta-p - real(r8) :: zgamma ! intermediate constant - real(r8) :: qave ! mean q between levels - real(r8) :: cappa ! Kappa at level intefaces - - logical :: ilconv ! .TRUE. ==> convergence was attained - logical :: dodad(ncol) ! .TRUE. ==> do dry adjustment - - !----------------------------------------------------------------------- - - icol_err = 0 - zeps = 2.0e-5_r8 ! set convergence criteria - - allocate(c1dad(nlvdry), c2dad(nlvdry), c3dad(nlvdry), c4dad(nlvdry)) - - ! Find gridpoints with unstable stratification - - do i = 1, ncol - cappa = 0.5_r8*(cappav(i,2) + cappav(i,1)) - gammad = cappa*0.5_r8*(t(i,2) + t(i,1))/pint(i,2) - dtdp = (t(i,2) - t(i,1))/(pmid(i,2) - pmid(i,1)) - dodad(i) = (dtdp + zeps) .gt. gammad - end do - - dadpdf(:ncol,:) = 0._r8 - do k= 2, nlvdry - do i = 1, ncol - cappa = 0.5_r8*(cappav(i,k+1) + cappav(i,k)) - gammad = cappa*0.5_r8*(t(i,k+1) + t(i,k))/pint(i,k+1) - dtdp = (t(i,k+1) - t(i,k))/(pmid(i,k+1) - pmid(i,k)) - dodad(i) = dodad(i) .or. (dtdp + zeps).gt.gammad - if ((dtdp + zeps).gt.gammad) then - dadpdf(i,k) = 1._r8 - end if - end do - end do - - ! Make a dry adiabatic adjustment - ! Note: nlvdry ****MUST**** be < pver - - COL: do i = 1, ncol - - if (dodad(i)) then - - zeps = 2.0e-5_r8 - - do k = 1, nlvdry - c1dad(k) = cappa*0.5_r8*(pmid(i,k+1)-pmid(i,k))/pint(i,k+1) - c2dad(k) = (1._r8 - c1dad(k))/(1._r8 + c1dad(k)) - rdenom = 1._r8/(pdel(i,k)*c2dad(k) + pdel(i,k+1)) - c3dad(k) = rdenom*pdel(i,k) - c4dad(k) = rdenom*pdel(i,k+1) - end do - -50 continue - - do jiter = 1, niter - ilconv = .true. - - do k = 1, nlvdry - zepsdp = zeps*(pmid(i,k+1) - pmid(i,k)) - zgamma = c1dad(k)*(t(i,k) + t(i,k+1)) - - if ((t(i,k+1)-t(i,k)) >= (zgamma+zepsdp)) then - ilconv = .false. - t(i,k+1) = t(i,k)*c3dad(k) + t(i,k+1)*c4dad(k) - t(i,k) = c2dad(k)*t(i,k+1) - qave = (pdel(i,k+1)*q(i,k+1) + pdel(i,k)*q(i,k))/(pdel(i,k+1)+ pdel(i,k)) - q(i,k+1) = qave - q(i,k) = qave - end if - - end do - - if (ilconv) cycle COL ! convergence => next longitude - end do - - ! Double convergence criterion if no convergence in niter iterations - - zeps = zeps + zeps - if (zeps > 1.e-4_r8) then - icol_err = i - return ! error return - else - go to 50 - end if - - end if - - end do COL - - deallocate(c1dad, c2dad, c3dad, c4dad) - -end subroutine dadadj_calc - -!=============================================================================== - -end module dadadj diff --git a/src/physics/cam/dadadj_cam.F90 b/src/physics/cam/dadadj_cam.F90 index 0717865ca8..d12c307ac9 100644 --- a/src/physics/cam/dadadj_cam.F90 +++ b/src/physics/cam/dadadj_cam.F90 @@ -2,7 +2,7 @@ module dadadj_cam ! CAM interfaces for the dry adiabatic adjustment parameterization -use shr_kind_mod, only: r8=>shr_kind_r8, cs=>shr_kind_cs +use shr_kind_mod, only: r8=>shr_kind_r8, cs=>shr_kind_cs, cm=>shr_kind_cm use ppgrid, only: pcols, pver, pverp use constituents, only: pcnst use air_composition, only: cappav, cpairv @@ -17,7 +17,7 @@ module dadadj_cam use namelist_utils, only: find_group_name use units, only: getunit, freeunit -use dadadj, only: dadadj_initial, dadadj_calc +use dadadj, only: dadadj_init, dadadj_run implicit none private @@ -25,7 +25,7 @@ module dadadj_cam public :: & dadadj_readnl, & - dadadj_init, & + dadadj_cam_init, & dadadj_tend ! Namelist variables @@ -42,8 +42,10 @@ subroutine dadadj_readnl(filein) namelist /dadadj_nl/ dadadj_nlvdry, dadadj_niter - integer :: unitn, ierr - character(len=*), parameter :: sub='dadadj_readnl' + integer :: unitn, ierr + integer :: errflg ! CCPP physics scheme error flag + character(len=512) :: errmsg ! CCPP physics scheme error message + character(len=*), parameter :: sub='dadadj_readnl' !------------------------------------------------------------------ ! Read namelist @@ -67,13 +69,16 @@ subroutine dadadj_readnl(filein) call mpibcast(dadadj_niter, 1, mpi_integer, masterprocid, mpicom) #endif - call dadadj_initial(dadadj_nlvdry, dadadj_niter) + call dadadj_init(dadadj_nlvdry, dadadj_niter, pver, errmsg, errflg) + if (errflg /=0) then + call endrun('dadadj_readnl: Error returned from dadadj_init: '//trim(errmsg)) + end if if (masterproc .and. .not. use_simple_phys) then write(iulog,*)'Dry adiabatic adjustment applied to top N layers; N=', & - dadadj_nlvdry + dadadj_nlvdry write(iulog,*)'Dry adiabatic adjustment number of iterations for convergence =', & - dadadj_niter + dadadj_niter end if end subroutine dadadj_readnl @@ -81,12 +86,12 @@ end subroutine dadadj_readnl !=============================================================================== -subroutine dadadj_init() +subroutine dadadj_cam_init() use cam_history, only: addfld call addfld('DADADJ_PD', (/ 'lev' /), 'A', 'probability', 'dry adiabatic adjustment probability') -end subroutine dadadj_init +end subroutine dadadj_cam_init !=============================================================================== @@ -98,39 +103,46 @@ subroutine dadadj_tend(dt, state, ptend) type(physics_state), intent(in) :: state ! Physics state variables type(physics_ptend), intent(out) :: ptend ! parameterization tendencies - logical :: lq(pcnst) - real(r8) :: dadpdf(pcols, pver) - integer :: ncol, lchnk, icol_err - character(len=128) :: errstring ! Error string - - ncol = state%ncol - lchnk = state%lchnk - lq(:) = .FALSE. - lq(1) = .TRUE. - call physics_ptend_init(ptend, state%psetcols, 'dadadj', ls=.true., lq=lq) - - ! use the ptend components for temporary storate and copy state info for input to - ! dadadj_calc which directly updates the temperature and moisture input arrays. - - ptend%s(:ncol,:pver) = state%t(:ncol,:pver) - ptend%q(:ncol,:pver,1) = state%q(:ncol,:pver,1) - - call dadadj_calc( & - ncol, state%pmid, state%pint, state%pdel, cappav(:,:,lchnk), ptend%s, & - ptend%q(:,:,1), dadpdf, icol_err) - - call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) - - if (icol_err > 0) then - ! error exit - write(errstring, *) & - 'dadadj_calc: No convergence in column at lat,lon:', & - state%lat(icol_err)*180._r8/pi, state%lon(icol_err)*180._r8/pi - call handle_errmsg(errstring, subname="dadadj_tend") - end if - - ptend%s(:ncol,:) = (ptend%s(:ncol,:) - state%t(:ncol,:) )/dt * cpairv(:ncol,:,lchnk) - ptend%q(:ncol,:,1) = (ptend%q(:ncol,:,1) - state%q(:ncol,:,1))/dt + character(len=512) :: errstring ! Error string + character(len=512) :: errmsg ! CCPP physics scheme error message + character(len=64) :: scheme_name! CCPP physics scheme name (not used in CAM) + integer :: icol_err + integer :: lchnk + integer :: ncol + integer :: errflg ! CCPP physics scheme error flag + logical :: lq(pcnst) + real(r8) :: dadpdf(pcols, pver) + + !------------------------------------------------------------------ + ncol = state%ncol + lchnk = state%lchnk + lq(:) = .FALSE. + lq(1) = .TRUE. + call physics_ptend_init(ptend, state%psetcols, 'dadadj', ls=.true., lq=lq) + + !REMOVECAM - no longer need these when CAM is retired and pcols no longer exists + dadpdf = 0._r8 + ptend%s = 0._r8 + ptend%q = 0._r8 + !REMOVECAM_END + + ! dadadj_run returns t tend, we are passing the ptend%s array to receive the t tendency and will convert it to s + ! before it is returned to CAM.. + call dadadj_run( & + ncol, dt, state%pmid(:ncol,:), state%pint(:ncol,:), state%pdel(:ncol,:), state%t(:ncol,:), state%q(:ncol,:,1), cappav(:ncol,:,lchnk), & + ptend%s(:ncol,:), ptend%q(:ncol,:,1), dadpdf(:ncol,:), scheme_name, errmsg, errflg) + + if (errflg /= 0) then + ! error exit + write(errstring, *) errmsg,' at lat,lon:', & + state%lat(errflg)*180._r8/pi, state%lon(errflg)*180._r8/pi + call endrun('dadadj_tend: Error returned from dadadj_run: '//trim(errstring)) + end if + + call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) + + ! convert the t tendency to an s tendency for cam + ptend%s(:ncol,:) = ptend%s(:ncol,:) * cpairv(:ncol,:,lchnk) end subroutine dadadj_tend diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index cb7322254f..883b774fd1 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -777,7 +777,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use sslt_rebin, only: sslt_rebin_init use tropopause, only: tropopause_init use solar_data, only: solar_data_init - use dadadj_cam, only: dadadj_init + use dadadj_cam, only: dadadj_cam_init use cam_abortutils, only: endrun use nudging, only: Nudge_Model, nudging_init use cam_snapshot, only: cam_snapshot_init @@ -952,7 +952,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) #endif call sslt_rebin_init() call tropopause_init() - call dadadj_init() + call dadadj_cam_init() prec_dp_idx = pbuf_get_index('PREC_DP') snow_dp_idx = pbuf_get_index('SNOW_DP') diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index aef997716f..45d195de2e 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -761,7 +761,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use clubb_intr, only: clubb_ini_cam use tropopause, only: tropopause_init use solar_data, only: solar_data_init - use dadadj_cam, only: dadadj_init + use dadadj_cam, only: dadadj_cam_init use cam_abortutils, only: endrun use nudging, only: Nudge_Model, nudging_init use cam_snapshot, only: cam_snapshot_init @@ -920,7 +920,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call metdata_phys_init() #endif call tropopause_init() - call dadadj_init() + call dadadj_cam_init() prec_dp_idx = pbuf_get_index('PREC_DP') snow_dp_idx = pbuf_get_index('SNOW_DP') From 9eb07a19ddfabf2c5fee426aeb02917b7c38a8c5 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Mon, 6 May 2024 09:51:51 -0600 Subject: [PATCH 02/12] Update Externals_CAM to point to my new atmos_phys branch - will need to redirect this to the tagged version --- Externals_CAM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index a1c76e7db5..9ea695165f 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -50,9 +50,9 @@ tag = ALI_ARMS_v1.0.1 required = True [atmos_phys] -tag = atmos_phys0_02_006 +branch = dadadj protocol = git -repo_url = https://github.com/ESCOMP/atmospheric_physics +repo_url = https://github.com/jtruesdal/atmospheric_physics required = True local_path = src/atmos_phys From f088d526f274cfa3e27acad63011412ca232f5f5 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 30 May 2024 17:09:30 -0600 Subject: [PATCH 03/12] change dir name from dadadj to dry_adiabatic_adjust and make sure new name is in Filepath --- bld/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/configure b/bld/configure index 05f1d7155c..0030d6a83a 100755 --- a/bld/configure +++ b/bld/configure @@ -2304,7 +2304,7 @@ sub write_filepath #Add the CCPP'ized subdirectories print $fh "$camsrcdir/src/atmos_phys/zhang_mcfarlane\n"; - print $fh "$camsrcdir/src/atmos_phys/dadadj\n"; + print $fh "$camsrcdir/src/atmos_phys/dry_adiabatic_adjust\n"; # Dynamics package and test utilities print $fh "$camsrcdir/src/dynamics/$dyn\n"; From b9003c2651a01e173a4dcde48f510b4b01c62b36 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Tue, 4 Jun 2024 12:24:15 -0600 Subject: [PATCH 04/12] PR update to err message for convergence failure --- src/physics/cam/dadadj_cam.F90 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/dadadj_cam.F90 b/src/physics/cam/dadadj_cam.F90 index d12c307ac9..2a7e09014e 100644 --- a/src/physics/cam/dadadj_cam.F90 +++ b/src/physics/cam/dadadj_cam.F90 @@ -132,11 +132,16 @@ subroutine dadadj_tend(dt, state, ptend) ncol, dt, state%pmid(:ncol,:), state%pint(:ncol,:), state%pdel(:ncol,:), state%t(:ncol,:), state%q(:ncol,:,1), cappav(:ncol,:,lchnk), & ptend%s(:ncol,:), ptend%q(:ncol,:,1), dadpdf(:ncol,:), scheme_name, errmsg, errflg) + ! error exit if (errflg /= 0) then - ! error exit - write(errstring, *) errmsg,' at lat,lon:', & - state%lat(errflg)*180._r8/pi, state%lon(errflg)*180._r8/pi - call endrun('dadadj_tend: Error returned from dadadj_run: '//trim(errstring)) + ! If this is a Convergence error then output lat lon of problem column using column index (errflg) + if(index('Convergence', errmsg) /= 0)then + write(errstring, *) trim(adjustl(errmsg)),' lat:',state%lat(errflg)*180._r8/pi,' lon:', & + state%lon(errflg)*180._r8/pi + else + errstring=trim(errmsg) + end if + call endrun('Error dadadj_tend:'//trim(errstring)) end if call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) From 1698a761ac5dd562bd96975a8636d13465831283 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 20 Jun 2024 15:42:08 -0600 Subject: [PATCH 05/12] initialize snapshot outfld fields to 0 in tphysac and tphysbc --- Externals.cfg | 4 ++-- src/physics/cam/physpkg.F90 | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index ffe2c4b012..776dac5899 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -64,9 +64,9 @@ local_path = libraries/parallelio required = True [cime] -tag = cime6.0.236_httpsbranch01 +tag = stdname_xsd protocol = git -repo_url = https://github.com/ESMCI/cime +repo_url = https://github.com/jtruesdal/cime local_path = cime required = True diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 883b774fd1..720a24286e 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1463,10 +1463,10 @@ subroutine tphysac (ztodt, cam_in, & logical :: labort ! abort flag - real(r8) surfric(pcols) ! surface friction velocity - real(r8) obklen(pcols) ! Obukhov length - real(r8) :: fh2o(pcols) ! h2o flux to balance source from methane chemistry - real(r8) :: flx_heat(pcols) ! Heat flux for check_energy_chng. + real(r8) :: surfric(pcols) = 0._r8 ! surface friction velocity + real(r8) :: obklen(pcols) = 0._r8 ! Obukhov length + real(r8) :: fh2o(pcols) = 0._r8 ! h2o flux to balance source from methane chemistry + real(r8) :: flx_heat(pcols) = 0._r8 ! Heat flux for check_energy_chng. real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space real(r8) :: tmp_pdel (pcols,pver) ! tmp space real(r8) :: tmp_ps (pcols) ! tmp space @@ -2117,15 +2117,15 @@ subroutine tphysbc (ztodt, state, & integer :: nstep ! current timestep number - real(r8) :: net_flx(pcols) + real(r8) :: net_flx(pcols) = 0._r8 - real(r8) :: zdu(pcols,pver) ! detraining mass flux from deep convection - real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c + real(r8) :: zdu(pcols,pver) = 0._r8 ! detraining mass flux from deep convection + real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c - real(r8) cmfcme(pcols,pver) ! cmf condensation - evaporation + real(r8) cmfcme(pcols,pver) = 0._r8 ! cmf condensation - evaporation - real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections - real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections + real(r8) dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections + real(r8) dlf2(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow convections real(r8) rtdt ! 1./ztodt integer lchnk ! chunk identifier @@ -2187,13 +2187,13 @@ subroutine tphysbc (ztodt, state, & ! energy checking variables real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros - real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: rice(pcols) ! vertical integral of ice not yet in q(ixcldice) - real(r8) :: rliq2(pcols) ! vertical integral of liquid from shallow scheme - real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice - real(r8) :: det_ice(pcols) ! vertical integral of detrained ice + real(r8) :: rliq(pcols) = 0._r8 ! vertical integral of liquid not yet in q(ixcldliq) + real(r8) :: rice(pcols) = 0._r8 ! vertical integral of ice not yet in q(ixcldice) + real(r8) :: rliq2(pcols) = 0._r8 ! vertical integral of liquid from shallow scheme + real(r8) :: det_s (pcols) = 0._r8 ! vertical integral of detrained static energy from ice + real(r8) :: det_ice(pcols) = 0._r8 ! vertical integral of detrained ice real(r8) :: flx_cnd(pcols) - real(r8) :: flx_heat(pcols) + real(r8) :: flx_heat(pcols) = 0._r8 type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes real(r8) :: zero_tracers(pcols,pcnst) From cbc9ce52d255aee5c277462fb70ec84fa0a83987 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 21 Jun 2024 09:34:34 -0600 Subject: [PATCH 06/12] update to cam6_3_162 w git-fleximod --- .gitmodules | 4 +- bld/configure | 1 + src/atmos_phys | 2 +- src/physics/cam/dadadj_cam.F90 | 103 +++++++++++++++++++------------- src/physics/cam/physpkg.F90 | 56 ++++++++--------- src/physics/cam_dev/physpkg.F90 | 58 +++++++++--------- 6 files changed, 117 insertions(+), 107 deletions(-) diff --git a/.gitmodules b/.gitmodules index 77e9c2fc56..5911569d46 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,8 +35,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_02_006 + url = https://github.com/jtruesdal/atmospheric_physics + fxtag = dadadj fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/bld/configure b/bld/configure index e2fb784495..0030d6a83a 100755 --- a/bld/configure +++ b/bld/configure @@ -2304,6 +2304,7 @@ sub write_filepath #Add the CCPP'ized subdirectories print $fh "$camsrcdir/src/atmos_phys/zhang_mcfarlane\n"; + print $fh "$camsrcdir/src/atmos_phys/dry_adiabatic_adjust\n"; # Dynamics package and test utilities print $fh "$camsrcdir/src/dynamics/$dyn\n"; diff --git a/src/atmos_phys b/src/atmos_phys index 4944547f04..4c0f72356a 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 4944547f04b1457d78bf7d3c0becddcfe0deabb9 +Subproject commit 4c0f72356afa6c5453b4b21a9fb041b3a3ac155c diff --git a/src/physics/cam/dadadj_cam.F90 b/src/physics/cam/dadadj_cam.F90 index 0717865ca8..2a7e09014e 100644 --- a/src/physics/cam/dadadj_cam.F90 +++ b/src/physics/cam/dadadj_cam.F90 @@ -2,7 +2,7 @@ module dadadj_cam ! CAM interfaces for the dry adiabatic adjustment parameterization -use shr_kind_mod, only: r8=>shr_kind_r8, cs=>shr_kind_cs +use shr_kind_mod, only: r8=>shr_kind_r8, cs=>shr_kind_cs, cm=>shr_kind_cm use ppgrid, only: pcols, pver, pverp use constituents, only: pcnst use air_composition, only: cappav, cpairv @@ -17,7 +17,7 @@ module dadadj_cam use namelist_utils, only: find_group_name use units, only: getunit, freeunit -use dadadj, only: dadadj_initial, dadadj_calc +use dadadj, only: dadadj_init, dadadj_run implicit none private @@ -25,7 +25,7 @@ module dadadj_cam public :: & dadadj_readnl, & - dadadj_init, & + dadadj_cam_init, & dadadj_tend ! Namelist variables @@ -42,8 +42,10 @@ subroutine dadadj_readnl(filein) namelist /dadadj_nl/ dadadj_nlvdry, dadadj_niter - integer :: unitn, ierr - character(len=*), parameter :: sub='dadadj_readnl' + integer :: unitn, ierr + integer :: errflg ! CCPP physics scheme error flag + character(len=512) :: errmsg ! CCPP physics scheme error message + character(len=*), parameter :: sub='dadadj_readnl' !------------------------------------------------------------------ ! Read namelist @@ -67,13 +69,16 @@ subroutine dadadj_readnl(filein) call mpibcast(dadadj_niter, 1, mpi_integer, masterprocid, mpicom) #endif - call dadadj_initial(dadadj_nlvdry, dadadj_niter) + call dadadj_init(dadadj_nlvdry, dadadj_niter, pver, errmsg, errflg) + if (errflg /=0) then + call endrun('dadadj_readnl: Error returned from dadadj_init: '//trim(errmsg)) + end if if (masterproc .and. .not. use_simple_phys) then write(iulog,*)'Dry adiabatic adjustment applied to top N layers; N=', & - dadadj_nlvdry + dadadj_nlvdry write(iulog,*)'Dry adiabatic adjustment number of iterations for convergence =', & - dadadj_niter + dadadj_niter end if end subroutine dadadj_readnl @@ -81,12 +86,12 @@ end subroutine dadadj_readnl !=============================================================================== -subroutine dadadj_init() +subroutine dadadj_cam_init() use cam_history, only: addfld call addfld('DADADJ_PD', (/ 'lev' /), 'A', 'probability', 'dry adiabatic adjustment probability') -end subroutine dadadj_init +end subroutine dadadj_cam_init !=============================================================================== @@ -98,39 +103,51 @@ subroutine dadadj_tend(dt, state, ptend) type(physics_state), intent(in) :: state ! Physics state variables type(physics_ptend), intent(out) :: ptend ! parameterization tendencies - logical :: lq(pcnst) - real(r8) :: dadpdf(pcols, pver) - integer :: ncol, lchnk, icol_err - character(len=128) :: errstring ! Error string - - ncol = state%ncol - lchnk = state%lchnk - lq(:) = .FALSE. - lq(1) = .TRUE. - call physics_ptend_init(ptend, state%psetcols, 'dadadj', ls=.true., lq=lq) - - ! use the ptend components for temporary storate and copy state info for input to - ! dadadj_calc which directly updates the temperature and moisture input arrays. - - ptend%s(:ncol,:pver) = state%t(:ncol,:pver) - ptend%q(:ncol,:pver,1) = state%q(:ncol,:pver,1) - - call dadadj_calc( & - ncol, state%pmid, state%pint, state%pdel, cappav(:,:,lchnk), ptend%s, & - ptend%q(:,:,1), dadpdf, icol_err) - - call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) - - if (icol_err > 0) then - ! error exit - write(errstring, *) & - 'dadadj_calc: No convergence in column at lat,lon:', & - state%lat(icol_err)*180._r8/pi, state%lon(icol_err)*180._r8/pi - call handle_errmsg(errstring, subname="dadadj_tend") - end if - - ptend%s(:ncol,:) = (ptend%s(:ncol,:) - state%t(:ncol,:) )/dt * cpairv(:ncol,:,lchnk) - ptend%q(:ncol,:,1) = (ptend%q(:ncol,:,1) - state%q(:ncol,:,1))/dt + character(len=512) :: errstring ! Error string + character(len=512) :: errmsg ! CCPP physics scheme error message + character(len=64) :: scheme_name! CCPP physics scheme name (not used in CAM) + integer :: icol_err + integer :: lchnk + integer :: ncol + integer :: errflg ! CCPP physics scheme error flag + logical :: lq(pcnst) + real(r8) :: dadpdf(pcols, pver) + + !------------------------------------------------------------------ + ncol = state%ncol + lchnk = state%lchnk + lq(:) = .FALSE. + lq(1) = .TRUE. + call physics_ptend_init(ptend, state%psetcols, 'dadadj', ls=.true., lq=lq) + + !REMOVECAM - no longer need these when CAM is retired and pcols no longer exists + dadpdf = 0._r8 + ptend%s = 0._r8 + ptend%q = 0._r8 + !REMOVECAM_END + + ! dadadj_run returns t tend, we are passing the ptend%s array to receive the t tendency and will convert it to s + ! before it is returned to CAM.. + call dadadj_run( & + ncol, dt, state%pmid(:ncol,:), state%pint(:ncol,:), state%pdel(:ncol,:), state%t(:ncol,:), state%q(:ncol,:,1), cappav(:ncol,:,lchnk), & + ptend%s(:ncol,:), ptend%q(:ncol,:,1), dadpdf(:ncol,:), scheme_name, errmsg, errflg) + + ! error exit + if (errflg /= 0) then + ! If this is a Convergence error then output lat lon of problem column using column index (errflg) + if(index('Convergence', errmsg) /= 0)then + write(errstring, *) trim(adjustl(errmsg)),' lat:',state%lat(errflg)*180._r8/pi,' lon:', & + state%lon(errflg)*180._r8/pi + else + errstring=trim(errmsg) + end if + call endrun('Error dadadj_tend:'//trim(errstring)) + end if + + call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) + + ! convert the t tendency to an s tendency for cam + ptend%s(:ncol,:) = ptend%s(:ncol,:) * cpairv(:ncol,:,lchnk) end subroutine dadadj_tend diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index cb7322254f..13dc3eb6bb 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -777,7 +777,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use sslt_rebin, only: sslt_rebin_init use tropopause, only: tropopause_init use solar_data, only: solar_data_init - use dadadj_cam, only: dadadj_init + use dadadj_cam, only: dadadj_cam_init use cam_abortutils, only: endrun use nudging, only: Nudge_Model, nudging_init use cam_snapshot, only: cam_snapshot_init @@ -952,7 +952,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) #endif call sslt_rebin_init() call tropopause_init() - call dadadj_init() + call dadadj_cam_init() prec_dp_idx = pbuf_get_index('PREC_DP') snow_dp_idx = pbuf_get_index('SNOW_DP') @@ -1463,10 +1463,10 @@ subroutine tphysac (ztodt, cam_in, & logical :: labort ! abort flag - real(r8) surfric(pcols) ! surface friction velocity - real(r8) obklen(pcols) ! Obukhov length - real(r8) :: fh2o(pcols) ! h2o flux to balance source from methane chemistry - real(r8) :: flx_heat(pcols) ! Heat flux for check_energy_chng. + real(r8) :: surfric(pcols) = 0._r8 ! surface friction velocity + real(r8) :: obklen(pcols) = 0._r8 ! Obukhov length + real(r8) :: fh2o(pcols) = 0._r8 ! h2o flux to balance source from methane chemistry + real(r8) :: flx_heat(pcols) = 0._r8 ! Heat flux for check_energy_chng. real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space real(r8) :: tmp_pdel (pcols,pver) ! tmp space real(r8) :: tmp_ps (pcols) ! tmp space @@ -2117,26 +2117,22 @@ subroutine tphysbc (ztodt, state, & integer :: nstep ! current timestep number - real(r8) :: net_flx(pcols) - - real(r8) :: zdu(pcols,pver) ! detraining mass flux from deep convection - real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c - - real(r8) cmfcme(pcols,pver) ! cmf condensation - evaporation - - real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections - real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections - real(r8) rtdt ! 1./ztodt - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - - integer :: i ! column indicex - integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. + real(r8) :: net_flx(pcols) = 0._r8 + real(r8) :: zdu(pcols,pver) = 0._r8 ! detraining mass flux from deep convection + real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c + real(r8) :: cmfcme(pcols,pver) = 0._r8 ! cmf condensation - evaporation + real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections + real(r8) :: dlf2(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow convections + real(r8) :: rtdt ! 1./ztodt + + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns + integer :: i ! column indicex + integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. integer :: m, m_cnst ! for macro/micro co-substepping - integer :: macmic_it ! iteration variables - real(r8) :: cld_macmic_ztodt ! modified timestep + integer :: macmic_it ! iteration variables + real(r8) :: cld_macmic_ztodt ! modified timestep ! physics buffer fields to compute tendencies for stratiform package integer itim_old, ifld real(r8), pointer, dimension(:,:) :: cld ! cloud fraction @@ -2187,13 +2183,13 @@ subroutine tphysbc (ztodt, state, & ! energy checking variables real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros - real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: rice(pcols) ! vertical integral of ice not yet in q(ixcldice) - real(r8) :: rliq2(pcols) ! vertical integral of liquid from shallow scheme - real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice - real(r8) :: det_ice(pcols) ! vertical integral of detrained ice + real(r8) :: rliq(pcols) = 0._r8 ! vertical integral of liquid not yet in q(ixcldliq) + real(r8) :: rice(pcols) = 0._r8 ! vertical integral of ice not yet in q(ixcldice) + real(r8) :: rliq2(pcols) = 0._r8 ! vertical integral of liquid from shallow scheme + real(r8) :: det_s (pcols) = 0._r8 ! vertical integral of detrained static energy from ice + real(r8) :: det_ice(pcols) = 0._r8 ! vertical integral of detrained ice real(r8) :: flx_cnd(pcols) - real(r8) :: flx_heat(pcols) + real(r8) :: flx_heat(pcols) = 0._r8 type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes real(r8) :: zero_tracers(pcols,pcnst) diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index aef997716f..82f4065fba 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -761,7 +761,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use clubb_intr, only: clubb_ini_cam use tropopause, only: tropopause_init use solar_data, only: solar_data_init - use dadadj_cam, only: dadadj_init + use dadadj_cam, only: dadadj_cam_init use cam_abortutils, only: endrun use nudging, only: Nudge_Model, nudging_init use cam_snapshot, only: cam_snapshot_init @@ -920,7 +920,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call metdata_phys_init() #endif call tropopause_init() - call dadadj_init() + call dadadj_cam_init() prec_dp_idx = pbuf_get_index('PREC_DP') snow_dp_idx = pbuf_get_index('SNOW_DP') @@ -1448,16 +1448,16 @@ subroutine tphysac (ztodt, cam_in, & integer :: macmic_it ! iteration variables real(r8) :: cld_macmic_ztodt ! modified timestep - real(r8) :: net_flx(pcols) + real(r8) :: net_flx(pcols) = 0._r8 - real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c + real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c - real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections - real(r8) rtdt ! 1./ztodt + real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections + real(r8) :: rtdt ! 1./ztodt real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice - real(r8) :: det_ice(pcols) ! vertical integral of detrained ice + real(r8) :: det_s (pcols) = 0._r8 ! vertical integral of detrained static energy from ice + real(r8) :: det_ice(pcols) = 0._r8 ! vertical integral of detrained ice real(r8) :: flx_cnd(pcols) real(r8) :: zero_sc(pcols*psubcols) ! array of zeros @@ -1489,12 +1489,12 @@ subroutine tphysac (ztodt, cam_in, & logical :: labort ! abort flag - real(r8) tvm(pcols,pver) ! virtual temperature - real(r8) prect(pcols) ! total precipitation - real(r8) surfric(pcols) ! surface friction velocity - real(r8) obklen(pcols) ! Obukhov length - real(r8) :: fh2o(pcols) ! h2o flux to balance source from methane chemistry - real(r8) :: flx_heat(pcols) ! Heat flux for check_energy_chng. + real(r8) :: tvm(pcols,pver) ! virtual temperature + real(r8) :: prect(pcols) ! total precipitation + real(r8) :: surfric(pcols) = 0._r8 ! surface friction velocity + real(r8) :: obklen(pcols) = 0._r8 ! Obukhov length + real(r8) :: fh2o(pcols) = 0._r8 ! h2o flux to balance source from methane chemistry + real(r8) :: flx_heat(pcols) = 0._r8 ! Heat flux for check_energy_chng. real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space real(r8) :: tmp_pdel (pcols,pver) ! tmp space real(r8) :: tmp_ps (pcols) ! tmp space @@ -2534,22 +2534,18 @@ subroutine tphysbc (ztodt, state, & integer :: nstep ! current timestep number - real(r8) :: net_flx(pcols) + real(r8) :: net_flx(pcols) = 0._r8 + real(r8) :: zdu(pcols,pver) = 0._r8 ! detraining mass flux from deep convection + real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c + real(r8) :: cmfcme(pcols,pver) = 0._r8 ! cmf condensation - evaporation + real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections + real(r8) :: dlf2(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow convections + real(r8) :: rtdt ! 1./ztodt - real(r8) :: zdu(pcols,pver) ! detraining mass flux from deep convection - real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c - - real(r8) cmfcme(pcols,pver) ! cmf condensation - evaporation - - real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections - real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections - real(r8) rtdt ! 1./ztodt - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - - integer :: i ! column indicex - integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns + integer :: i ! column indicex + integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. integer :: m, m_cnst ! physics buffer fields to compute tendencies for stratiform package @@ -2593,8 +2589,8 @@ subroutine tphysbc (ztodt, state, & real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: rice(pcols) ! vertical integral of ice not yet in q(ixcldice) - real(r8) :: rliq2(pcols) ! vertical integral of liquid from shallow scheme + real(r8) :: rice(pcols) = 0._r8 ! vertical integral of ice not yet in q(ixcldice) + real(r8) :: rliq2(pcols) = 0._r8 ! vertical integral of liquid from shallow scheme real(r8) :: flx_cnd(pcols) real(r8) :: flx_heat(pcols) type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes From b3c74ce4497ad394c052a834befc3a6c0c57fbb4 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 11 Jul 2024 10:12:06 -0600 Subject: [PATCH 07/12] update cam to match atmos_phys changes in dadadj (return heating rate in ptend%s) --- src/atmos_phys | 2 +- src/physics/cam/dadadj_cam.F90 | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/atmos_phys b/src/atmos_phys index 4c0f72356a..c98d6acaab 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 4c0f72356afa6c5453b4b21a9fb041b3a3ac155c +Subproject commit c98d6acaab123519b933e6cbc3233aaccc66af7e diff --git a/src/physics/cam/dadadj_cam.F90 b/src/physics/cam/dadadj_cam.F90 index 2a7e09014e..c2a6d685d1 100644 --- a/src/physics/cam/dadadj_cam.F90 +++ b/src/physics/cam/dadadj_cam.F90 @@ -129,8 +129,9 @@ subroutine dadadj_tend(dt, state, ptend) ! dadadj_run returns t tend, we are passing the ptend%s array to receive the t tendency and will convert it to s ! before it is returned to CAM.. call dadadj_run( & - ncol, dt, state%pmid(:ncol,:), state%pint(:ncol,:), state%pdel(:ncol,:), state%t(:ncol,:), state%q(:ncol,:,1), cappav(:ncol,:,lchnk), & - ptend%s(:ncol,:), ptend%q(:ncol,:,1), dadpdf(:ncol,:), scheme_name, errmsg, errflg) + ncol, pver, dt, state%pmid(:ncol,:), state%pint(:ncol,:), state%pdel(:ncol,:), & + state%t(:ncol,:), state%q(:ncol,:,1), cappav(:ncol,:,lchnk), cpairv(:ncol,:,lchnk), ptend%s(:ncol,:), & + ptend%q(:ncol,:,1), dadpdf(:ncol,:), scheme_name, errmsg, errflg) ! error exit if (errflg /= 0) then @@ -146,9 +147,6 @@ subroutine dadadj_tend(dt, state, ptend) call outfld('DADADJ_PD', dadpdf(:ncol,:), ncol, lchnk) - ! convert the t tendency to an s tendency for cam - ptend%s(:ncol,:) = ptend%s(:ncol,:) * cpairv(:ncol,:,lchnk) - end subroutine dadadj_tend !=============================================================================== From e8bb66947859fff2b757b5e98bb957cd4f7c687b Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 19 Jul 2024 08:26:19 -0600 Subject: [PATCH 08/12] add src/atmos_phys --- src/atmos_phys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atmos_phys b/src/atmos_phys index c98d6acaab..1e70ee7aa0 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit c98d6acaab123519b933e6cbc3233aaccc66af7e +Subproject commit 1e70ee7aa09a08a6c1375c9077118662d174b5ae From 31e33fe758eee65f524a7a23cc243331b20e561b Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 25 Jul 2024 14:33:21 -0600 Subject: [PATCH 09/12] remove variable initialization, not necessary for bfb --- components/cice | 2 +- components/cmeps | 2 +- src/dynamics/fv3 | 2 +- src/physics/cam/physpkg.F90 | 48 +++++++++++++++++--------------- src/physics/cam7/physpkg.F90 | 54 +++++++++++++++++++----------------- 5 files changed, 58 insertions(+), 50 deletions(-) diff --git a/components/cice b/components/cice index bdf6ea04d6..b56154b318 160000 --- a/components/cice +++ b/components/cice @@ -1 +1 @@ -Subproject commit bdf6ea04d6133434fcaa4de5336de106f01290d0 +Subproject commit b56154b318b41312faec8a8ebee86c866b47c9f2 diff --git a/components/cmeps b/components/cmeps index 6384ff4e4a..90f815ba9e 160000 --- a/components/cmeps +++ b/components/cmeps @@ -1 +1 @@ -Subproject commit 6384ff4e4a6bc82a678f9419a43ffbd5d53ac209 +Subproject commit 90f815ba9e7493d71043b5d8e627a3f20bd5dc78 diff --git a/src/dynamics/fv3 b/src/dynamics/fv3 index df3550b0f6..66227690a9 160000 --- a/src/dynamics/fv3 +++ b/src/dynamics/fv3 @@ -1 +1 @@ -Subproject commit df3550b0f6a835778f32ccc8c6291942e0413f62 +Subproject commit 66227690a9fb43a64492de32de14562a25ede717 diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index e827ed18df..debb251909 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1463,10 +1463,10 @@ subroutine tphysac (ztodt, cam_in, & logical :: labort ! abort flag - real(r8) :: surfric(pcols) = 0._r8 ! surface friction velocity - real(r8) :: obklen(pcols) = 0._r8 ! Obukhov length - real(r8) :: fh2o(pcols) = 0._r8 ! h2o flux to balance source from methane chemistry - real(r8) :: flx_heat(pcols) = 0._r8 ! Heat flux for check_energy_chng. + real(r8) surfric(pcols) ! surface friction velocity + real(r8) obklen(pcols) ! Obukhov length + real(r8) :: fh2o(pcols) ! h2o flux to balance source from methane chemistry + real(r8) :: flx_heat(pcols) ! Heat flux for check_energy_chng. real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space real(r8) :: tmp_pdel (pcols,pver) ! tmp space real(r8) :: tmp_ps (pcols) ! tmp space @@ -2117,18 +2117,22 @@ subroutine tphysbc (ztodt, state, & integer :: nstep ! current timestep number - real(r8) :: net_flx(pcols) = 0._r8 - real(r8) :: zdu(pcols,pver) = 0._r8 ! detraining mass flux from deep convection - real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c - real(r8) :: cmfcme(pcols,pver) = 0._r8 ! cmf condensation - evaporation - real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections - real(r8) :: dlf2(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow convections - real(r8) :: rtdt ! 1./ztodt - - integer :: lchnk ! chunk identifier - integer :: ncol ! number of atmospheric columns - integer :: i ! column indicex - integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. + real(r8) :: net_flx(pcols) + + real(r8) :: zdu(pcols,pver) ! detraining mass flux from deep convection + real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c + + real(r8) cmfcme(pcols,pver) ! cmf condensation - evaporation + + real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections + real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections + real(r8) rtdt ! 1./ztodt + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + + integer :: i ! column indicex + integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. integer :: m, m_cnst ! for macro/micro co-substepping integer :: macmic_it ! iteration variables @@ -2183,13 +2187,13 @@ subroutine tphysbc (ztodt, state, & ! energy checking variables real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros - real(r8) :: rliq(pcols) = 0._r8 ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: rice(pcols) = 0._r8 ! vertical integral of ice not yet in q(ixcldice) - real(r8) :: rliq2(pcols) = 0._r8 ! vertical integral of liquid from shallow scheme - real(r8) :: det_s (pcols) = 0._r8 ! vertical integral of detrained static energy from ice - real(r8) :: det_ice(pcols) = 0._r8 ! vertical integral of detrained ice + real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) + real(r8) :: rice(pcols) ! vertical integral of ice not yet in q(ixcldice) + real(r8) :: rliq2(pcols) ! vertical integral of liquid from shallow scheme + real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice + real(r8) :: det_ice(pcols) ! vertical integral of detrained ice real(r8) :: flx_cnd(pcols) - real(r8) :: flx_heat(pcols) = 0._r8 + real(r8) :: flx_heat(pcols) type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes real(r8) :: zero_tracers(pcols,pcnst) diff --git a/src/physics/cam7/physpkg.F90 b/src/physics/cam7/physpkg.F90 index 076ddba799..1c58c417b4 100644 --- a/src/physics/cam7/physpkg.F90 +++ b/src/physics/cam7/physpkg.F90 @@ -1448,16 +1448,16 @@ subroutine tphysac (ztodt, cam_in, & integer :: macmic_it ! iteration variables real(r8) :: cld_macmic_ztodt ! modified timestep - real(r8) :: net_flx(pcols) = 0._r8 + real(r8) :: net_flx(pcols) - real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c + real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c - real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections - real(r8) :: rtdt ! 1./ztodt + real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections + real(r8) rtdt ! 1./ztodt real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: det_s (pcols) = 0._r8 ! vertical integral of detrained static energy from ice - real(r8) :: det_ice(pcols) = 0._r8 ! vertical integral of detrained ice + real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice + real(r8) :: det_ice(pcols) ! vertical integral of detrained ice real(r8) :: flx_cnd(pcols) real(r8) :: zero_sc(pcols*psubcols) ! array of zeros @@ -1489,12 +1489,12 @@ subroutine tphysac (ztodt, cam_in, & logical :: labort ! abort flag - real(r8) :: tvm(pcols,pver) ! virtual temperature - real(r8) :: prect(pcols) ! total precipitation - real(r8) :: surfric(pcols) = 0._r8 ! surface friction velocity - real(r8) :: obklen(pcols) = 0._r8 ! Obukhov length - real(r8) :: fh2o(pcols) = 0._r8 ! h2o flux to balance source from methane chemistry - real(r8) :: flx_heat(pcols) = 0._r8 ! Heat flux for check_energy_chng. + real(r8) tvm(pcols,pver) ! virtual temperature + real(r8) prect(pcols) ! total precipitation + real(r8) surfric(pcols) ! surface friction velocity + real(r8) obklen(pcols) ! Obukhov length + real(r8) :: fh2o(pcols) ! h2o flux to balance source from methane chemistry + real(r8) :: flx_heat(pcols) ! Heat flux for check_energy_chng. real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space real(r8) :: tmp_pdel (pcols,pver) ! tmp space real(r8) :: tmp_ps (pcols) ! tmp space @@ -2534,18 +2534,22 @@ subroutine tphysbc (ztodt, state, & integer :: nstep ! current timestep number - real(r8) :: net_flx(pcols) = 0._r8 - real(r8) :: zdu(pcols,pver) = 0._r8 ! detraining mass flux from deep convection - real(r8) :: cmfmc(pcols,pverp) = 0._r8 ! Convective mass flux--m sub c - real(r8) :: cmfcme(pcols,pver) = 0._r8 ! cmf condensation - evaporation - real(r8) :: dlf(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow + deep convections - real(r8) :: dlf2(pcols,pver) = 0._r8 ! Detraining cld H20 from shallow convections - real(r8) :: rtdt ! 1./ztodt + real(r8) :: net_flx(pcols) - integer :: lchnk ! chunk identifier - integer :: ncol ! number of atmospheric columns - integer :: i ! column indicex - integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. + real(r8) :: zdu(pcols,pver) ! detraining mass flux from deep convection + real(r8) :: cmfmc(pcols,pverp) ! Convective mass flux--m sub c + + real(r8) cmfcme(pcols,pver) ! cmf condensation - evaporation + + real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections + real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections + real(r8) rtdt ! 1./ztodt + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + + integer :: i ! column indicex + integer :: ixcldice, ixcldliq, ixq ! constituent indices for cloud liquid and ice water. integer :: m, m_cnst ! physics buffer fields to compute tendencies for stratiform package @@ -2589,8 +2593,8 @@ subroutine tphysbc (ztodt, state, & real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) - real(r8) :: rice(pcols) = 0._r8 ! vertical integral of ice not yet in q(ixcldice) - real(r8) :: rliq2(pcols) = 0._r8 ! vertical integral of liquid from shallow scheme + real(r8) :: rice(pcols) ! vertical integral of ice not yet in q(ixcldice) + real(r8) :: rliq2(pcols) ! vertical integral of liquid from shallow scheme real(r8) :: flx_cnd(pcols) real(r8) :: flx_heat(pcols) type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes From b0b79b29fb2d062339615aa731216e125689ecff Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Thu, 25 Jul 2024 16:18:16 -0600 Subject: [PATCH 10/12] update gitmodules for new atmospheric_physics tag --- .gitmodules | 4 ++-- src/atmos_phys | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index bfe3d8bae1..0637b0a767 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,8 +35,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/jtruesdal/atmospheric_physics - fxtag = dadadj + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_04_000 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 1e70ee7aa0..ebe25e38fe 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 1e70ee7aa09a08a6c1375c9077118662d174b5ae +Subproject commit ebe25e38fec87c8531760858507e774996cb977e From d36b4ed63b06a460b2a2208c88934f702bbad2aa Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 16 Aug 2024 20:13:19 -0600 Subject: [PATCH 11/12] update ChangeLog and add back # to first line of test_driver.sh --- doc/ChangeLog | 71 ++++++++++++++++++++++++++++++++++++++ test/system/test_driver.sh | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 26d357a79b..b62f165c26 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,76 @@ =============================================================== +Tag name: cam6_4_021 +Originator(s): jet +Date: 8 Aug 2024 +One-line Summary: CCPPize dadadj +Github PR URL: https://github.com/ESCOMP/CAM/pull/1026 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Issue #928 - Convert Dry Adiabatic Adjustment to CCPP and move into the atmospheric_physics github repo + +Describe any changes made to build system: add atmos_phys/dry_adiabatic_adjust directory to build filepath + +Describe any changes made to the namelist: none + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: cacraigucar, nusbaume + +List all files eliminated: +D physics/cam/dadadj.F90 + +List all files added and what they do: none + +List all existing files that have been modified, and describe the changes: + +M .gitmodules + - update to atmospheric_physics tag with new dry_adiabatic_adjust ccpp routine + +M bld/configure + - Add dry_adiabatic_adjust to build Filepath +M src/cam_snapshot_common.F90 + - update pbuf_snapshot fields from 250 to 300 +M physics/cam/dadadj_cam.F90 + - CCPP'ize dadadj interface +M physics/physpkg.F90 +M physics/cam7/physpkg.F90 + - update subroutine name for cam dadadj initialization + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +derecho/intel/aux_cam: +ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: FAIL) details: +- pre-existing failure due to HEMCO not having reproducible results issues #1018 and #856 + +SMS_D_Ln9_P1280x1.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: PEND) details: +- pre-existing failures -- need fix in CLM external + +SMS_D_Ln9.T42_T42.FSCAM.derecho_intel.cam-outfrq9s (Overall: FAIL) details: +- pre-existing failure -- need fix in CICE external + +derecho/nvphc/aux_cam: All Pass + +izumi/nag/aux_cam: +DAE.f45_f45_mg37.FHS94.izumi_nag.cam-dae (Overall: FAIL) details: +- pre-existing failure - issue #670 + + +izumi/gnu/aux_cam: All Pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: BFB, as expected + +=============================================================== + Tag name: cam6_4_020 Originator(s): fvitt Date: 14 Aug 2024 diff --git a/test/system/test_driver.sh b/test/system/test_driver.sh index ef86e43cb8..a53d0762d8 100755 --- a/test/system/test_driver.sh +++ b/test/system/test_driver.sh @@ -1,4 +1,4 @@ -!/bin/sh +#!/bin/sh # # test_driver.sh: driver for the testing of CAM with standalone scripts # From cf34bea6c90051aec5046dba3e27c0fef800bd90 Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 16 Aug 2024 21:25:44 -0600 Subject: [PATCH 12/12] fix date of ChangeLog entry --- doc/ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index b62f165c26..6f9974c465 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,12 +2,13 @@ Tag name: cam6_4_021 Originator(s): jet -Date: 8 Aug 2024 +Date: 16 Aug 2024 One-line Summary: CCPPize dadadj Github PR URL: https://github.com/ESCOMP/CAM/pull/1026 Purpose of changes (include the issue number and title text for each relevant GitHub issue): - Issue #928 - Convert Dry Adiabatic Adjustment to CCPP and move into the atmospheric_physics github repo + - Bugfix to dadadj although it didn't change answers in the regression suite. Describe any changes made to build system: add atmos_phys/dry_adiabatic_adjust directory to build filepath