From 050df11d94eea17e53e4a2f916834eff46f20215 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 9 Dec 2020 16:07:51 -0700 Subject: [PATCH 001/466] added evaporation of rain --- src/physics/cam/clubb_intr.F90 | 2 +- src/physics/cam/clubb_mf.F90 | 78 ++++++++++++++++++++++++++++------ 2 files changed, 65 insertions(+), 15 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index e4417f83fe..239258418f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2505,7 +2505,7 @@ subroutine clubb_tend_cam( & thlm_zm_in = zt2zm_api( thlm_in ) call integrate_mf( pverp, dzt, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - p_in_Pa, invrs_exner_zt, & ! input + rho_zt, p_in_Pa, invrs_exner_zt, & ! input um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input thlm_zm_in, rtm_zm_in, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 898c42004d..b12906f2c6 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -76,7 +76,7 @@ subroutine clubb_mf_readnl(nlfile) end subroutine clubb_mf_readnl subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, & ! input - p_zt, iexner_zt, & ! input + rho_zt, p_zt, iexner_zt, & ! input u, v, thl, qt, thv, & ! input thl_zm, qt_zm, & ! input wthl, wqt, pblh, & ! input @@ -129,7 +129,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, real(r8), dimension(nz), intent(in) :: u, v, & ! thermodynamic grid thl, thv, & ! thermodynamic grid qt, & ! thermodynamic grid - dzt, & ! thermodynamic grid + dzt, rho_zt, & ! thermodynamic grid p_zt, iexner_zt, & ! thermodynamic grid thl_zm, & ! momentum grid qt_zm, & ! momentum grid @@ -166,7 +166,12 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upql, upqi, & ! momentum grid upth, upthv, & ! momentum grid upthl, & ! momentum grid - upu, upv ! momentum grid + upu, upv, & ! momentum grid + uplmix ! momentum grid + ! + ! microphyiscs terms + real(r8), dimension(nz,clubb_mf_nup) :: supqt, supthl, & ! thermodynamic grid + uprr ! thermodynamic grid ! ! entrainment profiles real(r8), dimension(nz,clubb_mf_nup) :: ent, entf ! thermodynamic grid @@ -183,12 +188,13 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, wlv, wtv, wp, & B, & ! thermodynamic grid entexp, entexpu, entw, & ! thermodynamic grid + lmixt, & ! thermodynamic grid + qtovqs, sevap, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid qtn, qsn, & ! momentum grid qcn, qln, qin, & ! momentum grid un, vn, wn2, & ! momentum grid - lmixn, & ! momentum grid - supqt, supthl ! thermodynamic grid + lmixn ! momentum grid ! ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & @@ -216,10 +222,18 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, logical :: do_condensation = .true. ! ! to precip or not to precip - logical :: do_precip = .false. + logical :: do_precip = .true. + ! + ! evaporation efficiency after Suselj etal 2019 + real(r8),parameter :: ke = 2.5e-4_r8 ! - ! to debug flag (overides stochastic entrainment) + ! fraction of rain detrained into downdrafts + real(r8),parameter :: fdd = 0._r8 + ! + ! to debug flag logical :: debug = .false. + ! + ! fixed entrainment rate (debug only) real(r8),parameter :: fixent = 0.004_r8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -274,6 +288,10 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upqi = 0._r8 upqv = 0._r8 upqs = 0._r8 + uplmix= 0._r8 + uprr = 0._r8 + supqt = 0._r8 + supthl= 0._r8 ! unique identifier zcb_unset = 9999999._r8 @@ -360,20 +378,20 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! get microphysics, autoconversion if (do_precip .and. upqc(k,i) > 0._r8) then - call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt) + call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) - supthl = -1._r8*lmixn*supqt*iexner_zt(k+1)/cpair + supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair else - supqt = 0._r8 - supthl = 0._r8 + supqt(k+1,i) = 0._r8 + supthl(k+1,i) = 0._r8 end if ! integrate updraft entexp = exp(-ent(k+1,i)*dzt(k+1)) entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) - - qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt - thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl + + qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) + thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu @@ -416,12 +434,44 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upql(k+1,i) = qln upqi(k+1,i) = qin upqv(k+1,i) = qtn - qcn + uplmix(k+1,i)= lmixn else exit end if enddo enddo + ! downward sweep for rain evaporation, snow melting + if (do_precip) then + do i=1,clubb_mf_nup + do k=nz-1,1,-1 + ! get rain evaporation + if ((upqs(k,i) + upqs(k-1,i)).le.0._r8) then + qtovqs = 0._r8 + else + qtovqs = (upqt(k,i) + upqt(k-1,i))/(upqs(k,i) + upqs(k-1,i)) + end if + qtovqs = min(1._r8,qtovqs) + sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k+1,i),0._r8)) + + ! get rain rate + uprr(k,i) = uprr(k+1,i) & + - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) + + if (debug) then + !if ( masterproc ) then + ! write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i + !end if + end if + + ! update source terms + lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) + supqt(k,i) = supqt(k,i) + sevap + supthl(k,i) = supthl(k,i) - lmixt*sevap*iexner_zt(k)/cpair + end do + end do + end if + ! writing updraft properties for output do k=1,nz From 60bd82eb8bb8a17dd89fe44bf1d884f87e8d790c Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 6 Jan 2021 09:23:23 -0700 Subject: [PATCH 002/466] added kludge flag --- src/physics/cam/clubb_mf.F90 | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index b12906f2c6..ed883065e2 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -99,12 +99,6 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! Provides rtm and thl fluxes due to mass flux ensemble, ! ! which are fed into the mixed explicit/implicit clubb solver as explicit terms ! ! ! - ! Variables needed for solver ! - ! ae = sum_i (1-a_i) ! - ! aw3 = sum (a_i w_i) ! - ! aws3 = sum (a_i w_i*s_i); s=thl*cp ! - ! aws3,awqv3,awql3,awqi3,awu3,awv3 similar as above except for different variables ! - ! ! ! Mass flux variables are computed on edges (i.e. momentum grid): ! ! upa,upw,upqt,... ! ! dry_a,moist_a,dry_w,moist_w, ... ! @@ -190,6 +184,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, entexp, entexpu, entw, & ! thermodynamic grid lmixt, & ! thermodynamic grid qtovqs, sevap, & ! thermodynamic grid + betathl,betaqt, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid qtn, qsn, & ! momentum grid qcn, qln, qin, & ! momentum grid @@ -222,7 +217,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, logical :: do_condensation = .true. ! ! to precip or not to precip - logical :: do_precip = .true. + logical :: do_precip = .false. ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 @@ -235,6 +230,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! ! fixed entrainment rate (debug only) real(r8),parameter :: fixent = 0.004_r8 + ! + ! to kludge (stagger environ values) + logical :: kludge = .true. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! @@ -541,10 +539,25 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, enddo enddo - do k=1,nz - thlflx(k)= awthl(k) - aw(k)*thl_zm(k) - qtflx(k)= awqt(k) - aw(k)*qt_zm(k) - enddo + if (kludge) then + ! staggered environment values + betathl = (thl(4)-thl(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + + ! extrapolate to ghost point + thlflx(1)= awthl(1) - aw(1)*(thl(2)-betathl*0.5_r8*(dzt(2)+dzt(1))) + qtflx(1)= awqt(1) - aw(1)*(qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))) + do k=2,nz + thlflx(k)= awthl(k) - aw(k)*thl(k) + qtflx(k)= awqt(k) - aw(k)*qt(k) + enddo + else + ! collocated environment values + do k=1,nz + thlflx(k)= awthl(k) - aw(k)*thl_zm(k) + qtflx(k) = awqt(k) - aw(k)*qt_zm(k) + end do + endif end if ! ( wthv > 0.0 ) From 94a123b253b3967f5aa965ae93522e36419867d2 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 12 Jan 2021 09:26:38 -0700 Subject: [PATCH 003/466] turn off kludge --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index ed883065e2..f42461e702 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -232,7 +232,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, real(r8),parameter :: fixent = 0.004_r8 ! ! to kludge (stagger environ values) - logical :: kludge = .true. + logical :: kludge = .false. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! From b7771083bc3874ff69f3e8ea22ce800ee6b6abc9 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 14 Jan 2021 10:44:19 -0700 Subject: [PATCH 004/466] includes options for everything but the kitchen sink --- src/physics/cam/clubb_intr.F90 | 102 +++++++++++++++++- src/physics/cam/clubb_mf.F90 | 185 +++++++++++++++++++++++++++------ 2 files changed, 253 insertions(+), 34 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 239258418f..5d114603cc 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1201,10 +1201,20 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) + call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) + call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) + call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) + call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) + call addfld ( 'edmf_thflx' , (/ 'ilev' /), 'A', 'K m/s' , 'th flux (EDMF)' ) + call addfld ( 'edmf_qvflx' , (/ 'ilev' /), 'A', 'kg/kg m/s' , 'qv flux (EDMF)' ) + call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) + call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) + call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) + call addfld ( 'edmf_rcm' , (/ 'lev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) end if ! Initialize statistics, below are dummy variables @@ -1317,12 +1327,21 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_MOIST_QC' , 1, ' ') call add_default( 'edmf_S_AE' , 1, ' ') call add_default( 'edmf_S_AW' , 1, ' ') + call add_default( 'edmf_S_AWTH' , 1, ' ') call add_default( 'edmf_S_AWTHL' , 1, ' ') call add_default( 'edmf_S_AWQT' , 1, ' ') call add_default( 'edmf_S_AWU' , 1, ' ') call add_default( 'edmf_S_AWV' , 1, ' ') call add_default( 'edmf_thlflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') + call add_default( 'edmf_thlforc' , 1, ' ') + call add_default( 'edmf_qtforc' , 1, ' ') + call add_default( 'edmf_thflx' , 1, ' ') + call add_default( 'edmf_qvflx' , 1, ' ') + call add_default( 'edmf_thforc' , 1, ' ') + call add_default( 'edmf_qvforc' , 1, ' ') + call add_default( 'edmf_qcforc' , 1, ' ') + call add_default( 'edmf_rcm' , 1, ' ') end if end if @@ -1784,8 +1803,15 @@ subroutine clubb_tend_cam( & s_ae_output, s_aw_output, & s_awthl_output, s_awqt_output, & s_awql_output, s_awqi_output, & + s_awth_output, s_awqv_output, & s_awu_output, s_awv_output, & + mf_thflx_output, mf_qvflx_output, & mf_thlflx_output, mf_qtflx_output + + ! MF outputs to outfld + real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid + mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid + mf_qcforc_output, mf_rcm_output ! MF Plume real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & mf_dry_w, mf_moist_w, & @@ -1797,13 +1823,21 @@ subroutine clubb_tend_cam( & s_ae, s_aw, & s_awthl, s_awqt, & s_awql, s_awqi, & + s_awth, s_awqv, & s_awu, s_awv, & - mf_thlflx, mf_qtflx + mf_thflx, mf_qvflx, & + mf_thlflx, mf_qtflx, & + mf_qcflx, & + mf_thforc, mf_qvforc, & + mf_qcforc, mf_rcm ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid invrs_exner_zt,& ! thermodynamic grid kappa_zt, qc_zt, & ! thermodynamic grid + th_zt, qv_zt, & ! momentum grid + th_zm, qv_zm, & ! momentum grid + qc_zm, & ! momentum grid kappa_zm, p_in_Pa_zm, & ! momentum grid invrs_exner_zm ! momentum grid @@ -2167,10 +2201,20 @@ subroutine clubb_tend_cam( & s_awqt_output(:,:) = 0._r8 s_awql_output(:,:) = 0._r8 s_awqi_output(:,:) = 0._r8 + s_awth_output(:,:) = 0._r8 + s_awqv_output(:,:) = 0._r8 s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 mf_thlflx_output(:,:) = 0._r8 mf_qtflx_output(:,:) = 0._r8 + mf_thflx_output(:,:) = 0._r8 + mf_qvflx_output(:,:) = 0._r8 + mf_thlforc_output(:,:) = 0._r8 + mf_qtforc_output(:,:) = 0._r8 + mf_thforc_output(:,:) = 0._r8 + mf_qvforc_output(:,:) = 0._r8 + mf_qcforc_output(:,:) = 0._r8 + mf_rcm_output(:,:) = 0._r8 ! Loop over all columns in lchnk to advance CLUBB core do i=1,ncol ! loop over columns @@ -2213,6 +2257,8 @@ subroutine clubb_tend_cam( & invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo + th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) + qv_zt(k+1) = state1%q(i,pver-k+1,ixq) rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) radf(k+1) = radf_clubb(i,pver-k+1) qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) @@ -2230,6 +2276,8 @@ subroutine clubb_tend_cam( & rfrzm(1) = rfrzm(2) radf(1) = radf(2) qrl_clubb(1) = qrl_clubb(2) + th_zt(1) = th_zt(2) + qv_zt(1) = qv_zt(2) ! Compute mean w wind on thermo grid, convert from omega to w wm_zt(1) = 0._r8 @@ -2503,11 +2551,16 @@ subroutine clubb_tend_cam( & rtm_zm_in = zt2zm_api( rtm_in ) thlm_zm_in = zt2zm_api( thlm_in ) + th_zm = zt2zm_api( th_zt ) + qv_zm = zt2zm_api( qv_zt ) + qc_zm = zt2zm_api( qc_zt ) call integrate_mf( pverp, dzt, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input rho_zt, p_in_Pa, invrs_exner_zt, & ! input um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input + th_zt, qv_zt, qc_zt, & ! input thlm_zm_in, rtm_zm_in, & ! input + th_zm, qv_zm, qc_zm, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input mf_dry_a, mf_moist_a, & ! output - plume diagnostics mf_dry_w, mf_moist_w, & ! output - plume diagnostics @@ -2519,18 +2572,36 @@ subroutine clubb_tend_cam( & s_ae, s_aw, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics s_awql, s_awqi, & ! output - plume diagnostics + s_awth, s_awqv, & ! output - plume diagnostics s_awu, s_awv, & ! output - plume diagnostics + mf_thflx, mf_qvflx, & ! output - plume diagnostics + mf_qcflx, & ! output - plume diagnostics mf_thlflx, mf_qtflx ) ! output - variables needed for solver ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing(1) = 0._r8 - thlm_forcing(1)= 0._r8 + rtm_forcing = 0._r8 + thlm_forcing = 0._r8 + mf_thforc = 0._r8 + mf_qvforc = 0._r8 + mf_qcforc = 0._r8 + mf_rcm = 0._r8 do k=2,pverp rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) + + mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) + + mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) + + mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) + + !mf_rcm(k) = dtime * mf_qcforc(k) end do end if @@ -2713,6 +2784,8 @@ subroutine clubb_tend_cam( & s_ae_output(i,pverp-k+1) = s_ae(k) s_aw_output(i,pverp-k+1) = s_aw(k) s_awthl_output(i,pverp-k+1) = s_awthl(k) + s_awth_output(i,pverp-k+1) = s_awth(k) + s_awqv_output(i,pverp-k+1) = s_awqv(k) s_awqt_output(i,pverp-k+1) = s_awqt(k) s_awql_output(i,pverp-k+1) = s_awql(k) s_awqi_output(i,pverp-k+1) = s_awqi(k) @@ -2720,6 +2793,16 @@ subroutine clubb_tend_cam( & s_awv_output(i,pverp-k+1) = s_awv(k) mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + mf_thflx_output(i,pverp-k+1) = mf_thflx(k) + mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) + if (k.ne.1) then + mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) + mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) + mf_thforc_output(i,pverp-k+1) = mf_thforc(k) + mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) + mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + end if end if enddo @@ -2883,7 +2966,10 @@ subroutine clubb_tend_cam( & ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor +!+++ARH ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water + !ptend_loc%q(i,k,ixcldliq) = (mf_rcm_output(i,k)+rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime +!---ARH ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit @@ -3453,12 +3539,22 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQV' , s_awqv_output, pcols, lchnk ) call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) + call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) + call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) + call outfld( 'edmf_thflx' , mf_thflx_output, pcols, lchnk ) + call outfld( 'edmf_qvflx' , mf_qvflx_output, pcols, lchnk ) + call outfld( 'edmf_thforc' , mf_thforc_output, pcols, lchnk ) + call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) + call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) + call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) end if ! Output CLUBB history here diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index f42461e702..77db651172 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -78,7 +78,9 @@ end subroutine clubb_mf_readnl subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, & ! input rho_zt, p_zt, iexner_zt, & ! input u, v, thl, qt, thv, & ! input + th, qv, qc, & ! input thl_zm, qt_zm, & ! input + th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input dry_a, moist_a, & ! output - plume diagnostics dry_w, moist_w, & ! output - plume diagnostics @@ -90,7 +92,10 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ae, aw, & ! output - diagnosed fluxes BEFORE mean field update awthl, awqt, & ! output - diagnosed fluxes BEFORE mean field update awql, awqi, & ! output - diagnosed fluxes BEFORE mean field update + awth, awqv, & ! output - diagnosed fluxes BEFORE mean field update awu, awv, & ! output - diagnosed fluxes BEFORE mean field update + thflx, qvflx, & ! output - diagnosed fluxes BEFORE mean field update + qcflx, & ! output - diagnosed fluxes BEFORE mean field update thlflx, qtflx ) ! output - variables needed for solver ! ================================================================================= ! @@ -122,11 +127,13 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, integer, intent(in) :: nz real(r8), dimension(nz), intent(in) :: u, v, & ! thermodynamic grid thl, thv, & ! thermodynamic grid - qt, & ! thermodynamic grid + th, qv, & ! thermodynamic grid + qt, qc, & ! thermodynamic grid dzt, rho_zt, & ! thermodynamic grid p_zt, iexner_zt, & ! thermodynamic grid thl_zm, & ! momentum grid - qt_zm, & ! momentum grid + th_zm, qv_zm, & + qt_zm, qc_zm, & ! momentum grid zm, & ! momentum grid p_zm, iexner_zm ! momentum grid @@ -143,15 +150,21 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ae, aw, & ! momentum grid awthl, awqt, & ! momentum grid awql, awqi, & ! momentum grid + awth, awqv, & ! momentum grid awu, awv, & ! momentum grid + thflx, qvflx, & ! momentum grid + qcflx, & ! momentum grid thlflx, qtflx ! momentum grid ! =============================================================================== ! ! INTERNAL VARIABLES ! ! sums over all plumes - real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid - awqv, awth ! momentum grid + real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid + awqc, & ! momentum grid + awthl_conv, awqt_conv, & ! momentum grid + thl_env_zm, qt_env_zm, & ! momentum grid + thl_env, qt_env ! thermodynamic grid ! ! updraft properties real(r8), dimension(nz,clubb_mf_nup) :: upw, upa, & ! momentum grid @@ -189,8 +202,10 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qtn, qsn, & ! momentum grid qcn, qln, qin, & ! momentum grid un, vn, wn2, & ! momentum grid - lmixn ! momentum grid - ! + lmixn, srfarea, & ! momentum grid + srfwqtu, srfwthvu, & + facqtu, facthvu + ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & pwmax = 3._r8 @@ -225,14 +240,20 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! fraction of rain detrained into downdrafts real(r8),parameter :: fdd = 0._r8 ! - ! to debug flag - logical :: debug = .false. - ! ! fixed entrainment rate (debug only) real(r8),parameter :: fixent = 0.004_r8 ! - ! to kludge (stagger environ values) - logical :: kludge = .false. + ! to upwind (stagger environ values) + logical :: upwind = .false. + ! + ! to scale surface fluxes + logical :: scalesrf = .false. + ! + ! to dry flux + logical :: dryflux = .false. + ! + ! to debug flag + logical :: debug = .false. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! @@ -255,15 +276,19 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, moist_qc = 0._r8 ! outputs - variables needed for solver aw = 0._r8 + awth = 0._r8 awthl = 0._r8 awqt = 0._r8 awqv = 0._r8 + awqc = 0._r8 awql = 0._r8 awqi = 0._r8 awu = 0._r8 awv = 0._r8 thlflx = 0._r8 qtflx = 0._r8 + thflx = 0._r8 + qvflx = 0._r8 ent = 0._r8 entf = 0._r8 @@ -274,6 +299,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! START MAIN COMPUTATION upw = 0._r8 + upth = 0._r8 upthl = 0._r8 upthv = 0._r8 upqt = 0._r8 @@ -338,7 +364,6 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, wmax = sigmaw * pwmax do i=1,clubb_mf_nup - wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) @@ -349,9 +374,51 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upu(1,i) = u(1) upv(1,i) = v(1) - upqt(1,i) = qt(1) + cwqt * upw(1,i) * sigmaqt/sigmaw - upthv(1,i) = thv(1) + cwthv * upw(1,i) * sigmathv/sigmaw + upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw + upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw + enddo + + facqtu=1._r8 + facthvu=1._r8 + if (scalesrf) then + ! scale surface fluxes + srfwqtu = 0._r8 + srfwthvu = 0._r8 + srfarea = 0._r8 + do i=1,clubb_mf_nup + srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) + srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) + srfarea = srfarea+upa(1,i) + end do + + if ( (srfwqtu .gt. srfarea*wqt) .and. (wqt .gt. 0._r8)) then + facqtu=srfarea*wqt/srfwqtu + endif + + if ( srfwthvu .gt. srfarea*wthv) then + facthvu=srfarea*wthv/srfwthvu + endif + + if (debug) then + if ( masterproc ) then + write(iulog,*) "facqtu, facthvu ", facqtu, facthvu + end if + end if + end if + + do i=1,clubb_mf_nup + + if (upwind) then + betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) + upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + else + upqt(1,i)=qt(1)+facqtu*upqt(1,i) + upthv(1,i)=thv(1)+facthvu*upthv(1,i) + end if upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) + upth(1,i) = upthl(1,i) ! get cloud, lowest momentum level if (do_condensation) then @@ -362,13 +429,13 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upql(1,i) = qln upqi(1,i) = qin upqs(1,i) = qsn + upth(1,i) = thn if (qcn > 0._r8) zcb(i) = zm(1) else ! assume no cldliq upqc(1,i) = 0._r8 end if - - enddo + end do ! get updraft properties do i=1,clubb_mf_nup @@ -433,6 +500,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upqi(k+1,i) = qin upqv(k+1,i) = qtn - qcn uplmix(k+1,i)= lmixn + upth(k+1,i) = thn else exit end if @@ -457,9 +525,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) if (debug) then - !if ( masterproc ) then - ! write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i - !end if + if ( masterproc ) then + write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i + end if end if ! update source terms @@ -532,30 +600,83 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) + awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) enddo enddo - if (kludge) then + if (dryflux) then + awthl_conv = awth + awqt_conv = awqv + thl_env = th + thl_env_zm = th_zm + qt_env = qv + qt_env_zm = qv_zm + else + awthl_conv = awthl + awqt_conv = awqt + thl_env = thl + thl_env_zm = thl_zm + qt_env = qt + qt_env_zm = qt_zm + end if + + if (upwind) then ! staggered environment values - betathl = (thl(4)-thl(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - - ! extrapolate to ghost point - thlflx(1)= awthl(1) - aw(1)*(thl(2)-betathl*0.5_r8*(dzt(2)+dzt(1))) - qtflx(1)= awqt(1) - aw(1)*(qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))) - do k=2,nz - thlflx(k)= awthl(k) - aw(k)*thl(k) - qtflx(k)= awqt(k) - aw(k)*qt(k) + + ! get thl & qt fluxes + betathl = (thl_env(4)-thl_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qt_env(4)-qt_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=1,nz + thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k) + qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k) + enddo + + ! get th & qv fluxes + thl_env = th + qt_env = qv + betathl = (th(4)-th(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qv(4)-qv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=1,nz + thflx(k)= awth(k) - aw(k)*thl_env(k) + qvflx(k)= awqv(k) - aw(k)*qt_env(k) + enddo + + ! get qc fluxes + qt_env = qc + betaqt = (qc(4)-qc(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=1,nz + qcflx(k)= awqc(k) - aw(k)*qt_env(k) enddo + else ! collocated environment values do k=1,nz - thlflx(k)= awthl(k) - aw(k)*thl_zm(k) - qtflx(k) = awqt(k) - aw(k)*qt_zm(k) + ! get thl & qt fluxes + thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) + qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) + + ! get th & qv fluxes + thflx(k) = awth(k) - aw(k)*th_zm(k) + qvflx(k) = awqv(k) - aw(k)*qv_zm(k) + + ! get qc fluxes + qcflx(k) = awqc(k) - aw(k)*qc_zm(k) end do endif @@ -594,6 +715,7 @@ subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) ! = Thl*Exner + L/cp*ql do i=1,niter wf = get_watf(t) + !wf = 1._r8 t = thl/iex+get_alhl(wf)/cpair*qc !as in (4) ! qsat, p is in pascal (check!) @@ -604,6 +726,7 @@ subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) enddo wf = get_watf(t) + !wf = 1._r8 t = thl/iex+get_alhl(wf)/cpair*qc call qsat(t,p,es,qs) From d866bc5f85c06b6cfcf065446e9fa95674bc38da Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 22 Jan 2021 14:54:41 -0700 Subject: [PATCH 005/466] pupwind option --- src/physics/cam/clubb_mf.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 77db651172..b6fde97626 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -244,7 +244,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, real(r8),parameter :: fixent = 0.004_r8 ! ! to upwind (stagger environ values) - logical :: upwind = .false. + logical :: pupwind = .true. ! ! to scale surface fluxes logical :: scalesrf = .false. @@ -408,7 +408,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, do i=1,clubb_mf_nup - if (upwind) then + if (pupwind) then betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) @@ -625,7 +625,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env_zm = qt_zm end if - if (upwind) then + if (pupwind) then ! staggered environment values ! get thl & qt fluxes From ce4e81d55d9f9e6dc328961e0ee76d72962fe6b6 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 8 Apr 2021 16:55:37 -0600 Subject: [PATCH 006/466] fix upwind, enfore zoer flux BC --- src/physics/cam/clubb_intr.F90 | 3 --- src/physics/cam/clubb_mf.F90 | 18 +++++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 5d114603cc..e09fce797f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2966,10 +2966,7 @@ subroutine clubb_tend_cam( & ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor -!+++ARH ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water - !ptend_loc%q(i,k,ixcldliq) = (mf_rcm_output(i,k)+rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime -!---ARH ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index b6fde97626..ae748c037f 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -635,9 +635,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=1,nz - thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k) - qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k) + do k=2,nz-1 + thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k+1) + qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) enddo ! get th & qv fluxes @@ -649,9 +649,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=1,nz - thflx(k)= awth(k) - aw(k)*thl_env(k) - qvflx(k)= awqv(k) - aw(k)*qt_env(k) + do k=2,nz-1 + thflx(k)= awth(k) - aw(k)*thl_env(k+1) + qvflx(k)= awqv(k) - aw(k)*qt_env(k+1) enddo ! get qc fluxes @@ -660,13 +660,13 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=1,nz - qcflx(k)= awqc(k) - aw(k)*qt_env(k) + do k=2,nz-1 + qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) enddo else ! collocated environment values - do k=1,nz + do k=2,nz ! get thl & qt fluxes thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) From 2e164b264adfab355187067d69d52c917cd6723c Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 8 Apr 2021 16:57:26 -0600 Subject: [PATCH 007/466] zero flux at top of model --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index ae748c037f..a45000a71f 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -666,7 +666,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, else ! collocated environment values - do k=2,nz + do k=2,nz-1 ! get thl & qt fluxes thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) From 6fe4a1502eaec5cb0f6b14fdfca758d89709c6fc Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 19 Apr 2021 15:03:46 -0600 Subject: [PATCH 008/466] cfllim on MFs --- src/physics/cam/clubb_intr.F90 | 28 +++++++++++++--- src/physics/cam/clubb_mf.F90 | 59 +++++++++++++++++----------------- 2 files changed, 52 insertions(+), 35 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index e09fce797f..995b30ed35 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1830,6 +1830,12 @@ subroutine clubb_tend_cam( & mf_qcflx, & mf_thforc, mf_qvforc, & mf_qcforc, mf_rcm +!+++ARH + ! + real(r8), dimension(pcols) :: max_cfl + real(r8) :: cflval, cflfac + logical :: cfllim +!---ARH ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid @@ -2578,6 +2584,18 @@ subroutine clubb_tend_cam( & mf_qcflx, & ! output - plume diagnostics mf_thlflx, mf_qtflx ) ! output - variables needed for solver +!+++ARH + ! CFL limiter + s_aw(0) = 0._r8 + max_cfl(i)= 0._r8 + do k=2,pverp + max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) + end do + cflval = 1._r8 + cflfac = 1._r8 + cfllim = .true. + if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) +!---ARH ! pass MF turbulent advection term as CLUBB explicit forcing term rtm_forcing = 0._r8 thlm_forcing = 0._r8 @@ -2586,19 +2604,19 @@ subroutine clubb_tend_cam( & mf_qcforc = 0._r8 mf_rcm = 0._r8 do k=2,pverp - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) - mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) - mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) - mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & + mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) !mf_rcm(k) = dtime * mf_qcforc(k) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index a45000a71f..d704cf4033 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -241,10 +241,10 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, real(r8),parameter :: fdd = 0._r8 ! ! fixed entrainment rate (debug only) - real(r8),parameter :: fixent = 0.004_r8 + real(r8),parameter :: fixent = 1.e-3_r8 ! ! to upwind (stagger environ values) - logical :: pupwind = .true. + logical :: pupwind = .false. ! ! to scale surface fluxes logical :: scalesrf = .false. @@ -390,20 +390,14 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) srfarea = srfarea+upa(1,i) end do - - if ( (srfwqtu .gt. srfarea*wqt) .and. (wqt .gt. 0._r8)) then - facqtu=srfarea*wqt/srfwqtu - endif - - if ( srfwthvu .gt. srfarea*wthv) then - facthvu=srfarea*wthv/srfwthvu - endif - - if (debug) then - if ( masterproc ) then - write(iulog,*) "facqtu, facthvu ", facqtu, facthvu - end if - end if + facqtu=srfarea*wqt/srfwqtu + facthvu=srfarea*wthv/srfwthvu + + !if (debug) then + ! if ( masterproc ) then + ! write(iulog,*) "facqtu, facthvu ", facqtu, facthvu + ! end if + !end if end if do i=1,clubb_mf_nup @@ -471,11 +465,11 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! get buoyancy B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) - if (debug) then - if ( masterproc ) then - write(iulog,*) "B(k,i), k, i ", B, k, i - end if - end if + !if (debug) then + ! if ( masterproc ) then + ! write(iulog,*) "B(k,i), k, i ", B, k, i + ! end if + !end if ! get wn^2 wp = wb*ent(k+1,i) @@ -524,11 +518,11 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, uprr(k,i) = uprr(k+1,i) & - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) - if (debug) then - if ( masterproc ) then - write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i - end if - end if + !if (debug) then + ! if ( masterproc ) then + ! write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i + ! end if + !end if ! update source terms lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) @@ -625,6 +619,11 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env_zm = qt_zm end if + kstart = 2 + if (scalesrf) then + kstart = 1 + end if + if (pupwind) then ! staggered environment values @@ -635,7 +634,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=2,nz-1 + do k=kstart,nz-1 thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k+1) qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) enddo @@ -649,7 +648,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=2,nz-1 + do k=kstart,nz-1 thflx(k)= awth(k) - aw(k)*thl_env(k+1) qvflx(k)= awqv(k) - aw(k)*qt_env(k+1) enddo @@ -660,13 +659,13 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=2,nz-1 + do k=kstart,nz-1 qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) enddo else ! collocated environment values - do k=2,nz-1 + do k=kstart,nz-1 ! get thl & qt fluxes thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) From 6b2ee8f37725e7af9d0b8fc627c044bd83e978f8 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 19 Apr 2021 15:07:42 -0600 Subject: [PATCH 009/466] new clubb externals --- Externals_CAM.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 27074c8781..1452e56bc5 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -22,8 +22,8 @@ required = True [clubb] local_path = src/physics/clubb protocol = git -repo_url = https://github.com/ESCOMP/CLUBB_CESM -tag = clubb_release_b76a124_20200220_c20200320 +repo_url = https://github.com/adamrher/CLUBB_CESM +tag = clubb_release_b76a124.clubbmf required = True [silhs] From acb466b357ecf9c4bf8eaa6086fc4f6f66007b9b Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 19 Apr 2021 15:22:34 -0600 Subject: [PATCH 010/466] add kstart --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index d704cf4033..0859799ecc 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -185,7 +185,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid ! ! other variables - integer :: k,i,ih + integer :: k,i,kstart real(r8), dimension(clubb_mf_nup) :: zcb real(r8) :: zcb_unset, & wthv, & From f7f6994b658103de7aa1da31f96eee0523fd5701 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Wed, 28 Apr 2021 13:18:43 -0600 Subject: [PATCH 011/466] Now compute plume theta_v flux in integrate_mf, added mf_thvflx to EDMF output in clubb_intr.F90 --- src/physics/cam/clubb_intr.F90 | 15 +++++++++++---- src/physics/cam/clubb_mf.F90 | 22 ++++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 995b30ed35..8c3f360a7f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1206,6 +1206,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) + call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thv flux (EDMF)' ) call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) @@ -1333,6 +1334,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_S_AWU' , 1, ' ') call add_default( 'edmf_S_AWV' , 1, ' ') call add_default( 'edmf_thlflx' , 1, ' ') + call add_default( 'edmf_thvflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') call add_default( 'edmf_thlforc' , 1, ' ') call add_default( 'edmf_qtforc' , 1, ' ') @@ -1806,7 +1808,8 @@ subroutine clubb_tend_cam( & s_awth_output, s_awqv_output, & s_awu_output, s_awv_output, & mf_thflx_output, mf_qvflx_output, & - mf_thlflx_output, mf_qtflx_output + mf_thlflx_output, mf_qtflx_output, & + mf_thvflx_output ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid @@ -1827,7 +1830,7 @@ subroutine clubb_tend_cam( & s_awu, s_awv, & mf_thflx, mf_qvflx, & mf_thlflx, mf_qtflx, & - mf_qcflx, & + mf_thvflx, mf_qcflx, & mf_thforc, mf_qvforc, & mf_qcforc, mf_rcm !+++ARH @@ -2212,6 +2215,7 @@ subroutine clubb_tend_cam( & s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 mf_thlflx_output(:,:) = 0._r8 + mf_thvflx_output(:,:) = 0._r8 mf_qtflx_output(:,:) = 0._r8 mf_thflx_output(:,:) = 0._r8 mf_qvflx_output(:,:) = 0._r8 @@ -2565,7 +2569,7 @@ subroutine clubb_tend_cam( & rho_zt, p_in_Pa, invrs_exner_zt, & ! input um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, & ! input + thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input mf_dry_a, mf_moist_a, & ! output - plume diagnostics @@ -2581,7 +2585,7 @@ subroutine clubb_tend_cam( & s_awth, s_awqv, & ! output - plume diagnostics s_awu, s_awv, & ! output - plume diagnostics mf_thflx, mf_qvflx, & ! output - plume diagnostics - mf_qcflx, & ! output - plume diagnostics + mf_thvflx, mf_qcflx, & ! output - plume diagnostics mf_thlflx, mf_qtflx ) ! output - variables needed for solver !+++ARH @@ -2798,6 +2802,7 @@ subroutine clubb_tend_cam( & mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) s_ae_output(i,pverp-k+1) = s_ae(k) s_aw_output(i,pverp-k+1) = s_aw(k) @@ -3303,6 +3308,7 @@ subroutine clubb_tend_cam( & tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy if (do_clubb_mf) then mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair + mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap end if enddo @@ -3561,6 +3567,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) + call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 0859799ecc..1819eb5163 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -79,7 +79,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, rho_zt, p_zt, iexner_zt, & ! input u, v, thl, qt, thv, & ! input th, qv, qc, & ! input - thl_zm, qt_zm, & ! input + thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input dry_a, moist_a, & ! output - plume diagnostics @@ -95,7 +95,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, awth, awqv, & ! output - diagnosed fluxes BEFORE mean field update awu, awv, & ! output - diagnosed fluxes BEFORE mean field update thflx, qvflx, & ! output - diagnosed fluxes BEFORE mean field update - qcflx, & ! output - diagnosed fluxes BEFORE mean field update + thvflx, qcflx, & ! output - diagnosed fluxes BEFORE mean field update thlflx, qtflx ) ! output - variables needed for solver ! ================================================================================= ! @@ -131,7 +131,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt, qc, & ! thermodynamic grid dzt, rho_zt, & ! thermodynamic grid p_zt, iexner_zt, & ! thermodynamic grid - thl_zm, & ! momentum grid + thl_zm, thv_zm, & ! momentum grid th_zm, qv_zm, & qt_zm, qc_zm, & ! momentum grid zm, & ! momentum grid @@ -153,7 +153,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, awth, awqv, & ! momentum grid awu, awv, & ! momentum grid thflx, qvflx, & ! momentum grid - qcflx, & ! momentum grid + thvflx, qcflx, & ! momentum grid thlflx, qtflx ! momentum grid ! =============================================================================== ! @@ -161,10 +161,12 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! ! sums over all plumes real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid - awqc, & ! momentum grid + awthv, awqc, & ! momentum grid awthl_conv, awqt_conv, & ! momentum grid + thv_env_zm, awthv_conv, & ! MKW thl_env_zm, qt_env_zm, & ! momentum grid - thl_env, qt_env ! thermodynamic grid + thl_env, qt_env, & ! thermodynamic grid + thv_env ! ! updraft properties real(r8), dimension(nz,clubb_mf_nup) :: upw, upa, & ! momentum grid @@ -278,6 +280,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, aw = 0._r8 awth = 0._r8 awthl = 0._r8 + awthv = 0._r8 awqt = 0._r8 awqv = 0._r8 awqc = 0._r8 @@ -286,6 +289,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, awu = 0._r8 awv = 0._r8 thlflx = 0._r8 + thvflx = 0._r8 qtflx = 0._r8 thflx = 0._r8 qvflx = 0._r8 @@ -618,6 +622,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, qt_env = qt qt_env_zm = qt_zm end if + awthv_conv = awthv + thv_env = thv + thv_env_zm = thv_zm kstart = 2 if (scalesrf) then @@ -676,6 +683,9 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, ! get qc fluxes qcflx(k) = awqc(k) - aw(k)*qc_zm(k) + + ! get thv flux + thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) end do endif From dd71d38dde036b5661ad4ca4f2aa00e994f20a95 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 28 Apr 2021 18:47:13 -0600 Subject: [PATCH 012/466] code cleanup, added diagnostics, noice logical set to true --- src/physics/cam/clubb_intr.F90 | 154 +++++++++++++++++++++++++++++---- src/physics/cam/clubb_mf.F90 | 63 ++++++++++---- 2 files changed, 181 insertions(+), 36 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 995b30ed35..b399785323 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -30,7 +30,8 @@ module clubb_intr #ifdef CLUBB_SGS use clubb_api_module, only: pdf_parameter, implicit_coefs_terms use clubb_api_module, only: clubb_config_flags_type - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag + use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup + use cam_history_support, only: add_hist_coord #endif implicit none @@ -1215,6 +1216,18 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'lev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) + call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + + call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') + call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) + call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) + call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) + call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) + call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if ! Initialize statistics, below are dummy variables @@ -1342,6 +1355,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_qvforc' , 1, ' ') call add_default( 'edmf_qcforc' , 1, ' ') call add_default( 'edmf_rcm' , 1, ' ') + call add_default( 'edmf_cloudfrac', 1, ' ') end if end if @@ -1811,7 +1825,30 @@ subroutine clubb_tend_cam( & ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output, mf_rcm_output + mf_qcforc_output, & ! thermodynamic grid + mf_rcm_output, mf_cloudfrac_output ! momentum grid + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & + mf_upw_flip, & + mf_upqt_flip, & + mf_upthl_flip, & + mf_upthv_flip, & + mf_upth_flip, & + mf_upqc_flip, & + mf_upbuoy_flip, & + mf_upent_flip + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & + mf_upw_output, & + mf_upqt_output, & + mf_upthl_output, & + mf_upthv_output, & + mf_upth_output, & + mf_upqc_output, & + mf_upent_output + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output + ! MF Plume real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & mf_dry_w, mf_moist_w, & @@ -1829,13 +1866,23 @@ subroutine clubb_tend_cam( & mf_thlflx, mf_qtflx, & mf_qcflx, & mf_thforc, mf_qvforc, & - mf_qcforc, mf_rcm -!+++ARH - ! + mf_qcforc, & + mf_rcm, mf_cloudfrac + ! MF plume level + real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & + mf_upw, & + mf_upqt, & + mf_upthl, & + mf_upthv, & + mf_upth, & + mf_upqc, & + mf_upbuoy, & + mf_upent + ! CFL limiter vars real(r8), dimension(pcols) :: max_cfl real(r8) :: cflval, cflfac logical :: cfllim -!---ARH + ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid @@ -1845,7 +1892,7 @@ subroutine clubb_tend_cam( & th_zm, qv_zm, & ! momentum grid qc_zm, & ! momentum grid kappa_zm, p_in_Pa_zm, & ! momentum grid - invrs_exner_zm ! momentum grid + dzm, invrs_exner_zm ! momentum grid real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs @@ -2211,6 +2258,24 @@ subroutine clubb_tend_cam( & s_awqv_output(:,:) = 0._r8 s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 + mf_upa_output(:,:) = 0._r8 + mf_upw_output(:,:) = 0._r8 + mf_upqt_output(:,:) = 0._r8 + mf_upthl_output(:,:) = 0._r8 + mf_upthv_output(:,:) = 0._r8 + mf_upth_output(:,:) = 0._r8 + mf_upqc_output(:,:) = 0._r8 + mf_upbuoy_output(:,:) = 0._r8 + mf_upent_output(:,:) = 0._r8 + mf_upa_flip(:,:,:) = 0._r8 + mf_upw_flip(:,:,:) = 0._r8 + mf_upqt_flip(:,:,:) = 0._r8 + mf_upthl_flip(:,:,:) = 0._r8 + mf_upthv_flip(:,:,:) = 0._r8 + mf_upth_flip(:,:,:) = 0._r8 + mf_upqc_flip(:,:,:) = 0._r8 + mf_upbuoy_flip(:,:,:) = 0._r8 + mf_upent_flip(:,:,:) = 0._r8 mf_thlflx_output(:,:) = 0._r8 mf_qtflx_output(:,:) = 0._r8 mf_thflx_output(:,:) = 0._r8 @@ -2221,6 +2286,7 @@ subroutine clubb_tend_cam( & mf_qvforc_output(:,:) = 0._r8 mf_qcforc_output(:,:) = 0._r8 mf_rcm_output(:,:) = 0._r8 + mf_cloudfrac_output(:,:) = 0._r8 ! Loop over all columns in lchnk to advance CLUBB core do i=1,ncol ! loop over columns @@ -2551,8 +2617,10 @@ subroutine clubb_tend_cam( & do k=2,pverp dzt(k) = zi_g(k) - zi_g(k-1) + dzm(k-1) = zt_g(k) - zt_g(k-1) enddo dzt(1) = dzt(2) + dzm(pverp) = dzm(pver) invrs_dzt = 1._r8/dzt rtm_zm_in = zt2zm_api( rtm_in ) @@ -2561,13 +2629,23 @@ subroutine clubb_tend_cam( & qv_zm = zt2zm_api( qv_zt ) qc_zm = zt2zm_api( qc_zt ) - call integrate_mf( pverp, dzt, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, p_in_Pa, invrs_exner_zt, & ! input + call integrate_mf( pverp, & ! input + rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input + rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input th_zt, qv_zt, qc_zt, & ! input thlm_zm_in, rtm_zm_in, & ! input th_zm, qv_zm, qc_zm, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + mf_upa, & ! output - plume diagnostics + mf_upw, & ! output - plume diagnostics + mf_upqt, & ! output - plume diagnostics + mf_upthl, & ! output - plume diagnostics + mf_upthv, & ! output - plume diagnostics + mf_upth, & ! output - plume diagnostics + mf_upqc, & ! output - plume diagnostics + mf_upbuoy, & ! output - plume diagnostics + mf_upent, & ! output - plume diagnostics mf_dry_a, mf_moist_a, & ! output - plume diagnostics mf_dry_w, mf_moist_w, & ! output - plume diagnostics mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics @@ -2584,7 +2662,6 @@ subroutine clubb_tend_cam( & mf_qcflx, & ! output - plume diagnostics mf_thlflx, mf_qtflx ) ! output - variables needed for solver -!+++ARH ! CFL limiter s_aw(0) = 0._r8 max_cfl(i)= 0._r8 @@ -2595,14 +2672,13 @@ subroutine clubb_tend_cam( & cflfac = 1._r8 cfllim = .true. if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) -!---ARH + ! pass MF turbulent advection term as CLUBB explicit forcing term rtm_forcing = 0._r8 thlm_forcing = 0._r8 mf_thforc = 0._r8 mf_qvforc = 0._r8 mf_qcforc = 0._r8 - mf_rcm = 0._r8 do k=2,pverp rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) @@ -2619,8 +2695,12 @@ subroutine clubb_tend_cam( & mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) - !mf_rcm(k) = dtime * mf_qcforc(k) end do + ! compute ensemble cloud + mf_rcm = 0._r8 + mf_cloudfrac = 0._r8 + mf_rcm(:pverp) = s_aw(:pverp)*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= s_aw(:pverp) end if @@ -2813,18 +2893,44 @@ subroutine clubb_tend_cam( & mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) mf_thflx_output(i,pverp-k+1) = mf_thflx(k) mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(k) if (k.ne.1) then - mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) - mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) - mf_thforc_output(i,pverp-k+1) = mf_thforc(k) - mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) - mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) + mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) + mf_thforc_output(i,pverp-k+1) = mf_thforc(k) + mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) + mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) end if + + mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) + mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) + mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) + mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) + end if enddo + if (do_clubb_mf) then + do k=1,clubb_mf_nup + mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) + mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) + mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) + mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) + mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) + mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) + mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) + end do + end if + ! Values to use above top_lev, for variables that have not already been ! set up there. These are mostly fill values that should not actually be ! used in the run, but may end up in diagnostic output. @@ -3570,6 +3676,16 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) + call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) + call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) + call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) + call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) + call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) + call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) + call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) + call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) + call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) + call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) end if ! Output CLUBB history here diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 0859799ecc..59faa095d8 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -16,7 +16,8 @@ module clubb_mf public :: integrate_mf, & clubb_mf_readnl, & do_clubb_mf, & - do_clubb_mf_diag + do_clubb_mf_diag, & + clubb_mf_nup real(r8) :: clubb_mf_L0 = 0._r8 real(r8) :: clubb_mf_ent0 = 0._r8 @@ -75,13 +76,23 @@ subroutine clubb_mf_readnl(nlfile) end subroutine clubb_mf_readnl - subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, & ! input - rho_zt, p_zt, iexner_zt, & ! input + subroutine integrate_mf( nz, & ! input + rho_zm, dzm, zm, p_zm, iexner_zm, & ! input + rho_zt, dzt, zt, p_zt, iexner_zt, & ! input u, v, thl, qt, thv, & ! input th, qv, qc, & ! input thl_zm, qt_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input + upa, & ! output - plume diagnostics + upw, & ! output - plume diagnostics + upqt, & ! output - plume diagnostics + upthl, & ! output - plume diagnostics + upthv, & ! output - plume diagnostics + upth, & ! output - plume diagnostics + upqc, & ! output - plume diagnostics + upbuoy, & ! output - plume diagnostics + ent, & ! output - plume diagnostics dry_a, moist_a, & ! output - plume diagnostics dry_w, moist_w, & ! output - plume diagnostics dry_qt, moist_qt, & ! output - plume diagnostics @@ -129,17 +140,29 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, thl, thv, & ! thermodynamic grid th, qv, & ! thermodynamic grid qt, qc, & ! thermodynamic grid - dzt, rho_zt, & ! thermodynamic grid p_zt, iexner_zt, & ! thermodynamic grid + dzt, rho_zt, & ! thermodynamic grid + zt, & ! thermodynamic grid thl_zm, & ! momentum grid - th_zm, qv_zm, & + th_zm, qv_zm, & ! momentum grid qt_zm, qc_zm, & ! momentum grid - zm, & ! momentum grid - p_zm, iexner_zm ! momentum grid + p_zm, iexner_zm, & ! momentum grid + dzm, rho_zm, & ! momentum grid + zm ! momentum grid real(r8), intent(in) :: wthl,wqt real(r8), intent(inout) :: pblh + real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid + upw, & ! momentum grid + upqt, & ! momentum grid + upthl, & ! momentum grid + upthv, & ! momentum grid + upth, & ! momentum grid + upqc, & ! momentum grid + upbuoy, & ! momentum grid + ent + real(r8),dimension(nz), intent(out) :: dry_a, moist_a, & ! momentum grid dry_w, moist_w, & ! momentum grid dry_qt, moist_qt, & ! momentum grid @@ -167,12 +190,8 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, thl_env, qt_env ! thermodynamic grid ! ! updraft properties - real(r8), dimension(nz,clubb_mf_nup) :: upw, upa, & ! momentum grid - upqt, upqc, & ! momentum grid - upqv, upqs, & ! momentum grid + real(r8), dimension(nz,clubb_mf_nup) :: upqv, upqs, & ! momentum grid upql, upqi, & ! momentum grid - upth, upthv, & ! momentum grid - upthl, & ! momentum grid upu, upv, & ! momentum grid uplmix ! momentum grid ! @@ -181,7 +200,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, uprr ! thermodynamic grid ! ! entrainment profiles - real(r8), dimension(nz,clubb_mf_nup) :: ent, entf ! thermodynamic grid + real(r8), dimension(nz,clubb_mf_nup) :: entf ! thermodynamic grid integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid ! ! other variables @@ -312,6 +331,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upqi = 0._r8 upqv = 0._r8 upqs = 0._r8 + upbuoy= 0._r8 uplmix= 0._r8 uprr = 0._r8 supqt = 0._r8 @@ -495,6 +515,7 @@ subroutine integrate_mf( nz, dzt, zm, p_zm, iexner_zm, upqv(k+1,i) = qtn - qcn uplmix(k+1,i)= lmixn upth(k+1,i) = thn + upbuoy(k+1,i)= B else exit end if @@ -696,6 +717,7 @@ subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) !local variables integer :: niter,i real(r8) :: diff,t,qstmp,qcold,es,wf + logical :: noice = .true. ! max number of iterations niter=50 @@ -713,8 +735,12 @@ subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) ! T = Th*Exner=(Thl+L/cp*ql/Exner)*Exner (4) ! = Thl*Exner + L/cp*ql do i=1,niter - wf = get_watf(t) - !wf = 1._r8 + + if (noice) then + wf = 1._r8 + else + wf = get_watf(t) + end if t = thl/iex+get_alhl(wf)/cpair*qc !as in (4) ! qsat, p is in pascal (check!) @@ -724,8 +750,11 @@ subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) if (abs(qc-qcold) Date: Thu, 29 Apr 2021 22:33:47 -0600 Subject: [PATCH 013/466] added ARM Shallow Cumulus and Siebesma et al. (2007) dry PBL case 1 to cime_config/usermod_dirs --- .../scam_arm_shallow/shell_commands | 16 ++++++++++++++++ .../usermods_dirs/scam_arm_shallow/user_nl_cam | 16 ++++++++++++++++ .../usermods_dirs/scam_dry/shell_commands | 16 ++++++++++++++++ cime_config/usermods_dirs/scam_dry/user_nl_cam | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100755 cime_config/usermods_dirs/scam_arm_shallow/shell_commands create mode 100644 cime_config/usermods_dirs/scam_arm_shallow/user_nl_cam create mode 100755 cime_config/usermods_dirs/scam_dry/shell_commands create mode 100644 cime_config/usermods_dirs/scam_dry/user_nl_cam diff --git a/cime_config/usermods_dirs/scam_arm_shallow/shell_commands b/cime_config/usermods_dirs/scam_arm_shallow/shell_commands new file mode 100755 index 0000000000..e321cfc46e --- /dev/null +++ b/cime_config/usermods_dirs/scam_arm_shallow/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +./xmlchange PTS_LON=262.5 +./xmlchange PTS_LAT=36.6 + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +./xmlchange RUN_STARTDATE=1997-06-21 +./xmlchange START_TOD=0 +./xmlchange STOP_OPTION=nhours +./xmlchange STOP_N=14 + +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. diff --git a/cime_config/usermods_dirs/scam_arm_shallow/user_nl_cam b/cime_config/usermods_dirs/scam_arm_shallow/user_nl_cam new file mode 100644 index 0000000000..ea918aca1a --- /dev/null +++ b/cime_config/usermods_dirs/scam_arm_shallow/user_nl_cam @@ -0,0 +1,16 @@ +iopfile="/glade/u/home/mkwitte/scam_iop_nc/ARM_shallow_iopfile_4scam.nc" +ncdata="/glade/u/home/mkwitte/scam_iop_nc/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc" +mfilt=2088 +nhtfrq=1 +co2vmr=368.9e-6 +scm_use_obs_uv = .true. +scm_relaxation = .true. +scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' +scm_relax_bot_p = 105000. +scm_relax_top_p = 200. +scm_relax_linear = .true. +scm_relax_tau_bot_sec = 864000. +scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. diff --git a/cime_config/usermods_dirs/scam_dry/shell_commands b/cime_config/usermods_dirs/scam_dry/shell_commands new file mode 100755 index 0000000000..34041cdebe --- /dev/null +++ b/cime_config/usermods_dirs/scam_dry/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +./xmlchange PTS_LON=300. +./xmlchange PTS_LAT=15. + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +./xmlchange RUN_STARTDATE=1969-06-25 +./xmlchange START_TOD=0 +./xmlchange STOP_OPTION=nhours +./xmlchange STOP_N=10 + +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. diff --git a/cime_config/usermods_dirs/scam_dry/user_nl_cam b/cime_config/usermods_dirs/scam_dry/user_nl_cam new file mode 100644 index 0000000000..ad485b966e --- /dev/null +++ b/cime_config/usermods_dirs/scam_dry/user_nl_cam @@ -0,0 +1,16 @@ +iopfile="/glade/u/home/mkwitte/scam_iop_nc/input_DRY.nc" +ncdata="/glade/u/home/mkwitte/scam_iop_nc/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc" +mfilt=2088 +nhtfrq=1 +co2vmr=368.9e-6 +scm_use_obs_uv = .true. +scm_relaxation = .true. +scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' +scm_relax_bot_p = 105000. +scm_relax_top_p = 200. +scm_relax_linear = .true. +scm_relax_tau_bot_sec = 864000. +scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. From d348310f0dce2abc502869646327d9595c11efd8 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 30 Apr 2021 14:49:32 -0600 Subject: [PATCH 014/466] set scm_iop_lhflxshflxTg = T for BOMEX,DYCOMSRF02,SAS --- cime_config/usermods_dirs/scam_SAS/user_nl_cam | 1 + cime_config/usermods_dirs/scam_bomex/user_nl_cam | 1 + cime_config/usermods_dirs/scam_dycomsRF01/user_nl_cam | 1 + 3 files changed, 3 insertions(+) diff --git a/cime_config/usermods_dirs/scam_SAS/user_nl_cam b/cime_config/usermods_dirs/scam_SAS/user_nl_cam index 9a5a9304d7..8ad1ba8715 100644 --- a/cime_config/usermods_dirs/scam_SAS/user_nl_cam +++ b/cime_config/usermods_dirs/scam_SAS/user_nl_cam @@ -15,3 +15,4 @@ scm_relax_top_p = 200. scm_relax_linear = .true. scm_relax_tau_bot_sec = 864000. scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. diff --git a/cime_config/usermods_dirs/scam_bomex/user_nl_cam b/cime_config/usermods_dirs/scam_bomex/user_nl_cam index e9132902b8..1ff9ad5393 100644 --- a/cime_config/usermods_dirs/scam_bomex/user_nl_cam +++ b/cime_config/usermods_dirs/scam_bomex/user_nl_cam @@ -12,3 +12,4 @@ scm_relax_top_p = 200. scm_relax_linear = .true. scm_relax_tau_bot_sec = 864000. scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. diff --git a/cime_config/usermods_dirs/scam_dycomsRF01/user_nl_cam b/cime_config/usermods_dirs/scam_dycomsRF01/user_nl_cam index 76a2c10c55..d40adae86a 100644 --- a/cime_config/usermods_dirs/scam_dycomsRF01/user_nl_cam +++ b/cime_config/usermods_dirs/scam_dycomsRF01/user_nl_cam @@ -13,3 +13,4 @@ scm_relax_top_p = 200. scm_relax_linear = .true. scm_relax_tau_bot_sec = 864000. scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. From 3df6bab89808726cf194a6a96d9c35a024f75bf2 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Wed, 5 May 2021 11:36:10 -0600 Subject: [PATCH 015/466] Fixed bug in thvflx calculation (awthv not set) --- src/physics/cam/clubb_mf.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 4152a575e3..5a0d4b773c 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -619,6 +619,7 @@ subroutine integrate_mf( nz, awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) From 24b5a2743ead2441235af43b6b70a4ad00e14106 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 6 May 2021 09:36:29 -0600 Subject: [PATCH 016/466] swapped cime externals to my fork --- Externals.cfg | 4 ++-- src/physics/cam/clubb_mf.F90 | 24 ++++++------------------ 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 511f55d36c..4836687e6d 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -9,9 +9,9 @@ local_path = components/cice required = True [cime] -tag = cime5.8.34 +tag = cime5.8.34.clubbmf protocol = git -repo_url = https://github.com/ESMCI/cime +repo_url = https://github.com/adamrher/cime local_path = cime required = True diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 5a0d4b773c..109fcd07d0 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -270,9 +270,6 @@ subroutine integrate_mf( nz, ! to scale surface fluxes logical :: scalesrf = .false. ! - ! to dry flux - logical :: dryflux = .false. - ! ! to debug flag logical :: debug = .false. @@ -629,21 +626,12 @@ subroutine integrate_mf( nz, enddo enddo - if (dryflux) then - awthl_conv = awth - awqt_conv = awqv - thl_env = th - thl_env_zm = th_zm - qt_env = qv - qt_env_zm = qv_zm - else - awthl_conv = awthl - awqt_conv = awqt - thl_env = thl - thl_env_zm = thl_zm - qt_env = qt - qt_env_zm = qt_zm - end if + awthl_conv = awthl + awqt_conv = awqt + thl_env = thl + thl_env_zm = thl_zm + qt_env = qt + qt_env_zm = qt_zm awthv_conv = awthv thv_env = thv thv_env_zm = thv_zm From 1adfd58e1a71d94a02260da6c4edcef992a393f4 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 6 May 2021 10:16:33 -0600 Subject: [PATCH 017/466] new scam time-stepping --- bld/namelist_files/namelist_defaults_cam.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index f83f2b03c9..ee556760cf 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1910,6 +1910,9 @@ 1 1 3 + + 6 + 6 1.0D0 From b6c6e363c5d03425e6bd1a5f05982fd11248cabc Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 12 May 2021 18:56:42 -0600 Subject: [PATCH 018/466] 2 bugfixes, wpthvp and mf_rcm/cloudfrac --- src/physics/cam/clubb_intr.F90 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 9aacf2a272..c0ee8f4e61 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2703,8 +2703,8 @@ subroutine clubb_tend_cam( & ! compute ensemble cloud mf_rcm = 0._r8 mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = s_aw(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= s_aw(:pverp) + mf_rcm(:pverp) = (1._r8 - s_ae(:pverp))*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= 1._r8 - s_ae(:pverp) end if @@ -3407,6 +3407,7 @@ subroutine clubb_tend_cam( & do k=1,pverp do i=1,ncol + wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output @@ -3613,7 +3614,7 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - temp2dp(:ncol,:) = wpthvp(:ncol,:) * cpair + temp2dp(:ncol,:) = wpthvp(:ncol,:) call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) From 95aa0b5ead69875c71be9c57876eb16340158db7 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 17 May 2021 18:23:56 -0600 Subject: [PATCH 019/466] substep level diagnostics added --- src/physics/cam/clubb_intr.F90 | 128 +++++++++++++++++++++++++++++++-- src/physics/cam/clubb_mf.F90 | 2 +- 2 files changed, 123 insertions(+), 7 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index c0ee8f4e61..d464195509 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -255,6 +255,18 @@ module clubb_intr dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. + integer :: & + qt_macmic_idx, & + thl_macmic_idx, & + rcm_macmic_idx, & + cldfrac_macmic_idx, & + wpthlp_macmic_idx, & + wprtp_macmic_idx, & + wpthvp_macmic_idx, & + mf_wpthlp_macmic_idx, & + mf_wprtp_macmic_idx, & + mf_wpthvp_macmic_idx + ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -296,11 +308,15 @@ subroutine clubb_register_cam( ) ! Add CLUBB fields to pbuf use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls use subcol_utils, only: subcol_get_scheme + + integer :: cld_macmic_num_steps call phys_getopts( eddy_scheme_out = eddy_scheme, & deep_scheme_out = deep_scheme, & history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num ) + history_budget_histfile_num_out = history_budget_histfile_num, & + cld_macmic_num_steps_out = cld_macmic_num_steps) + subcol_scheme = subcol_get_scheme() if (trim(subcol_scheme) == 'SILHS') then @@ -382,6 +398,19 @@ subroutine clubb_register_cam( ) call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) + call pbuf_add_field('QT_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) + call pbuf_add_field('THETAL_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) + call pbuf_add_field('RCM_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) + call pbuf_add_field('CLDFRAC_CLUBB_macmic','global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) + call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) + call pbuf_add_field('WPRTP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) + call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) + if (do_clubb_mf) then + call pbuf_add_field('edmf_thlflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) + call pbuf_add_field('edmf_qtflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) + call pbuf_add_field('edmf_thvflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) + end if + #endif end subroutine clubb_register_cam @@ -845,6 +874,8 @@ subroutine clubb_ini_cam(pbuf2d) ! The similar name to clubb_history is unfortunate... logical :: history_amwg, history_clubb + integer :: cld_macmic_num_steps + integer :: err_code ! Code for when CLUBB fails integer :: j, k, l ! Indices integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) @@ -897,7 +928,8 @@ subroutine clubb_ini_cam(pbuf2d) call phys_getopts(prog_modal_aero_out=prog_modal_aero, & history_amwg_out=history_amwg, & - history_clubb_out=history_clubb) + history_clubb_out=history_clubb, & + cld_macmic_num_steps_out = cld_macmic_num_steps) ! Select variables to apply tendencies back to CAM @@ -1184,6 +1216,7 @@ subroutine clubb_ini_cam(pbuf2d) ! ---------------------------------------------------------------------------- ! ! Below are for detailed analysis of EDMF Scheme ! ! ---------------------------------------------------------------------------- ! + if (do_clubb_mf) then call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) @@ -1231,6 +1264,20 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if + call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') + call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') + call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') + call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') + call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') + call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') + call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') + if (do_clubb_mf) then + call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) + end if + ! Initialize statistics, below are dummy variables dum1 = 300._r8 dum2 = 1200._r8 @@ -1360,6 +1407,19 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_cloudfrac', 1, ' ') end if + call add_default( 'QT_macmic' , 1, ' ') + call add_default( 'THETAL_macmic' , 1, ' ') + call add_default( 'RCM_CLUBB_macmic' , 1, ' ') + call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') + call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') + if (do_clubb_mf_diag) then + call add_default( 'edmf_thlflx_macmic' , 1, ' ') + call add_default( 'edmf_qtflx_macmic' , 1, ' ') + call add_default( 'edmf_thvflx_macmic' , 1, ' ') + end if + end if if (history_amwg) then @@ -1797,6 +1857,17 @@ subroutine clubb_tend_cam( & real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. + real(r8), pointer :: qt_macmic(:,:) + real(r8), pointer :: thl_macmic(:,:) + real(r8), pointer :: rcm_macmic(:,:) + real(r8), pointer :: cldfrac_macmic(:,:) + real(r8), pointer :: wpthlp_macmic(:,:) + real(r8), pointer :: wprtp_macmic(:,:) + real(r8), pointer :: wpthvp_macmic(:,:) + real(r8), pointer :: mf_thlflx_macmic(:,:) + real(r8), pointer :: mf_qtflx_macmic(:,:) + real(r8), pointer :: mf_thvflx_macmic(:,:) + real(r8) :: stend(pcols,pver) real(r8) :: qvtend(pcols,pver) real(r8) :: qctend(pcols,pver) @@ -2033,6 +2104,19 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) + call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) + call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) + call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) + call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) + call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) + call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) + call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) + if (do_clubb_mf) then + call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) + call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) + call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) + end if + ! Initialize the apply_const variable (note special logic is due to eularian backstepping) if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then apply_const = 0._r8 ! On first time through do not remove constant @@ -2703,8 +2787,8 @@ subroutine clubb_tend_cam( & ! compute ensemble cloud mf_rcm = 0._r8 mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = (1._r8 - s_ae(:pverp))*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= 1._r8 - s_ae(:pverp) + mf_rcm(:pverp) = s_aw(:pverp)*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= s_aw(:pverp) end if @@ -3407,12 +3491,12 @@ subroutine clubb_tend_cam( & do k=1,pverp do i=1,ncol - wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy + wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair if (do_clubb_mf) then mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair @@ -3420,6 +3504,23 @@ subroutine clubb_tend_cam( & end if enddo enddo + + do k=1,pverp + do i=1,ncol + qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) + thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) + rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) + cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) + wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) + wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) + wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) + if (do_clubb_mf) then + mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) + mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) + mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) + end if + enddo + enddo ! --------------------------------------------------------------------------------- ! ! Diagnose some quantities that are computed in macrop_tend here. ! @@ -3647,7 +3748,6 @@ subroutine clubb_tend_cam( & call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - ! --------------------------------------------------------------- ! ! Writing state variables after EDMF scheme for detailed analysis ! ! --------------------------------------------------------------- ! @@ -3696,6 +3796,22 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) end if + if (macmic_it==cld_macmic_num_steps) then + call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) + call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) + call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) + call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) + + call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) + call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) + if (do_clubb_mf) then + call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) + call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) + call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) + end if + end if + ! Output CLUBB history here if (l_stats) then diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 109fcd07d0..64611fde7d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -265,7 +265,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: fixent = 1.e-3_r8 ! ! to upwind (stagger environ values) - logical :: pupwind = .false. + logical :: pupwind = .true. ! ! to scale surface fluxes logical :: scalesrf = .false. From 4f235726a71958221c3d10bd85800808566c7c74 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 18 May 2021 14:58:53 -0600 Subject: [PATCH 020/466] fix mf_rcm/mf_cloudfrac bugs --- src/physics/cam/clubb_intr.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d464195509..7eb5ade136 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1249,8 +1249,8 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'lev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) + call addfld ( 'edmf_cloudfrac', (/ 'ilev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) @@ -1894,13 +1894,13 @@ subroutine clubb_tend_cam( & s_awu_output, s_awv_output, & mf_thflx_output, mf_qvflx_output, & mf_thlflx_output, mf_qtflx_output, & - mf_thvflx_output + mf_thvflx_output, & + mf_rcm_output, mf_cloudfrac_output ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output, & ! thermodynamic grid - mf_rcm_output, mf_cloudfrac_output ! momentum grid + mf_qcforc_output ! thermodynamic grid ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & @@ -2787,8 +2787,8 @@ subroutine clubb_tend_cam( & ! compute ensemble cloud mf_rcm = 0._r8 mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = s_aw(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= s_aw(:pverp) + mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= mf_moist_a(:pverp) end if From 0a281e5cce99d9f58e9c400efecd06634fbc7759 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 21 May 2021 17:00:30 -0600 Subject: [PATCH 021/466] added precipitation rate to diagnostic output --- src/physics/cam/clubb_intr.F90 | 14 ++++++++++++-- src/physics/cam/clubb_mf.F90 | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7eb5ade136..1a61372be7 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -20,7 +20,7 @@ module clubb_intr use shr_kind_mod, only: r8=>shr_kind_r8 use ppgrid, only: pver, pverp, pcols, begchunk, endchunk use phys_control, only: phys_getopts - use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman + use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o use spmd_utils, only: masterproc use constituents, only: pcnst, cnst_add @@ -1231,6 +1231,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_precc' , (/ 'lev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) @@ -1386,6 +1387,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_DRY_V' , 1, ' ') call add_default( 'edmf_MOIST_V' , 1, ' ') call add_default( 'edmf_MOIST_QC' , 1, ' ') + call add_default( 'edmf_precc' , 1, ' ') call add_default( 'edmf_S_AE' , 1, ' ') call add_default( 'edmf_S_AW' , 1, ' ') call add_default( 'edmf_S_AWTH' , 1, ' ') @@ -1900,7 +1902,7 @@ subroutine clubb_tend_cam( & ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output ! thermodynamic grid + mf_qcforc_output, mf_precc_output ! thermodynamic grid ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & @@ -1931,6 +1933,7 @@ subroutine clubb_tend_cam( & mf_dry_u, mf_moist_u, & mf_dry_v, mf_moist_v, & mf_moist_qc, & + mf_precc, & s_ae, s_aw, & s_awthl, s_awqt, & s_awql, s_awqi, & @@ -2335,6 +2338,7 @@ subroutine clubb_tend_cam( & mf_dry_v_output(:,:) = 0._r8 mf_moist_v_output(:,:) = 0._r8 mf_moist_qc_output(:,:) = 0._r8 + mf_precc_output(:,:) = 0._r8 s_ae_output(:,:) = 0._r8 s_aw_output(:,:) = 0._r8 s_awthl_output(:,:) = 0._r8 @@ -2741,6 +2745,7 @@ subroutine clubb_tend_cam( & mf_dry_u, mf_moist_u, & ! output - plume diagnostics mf_dry_v, mf_moist_v, & ! output - plume diagnostics mf_moist_qc, & ! output - plume diagnostics + mf_precc, & ! output - plume diagnostics s_ae, s_aw, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics s_awql, s_awqi, & ! output - plume diagnostics @@ -2990,6 +2995,7 @@ subroutine clubb_tend_cam( & mf_thforc_output(i,pverp-k+1) = mf_thforc(k) mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) + mf_precc_output(i,pverp-k+1) = mf_precc(k) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) end if @@ -3501,6 +3507,9 @@ subroutine clubb_tend_cam( & mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap + if (k.ne.pverp) then + mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o + end if end if enddo enddo @@ -3765,6 +3774,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) + call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 64611fde7d..27a64cd2e9 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -100,6 +100,7 @@ subroutine integrate_mf( nz, dry_u, moist_u, & ! output - plume diagnostics dry_v, moist_v, & ! output - plume diagnostics moist_qc, & ! output - plume diagnostics + precc, & ! output - plume diagnostics ae, aw, & ! output - diagnosed fluxes BEFORE mean field update awthl, awqt, & ! output - diagnosed fluxes BEFORE mean field update awql, awqi, & ! output - diagnosed fluxes BEFORE mean field update @@ -170,6 +171,7 @@ subroutine integrate_mf( nz, dry_u, moist_u, & ! momentum grid dry_v, moist_v, & ! momentum grid moist_qc, & ! momentum grid + precc, & ! thermodynamic grid ae, aw, & ! momentum grid awthl, awqt, & ! momentum grid awql, awqi, & ! momentum grid @@ -253,7 +255,7 @@ subroutine integrate_mf( nz, logical :: do_condensation = .true. ! ! to precip or not to precip - logical :: do_precip = .false. + logical :: do_precip = .true. ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 @@ -292,6 +294,7 @@ subroutine integrate_mf( nz, dry_v = 0._r8 moist_v = 0._r8 moist_qc = 0._r8 + precc = 0._r8 ! outputs - variables needed for solver aw = 0._r8 awth = 0._r8 @@ -623,6 +626,7 @@ subroutine integrate_mf( nz, awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) + precc(k)= precc(k)+ upa(k,i)*uprr(k,i) enddo enddo From a0cf7c6d45efd3dd4901aff983fb54643478eaca Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 21 May 2021 17:04:09 -0600 Subject: [PATCH 022/466] turn of MF precip as default --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 27a64cd2e9..e03ab6e21d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -255,7 +255,7 @@ subroutine integrate_mf( nz, logical :: do_condensation = .true. ! ! to precip or not to precip - logical :: do_precip = .true. + logical :: do_precip = .false. ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 From 6e22c4e832cec788a32029cafc32ec3f697c7abe Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sat, 22 May 2021 08:56:56 -0600 Subject: [PATCH 023/466] mf_precc fixed to be at interface levs --- src/physics/cam/clubb_intr.F90 | 13 ++++++------- src/physics/cam/clubb_mf.F90 | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 1a61372be7..5f2fa667bd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1231,7 +1231,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_precc' , (/ 'lev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) + call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) @@ -1897,12 +1897,13 @@ subroutine clubb_tend_cam( & mf_thflx_output, mf_qvflx_output, & mf_thlflx_output, mf_qtflx_output, & mf_thvflx_output, & - mf_rcm_output, mf_cloudfrac_output + mf_rcm_output, mf_cloudfrac_output, & + mf_precc_output ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output, mf_precc_output ! thermodynamic grid + mf_qcforc_output ! thermodynamic grid ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & @@ -2989,13 +2990,13 @@ subroutine clubb_tend_cam( & mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) mf_rcm_output(i,pverp-k+1) = mf_rcm(k) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(k) + mf_precc_output(i,pverp-k+1) = mf_precc(k) if (k.ne.1) then mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) mf_thforc_output(i,pverp-k+1) = mf_thforc(k) mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) end if @@ -3507,9 +3508,7 @@ subroutine clubb_tend_cam( & mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - if (k.ne.pverp) then - mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o - end if + mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o end if enddo enddo diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e03ab6e21d..865379a31d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -171,7 +171,7 @@ subroutine integrate_mf( nz, dry_u, moist_u, & ! momentum grid dry_v, moist_v, & ! momentum grid moist_qc, & ! momentum grid - precc, & ! thermodynamic grid + precc, & ! momentum grid ae, aw, & ! momentum grid awthl, awqt, & ! momentum grid awql, awqi, & ! momentum grid From 4f33b231b7008008d34d8cdd2acbb6b7def86f82 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 24 May 2021 14:01:23 -0600 Subject: [PATCH 024/466] added thvflx diags for pupwind --- src/physics/cam/clubb_mf.F90 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 865379a31d..d2f866868a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -632,11 +632,11 @@ subroutine integrate_mf( nz, awthl_conv = awthl awqt_conv = awqt + awthv_conv = awthv thl_env = thl thl_env_zm = thl_zm qt_env = qt qt_env_zm = qt_zm - awthv_conv = awthv thv_env = thv thv_env_zm = thv_zm @@ -660,6 +660,13 @@ subroutine integrate_mf( nz, qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) enddo + ! get thv fluxes + betathl = (thv_env(4)-thv_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thv_env(1) = thv_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + do k=kstart,nz-1 + thvflx(k)= awthv_conv(k) - aw(k)*thv_env(k+1) + enddo + ! get th & qv fluxes thl_env = th qt_env = qv @@ -667,7 +674,6 @@ subroutine integrate_mf( nz, betaqt = (qv(4)-qv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 do k=kstart,nz-1 thflx(k)= awth(k) - aw(k)*thl_env(k+1) @@ -678,7 +684,6 @@ subroutine integrate_mf( nz, qt_env = qc betaqt = (qc(4)-qc(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 do k=kstart,nz-1 qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) @@ -691,15 +696,15 @@ subroutine integrate_mf( nz, thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) + ! get thv flux + thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) + ! get th & qv fluxes thflx(k) = awth(k) - aw(k)*th_zm(k) qvflx(k) = awqv(k) - aw(k)*qv_zm(k) ! get qc fluxes qcflx(k) = awqc(k) - aw(k)*qc_zm(k) - - ! get thv flux - thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) end do endif From 0d3fa5342c6e233264b9b26ea5342f96802331f6 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 16 Jun 2021 16:54:47 -0600 Subject: [PATCH 025/466] fixed WPTHVP_CLUBB to output to interface levels --- src/physics/cam/clubb_intr.F90 | 2 +- src/physics/cam/clubb_mf.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 5f2fa667bd..972f6bed8c 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1170,7 +1170,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'lev' /), 'A', 'W/m2', 'Buoyancy Flux') + call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index d2f866868a..3b431af407 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -252,7 +252,7 @@ subroutine integrate_mf( nz, pblhmin = 100._r8 ! ! to condensate or not to condensate - logical :: do_condensation = .true. + logical :: do_condensation = .false. ! ! to precip or not to precip logical :: do_precip = .false. From abc62a60fb912d0204f044ebc830da137a5f3fce Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 16 Jun 2021 16:56:52 -0600 Subject: [PATCH 026/466] moist plumes as default --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3b431af407..d2f866868a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -252,7 +252,7 @@ subroutine integrate_mf( nz, pblhmin = 100._r8 ! ! to condensate or not to condensate - logical :: do_condensation = .false. + logical :: do_condensation = .true. ! ! to precip or not to precip logical :: do_precip = .false. From 92a69cafda47ce86fbdfe93cebe1cc217a453e05 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 2 Aug 2021 11:35:00 -0600 Subject: [PATCH 027/466] added dynamic L0 methods, namelists --- bld/build-namelist | 3 + bld/namelist_files/namelist_defaults_cam.xml | 3 + bld/namelist_files/namelist_definition.xml | 18 + src/physics/cam/clubb_intr.F90 | 9964 +++++++++--------- src/physics/cam/clubb_mf.F90 | 2968 ++++-- 5 files changed, 7083 insertions(+), 5873 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index ce70474f87..d5d58e18a8 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3050,6 +3050,9 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'do_clubb_mf_diag'); add_default($nl, 'clubb_mf_L0'); add_default($nl, 'clubb_mf_ent0'); + add_default($nl, 'clubb_mf_Lopt'); + add_default($nl, 'clubb_mf_a0'); + add_default($nl, 'clubb_mf_b0'); add_default($nl, 'clubb_mf_nup'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index ee556760cf..43b943847a 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1858,6 +1858,9 @@ .false. 50.0 0.22 + 0 + 2.0 + 0.5 10 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 6403914d39..0cf7d84012 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3713,6 +3713,24 @@ do_clubb_mf=FALSE. Default: 50.0 + +Integer: dynamic entrainment length scale option +Default: 0 + + + +Real: linear coefficient relating ztop/cape to entrainment length scale +Default: 2.0 + + + +Real: expoential coefficient relating ztop/cape to entrainment length scale +Default: 0.5 + + Entrainment efficiency for individual plumes. Not used if diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 972f6bed8c..9c569eac1a 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1,4969 +1,4995 @@ -module clubb_intr - - !----------------------------------------------------------------------------------------------------- ! - ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! - ! by the University of Wisconsin Milwaukee Group (UWM). ! - ! ! - ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! - ! ! - ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! - ! differencing the diffused and initial states. ! - ! ! - ! Calling sequence: ! - ! ! - !---------------------------Code history-------------------------------------------------------------- ! - ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! - ! Modified by: K Thayer-Calder ! - ! ! - !----------------------------------------------------------------------------------------------------- ! - - use shr_kind_mod, only: r8=>shr_kind_r8 - use ppgrid, only: pver, pverp, pcols, begchunk, endchunk - use phys_control, only: phys_getopts - use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o - - use spmd_utils, only: masterproc - use constituents, only: pcnst, cnst_add - use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev - use zm_conv_intr, only: zmconv_microp -#ifdef CLUBB_SGS - use clubb_api_module, only: pdf_parameter, implicit_coefs_terms - use clubb_api_module, only: clubb_config_flags_type - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup - use cam_history_support, only: add_hist_coord -#endif - - implicit none - private - save - - ! ----------------- ! - ! Public interfaces ! - ! ----------------- ! - - public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, & -#ifdef CLUBB_SGS - ! This utilizes CLUBB specific variables in its interface - stats_init_clubb, & - init_clubb_config_flags, & -#endif - stats_end_timestep_clubb, & - clubb_readnl, & - clubb_init_cnst, & - clubb_implements_cnst - -#ifdef CLUBB_SGS - ! Both of these utilize CLUBB specific variables in their interface - private :: stats_zero, stats_avg -#endif - - logical, public :: do_cldcool - logical :: clubb_do_icesuper - -#ifdef CLUBB_SGS - type(clubb_config_flags_type), public :: clubb_config_flags -#endif - - ! ------------ ! - ! Private data ! - ! ------------ ! - - integer, parameter :: & - grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels - hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements - - real(r8), parameter, dimension(0) :: & - sclr_tol = 1.e-8_r8 ! Total water in kg/kg - - character(len=6) :: saturation_equation - - real(r8), parameter :: & - theta0 = 300._r8, & ! Reference temperature [K] - ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] - p0_clubb = 100000._r8 - - integer, parameter :: & - sclr_dim = 0 ! Higher-order scalars, set to zero - - real(r8), parameter :: & - wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected - - real(r8), parameter :: & - wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected - - real(r8), parameter :: & - wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected - - real(r8), parameter :: & - rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected - - real(r8), parameter :: unset_r8 = huge(1.0_r8) - - real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist - real(r8) :: clubb_rnevap_effic = unset_r8 - - real(r8) :: clubb_c1 = unset_r8 - real(r8) :: clubb_c1b = unset_r8 - real(r8) :: clubb_C2rt = unset_r8 - real(r8) :: clubb_C2thl = unset_r8 - real(r8) :: clubb_C2rtthl = unset_r8 - real(r8) :: clubb_C4 = unset_r8 - real(r8) :: clubb_C8 = unset_r8 - real(r8) :: clubb_C8b = unset_r8 - real(r8) :: clubb_C7 = unset_r8 - real(r8) :: clubb_C7b = unset_r8 - real(r8) :: clubb_c11 = unset_r8 - real(r8) :: clubb_c11b = unset_r8 - real(r8) :: clubb_c14 = unset_r8 - real(r8) :: clubb_c_K9 = unset_r8 - real(r8) :: clubb_nu9 = unset_r8 - real(r8) :: clubb_c_K10 = unset_r8 - real(r8) :: clubb_c_K10h = unset_r8 - real(r8) :: clubb_gamma_coef = unset_r8 - real(r8) :: clubb_gamma_coefb = unset_r8 - real(r8) :: clubb_beta = unset_r8 - real(r8) :: clubb_lambda0_stability_coef = unset_r8 - real(r8) :: clubb_lmin_coef = unset_r8 - real(r8) :: clubb_mult_coef = unset_r8 - real(r8) :: clubb_Skw_denom_coef = unset_r8 - real(r8) :: clubb_skw_max_mag = unset_r8 - real(r8) :: clubb_up2_vp2_factor = unset_r8 - real(r8) :: clubb_C_wp2_splat = unset_r8 - logical :: clubb_l_brunt_vaisala_freq_moist = .false. - logical :: clubb_l_call_pdf_closure_twice = .false. - logical :: clubb_l_damp_wp3_Skw_squared = .false. - logical :: clubb_l_min_wp2_from_corr_wx = .false. - logical :: clubb_l_min_xp2_from_corr_wx = .false. - logical :: clubb_l_predict_upwp_vpwp = .false. - logical :: clubb_l_rcm_supersat_adj = .false. - logical :: clubb_l_stability_correct_tau_zm = .false. - logical :: clubb_l_trapezoidal_rule_zt = .false. - logical :: clubb_l_trapezoidal_rule_zm = .false. - logical :: clubb_l_upwind_xpyp_ta = .false. - logical :: clubb_l_use_C7_Richardson = .false. - logical :: clubb_l_use_C11_Richardson = .false. - logical :: clubb_l_use_cloud_cover = .false. - logical :: clubb_l_use_thvm_in_bv_freq = .false. - logical :: clubb_l_vert_avg_closure = .false. - logical :: clubb_l_diag_Lscale_from_tau = .false. - logical :: clubb_l_damp_wp2_using_em = .false. - -! Constant parameters - logical, parameter, private :: & - l_implemented = .true., & ! Implemented in a host model (always true) - l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes - - logical, parameter, private :: & - apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) - - logical :: lq(pcnst) - logical :: prog_modal_aero - logical :: do_rainturb - logical :: do_expldiff - logical :: clubb_do_adv - logical :: clubb_do_liqsupersat = .false. - logical :: clubb_do_energyfix = .true. - logical :: history_budget - - logical :: clubb_l_lscale_plume_centered - logical :: clubb_l_use_ice_latent - - integer :: history_budget_histfile_num - integer :: edsclr_dim ! Number of scalars to transport in CLUBB - integer :: offset - -! define physics buffer indicies here - integer :: & - wp2_idx, & ! vertical velocity variances - wp3_idx, & ! third moment of vertical velocity - wpthlp_idx, & ! turbulent flux of thetal - wprtp_idx, & ! turbulent flux of total water - rtpthlp_idx, & ! covariance of thetal and rt - rtp2_idx, & ! variance of total water - thlp2_idx, & ! variance of thetal - rtp3_idx, & ! total water 3rd order - thlp3_idx, & ! thetal 3rd order - up2_idx, & ! variance of east-west wind - vp2_idx, & ! variance of north-south wind - up3_idx, & ! east-west wind 3rd order - vp3_idx, & ! north-south wind 3rd order - upwp_idx, & ! east-west momentum flux - vpwp_idx, & ! north-south momentum flux - thlm_idx, & ! mean thetal - rtm_idx, & ! mean total water mixing ratio - um_idx, & ! mean of east-west wind - vm_idx, & ! mean of north-south wind - wpthvp_idx, & ! buoyancy flux - wp2thvp_idx, & ! second order buoyancy term - rtpthvp_idx, & ! moisture buoyancy correlation - thlpthvp_idx, & ! temperature buoyancy correlation - sclrpthvp_idx, & ! passive scalar buoyancy correlation - cloud_frac_idx, & ! CLUBB's cloud fraction - cld_idx, & ! Cloud fraction - concld_idx, & ! Convective cloud fraction - ast_idx, & ! Stratiform cloud fraction - alst_idx, & ! Liquid stratiform cloud fraction - aist_idx, & ! Ice stratiform cloud fraction - qlst_idx, & ! Physical in-cloud LWC - qist_idx, & ! Physical in-cloud IWC - dp_frac_idx, & ! deep convection cloud fraction - sh_frac_idx, & ! shallow convection cloud fraction - kvh_idx, & ! CLUBB eddy diffusivity on thermo levels - pblh_idx, & ! PBL pbuf - icwmrdp_idx, & ! In cloud mixing ratio for deep convection - tke_idx, & ! turbulent kinetic energy - tpert_idx, & ! temperature perturbation from PBL - fice_idx, & ! fice_idx index in physics buffer - cmeliq_idx, & ! cmeliq_idx index in physics buffer - relvar_idx, & ! relative cloud water variance - accre_enhan_idx, & ! optional accretion enhancement factor for MG - npccn_idx, & ! liquid ccn number concentration - naai_idx, & ! ice number concentration - prer_evap_idx, & ! rain evaporation rate - qrl_idx, & ! longwave cooling rate - radf_idx, & - qsatfac_idx, & ! subgrid cloud water saturation scaling factor - ice_supersat_idx, & ! ice cloud fraction for SILHS - rcm_idx, & ! Cloud water mixing ratio for SILHS - ztodt_idx ! physics timestep for SILHS - - ! Indices for microphysical covariance tendencies - integer :: & - rtp2_mc_zt_idx, & - thlp2_mc_zt_idx, & - wprtp_mc_zt_idx, & - wpthlp_mc_zt_idx, & - rtpthlp_mc_zt_idx - - integer, public :: & - ixthlp2 = 0, & - ixwpthlp = 0, & - ixwprtp = 0, & - ixwp2 = 0, & - ixwp3 = 0, & - ixrtpthlp = 0, & - ixrtp2 = 0, & - ixup2 = 0, & - ixvp2 = 0 - - integer :: cmfmc_sh_idx = 0 - - integer :: & - dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. - difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. - dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. - dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. - - integer :: & - qt_macmic_idx, & - thl_macmic_idx, & - rcm_macmic_idx, & - cldfrac_macmic_idx, & - wpthlp_macmic_idx, & - wprtp_macmic_idx, & - wpthvp_macmic_idx, & - mf_wpthlp_macmic_idx, & - mf_wprtp_macmic_idx, & - mf_wpthvp_macmic_idx - - ! Output arrays for CLUBB statistics - real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc - - character(len=16) :: eddy_scheme ! Default set in phys_control.F90 - character(len=16) :: deep_scheme ! Default set in phys_control.F90 - character(len=16) :: subcol_scheme - - integer, parameter :: ncnst=9 - character(len=8) :: cnst_names(ncnst) - logical :: do_cnst=.false. - -#ifdef CLUBB_SGS - type(pdf_parameter), target, allocatable, public, protected :: & - pdf_params_chnk(:,:) ! PDF parameters (thermo. levs.) [units vary] - type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:,:) ! PDF parameters on momentum levs. [units vary] - type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:,:) ! PDF impl. coefs. & expl. terms [units vary] -#endif - - contains - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_register_cam( ) -!------------------------------------------------------------------------------- -! Description: -! Register the constituents and fields in the physics buffer -! Author: P. Bogenschutz, C. Craig, A. Gettelman -! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns -! -!------------------------------------------------------------------------------- -#ifdef CLUBB_SGS - - !------------------------------------------------ ! - ! Register physics buffer fields and constituents ! - !------------------------------------------------ ! - - ! Add CLUBB fields to pbuf - use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls - use subcol_utils, only: subcol_get_scheme - - integer :: cld_macmic_num_steps - - call phys_getopts( eddy_scheme_out = eddy_scheme, & - deep_scheme_out = deep_scheme, & - history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num, & - cld_macmic_num_steps_out = cld_macmic_num_steps) - - subcol_scheme = subcol_get_scheme() - - if (trim(subcol_scheme) == 'SILHS') then - saturation_equation = "flatau" - else - saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP - end if - - if (clubb_do_adv) then - cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) - do_cnst=.true. - ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments - ! need a constant added to them before they are advected, thus this would corrupt the output. - ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments - call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) - call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) - call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) - end if - - ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top - call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) - call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) - call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) - call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) - call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) - call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) - call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) - call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) - call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) - call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) - call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) - call pbuf_add_field('FICE', 'physpkg',dtype_r8, (/pcols,pver/), fice_idx) - call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) - call pbuf_add_field('CMELIQ', 'physpkg',dtype_r8, (/pcols,pver/), cmeliq_idx) - call pbuf_add_field('QSATFAC', 'physpkg',dtype_r8, (/pcols,pver/), qsatfac_idx) - - - call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) - call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) - call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) - call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) - call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) - call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) - call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) - call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) - call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) - - call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) - call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) - call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) - call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) - - call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) - call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) - call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) - call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) - call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) - call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) - - call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) - call pbuf_add_field('WP2THVP', 'physpkg', dtype_r8, (/pcols,pverp/), wp2thvp_idx) - call pbuf_add_field('RTPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), rtpthvp_idx) - call pbuf_add_field('THLPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), thlpthvp_idx) - call pbuf_add_field('CLOUD_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), cloud_frac_idx) - call pbuf_add_field('ISS_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), ice_supersat_idx) - call pbuf_add_field('RCM', 'physpkg', dtype_r8, (/pcols,pverp/), rcm_idx) - call pbuf_add_field('ZTODT', 'physpkg', dtype_r8, (/pcols/), ztodt_idx) - - ! For SILHS microphysical covariance contributions - call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) - call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) - call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) - call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) - call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - - call pbuf_add_field('QT_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) - call pbuf_add_field('THETAL_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) - call pbuf_add_field('RCM_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) - call pbuf_add_field('CLDFRAC_CLUBB_macmic','global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) - call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) - call pbuf_add_field('WPRTP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) - call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) - if (do_clubb_mf) then - call pbuf_add_field('edmf_thlflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) - call pbuf_add_field('edmf_qtflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) - call pbuf_add_field('edmf_thvflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) - end if - -#endif - - end subroutine clubb_register_cam - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -function clubb_implements_cnst(name) - - !----------------------------------------------------------------------------- ! - ! ! - ! Return true if specified constituent is implemented by this package ! - ! ! - !----------------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - logical :: clubb_implements_cnst ! return value - - !----------------------------------------------------------------------- - - clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) - -end function clubb_implements_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) -#ifdef CLUBB_SGS - use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol -#endif - - !----------------------------------------------------------------------- ! - ! ! - ! Initialize the state if clubb_do_adv ! - ! ! - !----------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) - real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) - logical, intent(in) :: mask(:) ! Only initialize where .true. - real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev - - !----------------------------------------------------------------------- - integer :: k, nlev - -#ifdef CLUBB_SGS - if (clubb_do_adv) then - nlev = size(q, 2) - do k = 1, nlev - if (trim(name) == trim(cnst_names(1))) then - where(mask) - q(:,k) = thl_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(2))) then - where(mask) - q(:,k) = rt_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(3))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(4))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(5))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(6))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(7))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(8))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(9))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - end do - end if -#endif - -end subroutine clubb_init_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_readnl(nlfile) - -#ifdef CLUBB_SGS - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use cam_abortutils, only: endrun - use clubb_api_module, only: l_stats, l_output_rad_files - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8 - use clubb_mf, only: clubb_mf_readnl -#endif - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - -#ifdef CLUBB_SGS - - character(len=*), parameter :: sub = 'clubb_readnl' - - logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & - clubb_expldiff ! Stats enabled (T/F) - - integer :: iunit, read_status, ierr - - namelist /clubb_his_nl/ clubb_history, clubb_rad_history - namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, clubb_expldiff, & - clubb_do_adv, clubb_timestep, & - clubb_rnevap_effic,clubb_do_icesuper - namelist /clubb_params_nl/ clubb_c1, clubb_c1b, clubb_c11, clubb_c11b, clubb_c14, clubb_mult_coef, clubb_gamma_coef, & - clubb_c_K10, clubb_c_K10h, clubb_beta, clubb_C2rt, clubb_C2thl, & - clubb_C2rtthl, clubb_C8, clubb_C8b, clubb_C7, clubb_C7b, clubb_Skw_denom_coef, & - clubb_C4, clubb_c_K9, clubb_nu9, clubb_C_wp2_splat, & - clubb_lambda0_stability_coef, clubb_l_lscale_plume_centered, & - clubb_l_use_ice_latent, clubb_do_liqsupersat, clubb_do_energyfix,& - clubb_lmin_coef, clubb_skw_max_mag, clubb_l_stability_correct_tau_zm, & - clubb_gamma_coefb, clubb_up2_vp2_factor, & - clubb_l_use_C7_Richardson, clubb_l_use_C11_Richardson, & - clubb_l_brunt_vaisala_freq_moist, clubb_l_use_thvm_in_bv_freq, & - clubb_l_rcm_supersat_adj, clubb_l_damp_wp3_Skw_squared, & - clubb_l_predict_upwp_vpwp, clubb_l_min_wp2_from_corr_wx, & - clubb_l_min_xp2_from_corr_wx, clubb_l_upwind_xpyp_ta, clubb_l_vert_avg_closure, & - clubb_l_trapezoidal_rule_zt, clubb_l_trapezoidal_rule_zm, & - clubb_l_call_pdf_closure_twice, clubb_l_use_cloud_cover, & - clubb_l_diag_Lscale_from_tau, clubb_l_damp_wp2_using_em - - !----- Begin Code ----- - - ! Determine if we want clubb_history to be output - clubb_history = .false. ! Initialize to false - l_stats = .false. ! Initialize to false - l_output_rad_files = .false. ! Initialize to false - do_cldcool = .false. ! Initialize to false - do_rainturb = .false. ! Initialize to false - do_expldiff = .false. ! Initialize to false - - clubb_l_lscale_plume_centered = .false. ! Initialize to false! - clubb_l_use_ice_latent = .false. ! Initialize to false! - - ! Call CLUBB+MF namelist - call clubb_mf_readnl(nlfile) - - ! Read namelist to determine if CLUBB history should be called - if (masterproc) then - iunit = getunit() - open( iunit, file=trim(nlfile), status='old' ) - - call find_group_name(iunit, 'clubb_his_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_his_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - call find_group_name(iunit, 'clubb_params_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_params_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - else - call endrun('clubb_readnl: error reading namelist') - end if - - call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") - call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") - call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") - call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") - call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") - call mpi_bcast(clubb_expldiff, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_expldiff") - call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") - call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") - call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") - - call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") - call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") - call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") - call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") - call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") - call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") - call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") - call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") - call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") - call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") - call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") - call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") - call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") - call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") - call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") - call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") - call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") - call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") - call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") - call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") - call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") - call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") - call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") - call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") - call mpi_bcast(clubb_l_use_ice_latent, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_ice_latent") - call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") - call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") - - call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") - call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") - call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") - call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") - call mpi_bcast(clubb_up2_vp2_factor, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_vp2_factor") - - call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") - call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") - call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") - call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") - call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") - call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") - call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") - call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") - call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") - call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") - call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") - call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") - call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") - call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") - call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") - call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") - call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") - - ! Overwrite defaults if they are true - if (clubb_history) l_stats = .true. - if (clubb_rad_history) l_output_rad_files = .true. - if (clubb_cloudtop_cooling) do_cldcool = .true. - if (clubb_rainevap_turb) do_rainturb = .true. - if (clubb_expldiff) do_expldiff = .true. - -! Check that all namelists have been set - if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") - if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") - - if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") - if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") - if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") - if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") - if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") - if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") - if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") - if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") - if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") - if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") - if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") - if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") - if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") - if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") - if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") - if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") - if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") - if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") - if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") - if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") - if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") - if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") - if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") - if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") - if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") - if(clubb_up2_vp2_factor == unset_r8) call endrun(sub//": FATAL: clubb_up2_vp2_factor is not set") - if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") - -#endif - end subroutine clubb_readnl - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_ini_cam(pbuf2d) -!------------------------------------------------------------------------------- -! Description: -! Initialize UWM CLUBB. -! Author: Cheryl Craig March 2011 -! Modifications: Pete Bogenschutz 2011 March and onward -! Modifications: K Thayer-Calder 2013 July and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - - -#ifdef CLUBB_SGS - - ! From CAM libraries - use cam_history, only: addfld, add_default, horiz_only - use ref_pres, only: pref_mid - use hb_diff, only: init_hb_diff - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx - use cam_abortutils, only: endrun - - ! From the CLUBB libraries - use clubb_api_module, only: core_rknd, & - iC11, iC11b, ibeta, iSkw_denom_coef, & ! Constant(s) - em_min, & - iC1, iC1b, iC2rt, iC2thl, iC2rtthl, igamma_coef, igamma_coefb, & - imult_coef, ic_K10, iskw_max_mag, & - iC8, iC8b, iC11, iC11b, iC4, iC14, iup2_vp2_factor, params_list - - - - use clubb_api_module, only: & - print_clubb_config_flags_api, & - setup_clubb_core_api, & - init_pdf_params_api, & - init_pdf_implicit_coefs_terms_api, & - time_precision, & - core_rknd, & - set_clubb_debug_level_api, & - clubb_fatal_error, & ! Error code value to indicate a fatal error - nparams, & - read_parameters_api, & - l_stats, & - l_stats_samp, & - l_grads, & - stats_zt, & - stats_zm, & - stats_sfc, & - stats_rad_zt, & - stats_rad_zm, & - w_tol_sqd, & - rt_tol, & - thl_tol - - ! These are only needed if we're using a passive scalar - use clubb_api_module, only: & - iisclr_rt, & - iisclr_thl, & - iisclr_CO2, & - iiedsclr_rt, & - iiedsclr_thl, & - iiedsclr_CO2 - - ! These are needed to set parameters - use clubb_api_module, only: & - ilambda0_stability_coef, ic_K10, ic_K10h, iC2rtthl, iC7, iC7b, iC8, iC8b, iC11, iC11b, & - iC14, igamma_coef, imult_coef, ilmin_coef, iSkw_denom_coef, ibeta, iskw_max_mag, & - iC2rt, iC2thl, iC2rtthl, ic_K9, inu9, iC_wp2_splat - - use time_manager, only: is_first_step - use clubb_api_module, only: hydromet_dim - use constituents, only: cnst_get_ind - use phys_control, only: phys_getopts - use spmd_utils, only: iam - use cam_logfile, only: iulog -#endif - - use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc - implicit none - ! Input Variables - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - -#ifdef CLUBB_SGS - - real(kind=time_precision) :: dum1, dum2, dum3 - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - - ! The similar name to clubb_history is unfortunate... - logical :: history_amwg, history_clubb - - integer :: cld_macmic_num_steps - - integer :: err_code ! Code for when CLUBB fails - integer :: j, k, l ! Indices - integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) - integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) - integer :: nmodes, nspec, m - integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice - integer :: lptr - - logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. - logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. - - real(r8) :: zt_g(pverp+1-top_lev) ! Height dummy array - real(r8) :: zi_g(pverp+1-top_lev) ! Height dummy array - - ! CAM defines zi at the surface to be zero. - real(r8), parameter :: sfc_elevation = 0._r8 - - integer :: nlev - - !----- Begin Code ----- - - nlev = pver + 1 - top_lev - - if (core_rknd /= r8) then - call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') - end if - - ! Allocate PDF parameters across columns and chunks - allocate( & - pdf_params_chnk(pcols,begchunk:endchunk), & - pdf_params_zm_chnk(pcols,begchunk:endchunk), & - pdf_implicit_coefs_terms_chnk(pcols,begchunk:endchunk) ) - - ! Allocate (in the vertical) and zero PDF parameters - do l = begchunk, endchunk, 1 - do j = 1, pcols, 1 - call init_pdf_params_api( pverp+1-top_lev, pdf_params_chnk(j,l) ) - call init_pdf_params_api( pverp+1-top_lev, pdf_params_zm_chnk(j,l) ) - call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, sclr_dim, & - pdf_implicit_coefs_terms_chnk(j,l) ) - enddo ! j = 1, pcols, 1 - enddo ! l = begchunk, endchunk, 1 - - ! ----------------------------------------------------------------- ! - ! Determine how many constituents CLUBB will transport. Note that - ! CLUBB does not transport aerosol consituents. Therefore, need to - ! determine how many aerosols constituents there are and subtract that - ! off of pcnst (the total consituents) - ! ----------------------------------------------------------------- ! - - call phys_getopts(prog_modal_aero_out=prog_modal_aero, & - history_amwg_out=history_amwg, & - history_clubb_out=history_clubb, & - cld_macmic_num_steps_out = cld_macmic_num_steps) - - ! Select variables to apply tendencies back to CAM - - ! Initialize all consituents to true to start - lq(1:pcnst) = .true. - edsclr_dim = pcnst - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('NUMICE',ixnumice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - - if (prog_modal_aero) then - ! Turn off modal aerosols and decrement edsclr_dim accordingly - call rad_cnst_get_info(0, nmodes=nmodes) - - do m = 1, nmodes - call rad_cnst_get_mode_num_idx(m, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - - call rad_cnst_get_info(0, m, nspec=nspec) - do l = 1, nspec - call rad_cnst_get_mam_mmr_idx(m, l, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - end do - end do - - ! In addition, if running with MAM, droplet number is transported - ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport - ! tendencies to avoid double counted. Else, we apply tendencies. - lq(ixnumliq) = .false. - edsclr_dim = edsclr_dim-1 - endif - - ! ----------------------------------------------------------------- ! - ! Set the debug level. Level 2 has additional computational expense since - ! it checks the array variables in CLUBB for invalid values. - ! ----------------------------------------------------------------- ! - call set_clubb_debug_level_api( 0 ) - - ! ----------------------------------------------------------------- ! - ! use pbuf_get_fld_idx to get existing physics buffer fields from other - ! physics packages (e.g. tke) - ! ----------------------------------------------------------------- ! - - - ! Defaults - l_stats_samp = .false. - l_grads = .false. - - ! Overwrite defaults if needbe - if (l_stats) l_stats_samp = .true. - - ! Define physics buffers indexes - cld_idx = pbuf_get_index('CLD') ! Cloud fraction - concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover - ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction - alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction - aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction - qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC - qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC - dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction - icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio - sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction - relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance - accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG - prer_evap_idx = pbuf_get_index('PRER_EVAP') - qrl_idx = pbuf_get_index('QRL') - cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') - naai_idx = pbuf_get_index('NAAI') - npccn_idx = pbuf_get_index('NPCCN') - - - iisclr_rt = -1 - iisclr_thl = -1 - iisclr_CO2 = -1 - - iiedsclr_rt = -1 - iiedsclr_thl = -1 - iiedsclr_CO2 = -1 - - if (zmconv_microp) then - dlfzm_idx = pbuf_get_index('DLFZM') - difzm_idx = pbuf_get_index('DIFZM') - dnlfzm_idx = pbuf_get_index('DNLFZM') - dnifzm_idx = pbuf_get_index('DNIFZM') - end if - - ! ----------------------------------------------------------------- ! - ! Define number of tracers for CLUBB to diffuse - ! ----------------------------------------------------------------- ! - - if (do_expldiff) then - offset = 2 ! diffuse temperature and moisture explicitly - edsclr_dim = edsclr_dim + offset - endif - - ! ----------------------------------------------------------------- ! - ! Setup CLUBB core - ! ----------------------------------------------------------------- ! - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Fill in dummy arrays for height. Note that these are overwrote - ! at every CLUBB step to physical values. - do k=1,nlev+1 - zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage - zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage - enddo - - clubb_params(iC2rtthl) = clubb_C2rtthl - clubb_params(iC8) = clubb_C8 - clubb_params(iC11) = clubb_c11 - clubb_params(iC11b) = clubb_c11b - clubb_params(iC14) = clubb_c14 - clubb_params(ic_K10) = clubb_c_K10 - clubb_params(imult_coef) = clubb_mult_coef - clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef - clubb_params(iC2rt) = clubb_C2rt - clubb_params(iC2thl) = clubb_C2thl - clubb_params(ibeta) = clubb_beta - clubb_params(iC7) = clubb_C7 - clubb_params(iC7b) = clubb_C7b - clubb_params(igamma_coef) = clubb_gamma_coef - clubb_params(ic_K10h) = clubb_c_K10h - clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef - clubb_params(ilmin_coef) = clubb_lmin_coef - clubb_params(iC8b) = clubb_C8b - clubb_params(iskw_max_mag) = clubb_skw_max_mag - clubb_params(iC1) = clubb_C1 - clubb_params(iC1b) = clubb_C1b - clubb_params(igamma_coefb) = clubb_gamma_coefb - clubb_params(iup2_vp2_factor) = clubb_up2_vp2_factor - clubb_params(iC4) = clubb_C4 - clubb_params(ic_K9) = clubb_c_K9 - clubb_params(inu9) = clubb_nu9 - clubb_params(iC_wp2_splat) = clubb_C_wp2_splat - - call init_clubb_config_flags( clubb_config_flags ) ! In/Out - clubb_config_flags%l_use_C7_Richardson = clubb_l_use_C7_Richardson - clubb_config_flags%l_use_C11_Richardson = clubb_l_use_C11_Richardson - clubb_config_flags%l_brunt_vaisala_freq_moist = clubb_l_brunt_vaisala_freq_moist - clubb_config_flags%l_use_thvm_in_bv_freq = clubb_l_use_thvm_in_bv_freq - clubb_config_flags%l_rcm_supersat_adj = clubb_l_rcm_supersat_adj - clubb_config_flags%l_damp_wp3_Skw_squared = clubb_l_damp_wp3_Skw_squared - clubb_config_flags%l_predict_upwp_vpwp = clubb_l_predict_upwp_vpwp - clubb_config_flags%l_min_wp2_from_corr_wx = clubb_l_min_wp2_from_corr_wx - clubb_config_flags%l_min_xp2_from_corr_wx = clubb_l_min_xp2_from_corr_wx - clubb_config_flags%l_upwind_xpyp_ta = clubb_l_upwind_xpyp_ta - clubb_config_flags%l_vert_avg_closure = clubb_l_vert_avg_closure - clubb_config_flags%l_trapezoidal_rule_zt = clubb_l_trapezoidal_rule_zt - clubb_config_flags%l_trapezoidal_rule_zm = clubb_l_trapezoidal_rule_zm - clubb_config_flags%l_call_pdf_closure_twice = clubb_l_call_pdf_closure_twice - clubb_config_flags%l_use_cloud_cover = clubb_l_use_cloud_cover - clubb_config_flags%l_stability_correct_tau_zm = clubb_l_stability_correct_tau_zm - clubb_config_flags%l_do_expldiff_rtm_thlm = do_expldiff - clubb_config_flags%l_Lscale_plume_centered = clubb_l_lscale_plume_centered - clubb_config_flags%l_use_ice_latent = clubb_l_use_ice_latent - clubb_config_flags%l_diag_Lscale_from_tau = clubb_l_diag_Lscale_from_tau - clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em - clubb_config_flags%l_update_pressure = l_update_pressure - - - ! Set up CLUBB core. Note that some of these inputs are overwritten - ! when clubb_tend_cam is called. The reason is that heights can change - ! at each time step, which is why dummy arrays are read in here for heights - ! as they are immediately overwrote. -!$OMP PARALLEL - call setup_clubb_core_api & - ( nlev+1, theta0, ts_nudge, & ! In - hydromet_dim, sclr_dim, & ! In - sclr_tol, edsclr_dim, clubb_params, & ! In - l_host_applies_sfc_fluxes, & ! In - saturation_equation, & ! In - l_input_fields, & - l_implemented, grid_type, zi_g(2), zi_g(1), zi_g(nlev+1),& ! In - zi_g(1:nlev+1), zt_g(1:nlev+1), sfc_elevation, & ! In - clubb_config_flags%l_predict_upwp_vpwp, & ! In - clubb_config_flags%l_use_ice_latent, & ! In - clubb_config_flags%l_prescribed_avg_deltaz, & ! In - clubb_config_flags%l_damp_wp2_using_em, & ! In - clubb_config_flags%l_stability_correct_tau_zm, & ! In - err_code ) - - if ( err_code == clubb_fatal_error ) then - call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') - end if -!$OMP END PARALLEL - - ! Print the list of CLUBB parameters - if ( masterproc ) then - do j = 1, nparams, 1 - write(iulog,*) params_list(j), " = ", clubb_params(j) - enddo - endif - - ! Print configurable CLUBB flags - call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) - - ! ----------------------------------------------------------------- ! - ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! - ! ----------------------------------------------------------------- ! - - ! Initialize eddy diffusivity module - - ntop_eddy = 1 ! if >1, must be <= nbot_molec - nbot_eddy = pver ! currently always pver - - call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) - - ! ----------------------------------------------------------------- ! - ! Add output fields for the history files - ! ----------------------------------------------------------------- ! - - ! These are default CLUBB output. Not the higher order history budgets - call addfld ('RHO_CLUBB', (/ 'ilev' /), 'A', 'kg/m3', 'Air Density') - call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') - call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') - call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') - call addfld ('WP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') - call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') - call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') - call addfld ('WP3_CLUBB', (/ 'ilev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') - call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') - call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') - call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'g^2/kg^2', 'Moisture Variance') - call addfld ('RTP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') - call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') - call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') - call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') - call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') - call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') - call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') - call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') - call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') - call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') - call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') - call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') - call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Ice Tendency') - call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') - call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') - call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') - call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') - call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') - call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') - call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') - call addfld ('THETAL', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') - call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') - call addfld ('QT', (/ 'lev' /), 'A', 'kg/kg', 'Total water mixing ratio') - call addfld ('SL', (/ 'lev' /), 'A', 'J/kg', 'Liquid water static energy') - call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') - call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') - call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') - call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') - call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - - - call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') - - call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') - call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') - call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') - call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') - call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') - - - call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') - call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') - call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') - call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') - - call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') - call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') - - ! ---------------------------------------------------------------------------- ! - ! Below are for detailed analysis of EDMF Scheme ! - ! ---------------------------------------------------------------------------- ! - - if (do_clubb_mf) then - call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) - call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) - call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) - call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) - call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) - call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) - call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) - call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) - call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) - call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) - call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thv flux (EDMF)' ) - call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) - call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) - call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) - call addfld ( 'edmf_thflx' , (/ 'ilev' /), 'A', 'K m/s' , 'th flux (EDMF)' ) - call addfld ( 'edmf_qvflx' , (/ 'ilev' /), 'A', 'kg/kg m/s' , 'qv flux (EDMF)' ) - call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) - call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) - call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_cloudfrac', (/ 'ilev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) - - call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') - call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) - call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) - call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) - call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) - call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) - call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) - end if - - call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') - call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') - call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') - call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') - call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') - call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') - call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') - if (do_clubb_mf) then - call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) - end if - - ! Initialize statistics, below are dummy variables - dum1 = 300._r8 - dum2 = 1200._r8 - dum3 = 300._r8 - - if (l_stats) then - - call stats_init_clubb( .true., dum1, dum2, & - nlev+1, nlev+1, nlev+1, dum3 ) - - allocate(out_zt(pcols,pverp,stats_zt%num_output_fields)) - allocate(out_zm(pcols,pverp,stats_zm%num_output_fields)) - allocate(out_sfc(pcols,1,stats_sfc%num_output_fields)) - - allocate(out_radzt(pcols,pverp,stats_rad_zt%num_output_fields)) - allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) - - endif - - ! ----------------------------------------------------------------- ! - ! Make all of this output default, this is not CLUBB history - ! ----------------------------------------------------------------- ! - - if (clubb_do_adv .or. history_clubb) then - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UP2_CLUBB', 1, ' ') - call add_default('VP2_CLUBB', 1, ' ') - call add_default('WP2_CLUBB', 1, ' ') - call add_default('WP2_ZT_CLUBB', 1, ' ') - call add_default('WP3_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('WPTHLP_CLUBB', 1, ' ') - call add_default('WPRTP_CLUBB', 1, ' ') - call add_default('RTP2_CLUBB', 1, ' ') - call add_default('RTP2_ZT_CLUBB', 1, ' ') - call add_default('PDFP_RTP2_CLUBB', 1, ' ') - call add_default('THLP2_CLUBB', 1, ' ') - call add_default('THLP2_ZT_CLUBB', 1, ' ') - call add_default('RTPTHLP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('WM_ZT_CLUBB', 1, ' ') - call add_default('PBLH', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('THETAL', 1, ' ') - call add_default('CONCLD', 1, ' ') - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_clubb) then - - call add_default('RELVAR', 1, ' ') - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('CONCLD', 1, ' ') - - if (do_clubb_mf_diag) then - call add_default( 'edmf_DRY_A' , 1, ' ') - call add_default( 'edmf_MOIST_A' , 1, ' ') - call add_default( 'edmf_DRY_W' , 1, ' ') - call add_default( 'edmf_MOIST_W' , 1, ' ') - call add_default( 'edmf_DRY_QT' , 1, ' ') - call add_default( 'edmf_MOIST_QT' , 1, ' ') - call add_default( 'edmf_DRY_THL' , 1, ' ') - call add_default( 'edmf_MOIST_THL', 1, ' ') - call add_default( 'edmf_DRY_U' , 1, ' ') - call add_default( 'edmf_MOIST_U' , 1, ' ') - call add_default( 'edmf_DRY_V' , 1, ' ') - call add_default( 'edmf_MOIST_V' , 1, ' ') - call add_default( 'edmf_MOIST_QC' , 1, ' ') - call add_default( 'edmf_precc' , 1, ' ') - call add_default( 'edmf_S_AE' , 1, ' ') - call add_default( 'edmf_S_AW' , 1, ' ') - call add_default( 'edmf_S_AWTH' , 1, ' ') - call add_default( 'edmf_S_AWTHL' , 1, ' ') - call add_default( 'edmf_S_AWQT' , 1, ' ') - call add_default( 'edmf_S_AWU' , 1, ' ') - call add_default( 'edmf_S_AWV' , 1, ' ') - call add_default( 'edmf_thlflx' , 1, ' ') - call add_default( 'edmf_thvflx' , 1, ' ') - call add_default( 'edmf_qtflx' , 1, ' ') - call add_default( 'edmf_thlforc' , 1, ' ') - call add_default( 'edmf_qtforc' , 1, ' ') - call add_default( 'edmf_thflx' , 1, ' ') - call add_default( 'edmf_qvflx' , 1, ' ') - call add_default( 'edmf_thforc' , 1, ' ') - call add_default( 'edmf_qvforc' , 1, ' ') - call add_default( 'edmf_qcforc' , 1, ' ') - call add_default( 'edmf_rcm' , 1, ' ') - call add_default( 'edmf_cloudfrac', 1, ' ') - end if - - call add_default( 'QT_macmic' , 1, ' ') - call add_default( 'THETAL_macmic' , 1, ' ') - call add_default( 'RCM_CLUBB_macmic' , 1, ' ') - call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') - call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') - if (do_clubb_mf_diag) then - call add_default( 'edmf_thlflx_macmic' , 1, ' ') - call add_default( 'edmf_qtflx_macmic' , 1, ' ') - call add_default( 'edmf_thvflx_macmic' , 1, ' ') - end if - - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_budget) then - call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') - call add_default('DPDLFICE', history_budget_histfile_num, ' ') - call add_default('DPDLFT', history_budget_histfile_num, ' ') - call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') - endif - - - ! --------------- ! - ! First step? ! - ! Initialization ! - ! --------------- ! - - ! Is this the first time step? If so then initialize CLUBB variables as follows - if (is_first_step()) then - - call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) - call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) - call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) - - call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) - - call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) - call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) - - ! Initialize SILHS covariance contributions - call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) - endif - - ! The following is physpkg, so it needs to be initialized every time - call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) - - ! --------------- ! - ! End ! - ! Initialization ! - ! --------------- ! - -#endif - end subroutine clubb_ini_cam - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_tend_cam( & - state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & - macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) - -!------------------------------------------------------------------------------- -! Description: Provide tendencies of shallow convection, turbulence, and -! macrophysics from CLUBB to CAM -! -! Author: Cheryl Craig, March 2011 -! Modifications: Pete Bogenschutz, March 2011 and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - use physics_types, only: physics_state, physics_ptend, & - physics_state_copy, physics_ptend_init, & - physics_ptend_sum, physics_update, set_dry_to_wet - - use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc - - use constituents, only: cnst_get_ind, cnst_type - use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use tropopause, only: tropopause_findChemTrop - use time_manager, only: get_nstep - -#ifdef CLUBB_SGS - use hb_diff, only: pblintd - use scamMOD, only: single_column,scm_clubb_iop_name - use clubb_api_module, only: & - nparams, & - read_parameters_api, & - setup_parameters_api, & - time_precision, & - advance_clubb_core_api, & - zt2zm_api, zm2zt_api, & - setup_grid_heights_api, & - em_min, & - w_tol_sqd, & - rt_tol, & - thl_tol, & - l_stats, & - stats_tsamp, & - stats_tout, & - stats_zt, & - stats_sfc, & - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - l_output_rad_files, & - stats_begin_timestep_api, & - hydromet_dim, calculate_thlp2_rad_api, mu, update_xp2_mc_api, & - sat_mixrat_liq_api, & - fstderr - - use clubb_api_module, only: & - clubb_fatal_error ! Error code value to indicate a fatal error - - use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const - use cam_history, only: outfld - - use macrop_driver, only: liquid_macro_tend - use clubb_mf, only: integrate_mf - -#endif - - implicit none - - ! --------------- ! - ! Input Auguments ! - ! --------------- ! - - type(physics_state), intent(in) :: state ! Physics state variables [vary] - type(cam_in_t), intent(in) :: cam_in - real(r8), intent(in) :: hdtime ! Host model timestep [s] - real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] - real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] - integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations - integer, intent(in) :: macmic_it ! number of mac-mic iterations - - ! ---------------------- ! - ! Input-Output Auguments ! - ! ---------------------- ! - - type(physics_buffer_desc), pointer :: pbuf(:) - - ! ---------------------- ! - ! Output Auguments ! - ! ---------------------- ! - - type(physics_ptend), intent(out) :: ptend_all ! package tendencies - - ! These two variables are needed for energy check - real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice - real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check - - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - -#ifdef CLUBB_SGS - - type(physics_state) :: state1 ! Local copy of state variable - type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all - - integer :: i, j, k, t, ixind, nadv - integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq - integer :: itim_old - integer :: ncol, lchnk ! # of columns, and chunk identifier - integer :: err_code ! Diagnostic, for if some calculation goes amiss. - integer :: icnt, clubbtop - logical :: lq2(pcnst) - - integer :: iter - - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] - real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] - real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] - real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] - real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] - real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] - real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] - real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] - real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] - real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] - real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] - real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] - real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] - real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] - real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] - real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] - real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] - real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] - real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] - real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] - real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] - real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] - real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] - real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap - real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap - real(r8) :: wprtp_mc_out(pverp+1-top_lev) - real(r8) :: wpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] - real(r8) :: rcm_out_zm(pverp+1-top_lev) - real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] - real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] - real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] - real(r8) :: thlprcp_out(pverp+1-top_lev) - real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] - real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] - real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] - real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] - real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] - real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] - real(r8) :: rfrzm(pverp+1-top_lev) - real(r8) :: radf(pverp+1-top_lev) - real(r8) :: wprtp_forcing(pverp+1-top_lev) - real(r8) :: wpthlp_forcing(pverp+1-top_lev) - real(r8) :: rtp2_forcing(pverp+1-top_lev) - real(r8) :: thlp2_forcing(pverp+1-top_lev) - real(r8) :: rtpthlp_forcing(pverp+1-top_lev) - real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) - real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] - real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: fcor ! Coriolis forcing [s^-1] - real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] - real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] - real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] - real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] - real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] - real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] - real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] - real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] - real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] - real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] - real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] - real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] - real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] - real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] - real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] - real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] - real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] - real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] - real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] - real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) - real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) - real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) - real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) - real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) - real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] - real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo ! roughness height [m] - real(r8) :: dz_g(pver) ! thickness of layer [m] - real(r8) :: relvarmax - real(r8) :: se_upper_a, se_upper_b, se_upper_diss - real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss - real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - real(r8) :: host_dx, host_dy ! CAM grid [m] - - ! Variables below are needed to compute energy integrals for conservation - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis, se_a(pcols), se_b(pcols), clubb_s(pver) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: qrl_clubb(pverp+1-top_lev) - real(r8) :: qrl_zm(pverp+1-top_lev) - real(r8) :: thlp2_rad_out(pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend - - ! --------------- ! - ! Pointers ! - ! --------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - - real(r8), pointer :: qt_macmic(:,:) - real(r8), pointer :: thl_macmic(:,:) - real(r8), pointer :: rcm_macmic(:,:) - real(r8), pointer :: cldfrac_macmic(:,:) - real(r8), pointer :: wpthlp_macmic(:,:) - real(r8), pointer :: wprtp_macmic(:,:) - real(r8), pointer :: wpthvp_macmic(:,:) - real(r8), pointer :: mf_thlflx_macmic(:,:) - real(r8), pointer :: mf_qtflx_macmic(:,:) - real(r8), pointer :: mf_thvflx_macmic(:,:) - - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface - - ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthl_output, s_awqt_output, & - s_awql_output, s_awqi_output, & - s_awth_output, s_awqv_output, & - s_awu_output, s_awv_output, & - mf_thflx_output, mf_qvflx_output, & - mf_thlflx_output, mf_qtflx_output, & - mf_thvflx_output, & - mf_rcm_output, mf_cloudfrac_output, & - mf_precc_output - - ! MF outputs to outfld - real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid - mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output ! thermodynamic grid - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & - mf_upw_flip, & - mf_upqt_flip, & - mf_upthl_flip, & - mf_upthv_flip, & - mf_upth_flip, & - mf_upqc_flip, & - mf_upbuoy_flip, & - mf_upent_flip - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & - mf_upw_output, & - mf_upqt_output, & - mf_upthl_output, & - mf_upthv_output, & - mf_upth_output, & - mf_upqc_output, & - mf_upent_output - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output - - ! MF Plume - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - mf_precc, & - s_ae, s_aw, & - s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awth, s_awqv, & - s_awu, s_awv, & - mf_thflx, mf_qvflx, & - mf_thlflx, mf_qtflx, & - mf_thvflx, mf_qcflx, & - mf_thforc, mf_qvforc, & - mf_qcforc, & - mf_rcm, mf_cloudfrac - ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & - mf_upw, & - mf_upqt, & - mf_upthl, & - mf_upthv, & - mf_upth, & - mf_upqc, & - mf_upbuoy, & - mf_upent - ! CFL limiter vars - real(r8), dimension(pcols) :: max_cfl - real(r8) :: cflval, cflfac - logical :: cfllim - - ! MF local vars - real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - th_zt, qv_zt, & ! momentum grid - th_zm, qv_zm, & ! momentum grid - qc_zm, & ! momentum grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - dzm, invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - - - integer :: nlev - - intrinsic :: max - - character(len=*), parameter :: subr='clubb_tend_cam' - -#endif - det_s(:) = 0.0_r8 - det_ice(:) = 0.0_r8 -#ifdef CLUBB_SGS - - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - ! MAIN COMPUTATION BEGINS HERE ! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - - nlev = pver + 1 - top_lev - - rtp2_zt_out = 0._r8 - thl2_zt_out = 0._r8 - wp2_zt_out = 0._r8 - pdfp_rtp2 = 0._r8 - wm_zt_out = 0._r8 - - frac_limit = 0.01_r8 - ic_limit = 1.e-12_r8 - - if (clubb_do_adv) then - apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected - else - apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected - endif - - ! Get indicees for cloud and ice mass and cloud and ice number - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('NUMICE',ixnumice) - - if (clubb_do_icesuper) then - call pbuf_get_field(pbuf, naai_idx, naai) - end if - - ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine - call physics_ptend_init(ptend_all, state%psetcols, 'clubb') - - ! Copy the state to state1 array to use in this routine - call physics_state_copy(state, state1) - - ! constituents are all treated as wet mmr by clubb - call set_dry_to_wet(state1) - - if (clubb_do_liqsupersat) then - call pbuf_get_field(pbuf, npccn_idx, npccn) - endif - - ! Determine number of columns and which chunk computation is to be performed on - - ncol = state%ncol - lchnk = state%lchnk - - ! Determine time step of physics buffer - itim_old = pbuf_old_tim_idx() - - ! Establish associations between pointers and physics buffer fields - - call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) - call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) - call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) - call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) - call pbuf_get_field(pbuf, rcm_idx, rcm) - call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) - call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - - call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) - call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) - call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) - call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) - call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) - call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) - call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) - if (do_clubb_mf) then - call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) - call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) - call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) - end if - - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then - apply_const = 0._r8 ! On first time through do not remove constant - ! from moments since it has not been added yet - endif - - ! Set the ztodt timestep in pbuf for SILHS - ztodtptr(:) = 1.0_r8*hdtime - - ! Define the grid box size. CLUBB needs this information to determine what - ! the maximum length scale should be. This depends on the column for - ! variable mesh grids and lat-lon grids - if (single_column) then - ! If single column specify grid box size to be something - ! similar to a GCM run - grid_dx(:) = 100000._r8 - grid_dy(:) = 100000._r8 - else - - call grid_size(state1, grid_dx, grid_dy) - - end if - - if (clubb_do_icesuper) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - lq2(:) = .FALSE. - lq2(1) = .TRUE. - lq2(ixcldice) = .TRUE. - lq2(ixnumice) = .TRUE. - - latsub = latvap + latice - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qitend(:ncol,:)=0._r8 - initend(:ncol,:)=0._r8 - - call ice_macro_tend(naai(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & - state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,1),state1%q(:ncol,top_lev:pver,ixcldice),& - state1%q(:ncol,top_lev:pver,ixnumice),latsub,hdtime,& - stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qitend(:ncol,top_lev:pver),& - initend(:ncol,top_lev:pver)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - !Write output for tendencies: - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QITENDICE', qitend, pcols, lchnk ) - call outfld( 'NITENDICE', initend, pcols, lchnk ) - - endif - - - ! Determine CLUBB time step and make it sub-step friendly - ! For now we want CLUBB time step to be 5 min since that is - ! what has been scientifically validated. However, there are certain - ! instances when a 5 min time step will not be possible (based on - ! host model time step or on macro-micro sub-stepping - - dtime = clubb_timestep - - ! Now check to see if dtime is greater than the host model - ! (or sub stepped) time step. If it is, then simply - ! set it equal to the host (or sub step) time step. - ! This section is mostly to deal with small host model - ! time steps (or small sub-steps) - - if (dtime > hdtime) then - dtime = hdtime - endif - - ! Now check to see if CLUBB time step divides evenly into - ! the host model time step. If not, force it to divide evenly. - ! We also want it to be 5 minutes or less. This section is - ! mainly for host model time steps that are not evenly divisible - ! by 5 minutes - - if (mod(hdtime,dtime) .ne. 0) then - dtime = hdtime/2._r8 - do while (dtime > clubb_timestep) - dtime = dtime/2._r8 - end do - endif - - ! If resulting host model time step and CLUBB time step do not divide evenly - ! into each other, have model throw a fit. - - if (mod(hdtime,dtime) .ne. 0) then - call endrun(subr//': CLUBB time step and HOST time step NOT compatible') - endif - - ! determine number of timesteps CLUBB core should be advanced, - ! host time step divided by CLUBB time step - nadv = max(hdtime/dtime,1._r8) - - ! Initialize forcings for transported scalars to zero - - sclrm_forcing(:,:) = 0._r8 - edsclrm_forcing(:,:) = 0._r8 - sclrm(:,:) = 0._r8 - - ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant - ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent - ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables - ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state - - do k=1,pver - do i=1,ncol - inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) - enddo - enddo - - ! At each CLUBB call, initialize mean momentum and thermo CLUBB state - ! from the CAM state - - do k=1,pver ! loop over levels - do i=1,ncol ! loop over columns - - rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) - rvm(i,k) = state1%q(i,k,ixq) - um(i,k) = state1%u(i,k) - vm(i,k) = state1%v(i,k) - thlm(i,k) = ( state1%t(i,k) & - - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & - * inv_exner_clubb(i,k) - - if (clubb_do_adv) then - if (macmic_it == 1) then - - ! Note that some of the moments below can be positive or negative. - ! Remove a constant that was added to prevent dynamics from clipping - ! them to prevent dynamics from making them positive. - thlp2(i,k) = state1%q(i,k,ixthlp2) - rtp2(i,k) = state1%q(i,k,ixrtp2) - rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) - wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) - wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) - wp2(i,k) = state1%q(i,k,ixwp2) - wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) - up2(i,k) = state1%q(i,k,ixup2) - vp2(i,k) = state1%q(i,k,ixvp2) - endif - endif - - enddo - enddo - - if (clubb_do_adv) then - ! If not last step of macmic loop then set apply_const back to - ! zero to prevent output from being corrupted. - if (macmic_it == cld_macmic_num_steps) then - apply_const = 1._r8 - else - apply_const = 0._r8 - endif - endif - - rtm(1:ncol,pverp) = rtm(1:ncol,pver) - um(1:ncol,pverp) = state1%u(1:ncol,pver) - vm(1:ncol,pverp) = state1%v(1:ncol,pver) - thlm(1:ncol,pverp) = thlm(1:ncol,pver) - - if (clubb_do_adv) then - thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) - rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) - wp2(1:ncol,pverp)=wp2(1:ncol,pver) - wp3(1:ncol,pverp)=wp3(1:ncol,pver) - up2(1:ncol,pverp)=up2(1:ncol,pver) - vp2(1:ncol,pverp)=vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - mf_precc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awql_output(:,:) = 0._r8 - s_awqi_output(:,:) = 0._r8 - s_awth_output(:,:) = 0._r8 - s_awqv_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - mf_upa_output(:,:) = 0._r8 - mf_upw_output(:,:) = 0._r8 - mf_upqt_output(:,:) = 0._r8 - mf_upthl_output(:,:) = 0._r8 - mf_upthv_output(:,:) = 0._r8 - mf_upth_output(:,:) = 0._r8 - mf_upqc_output(:,:) = 0._r8 - mf_upbuoy_output(:,:) = 0._r8 - mf_upent_output(:,:) = 0._r8 - mf_upa_flip(:,:,:) = 0._r8 - mf_upw_flip(:,:,:) = 0._r8 - mf_upqt_flip(:,:,:) = 0._r8 - mf_upthl_flip(:,:,:) = 0._r8 - mf_upthv_flip(:,:,:) = 0._r8 - mf_upth_flip(:,:,:) = 0._r8 - mf_upqc_flip(:,:,:) = 0._r8 - mf_upbuoy_flip(:,:,:) = 0._r8 - mf_upent_flip(:,:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_thvflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - mf_thflx_output(:,:) = 0._r8 - mf_qvflx_output(:,:) = 0._r8 - mf_thlforc_output(:,:) = 0._r8 - mf_qtforc_output(:,:) = 0._r8 - mf_thforc_output(:,:) = 0._r8 - mf_qvforc_output(:,:) = 0._r8 - mf_qcforc_output(:,:) = 0._r8 - mf_rcm_output(:,:) = 0._r8 - mf_cloudfrac_output(:,:) = 0._r8 - - ! Loop over all columns in lchnk to advance CLUBB core - do i=1,ncol ! loop over columns - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1,nlev+1 - zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1,nlev - zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - - do k=1,pver - dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - enddo - - ! Thermodynamic ghost point is below surface - zt_g(1) = -1._r8*zt_g(2) - - ! Set the elevation of the surface - sfc_elevation = state1%zi(i,pver+1) - - ! Set the grid size - host_dx = grid_dx(i) - host_dy = grid_dy(i) - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile - exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) - invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo - thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo - th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) - qv_zt(k+1) = state1%q(i,pver-k+1,ixq) - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) - radf(k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) - enddo - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - rho_ds_zt(1) = rho_ds_zt(2) - invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) - rho_in(1) = rho_ds_zt(2) - thv_ds_zt(1) = thv_ds_zt(2) - rho_zt(:) = rho_in(:) - p_in_Pa(1) = p_in_Pa(2) - exner(1) = exner(2) - rfrzm(1) = rfrzm(2) - radf(1) = radf(2) - qrl_clubb(1) = qrl_clubb(2) - th_zt(1) = th_zt(2) - qv_zt(1) = qv_zt(2) - - ! Compute mean w wind on thermo grid, convert from omega to w - wm_zt(1) = 0._r8 - do k=1,nlev - wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) - enddo - - ! ------------------------------------------------- ! - ! Begin case specific code for SCAM cases. ! - ! This section of code block NOT called in ! - ! global simulations ! - ! ------------------------------------------------- ! - - if (single_column) then - - ! Initialize zo if variable ustar is used - - if (cam_in%landfrac(i) >= 0.5_r8) then - zo = 0.035_r8 - else - zo = 0.0001_r8 - endif - - ! Compute surface wind (ubar) - ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - ! Below denotes case specifics for surface momentum - ! and thermodynamic fluxes, depending on the case - - ! Define ustar (based on case, if not variable) - ustar = 0.25_r8 ! Initialize ustar in case no case - - if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then - ustar = 0.30_r8 - endif - - if(trim(scm_clubb_iop_name) == 'RICO_3day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & - trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - bflx22 = (gravit/theta0)*wpthlp_sfc - ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) - endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation - upwp_sfc = -um(i,pver)*ustar**2/ubar - vpwp_sfc = -vm(i,pver)*ustar**2/ubar - - endif - - ! Define surface sources for transported variables for diffusion, will - ! be zero as these tendencies are done in vertical_diffusion - do ixind=1,edsclr_dim - wpedsclrp_sfc(ixind) = 0._r8 - enddo - - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & - zi_g(1), zi_g, zt_g) - - call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & - zi_g, zt_g, & - clubb_config_flags%l_prescribed_avg_deltaz, & - err_code ) - - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing = 0._r8 - rtm_forcing = 0._r8 - um_forcing = 0._r8 - vm_forcing = 0._r8 - - wprtp_forcing = 0._r8 - wpthlp_forcing = 0._r8 - rtp2_forcing = 0._r8 - thlp2_forcing = 0._r8 - rtpthlp_forcing = 0._r8 - - ice_supersat_frac_out = 0._r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) - thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) - wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) - wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) - rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(i,:) = 0.0_r8 - thlp2_mc_zt(i,:) = 0.0_r8 - wprtp_mc_zt(i,:) = 0.0_r8 - wpthlp_mc_zt(i,:) = 0.0_r8 - rtpthlp_mc_zt(i,:) = 0.0_r8 - - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api(rho_ds_zt) - rho_zm = zt2zm_api(rho_zt) - invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) - thv_ds_zm = zt2zm_api(thv_ds_zt) - wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model - wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux - wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) - upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - um_in(k) = um(i,pverp-k+1) - vm_in(k) = vm(i,pverp-k+1) - upwp_in(k) = upwp(i,pverp-k+1) - vpwp_in(k) = vpwp(i,pverp-k+1) - wpthvp_in(k) = wpthvp(i,pverp-k+1) - wp2thvp_in(k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(k)= thlpthvp(i,pverp-k+1) - up2_in(k) = up2(i,pverp-k+1) - vp2_in(k) = vp2(i,pverp-k+1) - up3_in(k) = up3(i,pverp-k+1) - vp3_in(k) = vp3(i,pverp-k+1) - wp2_in(k) = wp2(i,pverp-k+1) - wp3_in(k) = wp3(i,pverp-k+1) - rtp2_in(k) = rtp2(i,pverp-k+1) - thlp2_in(k) = thlp2(i,pverp-k+1) - rtp3_in(k) = rtp3(i,pverp-k+1) - thlp3_in(k) = thlp3(i,pverp-k+1) - thlm_in(k) = thlm(i,pverp-k+1) - rtm_in(k) = rtm(i,pverp-k+1) - rvm_in(k) = rvm(i,pverp-k+1) - wprtp_in(k) = wprtp(i,pverp-k+1) - wpthlp_in(k) = wpthlp(i,pverp-k+1) - rtpthlp_in(k) = rtpthlp(i,pverp-k+1) - rcm_inout(k) = rcm(i,pverp-k+1) - cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) - sclrpthvp_inout(k,:) = 0._r8 - - if (k .ne. 1) then - pre_in(k) = prer_evap(i,pverp-k+1) - endif - - ! Initialize these to prevent crashing behavior - wprcp_out(k) = 0._r8 - rcm_in_layer_out(k) = 0._r8 - cloud_cover_out(k) = 0._r8 - edsclr_in(k,:) = 0._r8 - khzm_out(k) = 0._r8 - khzt_out(k) = 0._r8 - - ! higher order scalar stuff, put to zero - sclrm(k,:) = 0._r8 - wpsclrp(k,:) = 0._r8 - sclrp2(k,:) = 0._r8 - sclrp3(k,:) = 0._r8 - sclrprtp(k,:) = 0._r8 - sclrpthlp(k,:) = 0._r8 - wpsclrp_sfc(:) = 0._r8 - hydromet(k,:) = 0._r8 - wphydrometp(k,:) = 0._r8 - wp2hmp(k,:) = 0._r8 - rtphmp_zt(k,:) = 0._r8 - thlphmp_zt(k,:) = 0._r8 - - enddo - pre_in(1) = pre_in(2) - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - do k=1,pver - kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) - enddo - kappa_zt(1) = kappa_zt(2) - qc_zt(1) = qc_zt(2) - invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) - do k=1,pverp - p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) - enddo - end if - - if (clubb_do_adv) then - if (macmic_it == 1) then - wp2_in=zt2zm_api(wp2_in) - wpthlp_in=zt2zm_api(wpthlp_in) - wprtp_in=zt2zm_api(wprtp_in) - up2_in=zt2zm_api(up2_in) - vp2_in=zt2zm_api(vp2_in) - thlp2_in=zt2zm_api(thlp2_in) - rtp2_in=zt2zm_api(rtp2_in) - rtpthlp_in=zt2zm_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Do the same for tracers - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - do k=1,nlev - edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) - enddo - edsclr_in(1,icnt) = edsclr_in(2,icnt) - end if - enddo - - if (do_expldiff) then - do k=1,nlev - edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) - edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) - enddo - - edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) - edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) - endif - - stats_nsamp = nint(stats_tsamp/dtime) - stats_nout = nint(stats_tout/dtime) - - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif - - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - dzt(k) = zi_g(k) - zi_g(k-1) - dzm(k-1) = zt_g(k) - zt_g(k-1) - enddo - dzt(1) = dzt(2) - dzm(pverp) = dzm(pver) - invrs_dzt = 1._r8/dzt - - rtm_zm_in = zt2zm_api( rtm_in ) - thlm_zm_in = zt2zm_api( thlm_in ) - th_zm = zt2zm_api( th_zt ) - qv_zm = zt2zm_api( qv_zt ) - qc_zm = zt2zm_api( qc_zt ) - - call integrate_mf( pverp, & ! input - rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - mf_upa, & ! output - plume diagnostics - mf_upw, & ! output - plume diagnostics - mf_upqt, & ! output - plume diagnostics - mf_upthl, & ! output - plume diagnostics - mf_upthv, & ! output - plume diagnostics - mf_upth, & ! output - plume diagnostics - mf_upqc, & ! output - plume diagnostics - mf_upbuoy, & ! output - plume diagnostics - mf_upent, & ! output - plume diagnostics - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - mf_precc, & ! output - plume diagnostics - s_ae, s_aw, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awql, s_awqi, & ! output - plume diagnostics - s_awth, s_awqv, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thflx, mf_qvflx, & ! output - plume diagnostics - mf_thvflx, mf_qcflx, & ! output - plume diagnostics - mf_thlflx, mf_qtflx ) ! output - variables needed for solver - - ! CFL limiter - s_aw(0) = 0._r8 - max_cfl(i)= 0._r8 - do k=2,pverp - max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) - end do - cflval = 1._r8 - cflfac = 1._r8 - cfllim = .true. - if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) - - ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing = 0._r8 - thlm_forcing = 0._r8 - mf_thforc = 0._r8 - mf_qvforc = 0._r8 - mf_qcforc = 0._r8 - do k=2,pverp - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) - - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) - - mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) - - mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) - - mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) - - end do - ! compute ensemble cloud - mf_rcm = 0._r8 - mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= mf_moist_a(:pverp) - - end if - - ! Advance CLUBB CORE one timestep in the future - call advance_clubb_core_api & - ( l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & - thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & - sclrm_forcing, edsclrm_forcing, wprtp_forcing, & - wpthlp_forcing, rtp2_forcing, thlp2_forcing, & - rtpthlp_forcing, wm_zm, wm_zt, & - wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & - wpsclrp_sfc, wpedsclrp_sfc, & - p_in_Pa, rho_zm, rho_in, exner, & - rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & - invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & - rfrzm, radf, & - wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & - host_dx, host_dy, & - clubb_config_flags, & - um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & - thlm_in, rtm_in, wprtp_in, wpthlp_in, & - wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & - sclrm, & - sclrp2, sclrp3, sclrprtp, sclrpthlp, & - wpsclrp, edsclr_in, err_code, & - rcm_inout, cloud_frac_inout, & - wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & - sclrpthvp_inout, & - pdf_params_chnk(i,lchnk), pdf_params_zm_chnk(i,lchnk), & - pdf_implicit_coefs_terms_chnk(i,lchnk), & - khzm_out, khzt_out, & - qclvar_out, thlprcp_out, & - wprcp_out, ice_supersat_frac_out, & - rcm_in_layer_out, cloud_cover_out) - - if ( err_code == clubb_fatal_error ) then - write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep(), "LAT: ", state1%lat(i), " LON: ", state1%lon(i) - call endrun(subr//': Fatal error in CLUBB library') - end if - - - if (do_rainturb) then - rvm_in = rtm_in - rcm_inout - call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & - rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & - rtp2_mc_out, thlp2_mc_out, & - wprtp_mc_out, wpthlp_mc_out, & - rtpthlp_mc_out) - - dum1 = (1._r8 - cam_in%landfrac(i)) - - ! update turbulent moments based on rain evaporation - rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime - wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime - wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(rcm_inout) - qrl_zm = zt2zm_api(qrl_clubb) - thlp2_rad_out(:) = 0._r8 - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) - thlp2_in = thlp2_in + thlp2_rad_out * dtime - thlp2_in = max(thl_tol**2,thlp2_in) - endif - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& - out_radzt,out_radzm,out_sfc) - - enddo ! end time loop - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) - wpthlp_in=zm2zt_api(wpthlp_in) - wprtp_in=zm2zt_api(wprtp_in) - up2_in=zm2zt_api(up2_in) - vp2_in=zm2zt_api(vp2_in) - thlp2_in=zm2zt_api(thlp2_in) - rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api(rtp2_in) - thl2_zt = zm2zt_api(thlp2_in) - wp2_zt = zm2zt_api(wp2_in) - - ! Arrays need to be "flipped" to CAM grid - - do k=1,nlev+1 - - um(i,pverp-k+1) = um_in(k) - vm(i,pverp-k+1) = vm_in(k) - upwp(i,pverp-k+1) = upwp_in(k) - vpwp(i,pverp-k+1) = vpwp_in(k) - wpthvp(i,pverp-k+1) = wpthvp_in(k) - wp2thvp(i,pverp-k+1) = wp2thvp_in(k) - rtpthvp(i,pverp-k+1) = rtpthvp_in(k) - thlpthvp(i,pverp-k+1) = thlpthvp_in(k) - up2(i,pverp-k+1) = up2_in(k) - vp2(i,pverp-k+1) = vp2_in(k) - up3(i,pverp-k+1) = up3_in(k) - vp3(i,pverp-k+1) = vp3_in(k) - thlm(i,pverp-k+1) = thlm_in(k) - rtm(i,pverp-k+1) = rtm_in(k) - wprtp(i,pverp-k+1) = wprtp_in(k) - wpthlp(i,pverp-k+1) = wpthlp_in(k) - wp2(i,pverp-k+1) = wp2_in(k) - wp3(i,pverp-k+1) = wp3_in(k) - rtp2(i,pverp-k+1) = rtp2_in(k) - thlp2(i,pverp-k+1) = thlp2_in(k) - rtp3(i,pverp-k+1) = rtp3_in(k) - thlp3(i,pverp-k+1) = thlp3_in(k) - rtpthlp(i,pverp-k+1) = rtpthlp_in(k) - rcm(i,pverp-k+1) = rcm_inout(k) - ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_out(k) - wprcp(i,pverp-k+1) = wprcp_out(k) - cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(k),1._r8) - rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(k) - cloud_cover(i,pverp-k+1) = min(cloud_cover_out(k),1._r8) - zt_out(i,pverp-k+1) = zt_g(k) - zi_out(i,pverp-k+1) = zi_g(k) - khzm(i,pverp-k+1) = khzm_out(k) - qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(k)) - wm_zt_out(i,pverp-k+1) = wm_zt(k) - - rtp2_zt_out(i,pverp-k+1) = rtp2_zt(k) - thl2_zt_out(i,pverp-k+1) = thl2_zt(k) - wp2_zt_out(i,pverp-k+1) = wp2_zt(k) - - mean_rt & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * pdf_params_chnk(i,lchnk)%rt_1(k) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * pdf_params_chnk(i,lchnk)%rt_2(k) - - pdfp_rtp2(i,pverp-k+1) & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * ( ( pdf_params_chnk(i,lchnk)%rt_1(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_1(k) ) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * ( ( pdf_params_chnk(i,lchnk)%rt_2(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_2(k) ) - - do ixind=1,edsclr_dim - edsclr_out(pverp-k+1,ixind) = edsclr_in(k,ixind) - enddo - - if (do_clubb_mf) then - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awth_output(i,pverp-k+1) = s_awth(k) - s_awqv_output(i,pverp-k+1) = s_awqv(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - s_awql_output(i,pverp-k+1) = s_awql(k) - s_awqi_output(i,pverp-k+1) = s_awqi(k) - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - mf_thflx_output(i,pverp-k+1) = mf_thflx(k) - mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) - if (k.ne.1) then - mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) - mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) - mf_thforc_output(i,pverp-k+1) = mf_thforc(k) - mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) - mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) - end if - - mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) - mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) - mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) - mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - - end if - - enddo - - if (do_clubb_mf) then - do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) - end do - end if - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - upwp(i,:top_lev-1) = 0._r8 - vpwp(i,:top_lev-1) = 0._r8 - rcm(i,:top_lev-1) = 0._r8 - wprcp(i,:top_lev-1) = 0._r8 - cloud_frac(i,:top_lev-1) = 0._r8 - rcm_in_layer(i,:top_lev-1) = 0._r8 - zt_out(i,:top_lev-1) = 0._r8 - zi_out(i,:top_lev-1) = 0._r8 - khzm(i,:top_lev-1) = 0._r8 - qclvar(i,:top_lev-1) = 2._r8 - - - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end if - enddo - - ! Fill up arrays needed for McICA. Note we do not want the ghost point, - ! thus why the second loop is needed. - - zi_out(i,1) = 0._r8 - - ! Section below is concentrated on energy fixing for conservation. - ! There are two steps to this process. The first is to remove any tendencies - ! CLUBB may have produced above where it is active due to roundoff. - ! The second is to provider a fixer because CLUBB and CAM's thermodynamic - ! variables are different. - - ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from - ! firing up in the stratosphere - clubbtop = troplev(i) - do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) - clubbtop = clubbtop + 1 - enddo - - ! Compute static energy using CLUBB's variables - do k=1,pver - clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & - + latvap * rcm(i,k) & - + gravit * state1%zm(i,k) + state1%phis(i) - enddo - - ! Compute integrals above layer where CLUBB is active - se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called - se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called - tw_upper_a = 0._r8 ! total water in layers above where CLUBB is active AFTER CLUBB is called - tw_upper_b = 0._r8 ! total water in layers above where CLUBB is active BEFORE CLUBB is called - do k=1,clubbtop - se_upper_a = se_upper_a + (clubb_s(k)+0.5_r8*(um(i,k)**2+vm(i,k)**2)+(latvap+latice)* & - (rtm(i,k)-rcm(i,k))+(latice)*rcm(i,k))*state1%pdel(i,k)/gravit - se_upper_b = se_upper_b + (state1%s(i,k)+0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)+(latvap+latice)* & - state1%q(i,k,ixq)+(latice)*state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit - tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - enddo - - ! Compute the disbalance of total energy and water in upper levels, - ! divide by the thickness in the lower atmosphere where we will - ! evenly distribute this disbalance - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Perform a test to see if there will be any negative RTM errors - ! in the column. If so, apply the disbalance to the surface - apply_to_surface = .false. - if (tw_upper_diss < 0._r8) then - do k=clubbtop+1,pver - rtm_test = (rtm(i,k) + tw_upper_diss*gravit) - rcm(i,k) - if (rtm_test < 0._r8) then - apply_to_surface = .true. - endif - enddo - endif - - if (apply_to_surface) then - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - rtm(i,pver) = rtm(i,pver) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(pver) = clubb_s(pver) + se_upper_diss*gravit - else - ! Apply the disbalances above to layers where CLUBB is active - do k=clubbtop+1,pver - rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit - enddo - endif - - ! Essentially "zero" out tendencies in the layers above where CLUBB is active - do k=1,clubbtop - if (apply_to_heat) clubb_s(k) = state1%s(i,k) - rcm(i,k) = state1%q(i,k,ixcldliq) - rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) - enddo - - ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water - ! after CLUBB is called. This is for energy conservation purposes. - se_a = 0._r8 - ke_a = 0._r8 - wv_a = 0._r8 - wl_a = 0._r8 - - ! Do the same as above, but for before CLUBB was called. - se_b = 0._r8 - ke_b = 0._r8 - wv_b = 0._r8 - wl_b = 0._r8 - do k=1,pver - se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit - ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit - wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit - wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit - - se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit - ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit - wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit - wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - enddo - - ! Based on these integrals, compute the total energy before and after CLUBB call - te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) - te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) - - ! Take into account the surface fluxes of heat and moisture - ! Use correct qflux from cam_in, not lhf/latvap as was done previously - te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime - - ! Compute the disbalance of total energy, over depth where CLUBB is active - se_dis = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis*gravit - enddo - endif - - ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point - ! for all variables and therefore is never called in this loop - rtm_integral_vtend = 0._r8 - rtm_integral_ltend = 0._r8 - do k=1,pver - - ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind - ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind - ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor - ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water - ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy - - rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - rtm_integral_vtend = rtm_integral_vtend + ptend_loc%q(i,k,ixq)*state1%pdel(i,k)/gravit - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - - ! Here add a constant to moments which can be either positive or - ! negative. This is to prevent clipping when dynamics tries to - ! make all constituents positive - wp3(i,k) = wp3(i,k) + wp3_const - rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const - wpthlp(i,k) = wpthlp(i,k) + wpthlp_const - wprtp(i,k) = wprtp(i,k) + wprtp_const - - ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance - ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance - ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance - ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP - ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP - ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 - ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 - ptend_loc%q(i,k,ixup2)=(up2(i,k)-state1%q(i,k,ixup2))/hdtime ! UP2 - ptend_loc%q(i,k,ixvp2)=(vp2(i,k)-state1%q(i,k,ixvp2))/hdtime ! VP2 - else - ptend_loc%q(i,k,ixthlp2)=0._r8 - ptend_loc%q(i,k,ixrtp2)=0._r8 - ptend_loc%q(i,k,ixrtpthlp)=0._r8 - ptend_loc%q(i,k,ixwpthlp)=0._r8 - ptend_loc%q(i,k,ixwprtp)=0._r8 - ptend_loc%q(i,k,ixwp2)=0._r8 - ptend_loc%q(i,k,ixwp3)=0._r8 - ptend_loc%q(i,k,ixup2)=0._r8 - ptend_loc%q(i,k,ixvp2)=0._r8 - endif - - endif - - ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. - ! Loading up this array doesn't mean the tendencies are applied. - ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed - - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& - (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& - (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& - (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& - (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then - ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents - end if - end if - enddo - - enddo - - - enddo ! end column loop - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) - - ! Add constant to ghost point so that output is not corrupted - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp3(:,pverp) = wp3(:,pverp) + wp3_const - rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const - wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const - wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const - endif - endif - - cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) - - ! ------------------------------------------------- ! - ! End column computation of CLUBB, begin to apply ! - ! and compute output, etc ! - ! ------------------------------------------------- ! - - ! Output CLUBB tendencies - call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) - call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! Due to the order of operation of CLUBB, which closes on liquid first, - ! then advances it's predictive equations second, this can lead to - ! RHliq > 1 directly before microphysics is called. Therefore, we use - ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. - - if (clubb_do_liqsupersat) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - latsub = latvap + latice - - lq2(:) = .FALSE. - lq2(ixq) = .TRUE. - lq2(ixcldliq) = .TRUE. - lq2(ixnumliq) = .TRUE. - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qctend(:ncol,:)=0._r8 - inctend(:ncol,:)=0._r8 - - call liquid_macro_tend(npccn(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & - state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,ixq),state1%q(:ncol,top_lev:pver,ixcldliq),& - state1%q(:ncol,top_lev:pver,ixnumliq),latvap,hdtime,& - stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qctend(:ncol,top_lev:pver),& - inctend(:ncol,top_lev:pver)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - ! Write output for tendencies: - ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QCTENDICE', qctend, pcols, lchnk ) - call outfld( 'NCTENDICE', inctend, pcols, lchnk ) - - where(qctend .ne. 0._r8) - fqtend = 1._r8 - elsewhere - fqtend = 0._r8 - end where - - call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) - end if - - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! The rest of the code deals with diagnosing variables ! - ! for microphysics/radiation computation and macrophysics ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD DETRAINMENT ! - ! Detrainment of convective condensate into the environment or stratiform cloud ! - ! --------------------------------------------------------------------------------- ! - - ! Initialize the shallow convective detrainment rate, will always be zero - dlf2(:,:) = 0.0_r8 - dlf_liq_out(:,:) = 0.0_r8 - dlf_ice_out(:,:) = 0.0_r8 - - lqice(:) = .false. - lqice(ixcldliq) = .true. - lqice(ixcldice) = .true. - lqice(ixnumliq) = .true. - lqice(ixnumice) = .true. - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) - - if (zmconv_microp) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - call pbuf_get_field(pbuf, difzm_idx, difzm) - call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) - call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) - end if - - do k=1,pver - do i=1,ncol - if( state1%t(i,k) > 268.15_r8 ) then - dum1 = 0.0_r8 - elseif ( state1%t(i,k) < 238.15_r8 ) then - dum1 = 1.0_r8 - else - dum1 = ( 268.15_r8 - state1%t(i,k) ) / 30._r8 - endif - - if (zmconv_microp) then - ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 - - ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice - else - - ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 - ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8* 8.e-6_r8**3*997._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & - / (4._r8*3.14_r8*25.e-6_r8**3*500._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice - - dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) - dlf_ice_out(i,k) = dlf(i,k) * dum1 - end if - - ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep - ! track of the integrals of ice and static energy that is effected from conversion to ice - ! so that the energy checker doesn't complain. - det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit - det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit - - enddo - enddo - - det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water - - call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - - temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) - call outfld( 'DPDLFT', temp2d, pcols, lchnk) - - call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! ptend_all now has all accumulated tendencies. Convert the tendencies for the - ! dry constituents to dry air basis. - do ixind = 1, pcnst - if (lq(ixind) .and. cnst_type(ixind) == 'dry') then - do k = 1, pver - do i = 1, ncol - ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdel(i,k)/state1%pdeldry(i,k) - end do - end do - end if - end do - - ! ------------------------------------------------- ! - ! Diagnose relative cloud water variance ! - ! ------------------------------------------------- ! - - if (deep_scheme == 'CLUBB_SGS') then - relvarmax = 2.0_r8 - else - relvarmax = 10.0_r8 - endif - - relvar(:,:) = relvarmax ! default - - if (deep_scheme .ne. 'CLUBB_SGS') then - where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & - relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) - endif - - ! ------------------------------------------------- ! - ! Optional Accretion enhancement factor ! - ! ------------------------------------------------- ! - - accre_enhan(:ncol,:pver) = 1._r8 - - ! ------------------------------------------------- ! - ! Diagnose some output variables ! - ! ------------------------------------------------- ! - - ! density - rho(:ncol,1:pver) = state1%pmid(:ncol,1:pver)/(rairv(:ncol,1:pver,lchnk)*state1%t(:ncol,1:pver)) - rho(:ncol,pverp) = state1%ps(:ncol)/(rairv(:ncol,pver,lchnk)*state1%t(:ncol,pver)) - - wpthvp_diag(:,:) = 0.0_r8 - do k=1,pver - do i=1,ncol - eps = rairv(i,k,lchnk)/rh2o - ! buoyancy flux - wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & - (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & - state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) - - ! total water mixing ratio - qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) - ! liquid water potential temperature - thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) - ! liquid water static energy - sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) - enddo - enddo - - do k=1,pverp - do i=1,ncol - wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair - if (do_clubb_mf) then - mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair - mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o - end if - enddo - enddo - - do k=1,pverp - do i=1,ncol - qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) - thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) - rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) - cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) - wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) - wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) - wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) - if (do_clubb_mf) then - mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) - mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) - mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) - end if - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - ! initialize variables - alst(:,:) = 0.0_r8 - qlst(:,:) = 0.0_r8 - - do k=1,pver - do i=1,ncol - alst(i,k) = cloud_frac(i,k) - qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - deepcu(:,pver) = 0.0_r8 - shalcu(:,pver) = 0.0_r8 - - do k=1,pver-1 - do i=1,ncol - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = 0._r8 - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) - enddo - enddo - - if (single_column) then - if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & - trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & - trim(scm_clubb_iop_name) == 'RICO_3day' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - deepcu(:,:) = 0.0_r8 - concld(:,:) = 0.0_r8 - - endif - endif - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD FRACTION PORTION ! - ! use the aist_vector function to compute the ice cloud fraction ! - ! --------------------------------------------------------------------------------- ! - - aist(:,:top_lev-1) = 0._r8 - qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below - - do k = top_lev, pver - - ! For Type II PSC and for thin cirrus, the clouds can be thin, but - ! extensive and they should start forming when the gridbox mean saturation - ! reaches 1.0. - ! - ! For now, use the tropopause diagnostic to determine where the Type II - ! PSC should be, but in the future wold like a better metric that can also - ! identify the level for thin cirrus. Include the tropopause level so that - ! the cold point tropopause will use the stratospheric values. - where (k <= troplev) - rhmini = rhminis_const - rhmaxi = rhmaxis_const - elsewhere - rhmini = rhmini_const - rhmaxi = rhmaxi_const - end where - - if ( trim(subcol_scheme) == 'SILHS' ) then - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) - else - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& - qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) - endif - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! - ! ! - ! For now leave the computation of ice stratus fraction from macrop_driver intact ! - ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! - ! fraction that was coded in macrop_driver ! - ! --------------------------------------------------------------------------------- ! - - ! Recompute net stratus fraction using maximum over-lapping assumption, as done - ! in macrophysics code, using alst computed above and aist read in from physics buffer - - do k=1,pver - do i=1,ncol - - ast(i,k) = max(alst(i,k),aist(i,k)) - - qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) - enddo - enddo - - ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just - ! be outputting the shallow convective cloud fraction - - do k=1,pver - do i=1,ncol - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! DIAGNOSE THE PBL DEPTH ! - ! this is needed for aerosol code ! - ! --------------------------------------------------------------------------------- ! - - do i=1,ncol - do k=1,pver - th(i,k) = state1%t(i,k)*state1%exner(i,k) - thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) - enddo - enddo - - ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) - rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) - call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & - rrho(1:ncol), ustar2(1:ncol)) - ! use correct qflux from coupler - call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & - rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & - obklen(1:ncol)) - - dummy2(:) = 0._r8 - dummy3(:) = 0._r8 - - where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 - - ! Compute PBL depth according to Holtslag-Boville Scheme - call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & - ustar2, obklen, kbfs, pblh, dummy2, & - state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) - - ! Output the PBL depth - call outfld('PBLH', pblh, pcols, lchnk) - - ! Assign the first pver levels of cloud_frac back to cld - cld(:,1:pver) = cloud_frac(:,1:pver) - - ! --------------------------------------------------------------------------------- ! - ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! - ! --------------------------------------------------------------------------------- ! - - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 - call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) - - rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 - call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 - call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:) - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQV' , s_awqv_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) - call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) - call outfld( 'edmf_thflx' , mf_thflx_output, pcols, lchnk ) - call outfld( 'edmf_qvflx' , mf_qvflx_output, pcols, lchnk ) - call outfld( 'edmf_thforc' , mf_thforc_output, pcols, lchnk ) - call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) - call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) - call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) - call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) - call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) - call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) - call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) - call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) - call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) - call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) - call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) - call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) - call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) - end if - - if (macmic_it==cld_macmic_num_steps) then - call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) - call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) - call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) - call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) - - call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) - call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) - if (do_clubb_mf) then - call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) - call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) - call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) - end if - end if - - ! Output CLUBB history here - if (l_stats) then - - do i=1,stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) - enddo - - do i=1,stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) - enddo - - if (l_output_rad_files) then - do i=1,stats_rad_zt%num_output_fields - call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) - enddo - - do i=1,stats_rad_zm%num_output_fields - call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) - enddo - endif - - do i=1,stats_sfc%num_output_fields - call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) - enddo - - endif - - return -#endif - end subroutine clubb_tend_cam - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -! Saturation adjustment for ice -! Add ice mass if supersaturated -elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend) - - use wv_sat_methods, only: wv_sat_qsat_ice - - real(r8), intent(in) :: naai !Activated number of ice nuclei - real(r8), intent(in) :: t !temperature (k) - real(r8), intent(in) :: p !pressure (pa0 - real(r8), intent(in) :: qv !water vapor mixing ratio - real(r8), intent(in) :: qi !ice mixing ratio - real(r8), intent(in) :: ni !ice number concentration - real(r8), intent(in) :: xxls !latent heat of freezing - real(r8), intent(in) :: deltat !timestep - real(r8), intent(out) :: stend ! 'temperature' tendency - real(r8), intent(out) :: qvtend !vapor tendency - real(r8), intent(out) :: qitend !ice mass tendency - real(r8), intent(out) :: nitend !ice number tendency - - real(r8) :: ESI - real(r8) :: QSI - real(r8) :: tau - - stend = 0._r8 - qvtend = 0._r8 - qitend = 0._r8 - nitend = 0._r8 - -! calculate qsati from t,p,q - - call wv_sat_qsat_ice(t, p, ESI, QSI) - - if (naai > 1.e-18_r8 .and. qv > QSI) then - - - qitend = (qv-QSI)/deltat !* exp(-tau/deltat) - qvtend = 0._r8 - qitend - stend = qitend * xxls ! moist static energy tend...[J/kg/s] ! - - - ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice - if (ni < 1.e3_r8 .and. (qi+qitend*deltat) > 1.e-18_r8) then - nitend = nitend + 3._r8 * qitend/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) - endif - - endif - -end subroutine ice_macro_tend - -#ifdef CLUBB_SGS -! ---------------------------------------------------------------------- -! -! DISCLAIMER : this code appears to be correct but has not been -! very thouroughly tested. If you do notice any -! anomalous behaviour then please contact Andy and/or -! Bjorn -! -! Function diag_ustar: returns value of ustar using the below -! similarity functions and a specified buoyancy flux (bflx) given in -! kinematic units -! -! phi_m (zeta > 0) = (1 + am * zeta) -! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) -! -! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) -! -! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface -! Layer, in Workshop on Micormeteorology, pages 67-100. -! -! Code writen March, 1999 by Bjorn Stevens -! - -real(r8) function diag_ustar( z, bflx, wnd, z0 ) - -use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g - -implicit none - -real(r8), parameter :: am = 4.8_r8 ! " " " -real(r8), parameter :: bm = 19.3_r8 ! " " " - -real(r8), parameter :: grav = shr_const_g -real(r8), parameter :: vonk = shr_const_karman -real(r8), parameter :: pi = shr_const_pi - -real(r8), intent (in) :: z ! height where u locates -real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) -real(r8), intent (in) :: wnd ! wind speed at z -real(r8), intent (in) :: z0 ! momentum roughness height - - -integer :: iterate -real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar - -lnz = log( z / z0 ) -klnz = vonk/lnz -c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) - -ustar = wnd*klnz -if (abs(bflx) > 1.e-6_r8) then - do iterate=1,4 - - if (ustar > 1.e-6_r8) then - lmo = -ustar**3 / ( vonk * bflx ) - zeta = z/lmo - if (zeta > 0._r8) then - ustar = vonk*wnd /(lnz + am*zeta) - else - x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) - psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 - ustar = wnd*vonk/(lnz - psi1) - end if - - endif - - end do -end if - - -diag_ustar = ustar - -return - - -end function diag_ustar -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & - nnzp, nnrad_zt,nnrad_zm, delt ) - ! - ! Description: Initializes the statistics saving functionality of - ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here - ! the traditional stats_init of CLUBB is not called, as it is not compatible - ! with CAM output. - - !----------------------------------------------------------------------- - - - use clubb_api_module, only: & - stats_zt, & ! Variables - ztscr01, & - ztscr02, & - ztscr03, & - ztscr04, & - ztscr05, & - ztscr06, & - ztscr07, & - ztscr08, & - ztscr09, & - ztscr10, & - ztscr11, & - ztscr12, & - ztscr13, & - ztscr14, & - ztscr15, & - ztscr16, & - ztscr17, & - ztscr18, & - ztscr19, & - ztscr20, & - ztscr21 - - use clubb_api_module, only: & - stats_zm, & - zmscr01, & - zmscr02, & - zmscr03, & - zmscr04, & - zmscr05, & - zmscr06, & - zmscr07, & - zmscr08, & - zmscr09, & - zmscr10, & - zmscr11, & - zmscr12, & - zmscr13, & - zmscr14, & - zmscr15, & - zmscr16, & - zmscr17, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats, & - l_output_rad_files, & - stats_tsamp, & - stats_tout, & - l_stats_samp, & - l_stats_last, & - l_netcdf, & - l_grads - - use clubb_api_module, only: time_precision, & ! - nvarmax_zm, stats_init_zm_api, & ! - nvarmax_zt, stats_init_zt_api, & ! - nvarmax_rad_zt, stats_init_rad_zt_api, & ! - nvarmax_rad_zm, stats_init_rad_zm_api, & ! - nvarmax_sfc, stats_init_sfc_api, & ! - fstderr, var_length ! - use cam_abortutils, only: endrun - use cam_history, only: addfld, horiz_only - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character - - implicit none - - ! Input Variables - - logical, intent(in) :: l_stats_in ! Stats on? T/F - - real(kind=time_precision), intent(in) :: & - stats_tsamp_in, & ! Sampling interval [s] - stats_tout_in ! Output interval [s] - - integer, intent(in) :: nnzp ! Grid points in the vertical [count] - integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] - integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] - - real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] - - - ! Local Variables - - ! Namelist Variables - - character(len=*), parameter :: subr = 'stats_init_clubb' - - character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels - character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels - character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface - - namelist /clubb_stats_nl/ & - clubb_vars_zt, & - clubb_vars_zm, & - clubb_vars_rad_zt, & - clubb_vars_rad_zm, & - clubb_vars_sfc - - ! Local Variables - - logical :: l_error - - character(len=200) :: temp1, sub - - integer :: i, ntot, read_status - integer :: iunit, ierr - - ! Initialize - l_error = .false. - - ! Set stats_variables variables with inputs from calling subroutine - l_stats = l_stats_in - - stats_tsamp = stats_tsamp_in - stats_tout = stats_tout_in - - if ( .not. l_stats ) then - l_stats_samp = .false. - l_stats_last = .false. - return - end if - - ! Initialize namelist variables - - clubb_vars_zt = '' - clubb_vars_zm = '' - clubb_vars_rad_zt = '' - clubb_vars_rad_zm = '' - clubb_vars_sfc = '' - - ! Read variables to compute from the namelist - if (masterproc) then - iunit= getunit() - open(unit=iunit,file="atm_in",status='old') - call find_group_name(iunit, 'clubb_stats_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('stats_init_clubb: error reading namelist') - end if - end if - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") - call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") - call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") - call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") - call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") - - ! Hardcode these for use in CAM-CLUBB, don't want either - l_netcdf = .false. - l_grads = .false. - - ! Check sampling and output frequencies - - ! The model time step length, delt (which is dtmain), should multiply - ! evenly into the statistical sampling time step length, stats_tsamp. - if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then - l_error = .true. ! This will cause the run to stop. - write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & - 'delt (which is dtmain). Check the appropriate ', & - 'model.in file.' - write(fstderr,*) 'stats_tsamp = ', stats_tsamp - write(fstderr,*) 'delt = ', delt - endif - - ! Initialize zt (mass points) - - i = 1 - do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zt(i)) /= 0 .and. & - i <= nvarmax_zt ) - i = i + 1 - enddo - ntot = i - 1 - if ( ntot == nvarmax_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zt than allowed for by nvarmax_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & - "in the stats namelist, or change nvarmax_zt." - write(fstderr,*) "nvarmax_zt = ", nvarmax_zt - call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") - endif - - stats_zt%num_output_fields = ntot - stats_zt%kk = nnzp - - allocate( stats_zt%z( stats_zt%kk ) ) - - allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - - allocate( stats_zt%file%var( stats_zt%num_output_fields ) ) - allocate( stats_zt%file%z( stats_zt%kk ) ) - - ! Allocate scratch space - - allocate( ztscr01(stats_zt%kk) ) - allocate( ztscr02(stats_zt%kk) ) - allocate( ztscr03(stats_zt%kk) ) - allocate( ztscr04(stats_zt%kk) ) - allocate( ztscr05(stats_zt%kk) ) - allocate( ztscr06(stats_zt%kk) ) - allocate( ztscr07(stats_zt%kk) ) - allocate( ztscr08(stats_zt%kk) ) - allocate( ztscr09(stats_zt%kk) ) - allocate( ztscr10(stats_zt%kk) ) - allocate( ztscr11(stats_zt%kk) ) - allocate( ztscr12(stats_zt%kk) ) - allocate( ztscr13(stats_zt%kk) ) - allocate( ztscr14(stats_zt%kk) ) - allocate( ztscr15(stats_zt%kk) ) - allocate( ztscr16(stats_zt%kk) ) - allocate( ztscr17(stats_zt%kk) ) - allocate( ztscr18(stats_zt%kk) ) - allocate( ztscr19(stats_zt%kk) ) - allocate( ztscr20(stats_zt%kk) ) - allocate( ztscr21(stats_zt%kk) ) - - ztscr01 = 0.0_r8 - ztscr02 = 0.0_r8 - ztscr03 = 0.0_r8 - ztscr04 = 0.0_r8 - ztscr05 = 0.0_r8 - ztscr06 = 0.0_r8 - ztscr07 = 0.0_r8 - ztscr08 = 0.0_r8 - ztscr09 = 0.0_r8 - ztscr10 = 0.0_r8 - ztscr11 = 0.0_r8 - ztscr12 = 0.0_r8 - ztscr13 = 0.0_r8 - ztscr14 = 0.0_r8 - ztscr15 = 0.0_r8 - ztscr16 = 0.0_r8 - ztscr17 = 0.0_r8 - ztscr18 = 0.0_r8 - ztscr19 = 0.0_r8 - ztscr20 = 0.0_r8 - ztscr21 = 0.0_r8 - - ! Default initialization for array indices for zt - - call stats_init_zt_api( clubb_vars_zt, l_error ) - - ! Initialize zm (momentum points) - - i = 1 - do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zm(i)) /= 0 .and. & - i <= nvarmax_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zm than allowed for by nvarmax_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & - "in the stats namelist, or change nvarmax_zm." - write(fstderr,*) "nvarmax_zm = ", nvarmax_zm - call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") - endif - - stats_zm%num_output_fields = ntot - stats_zm%kk = nnzp - - allocate( stats_zm%z( stats_zm%kk ) ) - - allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - - allocate( stats_zm%file%var( stats_zm%num_output_fields ) ) - allocate( stats_zm%file%z( stats_zm%kk ) ) - - ! Allocate scratch space - - allocate( zmscr01(stats_zm%kk) ) - allocate( zmscr02(stats_zm%kk) ) - allocate( zmscr03(stats_zm%kk) ) - allocate( zmscr04(stats_zm%kk) ) - allocate( zmscr05(stats_zm%kk) ) - allocate( zmscr06(stats_zm%kk) ) - allocate( zmscr07(stats_zm%kk) ) - allocate( zmscr08(stats_zm%kk) ) - allocate( zmscr09(stats_zm%kk) ) - allocate( zmscr10(stats_zm%kk) ) - allocate( zmscr11(stats_zm%kk) ) - allocate( zmscr12(stats_zm%kk) ) - allocate( zmscr13(stats_zm%kk) ) - allocate( zmscr14(stats_zm%kk) ) - allocate( zmscr15(stats_zm%kk) ) - allocate( zmscr16(stats_zm%kk) ) - allocate( zmscr17(stats_zm%kk) ) - - zmscr01 = 0.0_r8 - zmscr02 = 0.0_r8 - zmscr03 = 0.0_r8 - zmscr04 = 0.0_r8 - zmscr05 = 0.0_r8 - zmscr06 = 0.0_r8 - zmscr07 = 0.0_r8 - zmscr08 = 0.0_r8 - zmscr09 = 0.0_r8 - zmscr10 = 0.0_r8 - zmscr11 = 0.0_r8 - zmscr12 = 0.0_r8 - zmscr13 = 0.0_r8 - zmscr14 = 0.0_r8 - zmscr15 = 0.0_r8 - zmscr16 = 0.0_r8 - zmscr17 = 0.0_r8 - - call stats_init_zm_api( clubb_vars_zm, l_error ) - - ! Initialize rad_zt (radiation points) - - if (l_output_rad_files) then - - i = 1 - do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & - i <= nvarmax_rad_zt ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & - "in the stats namelist, or change nvarmax_rad_zt." - write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt - call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") - endif - - stats_rad_zt%num_output_fields = ntot - stats_rad_zt%kk = nnrad_zt - - allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) - - allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - - allocate( stats_rad_zt%file%var( stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) - - call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) - - ! Initialize rad_zm (radiation points) - - i = 1 - do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & - i <= nvarmax_rad_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & - "in the stats namelist, or change nvarmax_rad_zm." - write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm - call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") - endif - - stats_rad_zm%num_output_fields = ntot - stats_rad_zm%kk = nnrad_zm - - allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) - - allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - - allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) - - call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) - end if ! l_output_rad_files - - - ! Initialize sfc (surface point) - - i = 1 - do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_sfc(i)) /= 0 .and. & - i <= nvarmax_sfc ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_sfc ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_sfc than allowed for by nvarmax_sfc." - write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & - "in the stats namelist, or change nvarmax_sfc." - write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc - call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") - endif - - stats_sfc%num_output_fields = ntot - stats_sfc%kk = 1 - - allocate( stats_sfc%z( stats_sfc%kk ) ) - - allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - allocate( stats_sfc%file%var( stats_sfc%num_output_fields ) ) - allocate( stats_sfc%file%z( stats_sfc%kk ) ) - - call stats_init_sfc_api( clubb_vars_sfc, l_error ) - - ! Check for errors - - if ( l_error ) then - call endrun ('stats_init: errors found') - endif - -! Now call add fields - do i = 1, stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) - enddo - - do i = 1, stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) - enddo - - if (l_output_rad_files) then -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - do i = 1, stats_rad_zt%num_output_fields - call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) - enddo - - do i = 1, stats_rad_zm%num_output_fields - call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) - enddo - endif - - do i = 1, stats_sfc%num_output_fields - call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& - 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) - enddo - - return - - end subroutine stats_init_clubb - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - - !----------------------------------------------------------------------- - subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) - - ! Description: Called when the stats timestep has ended. This subroutine - ! is responsible for calling statistics to be written to the output - ! format. - !----------------------------------------------------------------------- - -#ifdef CLUBB_SGS - - use shr_infnan_mod, only: is_nan => shr_infnan_isnan - - use clubb_api_module, only: & - fstderr, & ! Constant(s) - stats_zt, & ! Variable(s) - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats_last, & - stats_tsamp, & - stats_tout, & - l_output_rad_files, & - clubb_at_least_debug_level_api ! Procedure(s) - - use cam_abortutils, only: endrun - - implicit none - - -#endif - - integer :: thecol - - real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) - real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) - real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) - -#ifdef CLUBB_SGS - ! Local Variables - - integer :: i, k - logical :: l_error - - ! Check if it is time to write to file - - if ( .not. l_stats_last ) return - - ! Initialize - l_error = .false. - - ! Compute averages - call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) - call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) - if (l_output_rad_files) then - call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples ) - call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples ) - end if - call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) - - ! Here we are not outputting the data, rather reading the stats into - ! arrays which are conformable to CAM output. Also, the data is "flipped" - ! in the vertical level to be the same as CAM output. - do i = 1, stats_zt%num_output_fields - do k = 1, stats_zt%kk - out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) - if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_zm%num_output_fields - do k = 1, stats_zt%kk - out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) - if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 - enddo - enddo - - if (l_output_rad_files) then - do i = 1, stats_rad_zt%num_output_fields - do k = 1, stats_rad_zt%kk - out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) - if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_rad_zm%num_output_fields - do k = 1, stats_rad_zm%kk - out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) - if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 - enddo - enddo - - ! Fill in values above the CLUBB top. - out_zt(thecol,:top_lev-1,:) = 0.0_r8 - out_zm(thecol,:top_lev-1,:) = 0.0_r8 - out_radzt(thecol,:top_lev-1,:) = 0.0_r8 - out_radzm(thecol,:top_lev-1,:) = 0.0_r8 - - endif ! l_output_rad_files - - do i = 1, stats_sfc%num_output_fields - out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) - if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 - enddo - - ! Reset sample fields - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - if (l_output_rad_files) then - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - end if - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - return - -#endif - - end subroutine stats_end_timestep_clubb - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - !----------------------------------------------------------------------- - subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) - - ! Description: - ! Initialize stats to zero - !----------------------------------------------------------------------- - - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - - implicit none - - ! Input - integer, intent(in) :: kk, num_output_fields - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n - logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update - - ! Zero out arrays - - if ( num_output_fields > 0 ) then - x(:,:,:,:) = 0.0_r8 - n(:,:,:,:) = 0 - l_in_update(:,:,:,:) = .false. - end if - - return - - end subroutine stats_zero - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - -#ifdef CLUBB_SGS - !----------------------------------------------------------------------- - subroutine stats_avg( kk, num_output_fields, x, n ) - - ! Description: - ! Compute the average of stats fields - !----------------------------------------------------------------------- - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - implicit none - - ! Input - integer, intent(in) :: num_output_fields, kk - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x - - ! Internal - - integer k,m - - ! Compute averages - - do m=1,num_output_fields - do k=1,kk - - if ( n(1,1,k,m) > 0 ) then - x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) - end if - - end do - end do - - return - - end subroutine stats_avg - - subroutine grid_size(state, grid_dx, grid_dy) - ! Determine the size of the grid for each of the columns in state - - use phys_grid, only: get_area_p - use shr_const_mod, only: shr_const_pi - use physics_types, only: physics_state - - - type(physics_state), intent(in) :: state - real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - - real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator - real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid - real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid - - real(r8) :: mpdeglat, column_area, degree - integer :: i - - ! determine the column area in radians - do i=1,state%ncol - column_area = get_area_p(state%lchnk,i) - degree = sqrt(column_area)*(180._r8/shr_const_pi) - - ! Now find meters per degree latitude - ! Below equation finds distance between two points on an ellipsoid, derived from expansion - ! taking into account ellipsoid using World Geodetic System (WGS84) reference - mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) - grid_dx(i) = mpdeglat * degree - grid_dy(i) = grid_dx(i) ! Assume these are the same - enddo - - end subroutine grid_size - -#endif - -#ifdef CLUBB_SGS - subroutine init_clubb_config_flags( clubb_config_flags_in ) -!------------------------------------------------------------------------------- -! Description: -! Initializes the public module variable 'clubb_config_flags' of type -! 'clubb_config_flags_type' on first call and only on first call. -! References: -! None -!------------------------------------------------------------------------------- - use clubb_api_module, only: & - clubb_config_flags_type, & ! Type - set_default_clubb_config_flags_api, & ! Procedure(s) - initialize_clubb_config_flags_type_api - - implicit none - - ! Input/Output Variables - type(clubb_config_flags_type), intent(inout) :: clubb_config_flags_in - - ! Local Variables - logical :: & - l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The - ! precipitation fraction is automatically set to 1 when this - ! flag is turned off. - l_predict_upwp_vpwp, & ! Flag to predict and along with and - ! alongside the advancement of , , , - ! , , and in subroutine - ! advance_xm_wpxp. Otherwise, and are still - ! approximated by eddy diffusivity when and are - ! advanced in subroutine advance_windm_edsclrm. - l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping - ! the overall correlation of w and x (w and rt, as well as w - ! and theta-l) within the limits of -max_mag_correlation_flux - ! to max_mag_correlation_flux. - l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and - ! thlp2) on keeping the overall correlation of w and x within - ! the limits of -max_mag_correlation_flux to - ! max_mag_correlation_flux. - l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the - ! turbulent dissipation coefficient, C2. - l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm - l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor - l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 - l_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects wprtp, wpthlp, & wpsclrp. - l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & - ! sclrpthlp. - l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtm, thlm, sclrm, um and vm. - l_uv_nudge, & ! For wind speed nudging. - l_rtm_nudge, & ! For rtm nudging - l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. - ! TKE = 1/2 (u'^2 + v'^2 + w'^2) - l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to - ! compute the varibles that are output from high order - ! closure - l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the - ! thermodynamic-level variables output from pdf_closure. - l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three - ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - - ! output from pdf_closure. - l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call - ! subroutine pdf_closure twice. If true, pdf_closure is - ! called first on thermodynamic levels and then on momentum - ! levels so that each variable is computed on its native - ! level. If false, pdf_closure is only called on - ! thermodynamic levels, and variables which belong on - ! momentum levels are interpolated. - l_standard_term_ta, & ! Use the standard discretization for the turbulent advection - ! terms. Setting to .false. means that a_1 and a_3 are - ! pulled outside of the derivative in - ! advance_wp2_wp3_module.F90 and in - ! advance_xp2_xpyp_module.F90. - l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac - ! and rcm to help increase cloudiness at coarser grid - ! resolutions. - l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones - l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors - l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) - l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) - l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability - ! correction - l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of - ! -(2/3)*em/tau_zm, as in Bougeault (1981) - l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly - l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values - l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the - ! mixing length scale as Lscale = tau * tke - l_use_ice_latent, & ! Includes the effects of ice latent heating in turbulence - ! terms - l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number - l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number - l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in - ! saturated atmospheres (from Durran and Klemp, 1982) - l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency - l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water - l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and - ! rtpthlp - l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 - l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz - l_update_pressure ! Flag for having CLUBB update pressure and exner - - logical, save :: first_call = .true. - - if (first_call) then - - call set_default_clubb_config_flags_api( l_use_precip_frac, & ! Out - l_predict_upwp_vpwp, & ! Out - l_min_wp2_from_corr_wx, & ! Out - l_min_xp2_from_corr_wx, & ! Out - l_C2_cloud_frac, & ! Out - l_diffuse_rtm_and_thlm, & ! Out - l_stability_correct_Kh_N2_zm, & ! Out - l_calc_thlp2_rad, & ! Out - l_upwind_wpxp_ta, & ! Out - l_upwind_xpyp_ta, & ! Out - l_upwind_xm_ma, & ! Out - l_uv_nudge, & ! Out - l_rtm_nudge, & ! Out - l_tke_aniso, & ! Out - l_vert_avg_closure, & ! Out - l_trapezoidal_rule_zt, & ! Out - l_trapezoidal_rule_zm, & ! Out - l_call_pdf_closure_twice, & ! Out - l_standard_term_ta, & ! Out - l_use_cloud_cover, & ! Out - l_diagnose_correlations, & ! Out - l_calc_w_corr, & ! Out - l_const_Nc_in_cloud, & ! Out - l_fix_w_chi_eta_correlations, & ! Out - l_stability_correct_tau_zm, & ! Out - l_damp_wp2_using_em, & ! Out - l_do_expldiff_rtm_thlm, & ! Out - l_Lscale_plume_centered, & ! Out - l_diag_Lscale_from_tau, & ! Out - l_use_ice_latent, & ! Out - l_use_C7_Richardson, & ! Out - l_use_C11_Richardson, & ! Out - l_brunt_vaisala_freq_moist, & ! Out - l_use_thvm_in_bv_freq, & ! Out - l_rcm_supersat_adj, & ! Out - l_single_C2_Skw, & ! Out - l_damp_wp3_Skw_squared, & ! Out - l_prescribed_avg_deltaz, & ! Out - l_update_pressure ) ! Out - - call initialize_clubb_config_flags_type_api( l_use_precip_frac, & ! In - l_predict_upwp_vpwp, & ! In - l_min_wp2_from_corr_wx, & ! In - l_min_xp2_from_corr_wx, & ! In - l_C2_cloud_frac, & ! In - l_diffuse_rtm_and_thlm, & ! In - l_stability_correct_Kh_N2_zm, & ! In - l_calc_thlp2_rad, & ! In - l_upwind_wpxp_ta, & ! In - l_upwind_xpyp_ta, & ! In - l_upwind_xm_ma, & ! In - l_uv_nudge, & ! In - l_rtm_nudge, & ! In - l_tke_aniso, & ! In - l_vert_avg_closure, & ! In - l_trapezoidal_rule_zt, & ! In - l_trapezoidal_rule_zm, & ! In - l_call_pdf_closure_twice, & ! In - l_standard_term_ta, & ! In - l_use_cloud_cover, & ! In - l_diagnose_correlations, & ! In - l_calc_w_corr, & ! In - l_const_Nc_in_cloud, & ! In - l_fix_w_chi_eta_correlations, & ! In - l_stability_correct_tau_zm, & ! In - l_damp_wp2_using_em, & ! In - l_do_expldiff_rtm_thlm, & ! In - l_Lscale_plume_centered, & ! In - l_diag_Lscale_from_tau, & ! In - l_use_ice_latent, & ! In - l_use_C7_Richardson, & ! In - l_use_C11_Richardson, & ! In - l_brunt_vaisala_freq_moist, & ! In - l_use_thvm_in_bv_freq, & ! In - l_rcm_supersat_adj, & ! In - l_single_C2_Skw, & ! In - l_damp_wp3_Skw_squared, & ! In - l_prescribed_avg_deltaz, & ! In - l_update_pressure, & ! In - clubb_config_flags_in ) ! Out - - first_call = .false. - - end if - - return - - end subroutine init_clubb_config_flags -#endif - -end module clubb_intr +module clubb_intr + + !----------------------------------------------------------------------------------------------------- ! + ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! + ! by the University of Wisconsin Milwaukee Group (UWM). ! + ! ! + ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! + ! ! + ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! + ! differencing the diffused and initial states. ! + ! ! + ! Calling sequence: ! + ! ! + !---------------------------Code history-------------------------------------------------------------- ! + ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! + ! Modified by: K Thayer-Calder ! + ! ! + !----------------------------------------------------------------------------------------------------- ! + + use shr_kind_mod, only: r8=>shr_kind_r8 + use ppgrid, only: pver, pverp, pcols, begchunk, endchunk + use phys_control, only: phys_getopts + use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o + + use spmd_utils, only: masterproc + use constituents, only: pcnst, cnst_add + use pbl_utils, only: calc_ustar, calc_obklen + use ref_pres, only: top_lev => trop_cloud_top_lev + use zm_conv_intr, only: zmconv_microp +#ifdef CLUBB_SGS + use clubb_api_module, only: pdf_parameter, implicit_coefs_terms + use clubb_api_module, only: clubb_config_flags_type + use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup + use cam_history_support, only: add_hist_coord +#endif + + implicit none + private + save + + ! ----------------- ! + ! Public interfaces ! + ! ----------------- ! + + public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, & +#ifdef CLUBB_SGS + ! This utilizes CLUBB specific variables in its interface + stats_init_clubb, & + init_clubb_config_flags, & +#endif + stats_end_timestep_clubb, & + clubb_readnl, & + clubb_init_cnst, & + clubb_implements_cnst + +#ifdef CLUBB_SGS + ! Both of these utilize CLUBB specific variables in their interface + private :: stats_zero, stats_avg +#endif + + logical, public :: do_cldcool + logical :: clubb_do_icesuper + +#ifdef CLUBB_SGS + type(clubb_config_flags_type), public :: clubb_config_flags +#endif + + ! ------------ ! + ! Private data ! + ! ------------ ! + + integer, parameter :: & + grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels + hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements + + real(r8), parameter, dimension(0) :: & + sclr_tol = 1.e-8_r8 ! Total water in kg/kg + + character(len=6) :: saturation_equation + + real(r8), parameter :: & + theta0 = 300._r8, & ! Reference temperature [K] + ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] + p0_clubb = 100000._r8 + + integer, parameter :: & + sclr_dim = 0 ! Higher-order scalars, set to zero + + real(r8), parameter :: & + wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected + + real(r8), parameter :: & + wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected + + real(r8), parameter :: & + wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected + + real(r8), parameter :: & + rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected + + real(r8), parameter :: unset_r8 = huge(1.0_r8) + + real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist + real(r8) :: clubb_rnevap_effic = unset_r8 + + real(r8) :: clubb_c1 = unset_r8 + real(r8) :: clubb_c1b = unset_r8 + real(r8) :: clubb_C2rt = unset_r8 + real(r8) :: clubb_C2thl = unset_r8 + real(r8) :: clubb_C2rtthl = unset_r8 + real(r8) :: clubb_C4 = unset_r8 + real(r8) :: clubb_C8 = unset_r8 + real(r8) :: clubb_C8b = unset_r8 + real(r8) :: clubb_C7 = unset_r8 + real(r8) :: clubb_C7b = unset_r8 + real(r8) :: clubb_c11 = unset_r8 + real(r8) :: clubb_c11b = unset_r8 + real(r8) :: clubb_c14 = unset_r8 + real(r8) :: clubb_c_K9 = unset_r8 + real(r8) :: clubb_nu9 = unset_r8 + real(r8) :: clubb_c_K10 = unset_r8 + real(r8) :: clubb_c_K10h = unset_r8 + real(r8) :: clubb_gamma_coef = unset_r8 + real(r8) :: clubb_gamma_coefb = unset_r8 + real(r8) :: clubb_beta = unset_r8 + real(r8) :: clubb_lambda0_stability_coef = unset_r8 + real(r8) :: clubb_lmin_coef = unset_r8 + real(r8) :: clubb_mult_coef = unset_r8 + real(r8) :: clubb_Skw_denom_coef = unset_r8 + real(r8) :: clubb_skw_max_mag = unset_r8 + real(r8) :: clubb_up2_vp2_factor = unset_r8 + real(r8) :: clubb_C_wp2_splat = unset_r8 + logical :: clubb_l_brunt_vaisala_freq_moist = .false. + logical :: clubb_l_call_pdf_closure_twice = .false. + logical :: clubb_l_damp_wp3_Skw_squared = .false. + logical :: clubb_l_min_wp2_from_corr_wx = .false. + logical :: clubb_l_min_xp2_from_corr_wx = .false. + logical :: clubb_l_predict_upwp_vpwp = .false. + logical :: clubb_l_rcm_supersat_adj = .false. + logical :: clubb_l_stability_correct_tau_zm = .false. + logical :: clubb_l_trapezoidal_rule_zt = .false. + logical :: clubb_l_trapezoidal_rule_zm = .false. + logical :: clubb_l_upwind_xpyp_ta = .false. + logical :: clubb_l_use_C7_Richardson = .false. + logical :: clubb_l_use_C11_Richardson = .false. + logical :: clubb_l_use_cloud_cover = .false. + logical :: clubb_l_use_thvm_in_bv_freq = .false. + logical :: clubb_l_vert_avg_closure = .false. + logical :: clubb_l_diag_Lscale_from_tau = .false. + logical :: clubb_l_damp_wp2_using_em = .false. + +! Constant parameters + logical, parameter, private :: & + l_implemented = .true., & ! Implemented in a host model (always true) + l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes + + logical, parameter, private :: & + apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) + + logical :: lq(pcnst) + logical :: prog_modal_aero + logical :: do_rainturb + logical :: do_expldiff + logical :: clubb_do_adv + logical :: clubb_do_liqsupersat = .false. + logical :: clubb_do_energyfix = .true. + logical :: history_budget + + logical :: clubb_l_lscale_plume_centered + logical :: clubb_l_use_ice_latent + + integer :: history_budget_histfile_num + integer :: edsclr_dim ! Number of scalars to transport in CLUBB + integer :: offset + +! define physics buffer indicies here + integer :: & + wp2_idx, & ! vertical velocity variances + wp3_idx, & ! third moment of vertical velocity + wpthlp_idx, & ! turbulent flux of thetal + wprtp_idx, & ! turbulent flux of total water + rtpthlp_idx, & ! covariance of thetal and rt + rtp2_idx, & ! variance of total water + thlp2_idx, & ! variance of thetal + rtp3_idx, & ! total water 3rd order + thlp3_idx, & ! thetal 3rd order + up2_idx, & ! variance of east-west wind + vp2_idx, & ! variance of north-south wind + up3_idx, & ! east-west wind 3rd order + vp3_idx, & ! north-south wind 3rd order + upwp_idx, & ! east-west momentum flux + vpwp_idx, & ! north-south momentum flux + thlm_idx, & ! mean thetal + rtm_idx, & ! mean total water mixing ratio + um_idx, & ! mean of east-west wind + vm_idx, & ! mean of north-south wind + wpthvp_idx, & ! buoyancy flux + wp2thvp_idx, & ! second order buoyancy term + rtpthvp_idx, & ! moisture buoyancy correlation + thlpthvp_idx, & ! temperature buoyancy correlation + sclrpthvp_idx, & ! passive scalar buoyancy correlation + cloud_frac_idx, & ! CLUBB's cloud fraction + cld_idx, & ! Cloud fraction + concld_idx, & ! Convective cloud fraction + ast_idx, & ! Stratiform cloud fraction + alst_idx, & ! Liquid stratiform cloud fraction + aist_idx, & ! Ice stratiform cloud fraction + qlst_idx, & ! Physical in-cloud LWC + qist_idx, & ! Physical in-cloud IWC + dp_frac_idx, & ! deep convection cloud fraction + sh_frac_idx, & ! shallow convection cloud fraction + kvh_idx, & ! CLUBB eddy diffusivity on thermo levels + pblh_idx, & ! PBL pbuf + icwmrdp_idx, & ! In cloud mixing ratio for deep convection + tke_idx, & ! turbulent kinetic energy + tpert_idx, & ! temperature perturbation from PBL + fice_idx, & ! fice_idx index in physics buffer + cmeliq_idx, & ! cmeliq_idx index in physics buffer + relvar_idx, & ! relative cloud water variance + accre_enhan_idx, & ! optional accretion enhancement factor for MG + npccn_idx, & ! liquid ccn number concentration + naai_idx, & ! ice number concentration + prer_evap_idx, & ! rain evaporation rate + qrl_idx, & ! longwave cooling rate + radf_idx, & + qsatfac_idx, & ! subgrid cloud water saturation scaling factor + ice_supersat_idx, & ! ice cloud fraction for SILHS + rcm_idx, & ! Cloud water mixing ratio for SILHS + ztodt_idx ! physics timestep for SILHS + + ! Indices for microphysical covariance tendencies + integer :: & + rtp2_mc_zt_idx, & + thlp2_mc_zt_idx, & + wprtp_mc_zt_idx, & + wpthlp_mc_zt_idx, & + rtpthlp_mc_zt_idx + + integer, public :: & + ixthlp2 = 0, & + ixwpthlp = 0, & + ixwprtp = 0, & + ixwp2 = 0, & + ixwp3 = 0, & + ixrtpthlp = 0, & + ixrtp2 = 0, & + ixup2 = 0, & + ixvp2 = 0 + + integer :: cmfmc_sh_idx = 0 + + integer :: & + dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. + difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. + dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. + dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. + + integer :: & + qt_macmic_idx, & + thl_macmic_idx, & + rcm_macmic_idx, & + cldfrac_macmic_idx, & + wpthlp_macmic_idx, & + wprtp_macmic_idx, & + wpthvp_macmic_idx, & + mf_wpthlp_macmic_idx, & + mf_wprtp_macmic_idx, & + mf_wpthvp_macmic_idx + + ! Output arrays for CLUBB statistics + real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc + + character(len=16) :: eddy_scheme ! Default set in phys_control.F90 + character(len=16) :: deep_scheme ! Default set in phys_control.F90 + character(len=16) :: subcol_scheme + + integer, parameter :: ncnst=9 + character(len=8) :: cnst_names(ncnst) + logical :: do_cnst=.false. + +#ifdef CLUBB_SGS + type(pdf_parameter), target, allocatable, public, protected :: & + pdf_params_chnk(:,:) ! PDF parameters (thermo. levs.) [units vary] + type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:,:) ! PDF parameters on momentum levs. [units vary] + type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:,:) ! PDF impl. coefs. & expl. terms [units vary] +#endif + + contains + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_register_cam( ) +!------------------------------------------------------------------------------- +! Description: +! Register the constituents and fields in the physics buffer +! Author: P. Bogenschutz, C. Craig, A. Gettelman +! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns +! +!------------------------------------------------------------------------------- +#ifdef CLUBB_SGS + + !------------------------------------------------ ! + ! Register physics buffer fields and constituents ! + !------------------------------------------------ ! + + ! Add CLUBB fields to pbuf + use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls + use subcol_utils, only: subcol_get_scheme + + integer :: cld_macmic_num_steps + + call phys_getopts( eddy_scheme_out = eddy_scheme, & + deep_scheme_out = deep_scheme, & + history_budget_out = history_budget, & + history_budget_histfile_num_out = history_budget_histfile_num, & + cld_macmic_num_steps_out = cld_macmic_num_steps) + + subcol_scheme = subcol_get_scheme() + + if (trim(subcol_scheme) == 'SILHS') then + saturation_equation = "flatau" + else + saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP + end if + + if (clubb_do_adv) then + cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) + do_cnst=.true. + ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments + ! need a constant added to them before they are advected, thus this would corrupt the output. + ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments + call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) + call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) + call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) + call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) + call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) + call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) + call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) + call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) + call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) + end if + + ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top + call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) + call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) + call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) + call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) + call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) + call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) + call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) + call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) + call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) + call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) + call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) + call pbuf_add_field('FICE', 'physpkg',dtype_r8, (/pcols,pver/), fice_idx) + call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) + call pbuf_add_field('CMELIQ', 'physpkg',dtype_r8, (/pcols,pver/), cmeliq_idx) + call pbuf_add_field('QSATFAC', 'physpkg',dtype_r8, (/pcols,pver/), qsatfac_idx) + + + call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) + call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) + call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) + call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) + call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) + call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) + call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) + call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) + call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) + + call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) + call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) + call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) + call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) + + call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) + call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) + call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) + call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) + call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) + call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) + + call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) + call pbuf_add_field('WP2THVP', 'physpkg', dtype_r8, (/pcols,pverp/), wp2thvp_idx) + call pbuf_add_field('RTPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), rtpthvp_idx) + call pbuf_add_field('THLPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), thlpthvp_idx) + call pbuf_add_field('CLOUD_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), cloud_frac_idx) + call pbuf_add_field('ISS_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), ice_supersat_idx) + call pbuf_add_field('RCM', 'physpkg', dtype_r8, (/pcols,pverp/), rcm_idx) + call pbuf_add_field('ZTODT', 'physpkg', dtype_r8, (/pcols/), ztodt_idx) + + ! For SILHS microphysical covariance contributions + call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) + call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) + call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) + call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) + call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) + + call pbuf_add_field('QT_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) + call pbuf_add_field('THETAL_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) + call pbuf_add_field('RCM_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) + call pbuf_add_field('CLDFRAC_CLUBB_macmic','global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) + call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) + call pbuf_add_field('WPRTP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) + call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) + if (do_clubb_mf) then + call pbuf_add_field('edmf_thlflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) + call pbuf_add_field('edmf_qtflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) + call pbuf_add_field('edmf_thvflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) + end if + +#endif + + end subroutine clubb_register_cam + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +function clubb_implements_cnst(name) + + !----------------------------------------------------------------------------- ! + ! ! + ! Return true if specified constituent is implemented by this package ! + ! ! + !----------------------------------------------------------------------------- ! + + character(len=*), intent(in) :: name ! constituent name + logical :: clubb_implements_cnst ! return value + + !----------------------------------------------------------------------- + + clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) + +end function clubb_implements_cnst + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) +#ifdef CLUBB_SGS + use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol +#endif + + !----------------------------------------------------------------------- ! + ! ! + ! Initialize the state if clubb_do_adv ! + ! ! + !----------------------------------------------------------------------- ! + + character(len=*), intent(in) :: name ! constituent name + real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) + real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) + logical, intent(in) :: mask(:) ! Only initialize where .true. + real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev + + !----------------------------------------------------------------------- + integer :: k, nlev + +#ifdef CLUBB_SGS + if (clubb_do_adv) then + nlev = size(q, 2) + do k = 1, nlev + if (trim(name) == trim(cnst_names(1))) then + where(mask) + q(:,k) = thl_tol**2 + end where + end if + if (trim(name) == trim(cnst_names(2))) then + where(mask) + q(:,k) = rt_tol**2 + end where + end if + if (trim(name) == trim(cnst_names(3))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(4))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(5))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(6))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + if (trim(name) == trim(cnst_names(7))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(8))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + if (trim(name) == trim(cnst_names(9))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + end do + end if +#endif + +end subroutine clubb_init_cnst + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_readnl(nlfile) + +#ifdef CLUBB_SGS + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use cam_abortutils, only: endrun + use clubb_api_module, only: l_stats, l_output_rad_files + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8 + use clubb_mf, only: clubb_mf_readnl +#endif + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + +#ifdef CLUBB_SGS + + character(len=*), parameter :: sub = 'clubb_readnl' + + logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & + clubb_expldiff ! Stats enabled (T/F) + + integer :: iunit, read_status, ierr + + namelist /clubb_his_nl/ clubb_history, clubb_rad_history + namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, clubb_expldiff, & + clubb_do_adv, clubb_timestep, & + clubb_rnevap_effic,clubb_do_icesuper + namelist /clubb_params_nl/ clubb_c1, clubb_c1b, clubb_c11, clubb_c11b, clubb_c14, clubb_mult_coef, clubb_gamma_coef, & + clubb_c_K10, clubb_c_K10h, clubb_beta, clubb_C2rt, clubb_C2thl, & + clubb_C2rtthl, clubb_C8, clubb_C8b, clubb_C7, clubb_C7b, clubb_Skw_denom_coef, & + clubb_C4, clubb_c_K9, clubb_nu9, clubb_C_wp2_splat, & + clubb_lambda0_stability_coef, clubb_l_lscale_plume_centered, & + clubb_l_use_ice_latent, clubb_do_liqsupersat, clubb_do_energyfix,& + clubb_lmin_coef, clubb_skw_max_mag, clubb_l_stability_correct_tau_zm, & + clubb_gamma_coefb, clubb_up2_vp2_factor, & + clubb_l_use_C7_Richardson, clubb_l_use_C11_Richardson, & + clubb_l_brunt_vaisala_freq_moist, clubb_l_use_thvm_in_bv_freq, & + clubb_l_rcm_supersat_adj, clubb_l_damp_wp3_Skw_squared, & + clubb_l_predict_upwp_vpwp, clubb_l_min_wp2_from_corr_wx, & + clubb_l_min_xp2_from_corr_wx, clubb_l_upwind_xpyp_ta, clubb_l_vert_avg_closure, & + clubb_l_trapezoidal_rule_zt, clubb_l_trapezoidal_rule_zm, & + clubb_l_call_pdf_closure_twice, clubb_l_use_cloud_cover, & + clubb_l_diag_Lscale_from_tau, clubb_l_damp_wp2_using_em + + !----- Begin Code ----- + + ! Determine if we want clubb_history to be output + clubb_history = .false. ! Initialize to false + l_stats = .false. ! Initialize to false + l_output_rad_files = .false. ! Initialize to false + do_cldcool = .false. ! Initialize to false + do_rainturb = .false. ! Initialize to false + do_expldiff = .false. ! Initialize to false + + clubb_l_lscale_plume_centered = .false. ! Initialize to false! + clubb_l_use_ice_latent = .false. ! Initialize to false! + + ! Call CLUBB+MF namelist + call clubb_mf_readnl(nlfile) + + ! Read namelist to determine if CLUBB history should be called + if (masterproc) then + iunit = getunit() + open( iunit, file=trim(nlfile), status='old' ) + + call find_group_name(iunit, 'clubb_his_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_his_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + end if + + call find_group_name(iunit, 'clubb_params_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_params_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + else + call endrun('clubb_readnl: error reading namelist') + end if + + call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + end if + + close(unit=iunit) + call freeunit(iunit) + end if + + ! Broadcast namelist variables + call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") + call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") + call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") + call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") + call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") + call mpi_bcast(clubb_expldiff, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_expldiff") + call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") + call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") + call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") + + call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") + call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") + call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") + call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") + call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") + call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") + call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") + call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") + call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") + call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") + call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") + call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") + call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") + call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") + call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") + call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") + call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") + call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") + call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") + call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") + call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") + call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") + call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") + call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") + call mpi_bcast(clubb_l_use_ice_latent, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_ice_latent") + call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") + call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") + + call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") + call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") + call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") + call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") + call mpi_bcast(clubb_up2_vp2_factor, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_vp2_factor") + + call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") + call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") + call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") + call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") + call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") + call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") + call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") + call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") + call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") + call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") + call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") + call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") + call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") + call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") + call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") + call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") + call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") + + ! Overwrite defaults if they are true + if (clubb_history) l_stats = .true. + if (clubb_rad_history) l_output_rad_files = .true. + if (clubb_cloudtop_cooling) do_cldcool = .true. + if (clubb_rainevap_turb) do_rainturb = .true. + if (clubb_expldiff) do_expldiff = .true. + +! Check that all namelists have been set + if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") + if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") + + if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") + if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") + if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") + if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") + if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") + if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") + if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") + if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") + if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") + if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") + if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") + if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") + if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") + if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") + if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") + if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") + if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") + if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") + if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") + if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") + if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") + if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") + if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") + if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") + if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") + if(clubb_up2_vp2_factor == unset_r8) call endrun(sub//": FATAL: clubb_up2_vp2_factor is not set") + if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") + +#endif + end subroutine clubb_readnl + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_ini_cam(pbuf2d) +!------------------------------------------------------------------------------- +! Description: +! Initialize UWM CLUBB. +! Author: Cheryl Craig March 2011 +! Modifications: Pete Bogenschutz 2011 March and onward +! Modifications: K Thayer-Calder 2013 July and onward +! Origin: Based heavily on UWM clubb_init.F90 +! References: +! None +!------------------------------------------------------------------------------- + + + +#ifdef CLUBB_SGS + + ! From CAM libraries + use cam_history, only: addfld, add_default, horiz_only + use ref_pres, only: pref_mid + use hb_diff, only: init_hb_diff + use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx + use cam_abortutils, only: endrun + + ! From the CLUBB libraries + use clubb_api_module, only: core_rknd, & + iC11, iC11b, ibeta, iSkw_denom_coef, & ! Constant(s) + em_min, & + iC1, iC1b, iC2rt, iC2thl, iC2rtthl, igamma_coef, igamma_coefb, & + imult_coef, ic_K10, iskw_max_mag, & + iC8, iC8b, iC11, iC11b, iC4, iC14, iup2_vp2_factor, params_list + + + + use clubb_api_module, only: & + print_clubb_config_flags_api, & + setup_clubb_core_api, & + init_pdf_params_api, & + init_pdf_implicit_coefs_terms_api, & + time_precision, & + core_rknd, & + set_clubb_debug_level_api, & + clubb_fatal_error, & ! Error code value to indicate a fatal error + nparams, & + read_parameters_api, & + l_stats, & + l_stats_samp, & + l_grads, & + stats_zt, & + stats_zm, & + stats_sfc, & + stats_rad_zt, & + stats_rad_zm, & + w_tol_sqd, & + rt_tol, & + thl_tol + + ! These are only needed if we're using a passive scalar + use clubb_api_module, only: & + iisclr_rt, & + iisclr_thl, & + iisclr_CO2, & + iiedsclr_rt, & + iiedsclr_thl, & + iiedsclr_CO2 + + ! These are needed to set parameters + use clubb_api_module, only: & + ilambda0_stability_coef, ic_K10, ic_K10h, iC2rtthl, iC7, iC7b, iC8, iC8b, iC11, iC11b, & + iC14, igamma_coef, imult_coef, ilmin_coef, iSkw_denom_coef, ibeta, iskw_max_mag, & + iC2rt, iC2thl, iC2rtthl, ic_K9, inu9, iC_wp2_splat + + use time_manager, only: is_first_step + use clubb_api_module, only: hydromet_dim + use constituents, only: cnst_get_ind + use phys_control, only: phys_getopts + use spmd_utils, only: iam + use cam_logfile, only: iulog +#endif + + use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc + implicit none + ! Input Variables + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + +#ifdef CLUBB_SGS + + real(kind=time_precision) :: dum1, dum2, dum3 + + real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) + + ! The similar name to clubb_history is unfortunate... + logical :: history_amwg, history_clubb + + integer :: cld_macmic_num_steps + + integer :: err_code ! Code for when CLUBB fails + integer :: j, k, l ! Indices + integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) + integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) + integer :: nmodes, nspec, m + integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice + integer :: lptr + + logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. + logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. + + real(r8) :: zt_g(pverp+1-top_lev) ! Height dummy array + real(r8) :: zi_g(pverp+1-top_lev) ! Height dummy array + + ! CAM defines zi at the surface to be zero. + real(r8), parameter :: sfc_elevation = 0._r8 + + integer :: nlev + + !----- Begin Code ----- + + nlev = pver + 1 - top_lev + + if (core_rknd /= r8) then + call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') + end if + + ! Allocate PDF parameters across columns and chunks + allocate( & + pdf_params_chnk(pcols,begchunk:endchunk), & + pdf_params_zm_chnk(pcols,begchunk:endchunk), & + pdf_implicit_coefs_terms_chnk(pcols,begchunk:endchunk) ) + + ! Allocate (in the vertical) and zero PDF parameters + do l = begchunk, endchunk, 1 + do j = 1, pcols, 1 + call init_pdf_params_api( pverp+1-top_lev, pdf_params_chnk(j,l) ) + call init_pdf_params_api( pverp+1-top_lev, pdf_params_zm_chnk(j,l) ) + call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, sclr_dim, & + pdf_implicit_coefs_terms_chnk(j,l) ) + enddo ! j = 1, pcols, 1 + enddo ! l = begchunk, endchunk, 1 + + ! ----------------------------------------------------------------- ! + ! Determine how many constituents CLUBB will transport. Note that + ! CLUBB does not transport aerosol consituents. Therefore, need to + ! determine how many aerosols constituents there are and subtract that + ! off of pcnst (the total consituents) + ! ----------------------------------------------------------------- ! + + call phys_getopts(prog_modal_aero_out=prog_modal_aero, & + history_amwg_out=history_amwg, & + history_clubb_out=history_clubb, & + cld_macmic_num_steps_out = cld_macmic_num_steps) + + ! Select variables to apply tendencies back to CAM + + ! Initialize all consituents to true to start + lq(1:pcnst) = .true. + edsclr_dim = pcnst + + call cnst_get_ind('Q',ixq) + call cnst_get_ind('NUMICE',ixnumice) + call cnst_get_ind('NUMLIQ',ixnumliq) + call cnst_get_ind('CLDLIQ',ixcldliq) + call cnst_get_ind('CLDICE',ixcldice) + + if (prog_modal_aero) then + ! Turn off modal aerosols and decrement edsclr_dim accordingly + call rad_cnst_get_info(0, nmodes=nmodes) + + do m = 1, nmodes + call rad_cnst_get_mode_num_idx(m, lptr) + lq(lptr)=.false. + edsclr_dim = edsclr_dim-1 + + call rad_cnst_get_info(0, m, nspec=nspec) + do l = 1, nspec + call rad_cnst_get_mam_mmr_idx(m, l, lptr) + lq(lptr)=.false. + edsclr_dim = edsclr_dim-1 + end do + end do + + ! In addition, if running with MAM, droplet number is transported + ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport + ! tendencies to avoid double counted. Else, we apply tendencies. + lq(ixnumliq) = .false. + edsclr_dim = edsclr_dim-1 + endif + + ! ----------------------------------------------------------------- ! + ! Set the debug level. Level 2 has additional computational expense since + ! it checks the array variables in CLUBB for invalid values. + ! ----------------------------------------------------------------- ! + call set_clubb_debug_level_api( 0 ) + + ! ----------------------------------------------------------------- ! + ! use pbuf_get_fld_idx to get existing physics buffer fields from other + ! physics packages (e.g. tke) + ! ----------------------------------------------------------------- ! + + + ! Defaults + l_stats_samp = .false. + l_grads = .false. + + ! Overwrite defaults if needbe + if (l_stats) l_stats_samp = .true. + + ! Define physics buffers indexes + cld_idx = pbuf_get_index('CLD') ! Cloud fraction + concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover + ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction + alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction + aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction + qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC + qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC + dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction + icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio + sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction + relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance + accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG + prer_evap_idx = pbuf_get_index('PRER_EVAP') + qrl_idx = pbuf_get_index('QRL') + cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') + naai_idx = pbuf_get_index('NAAI') + npccn_idx = pbuf_get_index('NPCCN') + + iisclr_rt = -1 + iisclr_thl = -1 + iisclr_CO2 = -1 + + iiedsclr_rt = -1 + iiedsclr_thl = -1 + iiedsclr_CO2 = -1 + + if (zmconv_microp) then + dlfzm_idx = pbuf_get_index('DLFZM') + difzm_idx = pbuf_get_index('DIFZM') + dnlfzm_idx = pbuf_get_index('DNLFZM') + dnifzm_idx = pbuf_get_index('DNIFZM') + end if + + ! ----------------------------------------------------------------- ! + ! Define number of tracers for CLUBB to diffuse + ! ----------------------------------------------------------------- ! + + if (do_expldiff) then + offset = 2 ! diffuse temperature and moisture explicitly + edsclr_dim = edsclr_dim + offset + endif + + ! ----------------------------------------------------------------- ! + ! Setup CLUBB core + ! ----------------------------------------------------------------- ! + + ! Read in parameters for CLUBB. Just read in default values + call read_parameters_api( -99, "", clubb_params ) + + ! Fill in dummy arrays for height. Note that these are overwrote + ! at every CLUBB step to physical values. + do k=1,nlev+1 + zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage + zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage + enddo + + clubb_params(iC2rtthl) = clubb_C2rtthl + clubb_params(iC8) = clubb_C8 + clubb_params(iC11) = clubb_c11 + clubb_params(iC11b) = clubb_c11b + clubb_params(iC14) = clubb_c14 + clubb_params(ic_K10) = clubb_c_K10 + clubb_params(imult_coef) = clubb_mult_coef + clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef + clubb_params(iC2rt) = clubb_C2rt + clubb_params(iC2thl) = clubb_C2thl + clubb_params(ibeta) = clubb_beta + clubb_params(iC7) = clubb_C7 + clubb_params(iC7b) = clubb_C7b + clubb_params(igamma_coef) = clubb_gamma_coef + clubb_params(ic_K10h) = clubb_c_K10h + clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef + clubb_params(ilmin_coef) = clubb_lmin_coef + clubb_params(iC8b) = clubb_C8b + clubb_params(iskw_max_mag) = clubb_skw_max_mag + clubb_params(iC1) = clubb_C1 + clubb_params(iC1b) = clubb_C1b + clubb_params(igamma_coefb) = clubb_gamma_coefb + clubb_params(iup2_vp2_factor) = clubb_up2_vp2_factor + clubb_params(iC4) = clubb_C4 + clubb_params(ic_K9) = clubb_c_K9 + clubb_params(inu9) = clubb_nu9 + clubb_params(iC_wp2_splat) = clubb_C_wp2_splat + + call init_clubb_config_flags( clubb_config_flags ) ! In/Out + clubb_config_flags%l_use_C7_Richardson = clubb_l_use_C7_Richardson + clubb_config_flags%l_use_C11_Richardson = clubb_l_use_C11_Richardson + clubb_config_flags%l_brunt_vaisala_freq_moist = clubb_l_brunt_vaisala_freq_moist + clubb_config_flags%l_use_thvm_in_bv_freq = clubb_l_use_thvm_in_bv_freq + clubb_config_flags%l_rcm_supersat_adj = clubb_l_rcm_supersat_adj + clubb_config_flags%l_damp_wp3_Skw_squared = clubb_l_damp_wp3_Skw_squared + clubb_config_flags%l_predict_upwp_vpwp = clubb_l_predict_upwp_vpwp + clubb_config_flags%l_min_wp2_from_corr_wx = clubb_l_min_wp2_from_corr_wx + clubb_config_flags%l_min_xp2_from_corr_wx = clubb_l_min_xp2_from_corr_wx + clubb_config_flags%l_upwind_xpyp_ta = clubb_l_upwind_xpyp_ta + clubb_config_flags%l_vert_avg_closure = clubb_l_vert_avg_closure + clubb_config_flags%l_trapezoidal_rule_zt = clubb_l_trapezoidal_rule_zt + clubb_config_flags%l_trapezoidal_rule_zm = clubb_l_trapezoidal_rule_zm + clubb_config_flags%l_call_pdf_closure_twice = clubb_l_call_pdf_closure_twice + clubb_config_flags%l_use_cloud_cover = clubb_l_use_cloud_cover + clubb_config_flags%l_stability_correct_tau_zm = clubb_l_stability_correct_tau_zm + clubb_config_flags%l_do_expldiff_rtm_thlm = do_expldiff + clubb_config_flags%l_Lscale_plume_centered = clubb_l_lscale_plume_centered + clubb_config_flags%l_use_ice_latent = clubb_l_use_ice_latent + clubb_config_flags%l_diag_Lscale_from_tau = clubb_l_diag_Lscale_from_tau + clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em + clubb_config_flags%l_update_pressure = l_update_pressure + + + ! Set up CLUBB core. Note that some of these inputs are overwritten + ! when clubb_tend_cam is called. The reason is that heights can change + ! at each time step, which is why dummy arrays are read in here for heights + ! as they are immediately overwrote. +!$OMP PARALLEL + call setup_clubb_core_api & + ( nlev+1, theta0, ts_nudge, & ! In + hydromet_dim, sclr_dim, & ! In + sclr_tol, edsclr_dim, clubb_params, & ! In + l_host_applies_sfc_fluxes, & ! In + saturation_equation, & ! In + l_input_fields, & + l_implemented, grid_type, zi_g(2), zi_g(1), zi_g(nlev+1),& ! In + zi_g(1:nlev+1), zt_g(1:nlev+1), sfc_elevation, & ! In + clubb_config_flags%l_predict_upwp_vpwp, & ! In + clubb_config_flags%l_use_ice_latent, & ! In + clubb_config_flags%l_prescribed_avg_deltaz, & ! In + clubb_config_flags%l_damp_wp2_using_em, & ! In + clubb_config_flags%l_stability_correct_tau_zm, & ! In + err_code ) + + if ( err_code == clubb_fatal_error ) then + call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') + end if +!$OMP END PARALLEL + + ! Print the list of CLUBB parameters + if ( masterproc ) then + do j = 1, nparams, 1 + write(iulog,*) params_list(j), " = ", clubb_params(j) + enddo + endif + + ! Print configurable CLUBB flags + call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) + + ! ----------------------------------------------------------------- ! + ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! + ! ----------------------------------------------------------------- ! + + ! Initialize eddy diffusivity module + + ntop_eddy = 1 ! if >1, must be <= nbot_molec + nbot_eddy = pver ! currently always pver + + call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) + + ! ----------------------------------------------------------------- ! + ! Add output fields for the history files + ! ----------------------------------------------------------------- ! + + ! These are default CLUBB output. Not the higher order history budgets + call addfld ('RHO_CLUBB', (/ 'ilev' /), 'A', 'kg/m3', 'Air Density') + call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') + call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') + call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') + call addfld ('WP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') + call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') + call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') + call addfld ('WP3_CLUBB', (/ 'ilev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') + call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') + call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') + call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'g^2/kg^2', 'Moisture Variance') + call addfld ('RTP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') + call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') + call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') + call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') + call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') + call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') + call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') + call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') + call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') + call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') + call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') + call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') + call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') + call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') + call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Ice Tendency') + call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') + call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') + call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') + call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') + call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') + call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') + call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') + call addfld ('THETAL', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') + call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') + call addfld ('QT', (/ 'lev' /), 'A', 'kg/kg', 'Total water mixing ratio') + call addfld ('SL', (/ 'lev' /), 'A', 'J/kg', 'Liquid water static energy') + call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') + call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') + call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') + call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') + call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') + call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') + + + call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') + call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') + call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') + + call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') + call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') + call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') + call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') + call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') + + + call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') + call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') + call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') + call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') + + call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') + call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') + call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') + ! ---------------------------------------------------------------------------- ! + ! Below are for detailed analysis of EDMF Scheme ! + ! ---------------------------------------------------------------------------- ! + + if (do_clubb_mf) then + call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) + call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) + call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) + call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) + call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) + call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) + call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) + call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) + call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) + call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) + call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) + call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) + call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) + call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) + call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) + call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thv flux (EDMF)' ) + call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) + call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) + call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) + call addfld ( 'edmf_thflx' , (/ 'ilev' /), 'A', 'K m/s' , 'th flux (EDMF)' ) + call addfld ( 'edmf_qvflx' , (/ 'ilev' /), 'A', 'kg/kg m/s' , 'qv flux (EDMF)' ) + call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) + call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) + call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) + call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) + call addfld ( 'edmf_cloudfrac', (/ 'ilev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') + call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') + call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) + + call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') + call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) + call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) + call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) + call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) + call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) + end if + + call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') + call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') + call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') + call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') + call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') + call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') + call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') + if (do_clubb_mf) then + call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) + end if + + ! Initialize statistics, below are dummy variables + dum1 = 300._r8 + dum2 = 1200._r8 + dum3 = 300._r8 + + if (l_stats) then + + call stats_init_clubb( .true., dum1, dum2, & + nlev+1, nlev+1, nlev+1, dum3 ) + + allocate(out_zt(pcols,pverp,stats_zt%num_output_fields)) + allocate(out_zm(pcols,pverp,stats_zm%num_output_fields)) + allocate(out_sfc(pcols,1,stats_sfc%num_output_fields)) + + allocate(out_radzt(pcols,pverp,stats_rad_zt%num_output_fields)) + allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) + + endif + + ! ----------------------------------------------------------------- ! + ! Make all of this output default, this is not CLUBB history + ! ----------------------------------------------------------------- ! + + if (clubb_do_adv .or. history_clubb) then + call add_default('RHO_CLUBB', 1, ' ') + call add_default('UP2_CLUBB', 1, ' ') + call add_default('VP2_CLUBB', 1, ' ') + call add_default('WP2_CLUBB', 1, ' ') + call add_default('WP2_ZT_CLUBB', 1, ' ') + call add_default('WP3_CLUBB', 1, ' ') + call add_default('UPWP_CLUBB', 1, ' ') + call add_default('VPWP_CLUBB', 1, ' ') + call add_default('WPTHLP_CLUBB', 1, ' ') + call add_default('WPRTP_CLUBB', 1, ' ') + call add_default('RTP2_CLUBB', 1, ' ') + call add_default('RTP2_ZT_CLUBB', 1, ' ') + call add_default('PDFP_RTP2_CLUBB', 1, ' ') + call add_default('THLP2_CLUBB', 1, ' ') + call add_default('THLP2_ZT_CLUBB', 1, ' ') + call add_default('RTPTHLP_CLUBB', 1, ' ') + call add_default('RCM_CLUBB', 1, ' ') + call add_default('WPRCP_CLUBB', 1, ' ') + call add_default('CLOUDFRAC_CLUBB', 1, ' ') + call add_default('RCMINLAYER_CLUBB', 1, ' ') + call add_default('CLOUDCOVER_CLUBB', 1, ' ') + call add_default('WPTHVP_CLUBB', 1, ' ') + call add_default('RVMTEND_CLUBB', 1, ' ') + call add_default('STEND_CLUBB', 1, ' ') + call add_default('RCMTEND_CLUBB', 1, ' ') + call add_default('RIMTEND_CLUBB', 1, ' ') + call add_default('UTEND_CLUBB', 1, ' ') + call add_default('VTEND_CLUBB', 1, ' ') + call add_default('ZT_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') + call add_default('UM_CLUBB', 1, ' ') + call add_default('VM_CLUBB', 1, ' ') + call add_default('WM_ZT_CLUBB', 1, ' ') + call add_default('PBLH', 1, ' ') + call add_default('SL', 1, ' ') + call add_default('QT', 1, ' ') + call add_default('THETAL', 1, ' ') + call add_default('CONCLD', 1, ' ') + call add_default('TKE_CLUBB', 1, ' ') + end if + + if (history_amwg) then + call add_default('PBLH', 1, ' ') + end if + + if (history_clubb) then + + call add_default('RELVAR', 1, ' ') + call add_default('RHO_CLUBB', 1, ' ') + call add_default('UPWP_CLUBB', 1, ' ') + call add_default('VPWP_CLUBB', 1, ' ') + call add_default('RCM_CLUBB', 1, ' ') + call add_default('WPRCP_CLUBB', 1, ' ') + call add_default('CLOUDFRAC_CLUBB', 1, ' ') + call add_default('RCMINLAYER_CLUBB', 1, ' ') + call add_default('CLOUDCOVER_CLUBB', 1, ' ') + call add_default('WPTHVP_CLUBB', 1, ' ') + call add_default('RVMTEND_CLUBB', 1, ' ') + call add_default('STEND_CLUBB', 1, ' ') + call add_default('RCMTEND_CLUBB', 1, ' ') + call add_default('RIMTEND_CLUBB', 1, ' ') + call add_default('UTEND_CLUBB', 1, ' ') + call add_default('VTEND_CLUBB', 1, ' ') + call add_default('ZT_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') + call add_default('UM_CLUBB', 1, ' ') + call add_default('VM_CLUBB', 1, ' ') + call add_default('SL', 1, ' ') + call add_default('QT', 1, ' ') + call add_default('CONCLD', 1, ' ') + + if (do_clubb_mf_diag) then + call add_default( 'edmf_DRY_A' , 1, ' ') + call add_default( 'edmf_MOIST_A' , 1, ' ') + call add_default( 'edmf_DRY_W' , 1, ' ') + call add_default( 'edmf_MOIST_W' , 1, ' ') + call add_default( 'edmf_DRY_QT' , 1, ' ') + call add_default( 'edmf_MOIST_QT' , 1, ' ') + call add_default( 'edmf_DRY_THL' , 1, ' ') + call add_default( 'edmf_MOIST_THL', 1, ' ') + call add_default( 'edmf_DRY_U' , 1, ' ') + call add_default( 'edmf_MOIST_U' , 1, ' ') + call add_default( 'edmf_DRY_V' , 1, ' ') + call add_default( 'edmf_MOIST_V' , 1, ' ') + call add_default( 'edmf_MOIST_QC' , 1, ' ') + call add_default( 'edmf_precc' , 1, ' ') + call add_default( 'edmf_S_AE' , 1, ' ') + call add_default( 'edmf_S_AW' , 1, ' ') + call add_default( 'edmf_S_AWTH' , 1, ' ') + call add_default( 'edmf_S_AWTHL' , 1, ' ') + call add_default( 'edmf_S_AWQT' , 1, ' ') + call add_default( 'edmf_S_AWU' , 1, ' ') + call add_default( 'edmf_S_AWV' , 1, ' ') + call add_default( 'edmf_thlflx' , 1, ' ') + call add_default( 'edmf_thvflx' , 1, ' ') + call add_default( 'edmf_qtflx' , 1, ' ') + call add_default( 'edmf_thlforc' , 1, ' ') + call add_default( 'edmf_qtforc' , 1, ' ') + call add_default( 'edmf_thflx' , 1, ' ') + call add_default( 'edmf_qvflx' , 1, ' ') + call add_default( 'edmf_thforc' , 1, ' ') + call add_default( 'edmf_qvforc' , 1, ' ') + call add_default( 'edmf_qcforc' , 1, ' ') + call add_default( 'edmf_rcm' , 1, ' ') + call add_default( 'edmf_cloudfrac', 1, ' ') + call add_default( 'edmf_ztop' , 1, ' ') + call add_default( 'edmf_L0' , 1, ' ') + call add_default( 'edmf_cape' , 1, ' ') + end if + + call add_default( 'QT_macmic' , 1, ' ') + call add_default( 'THETAL_macmic' , 1, ' ') + call add_default( 'RCM_CLUBB_macmic' , 1, ' ') + call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') + call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') + if (do_clubb_mf_diag) then + call add_default( 'edmf_thlflx_macmic' , 1, ' ') + call add_default( 'edmf_qtflx_macmic' , 1, ' ') + call add_default( 'edmf_thvflx_macmic' , 1, ' ') + end if + + end if + + if (history_amwg) then + call add_default('PBLH', 1, ' ') + end if + + if (history_budget) then + call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') + call add_default('DPDLFICE', history_budget_histfile_num, ' ') + call add_default('DPDLFT', history_budget_histfile_num, ' ') + call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') + endif + + + ! --------------- ! + ! First step? ! + ! Initialization ! + ! --------------- ! + + ! Is this the first time step? If so then initialize CLUBB variables as follows + if (is_first_step()) then + + call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) + call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) + call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) + call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) + call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) + + call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) + + call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) + call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) + + ! Initialize SILHS covariance contributions + call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) + endif + + ! The following is physpkg, so it needs to be initialized every time + call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) + + ! --------------- ! + ! End ! + ! Initialization ! + ! --------------- ! + +#endif + end subroutine clubb_ini_cam + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_tend_cam( & + state, ptend_all, pbuf, hdtime, & + cmfmc, cam_in, & + macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) + +!------------------------------------------------------------------------------- +! Description: Provide tendencies of shallow convection, turbulence, and +! macrophysics from CLUBB to CAM +! +! Author: Cheryl Craig, March 2011 +! Modifications: Pete Bogenschutz, March 2011 and onward +! Origin: Based heavily on UWM clubb_init.F90 +! References: +! None +!------------------------------------------------------------------------------- + + use physics_types, only: physics_state, physics_ptend, & + physics_state_copy, physics_ptend_init, & + physics_ptend_sum, physics_update, set_dry_to_wet + use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc + + use constituents, only: cnst_get_ind, cnst_type + use camsrfexch, only: cam_in_t + use time_manager, only: is_first_step + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use tropopause, only: tropopause_findChemTrop + use time_manager, only: get_nstep + +#ifdef CLUBB_SGS + use hb_diff, only: pblintd + use scamMOD, only: single_column,scm_clubb_iop_name + use clubb_api_module, only: & + nparams, & + read_parameters_api, & + setup_parameters_api, & + time_precision, & + advance_clubb_core_api, & + zt2zm_api, zm2zt_api, & + setup_grid_heights_api, & + em_min, & + w_tol_sqd, & + rt_tol, & + thl_tol, & + l_stats, & + stats_tsamp, & + stats_tout, & + stats_zt, & + stats_sfc, & + stats_zm, & + stats_rad_zt, & + stats_rad_zm, & + l_output_rad_files, & + stats_begin_timestep_api, & + hydromet_dim, calculate_thlp2_rad_api, mu, update_xp2_mc_api, & + sat_mixrat_liq_api, & + fstderr + + use clubb_api_module, only: & + clubb_fatal_error ! Error code value to indicate a fatal error + + use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const + use cam_history, only: outfld + + use macrop_driver, only: liquid_macro_tend + use clubb_mf, only: integrate_mf + +#endif + + implicit none + + ! --------------- ! + ! Input Auguments ! + ! --------------- ! + + type(physics_state), intent(in) :: state ! Physics state variables [vary] + type(cam_in_t), intent(in) :: cam_in + real(r8), intent(in) :: hdtime ! Host model timestep [s] + real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] + real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] + integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations + integer, intent(in) :: macmic_it ! number of mac-mic iterations + + ! ---------------------- ! + ! Input-Output Auguments ! + ! ---------------------- ! + + type(physics_buffer_desc), pointer :: pbuf(:) + + ! ---------------------- ! + ! Output Auguments ! + ! ---------------------- ! + + type(physics_ptend), intent(out) :: ptend_all ! package tendencies + + ! These two variables are needed for energy check + real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice + real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check + + + ! --------------- ! + ! Local Variables ! + ! --------------- ! + +#ifdef CLUBB_SGS + + type(physics_state) :: state1 ! Local copy of state variable + type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all + + integer :: i, j, k, t, ixind, nadv + integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq + integer :: itim_old + integer :: ncol, lchnk ! # of columns, and chunk identifier + integer :: err_code ! Diagnostic, for if some calculation goes amiss. + integer :: icnt, clubbtop + logical :: lq2(pcnst) + + integer :: iter + + real(r8) :: frac_limit, ic_limit + + real(r8) :: dtime ! CLUBB time step [s] + real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] + real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] + real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] + real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] + real(r8) :: tke_in(pverp+1-top_lev) ! TKE + real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] + real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] + real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] + real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] + real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] + real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] + real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] + real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] + real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] + real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] + real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] + real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] + real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] + real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] + real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] + real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] + real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] + real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] + real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] + real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] + real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] + real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] + real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation + real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap + real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap + real(r8) :: wprtp_mc_out(pverp+1-top_lev) + real(r8) :: wpthlp_mc_out(pverp+1-top_lev) + real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) + real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] + real(r8) :: rcm_out_zm(pverp+1-top_lev) + real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] + real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] + real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] + real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] + real(r8) :: thlprcp_out(pverp+1-top_lev) + real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] + real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] + real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] + real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] + real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] + real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] + real(r8) :: rfrzm(pverp+1-top_lev) + real(r8) :: radf(pverp+1-top_lev) + real(r8) :: wprtp_forcing(pverp+1-top_lev) + real(r8) :: wpthlp_forcing(pverp+1-top_lev) + real(r8) :: rtp2_forcing(pverp+1-top_lev) + real(r8) :: thlp2_forcing(pverp+1-top_lev) + real(r8) :: rtpthlp_forcing(pverp+1-top_lev) + real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) + real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] + real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] + real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] + real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] + real(r8) :: fcor ! Coriolis forcing [s^-1] + real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] + real(r8) :: ubar ! surface wind [m/s] + real(r8) :: ustar ! surface stress [m/s] + real(r8) :: z0 ! roughness height [m] + real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] + real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] + real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] + real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] + real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] + real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] + real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] + real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] + real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] + real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] + real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] + real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] + real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] + real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] + real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] + real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] + real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] + real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] + real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] + real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] + real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] + real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] + real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] + real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] + real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] + real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) + real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) + real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) + real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) + real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) + real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] + real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] + real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] + real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] + real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] + real(r8) :: zo ! roughness height [m] + real(r8) :: dz_g(pver) ! thickness of layer [m] + real(r8) :: relvarmax + real(r8) :: se_upper_a, se_upper_b, se_upper_diss + real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss + real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] + real(r8) :: host_dx, host_dy ! CAM grid [m] + + ! Variables below are needed to compute energy integrals for conservation + real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) + real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) + real(r8) :: se_dis, se_a(pcols), se_b(pcols), clubb_s(pver) + + real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] + real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] + real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] + real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] + real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] + real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] + real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] + real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] + real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] + real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] + real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] + real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] + real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] + real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] + real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] + real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] + real(r8) :: rvm(pcols,pverp) + real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] + real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs + real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] + real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] + real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs + real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] + real(r8) :: wp2_zt_out(pcols, pverp) + real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] + real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] + real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] + real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] + real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] + real(r8) :: eps ! Rv/Rd [-] + real(r8) :: dum1 ! dummy variable [units vary] + real(r8) :: obklen(pcols) ! Obukov length [m] + real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] + real(r8) :: th(pcols,pver) ! potential temperature [K] + real(r8) :: dummy2(pcols) ! dummy variable [units vary] + real(r8) :: dummy3(pcols) ! dummy variable [units vary] + real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] + real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] + real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] + real(r8) :: latsub + real(r8) :: qrl_clubb(pverp+1-top_lev) + real(r8) :: qrl_zm(pverp+1-top_lev) + real(r8) :: thlp2_rad_out(pverp+1-top_lev) + real(r8) :: apply_const, rtm_test + + real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) + real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] + + character(len=200) :: temp1, sub ! Strings needed for CLUBB output + real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] + integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] + + real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend + + ! --------------- ! + ! Pointers ! + ! --------------- ! + + real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] + real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] + real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] + real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] + real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] + real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] + real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] + real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] + real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] + real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] + real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] + real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] + real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] + real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] + real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] + real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] + real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] + real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] + real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] + real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS + real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] + real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] + real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] + real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] + real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] + real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] + real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] + real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] + real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] + real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] + real(r8), pointer, dimension(:,:) :: naai + real(r8), pointer, dimension(:,:) :: cmeliq + real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] + + real(r8), pointer, dimension(:,:) :: qsatfac + real(r8), pointer, dimension(:,:) :: npccn + real(r8), pointer, dimension(:,:) :: prer_evap + real(r8), pointer, dimension(:,:) :: qrl + real(r8), pointer, dimension(:,:) :: radf_clubb + + ! SILHS covariance contributions + real(r8), pointer, dimension(:,:) :: rtp2_mc_zt + real(r8), pointer, dimension(:,:) :: thlp2_mc_zt + real(r8), pointer, dimension(:,:) :: wprtp_mc_zt + real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt + real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt + + real(r8) qitend(pcols,pver) + real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation + + ! ZM microphysics + real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. + real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. + real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. + real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. + + real(r8), pointer :: qt_macmic(:,:) + real(r8), pointer :: thl_macmic(:,:) + real(r8), pointer :: rcm_macmic(:,:) + real(r8), pointer :: cldfrac_macmic(:,:) + real(r8), pointer :: wpthlp_macmic(:,:) + real(r8), pointer :: wprtp_macmic(:,:) + real(r8), pointer :: wpthvp_macmic(:,:) + real(r8), pointer :: mf_thlflx_macmic(:,:) + real(r8), pointer :: mf_qtflx_macmic(:,:) + real(r8), pointer :: mf_thvflx_macmic(:,:) + + real(r8) :: stend(pcols,pver) + real(r8) :: qvtend(pcols,pver) + real(r8) :: qctend(pcols,pver) + real(r8) :: inctend(pcols,pver) + real(r8) :: fqtend(pcols,pver) + real(r8) :: rhmini(pcols) + real(r8) :: rhmaxi(pcols) + integer :: troplev(pcols) + logical :: lqice(pcnst) + logical :: apply_to_surface + + ! MF outputs to outfld + real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & + mf_dry_w_output, mf_moist_w_output, & + mf_dry_qt_output, mf_moist_qt_output, & + mf_dry_thl_output, mf_moist_thl_output, & + mf_dry_u_output, mf_moist_u_output, & + mf_dry_v_output, mf_moist_v_output, & + mf_moist_qc_output, & + s_ae_output, s_aw_output, & + s_awthl_output, s_awqt_output, & + s_awql_output, s_awqi_output, & + s_awth_output, s_awqv_output, & + s_awu_output, s_awv_output, & + mf_thflx_output, mf_qvflx_output, & + mf_thlflx_output, mf_qtflx_output, & + mf_thvflx_output, & + mf_rcm_output, mf_cloudfrac_output, & + mf_precc_output + ! + real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & + mf_cape_output + ! + ! MF outputs to outfld + real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid + mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid + mf_qcforc_output ! thermodynamic grid + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & + mf_upw_flip, & + mf_upqt_flip, & + mf_upthl_flip, & + mf_upthv_flip, & + mf_upth_flip, & + mf_upqc_flip, & + mf_upbuoy_flip, & + mf_upent_flip + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & + mf_upw_output, & + mf_upqt_output, & + mf_upthl_output, & + mf_upthv_output, & + mf_upth_output, & + mf_upqc_output, & + mf_upent_output + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output + + ! MF Plume + real(r8), pointer :: tpert(:) + real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & + mf_dry_w, mf_moist_w, & + mf_dry_qt, mf_moist_qt, & + mf_dry_thl, mf_moist_thl, & + mf_dry_u, mf_moist_u, & + mf_dry_v, mf_moist_v, & + mf_moist_qc, & + mf_precc, & + s_ae, s_aw, & + s_awthl, s_awqt, & + s_awql, s_awqi, & + s_awth, s_awqv, & + s_awu, s_awv, & + mf_thflx, mf_qvflx, & + mf_thlflx, mf_qtflx, & + mf_thvflx, mf_qcflx, & + mf_thforc, mf_qvforc, & + mf_qcforc, & + mf_rcm, mf_cloudfrac + ! MF plume level + real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & + mf_upw, & + mf_upqt, & + mf_upthl, & + mf_upthv, & + mf_upth, & + mf_upqc, & + mf_upbuoy, & + mf_upent + ! CFL limiter vars + real(r8), dimension(pcols) :: max_cfl + real(r8) :: cflval, cflfac + logical :: cfllim + + ! MF local vars + real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid + dzt, invrs_dzt, & ! thermodynamic grid + invrs_exner_zt,& ! thermodynamic grid + kappa_zt, qc_zt, & ! thermodynamic grid + th_zt, qv_zt, & ! momentum grid + th_zm, qv_zm, & ! momentum grid + qc_zm, & ! momentum grid + kappa_zm, p_in_Pa_zm, & ! momentum grid + dzm, invrs_exner_zm ! momentum grid + + real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs + + + integer :: nlev + + intrinsic :: max + + character(len=*), parameter :: subr='clubb_tend_cam' + +#endif + det_s(:) = 0.0_r8 + det_ice(:) = 0.0_r8 +#ifdef CLUBB_SGS + + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + ! MAIN COMPUTATION BEGINS HERE ! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + + nlev = pver + 1 - top_lev + + rtp2_zt_out = 0._r8 + thl2_zt_out = 0._r8 + wp2_zt_out = 0._r8 + pdfp_rtp2 = 0._r8 + wm_zt_out = 0._r8 + + frac_limit = 0.01_r8 + ic_limit = 1.e-12_r8 + + if (clubb_do_adv) then + apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected + else + apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected + endif + + ! Get indicees for cloud and ice mass and cloud and ice number + + call cnst_get_ind('Q',ixq) + call cnst_get_ind('CLDLIQ',ixcldliq) + call cnst_get_ind('CLDICE',ixcldice) + call cnst_get_ind('NUMLIQ',ixnumliq) + call cnst_get_ind('NUMICE',ixnumice) + + if (clubb_do_icesuper) then + call pbuf_get_field(pbuf, naai_idx, naai) + end if + + ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine + call physics_ptend_init(ptend_all, state%psetcols, 'clubb') + + ! Copy the state to state1 array to use in this routine + call physics_state_copy(state, state1) + + ! constituents are all treated as wet mmr by clubb + call set_dry_to_wet(state1) + + if (clubb_do_liqsupersat) then + call pbuf_get_field(pbuf, npccn_idx, npccn) + endif + + ! Determine number of columns and which chunk computation is to be performed on + + ncol = state%ncol + lchnk = state%lchnk + + ! Determine time step of physics buffer + itim_old = pbuf_old_tim_idx() + + ! Establish associations between pointers and physics buffer fields + + call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) + call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) + call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) + call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) + call pbuf_get_field(pbuf, rcm_idx, rcm) + call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) + call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, tke_idx, tke) + call pbuf_get_field(pbuf, qrl_idx, qrl) + call pbuf_get_field(pbuf, radf_idx, radf_clubb) + + call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + + call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) + + call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) + call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) + call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) + call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) + call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) + call pbuf_get_field(pbuf, relvar_idx, relvar) + call pbuf_get_field(pbuf, dp_frac_idx, deepcu) + call pbuf_get_field(pbuf, sh_frac_idx, shalcu) + call pbuf_get_field(pbuf, kvh_idx, khzm) + call pbuf_get_field(pbuf, pblh_idx, pblh) + call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) + call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) + + ! SILHS covariance contributions + call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) + call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) + call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) + call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) + call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) + + call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) + call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) + call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) + call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) + call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) + call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) + call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) + if (do_clubb_mf) then + call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) + call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) + call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) + call pbuf_get_field(pbuf, tpert_idx, tpert) + end if + + ! Initialize the apply_const variable (note special logic is due to eularian backstepping) + if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then + apply_const = 0._r8 ! On first time through do not remove constant + ! from moments since it has not been added yet + endif + + ! Set the ztodt timestep in pbuf for SILHS + ztodtptr(:) = 1.0_r8*hdtime + + ! Define the grid box size. CLUBB needs this information to determine what + ! the maximum length scale should be. This depends on the column for + ! variable mesh grids and lat-lon grids + if (single_column) then + ! If single column specify grid box size to be something + ! similar to a GCM run + grid_dx(:) = 100000._r8 + grid_dy(:) = 100000._r8 + else + + call grid_size(state1, grid_dx, grid_dy) + + end if + + if (clubb_do_icesuper) then + + ! -------------------------------------- ! + ! Ice Saturation Adjustment Computation ! + ! -------------------------------------- ! + + lq2(:) = .FALSE. + lq2(1) = .TRUE. + lq2(ixcldice) = .TRUE. + lq2(ixnumice) = .TRUE. + + latsub = latvap + latice + + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) + + stend(:ncol,:)=0._r8 + qvtend(:ncol,:)=0._r8 + qitend(:ncol,:)=0._r8 + initend(:ncol,:)=0._r8 + + call ice_macro_tend(naai(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & + state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,1),state1%q(:ncol,top_lev:pver,ixcldice),& + state1%q(:ncol,top_lev:pver,ixnumice),latsub,hdtime,& + stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qitend(:ncol,top_lev:pver),& + initend(:ncol,top_lev:pver)) + + ! update local copy of state with the tendencies + ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) + ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) + + ! Add the ice tendency to the output tendency + call physics_ptend_sum(ptend_loc, ptend_all, ncol) + + ! ptend_loc is reset to zero by this call + call physics_update(state1, ptend_loc, hdtime) + + !Write output for tendencies: + temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) + call outfld( 'TTENDICE', temp2d, pcols, lchnk ) + call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) + call outfld( 'QITENDICE', qitend, pcols, lchnk ) + call outfld( 'NITENDICE', initend, pcols, lchnk ) + + endif + + + ! Determine CLUBB time step and make it sub-step friendly + ! For now we want CLUBB time step to be 5 min since that is + ! what has been scientifically validated. However, there are certain + ! instances when a 5 min time step will not be possible (based on + ! host model time step or on macro-micro sub-stepping + + dtime = clubb_timestep + + ! Now check to see if dtime is greater than the host model + ! (or sub stepped) time step. If it is, then simply + ! set it equal to the host (or sub step) time step. + ! This section is mostly to deal with small host model + ! time steps (or small sub-steps) + + if (dtime > hdtime) then + dtime = hdtime + endif + + ! Now check to see if CLUBB time step divides evenly into + ! the host model time step. If not, force it to divide evenly. + ! We also want it to be 5 minutes or less. This section is + ! mainly for host model time steps that are not evenly divisible + ! by 5 minutes + + if (mod(hdtime,dtime) .ne. 0) then + dtime = hdtime/2._r8 + do while (dtime > clubb_timestep) + dtime = dtime/2._r8 + end do + endif + + ! If resulting host model time step and CLUBB time step do not divide evenly + ! into each other, have model throw a fit. + + if (mod(hdtime,dtime) .ne. 0) then + call endrun(subr//': CLUBB time step and HOST time step NOT compatible') + endif + + ! determine number of timesteps CLUBB core should be advanced, + ! host time step divided by CLUBB time step + nadv = max(hdtime/dtime,1._r8) + + ! Initialize forcings for transported scalars to zero + + sclrm_forcing(:,:) = 0._r8 + edsclrm_forcing(:,:) = 0._r8 + sclrm(:,:) = 0._r8 + + ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant + ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent + ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables + ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state + + do k=1,pver + do i=1,ncol + inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) + enddo + enddo + + ! At each CLUBB call, initialize mean momentum and thermo CLUBB state + ! from the CAM state + + do k=1,pver ! loop over levels + do i=1,ncol ! loop over columns + + rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) + rvm(i,k) = state1%q(i,k,ixq) + um(i,k) = state1%u(i,k) + vm(i,k) = state1%v(i,k) + thlm(i,k) = ( state1%t(i,k) & + - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & + * inv_exner_clubb(i,k) + + if (clubb_do_adv) then + if (macmic_it == 1) then + + ! Note that some of the moments below can be positive or negative. + ! Remove a constant that was added to prevent dynamics from clipping + ! them to prevent dynamics from making them positive. + thlp2(i,k) = state1%q(i,k,ixthlp2) + rtp2(i,k) = state1%q(i,k,ixrtp2) + rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) + wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) + wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) + wp2(i,k) = state1%q(i,k,ixwp2) + wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) + up2(i,k) = state1%q(i,k,ixup2) + vp2(i,k) = state1%q(i,k,ixvp2) + endif + endif + + enddo + enddo + + if (clubb_do_adv) then + ! If not last step of macmic loop then set apply_const back to + ! zero to prevent output from being corrupted. + if (macmic_it == cld_macmic_num_steps) then + apply_const = 1._r8 + else + apply_const = 0._r8 + endif + endif + + rtm(1:ncol,pverp) = rtm(1:ncol,pver) + um(1:ncol,pverp) = state1%u(1:ncol,pver) + vm(1:ncol,pverp) = state1%v(1:ncol,pver) + thlm(1:ncol,pverp) = thlm(1:ncol,pver) + + if (clubb_do_adv) then + thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) + rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) + rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) + wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) + wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) + wp2(1:ncol,pverp)=wp2(1:ncol,pver) + wp3(1:ncol,pverp)=wp3(1:ncol,pver) + up2(1:ncol,pverp)=up2(1:ncol,pver) + vp2(1:ncol,pverp)=vp2(1:ncol,pver) + endif + + ! Compute virtual potential temperature, which is needed for CLUBB + do k=1,pver + do i=1,ncol + thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& + -state1%q(i,k,ixcldliq)) + enddo + enddo + + call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) + + call tropopause_findChemTrop(state, troplev) + + ! Initialize EDMF outputs + mf_dry_a_output(:,:) = 0._r8 + mf_moist_a_output(:,:) = 0._r8 + mf_dry_w_output(:,:) = 0._r8 + mf_moist_w_output(:,:) = 0._r8 + mf_dry_qt_output(:,:) = 0._r8 + mf_moist_qt_output(:,:) = 0._r8 + mf_dry_thl_output(:,:) = 0._r8 + mf_moist_thl_output(:,:) = 0._r8 + mf_dry_u_output(:,:) = 0._r8 + mf_moist_u_output(:,:) = 0._r8 + mf_dry_v_output(:,:) = 0._r8 + mf_moist_v_output(:,:) = 0._r8 + mf_moist_qc_output(:,:) = 0._r8 + mf_precc_output(:,:) = 0._r8 + s_ae_output(:,:) = 0._r8 + s_aw_output(:,:) = 0._r8 + s_awthl_output(:,:) = 0._r8 + s_awqt_output(:,:) = 0._r8 + s_awql_output(:,:) = 0._r8 + s_awqi_output(:,:) = 0._r8 + s_awth_output(:,:) = 0._r8 + s_awqv_output(:,:) = 0._r8 + s_awu_output(:,:) = 0._r8 + s_awv_output(:,:) = 0._r8 + mf_upa_output(:,:) = 0._r8 + mf_upw_output(:,:) = 0._r8 + mf_upqt_output(:,:) = 0._r8 + mf_upthl_output(:,:) = 0._r8 + mf_upthv_output(:,:) = 0._r8 + mf_upth_output(:,:) = 0._r8 + mf_upqc_output(:,:) = 0._r8 + mf_upbuoy_output(:,:) = 0._r8 + mf_upent_output(:,:) = 0._r8 + mf_upa_flip(:,:,:) = 0._r8 + mf_upw_flip(:,:,:) = 0._r8 + mf_upqt_flip(:,:,:) = 0._r8 + mf_upthl_flip(:,:,:) = 0._r8 + mf_upthv_flip(:,:,:) = 0._r8 + mf_upth_flip(:,:,:) = 0._r8 + mf_upqc_flip(:,:,:) = 0._r8 + mf_upbuoy_flip(:,:,:) = 0._r8 + mf_upent_flip(:,:,:) = 0._r8 + mf_thlflx_output(:,:) = 0._r8 + mf_thvflx_output(:,:) = 0._r8 + mf_qtflx_output(:,:) = 0._r8 + mf_thflx_output(:,:) = 0._r8 + mf_qvflx_output(:,:) = 0._r8 + mf_thlforc_output(:,:) = 0._r8 + mf_qtforc_output(:,:) = 0._r8 + mf_thforc_output(:,:) = 0._r8 + mf_qvforc_output(:,:) = 0._r8 + mf_qcforc_output(:,:) = 0._r8 + mf_rcm_output(:,:) = 0._r8 + mf_cloudfrac_output(:,:) = 0._r8 + mf_ztop_output(:) = 0._r8 + mf_L0_output(:) = 0._r8 + mf_cape_output(:) = 0._r8 + + ! Loop over all columns in lchnk to advance CLUBB core + do i=1,ncol ! loop over columns + + ! Determine Coriolis force at given latitude. This is never used + ! when CLUBB is implemented in a host model, therefore just set + ! to zero. + fcor = 0._r8 + + ! Define the CLUBB momentum grid (in height, units of m) + do k=1,nlev+1 + zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) + enddo + + ! Define the CLUBB thermodynamic grid (in units of m) + do k=1,nlev + zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) + end do + + do k=1,pver + dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness + enddo + + ! Thermodynamic ghost point is below surface + zt_g(1) = -1._r8*zt_g(2) + + ! Set the elevation of the surface + sfc_elevation = state1%zi(i,pver+1) + + ! Set the grid size + host_dx = grid_dx(i) + host_dy = grid_dy(i) + + ! Compute thermodynamic stuff needed for CLUBB on thermo levels. + ! Inputs for the momentum levels are set below setup_clubb core + do k=1,nlev + p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile + exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) + rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) + invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo + rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo + thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo + th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) + qv_zt(k+1) = state1%q(i,pver-k+1,ixq) + rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) + radf(k+1) = radf_clubb(i,pver-k+1) + qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) + enddo + + ! Below computes the same stuff for the ghost point. May or may + ! not be needed, just to be safe to avoid NaN's + rho_ds_zt(1) = rho_ds_zt(2) + invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) + rho_in(1) = rho_ds_zt(2) + thv_ds_zt(1) = thv_ds_zt(2) + rho_zt(:) = rho_in(:) + p_in_Pa(1) = p_in_Pa(2) + exner(1) = exner(2) + rfrzm(1) = rfrzm(2) + radf(1) = radf(2) + qrl_clubb(1) = qrl_clubb(2) + th_zt(1) = th_zt(2) + qv_zt(1) = qv_zt(2) + + ! Compute mean w wind on thermo grid, convert from omega to w + wm_zt(1) = 0._r8 + do k=1,nlev + wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) + enddo + + ! ------------------------------------------------- ! + ! Begin case specific code for SCAM cases. ! + ! This section of code block NOT called in ! + ! global simulations ! + ! ------------------------------------------------- ! + + if (single_column) then + + ! Initialize zo if variable ustar is used + + if (cam_in%landfrac(i) >= 0.5_r8) then + zo = 0.035_r8 + else + zo = 0.0001_r8 + endif + + ! Compute surface wind (ubar) + ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) + if (ubar < 0.25_r8) ubar = 0.25_r8 + + ! Below denotes case specifics for surface momentum + ! and thermodynamic fluxes, depending on the case + + ! Define ustar (based on case, if not variable) + ustar = 0.25_r8 ! Initialize ustar in case no case + + if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then + ustar = 0.30_r8 + endif + + if(trim(scm_clubb_iop_name) == 'RICO_3day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & + trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & + trim(scm_clubb_iop_name) == 'ARM_CC') then + + bflx22 = (gravit/theta0)*wpthlp_sfc + ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) + endif + + ! Compute the surface momentum fluxes, if this is a SCAM simulation + upwp_sfc = -um(i,pver)*ustar**2/ubar + vpwp_sfc = -vm(i,pver)*ustar**2/ubar + + endif + + ! Define surface sources for transported variables for diffusion, will + ! be zero as these tendencies are done in vertical_diffusion + do ixind=1,edsclr_dim + wpedsclrp_sfc(ixind) = 0._r8 + enddo + + ! Set stats output and increment equal to CLUBB and host dt + stats_tsamp = dtime + stats_tout = hdtime + + ! Heights need to be set at each timestep. Therefore, recall + ! setup_grid and setup_parameters for this. + + ! Read in parameters for CLUBB. Just read in default values + call read_parameters_api( -99, "", clubb_params ) + + ! Set-up CLUBB core at each CLUBB call because heights can change + ! Important note: do not make any calls that use CLUBB grid-height + ! operators (such as zt2zm_api, etc.) until AFTER the + ! call to setup_grid_heights_api. + call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & + zi_g(1), zi_g, zt_g) + + call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & + zi_g, zt_g, & + clubb_config_flags%l_prescribed_avg_deltaz, & + err_code ) + + ! Define forcings from CAM to CLUBB as zero for momentum and thermo, + ! forcings already applied through CAM + thlm_forcing = 0._r8 + rtm_forcing = 0._r8 + um_forcing = 0._r8 + vm_forcing = 0._r8 + + wprtp_forcing = 0._r8 + wpthlp_forcing = 0._r8 + rtp2_forcing = 0._r8 + thlp2_forcing = 0._r8 + rtpthlp_forcing = 0._r8 + + ice_supersat_frac_out = 0._r8 + + ! Add forcings for SILHS covariance contributions + rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) + thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) + wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) + wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) + rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) + + ! Zero out SILHS covariance contribution terms + rtp2_mc_zt(i,:) = 0.0_r8 + thlp2_mc_zt(i,:) = 0.0_r8 + wprtp_mc_zt(i,:) = 0.0_r8 + wpthlp_mc_zt(i,:) = 0.0_r8 + rtpthlp_mc_zt(i,:) = 0.0_r8 + + ! Compute some inputs from the thermodynamic grid + ! to the momentum grid + rho_ds_zm = zt2zm_api(rho_ds_zt) + rho_zm = zt2zm_api(rho_zt) + invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) + thv_ds_zm = zt2zm_api(thv_ds_zt) + wm_zm = zt2zm_api(wm_zt) + + ! Surface fluxes provided by host model + wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux + wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) + upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux + vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux + + ! Need to flip arrays around for CLUBB core + do k=1,nlev+1 + um_in(k) = um(i,pverp-k+1) + vm_in(k) = vm(i,pverp-k+1) + upwp_in(k) = upwp(i,pverp-k+1) + vpwp_in(k) = vpwp(i,pverp-k+1) + wpthvp_in(k) = wpthvp(i,pverp-k+1) + wp2thvp_in(k) = wp2thvp(i,pverp-k+1) + rtpthvp_in(k) = rtpthvp(i,pverp-k+1) + thlpthvp_in(k)= thlpthvp(i,pverp-k+1) + up2_in(k) = up2(i,pverp-k+1) + vp2_in(k) = vp2(i,pverp-k+1) + up3_in(k) = up3(i,pverp-k+1) + vp3_in(k) = vp3(i,pverp-k+1) + wp2_in(k) = wp2(i,pverp-k+1) + wp3_in(k) = wp3(i,pverp-k+1) + rtp2_in(k) = rtp2(i,pverp-k+1) + thlp2_in(k) = thlp2(i,pverp-k+1) + rtp3_in(k) = rtp3(i,pverp-k+1) + thlp3_in(k) = thlp3(i,pverp-k+1) + thlm_in(k) = thlm(i,pverp-k+1) + rtm_in(k) = rtm(i,pverp-k+1) + rvm_in(k) = rvm(i,pverp-k+1) + wprtp_in(k) = wprtp(i,pverp-k+1) + wpthlp_in(k) = wpthlp(i,pverp-k+1) + tke_in(k) = tke(i,pverp-k+1) + rtpthlp_in(k) = rtpthlp(i,pverp-k+1) + rcm_inout(k) = rcm(i,pverp-k+1) + cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) + sclrpthvp_inout(k,:) = 0._r8 + + if (k .ne. 1) then + pre_in(k) = prer_evap(i,pverp-k+1) + endif + + ! Initialize these to prevent crashing behavior + wprcp_out(k) = 0._r8 + rcm_in_layer_out(k) = 0._r8 + cloud_cover_out(k) = 0._r8 + edsclr_in(k,:) = 0._r8 + khzm_out(k) = 0._r8 + khzt_out(k) = 0._r8 + + ! higher order scalar stuff, put to zero + sclrm(k,:) = 0._r8 + wpsclrp(k,:) = 0._r8 + sclrp2(k,:) = 0._r8 + sclrp3(k,:) = 0._r8 + sclrprtp(k,:) = 0._r8 + sclrpthlp(k,:) = 0._r8 + wpsclrp_sfc(:) = 0._r8 + hydromet(k,:) = 0._r8 + wphydrometp(k,:) = 0._r8 + wp2hmp(k,:) = 0._r8 + rtphmp_zt(k,:) = 0._r8 + thlphmp_zt(k,:) = 0._r8 + + enddo + pre_in(1) = pre_in(2) + + ! pressure,exner on momentum grid needed for mass flux calc. + if (do_clubb_mf) then + do k=1,pver + kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) + qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) + invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) + enddo + kappa_zt(1) = kappa_zt(2) + qc_zt(1) = qc_zt(2) + invrs_exner_zt(1) = invrs_exner_zt(2) + + kappa_zm = zt2zm_api(kappa_zt) + do k=1,pverp + p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) + invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) + enddo + end if + + if (clubb_do_adv) then + if (macmic_it == 1) then + wp2_in=zt2zm_api(wp2_in) + wpthlp_in=zt2zm_api(wpthlp_in) + wprtp_in=zt2zm_api(wprtp_in) + up2_in=zt2zm_api(up2_in) + vp2_in=zt2zm_api(vp2_in) + thlp2_in=zt2zm_api(thlp2_in) + rtp2_in=zt2zm_api(rtp2_in) + rtpthlp_in=zt2zm_api(rtpthlp_in) + + do k=1,nlev+1 + thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) + rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) + wp2_in(k)=max(w_tol_sqd,wp2_in(k)) + up2_in(k)=max(w_tol_sqd,up2_in(k)) + vp2_in(k)=max(w_tol_sqd,vp2_in(k)) + enddo + endif + endif + + ! Do the same for tracers + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + do k=1,nlev + edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) + enddo + edsclr_in(1,icnt) = edsclr_in(2,icnt) + end if + enddo + + if (do_expldiff) then + do k=1,nlev + edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) + edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) + enddo + + edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) + edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) + endif + + stats_nsamp = nint(stats_tsamp/dtime) + stats_nout = nint(stats_tout/dtime) + + do t=1,nadv ! do needed number of "sub" timesteps for each CAM step + + ! Increment the statistics then being stats timestep + if (l_stats) then + call stats_begin_timestep_api(t, stats_nsamp, stats_nout) + endif + + !####################################################################### + !###################### CALL MF DIAGNOSTIC PLUMES ###################### + !####################################################################### + if (do_clubb_mf) then + + do k=2,pverp + dzt(k) = zi_g(k) - zi_g(k-1) + dzm(k-1) = zt_g(k) - zt_g(k-1) + enddo + dzt(1) = dzt(2) + dzm(pverp) = dzm(pver) + invrs_dzt = 1._r8/dzt + + rtm_zm_in = zt2zm_api( rtm_in ) + thlm_zm_in = zt2zm_api( thlm_in ) + th_zm = zt2zm_api( th_zt ) + qv_zm = zt2zm_api( qv_zt ) + qc_zm = zt2zm_api( qc_zt ) + + call integrate_mf( pverp, & ! input + rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input + rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input + um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input + th_zt, qv_zt, qc_zt, & ! input + thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input + th_zm, qv_zm, qc_zm, & ! input + wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + wpthlp_in, tke_in, tpert(i), & ! input + mf_cape_output(i), & ! output - plume diagnostics + mf_upa, & ! output - plume diagnostics + mf_upw, & ! output - plume diagnostics + mf_upqt, & ! output - plume diagnostics + mf_upthl, & ! output - plume diagnostics + mf_upthv, & ! output - plume diagnostics + mf_upth, & ! output - plume diagnostics + mf_upqc, & ! output - plume diagnostics + mf_upbuoy, & ! output - plume diagnostics + mf_upent, & ! output - plume diagnostics + mf_dry_a, mf_moist_a, & ! output - plume diagnostics + mf_dry_w, mf_moist_w, & ! output - plume diagnostics + mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics + mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics + mf_dry_u, mf_moist_u, & ! output - plume diagnostics + mf_dry_v, mf_moist_v, & ! output - plume diagnostics + mf_moist_qc, & ! output - plume diagnostics + mf_precc, & ! output - plume diagnostics + s_ae, s_aw, & ! output - plume diagnostics + s_awthl, s_awqt, & ! output - plume diagnostics + s_awql, s_awqi, & ! output - plume diagnostics + s_awth, s_awqv, & ! output - plume diagnostics + s_awu, s_awv, & ! output - plume diagnostics + mf_thflx, mf_qvflx, & ! output - plume diagnostics + mf_thvflx, mf_qcflx, & ! output - plume diagnostics + mf_thlflx, mf_qtflx, & ! output - variables needed for solver + mf_ztop_output(i), mf_L0_output(i) ) + + !if ( masterproc ) then + ! write(iulog,*) "mf cape ", mf_cape_output(i) + !endif + + ! CFL limiter + s_aw(0) = 0._r8 + max_cfl(i)= 0._r8 + do k=2,pverp + max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) + end do + cflval = 1._r8 + cflfac = 1._r8 + cfllim = .true. + if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) + + ! pass MF turbulent advection term as CLUBB explicit forcing term + rtm_forcing = 0._r8 + thlm_forcing = 0._r8 + mf_thforc = 0._r8 + mf_qvforc = 0._r8 + mf_qcforc = 0._r8 + do k=2,pverp + rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) + + thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) + + mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) + + mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) + + mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) + + end do + ! compute ensemble cloud + mf_rcm = 0._r8 + mf_cloudfrac = 0._r8 + mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= mf_moist_a(:pverp) + + end if + + ! Advance CLUBB CORE one timestep in the future + call advance_clubb_core_api & + ( l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & + thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & + sclrm_forcing, edsclrm_forcing, wprtp_forcing, & + wpthlp_forcing, rtp2_forcing, thlp2_forcing, & + rtpthlp_forcing, wm_zm, wm_zt, & + wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & + wpsclrp_sfc, wpedsclrp_sfc, & + p_in_Pa, rho_zm, rho_in, exner, & + rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & + invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & + rfrzm, radf, & + wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & + host_dx, host_dy, & + clubb_config_flags, & + um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & + thlm_in, rtm_in, wprtp_in, wpthlp_in, & + wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & + sclrm, & + sclrp2, sclrp3, sclrprtp, sclrpthlp, & + wpsclrp, edsclr_in, err_code, & + rcm_inout, cloud_frac_inout, & + wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & + sclrpthvp_inout, & + pdf_params_chnk(i,lchnk), pdf_params_zm_chnk(i,lchnk), & + pdf_implicit_coefs_terms_chnk(i,lchnk), & + khzm_out, khzt_out, & + qclvar_out, thlprcp_out, & + wprcp_out, ice_supersat_frac_out, & + rcm_in_layer_out, cloud_cover_out) + + if ( err_code == clubb_fatal_error ) then + write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep(), "LAT: ", state1%lat(i), " LON: ", state1%lon(i) + call endrun(subr//': Fatal error in CLUBB library') + end if + + + if (do_rainturb) then + rvm_in = rtm_in - rcm_inout + call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & + rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & + rtp2_mc_out, thlp2_mc_out, & + wprtp_mc_out, wpthlp_mc_out, & + rtpthlp_mc_out) + + dum1 = (1._r8 - cam_in%landfrac(i)) + + ! update turbulent moments based on rain evaporation + rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime + thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime + wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime + wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime + endif + + if (do_cldcool) then + + rcm_out_zm = zt2zm_api(rcm_inout) + qrl_zm = zt2zm_api(qrl_clubb) + thlp2_rad_out(:) = 0._r8 + call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) + thlp2_in = thlp2_in + thlp2_rad_out * dtime + thlp2_in = max(thl_tol**2,thlp2_in) + endif + + ! Check to see if stats should be output, here stats are read into + ! output arrays to make them conformable to CAM output + if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& + out_radzt,out_radzm,out_sfc) + + enddo ! end time loop + + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + wp2_in=zm2zt_api(wp2_in) + wpthlp_in=zm2zt_api(wpthlp_in) + wprtp_in=zm2zt_api(wprtp_in) + up2_in=zm2zt_api(up2_in) + vp2_in=zm2zt_api(vp2_in) + thlp2_in=zm2zt_api(thlp2_in) + rtp2_in=zm2zt_api(rtp2_in) + rtpthlp_in=zm2zt_api(rtpthlp_in) + + do k=1,nlev+1 + thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) + rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) + wp2_in(k)=max(w_tol_sqd,wp2_in(k)) + up2_in(k)=max(w_tol_sqd,up2_in(k)) + vp2_in(k)=max(w_tol_sqd,vp2_in(k)) + enddo + endif + endif + + ! Convert RTP2 and THLP2 to thermo grid for output + rtp2_zt = zm2zt_api(rtp2_in) + thl2_zt = zm2zt_api(thlp2_in) + wp2_zt = zm2zt_api(wp2_in) + + ! Arrays need to be "flipped" to CAM grid + + do k=1,nlev+1 + + um(i,pverp-k+1) = um_in(k) + vm(i,pverp-k+1) = vm_in(k) + upwp(i,pverp-k+1) = upwp_in(k) + vpwp(i,pverp-k+1) = vpwp_in(k) + wpthvp(i,pverp-k+1) = wpthvp_in(k) + wp2thvp(i,pverp-k+1) = wp2thvp_in(k) + rtpthvp(i,pverp-k+1) = rtpthvp_in(k) + thlpthvp(i,pverp-k+1) = thlpthvp_in(k) + up2(i,pverp-k+1) = up2_in(k) + vp2(i,pverp-k+1) = vp2_in(k) + up3(i,pverp-k+1) = up3_in(k) + vp3(i,pverp-k+1) = vp3_in(k) + thlm(i,pverp-k+1) = thlm_in(k) + rtm(i,pverp-k+1) = rtm_in(k) + wprtp(i,pverp-k+1) = wprtp_in(k) + wpthlp(i,pverp-k+1) = wpthlp_in(k) + wp2(i,pverp-k+1) = wp2_in(k) + wp3(i,pverp-k+1) = wp3_in(k) + rtp2(i,pverp-k+1) = rtp2_in(k) + thlp2(i,pverp-k+1) = thlp2_in(k) + rtp3(i,pverp-k+1) = rtp3_in(k) + thlp3(i,pverp-k+1) = thlp3_in(k) + rtpthlp(i,pverp-k+1) = rtpthlp_in(k) + rcm(i,pverp-k+1) = rcm_inout(k) + ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_out(k) + wprcp(i,pverp-k+1) = wprcp_out(k) + cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(k),1._r8) + rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(k) + cloud_cover(i,pverp-k+1) = min(cloud_cover_out(k),1._r8) + zt_out(i,pverp-k+1) = zt_g(k) + zi_out(i,pverp-k+1) = zi_g(k) + khzm(i,pverp-k+1) = khzm_out(k) + qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(k)) + wm_zt_out(i,pverp-k+1) = wm_zt(k) + + rtp2_zt_out(i,pverp-k+1) = rtp2_zt(k) + thl2_zt_out(i,pverp-k+1) = thl2_zt(k) + wp2_zt_out(i,pverp-k+1) = wp2_zt(k) + + mean_rt & + = pdf_params_chnk(i,lchnk)%mixt_frac(k) & + * pdf_params_chnk(i,lchnk)%rt_1(k) & + + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & + * pdf_params_chnk(i,lchnk)%rt_2(k) + + pdfp_rtp2(i,pverp-k+1) & + = pdf_params_chnk(i,lchnk)%mixt_frac(k) & + * ( ( pdf_params_chnk(i,lchnk)%rt_1(k) - mean_rt )**2 & + + pdf_params_chnk(i,lchnk)%varnce_rt_1(k) ) & + + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & + * ( ( pdf_params_chnk(i,lchnk)%rt_2(k) - mean_rt )**2 & + + pdf_params_chnk(i,lchnk)%varnce_rt_2(k) ) + + do ixind=1,edsclr_dim + edsclr_out(pverp-k+1,ixind) = edsclr_in(k,ixind) + enddo + + if (do_clubb_mf) then + mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) + mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) + mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) + mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) + mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) + mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) + mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) + mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) + mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) + mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) + mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) + mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) + mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + s_ae_output(i,pverp-k+1) = s_ae(k) + s_aw_output(i,pverp-k+1) = s_aw(k) + s_awthl_output(i,pverp-k+1) = s_awthl(k) + s_awth_output(i,pverp-k+1) = s_awth(k) + s_awqv_output(i,pverp-k+1) = s_awqv(k) + s_awqt_output(i,pverp-k+1) = s_awqt(k) + s_awql_output(i,pverp-k+1) = s_awql(k) + s_awqi_output(i,pverp-k+1) = s_awqi(k) + s_awu_output(i,pverp-k+1) = s_awu(k) + s_awv_output(i,pverp-k+1) = s_awv(k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + mf_thflx_output(i,pverp-k+1) = mf_thflx(k) + mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(k) + mf_precc_output(i,pverp-k+1) = mf_precc(k) + if (k.ne.1) then + mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) + mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) + mf_thforc_output(i,pverp-k+1) = mf_thforc(k) + mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) + mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) + end if + + mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) + mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) + mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) + mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) + + end if + + enddo + + if (do_clubb_mf) then + do k=1,clubb_mf_nup + mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) + mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) + mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) + mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) + mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) + mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) + mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) + end do + end if + + ! Values to use above top_lev, for variables that have not already been + ! set up there. These are mostly fill values that should not actually be + ! used in the run, but may end up in diagnostic output. + upwp(i,:top_lev-1) = 0._r8 + vpwp(i,:top_lev-1) = 0._r8 + rcm(i,:top_lev-1) = 0._r8 + wprcp(i,:top_lev-1) = 0._r8 + cloud_frac(i,:top_lev-1) = 0._r8 + rcm_in_layer(i,:top_lev-1) = 0._r8 + zt_out(i,:top_lev-1) = 0._r8 + zi_out(i,:top_lev-1) = 0._r8 + khzm(i,:top_lev-1) = 0._r8 + qclvar(i,:top_lev-1) = 2._r8 + + + + ! enforce zero tracer tendencies above the top_lev level -- no change + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) + end if + enddo + + ! Fill up arrays needed for McICA. Note we do not want the ghost point, + ! thus why the second loop is needed. + + zi_out(i,1) = 0._r8 + + ! Section below is concentrated on energy fixing for conservation. + ! There are two steps to this process. The first is to remove any tendencies + ! CLUBB may have produced above where it is active due to roundoff. + ! The second is to provider a fixer because CLUBB and CAM's thermodynamic + ! variables are different. + + ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from + ! firing up in the stratosphere + clubbtop = troplev(i) + do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) + clubbtop = clubbtop + 1 + enddo + + ! Compute static energy using CLUBB's variables + do k=1,pver + clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & + + latvap * rcm(i,k) & + + gravit * state1%zm(i,k) + state1%phis(i) + enddo + + ! Compute integrals above layer where CLUBB is active + se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called + se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called + tw_upper_a = 0._r8 ! total water in layers above where CLUBB is active AFTER CLUBB is called + tw_upper_b = 0._r8 ! total water in layers above where CLUBB is active BEFORE CLUBB is called + do k=1,clubbtop + se_upper_a = se_upper_a + (clubb_s(k)+0.5_r8*(um(i,k)**2+vm(i,k)**2)+(latvap+latice)* & + (rtm(i,k)-rcm(i,k))+(latice)*rcm(i,k))*state1%pdel(i,k)/gravit + se_upper_b = se_upper_b + (state1%s(i,k)+0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)+(latvap+latice)* & + state1%q(i,k,ixq)+(latice)*state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit + tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit + tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit + enddo + + ! Compute the disbalance of total energy and water in upper levels, + ! divide by the thickness in the lower atmosphere where we will + ! evenly distribute this disbalance + se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + + ! Perform a test to see if there will be any negative RTM errors + ! in the column. If so, apply the disbalance to the surface + apply_to_surface = .false. + if (tw_upper_diss < 0._r8) then + do k=clubbtop+1,pver + rtm_test = (rtm(i,k) + tw_upper_diss*gravit) - rcm(i,k) + if (rtm_test < 0._r8) then + apply_to_surface = .true. + endif + enddo + endif + + if (apply_to_surface) then + tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) + se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) + rtm(i,pver) = rtm(i,pver) + tw_upper_diss*gravit + if (apply_to_heat) clubb_s(pver) = clubb_s(pver) + se_upper_diss*gravit + else + ! Apply the disbalances above to layers where CLUBB is active + do k=clubbtop+1,pver + rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit + if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit + enddo + endif + + ! Essentially "zero" out tendencies in the layers above where CLUBB is active + do k=1,clubbtop + if (apply_to_heat) clubb_s(k) = state1%s(i,k) + rcm(i,k) = state1%q(i,k,ixcldliq) + rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) + enddo + + ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water + ! after CLUBB is called. This is for energy conservation purposes. + se_a = 0._r8 + ke_a = 0._r8 + wv_a = 0._r8 + wl_a = 0._r8 + + ! Do the same as above, but for before CLUBB was called. + se_b = 0._r8 + ke_b = 0._r8 + wv_b = 0._r8 + wl_b = 0._r8 + do k=1,pver + se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit + ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit + wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit + wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit + + se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit + ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit + wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit + wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit + enddo + + ! Based on these integrals, compute the total energy before and after CLUBB call + te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) + te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) + + ! Take into account the surface fluxes of heat and moisture + ! Use correct qflux from cam_in, not lhf/latvap as was done previously + te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime + + ! Compute the disbalance of total energy, over depth where CLUBB is active + se_dis = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + + ! Fix the total energy coming out of CLUBB so it achieves enery conservation. + ! Apply this fixer throughout the column evenly, but only at layers where + ! CLUBB is active. + ! + ! NOTE: The energy fixer seems to cause the climate to change significantly + ! when using specified dynamics, so allow this to be turned off via a namelist + ! variable. + if (clubb_do_energyfix) then + do k=clubbtop+1,pver + clubb_s(k) = clubb_s(k) - se_dis*gravit + enddo + endif + + ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point + ! for all variables and therefore is never called in this loop + rtm_integral_vtend = 0._r8 + rtm_integral_ltend = 0._r8 + do k=1,pver + + ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind + ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind + ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor + ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water + ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy + + rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit + rtm_integral_vtend = rtm_integral_vtend + ptend_loc%q(i,k,ixq)*state1%pdel(i,k)/gravit + + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + + ! Here add a constant to moments which can be either positive or + ! negative. This is to prevent clipping when dynamics tries to + ! make all constituents positive + wp3(i,k) = wp3(i,k) + wp3_const + rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const + wpthlp(i,k) = wpthlp(i,k) + wpthlp_const + wprtp(i,k) = wprtp(i,k) + wprtp_const + + ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance + ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance + ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance + ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP + ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP + ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 + ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 + ptend_loc%q(i,k,ixup2)=(up2(i,k)-state1%q(i,k,ixup2))/hdtime ! UP2 + ptend_loc%q(i,k,ixvp2)=(vp2(i,k)-state1%q(i,k,ixvp2))/hdtime ! VP2 + else + ptend_loc%q(i,k,ixthlp2)=0._r8 + ptend_loc%q(i,k,ixrtp2)=0._r8 + ptend_loc%q(i,k,ixrtpthlp)=0._r8 + ptend_loc%q(i,k,ixwpthlp)=0._r8 + ptend_loc%q(i,k,ixwprtp)=0._r8 + ptend_loc%q(i,k,ixwp2)=0._r8 + ptend_loc%q(i,k,ixwp3)=0._r8 + ptend_loc%q(i,k,ixup2)=0._r8 + ptend_loc%q(i,k,ixvp2)=0._r8 + endif + + endif + + ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. + ! Loading up this array doesn't mean the tendencies are applied. + ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed + + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& + (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& + (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& + (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& + (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then + ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents + end if + end if + enddo + + enddo + + + enddo ! end column loop + + call outfld('KVH_CLUBB', khzm, pcols, lchnk) + + ! Add constant to ghost point so that output is not corrupted + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + wp3(:,pverp) = wp3(:,pverp) + wp3_const + rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const + wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const + wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const + endif + endif + + cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) + + ! ------------------------------------------------- ! + ! End column computation of CLUBB, begin to apply ! + ! and compute output, etc ! + ! ------------------------------------------------- ! + + ! Output CLUBB tendencies + call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) + call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) + call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) + call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) + call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) + call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) + + call outfld( 'CMELIQ', cmeliq, pcols, lchnk) + + call physics_ptend_sum(ptend_loc,ptend_all,ncol) + call physics_update(state1,ptend_loc,hdtime) + + ! Due to the order of operation of CLUBB, which closes on liquid first, + ! then advances it's predictive equations second, this can lead to + ! RHliq > 1 directly before microphysics is called. Therefore, we use + ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. + + if (clubb_do_liqsupersat) then + + ! -------------------------------------- ! + ! Ice Saturation Adjustment Computation ! + ! -------------------------------------- ! + + latsub = latvap + latice + + lq2(:) = .FALSE. + lq2(ixq) = .TRUE. + lq2(ixcldliq) = .TRUE. + lq2(ixnumliq) = .TRUE. + + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) + + stend(:ncol,:)=0._r8 + qvtend(:ncol,:)=0._r8 + qctend(:ncol,:)=0._r8 + inctend(:ncol,:)=0._r8 + + call liquid_macro_tend(npccn(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & + state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,ixq),state1%q(:ncol,top_lev:pver,ixcldliq),& + state1%q(:ncol,top_lev:pver,ixnumliq),latvap,hdtime,& + stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qctend(:ncol,top_lev:pver),& + inctend(:ncol,top_lev:pver)) + + ! update local copy of state with the tendencies + ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) + ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) + + ! Add the ice tendency to the output tendency + call physics_ptend_sum(ptend_loc, ptend_all, ncol) + + ! ptend_loc is reset to zero by this call + call physics_update(state1, ptend_loc, hdtime) + + ! Write output for tendencies: + ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE + temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) + call outfld( 'TTENDICE', temp2d, pcols, lchnk ) + call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) + call outfld( 'QCTENDICE', qctend, pcols, lchnk ) + call outfld( 'NCTENDICE', inctend, pcols, lchnk ) + + where(qctend .ne. 0._r8) + fqtend = 1._r8 + elsewhere + fqtend = 0._r8 + end where + + call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) + end if + + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! The rest of the code deals with diagnosing variables ! + ! for microphysics/radiation computation and macrophysics ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + + + ! --------------------------------------------------------------------------------- ! + ! COMPUTE THE ICE CLOUD DETRAINMENT ! + ! Detrainment of convective condensate into the environment or stratiform cloud ! + ! --------------------------------------------------------------------------------- ! + + ! Initialize the shallow convective detrainment rate, will always be zero + dlf2(:,:) = 0.0_r8 + dlf_liq_out(:,:) = 0.0_r8 + dlf_ice_out(:,:) = 0.0_r8 + + lqice(:) = .false. + lqice(ixcldliq) = .true. + lqice(ixcldice) = .true. + lqice(ixnumliq) = .true. + lqice(ixnumice) = .true. + + call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) + + if (zmconv_microp) then + call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) + call pbuf_get_field(pbuf, difzm_idx, difzm) + call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) + call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) + end if + + do k=1,pver + do i=1,ncol + if( state1%t(i,k) > 268.15_r8 ) then + dum1 = 0.0_r8 + elseif ( state1%t(i,k) < 238.15_r8 ) then + dum1 = 1.0_r8 + else + dum1 = ( 268.15_r8 - state1%t(i,k) ) / 30._r8 + endif + + if (zmconv_microp) then + ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) + ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 + + ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection + ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & + / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection + ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice + else + + ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) + ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 + ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8* 8.e-6_r8**3*997._r8) + & ! Deep Convection + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection + ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & + / (4._r8*3.14_r8*25.e-6_r8**3*500._r8) + & ! Deep Convection + 3._r8 * ( dlf2(i,k) * dum1 ) & + / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection + ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice + + dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) + dlf_ice_out(i,k) = dlf(i,k) * dum1 + end if + + ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep + ! track of the integrals of ice and static energy that is effected from conversion to ice + ! so that the energy checker doesn't complain. + det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit + det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit + + enddo + enddo + + det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water + + call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) + call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) + + temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) + call outfld( 'DPDLFT', temp2d, pcols, lchnk) + + call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) + + call physics_ptend_sum(ptend_loc,ptend_all,ncol) + call physics_update(state1,ptend_loc,hdtime) + + ! ptend_all now has all accumulated tendencies. Convert the tendencies for the + ! dry constituents to dry air basis. + do ixind = 1, pcnst + if (lq(ixind) .and. cnst_type(ixind) == 'dry') then + do k = 1, pver + do i = 1, ncol + ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdel(i,k)/state1%pdeldry(i,k) + end do + end do + end if + end do + + ! ------------------------------------------------- ! + ! Diagnose relative cloud water variance ! + ! ------------------------------------------------- ! + + if (deep_scheme == 'CLUBB_SGS') then + relvarmax = 2.0_r8 + else + relvarmax = 10.0_r8 + endif + + relvar(:,:) = relvarmax ! default + + if (deep_scheme .ne. 'CLUBB_SGS') then + where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & + relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) + endif + + ! ------------------------------------------------- ! + ! Optional Accretion enhancement factor ! + ! ------------------------------------------------- ! + + accre_enhan(:ncol,:pver) = 1._r8 + + ! ------------------------------------------------- ! + ! Diagnose some output variables ! + ! ------------------------------------------------- ! + + ! density + rho(:ncol,1:pver) = state1%pmid(:ncol,1:pver)/(rairv(:ncol,1:pver,lchnk)*state1%t(:ncol,1:pver)) + rho(:ncol,pverp) = state1%ps(:ncol)/(rairv(:ncol,pver,lchnk)*state1%t(:ncol,pver)) + + wpthvp_diag(:,:) = 0.0_r8 + do k=1,pver + do i=1,ncol + eps = rairv(i,k,lchnk)/rh2o + ! buoyancy flux + wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & + (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & + state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) + + ! total water mixing ratio + qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) + ! liquid water potential temperature + thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) + ! liquid water static energy + sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) + enddo + enddo + + do k=1,pverp + do i=1,ncol + wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux + wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux + rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output + wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output + tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy + wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair + if (do_clubb_mf) then + mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair + mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair + mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap + mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o + end if + enddo + enddo + + do k=1,pverp + do i=1,ncol + qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) + thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) + rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) + cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) + wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) + wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) + wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) + if (do_clubb_mf) then + mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) + mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) + mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) + end if + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! Diagnose some quantities that are computed in macrop_tend here. ! + ! These are inputs required for the microphysics calculation. ! + ! ! + ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! + ! --------------------------------------------------------------------------------- ! + + ! initialize variables + alst(:,:) = 0.0_r8 + qlst(:,:) = 0.0_r8 + + do k=1,pver + do i=1,ncol + alst(i,k) = cloud_frac(i,k) + qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! + ! --------------------------------------------------------------------------------- ! + + deepcu(:,pver) = 0.0_r8 + shalcu(:,pver) = 0.0_r8 + + do k=1,pver-1 + do i=1,ncol + ! diagnose the deep convective cloud fraction, as done in macrophysics based on the + ! deep convective mass flux, read in from pbuf. Since shallow convection is never + ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud + ! fraction is purely from deep convection scheme. + deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) + shalcu(i,k) = 0._r8 + + if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then + deepcu(i,k) = 0._r8 + endif + + ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable + ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation + ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud + ! from CLUBB plus the deep convective cloud fraction + concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) + enddo + enddo + + if (single_column) then + if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & + trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & + trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & + trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & + trim(scm_clubb_iop_name) == 'RICO_3day' .or. & + trim(scm_clubb_iop_name) == 'ARM_CC') then + + deepcu(:,:) = 0.0_r8 + concld(:,:) = 0.0_r8 + + endif + endif + + ! --------------------------------------------------------------------------------- ! + ! COMPUTE THE ICE CLOUD FRACTION PORTION ! + ! use the aist_vector function to compute the ice cloud fraction ! + ! --------------------------------------------------------------------------------- ! + + aist(:,:top_lev-1) = 0._r8 + qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below + + do k = top_lev, pver + + ! For Type II PSC and for thin cirrus, the clouds can be thin, but + ! extensive and they should start forming when the gridbox mean saturation + ! reaches 1.0. + ! + ! For now, use the tropopause diagnostic to determine where the Type II + ! PSC should be, but in the future wold like a better metric that can also + ! identify the level for thin cirrus. Include the tropopause level so that + ! the cold point tropopause will use the stratospheric values. + where (k <= troplev) + rhmini = rhminis_const + rhmaxi = rhmaxis_const + elsewhere + rhmini = rhmini_const + rhmaxi = rhmaxi_const + end where + + if ( trim(subcol_scheme) == 'SILHS' ) then + call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & + state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) + else + call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & + state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& + qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) + endif + enddo + + ! --------------------------------------------------------------------------------- ! + ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! + ! ! + ! For now leave the computation of ice stratus fraction from macrop_driver intact ! + ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! + ! fraction that was coded in macrop_driver ! + ! --------------------------------------------------------------------------------- ! + + ! Recompute net stratus fraction using maximum over-lapping assumption, as done + ! in macrophysics code, using alst computed above and aist read in from physics buffer + + do k=1,pver + do i=1,ncol + + ast(i,k) = max(alst(i,k),aist(i,k)) + + qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) + enddo + enddo + + ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just + ! be outputting the shallow convective cloud fraction + + do k=1,pver + do i=1,ncol + cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! DIAGNOSE THE PBL DEPTH ! + ! this is needed for aerosol code ! + ! --------------------------------------------------------------------------------- ! + + do i=1,ncol + do k=1,pver + th(i,k) = state1%t(i,k)*state1%exner(i,k) + thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) + enddo + enddo + + ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) + rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) + call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & + rrho(1:ncol), ustar2(1:ncol)) + ! use correct qflux from coupler + call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & + rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & + obklen(1:ncol)) + + dummy2(:) = 0._r8 + dummy3(:) = 0._r8 + + where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 + + ! Compute PBL depth according to Holtslag-Boville Scheme + call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & + ustar2, obklen, kbfs, pblh, dummy2, & + state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) + + ! Output the PBL depth + call outfld('PBLH', pblh, pcols, lchnk) + + ! Assign the first pver levels of cloud_frac back to cld + cld(:,1:pver) = cloud_frac(:,1:pver) + + ! --------------------------------------------------------------------------------- ! + ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! + ! --------------------------------------------------------------------------------- ! + + ! Output calls of variables goes here + call outfld( 'RELVAR', relvar, pcols, lchnk ) + call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) + call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) + call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) + call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) + call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) + call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) + call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) + call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) + + temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 + call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) + + rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 + call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) + + temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 + call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap + call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 + call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = wpthvp(:ncol,:) + call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) + + call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) + call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) + call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) + call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) + call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) + call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) + call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) + call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) + call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) + call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) + call outfld( 'UM_CLUBB', um, pcols, lchnk ) + call outfld( 'VM_CLUBB', vm, pcols, lchnk ) + call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) + call outfld( 'THETAL', thetal_output, pcols, lchnk ) + call outfld( 'QT', qt_output, pcols, lchnk ) + call outfld( 'SL', sl_output, pcols, lchnk ) + call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) + call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) + call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) + call outfld( 'UM_CLUBB', um, pcols, lchnk ) + call outfld( 'VM_CLUBB', vm, pcols, lchnk ) + call outfld( 'THETAL', thetal_output, pcols, lchnk ) + call outfld( 'QT', qt_output, pcols, lchnk ) + call outfld( 'SL', sl_output, pcols, lchnk ) + call outfld( 'CONCLD', concld, pcols, lchnk ) + call outfld( 'DP_CLD', deepcu, pcols, lchnk ) + call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) + call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) + call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) + call outfld( 'QSATFAC', qsatfac, pcols, lchnk) + + ! --------------------------------------------------------------- ! + ! Writing state variables after EDMF scheme for detailed analysis ! + ! --------------------------------------------------------------- ! + if (do_clubb_mf) then + call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) + call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) + call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) + call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) + call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) + call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) + call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) + call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) + call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQV' , s_awqv_output, pcols, lchnk ) + call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) + call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) + call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) + call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) + call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) + call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) + call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) + call outfld( 'edmf_thflx' , mf_thflx_output, pcols, lchnk ) + call outfld( 'edmf_qvflx' , mf_qvflx_output, pcols, lchnk ) + call outfld( 'edmf_thforc' , mf_thforc_output, pcols, lchnk ) + call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) + call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) + call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) + call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) + call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) + call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) + call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) + call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) + call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) + call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) + call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) + call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) + call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) + call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) + call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) + call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) + end if + + if (macmic_it==cld_macmic_num_steps) then + call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) + call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) + call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) + call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) + + call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) + call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) + if (do_clubb_mf) then + call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) + call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) + call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) + end if + end if + + ! Output CLUBB history here + if (l_stats) then + + do i=1,stats_zt%num_output_fields + + temp1 = trim(stats_zt%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + + call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) + enddo + + do i=1,stats_zm%num_output_fields + + temp1 = trim(stats_zm%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + + call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) + enddo + + if (l_output_rad_files) then + do i=1,stats_rad_zt%num_output_fields + call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) + enddo + + do i=1,stats_rad_zm%num_output_fields + call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) + enddo + endif + + do i=1,stats_sfc%num_output_fields + call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) + enddo + + endif + + return +#endif + end subroutine clubb_tend_cam + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +! Saturation adjustment for ice +! Add ice mass if supersaturated +elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend) + + use wv_sat_methods, only: wv_sat_qsat_ice + + real(r8), intent(in) :: naai !Activated number of ice nuclei + real(r8), intent(in) :: t !temperature (k) + real(r8), intent(in) :: p !pressure (pa0 + real(r8), intent(in) :: qv !water vapor mixing ratio + real(r8), intent(in) :: qi !ice mixing ratio + real(r8), intent(in) :: ni !ice number concentration + real(r8), intent(in) :: xxls !latent heat of freezing + real(r8), intent(in) :: deltat !timestep + real(r8), intent(out) :: stend ! 'temperature' tendency + real(r8), intent(out) :: qvtend !vapor tendency + real(r8), intent(out) :: qitend !ice mass tendency + real(r8), intent(out) :: nitend !ice number tendency + + real(r8) :: ESI + real(r8) :: QSI + real(r8) :: tau + + stend = 0._r8 + qvtend = 0._r8 + qitend = 0._r8 + nitend = 0._r8 + +! calculate qsati from t,p,q + + call wv_sat_qsat_ice(t, p, ESI, QSI) + + if (naai > 1.e-18_r8 .and. qv > QSI) then + + + qitend = (qv-QSI)/deltat !* exp(-tau/deltat) + qvtend = 0._r8 - qitend + stend = qitend * xxls ! moist static energy tend...[J/kg/s] ! + + + ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice + if (ni < 1.e3_r8 .and. (qi+qitend*deltat) > 1.e-18_r8) then + nitend = nitend + 3._r8 * qitend/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) + endif + + endif + +end subroutine ice_macro_tend + +#ifdef CLUBB_SGS +! ---------------------------------------------------------------------- +! +! DISCLAIMER : this code appears to be correct but has not been +! very thouroughly tested. If you do notice any +! anomalous behaviour then please contact Andy and/or +! Bjorn +! +! Function diag_ustar: returns value of ustar using the below +! similarity functions and a specified buoyancy flux (bflx) given in +! kinematic units +! +! phi_m (zeta > 0) = (1 + am * zeta) +! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) +! +! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) +! +! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface +! Layer, in Workshop on Micormeteorology, pages 67-100. +! +! Code writen March, 1999 by Bjorn Stevens +! + +real(r8) function diag_ustar( z, bflx, wnd, z0 ) + +use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g + +implicit none + +real(r8), parameter :: am = 4.8_r8 ! " " " +real(r8), parameter :: bm = 19.3_r8 ! " " " + +real(r8), parameter :: grav = shr_const_g +real(r8), parameter :: vonk = shr_const_karman +real(r8), parameter :: pi = shr_const_pi + +real(r8), intent (in) :: z ! height where u locates +real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) +real(r8), intent (in) :: wnd ! wind speed at z +real(r8), intent (in) :: z0 ! momentum roughness height + + +integer :: iterate +real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar + +lnz = log( z / z0 ) +klnz = vonk/lnz +c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) + +ustar = wnd*klnz +if (abs(bflx) > 1.e-6_r8) then + do iterate=1,4 + + if (ustar > 1.e-6_r8) then + lmo = -ustar**3 / ( vonk * bflx ) + zeta = z/lmo + if (zeta > 0._r8) then + ustar = vonk*wnd /(lnz + am*zeta) + else + x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) + psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 + ustar = wnd*vonk/(lnz - psi1) + end if + + endif + + end do +end if + + +diag_ustar = ustar + +return + + +end function diag_ustar +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +#ifdef CLUBB_SGS + + subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & + nnzp, nnrad_zt,nnrad_zm, delt ) + ! + ! Description: Initializes the statistics saving functionality of + ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here + ! the traditional stats_init of CLUBB is not called, as it is not compatible + ! with CAM output. + + !----------------------------------------------------------------------- + + + use clubb_api_module, only: & + stats_zt, & ! Variables + ztscr01, & + ztscr02, & + ztscr03, & + ztscr04, & + ztscr05, & + ztscr06, & + ztscr07, & + ztscr08, & + ztscr09, & + ztscr10, & + ztscr11, & + ztscr12, & + ztscr13, & + ztscr14, & + ztscr15, & + ztscr16, & + ztscr17, & + ztscr18, & + ztscr19, & + ztscr20, & + ztscr21 + + use clubb_api_module, only: & + stats_zm, & + zmscr01, & + zmscr02, & + zmscr03, & + zmscr04, & + zmscr05, & + zmscr06, & + zmscr07, & + zmscr08, & + zmscr09, & + zmscr10, & + zmscr11, & + zmscr12, & + zmscr13, & + zmscr14, & + zmscr15, & + zmscr16, & + zmscr17, & + stats_rad_zt, & + stats_rad_zm, & + stats_sfc, & + l_stats, & + l_output_rad_files, & + stats_tsamp, & + stats_tout, & + l_stats_samp, & + l_stats_last, & + l_netcdf, & + l_grads + + use clubb_api_module, only: time_precision, & ! + nvarmax_zm, stats_init_zm_api, & ! + nvarmax_zt, stats_init_zt_api, & ! + nvarmax_rad_zt, stats_init_rad_zt_api, & ! + nvarmax_rad_zm, stats_init_rad_zm_api, & ! + nvarmax_sfc, stats_init_sfc_api, & ! + fstderr, var_length ! + use cam_abortutils, only: endrun + use cam_history, only: addfld, horiz_only + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character + + implicit none + + ! Input Variables + + logical, intent(in) :: l_stats_in ! Stats on? T/F + + real(kind=time_precision), intent(in) :: & + stats_tsamp_in, & ! Sampling interval [s] + stats_tout_in ! Output interval [s] + + integer, intent(in) :: nnzp ! Grid points in the vertical [count] + integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] + integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] + + real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] + + + ! Local Variables + + ! Namelist Variables + + character(len=*), parameter :: subr = 'stats_init_clubb' + + character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels + character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels + character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels + character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels + character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface + + namelist /clubb_stats_nl/ & + clubb_vars_zt, & + clubb_vars_zm, & + clubb_vars_rad_zt, & + clubb_vars_rad_zm, & + clubb_vars_sfc + + ! Local Variables + + logical :: l_error + + character(len=200) :: temp1, sub + + integer :: i, ntot, read_status + integer :: iunit, ierr + + ! Initialize + l_error = .false. + + ! Set stats_variables variables with inputs from calling subroutine + l_stats = l_stats_in + + stats_tsamp = stats_tsamp_in + stats_tout = stats_tout_in + + if ( .not. l_stats ) then + l_stats_samp = .false. + l_stats_last = .false. + return + end if + + ! Initialize namelist variables + + clubb_vars_zt = '' + clubb_vars_zm = '' + clubb_vars_rad_zt = '' + clubb_vars_rad_zm = '' + clubb_vars_sfc = '' + + ! Read variables to compute from the namelist + if (masterproc) then + iunit= getunit() + open(unit=iunit,file="atm_in",status='old') + call find_group_name(iunit, 'clubb_stats_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('stats_init_clubb: error reading namelist') + end if + end if + close(unit=iunit) + call freeunit(iunit) + end if + + ! Broadcast namelist variables + call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") + call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") + call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") + call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") + call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") + + ! Hardcode these for use in CAM-CLUBB, don't want either + l_netcdf = .false. + l_grads = .false. + + ! Check sampling and output frequencies + + ! The model time step length, delt (which is dtmain), should multiply + ! evenly into the statistical sampling time step length, stats_tsamp. + if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then + l_error = .true. ! This will cause the run to stop. + write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & + 'delt (which is dtmain). Check the appropriate ', & + 'model.in file.' + write(fstderr,*) 'stats_tsamp = ', stats_tsamp + write(fstderr,*) 'delt = ', delt + endif + + ! Initialize zt (mass points) + + i = 1 + do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zt(i)) /= 0 .and. & + i <= nvarmax_zt ) + i = i + 1 + enddo + ntot = i - 1 + if ( ntot == nvarmax_zt ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_zt than allowed for by nvarmax_zt." + write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & + "in the stats namelist, or change nvarmax_zt." + write(fstderr,*) "nvarmax_zt = ", nvarmax_zt + call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") + endif + + stats_zt%num_output_fields = ntot + stats_zt%kk = nnzp + + allocate( stats_zt%z( stats_zt%kk ) ) + + allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & + stats_zt%accum_num_samples, stats_zt%l_in_update ) + + allocate( stats_zt%file%var( stats_zt%num_output_fields ) ) + allocate( stats_zt%file%z( stats_zt%kk ) ) + + ! Allocate scratch space + + allocate( ztscr01(stats_zt%kk) ) + allocate( ztscr02(stats_zt%kk) ) + allocate( ztscr03(stats_zt%kk) ) + allocate( ztscr04(stats_zt%kk) ) + allocate( ztscr05(stats_zt%kk) ) + allocate( ztscr06(stats_zt%kk) ) + allocate( ztscr07(stats_zt%kk) ) + allocate( ztscr08(stats_zt%kk) ) + allocate( ztscr09(stats_zt%kk) ) + allocate( ztscr10(stats_zt%kk) ) + allocate( ztscr11(stats_zt%kk) ) + allocate( ztscr12(stats_zt%kk) ) + allocate( ztscr13(stats_zt%kk) ) + allocate( ztscr14(stats_zt%kk) ) + allocate( ztscr15(stats_zt%kk) ) + allocate( ztscr16(stats_zt%kk) ) + allocate( ztscr17(stats_zt%kk) ) + allocate( ztscr18(stats_zt%kk) ) + allocate( ztscr19(stats_zt%kk) ) + allocate( ztscr20(stats_zt%kk) ) + allocate( ztscr21(stats_zt%kk) ) + + ztscr01 = 0.0_r8 + ztscr02 = 0.0_r8 + ztscr03 = 0.0_r8 + ztscr04 = 0.0_r8 + ztscr05 = 0.0_r8 + ztscr06 = 0.0_r8 + ztscr07 = 0.0_r8 + ztscr08 = 0.0_r8 + ztscr09 = 0.0_r8 + ztscr10 = 0.0_r8 + ztscr11 = 0.0_r8 + ztscr12 = 0.0_r8 + ztscr13 = 0.0_r8 + ztscr14 = 0.0_r8 + ztscr15 = 0.0_r8 + ztscr16 = 0.0_r8 + ztscr17 = 0.0_r8 + ztscr18 = 0.0_r8 + ztscr19 = 0.0_r8 + ztscr20 = 0.0_r8 + ztscr21 = 0.0_r8 + + ! Default initialization for array indices for zt + + call stats_init_zt_api( clubb_vars_zt, l_error ) + + ! Initialize zm (momentum points) + + i = 1 + do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zm(i)) /= 0 .and. & + i <= nvarmax_zm ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_zm ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_zm than allowed for by nvarmax_zm." + write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & + "in the stats namelist, or change nvarmax_zm." + write(fstderr,*) "nvarmax_zm = ", nvarmax_zm + call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") + endif + + stats_zm%num_output_fields = ntot + stats_zm%kk = nnzp + + allocate( stats_zm%z( stats_zm%kk ) ) + + allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & + stats_zm%accum_num_samples, stats_zm%l_in_update ) + + allocate( stats_zm%file%var( stats_zm%num_output_fields ) ) + allocate( stats_zm%file%z( stats_zm%kk ) ) + + ! Allocate scratch space + + allocate( zmscr01(stats_zm%kk) ) + allocate( zmscr02(stats_zm%kk) ) + allocate( zmscr03(stats_zm%kk) ) + allocate( zmscr04(stats_zm%kk) ) + allocate( zmscr05(stats_zm%kk) ) + allocate( zmscr06(stats_zm%kk) ) + allocate( zmscr07(stats_zm%kk) ) + allocate( zmscr08(stats_zm%kk) ) + allocate( zmscr09(stats_zm%kk) ) + allocate( zmscr10(stats_zm%kk) ) + allocate( zmscr11(stats_zm%kk) ) + allocate( zmscr12(stats_zm%kk) ) + allocate( zmscr13(stats_zm%kk) ) + allocate( zmscr14(stats_zm%kk) ) + allocate( zmscr15(stats_zm%kk) ) + allocate( zmscr16(stats_zm%kk) ) + allocate( zmscr17(stats_zm%kk) ) + + zmscr01 = 0.0_r8 + zmscr02 = 0.0_r8 + zmscr03 = 0.0_r8 + zmscr04 = 0.0_r8 + zmscr05 = 0.0_r8 + zmscr06 = 0.0_r8 + zmscr07 = 0.0_r8 + zmscr08 = 0.0_r8 + zmscr09 = 0.0_r8 + zmscr10 = 0.0_r8 + zmscr11 = 0.0_r8 + zmscr12 = 0.0_r8 + zmscr13 = 0.0_r8 + zmscr14 = 0.0_r8 + zmscr15 = 0.0_r8 + zmscr16 = 0.0_r8 + zmscr17 = 0.0_r8 + + call stats_init_zm_api( clubb_vars_zm, l_error ) + + ! Initialize rad_zt (radiation points) + + if (l_output_rad_files) then + + i = 1 + do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & + i <= nvarmax_rad_zt ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_rad_zt ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." + write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & + "in the stats namelist, or change nvarmax_rad_zt." + write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt + call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") + endif + + stats_rad_zt%num_output_fields = ntot + stats_rad_zt%kk = nnrad_zt + + allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) + + allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + + call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) + + allocate( stats_rad_zt%file%var( stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) + + call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) + + ! Initialize rad_zm (radiation points) + + i = 1 + do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & + i <= nvarmax_rad_zm ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_rad_zm ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." + write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & + "in the stats namelist, or change nvarmax_rad_zm." + write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm + call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") + endif + + stats_rad_zm%num_output_fields = ntot + stats_rad_zm%kk = nnrad_zm + + allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) + + allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + + call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) + + allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) + + call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) + end if ! l_output_rad_files + + + ! Initialize sfc (surface point) + + i = 1 + do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_sfc(i)) /= 0 .and. & + i <= nvarmax_sfc ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_sfc ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_sfc than allowed for by nvarmax_sfc." + write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & + "in the stats namelist, or change nvarmax_sfc." + write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc + call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") + endif + + stats_sfc%num_output_fields = ntot + stats_sfc%kk = 1 + + allocate( stats_sfc%z( stats_sfc%kk ) ) + + allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + + call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & + stats_sfc%accum_num_samples, stats_sfc%l_in_update ) + + allocate( stats_sfc%file%var( stats_sfc%num_output_fields ) ) + allocate( stats_sfc%file%z( stats_sfc%kk ) ) + + call stats_init_sfc_api( clubb_vars_sfc, l_error ) + + ! Check for errors + + if ( l_error ) then + call endrun ('stats_init: errors found') + endif + +! Now call add fields + do i = 1, stats_zt%num_output_fields + + temp1 = trim(stats_zt%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + call addfld(trim(sub),(/ 'ilev' /),& + 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) + enddo + + do i = 1, stats_zm%num_output_fields + + temp1 = trim(stats_zm%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + call addfld(trim(sub),(/ 'ilev' /),& + 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) + enddo + + if (l_output_rad_files) then +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + do i = 1, stats_rad_zt%num_output_fields + call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& + 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) + enddo + + do i = 1, stats_rad_zm%num_output_fields + call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& + 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) + enddo + endif + + do i = 1, stats_sfc%num_output_fields + call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& + 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) + enddo + + return + + end subroutine stats_init_clubb + +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + + !----------------------------------------------------------------------- + subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) + + ! Description: Called when the stats timestep has ended. This subroutine + ! is responsible for calling statistics to be written to the output + ! format. + !----------------------------------------------------------------------- + +#ifdef CLUBB_SGS + + use shr_infnan_mod, only: is_nan => shr_infnan_isnan + + use clubb_api_module, only: & + fstderr, & ! Constant(s) + stats_zt, & ! Variable(s) + stats_zm, & + stats_rad_zt, & + stats_rad_zm, & + stats_sfc, & + l_stats_last, & + stats_tsamp, & + stats_tout, & + l_output_rad_files, & + clubb_at_least_debug_level_api ! Procedure(s) + + use cam_abortutils, only: endrun + + implicit none + + +#endif + + integer :: thecol + + real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) + real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) + real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) + real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) + real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) + +#ifdef CLUBB_SGS + ! Local Variables + + integer :: i, k + logical :: l_error + + ! Check if it is time to write to file + + if ( .not. l_stats_last ) return + + ! Initialize + l_error = .false. + + ! Compute averages + call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) + call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) + if (l_output_rad_files) then + call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples ) + call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples ) + end if + call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) + + ! Here we are not outputting the data, rather reading the stats into + ! arrays which are conformable to CAM output. Also, the data is "flipped" + ! in the vertical level to be the same as CAM output. + do i = 1, stats_zt%num_output_fields + do k = 1, stats_zt%kk + out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) + if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 + enddo + enddo + + do i = 1, stats_zm%num_output_fields + do k = 1, stats_zt%kk + out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) + if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 + enddo + enddo + + if (l_output_rad_files) then + do i = 1, stats_rad_zt%num_output_fields + do k = 1, stats_rad_zt%kk + out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) + if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 + enddo + enddo + + do i = 1, stats_rad_zm%num_output_fields + do k = 1, stats_rad_zm%kk + out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) + if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 + enddo + enddo + + ! Fill in values above the CLUBB top. + out_zt(thecol,:top_lev-1,:) = 0.0_r8 + out_zm(thecol,:top_lev-1,:) = 0.0_r8 + out_radzt(thecol,:top_lev-1,:) = 0.0_r8 + out_radzm(thecol,:top_lev-1,:) = 0.0_r8 + + endif ! l_output_rad_files + + do i = 1, stats_sfc%num_output_fields + out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) + if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 + enddo + + ! Reset sample fields + call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & + stats_zt%accum_num_samples, stats_zt%l_in_update ) + call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & + stats_zm%accum_num_samples, stats_zm%l_in_update ) + if (l_output_rad_files) then + call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) + call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) + end if + call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & + stats_sfc%accum_num_samples, stats_sfc%l_in_update ) + + return + +#endif + + end subroutine stats_end_timestep_clubb + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +#ifdef CLUBB_SGS + + !----------------------------------------------------------------------- + subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) + + ! Description: + ! Initialize stats to zero + !----------------------------------------------------------------------- + + use clubb_api_module, only: & + stat_rknd, & ! Variable(s) + stat_nknd + + + implicit none + + ! Input + integer, intent(in) :: kk, num_output_fields + + ! Output + real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x + integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n + logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update + + ! Zero out arrays + + if ( num_output_fields > 0 ) then + x(:,:,:,:) = 0.0_r8 + n(:,:,:,:) = 0 + l_in_update(:,:,:,:) = .false. + end if + + return + + end subroutine stats_zero + +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + +#ifdef CLUBB_SGS + !----------------------------------------------------------------------- + subroutine stats_avg( kk, num_output_fields, x, n ) + + ! Description: + ! Compute the average of stats fields + !----------------------------------------------------------------------- + use clubb_api_module, only: & + stat_rknd, & ! Variable(s) + stat_nknd + + implicit none + + ! Input + integer, intent(in) :: num_output_fields, kk + integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n + + ! Output + real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x + + ! Internal + + integer k,m + + ! Compute averages + + do m=1,num_output_fields + do k=1,kk + + if ( n(1,1,k,m) > 0 ) then + x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) + end if + + end do + end do + + return + + end subroutine stats_avg + + subroutine grid_size(state, grid_dx, grid_dy) + ! Determine the size of the grid for each of the columns in state + + use phys_grid, only: get_area_p + use shr_const_mod, only: shr_const_pi + use physics_types, only: physics_state + + + type(physics_state), intent(in) :: state + real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] + + real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator + real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid + real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid + + real(r8) :: mpdeglat, column_area, degree + integer :: i + + ! determine the column area in radians + do i=1,state%ncol + column_area = get_area_p(state%lchnk,i) + degree = sqrt(column_area)*(180._r8/shr_const_pi) + + ! Now find meters per degree latitude + ! Below equation finds distance between two points on an ellipsoid, derived from expansion + ! taking into account ellipsoid using World Geodetic System (WGS84) reference + mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) + grid_dx(i) = mpdeglat * degree + grid_dy(i) = grid_dx(i) ! Assume these are the same + enddo + + end subroutine grid_size + +#endif + +#ifdef CLUBB_SGS + subroutine init_clubb_config_flags( clubb_config_flags_in ) +!------------------------------------------------------------------------------- +! Description: +! Initializes the public module variable 'clubb_config_flags' of type +! 'clubb_config_flags_type' on first call and only on first call. +! References: +! None +!------------------------------------------------------------------------------- + use clubb_api_module, only: & + clubb_config_flags_type, & ! Type + set_default_clubb_config_flags_api, & ! Procedure(s) + initialize_clubb_config_flags_type_api + + implicit none + + ! Input/Output Variables + type(clubb_config_flags_type), intent(inout) :: clubb_config_flags_in + + ! Local Variables + logical :: & + l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The + ! precipitation fraction is automatically set to 1 when this + ! flag is turned off. + l_predict_upwp_vpwp, & ! Flag to predict and along with and + ! alongside the advancement of , , , + ! , , and in subroutine + ! advance_xm_wpxp. Otherwise, and are still + ! approximated by eddy diffusivity when and are + ! advanced in subroutine advance_windm_edsclrm. + l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping + ! the overall correlation of w and x (w and rt, as well as w + ! and theta-l) within the limits of -max_mag_correlation_flux + ! to max_mag_correlation_flux. + l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and + ! thlp2) on keeping the overall correlation of w and x within + ! the limits of -max_mag_correlation_flux to + ! max_mag_correlation_flux. + l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the + ! turbulent dissipation coefficient, C2. + l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm + l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor + l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 + l_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects wprtp, wpthlp, & wpsclrp. + l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & + ! sclrpthlp. + l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects rtm, thlm, sclrm, um and vm. + l_uv_nudge, & ! For wind speed nudging. + l_rtm_nudge, & ! For rtm nudging + l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. + ! TKE = 1/2 (u'^2 + v'^2 + w'^2) + l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to + ! compute the varibles that are output from high order + ! closure + l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the + ! thermodynamic-level variables output from pdf_closure. + l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three + ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - + ! output from pdf_closure. + l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call + ! subroutine pdf_closure twice. If true, pdf_closure is + ! called first on thermodynamic levels and then on momentum + ! levels so that each variable is computed on its native + ! level. If false, pdf_closure is only called on + ! thermodynamic levels, and variables which belong on + ! momentum levels are interpolated. + l_standard_term_ta, & ! Use the standard discretization for the turbulent advection + ! terms. Setting to .false. means that a_1 and a_3 are + ! pulled outside of the derivative in + ! advance_wp2_wp3_module.F90 and in + ! advance_xp2_xpyp_module.F90. + l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac + ! and rcm to help increase cloudiness at coarser grid + ! resolutions. + l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones + l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors + l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) + l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) + l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability + ! correction + l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of + ! -(2/3)*em/tau_zm, as in Bougeault (1981) + l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly + l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values + l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the + ! mixing length scale as Lscale = tau * tke + l_use_ice_latent, & ! Includes the effects of ice latent heating in turbulence + ! terms + l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number + l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number + l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in + ! saturated atmospheres (from Durran and Klemp, 1982) + l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency + l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water + l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and + ! rtpthlp + l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 + l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz + l_update_pressure ! Flag for having CLUBB update pressure and exner + + logical, save :: first_call = .true. + + if (first_call) then + + call set_default_clubb_config_flags_api( l_use_precip_frac, & ! Out + l_predict_upwp_vpwp, & ! Out + l_min_wp2_from_corr_wx, & ! Out + l_min_xp2_from_corr_wx, & ! Out + l_C2_cloud_frac, & ! Out + l_diffuse_rtm_and_thlm, & ! Out + l_stability_correct_Kh_N2_zm, & ! Out + l_calc_thlp2_rad, & ! Out + l_upwind_wpxp_ta, & ! Out + l_upwind_xpyp_ta, & ! Out + l_upwind_xm_ma, & ! Out + l_uv_nudge, & ! Out + l_rtm_nudge, & ! Out + l_tke_aniso, & ! Out + l_vert_avg_closure, & ! Out + l_trapezoidal_rule_zt, & ! Out + l_trapezoidal_rule_zm, & ! Out + l_call_pdf_closure_twice, & ! Out + l_standard_term_ta, & ! Out + l_use_cloud_cover, & ! Out + l_diagnose_correlations, & ! Out + l_calc_w_corr, & ! Out + l_const_Nc_in_cloud, & ! Out + l_fix_w_chi_eta_correlations, & ! Out + l_stability_correct_tau_zm, & ! Out + l_damp_wp2_using_em, & ! Out + l_do_expldiff_rtm_thlm, & ! Out + l_Lscale_plume_centered, & ! Out + l_diag_Lscale_from_tau, & ! Out + l_use_ice_latent, & ! Out + l_use_C7_Richardson, & ! Out + l_use_C11_Richardson, & ! Out + l_brunt_vaisala_freq_moist, & ! Out + l_use_thvm_in_bv_freq, & ! Out + l_rcm_supersat_adj, & ! Out + l_single_C2_Skw, & ! Out + l_damp_wp3_Skw_squared, & ! Out + l_prescribed_avg_deltaz, & ! Out + l_update_pressure ) ! Out + + call initialize_clubb_config_flags_type_api( l_use_precip_frac, & ! In + l_predict_upwp_vpwp, & ! In + l_min_wp2_from_corr_wx, & ! In + l_min_xp2_from_corr_wx, & ! In + l_C2_cloud_frac, & ! In + l_diffuse_rtm_and_thlm, & ! In + l_stability_correct_Kh_N2_zm, & ! In + l_calc_thlp2_rad, & ! In + l_upwind_wpxp_ta, & ! In + l_upwind_xpyp_ta, & ! In + l_upwind_xm_ma, & ! In + l_uv_nudge, & ! In + l_rtm_nudge, & ! In + l_tke_aniso, & ! In + l_vert_avg_closure, & ! In + l_trapezoidal_rule_zt, & ! In + l_trapezoidal_rule_zm, & ! In + l_call_pdf_closure_twice, & ! In + l_standard_term_ta, & ! In + l_use_cloud_cover, & ! In + l_diagnose_correlations, & ! In + l_calc_w_corr, & ! In + l_const_Nc_in_cloud, & ! In + l_fix_w_chi_eta_correlations, & ! In + l_stability_correct_tau_zm, & ! In + l_damp_wp2_using_em, & ! In + l_do_expldiff_rtm_thlm, & ! In + l_Lscale_plume_centered, & ! In + l_diag_Lscale_from_tau, & ! In + l_use_ice_latent, & ! In + l_use_C7_Richardson, & ! In + l_use_C11_Richardson, & ! In + l_brunt_vaisala_freq_moist, & ! In + l_use_thvm_in_bv_freq, & ! In + l_rcm_supersat_adj, & ! In + l_single_C2_Skw, & ! In + l_damp_wp3_Skw_squared, & ! In + l_prescribed_avg_deltaz, & ! In + l_update_pressure, & ! In + clubb_config_flags_in ) ! Out + + first_call = .false. + + end if + + return + + end subroutine init_clubb_config_flags +#endif + +end module clubb_intr diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index d2f866868a..0928c89b7d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1,904 +1,2064 @@ -module clubb_mf - -! =============================================================================== ! -! Mass-flux module for use with CLUBB ! -! Together (CLUBB+MF) they comprise a eddy-diffusivity mass-flux approach (EDMF) ! -! =============================================================================== ! - - use shr_kind_mod, only: r8=>shr_kind_r8 - use spmd_utils, only: masterproc - use cam_logfile, only: iulog - - implicit none - private - save - - public :: integrate_mf, & - clubb_mf_readnl, & - do_clubb_mf, & - do_clubb_mf_diag, & - clubb_mf_nup - - real(r8) :: clubb_mf_L0 = 0._r8 - real(r8) :: clubb_mf_ent0 = 0._r8 - integer :: clubb_mf_nup = 0 - logical, protected :: do_clubb_mf = .false. - logical, protected :: do_clubb_mf_diag = .false. - - contains - - subroutine clubb_mf_readnl(nlfile) - - ! =============================================================================== ! - ! MF namelists ! - ! =============================================================================== ! - - use namelist_utils, only: find_group_name - use cam_abortutils, only: endrun - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_real8, mpi_integer, mpi_logical - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - character(len=*), parameter :: sub = 'clubb_mf_readnl' - - integer :: iunit, read_status, ierr - - - namelist /clubb_mf_nl/ clubb_mf_L0, clubb_mf_ent0, clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag - - if (masterproc) then - open( newunit=iunit, file=trim(nlfile), status='old' ) - call find_group_name(iunit, 'clubb_mf_nl', status=read_status) - if (read_status == 0) then - read(iunit, clubb_mf_nl, iostat=ierr) - if (ierr /= 0) then - call endrun('clubb_mf_readnl: ERROR reading namelist') - end if - end if - close(iunit) - end if - - call mpi_bcast(clubb_mf_L0, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_L0") - call mpi_bcast(clubb_mf_ent0, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ent0") - call mpi_bcast(clubb_mf_nup, 1, mpi_integer, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_nup") - call mpi_bcast(do_clubb_mf, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf") - call mpi_bcast(do_clubb_mf_diag, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_diag") - - if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then - call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') - end if - - - end subroutine clubb_mf_readnl - - subroutine integrate_mf( nz, & ! input - rho_zm, dzm, zm, p_zm, iexner_zm, & ! input - rho_zt, dzt, zt, p_zt, iexner_zt, & ! input - u, v, thl, qt, thv, & ! input - th, qv, qc, & ! input - thl_zm, qt_zm, thv_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - wthl, wqt, pblh, & ! input - upa, & ! output - plume diagnostics - upw, & ! output - plume diagnostics - upqt, & ! output - plume diagnostics - upthl, & ! output - plume diagnostics - upthv, & ! output - plume diagnostics - upth, & ! output - plume diagnostics - upqc, & ! output - plume diagnostics - upbuoy, & ! output - plume diagnostics - ent, & ! output - plume diagnostics - dry_a, moist_a, & ! output - plume diagnostics - dry_w, moist_w, & ! output - plume diagnostics - dry_qt, moist_qt, & ! output - plume diagnostics - dry_thl, moist_thl, & ! output - plume diagnostics - dry_u, moist_u, & ! output - plume diagnostics - dry_v, moist_v, & ! output - plume diagnostics - moist_qc, & ! output - plume diagnostics - precc, & ! output - plume diagnostics - ae, aw, & ! output - diagnosed fluxes BEFORE mean field update - awthl, awqt, & ! output - diagnosed fluxes BEFORE mean field update - awql, awqi, & ! output - diagnosed fluxes BEFORE mean field update - awth, awqv, & ! output - diagnosed fluxes BEFORE mean field update - awu, awv, & ! output - diagnosed fluxes BEFORE mean field update - thflx, qvflx, & ! output - diagnosed fluxes BEFORE mean field update - thvflx, qcflx, & ! output - diagnosed fluxes BEFORE mean field update - thlflx, qtflx ) ! output - variables needed for solver - - ! ================================================================================= ! - ! Mass-flux algorithm ! - ! ! - ! Provides rtm and thl fluxes due to mass flux ensemble, ! - ! which are fed into the mixed explicit/implicit clubb solver as explicit terms ! - ! ! - ! Mass flux variables are computed on edges (i.e. momentum grid): ! - ! upa,upw,upqt,... ! - ! dry_a,moist_a,dry_w,moist_w, ... ! - ! ! - ! In CLUBB (unlike CAM) nlevs of momentum grid = nlevs of thermodynamic grid, ! - ! due to a subsurface thermodynamic layer. To avoid confusion, below the variables ! - ! are grouped by the grid they are on. ! - ! ! - ! *note that state on the lowest thermo level is equal to state on the lowest ! - ! momentum level due to state_zt(1) = state_zt(2), and lowest momentum level ! - ! is a weighted combination of the lowest two thermodynamic levels. ! - ! ! - ! ---------------------------------Authors---------------------------------------- ! - ! Marcin Kurowski, JPL ! - ! Modified heavily by Mikael Witte, UCLA/JPL for implementation in CESM2/E3SM ! - ! Additional modifications by Adam Herrington, NCAR ! - ! ================================================================================= ! - - use physconst, only: rair, cpair, gravit, latvap, latice, zvir - - integer, intent(in) :: nz - real(r8), dimension(nz), intent(in) :: u, v, & ! thermodynamic grid - thl, thv, & ! thermodynamic grid - th, qv, & ! thermodynamic grid - qt, qc, & ! thermodynamic grid - p_zt, iexner_zt, & ! thermodynamic grid - dzt, rho_zt, & ! thermodynamic grid - zt, & ! thermodynamic grid - thl_zm, thv_zm, & ! momentum grid - th_zm, qv_zm, & - qt_zm, qc_zm, & ! momentum grid - p_zm, iexner_zm, & ! momentum grid - dzm, rho_zm, & ! momentum grid - zm ! momentum grid - - real(r8), intent(in) :: wthl,wqt - real(r8), intent(inout) :: pblh - - real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid - upw, & ! momentum grid - upqt, & ! momentum grid - upthl, & ! momentum grid - upthv, & ! momentum grid - upth, & ! momentum grid - upqc, & ! momentum grid - upbuoy, & ! momentum grid - ent - - real(r8),dimension(nz), intent(out) :: dry_a, moist_a, & ! momentum grid - dry_w, moist_w, & ! momentum grid - dry_qt, moist_qt, & ! momentum grid - dry_thl, moist_thl, & ! momentum grid - dry_u, moist_u, & ! momentum grid - dry_v, moist_v, & ! momentum grid - moist_qc, & ! momentum grid - precc, & ! momentum grid - ae, aw, & ! momentum grid - awthl, awqt, & ! momentum grid - awql, awqi, & ! momentum grid - awth, awqv, & ! momentum grid - awu, awv, & ! momentum grid - thflx, qvflx, & ! momentum grid - thvflx, qcflx, & ! momentum grid - thlflx, qtflx ! momentum grid - - ! =============================================================================== ! - ! INTERNAL VARIABLES - ! - ! sums over all plumes - real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid - awthv, awqc, & ! momentum grid - awthl_conv, awqt_conv, & ! momentum grid - thv_env_zm, awthv_conv, & ! MKW - thl_env_zm, qt_env_zm, & ! momentum grid - thl_env, qt_env, & ! thermodynamic grid - thv_env - ! - ! updraft properties - real(r8), dimension(nz,clubb_mf_nup) :: upqv, upqs, & ! momentum grid - upql, upqi, & ! momentum grid - upu, upv, & ! momentum grid - uplmix ! momentum grid - ! - ! microphyiscs terms - real(r8), dimension(nz,clubb_mf_nup) :: supqt, supthl, & ! thermodynamic grid - uprr ! thermodynamic grid - ! - ! entrainment profiles - real(r8), dimension(nz,clubb_mf_nup) :: entf ! thermodynamic grid - integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid - ! - ! other variables - integer :: k,i,kstart - real(r8), dimension(clubb_mf_nup) :: zcb - real(r8) :: zcb_unset, & - wthv, & - wstar, qstar, thvstar, & - sigmaw, sigmaqt, sigmathv,& - wmin, wmax, & - wlv, wtv, wp, & - B, & ! thermodynamic grid - entexp, entexpu, entw, & ! thermodynamic grid - lmixt, & ! thermodynamic grid - qtovqs, sevap, & ! thermodynamic grid - betathl,betaqt, & ! thermodynamic grid - thln, thvn, thn, & ! momentum grid - qtn, qsn, & ! momentum grid - qcn, qln, qin, & ! momentum grid - un, vn, wn2, & ! momentum grid - lmixn, srfarea, & ! momentum grid - srfwqtu, srfwthvu, & - facqtu, facthvu - - ! parameters defining initial conditions for updrafts - real(r8),parameter :: pwmin = 1.5_r8, & - pwmax = 3._r8 - - ! - ! alpha, z-scores after Suselj etal 2019 - real(r8),parameter :: alphw = 0.572_r8, & - alphqt = 2.890_r8, & - alphthv = 2.890_r8 - ! - ! w' covariance after Suselj etal 2019 - real(r8),parameter :: cwqt = 0.32_r8, & - cwthv = 0.58_r8 - ! - ! virtual mass coefficients for w-eqn after Suselj etal 2019 - real(r8),parameter :: wa = 1.0_r8, & - wb = 1.5_r8 - ! - ! min values to avoid singularities - real(r8),parameter :: wstarmin = 1.e-3_r8, & - pblhmin = 100._r8 - ! - ! to condensate or not to condensate - logical :: do_condensation = .true. - ! - ! to precip or not to precip - logical :: do_precip = .false. - ! - ! evaporation efficiency after Suselj etal 2019 - real(r8),parameter :: ke = 2.5e-4_r8 - ! - ! fraction of rain detrained into downdrafts - real(r8),parameter :: fdd = 0._r8 - ! - ! fixed entrainment rate (debug only) - real(r8),parameter :: fixent = 1.e-3_r8 - ! - ! to upwind (stagger environ values) - logical :: pupwind = .true. - ! - ! to scale surface fluxes - logical :: scalesrf = .false. - ! - ! to debug flag - logical :: debug = .false. - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - ! INITIALIZE OUTPUT VARIABLES - ! set updraft properties to zero - dry_a = 0._r8 - moist_a = 0._r8 - dry_w = 0._r8 - moist_w = 0._r8 - dry_qt = 0._r8 - moist_qt = 0._r8 - dry_thl = 0._r8 - moist_thl = 0._r8 - dry_u = 0._r8 - moist_u = 0._r8 - dry_v = 0._r8 - moist_v = 0._r8 - moist_qc = 0._r8 - precc = 0._r8 - ! outputs - variables needed for solver - aw = 0._r8 - awth = 0._r8 - awthl = 0._r8 - awthv = 0._r8 - awqt = 0._r8 - awqv = 0._r8 - awqc = 0._r8 - awql = 0._r8 - awqi = 0._r8 - awu = 0._r8 - awv = 0._r8 - thlflx = 0._r8 - thvflx = 0._r8 - qtflx = 0._r8 - thflx = 0._r8 - qvflx = 0._r8 - - ent = 0._r8 - entf = 0._r8 - enti = 0 - - ! this is the environmental area - by default 1. - ae = 1._r8 - - ! START MAIN COMPUTATION - upw = 0._r8 - upth = 0._r8 - upthl = 0._r8 - upthv = 0._r8 - upqt = 0._r8 - upa = 0._r8 - upu = 0._r8 - upv = 0._r8 - upqc = 0._r8 - upth = 0._r8 - upql = 0._r8 - upqi = 0._r8 - upqv = 0._r8 - upqs = 0._r8 - upbuoy= 0._r8 - uplmix= 0._r8 - uprr = 0._r8 - supqt = 0._r8 - supthl= 0._r8 - - ! unique identifier - zcb_unset = 9999999._r8 - zcb = zcb_unset - - pblh = max(pblh,pblhmin) - wthv = wthl+zvir*thv(1)*wqt - - ! if surface buoyancy is positive then do mass-flux - if ( wthv > 0._r8 ) then - - if (debug) then - ! overide stochastic entrainment with fixent - ent(:,:) = fixent - else - - ! get entrainment coefficient, dz/L0 - do i=1,clubb_mf_nup - do k=1,nz - entf(k,i) = dzt(k) / clubb_mf_L0 - enddo - enddo - - ! get poisson, P(dz/L0) - call poisson( nz, clubb_mf_nup, entf, enti, u(2:5)) - - ! get entrainment, ent=ent0/dz*P(dz/L0) - do i=1,clubb_mf_nup - do k=1,nz - ent(k,i) = real( enti(k,i))*clubb_mf_ent0/dzt(k) - enddo - enddo - - end if - - ! get surface conditions - wstar = max( wstarmin, (gravit/thv(1)*wthv*pblh)**(1._r8/3._r8) ) - qstar = wqt / wstar - thvstar = wthv / wstar - - sigmaw = alphw * wstar - sigmaqt = alphqt * abs(qstar) - sigmathv = alphthv * abs(thvstar) - - wmin = sigmaw * pwmin - wmax = sigmaw * pwmax - - do i=1,clubb_mf_nup - wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) - wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) - - upw(1,i) = 0.5_r8 * (wlv+wtv) - upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & - - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) - - upu(1,i) = u(1) - upv(1,i) = v(1) - - upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw - upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw - enddo - - facqtu=1._r8 - facthvu=1._r8 - if (scalesrf) then - ! scale surface fluxes - srfwqtu = 0._r8 - srfwthvu = 0._r8 - srfarea = 0._r8 - do i=1,clubb_mf_nup - srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) - srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) - srfarea = srfarea+upa(1,i) - end do - facqtu=srfarea*wqt/srfwqtu - facthvu=srfarea*wthv/srfwthvu - - !if (debug) then - ! if ( masterproc ) then - ! write(iulog,*) "facqtu, facthvu ", facqtu, facthvu - ! end if - !end if - end if - - do i=1,clubb_mf_nup - - if (pupwind) then - betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) - upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) - else - upqt(1,i)=qt(1)+facqtu*upqt(1,i) - upthv(1,i)=thv(1)+facthvu*upthv(1,i) - end if - upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) - upth(1,i) = upthl(1,i) - - ! get cloud, lowest momentum level - if (do_condensation) then - call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - upthv(1,i) = thvn - upqc(1,i) = qcn - upql(1,i) = qln - upqi(1,i) = qin - upqs(1,i) = qsn - upth(1,i) = thn - if (qcn > 0._r8) zcb(i) = zm(1) - else - ! assume no cldliq - upqc(1,i) = 0._r8 - end if - end do - - ! get updraft properties - do i=1,clubb_mf_nup - do k=1,nz-1 - - ! get microphysics, autoconversion - if (do_precip .and. upqc(k,i) > 0._r8) then - call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) - - supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair - else - supqt(k+1,i) = 0._r8 - supthl(k+1,i) = 0._r8 - end if - - ! integrate updraft - entexp = exp(-ent(k+1,i)*dzt(k+1)) - entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) - - qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) - thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) - un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu - vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu - - ! get cloud, momentum levels - if (do_condensation) then - call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - if (zcb(i).eq.zcb_unset .and. qcn > 0._r8) zcb(i) = zm(k+1) - else - thvn = thln*(1._r8+zvir*qtn) - end if - - ! get buoyancy - B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) - !if (debug) then - ! if ( masterproc ) then - ! write(iulog,*) "B(k,i), k, i ", B, k, i - ! end if - !end if - - ! get wn^2 - wp = wb*ent(k+1,i) - if (wp==0._r8) then - wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) - else - entw = exp(-2._r8*wp*dzt(k+1)) - wn2 = entw*upw(k,i)**2._r8+wa*B/(wb*ent(k+1,i))*(1._r8-entw) - end if - - if (wn2>0._r8) then - upw(k+1,i) = sqrt(wn2) - upthv(k+1,i) = thvn - upthl(k+1,i) = thln - upqt(k+1,i) = qtn - upqc(k+1,i) = qcn - upqs(k+1,i) = qsn - upu(k+1,i) = un - upv(k+1,i) = vn - upa(k+1,i) = upa(k,i) - upql(k+1,i) = qln - upqi(k+1,i) = qin - upqv(k+1,i) = qtn - qcn - uplmix(k+1,i)= lmixn - upth(k+1,i) = thn - upbuoy(k+1,i)= B - else - exit - end if - enddo - enddo - - ! downward sweep for rain evaporation, snow melting - if (do_precip) then - do i=1,clubb_mf_nup - do k=nz-1,1,-1 - ! get rain evaporation - if ((upqs(k,i) + upqs(k-1,i)).le.0._r8) then - qtovqs = 0._r8 - else - qtovqs = (upqt(k,i) + upqt(k-1,i))/(upqs(k,i) + upqs(k-1,i)) - end if - qtovqs = min(1._r8,qtovqs) - sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k+1,i),0._r8)) - - ! get rain rate - uprr(k,i) = uprr(k+1,i) & - - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) - - !if (debug) then - ! if ( masterproc ) then - ! write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i - ! end if - !end if - - ! update source terms - lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) - supqt(k,i) = supqt(k,i) + sevap - supthl(k,i) = supthl(k,i) - lmixt*sevap*iexner_zt(k)/cpair - end do - end do - end if - - ! writing updraft properties for output - do k=1,nz - - ! first sum over all i-updrafts - do i=1,clubb_mf_nup - if (upqc(k,i)>0._r8) then - moist_a(k) = moist_a(k) + upa(k,i) - moist_w(k) = moist_w(k) + upa(k,i)*upw(k,i) - moist_qt(k) = moist_qt(k) + upa(k,i)*upqt(k,i) - moist_thl(k) = moist_thl(k) + upa(k,i)*upthl(k,i) - moist_u(k) = moist_u(k) + upa(k,i)*upu(k,i) - moist_v(k) = moist_v(k) + upa(k,i)*upv(k,i) - moist_qc(k) = moist_qc(k) + upa(k,i)*upqc(k,i) - else - dry_a(k) = dry_a(k) + upa(k,i) - dry_w(k) = dry_w(k) + upa(k,i)*upw(k,i) - dry_qt(k) = dry_qt(k) + upa(k,i)*upqt(k,i) - dry_thl(k) = dry_thl(k) + upa(k,i)*upthl(k,i) - dry_u(k) = dry_u(k) + upa(k,i)*upu(k,i) - dry_v(k) = dry_v(k) + upa(k,i)*upv(k,i) - endif - enddo - - if ( dry_a(k) > 0._r8 ) then - dry_w(k) = dry_w(k) / dry_a(k) - dry_qt(k) = dry_qt(k) / dry_a(k) - dry_thl(k) = dry_thl(k) / dry_a(k) - dry_u(k) = dry_u(k) / dry_a(k) - dry_v(k) = dry_v(k) / dry_a(k) - else - dry_w(k) = 0._r8 - dry_qt(k) = 0._r8 - dry_thl(k) = 0._r8 - dry_u(k) = 0._r8 - dry_v(k) = 0._r8 - endif - - if ( moist_a(k) > 0._r8 ) then - moist_w(k) = moist_w(k) / moist_a(k) - moist_qt(k) = moist_qt(k) / moist_a(k) - moist_thl(k) = moist_thl(k) / moist_a(k) - moist_u(k) = moist_u(k) / moist_a(k) - moist_v(k) = moist_v(k) / moist_a(k) - moist_qc(k) = moist_qc(k) / moist_a(k) - else - moist_w(k) = 0._r8 - moist_qt(k) = 0._r8 - moist_thl(k) = 0._r8 - moist_u(k) = 0._r8 - moist_v(k) = 0._r8 - moist_qc(k) = 0._r8 - endif - - enddo - - do k=1,nz - do i=1,clubb_mf_nup - ae (k) = ae (k) - upa(k,i) - aw (k) = aw (k) + upa(k,i)*upw(k,i) - awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) - awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) - awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) - awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) - awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) - awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) - awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) - awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) - awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) - awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) - precc(k)= precc(k)+ upa(k,i)*uprr(k,i) - enddo - enddo - - awthl_conv = awthl - awqt_conv = awqt - awthv_conv = awthv - thl_env = thl - thl_env_zm = thl_zm - qt_env = qt - qt_env_zm = qt_zm - thv_env = thv - thv_env_zm = thv_zm - - kstart = 2 - if (scalesrf) then - kstart = 1 - end if - - if (pupwind) then - ! staggered environment values - - ! get thl & qt fluxes - betathl = (thl_env(4)-thl_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betaqt = (qt_env(4)-qt_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k+1) - qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) - enddo - - ! get thv fluxes - betathl = (thv_env(4)-thv_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thv_env(1) = thv_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - do k=kstart,nz-1 - thvflx(k)= awthv_conv(k) - aw(k)*thv_env(k+1) - enddo - - ! get th & qv fluxes - thl_env = th - qt_env = qv - betathl = (th(4)-th(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betaqt = (qv(4)-qv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - thflx(k)= awth(k) - aw(k)*thl_env(k+1) - qvflx(k)= awqv(k) - aw(k)*qt_env(k+1) - enddo - - ! get qc fluxes - qt_env = qc - betaqt = (qc(4)-qc(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) - enddo - - else - ! collocated environment values - do k=kstart,nz-1 - ! get thl & qt fluxes - thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) - qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) - - ! get thv flux - thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) - - ! get th & qv fluxes - thflx(k) = awth(k) - aw(k)*th_zm(k) - qvflx(k) = awqv(k) - aw(k)*qv_zm(k) - - ! get qc fluxes - qcflx(k) = awqc(k) - aw(k)*qc_zm(k) - end do - endif - - end if ! ( wthv > 0.0 ) - - end subroutine integrate_mf - - subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) - ! =============================================================================== ! - ! zero or one condensation for edmf: calculates thv and qc ! - ! =============================================================================== ! - use physconst, only: cpair, zvir, h2otrip - use wv_saturation, only : qsat - - real(r8),intent(in) :: qt,thl,p,iex - real(r8),intent(out):: thv,qc,th,ql,qi,qs,lmix - - !local variables - integer :: niter,i - real(r8) :: diff,t,qstmp,qcold,es,wf - logical :: noice = .true. - - ! max number of iterations - niter=50 - ! minimum difference - diff=2.e-5_r8 - - qc=0._r8 - t=thl/iex - - !by definition: - ! T = Th*Exner, Exner=(p/p0)^(R/cp) (1) - ! Thl = Th - L/cp*ql/Exner (2) - !so: - ! Th = Thl + L/cp*ql/Exner (3) - ! T = Th*Exner=(Thl+L/cp*ql/Exner)*Exner (4) - ! = Thl*Exner + L/cp*ql - do i=1,niter - - if (noice) then - wf = 1._r8 - else - wf = get_watf(t) - end if - t = thl/iex+get_alhl(wf)/cpair*qc !as in (4) - - ! qsat, p is in pascal (check!) - call qsat(t,p,es,qstmp) - qcold = qc - qc = max(0.5_r8*qc+0.5_r8*(qt-qstmp),0._r8) - if (abs(qc-qcold)tmax) then - get_watf=1._r8 - else if (tc qstar) then - ! get precip efficiency - tauwgt = (dzcld-zmin)/(zmax-zmin) - tauwgt = min(max(tauwgt,0._r8),1._r8) - tau = tauwgt/tau0 - - ! get source for updraft - Supqt = (qstar-qt)*(1._r8 - exp(-1._r8*tau*dz/w)) - else - Supqt = 0._r8 - end if - - end subroutine precip_mf - - subroutine poisson(nz,nup,lambda,poi,state) - !********************************************************************** - ! Set a unique (but reproduceble) seed for the kiss RNG - ! Call Poisson deviate - ! By Adam Herrington - !********************************************************************** - use shr_RandNum_mod, only: ShrKissRandGen - - integer, intent(in) :: nz,nup - real(r8), dimension(4), intent(in) :: state - real(r8), dimension(nz,nup), intent(in) :: lambda - integer, dimension(nz,nup), intent(out) :: poi - integer, dimension(1,4) :: tmpseed - integer :: i,j - type(ShrKissRandGen) :: kiss_gen - - ! Compute seed - tmpseed(1,1) = int((state(1) - int(state(1))) * 1000000000._r8) - tmpseed(1,2) = int((state(2) - int(state(2))) * 1000000000._r8) - tmpseed(1,3) = int((state(3) - int(state(3))) * 1000000000._r8) - tmpseed(1,4) = int((state(4) - int(state(4))) * 1000000000._r8) - - ! Set seed - kiss_gen = ShrKissRandGen(tmpseed) - - do i=1,nz - do j=1,nup - call knuth(kiss_gen,lambda(i,j),poi(i,j)) - enddo - enddo - - end subroutine poisson - - subroutine knuth(kiss_gen,lambda,kout) - !********************************************************************** - ! Discrete random poisson from Knuth - ! The Art of Computer Programming, v2, 137-138 - ! By Adam Herrington - !********************************************************************** - use shr_RandNum_mod, only: ShrKissRandGen - - type(ShrKissRandGen), intent(inout) :: kiss_gen - real(r8), intent(in) :: lambda - integer, intent(out) :: kout - - ! Local variables - real(r8), dimension(1,1) :: tmpuni - real(r8) :: puni, explam - integer :: k - - k = 0 - explam = exp(-1._r8*lambda) - puni = 1._r8 - do while (puni > explam) - k = k + 1 - call kiss_gen%random(tmpuni) - puni = puni*tmpuni(1,1) - end do - kout = k - 1 - - end subroutine knuth - -end module clubb_mf +module clubb_mf + +! =============================================================================== ! +! Mass-flux module for use with CLUBB ! +! Together (CLUBB+MF) they comprise a eddy-diffusivity mass-flux approach (EDMF) ! +! =============================================================================== ! + + use shr_kind_mod, only: r8=>shr_kind_r8 + use spmd_utils, only: masterproc + use cam_logfile, only: iulog + use cam_abortutils,only: endrun + use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & + cpwv, cpliq, rh2o, zvir + + implicit none + private + save + + public :: integrate_mf, & + clubb_mf_readnl, & + do_clubb_mf, & + do_clubb_mf_diag, & + clubb_mf_nup + + ! + ! Lopt 0 = fixed L0 + ! 1 = tke_clubb L0 + ! 2 = wpthlp_clubb L0 + ! 3 = test plume L0 + ! 4 = lel + ! 5 = cape + integer :: clubb_mf_Lopt = 0 + real(r8) :: clubb_mf_a0 = 0._r8 + real(r8) :: clubb_mf_b0 = 0._r8 + real(r8) :: clubb_mf_L0 = 0._r8 + real(r8) :: clubb_mf_ent0 = 0._r8 + integer :: clubb_mf_nup = 0 + logical, protected :: do_clubb_mf = .false. + logical, protected :: do_clubb_mf_diag = .false. + logical, protected :: tht_tweaks = .true. + integer, protected :: mf_num_cin = 5 + contains + + subroutine clubb_mf_readnl(nlfile) + + ! =============================================================================== ! + ! MF namelists ! + ! =============================================================================== ! + + use namelist_utils, only: find_group_name + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_real8, mpi_integer, mpi_logical + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + character(len=*), parameter :: sub = 'clubb_mf_readnl' + + integer :: iunit, read_status, ierr + + + namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_nup, & + do_clubb_mf, do_clubb_mf_diag + + if (masterproc) then + open( newunit=iunit, file=trim(nlfile), status='old' ) + call find_group_name(iunit, 'clubb_mf_nl', status=read_status) + if (read_status == 0) then + read(iunit, clubb_mf_nl, iostat=ierr) + if (ierr /= 0) then + call endrun('clubb_mf_readnl: ERROR reading namelist') + end if + end if + close(iunit) + end if + + call mpi_bcast(clubb_mf_Lopt, 1, mpi_integer, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_Lopt") + call mpi_bcast(clubb_mf_a0, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_a0") + call mpi_bcast(clubb_mf_b0, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_b0") + call mpi_bcast(clubb_mf_L0, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_L0") + call mpi_bcast(clubb_mf_ent0, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ent0") + call mpi_bcast(clubb_mf_nup, 1, mpi_integer, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_nup") + call mpi_bcast(do_clubb_mf, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf") + call mpi_bcast(do_clubb_mf_diag, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_diag") + + if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then + call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') + end if + + + end subroutine clubb_mf_readnl + + subroutine integrate_mf( nz, & ! input + rho_zm, dzm, zm, p_zm, iexner_zm, & ! input + rho_zt, dzt, zt, p_zt, iexner_zt, & ! input + u, v, thl, qt, thv, & ! input + th, qv, qc, & ! input + thl_zm, qt_zm, thv_zm, & ! input + th_zm, qv_zm, qc_zm, & ! input + wthl, wqt, pblh, & ! input + wpthlp_env, tke, tpert, & ! input + mcape, & ! output - plume diagnostics + upa, & ! output - plume diagnostics + upw, & ! output - plume diagnostics + upqt, & ! output - plume diagnostics + upthl, & ! output - plume diagnostics + upthv, & ! output - plume diagnostics + upth, & ! output - plume diagnostics + upqc, & ! output - plume diagnostics + upbuoy, & ! output - plume diagnostics + ent, & ! output - plume diagnostics + dry_a, moist_a, & ! output - plume diagnostics + dry_w, moist_w, & ! output - plume diagnostics + dry_qt, moist_qt, & ! output - plume diagnostics + dry_thl, moist_thl, & ! output - plume diagnostics + dry_u, moist_u, & ! output - plume diagnostics + dry_v, moist_v, & ! output - plume diagnostics + moist_qc, & ! output - plume diagnostics + precc, & ! output - plume diagnostics + ae, aw, & ! output - diagnosed fluxes BEFORE mean field update + awthl, awqt, & ! output - diagnosed fluxes BEFORE mean field update + awql, awqi, & ! output - diagnosed fluxes BEFORE mean field update + awth, awqv, & ! output - diagnosed fluxes BEFORE mean field update + awu, awv, & ! output - diagnosed fluxes BEFORE mean field update + thflx, qvflx, & ! output - diagnosed fluxes BEFORE mean field update + thvflx, qcflx, & ! output - diagnosed fluxes BEFORE mean field update + thlflx, qtflx, & ! output - variables needed for solver + ztop, dynamic_L0 ) + + ! ================================================================================= ! + ! Mass-flux algorithm ! + ! ! + ! Provides rtm and thl fluxes due to mass flux ensemble, ! + ! which are fed into the mixed explicit/implicit clubb solver as explicit terms ! + ! ! + ! Mass flux variables are computed on edges (i.e. momentum grid): ! + ! upa,upw,upqt,... ! + ! dry_a,moist_a,dry_w,moist_w, ... ! + ! ! + ! In CLUBB (unlike CAM) nlevs of momentum grid = nlevs of thermodynamic grid, ! + ! due to a subsurface thermodynamic layer. To avoid confusion, below the variables ! + ! are grouped by the grid they are on. ! + ! ! + ! *note that state on the lowest thermo level is equal to state on the lowest ! + ! momentum level due to state_zt(1) = state_zt(2), and lowest momentum level ! + ! is a weighted combination of the lowest two thermodynamic levels. ! + ! ! + ! ---------------------------------Authors---------------------------------------- ! + ! Marcin Kurowski, JPL ! + ! Modified heavily by Mikael Witte, UCLA/JPL for implementation in CESM2/E3SM ! + ! Additional modifications by Adam Herrington, NCAR ! + ! ================================================================================= ! + + use physconst, only: rair, cpair, gravit, latvap, latice, zvir + + integer, intent(in) :: nz + real(r8), dimension(nz), intent(in) :: u, v, & ! thermodynamic grid + thl, thv, & ! thermodynamic grid + th, qv, & ! thermodynamic grid + qt, qc, & ! thermodynamic grid + p_zt, iexner_zt, & ! thermodynamic grid + dzt, rho_zt, & ! thermodynamic grid + zt, & ! thermodynamic grid + thl_zm, thv_zm, & ! momentum grid + th_zm, qv_zm, & + qt_zm, qc_zm, & ! momentum grid + p_zm, iexner_zm, & ! momentum grid + dzm, rho_zm, & ! momentum grid + zm, & ! momentum grid + tke, wpthlp_env ! momentum grid + + real(r8), intent(in) :: wthl,wqt + real(r8), intent(in) :: pblh,tpert + + real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid + upw, & ! momentum grid + upqt, & ! momentum grid + upthl, & ! momentum grid + upthv, & ! momentum grid + upth, & ! momentum grid + upqc, & ! momentum grid + upbuoy, & ! momentum grid + ent + + real(r8),dimension(nz), intent(out) :: dry_a, moist_a, & ! momentum grid + dry_w, moist_w, & ! momentum grid + dry_qt, moist_qt, & ! momentum grid + dry_thl, moist_thl, & ! momentum grid + dry_u, moist_u, & ! momentum grid + dry_v, moist_v, & ! momentum grid + moist_qc, & ! momentum grid + precc, & ! momentum grid + ae, aw, & ! momentum grid + awthl, awqt, & ! momentum grid + awql, awqi, & ! momentum grid + awth, awqv, & ! momentum grid + awu, awv, & ! momentum grid + thflx, qvflx, & ! momentum grid + thvflx, qcflx, & ! momentum grid + thlflx, qtflx ! momentum grid + + real(r8), intent(out) :: ztop, dynamic_L0, & + mcape + ! =============================================================================== ! + ! INTERNAL VARIABLES + ! + ! sums over all plumes + real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid + awthv, awqc, & ! momentum grid + awthl_conv, awqt_conv, & ! momentum grid + thv_env_zm, awthv_conv, & ! MKW + thl_env_zm, qt_env_zm, & ! momentum grid + thl_env, qt_env, & ! thermodynamic grid + thv_env + ! + ! updraft properties + real(r8), dimension(nz,clubb_mf_nup) :: upqv, upqs, & ! momentum grid + upql, upqi, & ! momentum grid + upu, upv, & ! momentum grid + uplmix ! momentum grid + ! + ! microphyiscs terms + real(r8), dimension(nz,clubb_mf_nup) :: supqt, supthl, & ! thermodynamic grid + uprr ! thermodynamic grid + ! + ! entrainment profiles + real(r8), dimension(nz,clubb_mf_nup) :: entf ! thermodynamic grid + integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid + ! + ! other variables + integer :: k,i,kstart + real(r8), dimension(clubb_mf_nup) :: zcb + real(r8) :: zcb_unset, & + wthv, & + wstar, qstar, thvstar, & + sigmaw, sigmaqt, sigmathv,& + convh, wmin, wmax, & + wlv, wtv, wp, & + B, & ! thermodynamic grid + entexp, entexpu, entw, & ! thermodynamic grid + lmixt, & ! thermodynamic grid + qtovqs, sevap, & ! thermodynamic grid + betathl,betaqt, & ! thermodynamic grid + thln, thvn, thn, & ! momentum grid + qtn, qsn, & ! momentum grid + qcn, qln, qin, & ! momentum grid + un, vn, wn2, & ! momentum grid + lmixn, srfarea, & ! momentum grid + srfwqtu, srfwthvu, & + facqtu, facthvu +!+++ARH + ! + ! cape variables + real(r8), dimension(nz) :: t_zt + real(r8), dimension(nz-1) :: tp, qstp + !real(r8), dimension(nz-1,clubb_mf_nup) :: dmpdz + !real(r8), dimension(clubb_mf_nup) :: tl, & + ! cape, cin + !integer, dimension(clubb_mf_nup) :: lcl, lel + real(r8), dimension(nz-1,1) :: dmpdz + real(r8), dimension(1) :: tl, & + cape, cin + integer, dimension(1) :: lcl, lel + real(r8) :: landfrac + integer :: kpbl, msg, & + lon, mx +!---ARH + ! + ! parameters defining initial conditions for updrafts + real(r8),parameter :: pwmin = 1.5_r8, & + pwmax = 3._r8 + + ! + ! alpha, z-scores after Suselj etal 2019 + real(r8),parameter :: alphw = 0.572_r8, & + alphqt = 2.890_r8, & + alphthv = 2.890_r8 + ! + ! w' covariance after Suselj etal 2019 + real(r8),parameter :: cwqt = 0.32_r8, & + cwthv = 0.58_r8 + ! + ! virtual mass coefficients for w-eqn after Suselj etal 2019 + real(r8),parameter :: wa = 1.0_r8, & + wb = 1.5_r8 + ! + ! min values to avoid singularities + real(r8),parameter :: wstarmin = 1.e-3_r8, & + pblhmin = 100._r8 + ! + ! to condensate or not to condensate + logical :: do_condensation = .true. + ! + ! to precip or not to precip + logical :: do_precip = .false. + ! + ! evaporation efficiency after Suselj etal 2019 + real(r8),parameter :: ke = 2.5e-4_r8 + ! + ! fraction of rain detrained into downdrafts + real(r8),parameter :: fdd = 0._r8 + ! + ! fixed entrainment rate (debug only) + real(r8),parameter :: fixent = 1.e-3_r8 + ! + ! to upwind (stagger environ values) + logical :: pupwind = .true. + ! + ! to scale surface fluxes + logical :: scalesrf = .false. + ! + ! to debug flag + logical :: debug = .false. + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + ! INITIALIZE OUTPUT VARIABLES + ! set updraft properties to zero + dry_a = 0._r8 + moist_a = 0._r8 + dry_w = 0._r8 + moist_w = 0._r8 + dry_qt = 0._r8 + moist_qt = 0._r8 + dry_thl = 0._r8 + moist_thl = 0._r8 + dry_u = 0._r8 + moist_u = 0._r8 + dry_v = 0._r8 + moist_v = 0._r8 + moist_qc = 0._r8 + precc = 0._r8 + ! outputs - variables needed for solver + aw = 0._r8 + awth = 0._r8 + awthl = 0._r8 + awthv = 0._r8 + awqt = 0._r8 + awqv = 0._r8 + awqc = 0._r8 + awql = 0._r8 + awqi = 0._r8 + awu = 0._r8 + awv = 0._r8 + thlflx = 0._r8 + thvflx = 0._r8 + qtflx = 0._r8 + thflx = 0._r8 + qvflx = 0._r8 + + ent = 0._r8 + entf = 0._r8 + enti = 0 + cape = 0._r8 + mcape = 0._r8 + dmpdz = 0._r8 + + ! this is the environmental area - by default 1. + ae = 1._r8 + + ! START MAIN COMPUTATION + upw = 0._r8 + upth = 0._r8 + upthl = 0._r8 + upthv = 0._r8 + upqt = 0._r8 + upa = 0._r8 + upu = 0._r8 + upv = 0._r8 + upqc = 0._r8 + upth = 0._r8 + upql = 0._r8 + upqi = 0._r8 + upqv = 0._r8 + upqs = 0._r8 + upbuoy= 0._r8 + uplmix= 0._r8 + uprr = 0._r8 + supqt = 0._r8 + supthl= 0._r8 + + ! unique identifier + zcb_unset = 9999999._r8 + zcb = zcb_unset + + convh = max(pblh,pblhmin) + wthv = wthl+zvir*thv(1)*wqt + + ! if surface buoyancy is positive then do mass-flux + if ( wthv > 0._r8 ) then + + ! get surface conditions + wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) + qstar = wqt / wstar + thvstar = wthv / wstar + + sigmaw = alphw * wstar + sigmaqt = alphqt * abs(qstar) + sigmathv = alphthv * abs(thvstar) + + wmin = sigmaw * pwmin + wmax = sigmaw * pwmax + + if (clubb_mf_Lopt==0) then + !Constant L0 + dynamic_L0 = clubb_mf_L0 + ztop = 0._r8 + else if (clubb_mf_Lopt==1) then + !TKE + do k=nz-2,2,-1 + if (zm(k) < 20000 .and. tke(k) - tke(k+1) > 1e-5) then + ztop = zm(k) + exit + endif + enddo + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==2) then + !Heat flux + do k=nz-2,2,-1 + !if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-3) then + if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-4) then + ztop = zm(k) + exit + endif + enddo + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==3) then + !Test plume + call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & + wa, do_condensation, do_precip, ztop ) + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then + !dilute cape calculation + !dmpdz = -1._r8*ent_zt(2:nz,:) + dmpdz(:,:) = -1.E-3_r8 + t_zt = th/iexner_zt + landfrac = 1._r8 + + do k=2,nz + if (zt(k-1) <= pblh) then + kpbl = k + end if + end do + + do k=1,nz + if (p_zt(k) > 40.e2_r8) then + msg = k + end if + end do + !call buoyan_dilute(nz-1 ,clubb_mf_nup ,dmpdz , & + call buoyan_dilute(nz-1 ,1 ,dmpdz , & + qv(2:nz) ,t_zt(2:nz) ,p_zt(2:nz)*0.01_r8 ,zt(2:nz) ,p_zm*0.01_r8 , & + tp ,qstp ,tl ,cape ,cin , & + kpbl-1 ,lcl ,lel ,lon ,mx , & + msg-1 ,tpert ,landfrac ) + + !do i=1,clubb_mf_nup + ! mcape = mcape + cape(i) + !end do + !mcape = mcape/REAL(clubb_mf_nup) + mcape = max(cape(1),25._r8) + + if (clubb_mf_Lopt==4) then + ztop = max(zt(lel(1)+1),convh) + else if (clubb_mf_Lopt==5) then + ztop = mcape + end if + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + end if + + if (debug) then + ! overide stochastic entrainment with fixent + ent(:,:) = fixent + else + ! get entrainment coefficient, dz/L0 + do i=1,clubb_mf_nup + do k=1,nz + entf(k,i) = dzt(k) / dynamic_L0 + enddo + enddo + + ! get poisson, P(dz/L0) + call poisson( nz, clubb_mf_nup, entf, enti, u(2:5)) + + ! get entrainment, ent=ent0/dz*P(dz/L0) + do i=1,clubb_mf_nup + do k=1,nz + ent(k,i) = real( enti(k,i))*clubb_mf_ent0/dzt(k) + enddo + enddo + end if + + do i=1,clubb_mf_nup + wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) + wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) + + upw(1,i) = 0.5_r8 * (wlv+wtv) + upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & + - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) + + upu(1,i) = u(1) + upv(1,i) = v(1) + + upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw + upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw + enddo + + facqtu=1._r8 + facthvu=1._r8 + if (scalesrf) then + ! scale surface fluxes + srfwqtu = 0._r8 + srfwthvu = 0._r8 + srfarea = 0._r8 + do i=1,clubb_mf_nup + srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) + srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) + srfarea = srfarea+upa(1,i) + end do + facqtu=srfarea*wqt/srfwqtu + facthvu=srfarea*wthv/srfwthvu + end if + + do i=1,clubb_mf_nup + + if (pupwind) then + betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) + upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + else + upqt(1,i)=qt(1)+facqtu*upqt(1,i) + upthv(1,i)=thv(1)+facthvu*upthv(1,i) + end if + upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) + upth(1,i) = upthl(1,i) + + ! get cloud, lowest momentum level + if (do_condensation) then + call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + upthv(1,i) = thvn + upqc(1,i) = qcn + upql(1,i) = qln + upqi(1,i) = qin + upqs(1,i) = qsn + upth(1,i) = thn + if (qcn > 0._r8) zcb(i) = zm(1) + else + ! assume no cldliq + upqc(1,i) = 0._r8 + end if + end do + + ! get updraft properties + do i=1,clubb_mf_nup + do k=1,nz-1 + + ! get microphysics, autoconversion + if (do_precip .and. upqc(k,i) > 0._r8) then + call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) + + supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair + else + supqt(k+1,i) = 0._r8 + supthl(k+1,i) = 0._r8 + end if + + ! integrate updraft + entexp = exp(-ent(k+1,i)*dzt(k+1)) + entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) + + qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) + thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) + un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu + vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu + + ! get cloud, momentum levels + if (do_condensation) then + call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + if (zcb(i).eq.zcb_unset .and. qcn > 0._r8) zcb(i) = zm(k+1) + else + thvn = thln*(1._r8+zvir*qtn) + end if + + ! get buoyancy + B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) + if (debug) then + if ( masterproc ) then + write(iulog,*) "B(k,i), k, i ", B, k, i + end if + end if + + ! get wn^2 + wp = wb*ent(k+1,i) + if (wp==0._r8) then + wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) + else + entw = exp(-2._r8*wp*dzt(k+1)) + wn2 = entw*upw(k,i)**2._r8+wa*B/(wb*ent(k+1,i))*(1._r8-entw) + end if + + if (wn2>0._r8) then + upw(k+1,i) = sqrt(wn2) + upthv(k+1,i) = thvn + upthl(k+1,i) = thln + upqt(k+1,i) = qtn + upqc(k+1,i) = qcn + upqs(k+1,i) = qsn + upu(k+1,i) = un + upv(k+1,i) = vn + upa(k+1,i) = upa(k,i) + upql(k+1,i) = qln + upqi(k+1,i) = qin + upqv(k+1,i) = qtn - qcn + uplmix(k+1,i)= lmixn + upth(k+1,i) = thn + upbuoy(k+1,i)= B + else + exit + end if + enddo + enddo + + ! downward sweep for rain evaporation, snow melting + if (do_precip) then + do i=1,clubb_mf_nup + do k=nz-1,1,-1 + ! get rain evaporation + if ((upqs(k,i) + upqs(k-1,i)).le.0._r8) then + qtovqs = 0._r8 + else + qtovqs = (upqt(k,i) + upqt(k-1,i))/(upqs(k,i) + upqs(k-1,i)) + end if + qtovqs = min(1._r8,qtovqs) + sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k+1,i),0._r8)) + + ! get rain rate + uprr(k,i) = uprr(k+1,i) & + - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) + + if (debug) then + if ( masterproc ) then + write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i + end if + end if + + ! update source terms + lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) + supqt(k,i) = supqt(k,i) + sevap + supthl(k,i) = supthl(k,i) - lmixt*sevap*iexner_zt(k)/cpair + end do + end do + end if + + ! writing updraft properties for output + do k=1,nz + + ! first sum over all i-updrafts + do i=1,clubb_mf_nup + if (upqc(k,i)>0._r8) then + moist_a(k) = moist_a(k) + upa(k,i) + moist_w(k) = moist_w(k) + upa(k,i)*upw(k,i) + moist_qt(k) = moist_qt(k) + upa(k,i)*upqt(k,i) + moist_thl(k) = moist_thl(k) + upa(k,i)*upthl(k,i) + moist_u(k) = moist_u(k) + upa(k,i)*upu(k,i) + moist_v(k) = moist_v(k) + upa(k,i)*upv(k,i) + moist_qc(k) = moist_qc(k) + upa(k,i)*upqc(k,i) + else + dry_a(k) = dry_a(k) + upa(k,i) + dry_w(k) = dry_w(k) + upa(k,i)*upw(k,i) + dry_qt(k) = dry_qt(k) + upa(k,i)*upqt(k,i) + dry_thl(k) = dry_thl(k) + upa(k,i)*upthl(k,i) + dry_u(k) = dry_u(k) + upa(k,i)*upu(k,i) + dry_v(k) = dry_v(k) + upa(k,i)*upv(k,i) + endif + enddo + + if ( dry_a(k) > 0._r8 ) then + dry_w(k) = dry_w(k) / dry_a(k) + dry_qt(k) = dry_qt(k) / dry_a(k) + dry_thl(k) = dry_thl(k) / dry_a(k) + dry_u(k) = dry_u(k) / dry_a(k) + dry_v(k) = dry_v(k) / dry_a(k) + else + dry_w(k) = 0._r8 + dry_qt(k) = 0._r8 + dry_thl(k) = 0._r8 + dry_u(k) = 0._r8 + dry_v(k) = 0._r8 + endif + + if ( moist_a(k) > 0._r8 ) then + moist_w(k) = moist_w(k) / moist_a(k) + moist_qt(k) = moist_qt(k) / moist_a(k) + moist_thl(k) = moist_thl(k) / moist_a(k) + moist_u(k) = moist_u(k) / moist_a(k) + moist_v(k) = moist_v(k) / moist_a(k) + moist_qc(k) = moist_qc(k) / moist_a(k) + else + moist_w(k) = 0._r8 + moist_qt(k) = 0._r8 + moist_thl(k) = 0._r8 + moist_u(k) = 0._r8 + moist_v(k) = 0._r8 + moist_qc(k) = 0._r8 + endif + + enddo + + do k=1,nz + do i=1,clubb_mf_nup + ae (k) = ae (k) - upa(k,i) + aw (k) = aw (k) + upa(k,i)*upw(k,i) + awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) + awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) + awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) + awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) + awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) + awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) + awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) + awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) + awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) + precc(k)= precc(k)+ upa(k,i)*uprr(k,i) + enddo + enddo + + awthl_conv = awthl + awqt_conv = awqt + awthv_conv = awthv + thl_env = thl + thl_env_zm = thl_zm + qt_env = qt + qt_env_zm = qt_zm + thv_env = thv + thv_env_zm = thv_zm + + kstart = 2 + if (scalesrf) then + kstart = 1 + end if + + if (pupwind) then + ! staggered environment values + + ! get thl & qt fluxes + betathl = (thl_env(4)-thl_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qt_env(4)-qt_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=kstart,nz-1 + thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k+1) + qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) + enddo + + ! get thv fluxes + betathl = (thv_env(4)-thv_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thv_env(1) = thv_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + do k=kstart,nz-1 + thvflx(k)= awthv_conv(k) - aw(k)*thv_env(k+1) + enddo + + ! get th & qv fluxes + thl_env = th + qt_env = qv + betathl = (th(4)-th(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qv(4)-qv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=kstart,nz-1 + thflx(k)= awth(k) - aw(k)*thl_env(k+1) + qvflx(k)= awqv(k) - aw(k)*qt_env(k+1) + enddo + + ! get qc fluxes + qt_env = qc + betaqt = (qc(4)-qc(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 + do k=kstart,nz-1 + qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) + enddo + + else + ! collocated environment values + do k=kstart,nz-1 + ! get thl & qt fluxes + thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) + qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) + + ! get thv flux + thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) + + ! get th & qv fluxes + thflx(k) = awth(k) - aw(k)*th_zm(k) + qvflx(k) = awqv(k) - aw(k)*qv_zm(k) + + ! get qc fluxes + qcflx(k) = awqc(k) - aw(k)*qc_zm(k) + end do + endif + + end if ! ( wthv > 0.0 ) + + end subroutine integrate_mf + + subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) + ! =============================================================================== ! + ! zero or one condensation for edmf: calculates thv and qc ! + ! =============================================================================== ! + use physconst, only: cpair, zvir, h2otrip + use wv_saturation, only : qsat + + real(r8),intent(in) :: qt,thl,p,iex + real(r8),intent(out):: thv,qc,th,ql,qi,qs,lmix + + !local variables + integer :: niter,i + real(r8) :: diff,t,qstmp,qcold,es,wf + logical :: noice = .true. + + ! max number of iterations + niter=50 + ! minimum difference + diff=2.e-5_r8 + + qc=0._r8 + t=thl/iex + + !by definition: + ! T = Th*Exner, Exner=(p/p0)^(R/cp) (1) + ! Thl = Th - L/cp*ql/Exner (2) + !so: + ! Th = Thl + L/cp*ql/Exner (3) + ! T = Th*Exner=(Thl+L/cp*ql/Exner)*Exner (4) + ! = Thl*Exner + L/cp*ql + do i=1,niter + + if (noice) then + wf = 1._r8 + else + wf = get_watf(t) + end if + t = thl/iex+get_alhl(wf)/cpair*qc !as in (4) + + ! qsat, p is in pascal (check!) + call qsat(t,p,es,qstmp) + qcold = qc + qc = max(0.5_r8*qc+0.5_r8*(qt-qstmp),0._r8) + if (abs(qc-qcold)tmax) then + get_watf=1._r8 + else if (tc qstar) then + ! get precip efficiency + tauwgt = (dzcld-zmin)/(zmax-zmin) + tauwgt = min(max(tauwgt,0._r8),1._r8) + tau = tauwgt/tau0 + + ! get source for updraft + Supqt = (qstar-qt)*(1._r8 - exp(-1._r8*tau*dz/w)) + else + Supqt = 0._r8 + end if + + end subroutine precip_mf + + subroutine poisson(nz,nup,lambda,poi,state) + !********************************************************************** + ! Set a unique (but reproduceble) seed for the kiss RNG + ! Call Poisson deviate + ! By Adam Herrington + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + integer, intent(in) :: nz,nup + real(r8), dimension(4), intent(in) :: state + real(r8), dimension(nz,nup), intent(in) :: lambda + integer, dimension(nz,nup), intent(out) :: poi + integer, dimension(1,4) :: tmpseed + integer :: i,j + type(ShrKissRandGen) :: kiss_gen + + ! Compute seed + tmpseed(1,1) = int((state(1) - int(state(1))) * 1000000000._r8) + tmpseed(1,2) = int((state(2) - int(state(2))) * 1000000000._r8) + tmpseed(1,3) = int((state(3) - int(state(3))) * 1000000000._r8) + tmpseed(1,4) = int((state(4) - int(state(4))) * 1000000000._r8) + + ! Set seed + kiss_gen = ShrKissRandGen(tmpseed) + + do i=1,nz + do j=1,nup + call knuth(kiss_gen,lambda(i,j),poi(i,j)) + enddo + enddo + + end subroutine poisson + + subroutine knuth(kiss_gen,lambda,kout) + !********************************************************************** + ! Discrete random poisson from Knuth + ! The Art of Computer Programming, v2, 137-138 + ! By Adam Herrington + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + type(ShrKissRandGen), intent(inout) :: kiss_gen + real(r8), intent(in) :: lambda + integer, intent(out) :: kout + + ! Local variables + real(r8), dimension(1,1) :: tmpuni + real(r8) :: puni, explam + integer :: k + + k = 0 + explam = exp(-1._r8*lambda) + puni = 1._r8 + do while (puni > explam) + k = k + 1 + call kiss_gen%random(tmpuni) + puni = puni*tmpuni(1,1) + end do + kout = k - 1 + + end subroutine knuth + + subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & + wa, do_condensation, do_precip, plumeheight ) + !********************************************************************** + ! Calculate a single plume with zero entrainment + ! to be used for a dynamic mixing length calculation + ! By Rachel Storer + !********************************************************************** + use physconst, only: cpair, gravit, zvir + + integer, intent(in) :: nz + real(r8), dimension(nz), intent(in) :: zm, dzt, iexner_zm, iexner_zt, & + p_zm, qt, thv, thl + real(r8), intent(in) :: wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, & + cwthv, zcb_unset, wa + logical, intent(in) :: do_condensation, do_precip + + real(r8), intent(inout) :: plumeheight + + !local variables + integer :: k + real(r8), parameter :: pent = 1.E-3_r8 + real(r8) :: thvn, qtn, thln, qcn, thn, qln, qin, qsn, lmixn, zcb, B, wn2, pentexp + real(r8), dimension(nz) :: upw, upa, upqt, upthv, upthl, upth, upqs, & + upqc, upql, upqi, supqt, supthl + + + upw(1) = 0.5_r8 * wmax + upa(1) = 0.5_r8 * erf( wmax/(sqrt(2._r8)*sigmaw) ) + + upqt(1) = cwqt * upw(1) * sigmaqt/sigmaw + upthv(1) = cwthv * upw(1) * sigmathv/sigmaw + + upqt(1) = qt(1)+upqt(1) + upthv(1) = thv(1)+upthv(1) + upthl(1) = upthv(1) / (1._r8+zvir*upqt(1)) + upth(1) = upthl(1) + + ! get cloud, lowest momentum level + if (do_condensation) then + call condensation_mf(upqt(1), upthl(1), p_zm(1), iexner_zm(1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + upthv(1) = thvn + upqc(1) = qcn + upql(1) = qln + upqi(1) = qin + upqs(1) = qsn + upth(1) = thn + if (qcn > 0._r8) zcb = zm(1) + else + ! assume no cldliq + upqc(1) = 0._r8 + end if + + do k=1,nz-1 + ! get microphysics, autoconversion + if (do_precip .and. upqc(k) > 0._r8) then + call precip_mf(upqs(k),upqt(k),upw(k),dzt(k+1),zm(k+1)-zcb,supqt(k+1)) + supthl(k+1) = -1._r8*lmixn*supqt(k+1)*iexner_zt(k+1)/cpair + else + supqt(k+1) = 0._r8 + supthl(k+1) = 0._r8 + end if + ! integrate updraft + pentexp = exp(-pent*dzt(k+1)) + qtn = qt(k+1) *(1._r8-pentexp ) + upqt (k)*pentexp + supqt(k+1) + thln = thl(k+1)*(1._r8-pentexp ) + upthl(k)*pentexp + supthl(k+1) + + !qtn = upqt (k) + supqt(k+1) + !thln = upthl(k) + supthl(k+1) + + ! get cloud, momentum levels + if (do_condensation) then + call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + if (zcb.eq.zcb_unset .and. qcn > 0._r8) zcb = zm(k+1) + else + thvn = thln*(1._r8+zvir*qtn) + end if + ! get buoyancy + B=gravit*(0.5_r8*(thvn + upthv(k))/thv(k+1)-1._r8) + + ! get wn^2 + wn2 = upw(k)**2._r8+2._r8*wa*B*dzt(k+1) + + if (wn2>0._r8) then + upw(k+1) = sqrt(wn2) + upthv(k+1) = thvn + upthl(k+1) = thln + upqt(k+1) = qtn + upqc(k+1) = qcn + upqs(k+1) = qsn + upa(k+1) = upa(k) + upql(k+1) = qln + upqi(k+1) = qin + upth(k+1) = thn + else + print*, 'L0 HEIGHT ', zm(k) + plumeheight = zm(k) + exit + end if + enddo + + end subroutine oneplume + +subroutine buoyan_dilute( nz ,nup ,dmpdz , & + q ,t ,p ,z ,pf , & + tp ,qstp ,tl ,cape ,cin , & + pblt ,lcl ,lel ,lon ,mx , & + msg ,tpert ,landfrac ) +!----------------------------------------------------------------------- +! +! Purpose: +! Calculates CAPE the lifting condensation level and the convective top +! where buoyancy is first -ve. +! +! Method: Calculates the parcel temperature based on a simple constant +! entraining plume model. CAPE is integrated from buoyancy. +! 09/09/04 - Simplest approach using an assumed entrainment rate for +! testing (dmpdp). +! 08/04/05 - Swap to convert dmpdz to dmpdp +! +! SCAM Logical Switches - DILUTE:RBN - Now Disabled +! --------------------- +! switch(1) = .T. - Uses the dilute parcel calculation to obtain tendencies. +! switch(2) = .T. - Includes entropy/q changes due to condensate loss and freezing. +! switch(3) = .T. - Adds the PBL Tpert for the parcel temperature at all levels. +! +! References: +! Raymond and Blythe (1992) JAS +! +! Author: +! Richard Neale - September 2004 +! +!----------------------------------------------------------------------- + implicit none +!----------------------------------------------------------------------- +! +! input arguments +! + integer, intent(in) :: nz ! vertical grid + integer, intent(in) :: nup ! number of plumes + +!+tht + !real(r8), intent(in), dimension(nz,nup) :: dmpdz ! Parcel fractional mass entrainment rate (/m) 3D + real(r8), intent(in) :: dmpdz(nz,nup) + !real(r8), intent(inout) :: dmpdz(nz,nup) +!-tht + + real(r8), intent(in) :: q(nz) ! spec. humidity + real(r8), intent(in) :: t(nz) ! temperature + real(r8), intent(in) :: p(nz) ! pressure + real(r8), intent(in) :: z(nz) ! height + real(r8), intent(in) :: pf(nz+1) ! pressure at interfaces + integer, intent(in) :: pblt ! index of pbl depth + real(r8), intent(in) :: tpert ! perturbation temperature by pbl processes + real(r8), intent(in) :: landfrac + +! +! output arguments +! + real(r8), intent(out) :: tp(nz,nup) ! parcel temperature + real(r8), intent(out) :: qstp(nz,nup) ! saturation mixing ratio of parcel (only above lcl, just q below). + real(r8), intent(out) :: tl(nup) ! parcel temperature at lcl + real(r8), intent(out) :: cape(nup) ! convective aval. pot. energy. + + real(r8), intent(out) :: cin (nup) !+tht: CIN + + integer, intent(out) :: lcl(nup) ! + integer, intent(out) :: lel(nup) ! + integer, intent(out) :: lon ! level of onset of deep convection + integer, intent(out) :: mx ! level of max moist static energy +! +!--------------------------Local Variables------------------------------ +! + integer lelten(nup,mf_num_cin) + real(r8) capeten(nup,mf_num_cin) ! provisional value of cape + real(r8) cinten(nup,mf_num_cin) !+tht provisional value of CIN + real(r8) tv(nz) + real(r8) tpv(nz,nup) + real(r8) buoy(nz,nup) + real(r8) pl(nup) + + real(r8) a1 + real(r8) a2 + real(r8) estp + real(r8) plexp + real(r8) hmax + real(r8) hmn + real(r8) y + + logical plge600(nup) + integer knt(nup) + + real(r8) e + + integer i + integer k + integer msg + integer n + + real(r8), parameter :: tiedke_add = 0.5_r8 +! +!----------------------------------------------------------------------- +! + do n = 1,mf_num_cin + do i = 1,nup + lelten(i,n) = 1 + capeten(i,n) = 0._r8 + cinten (i,n) = 0._r8 + end do + end do +! + lon = 1 + mx = lon + hmax = 0._r8 + + do i = 1,nup + knt(i) = 0 + lel(i) = 1 + cape(i) = 0._r8 + tp(:nz,i) = t(:nz) + qstp(:nz,i) = q(:nz) + end do + +!!! RBN - Initialize tv and buoy for output. +!!! tv=tv : tpv=tpv : qstp=q : buoy=0. + if (tht_tweaks) then +!+tht use system constants + tv (:nz) = t(:nz) *(1._r8+q(:nz)/epsilo)/ (1._r8+q(:nz)) !+tht + else + tv (:nz) = t(:nz) *(1._r8+1.608_r8*q(:nz))/ (1._r8+q(:nz)) + endif +!-tht + do i = 1,nup + tpv (:nz,i) = tv(:nz) + end do + buoy(:nz,:) = 0._r8 + +! +! set "launching" level(mx) to be at maximum moist static energy. +! search for this level stops at planetary boundary layer top. +! + do k = 1,msg-1 +!+tht: use total mse -- moist thermo + !hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) + hmn =(cpair+q(k)*cpliq)*t(k)/(1._r8+q(k)) + (1._r8+q(k)/epsilo)/(1._r8+q(k))*gravit*z(k) & + +(latvap-(cpliq-cpwv)*(t(k)-tmelt))*q(k) +!-tht + if (k <= pblt .and. k >= lon .and. hmn > hmax) then + hmax = hmn + mx = k + end if + end do + +! LCL dilute calculation - initialize to mx(i) +! Determine lcl in parcel_dilute and get pl,tl after parcel_dilute +! Original code actually sets LCL as level above wher condensate forms. +! Therefore in parcel_dilute lcl(i) will be at first level where qsmix < qtmix. + + do i = 1,nup ! Initialise LCL variables. + lcl(i) = mx + tl(i) = t(mx) + pl(i) = p(mx) + end do + +! +! main buoyancy calculation. +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!! DILUTE PLUME CALCULATION USING ENTRAINING PLUME !!! +!!! RBN 9/9/04 !!! + +!+tht: add geop.height in argument to allow enthalpy mixing + call parcel_dilute(nz, nup, msg, mx, p, z, t, q, & + tpert, tp, tpv, qstp, pl, tl, lcl, & + landfrac, dmpdz) +!-tht + + +! If lcl is above the nominal level of non-divergence (600 mbs), +! no deep convection is permitted (ensuing calculations +! skipped and cape retains initialized value of zero). +! + do i = 1,nup + plge600(i) = pl(i).ge.600._r8 ! Just change to always allow buoy calculation. + end do + +! +! Main buoyancy calculation. +! + do k = 1,msg-1 + do i=1,nup + if (k >= mx .and. plge600(i)) then ! Define buoy from launch level to cloud top. + if (tht_tweaks) then + tv(k) = t(k)* (1._r8+q(k)/epsilo)/ (1._r8+q(k)) !+tht + else + tv(k) = t(k)* (1._r8+1.608_r8*q(k))/ (1._r8+q(k)) !orig + endif +! +0.5K or not? (arbitrary at this point - introduce in parcel_dilute instead? tht) + buoy(k,i) = tpv(k,i) - tv(k) + tiedke_add ! +0.5K or not? + else + qstp(k,i) = q(k) + tp(k,i) = t(k) + tpv(k,i) = tv(k) + endif + end do + end do + +!------------------------------------------------------------------------------- +! beginning from one below top (first level p>40hPa, msg) check for at most +! num_cin levels of neutral buoyancy (LELten) and compute CAPEten between LCL +! and those (tht) + do k = msg-2,1,-1 + do i = 1,nup + if (k > lcl(i) .and. plge600(i)) then + if (buoy(k-1,i) > 0._r8 .and. buoy(k,i) <= 0._r8) then + knt(i) = min(mf_num_cin,knt(i) + 1) + lelten(i,knt(i)) = k + end if + end if + end do + end do + +! calculate convective available potential energy (cape). + do n = 1,mf_num_cin + do k = msg-1,1,-1 + do i = 1,nup + if (plge600(i) .and. k >= mx .and. k < lelten(i,n)) then + !capeten(i,n) = capeten(i,n) + rair*buoy(k,i)*log(pf(k-1)/pf(k)) + capeten(i,n) = capeten(i,n) + rair*buoy(k,i)*log(pf(k)/pf(k+1)) +!+tht also compute total CIN + !cinten (i,n) = cinten (i,n) - rair*min(buoy(k,i),0._r8)*log(pf(k-1)/pf(k)) + cinten (i,n) = cinten (i,n) - rair*min(buoy(k,i),0._r8)*log(pf(k)/pf(k+1)) +!-tht + end if + end do + end do + end do + +! +! find maximum cape from all possible tentative capes from +! one sounding, +! and use it as the final cape, april 26, 1995 +! + do n = 1,mf_num_cin + do i = 1,nup + if (capeten(i,n) > cape(i)) then + cape(i) = capeten(i,n) + cin (i) = cinten (i,n) !+tht CIN + lel(i) = lelten(i,n) + end if + end do + end do +! +! put lower bound on cape for diagnostic purposes. +! + do i = 1,nup + cape(i) = max(cape(i), 0._r8) + end do +! + return +end subroutine buoyan_dilute + +!+tht + subroutine parcel_dilute (nz, nup, msg, klaunch, p, z, t, q, & + tpert, tp, tpv, qstp, pl, tl, lcl, & + landfrac, dmpdz) +!-tht + +! Routine to determine +! 1. Tp - Parcel temperature +! 2. qstp - Saturated mixing ratio at the parcel temperature. + +!-------------------- +implicit none +!-------------------- + +integer, intent(in) :: nz +integer, intent(in) :: nup +integer, intent(in) :: msg +integer, intent(in) :: klaunch + +real(r8), intent(in) :: tpert ! PBL temperature perturbation. +real(r8), intent(in) :: landfrac +real(r8), intent(in), dimension(nz) :: p +!+tht +real(r8), intent(in), dimension(nz) :: z +!-tht +real(r8), intent(in), dimension(nz) :: t +real(r8), intent(in), dimension(nz) :: q + +real(r8), intent(inout), dimension(nz,nup) :: tp ! Parcel temp. +real(r8), intent(inout), dimension(nz,nup) :: qstp ! Parcel water vapour (sat value above lcl). +real(r8), intent(inout), dimension(nup) :: tl ! Actual temp of LCL. +real(r8), intent(inout), dimension(nup) :: pl ! Actual pressure of LCL. +integer, intent(inout), dimension(nup) :: lcl ! Lifting condesation level (first model level with saturation). + +real(r8), intent(out), dimension(nz,nup) :: tpv ! Define tpv within this routine. + +!+tht +!real(r8), dimension(pcols) :: dmpdz ! Parcel fractional mass entrainment rate (/m) 2D + real(r8), dimension(nz,nup) :: dmpdz ! Parcel fractional mass entrainment rate (/m) 3D +!-tht + +!-------------------- + +! Have to be careful as s is also dry static energy. +!+tht +! in the mods below, s is used both as enthalpy (moist s.e.) and entropy +!-tht + +! If we are to retain the fact that CAM loops over grid-points in the internal +! loop then we need to dimension sp,atp,mp,xsh2o with ncol. + + +real(r8) tmix(nz,nup) ! Tempertaure of the entraining parcel. +real(r8) qtmix(nz,nup) ! Total water of the entraining parcel. +real(r8) qsmix(nz,nup) ! Saturated mixing ratio at the tmix. +real(r8) smix(nz,nup) ! Entropy of the entraining parcel. +real(r8) xsh2o(nz,nup) ! Precipitate lost from parcel. +real(r8) ds_xsh2o(nz,nup) ! Entropy change due to loss of condensate. +real(r8) ds_freeze(nz,nup) ! Entropy change sue to freezing of precip. +real(r8) dmpdz2d(nz,nup) ! variable detrainment rate + +!+tht +real(r8) zl(nup) ! lcl +!-tht + +real(r8) mp(nup) ! Parcel mass flux. +real(r8) qtp(nup) ! Parcel total water. +real(r8) sp(nup) ! Parcel entropy. + +real(r8) sp0(nup) ! Parcel launch entropy. +real(r8) qtp0(nup) ! Parcel launch total water. +real(r8) mp0(nup) ! Parcel launch relative mass flux. + +real(r8) lwmax ! Maximum condesate that can be held in cloud before rainout. +real(r8) dmpdp ! Parcel fractional mass entrainment rate (/mb). +!real(r8) dmpdpc ! In cloud parcel mass entrainment rate (/mb). +!real(r8) dmpdz ! Parcel fractional mass entrainment rate (/m) +real(r8) dpdz,dzdp ! Hydrstatic relation and inverse of. +real(r8) senv ! Environmental entropy at each grid point. +real(r8) qtenv ! Environmental total water " " ". +real(r8) penv ! Environmental total pressure " " ". +!+tht +real(r8) zenv +!-tht +real(r8) tenv ! Environmental total temperature " " ". +real(r8) new_s ! Hold value for entropy after condensation/freezing adjustments. +real(r8) new_q ! Hold value for total water after condensation/freezing adjustments. +real(r8) dp ! Layer thickness (center to center) +real(r8) tfguess ! First guess for entropy inversion - crucial for efficiency! +real(r8) tscool ! Super cooled temperature offset (in degC) (eg -35). + +real(r8) qxsk, qxskp1 ! LCL excess water (k, k+1) +real(r8) dsdp, dqtdp, dqxsdp ! LCL s, qt, p gradients (k, k+1) +real(r8) slcl,qtlcl,qslcl ! LCL s, qt, qs values. +real(r8) dmpdz_lnd, dmpdz_mask + +integer rcall ! Number of ientropy call for errors recording +integer nit_lheat ! Number of iterations for condensation/freezing loop. +integer i,k,ii ! Loop counters. + +real(r8) est +!====================================================================== +! SUMMARY +! +! 9/9/04 - Assumes parcel is initiated from level of maxh (klaunch) +! and entrains at each level with a specified entrainment rate. +! +! 15/9/04 - Calculates lcl(i) based on k where qsmix is first < qtmix. +! +!====================================================================== +! +! Set some values that may be changed frequently. +! + +nit_lheat = 2 ! iterations for ds,dq changes from condensation freezing. + +!+tht should not be necessary but for bit-reproducibility it turns out it is + !if (.not.tht_tweaks) then + ! dmpdz =-1.e-3_r8 ! Entrainment rate. (-ve for /m) + ! dmpdz_lnd=-1.e-3_r8 ! idem, on land + !endif +!-tht + +!dmpdpc = 3.e-2_r8 ! In cloud entrainment rate (/mb). + + lwmax = 1.e-3_r8 ! Need to put formula in for this. + tscool = 0.0_r8 ! Temp at which water loading freezes in the cloud. +!+tht +!lwmax = 1.e10_r8 ! tht: don't precipitate +!tscool =-10._r8 ! tht: allow even just mild supercooling?! +!-tht + +qtmix=0._r8 +smix=0._r8 + +qtenv = 0._r8 +senv = 0._r8 +tenv = 0._r8 +penv = 0._r8 +!+tht +zenv = 0._r8 +!-tht + +qtp0 = 0._r8 +sp0 = 0._r8 +mp0 = 0._r8 + +qtp = 0._r8 +sp = 0._r8 +mp = 0._r8 + +new_q = 0._r8 +new_s = 0._r8 + +zl(:)=0._r8 + +! **** Begin loops **** + +do k = 1,msg-1 + do i=1,nup + +! Initialize parcel values at launch level. + + if (k == klaunch) then + qtp0(i) = q(k) ! Parcel launch total water (assuming subsaturated) - OK????. + +!+tht: formulate dilution on enthalpy not on entropy + if (tht_tweaks) then + sp0(i) = enthalpy(t(k),p(k),qtp0(i),z(k)) ! Parcel launch enthalpy. + else + sp0(i) = entropy (t(k),p(k),qtp0(i)) ! Parcel launch entropy. + endif +!-tht + mp0(i) = 1._r8 ! Parcel launch relative mass (=1 for dmpdp=0 i.e. undilute). + smix(k,i) = sp0(i) + qtmix(k,i) = qtp0(i) +!+tht: since the function to invert for T is *identical* with sp0(i)=entropy(t), unless there is +! a coding error (likely, given the mess) the result must be t(i,k) (verified 21/2/2014) + if (tht_tweaks) then + tmix(k,i) = t(k) + call qsat_hPa(tmix(k,i),p(k), est, qsmix(k,i)) + else + tfguess = t(k) + rcall = 1 + call ientropy (rcall,smix(k,i),p(k),qtmix(k,i),tmix(k,i),qsmix(k,i),tfguess) + endif +!-tht + end if + +! Entraining levels + + if (k > klaunch) then + +! Set environmental values for this level. + + dp = (p(k)-p(k-1)) ! In -ve mb as p decreasing with height - difference between center of layers. + qtenv = 0.5_r8*(q(k)+q(k-1)) ! Total water of environment. + tenv = 0.5_r8*(t(k)+t(k-1)) + penv = 0.5_r8*(p(k)+p(k-1)) +!+tht + zenv = 0.5_r8*(z(k)+z(k-1)) +!-tht + +!+tht: base plume dilution on enthalpy not on entropy + if (tht_tweaks) then + senv = enthalpy(tenv,penv,qtenv,zenv) ! Enthalpy of environment. + else + senv = entropy (tenv,penv,qtenv) ! Entropy of environment. + endif +!-tht + +! Determine fractional entrainment rate /pa given value /m. + + dpdz = -(penv*gravit)/(rair*tenv) ! in mb/m since p in mb. + dzdp = 1._r8/dpdz ! in m/mb +!+tht +! NB: land fudge makes no sense to me - make dmpdz_lnd=dmpdz (as per default code, hard-wired to 1e-3) + !dmpdp = dmpdz*dzdp + !dmpdp = dmpdz(i)*dzdp ! /mb Fractional entrainment 2D + dmpdp = dmpdz(k,i)*dzdp ! /mb Fractional entrainment 3D +!-tht + +! Sum entrainment to current level +! entrains q,s out of intervening dp layers, in which linear variation is assumed +! so really it entrains the mean of the 2 stored values. + + sp(i) = sp(i) - dmpdp*dp*senv + qtp(i) = qtp(i) - dmpdp*dp*qtenv + mp(i) = mp(i) - dmpdp*dp + +! Entrain s and qt to next level. + + smix(k,i) = (sp0(i) + sp(i)) / (mp0(i) + mp(i)) + qtmix(k,i) = (qtp0(i) + qtp(i)) / (mp0(i) + mp(i)) + +! Invert entropy from s and q to determine T and saturation-capped q of mixture. +! t(i,k) used as a first guess so that it converges faster. + + tfguess = tmix(k-1,i) + rcall = 2 +!+tht + if (tht_tweaks) then + call ienthalpy(rcall,smix(k,i),p(k),z(k),qtmix(k,i),tmix(k,i),qsmix(k,i),tfguess) + else + call ientropy (rcall,smix(k,i),p(k),qtmix(k,i),tmix(k,i),qsmix(k,i),tfguess) + endif +!-tht + +! +! Determine if this is lcl of this column if qsmix <= qtmix. +! FIRST LEVEL where this happens on ascending. + if (qsmix(k,i) <= qtmix(k,i) .and. qsmix(k-1,i) > qtmix(k-1,i)) then + lcl(i) = k + qxsk = qtmix(k,i) - qsmix(k,i) + qxskp1 = qtmix(k-1,i) - qsmix(k-1,i) + dqxsdp = (qxsk - qxskp1)/dp + pl(i) = p(k-1) - qxskp1/dqxsdp ! pressure level of actual lcl. +!+tht + zl(i) = z(k-1) - qxskp1/dqxsdp *dzdp +!-tht + dsdp = (smix(k,i) - smix(k-1,i))/dp + dqtdp = (qtmix(k,i) - qtmix(k-1,i))/dp + slcl = smix(k-1,i) + dsdp* (pl(i)-p(k-1)) + qtlcl = qtmix(k-1,i) + dqtdp*(pl(i)-p(k-1)) + + tfguess = tmix(k,i) + rcall = 3 +!+tht + if (tht_tweaks) then + call ienthalpy(rcall,slcl,pl(i),zl(i),qtlcl,tl(i),qslcl,tfguess) + else + call ientropy (rcall,slcl,pl(i),qtlcl,tl(i),qslcl,tfguess) + endif +!-tht + +! write(iulog,*)' ' +! write(iulog,*)' p',p(i,k+1),pl(i),p(i,lcl(i)) +! write(iulog,*)' t',tmix(i,k+1),tl(i),tmix(i,lcl(i)) +! write(iulog,*)' s',smix(i,k+1),slcl,smix(i,lcl(i)) +! write(iulog,*)'qt',qtmix(i,k+1),qtlcl,qtmix(i,lcl(i)) +! write(iulog,*)'qs',qsmix(i,k+1),qslcl,qsmix(i,lcl(i)) + + endif +! + end if ! k < klaunch + + + end do ! Levels loop +end do ! Columns loop + +!+++ARH +! if ( masterproc ) then +! do k = 1,msg-1 +! do i = 1,nup +! write(iulog,*) "after, k, nup, dmpdz ", k, i, dmpdz(k,i) +! end do +! end do +! end if +!---ARH + +!!!!!!!!!!!!!!!!!!!!!!!!!!END ENTRAINMENT LOOP!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +!! Could stop now and test with this as it will provide some estimate of buoyancy +!! without the effects of freezing/condensation taken into account for tmix. + +!! So we now have a profile of entropy and total water of the entraining parcel +!! Varying with height from the launch level klaunch parcel=environment. To the +!! top allowed level for the existence of convection. + +!! Now we have to adjust these values such that the water held in vaopor is < or +!! = to qsmix. Therefore, we assume that the cloud holds a certain amount of +!! condensate (lwmax) and the rest is rained out (xsh2o). This, obviously +!! provides latent heating to the mixed parcel and so this has to be added back +!! to it. But does this also increase qsmix as well? Also freezing processes + + +xsh2o = 0._r8 +ds_xsh2o = 0._r8 +ds_freeze = 0._r8 + +!!!!!!!!!!!!!!!!!!!!!!!!!PRECIPITATION/FREEZING LOOP!!!!!!!!!!!!!!!!!!!!!!!!!! +!! Iterate solution twice for accuracy + + + +do k = 1, msg-1 + do i=1,nup + +! Initialize variables at k=klaunch + + if (k == klaunch) then + +! Set parcel values at launch level assume no liquid water. + + tp(k,i) = tmix(k,i) + qstp(k,i) = q(k) + if (tht_tweaks) then + tpv(k,i) = (tp(k,i) + tpert) * (1._r8+qstp(k,i)/epsilo) / (1._r8+qstp(k,i)) !+tht OK with mx ratio + else + tpv(k,i) = (tp(k,i) + tpert) * (1._r8+1.608_r8*qstp(k,i)) / (1._r8+qstp(k,i)) + endif + + end if + + if (k > klaunch) then + + if (tht_tweaks) then + smix(k,i)=entropy(tmix(k,i),p(k),qtmix(k,i)) !+tht make sure to use entropy here + endif + +!---- +! Initiate loop if switch(2) = .T. - RBN:DILUTE - TAKEN OUT BUT COULD BE RETURNED LATER. +! Iterate nit_lheat times for s,qt changes. + do ii=0,nit_lheat-1 + +! Rain (xsh2o) is excess condensate, bar LWMAX (Accumulated loss from qtmix). + xsh2o(k,i) = max (0._r8, qtmix(k,i) - qsmix(k,i) - lwmax) + +! Contribution to ds from precip loss of condensate (Accumulated change from smix).(-ve) + ds_xsh2o(k,i) = ds_xsh2o(k-1,i) - cpliq * log (tmix(k,i)/tmelt) * max(0._r8,(xsh2o(k,i)-xsh2o(k-1,i))) +! +! Entropy of freezing: latice times amount of water involved divided by T. +! + if (tmix(k,i) <= tmelt+tscool .and. ds_freeze(k-1,i) == 0._r8) then ! One off freezing of condensate. + ds_freeze(k,i) = (latice/tmix(k,i)) * max(0._r8,qtmix(k,i)-qsmix(k,i)-xsh2o(k,i)) ! Gain of LH + end if + + if (tmix(k,i) <= tmelt+tscool .and. ds_freeze(k-1,i) /= 0._r8) then ! Continual freezing of additional condensate. + ds_freeze(k,i) = ds_freeze(k-1,i)+(latice/tmix(k,i)) * max(0._r8,(qsmix(k-1,i)-qsmix(k,i))) + end if + +! Adjust entropy and accordingly to sum of ds (be careful of signs). + new_s = smix(k,i) + ds_xsh2o(k,i) + ds_freeze(k,i) + +! Adjust liquid water and accordingly to xsh2o. + new_q = qtmix(k,i) - xsh2o(k,i) + +! Invert entropy to get updated Tmix and qsmix of parcel. + + tfguess = tmix(k,i) + rcall =4 + call ientropy (rcall,new_s, p(k), new_q, tmix(k,i), qsmix(k,i), tfguess) + + end do ! Iteration loop for freezing processes. + +! tp - Parcel temp is temp of mixture. +! tpv - Parcel v. temp should be density temp with new_q total water. + + tp(k,i) = tmix(k,i) + +! tpv = tprho in the presence of condensate (i.e. when new_q > qsmix) + if (new_q > qsmix(k,i)) then ! Super-saturated so condensate present - reduces buoyancy. + qstp(k,i) = qsmix(k,i) + else ! Just saturated/sub-saturated - no condensate virtual effects. + qstp(k,i) = new_q + end if + + if (tht_tweaks) then + tpv(k,i) = (tp(k,i)+tpert)* (1._r8+qstp(k,i)/epsilo) / (1._r8+ new_q) !+tht + else + tpv(k,i) = (tp(k,i)+tpert)* (1._r8+1.608_r8*qstp(k,i)) / (1._r8+ new_q) + endif + + end if ! k > klaunch + + end do ! Loop for columns + +end do ! Loop for vertical levels. + + +return +end subroutine parcel_dilute + +!----------------------------------------------------------------------------------------- +real(r8) function entropy(TK,p,qtot) +!----------------------------------------------------------------------------------------- +! +! TK(K),p(mb),qtot(kg/kg) +! from Raymond and Blyth 1992 +! + real(r8), intent(in) :: p,qtot,TK + real(r8) :: qv,qst,e,est,L + real(r8), parameter :: pref = 1000._r8 + +L = latvap - (cpliq - cpwv)*(TK-tmelt) ! T IN CENTIGRADE + +call qsat_hPa(TK, p, est, qst) + +qv = min(qtot,qst) ! Partition qtot into vapor part only. +e = qv*p / (epsilo +qv) + +entropy = (cpair + qtot*cpliq)*log( TK/tmelt) - rair*log( (p-e)/pref ) + & + L*qv/TK - qv*rh2o*log(qv/qst) + +end FUNCTION entropy + +! +!----------------------------------------------------------------------------------------- +SUBROUTINE ientropy (rcall,s,p,qt,T,qst,Tfg) +!----------------------------------------------------------------------------------------- +! +! p(mb), Tfg/T(K), qt/qv(kg/kg), s(J/kg). +! Inverts entropy, pressure and total water qt +! for T and saturated vapor mixing ratio +! + + integer, intent(in) :: rcall + real(r8), intent(in) :: s, p, Tfg, qt + real(r8), intent(out) :: qst, T + real(r8) :: est + real(r8) :: a,b,c,d,ebr,fa,fb,fc,pbr,qbr,rbr,sbr,tol1,xm,tol + integer :: i + + logical :: converged + + ! Max number of iteration loops. + integer, parameter :: LOOPMAX = 100 + real(r8), parameter :: EPS = 3.e-8_r8 + + converged = .false. + + ! Invert the entropy equation -- use Brent's method + ! Brent, R. P. Ch. 3-4 in Algorithms for Minimization Without Derivatives. Englewood Cliffs, NJ: Prentice-Hall, 1973. + + T = Tfg ! Better first guess based on Tprofile from conv. + + a = Tfg-10 !low bracket + b = Tfg+10 !high bracket + + fa = entropy(a, p, qt) - s + fb = entropy(b, p, qt) - s + + c=b + fc=fb + tol=0.001_r8 + + converge: do i=0, LOOPMAX + if ((fb > 0.0_r8 .and. fc > 0.0_r8) .or. & + (fb < 0.0_r8 .and. fc < 0.0_r8)) then + c=a + fc=fa + d=b-a + ebr=d + end if + if (abs(fc) < abs(fb)) then + a=b + b=c + c=a + fa=fb + fb=fc + fc=fa + end if + + tol1=2.0_r8*EPS*abs(b)+0.5_r8*tol + xm=0.5_r8*(c-b) + converged = (abs(xm) <= tol1 .or. fb == 0.0_r8) + if (converged) exit converge + + if (abs(ebr) >= tol1 .and. abs(fa) > abs(fb)) then + sbr=fb/fa + if (a == c) then + pbr=2.0_r8*xm*sbr + qbr=1.0_r8-sbr + else + qbr=fa/fc + rbr=fb/fc + pbr=sbr*(2.0_r8*xm*qbr*(qbr-rbr)-(b-a)*(rbr-1.0_r8)) + qbr=(qbr-1.0_r8)*(rbr-1.0_r8)*(sbr-1.0_r8) + end if + if (pbr > 0.0_r8) qbr=-qbr + pbr=abs(pbr) + if (2.0_r8*pbr < min(3.0_r8*xm*qbr-abs(tol1*qbr),abs(ebr*qbr))) then + ebr=d + d=pbr/qbr + else + d=xm + ebr=d + end if + else + d=xm + ebr=d + end if + a=b + fa=fb + b=b+merge(d,sign(tol1,xm), abs(d) > tol1 ) + + fb = entropy(b, p, qt) - s + + end do converge + + T = b + call qsat_hPa(T, p, est, qst) + + if (.not. converged) then + call endrun('**** ZM_CONV IENTROPY: Tmix did not converge ****') + end if + +100 format (A,I1,I4,I4,7(A,F6.2)) + +end SUBROUTINE ientropy + +! Wrapper for qsat_water that does translation between Pa and hPa +! qsat_water uses Pa internally, so get it right, need to pass in Pa. +! Afterward, set es back to hPa. +elemental subroutine qsat_hPa(t, p, es, qm) + use wv_saturation, only: qsat_water + + ! Inputs + real(r8), intent(in) :: t ! Temperature (K) + real(r8), intent(in) :: p ! Pressure (hPa) + ! Outputs + real(r8), intent(out) :: es ! Saturation vapor pressure (hPa) + real(r8), intent(out) :: qm ! Saturation mass mixing ratio + ! (vapor mass over dry mass, kg/kg) + + call qsat_water(t, p*100._r8, es, qm) + + es = es*0.01_r8 + +end subroutine qsat_hPa + +!----------------------------------------------------------------------------------------- +real(r8) function enthalpy(TK,p,qtot,z) +!----------------------------------------------------------------------------------------- +! +! TK(K),p(mb),qtot(kg/kg) +! + real(r8), intent(in) :: p,qtot,TK,z + real(r8) :: qv,qst,e,est,L + +L = latvap - (cpliq - cpwv)*(TK-tmelt) + +call qsat_hPa(TK, p, est, qst) +qv = min(qtot,qst) ! Partition qtot into vapor part only. + +!enthalpy = (cpres + qtot*cpliq)*(TK-tfreez) + L*qv + (1._r8+qtot)*grav*z + enthalpy = (cpair + qtot*cpliq)* TK + L*qv + (1._r8+qtot)*gravit*z + +return +end FUNCTION enthalpy + +!----------------------------------------------------------------------------------------- + SUBROUTINE ienthalpy (rcall,s,p,z,qt,T,qst,Tfg) !identical with iENTROPY, only function calls swapped +!----------------------------------------------------------------------------------------- +! +! p(mb), Tfg/T(K), qt/qv(kg/kg), s(J/kg). +! Inverts entropy, pressure and total water qt +! for T and saturated vapor mixing ratio +! + + integer, intent(in) :: rcall + real(r8), intent(in) :: s, p, z, Tfg, qt + real(r8), intent(out) :: qst, T + real(r8) :: est + real(r8) :: a,b,c,d,ebr,fa,fb,fc,pbr,qbr,rbr,sbr,tol1,xm,tol + integer :: i + + logical :: converged + + ! Max number of iteration loops. + integer, parameter :: LOOPMAX = 100 + real(r8), parameter :: EPS = 3.e-8_r8 + + converged = .false. + + ! Invert the entropy equation -- use Brent's method + ! Brent, R. P. Ch. 3-4 in Algorithms for Minimization Without Derivatives. Englewood Cliffs, NJ: Prentice-Hall, 1973. + + T = Tfg ! Better first guess based on Tprofile from conv. + + a = Tfg-10 !low bracket + b = Tfg+10 !high bracket + + fa = enthalpy(a, p, qt,z) - s + fb = enthalpy(b, p, qt,z) - s + + c=b + fc=fb + tol=0.001_r8 + + converge: do i=0, LOOPMAX + if ((fb > 0.0_r8 .and. fc > 0.0_r8) .or. & + (fb < 0.0_r8 .and. fc < 0.0_r8)) then + c=a + fc=fa + d=b-a + ebr=d + end if + if (abs(fc) < abs(fb)) then + a=b + b=c + c=a + fa=fb + fb=fc + fc=fa + end if + + tol1=2.0_r8*EPS*abs(b)+0.5_r8*tol + xm=0.5_r8*(c-b) + converged = (abs(xm) <= tol1 .or. fb == 0.0_r8) + if (converged) exit converge + + if (abs(ebr) >= tol1 .and. abs(fa) > abs(fb)) then + sbr=fb/fa + if (a == c) then + pbr=2.0_r8*xm*sbr + qbr=1.0_r8-sbr + else + qbr=fa/fc + rbr=fb/fc + pbr=sbr*(2.0_r8*xm*qbr*(qbr-rbr)-(b-a)*(rbr-1.0_r8)) + qbr=(qbr-1.0_r8)*(rbr-1.0_r8)*(sbr-1.0_r8) + end if + if (pbr > 0.0_r8) qbr=-qbr + pbr=abs(pbr) + if (2.0_r8*pbr < min(3.0_r8*xm*qbr-abs(tol1*qbr),abs(ebr*qbr))) then + ebr=d + d=pbr/qbr + else + d=xm + ebr=d + end if + else + d=xm + ebr=d + end if + a=b + fa=fb + b=b+merge(d,sign(tol1,xm), abs(d) > tol1 ) + + fb = enthalpy(b, p, qt,z) - s + + end do converge + + T = b + call qsat_hPa(T, p, est, qst) + + if (.not. converged) then + call endrun('**** ZM_CONV IENTHALPY: Tmix did not converge ****') + end if + +100 format (A,I1,I4,I4,7(A,F6.2)) + + end SUBROUTINE ienthalpy + +!++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +end module clubb_mf From c1f059b7e61432d4573db7f9f660cadea865ea78 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 11 Aug 2021 18:26:45 -0600 Subject: [PATCH 028/466] added -phys cam64 option --- bld/build-namelist | 8 +- bld/config_files/definition.xml | 4 +- bld/configure | 13 +- cime_config/config_component.xml | 5 +- cime_config/config_compsets.xml | 5 + src/physics/camdev/check_energy.F90 | 1004 ++++++ src/physics/camdev/physpkg.F90 | 2887 ++++++++++++++++ src/physics/camdev/zm_conv.F90 | 4995 +++++++++++++++++++++++++++ src/physics/camdev/zm_conv_intr.F90 | 1405 ++++++++ 9 files changed, 10321 insertions(+), 5 deletions(-) create mode 100644 src/physics/camdev/check_energy.F90 create mode 100644 src/physics/camdev/physpkg.F90 create mode 100644 src/physics/camdev/zm_conv.F90 create mode 100644 src/physics/camdev/zm_conv_intr.F90 diff --git a/bld/build-namelist b/bld/build-namelist index d5d58e18a8..e4e44079c7 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -316,6 +316,12 @@ if ($print>=2) { print "Using namelist defaults file $nl_defaults_file$eol"; } my $defaults = Build::NamelistDefaults->new($nl_defaults_file, $cfg); +# CAMDEV +my $phys_check = $cfg->get('phys'); +if ($phys_check eq 'cam64') { + $cfg->set('phys', 'cam6'); + } + #----------------------------------------------------------------------------------------------- # Similarly to the namelist definition and defaults files, the use case file # may also come from the usr_src directories. Determine the location of the @@ -2731,7 +2737,7 @@ if (defined $cam_physpkg) { "This variable is set by build-namelist based on information\n". "from the configure cache file.\n"; } -$cam_physpkg = "'" . "$phys" . "'"; # add quotes to this string value +$cam_physpkg = "'" . "$phys_check" . "'"; # add quotes to this string value $nl->set_variable_value('phys_ctl_nl', 'cam_physpkg', $cam_physpkg); my $use_simple_phys = $nl->get_value('use_simple_phys'); diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index ba0550dd09..edcc8515fb 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -52,8 +52,8 @@ Option to turn on waccmx thermosphere/ionosphere extension: 0 => no, 1 => yes Ionosphere model used in WACCMX. - -Physics package: cam3, cam4, cam5, cam6, held_suarez, adiabatic, kessler, tj2016, spcam_sam1mom, spcam_m2005. + +Physics package: cam3, cam4, cam5, cam6, cam64, held_suarez, adiabatic, kessler, tj2016, spcam_sam1mom, spcam_m2005. Microphysics package: rk (Rasch and Kristjansson), mg1 (Morrison and diff --git a/bld/configure b/bld/configure index 5dbe6152a1..ef263c4114 100755 --- a/bld/configure +++ b/bld/configure @@ -96,7 +96,7 @@ OPTIONS -pbl Specify the PBL option [uw | hb | hbr]. -pcols Set maximum number of columns in a chunk to . -pergro Switch enables building CAM for perturbation growth tests. - -phys Physics option [cam3 | cam4 | cam5 | cam6 | + -phys Physics option [cam3 | cam4 | cam5 | cam6 | cam64 | held_suarez | adiabatic | kessler | tj2016 | spcam_sam1mom | spcam_m2005]. Default: cam6 -prog_species Comma-separate list of prognostic mozart species packages. @@ -565,6 +565,13 @@ if ($phys_pkg =~ m/^adiabatic$|^held_suarez$|^kessler$|^tj2016$/) { $simple_phys = 1; } +# Set flag to indicate a camdev physics option +my $camdev_phys = 0; +if ($phys_pkg eq 'cam64') { + $camdev_phys = 1; + $phys_pkg = 'cam6'; + } + #----------------------------------------------------------------------------------------------- # Chemistry package @@ -2100,6 +2107,10 @@ sub write_filepath print $fh "$camsrcdir/src/unit_drivers\n"; print $fh "$camsrcdir/src/unit_drivers/${offline_drv}\n"; + if ($camdev_phys) { + print $fh "$camsrcdir/src/physics/camdev\n"; + } + if ($simple_phys) { print $fh "$camsrcdir/src/physics/simple\n"; print $fh "$camsrcdir/src/atmos_phys/kessler\n"; diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 8ac578b80d..15e6407d0c 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -12,7 +12,7 @@ CAM cam5 physics: CAM cam4 physics: CAM cam3 physics: - CAM simplified and non-versioned physics : + CAM simplified and non-versioned physics : + CAM development physics: CAM-Chem troposphere/stratosphere chemistry with simplified VBS-SOA: CAM-Chem troposphere/stratosphere chemistry with simplified VBS-SOA and expanded isoprene and terpene oxidation: CAM-Chem troposphere/stratosphere chem with simplified volatility basis set SOA scheme and fire emissons : @@ -122,6 +123,7 @@ -phys cam6 + -phys cam64 -chem trop_strat_mam4_vbs -chem trop_strat_mam4_vbsext @@ -199,6 +201,7 @@ 2000_cam4_trop_chem waccmxie_ma_2000_cam4 + 2000_cam6 2000_cam6 waccm_tsmlt_2000_cam6 waccm_ma_2000_cam6 diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 1e6c35500a..336538afd9 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -223,6 +223,11 @@ HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV_BGC%BDRD + + F2000dev + 2000_CAM%DEV_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV + + diff --git a/src/physics/camdev/check_energy.F90 b/src/physics/camdev/check_energy.F90 new file mode 100644 index 0000000000..6fd157628f --- /dev/null +++ b/src/physics/camdev/check_energy.F90 @@ -0,0 +1,1004 @@ + +module check_energy + +!--------------------------------------------------------------------------------- +! Purpose: +! +! Module to check +! 1. vertically integrated total energy and water conservation for each +! column within the physical parameterizations +! +! 2. global mean total energy conservation between the physics output state +! and the input state on the next time step. +! +! 3. add a globally uniform heating term to account for any change of total energy in 2. +! +! Author: Byron Boville Oct 31, 2002 +! +! Modifications: +! 03.03.29 Boville Add global energy check and fixer. +! +!--------------------------------------------------------------------------------- + + use shr_kind_mod, only: r8 => shr_kind_r8 + use ppgrid, only: pcols, pver, begchunk, endchunk + use spmd_utils, only: masterproc + + use gmean_mod, only: gmean + use physconst, only: gravit, latvap, latice, cpair, cpairv + use physics_types, only: physics_state, physics_tend, physics_ptend, physics_ptend_init + use constituents, only: cnst_get_ind, pcnst, cnst_name, cnst_get_type_byind + use time_manager, only: is_first_step + use cam_logfile, only: iulog + + implicit none + private + +! Public types: + public check_tracers_data + +! Public methods + public :: check_energy_readnl ! read namelist values + public :: check_energy_register ! register fields in physics buffer + public :: check_energy_get_integrals ! get energy integrals computed in check_energy_gmean + public :: check_energy_init ! initialization of module + public :: check_energy_timestep_init ! timestep initialization of energy integrals and cumulative boundary fluxes + public :: check_energy_chng ! check changes in integrals against cumulative boundary fluxes + public :: check_energy_gmean ! global means of physics input and output total energy + public :: check_energy_fix ! add global mean energy difference as a heating + public :: check_tracers_init ! initialize tracer integrals and cumulative boundary fluxes + public :: check_tracers_chng ! check changes in integrals against cumulative boundary fluxes + + public :: calc_te_and_aam_budgets ! calculate and output total energy and axial angular momentum diagnostics + +! Private module data + + logical :: print_energy_errors = .false. + + real(r8) :: teout_glob ! global mean energy of output state + real(r8) :: teinp_glob ! global mean energy of input state + real(r8) :: tedif_glob ! global mean energy difference + real(r8) :: psurf_glob ! global mean surface pressure + real(r8) :: ptopb_glob ! global mean top boundary pressure + real(r8) :: heat_glob ! global mean heating rate + +! Physics buffer indices + + integer :: teout_idx = 0 ! teout index in physics buffer + integer :: dtcore_idx = 0 ! dtcore index in physics buffer + integer :: ducore_idx = 0 ! ducore index in physics buffer + integer :: dvcore_idx = 0 ! dvcore index in physics buffer + + type check_tracers_data + real(r8) :: tracer(pcols,pcnst) ! initial vertically integrated total (kinetic + static) energy + real(r8) :: tracer_tnd(pcols,pcnst) ! cumulative boundary flux of total energy + integer :: count(pcnst) ! count of values with significant imbalances + end type check_tracers_data + + +!=============================================================================== +contains +!=============================================================================== + +subroutine check_energy_readnl(nlfile) + + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical + use cam_abortutils, only: endrun + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + character(len=*), parameter :: sub = 'check_energy_readnl' + + namelist /check_energy_nl/ print_energy_errors + !----------------------------------------------------------------------------- + + ! Read namelist + if (masterproc) then + unitn = getunit() + open( unitn, file=trim(nlfile), status='old' ) + call find_group_name(unitn, 'check_energy_nl', status=ierr) + if (ierr == 0) then + read(unitn, check_energy_nl, iostat=ierr) + if (ierr /= 0) then + call endrun(sub//': FATAL: reading namelist') + end if + end if + close(unitn) + call freeunit(unitn) + end if + + call mpi_bcast(print_energy_errors, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: print_energy_errors") + + if (masterproc) then + write(iulog,*) 'check_energy options:' + write(iulog,*) ' print_energy_errors =', print_energy_errors + end if + +end subroutine check_energy_readnl + +!=============================================================================== + + subroutine check_energy_register() +! +! Register fields in the physics buffer. +! +!----------------------------------------------------------------------- + + use physics_buffer, only : pbuf_add_field, dtype_r8, dyn_time_lvls + use physics_buffer, only : pbuf_register_subcol + use subcol_utils, only : is_subcol_on + +!----------------------------------------------------------------------- + +! Request physics buffer space for fields that persist across timesteps. + + call pbuf_add_field('TEOUT', 'global',dtype_r8 , (/pcols,dyn_time_lvls/), teout_idx) + call pbuf_add_field('DTCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dtcore_idx) + call pbuf_add_field('DUCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),ducore_idx) + call pbuf_add_field('DVCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dvcore_idx) + if(is_subcol_on()) then + call pbuf_register_subcol('TEOUT', 'phys_register', teout_idx) + call pbuf_register_subcol('DTCORE', 'phys_register', dtcore_idx) + call pbuf_register_subcol('DUCORE', 'phys_register', ducore_idx) + call pbuf_register_subcol('DVCORE', 'phys_register', dvcore_idx) + end if + + end subroutine check_energy_register + +!=============================================================================== + +subroutine check_energy_get_integrals( tedif_glob_out, heat_glob_out ) + +!----------------------------------------------------------------------- +! Purpose: Return energy integrals +!----------------------------------------------------------------------- + + real(r8), intent(out), optional :: tedif_glob_out + real(r8), intent(out), optional :: heat_glob_out + +!----------------------------------------------------------------------- + + if ( present(tedif_glob_out) ) then + tedif_glob_out = tedif_glob + endif + if ( present(heat_glob_out) ) then + heat_glob_out = heat_glob + endif + +end subroutine check_energy_get_integrals + +!================================================================================================ + + subroutine check_energy_init() +! +! Initialize the energy conservation module +! +!----------------------------------------------------------------------- + use cam_history, only: addfld, add_default, horiz_only + use phys_control, only: phys_getopts + + implicit none + + logical :: history_budget, history_waccm + integer :: history_budget_histfile_num ! output history file number for budget fields + +!----------------------------------------------------------------------- + + call phys_getopts( history_budget_out = history_budget, & + history_budget_histfile_num_out = history_budget_histfile_num, & + history_waccm_out = history_waccm ) + +! register history variables + call addfld('TEINP', horiz_only, 'A', 'J/m2', 'Total energy of physics input') + call addfld('TEOUT', horiz_only, 'A', 'J/m2', 'Total energy of physics output') + call addfld('TEFIX', horiz_only, 'A', 'J/m2', 'Total energy after fixer') + call addfld('EFIX', horiz_only, 'A', 'W/m2', 'Effective sensible heat flux due to energy fixer') + call addfld('DTCORE', (/ 'lev' /), 'A', 'K/s' , 'T tendency due to dynamical core') + + if ( history_budget ) then + call add_default ('DTCORE', history_budget_histfile_num, ' ') + end if + if ( history_waccm ) then + call add_default ('DTCORE', 1, ' ') + end if + + end subroutine check_energy_init + +!=============================================================================== + + subroutine check_energy_timestep_init(state, tend, pbuf, col_type) + use physics_buffer, only : physics_buffer_desc, pbuf_set_field + use cam_abortutils, only: endrun +!----------------------------------------------------------------------- +! Compute initial values of energy and water integrals, +! zero cumulative tendencies +!----------------------------------------------------------------------- +!------------------------------Arguments-------------------------------- + + type(physics_state), intent(inout) :: state + type(physics_tend ), intent(inout) :: tend + type(physics_buffer_desc), pointer :: pbuf(:) + integer, optional :: col_type ! Flag inidicating whether using grid or subcolumns +!---------------------------Local storage------------------------------- + + real(r8) :: ke(state%ncol) ! vertical integral of kinetic energy + real(r8) :: se(state%ncol) ! vertical integral of static energy + real(r8) :: wv(state%ncol) ! vertical integral of water (vapor) + real(r8) :: wl(state%ncol) ! vertical integral of water (liquid) + real(r8) :: wi(state%ncol) ! vertical integral of water (ice) + + real(r8),allocatable :: cpairv_loc(:,:,:) + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + integer i,k ! column, level indices + integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices + integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices + integer :: ixgrau ! GRAUQM index +!----------------------------------------------------------------------- + + lchnk = state%lchnk + ncol = state%ncol + call cnst_get_ind('CLDICE', ixcldice, abort=.false.) + call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) + call cnst_get_ind('RAINQM', ixrain, abort=.false.) + call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) + call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) + + ! cpairv_loc needs to be allocated to a size which matches state and ptend + ! If psetcols == pcols, cpairv is the correct size and just copy into cpairv_loc + ! If psetcols > pcols and all cpairv match cpair, then assign the constant cpair + + if (state%psetcols == pcols) then + allocate (cpairv_loc(state%psetcols,pver,begchunk:endchunk)) + cpairv_loc(:,:,:) = cpairv(:,:,:) + else if (state%psetcols > pcols .and. all(cpairv(:,:,:) == cpair)) then + allocate(cpairv_loc(state%psetcols,pver,begchunk:endchunk)) + cpairv_loc(:,:,:) = cpair + else + call endrun('check_energy_timestep_init: cpairv is not allowed to vary when subcolumns are turned on') + end if + + ! Compute vertical integrals of dry static energy (modified), kinetic energy and water (vapor, liquid, ice) + ke = 0._r8 + se = 0._r8 + wv = 0._r8 + wl = 0._r8 + wi = 0._r8 + do k = 1, pver + do i = 1, ncol + ke(i) = ke(i) + 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit + se(i) = se(i) + state%t(i,k)*cpairv_loc(i,k,lchnk)*state%pdel(i,k)/gravit + wv(i) = wv(i) + state%q(i,k,1) *state%pdel(i,k)/gravit + end do + end do + do i = 1, ncol + se(i) = se(i) + state%phis(i)*state%ps(i)/gravit + end do + + ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. + if (ixcldliq > 1 .and. ixcldice > 1) then + do k = 1, pver + do i = 1, ncol + wl(i) = wl(i) + state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit + wi(i) = wi(i) + state%q(i,k,ixcldice)*state%pdel(i,k)/gravit + end do + end do + end if + + ! Don't require precip either, if microphysics doesn't add it. + if (ixrain > 1 .and. ixsnow > 1) then + do k = 1, pver + do i = 1, ncol + wl(i) = wl(i) + state%q(i,k,ixrain)*state%pdel(i,k)/gravit + wi(i) = wi(i) + state%q(i,k,ixsnow)*state%pdel(i,k)/gravit + end do + end do + end if + + ! Don't require graupel/hail either, if microphysics doesn't add it. + if (ixgrau > 1) then + do k = 1, pver + do i = 1, ncol + wi(i) = wi(i) + state%q(i,k,ixgrau)*state%pdel(i,k)/gravit + end do + end do + end if + +! Compute vertical integrals of frozen static energy and total water. + do i = 1, ncol + state%te_ini(i) = se(i) + ke(i) + (latvap+latice)*wv(i) + latice*wl(i) + state%tw_ini(i) = wv(i) + wl(i) + wi(i) + + state%te_cur(i) = state%te_ini(i) + state%tw_cur(i) = state%tw_ini(i) + end do + +! zero cummulative boundary fluxes + tend%te_tnd(:ncol) = 0._r8 + tend%tw_tnd(:ncol) = 0._r8 + + state%count = 0 + +! initialize physics buffer + if (is_first_step()) then + call pbuf_set_field(pbuf, teout_idx, state%te_ini, col_type=col_type) + end if + + deallocate(cpairv_loc) + + end subroutine check_energy_timestep_init + +!=============================================================================== + + subroutine check_energy_chng(state, tend, name, nstep, ztodt, & + flx_vap, flx_cnd, flx_ice, flx_sen) + use cam_abortutils, only: endrun + +!----------------------------------------------------------------------- +! Check that the energy and water change matches the boundary fluxes +!----------------------------------------------------------------------- +!------------------------------Arguments-------------------------------- + + type(physics_state) , intent(inout) :: state + type(physics_tend ) , intent(inout) :: tend + character*(*),intent(in) :: name ! parameterization name for fluxes + integer , intent(in ) :: nstep ! current timestep number + real(r8), intent(in ) :: ztodt ! 2 delta t (model time increment) + real(r8), intent(in ) :: flx_vap(:) ! (pcols) - boundary flux of vapor (kg/m2/s) + real(r8), intent(in ) :: flx_cnd(:) ! (pcols) -boundary flux of liquid+ice (m/s) (precip?) + real(r8), intent(in ) :: flx_ice(:) ! (pcols) -boundary flux of ice (m/s) (snow?) + real(r8), intent(in ) :: flx_sen(:) ! (pcols) -boundary flux of sensible heat (w/m2) + +!******************** BAB ****************************************************** +!******* Note that the precip and ice fluxes are in precip units (m/s). ******** +!******* I would prefer to have kg/m2/s. ******** +!******* I would also prefer liquid (not total) and ice fluxes ******** +!******************************************************************************* + +!---------------------------Local storage------------------------------- + + real(r8) :: te_xpd(state%ncol) ! expected value (f0 + dt*boundary_flux) + real(r8) :: te_dif(state%ncol) ! energy of input state - original energy + real(r8) :: te_tnd(state%ncol) ! tendency from last process + real(r8) :: te_rer(state%ncol) ! relative error in energy column + + real(r8) :: tw_xpd(state%ncol) ! expected value (w0 + dt*boundary_flux) + real(r8) :: tw_dif(state%ncol) ! tw_inp - original water + real(r8) :: tw_tnd(state%ncol) ! tendency from last process + real(r8) :: tw_rer(state%ncol) ! relative error in water column + + real(r8) :: ke(state%ncol) ! vertical integral of kinetic energy + real(r8) :: se(state%ncol) ! vertical integral of static energy + real(r8) :: wv(state%ncol) ! vertical integral of water (vapor) + real(r8) :: wl(state%ncol) ! vertical integral of water (liquid) + real(r8) :: wi(state%ncol) ! vertical integral of water (ice) + + real(r8) :: te(state%ncol) ! vertical integral of total energy + real(r8) :: tw(state%ncol) ! vertical integral of total water + + real(r8),allocatable :: cpairv_loc(:,:,:) + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + integer i,k ! column, level indices + integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices + integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices + integer :: ixgrau ! GRAUQM index +!----------------------------------------------------------------------- + + lchnk = state%lchnk + ncol = state%ncol + call cnst_get_ind('CLDICE', ixcldice, abort=.false.) + call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) + call cnst_get_ind('RAINQM', ixrain, abort=.false.) + call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) + call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) + + ! cpairv_loc needs to be allocated to a size which matches state and ptend + ! If psetcols == pcols, cpairv is the correct size and just copy into cpairv_loc + ! If psetcols > pcols and all cpairv match cpair, then assign the constant cpair + + if (state%psetcols == pcols) then + allocate (cpairv_loc(state%psetcols,pver,begchunk:endchunk)) + cpairv_loc(:,:,:) = cpairv(:,:,:) + else if (state%psetcols > pcols .and. all(cpairv(:,:,:) == cpair)) then + allocate(cpairv_loc(state%psetcols,pver,begchunk:endchunk)) + cpairv_loc(:,:,:) = cpair + else + call endrun('check_energy_chng: cpairv is not allowed to vary when subcolumns are turned on') + end if + + ! Compute vertical integrals of dry static energy (modified), kinetic energy and water (vapor, liquid, ice) + ke = 0._r8 + se = 0._r8 + wv = 0._r8 + wl = 0._r8 + wi = 0._r8 + do k = 1, pver + do i = 1, ncol + ke(i) = ke(i) + 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit + se(i) = se(i) + state%t(i,k)*cpairv_loc(i,k,lchnk)*state%pdel(i,k)/gravit + wv(i) = wv(i) + state%q(i,k,1) *state%pdel(i,k)/gravit + end do + end do + do i = 1, ncol + se(i) = se(i) + state%phis(i)*state%ps(i)/gravit + end do + + ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. + if (ixcldliq > 1 .and. ixcldice > 1) then + do k = 1, pver + do i = 1, ncol + wl(i) = wl(i) + state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit + wi(i) = wi(i) + state%q(i,k,ixcldice)*state%pdel(i,k)/gravit + end do + end do + end if + + ! Don't require precip either, if microphysics doesn't add it. + if (ixrain > 1 .and. ixsnow > 1) then + do k = 1, pver + do i = 1, ncol + wl(i) = wl(i) + state%q(i,k,ixrain)*state%pdel(i,k)/gravit + wi(i) = wi(i) + state%q(i,k,ixsnow)*state%pdel(i,k)/gravit + end do + end do + end if + + ! Don't require graupel/hail either, if microphysics doesn't add it. + if (ixgrau > 1) then + do k = 1, pver + do i = 1, ncol + wi(i) = wi(i) + state%q(i,k,ixgrau)*state%pdel(i,k)/gravit + end do + end do + end if + + ! Compute vertical integrals of frozen static energy and total water. + do i = 1, ncol + te(i) = se(i) + ke(i) + (latvap+latice)*wv(i) + latice*wl(i) + tw(i) = wv(i) + wl(i) + wi(i) + end do + + ! compute expected values and tendencies + do i = 1, ncol + ! change in static energy and total water + te_dif(i) = te(i) - state%te_cur(i) + tw_dif(i) = tw(i) - state%tw_cur(i) + + ! expected tendencies from boundary fluxes for last process + te_tnd(i) = flx_vap(i)*(latvap+latice) - (flx_cnd(i) - flx_ice(i))*1000._r8*latice + flx_sen(i) + tw_tnd(i) = flx_vap(i) - flx_cnd(i) *1000._r8 + + ! cummulative tendencies from boundary fluxes + tend%te_tnd(i) = tend%te_tnd(i) + te_tnd(i) + tend%tw_tnd(i) = tend%tw_tnd(i) + tw_tnd(i) + + ! expected new values from previous state plus boundary fluxes + te_xpd(i) = state%te_cur(i) + te_tnd(i)*ztodt + tw_xpd(i) = state%tw_cur(i) + tw_tnd(i)*ztodt + + ! relative error, expected value - input state / previous state + te_rer(i) = (te_xpd(i) - te(i)) / state%te_cur(i) + end do + + ! relative error for total water (allow for dry atmosphere) + tw_rer = 0._r8 + where (state%tw_cur(:ncol) > 0._r8) + tw_rer(:ncol) = (tw_xpd(:ncol) - tw(:ncol)) / state%tw_cur(:ncol) + end where + + ! error checking + if (print_energy_errors) then + if (any(abs(te_rer(1:ncol)) > 1.E-14_r8 .or. abs(tw_rer(1:ncol)) > 1.E-10_r8)) then + do i = 1, ncol + ! the relative error threshold for the water budget has been reduced to 1.e-10 + ! to avoid messages generated by QNEG3 calls + ! PJR- change to identify if error in energy or water + if (abs(te_rer(i)) > 1.E-14_r8 ) then + state%count = state%count + 1 + write(iulog,*) "significant energy conservation error after ", name, & + " count", state%count, " nstep", nstep, "chunk", lchnk, "col", i + write(iulog,*) te(i),te_xpd(i),te_dif(i),tend%te_tnd(i)*ztodt, & + te_tnd(i)*ztodt,te_rer(i) + endif + if ( abs(tw_rer(i)) > 1.E-10_r8) then + state%count = state%count + 1 + write(iulog,*) "significant water conservation error after ", name, & + " count", state%count, " nstep", nstep, "chunk", lchnk, "col", i + write(iulog,*) tw(i),tw_xpd(i),tw_dif(i),tend%tw_tnd(i)*ztodt, & + tw_tnd(i)*ztodt,tw_rer(i) + end if + end do + end if + end if + + ! copy new value to state + do i = 1, ncol + state%te_cur(i) = te(i) + state%tw_cur(i) = tw(i) + end do + + deallocate(cpairv_loc) + + end subroutine check_energy_chng + + +!=============================================================================== + subroutine check_energy_gmean(state, pbuf2d, dtime, nstep) + + use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_chunk + +!----------------------------------------------------------------------- +! Compute global mean total energy of physics input and output states +!----------------------------------------------------------------------- +!------------------------------Arguments-------------------------------- + + type(physics_state), intent(in ), dimension(begchunk:endchunk) :: state + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + real(r8), intent(in) :: dtime ! physics time step + integer , intent(in) :: nstep ! current timestep number + +!---------------------------Local storage------------------------------- + integer :: ncol ! number of active columns + integer :: lchnk ! chunk index + + real(r8) :: te(pcols,begchunk:endchunk,3) + ! total energy of input/output states (copy) + real(r8) :: te_glob(3) ! global means of total energy + real(r8), pointer :: teout(:) +!----------------------------------------------------------------------- + + ! Copy total energy out of input and output states + do lchnk = begchunk, endchunk + ncol = state(lchnk)%ncol + ! input energy + te(:ncol,lchnk,1) = state(lchnk)%te_ini(:ncol) + ! output energy + call pbuf_get_field(pbuf_get_chunk(pbuf2d,lchnk),teout_idx, teout) + + te(:ncol,lchnk,2) = teout(1:ncol) + ! surface pressure for heating rate + te(:ncol,lchnk,3) = state(lchnk)%pint(:ncol,pver+1) + end do + + ! Compute global means of input and output energies and of + ! surface pressure for heating rate (assume uniform ptop) + call gmean(te, te_glob, 3) + + if (begchunk .le. endchunk) then + teinp_glob = te_glob(1) + teout_glob = te_glob(2) + psurf_glob = te_glob(3) + ptopb_glob = state(begchunk)%pint(1,1) + + ! Global mean total energy difference + tedif_glob = teinp_glob - teout_glob + heat_glob = -tedif_glob/dtime * gravit / (psurf_glob - ptopb_glob) + + if (masterproc) then + write(iulog,'(1x,a9,1x,i8,4(1x,e25.17))') "nstep, te", nstep, teinp_glob, teout_glob, heat_glob, psurf_glob + end if + else + heat_glob = 0._r8 + end if ! (begchunk .le. endchunk) + + end subroutine check_energy_gmean + +!=============================================================================== + subroutine check_energy_fix(state, ptend, nstep, eshflx) + +!----------------------------------------------------------------------- +! Add heating rate required for global mean total energy conservation +!----------------------------------------------------------------------- +!------------------------------Arguments-------------------------------- + + type(physics_state), intent(in ) :: state + type(physics_ptend), intent(out) :: ptend + + integer , intent(in ) :: nstep ! time step number + real(r8), intent(out ) :: eshflx(pcols) ! effective sensible heat flux + +!---------------------------Local storage------------------------------- + integer :: i ! column + integer :: ncol ! number of atmospheric columns in chunk +!----------------------------------------------------------------------- + ncol = state%ncol + + call physics_ptend_init(ptend, state%psetcols, 'chkenergyfix', ls=.true.) + +#if ( defined OFFLINE_DYN ) + ! disable the energy fix for offline driver + heat_glob = 0._r8 +#endif +! add (-) global mean total energy difference as heating + ptend%s(:ncol,:pver) = heat_glob +!!$ write(iulog,*) "chk_fix: heat", state%lchnk, ncol, heat_glob + +! compute effective sensible heat flux + do i = 1, ncol + eshflx(i) = heat_glob * (state%pint(i,pver+1) - state%pint(i,1)) / gravit + end do +!!! if (nstep > 0) write(iulog,*) "heat", heat_glob, eshflx(1) + + return + end subroutine check_energy_fix + + +!=============================================================================== + subroutine check_tracers_init(state, tracerint) + +!----------------------------------------------------------------------- +! Compute initial values of tracers integrals, +! zero cumulative tendencies +!----------------------------------------------------------------------- + +!------------------------------Arguments-------------------------------- + + type(physics_state), intent(in) :: state + type(check_tracers_data), intent(out) :: tracerint + +!---------------------------Local storage------------------------------- + + real(r8) :: tr(pcols) ! vertical integral of tracer + real(r8) :: trpdel(pcols, pver) ! pdel for tracer + + integer ncol ! number of atmospheric columns + integer i,k,m ! column, level,constituent indices + integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices + integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices + integer :: ixgrau ! GRAUQM index +!----------------------------------------------------------------------- + + ncol = state%ncol + call cnst_get_ind('CLDICE', ixcldice, abort=.false.) + call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) + call cnst_get_ind('RAINQM', ixrain, abort=.false.) + call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) + call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) + + + do m = 1,pcnst + + if ( any(m == (/ 1, ixcldliq, ixcldice, & + ixrain, ixsnow, ixgrau /)) ) exit ! dont process water substances + ! they are checked in check_energy + + if (cnst_get_type_byind(m).eq.'dry') then + trpdel(:ncol,:) = state%pdeldry(:ncol,:) + else + trpdel(:ncol,:) = state%pdel(:ncol,:) + endif + + ! Compute vertical integrals of tracer + tr = 0._r8 + do k = 1, pver + do i = 1, ncol + tr(i) = tr(i) + state%q(i,k,m)*trpdel(i,k)/gravit + end do + end do + + ! Compute vertical integrals of frozen static tracers and total water. + do i = 1, ncol + tracerint%tracer(i,m) = tr(i) + end do + + ! zero cummulative boundary fluxes + tracerint%tracer_tnd(:ncol,m) = 0._r8 + + tracerint%count(m) = 0 + + end do + + return + end subroutine check_tracers_init + +!=============================================================================== + subroutine check_tracers_chng(state, tracerint, name, nstep, ztodt, cflx) + +!----------------------------------------------------------------------- +! Check that the tracers and water change matches the boundary fluxes +! these checks are not save when there are tracers transformations, as +! they only check to see whether a mass change in the column is +! associated with a flux +!----------------------------------------------------------------------- + + use cam_abortutils, only: endrun + + + implicit none + +!------------------------------Arguments-------------------------------- + + type(physics_state) , intent(in ) :: state + type(check_tracers_data), intent(inout) :: tracerint! tracers integrals and boundary fluxes + character*(*),intent(in) :: name ! parameterization name for fluxes + integer , intent(in ) :: nstep ! current timestep number + real(r8), intent(in ) :: ztodt ! 2 delta t (model time increment) + real(r8), intent(in ) :: cflx(pcols,pcnst) ! boundary flux of tracers (kg/m2/s) + +!---------------------------Local storage------------------------------- + + real(r8) :: tracer_inp(pcols,pcnst) ! total tracer of new (input) state + real(r8) :: tracer_xpd(pcols,pcnst) ! expected value (w0 + dt*boundary_flux) + real(r8) :: tracer_dif(pcols,pcnst) ! tracer_inp - original tracer + real(r8) :: tracer_tnd(pcols,pcnst) ! tendency from last process + real(r8) :: tracer_rer(pcols,pcnst) ! relative error in tracer column + + real(r8) :: tr(pcols) ! vertical integral of tracer + real(r8) :: trpdel(pcols, pver) ! pdel for tracer + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + integer i,k ! column, level indices + integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices + integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices + integer :: ixgrau ! GRAUQM index + integer :: m ! tracer index + character(len=8) :: tracname ! tracername +!----------------------------------------------------------------------- +!!$ if (.true.) return + + lchnk = state%lchnk + ncol = state%ncol + call cnst_get_ind('CLDICE', ixcldice, abort=.false.) + call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) + call cnst_get_ind('RAINQM', ixrain, abort=.false.) + call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) + call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) + + do m = 1,pcnst + + if ( any(m == (/ 1, ixcldliq, ixcldice, & + ixrain, ixsnow, ixgrau /)) ) exit ! dont process water substances + ! they are checked in check_energy + tracname = cnst_name(m) + if (cnst_get_type_byind(m).eq.'dry') then + trpdel(:ncol,:) = state%pdeldry(:ncol,:) + else + trpdel(:ncol,:) = state%pdel(:ncol,:) + endif + + ! Compute vertical integrals tracers + tr = 0._r8 + do k = 1, pver + do i = 1, ncol + tr(i) = tr(i) + state%q(i,k,m)*trpdel(i,k)/gravit + end do + end do + + ! Compute vertical integrals of tracer + do i = 1, ncol + tracer_inp(i,m) = tr(i) + end do + + ! compute expected values and tendencies + do i = 1, ncol + ! change in tracers + tracer_dif(i,m) = tracer_inp(i,m) - tracerint%tracer(i,m) + + ! expected tendencies from boundary fluxes for last process + tracer_tnd(i,m) = cflx(i,m) + + ! cummulative tendencies from boundary fluxes + tracerint%tracer_tnd(i,m) = tracerint%tracer_tnd(i,m) + tracer_tnd(i,m) + + ! expected new values from original values plus boundary fluxes + tracer_xpd(i,m) = tracerint%tracer(i,m) + tracerint%tracer_tnd(i,m)*ztodt + + ! relative error, expected value - input value / original + tracer_rer(i,m) = (tracer_xpd(i,m) - tracer_inp(i,m)) / tracerint%tracer(i,m) + end do + +!! final loop for error checking +! do i = 1, ncol + +!! error messages +! if (abs(enrgy_rer(i)) > 1.E-14 .or. abs(water_rer(i)) > 1.E-14) then +! tracerint%count = tracerint%count + 1 +! write(iulog,*) "significant conservations error after ", name, & +! " count", tracerint%count, " nstep", nstep, "chunk", lchnk, "col", i +! write(iulog,*) enrgy_inp(i),enrgy_xpd(i),enrgy_dif(i),tracerint%enrgy_tnd(i)*ztodt, & +! enrgy_tnd(i)*ztodt,enrgy_rer(i) +! write(iulog,*) water_inp(i),water_xpd(i),water_dif(i),tracerint%water_tnd(i)*ztodt, & +! water_tnd(i)*ztodt,water_rer(i) +! end if +! end do + + + ! final loop for error checking + if ( maxval(tracer_rer) > 1.E-14_r8 ) then + write(iulog,*) "CHECK_TRACERS TRACER large rel error" + write(iulog,*) tracer_rer + endif + + do i = 1, ncol + ! error messages + if (abs(tracer_rer(i,m)) > 1.E-14_r8 ) then + tracerint%count = tracerint%count + 1 + write(iulog,*) "CHECK_TRACERS TRACER significant conservation error after ", name, & + " count", tracerint%count, " nstep", nstep, "chunk", lchnk, "col",i + write(iulog,*)' process name, tracname, index ', name, tracname, m + write(iulog,*)" input integral ",tracer_inp(i,m) + write(iulog,*)" expected integral ", tracer_xpd(i,m) + write(iulog,*)" input - inital integral ",tracer_dif(i,m) + write(iulog,*)" cumulative tend ",tracerint%tracer_tnd(i,m)*ztodt + write(iulog,*)" process tend ",tracer_tnd(i,m)*ztodt + write(iulog,*)" relative error ",tracer_rer(i,m) + call endrun() + end if + end do + end do + + return + end subroutine check_tracers_chng + +!####################################################################### + + subroutine calc_te_and_aam_budgets(state, outfld_name_suffix) + use physconst, only: gravit,cpair,pi,rearth,omega + use cam_history, only: hist_fld_active, outfld + +!------------------------------Arguments-------------------------------- + + type(physics_state), intent(inout) :: state + character*(*),intent(in) :: outfld_name_suffix ! suffix for "outfld" names + +!---------------------------Local storage------------------------------- + + real(r8) :: se(pcols) ! Dry Static energy (J/m2) + real(r8) :: ke(pcols) ! kinetic energy (J/m2) + real(r8) :: wv(pcols) ! column integrated vapor (kg/m2) + real(r8) :: wl(pcols) ! column integrated liquid (kg/m2) + real(r8) :: wi(pcols) ! column integrated ice (kg/m2) + real(r8) :: tt(pcols) ! column integrated test tracer (kg/m2) + real(r8) :: mr(pcols) ! column integrated wind axial angular momentum (kg*m2/s) + real(r8) :: mo(pcols) ! column integrated mass axial angular momentum (kg*m2/s) + real(r8) :: se_tmp,ke_tmp,wv_tmp,wl_tmp,wi_tmp,tt_tmp,mr_tmp,mo_tmp,cos_lat + real(r8) :: mr_cnst, mo_cnst + + integer lchnk ! chunk identifier + integer ncol ! number of atmospheric columns + integer i,k ! column, level indices + integer :: ixcldice, ixcldliq,ixtt ! CLDICE and CLDLIQ indices + character(len=16) :: name_out1,name_out2,name_out3,name_out4,name_out5,name_out6 +!----------------------------------------------------------------------- + + name_out1 = 'SE_' //trim(outfld_name_suffix) + name_out2 = 'KE_' //trim(outfld_name_suffix) + name_out3 = 'WV_' //trim(outfld_name_suffix) + name_out4 = 'WL_' //trim(outfld_name_suffix) + name_out5 = 'WI_' //trim(outfld_name_suffix) + name_out6 = 'TT_' //trim(outfld_name_suffix) + + if ( hist_fld_active(name_out1).or.hist_fld_active(name_out2).or.hist_fld_active(name_out3).or.& + hist_fld_active(name_out4).or.hist_fld_active(name_out5).or.hist_fld_active(name_out6)) then + + lchnk = state%lchnk + ncol = state%ncol + call cnst_get_ind('CLDICE', ixcldice, abort=.false.) + call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) + call cnst_get_ind('TT_LW' , ixtt , abort=.false.) + + ! Compute frozen static energy in 3 parts: KE, SE, and energy associated with vapor and liquid + + se = 0._r8 + ke = 0._r8 + wv = 0._r8 + wl = 0._r8 + wi = 0._r8 + tt = 0._r8 + + do k = 1, pver + do i = 1, ncol + ke_tmp = 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit + se_tmp = cpair*state%t(i,k) *state%pdel(i,k)/gravit + wv_tmp = state%q(i,k,1 ) *state%pdel(i,k)/gravit + + se (i) = se (i) + se_tmp + ke (i) = ke (i) + ke_tmp + wv (i) = wv (i) + wv_tmp + end do + end do + do i = 1, ncol + se(i) = se(i) + state%phis(i)*state%ps(i)/gravit + end do + + ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. + + if (ixcldliq > 1) then + do k = 1, pver + do i = 1, ncol + wl_tmp = state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit + wl (i) = wl(i) + wl_tmp + end do + end do + end if + + if (ixcldice > 1) then + do k = 1, pver + do i = 1, ncol + wi_tmp = state%q(i,k,ixcldice)*state%pdel(i,k)/gravit + wi(i) = wi(i) + wi_tmp + end do + end do + end if + + if (ixtt > 1) then + if (name_out6 == 'TT_pAM') then + ! + ! after dme_adjust mixing ratios are all wet + ! + do k = 1, pver + do i = 1, ncol + tt_tmp = state%q(i,k,ixtt)*state%pdel(i,k)/gravit + tt (i) = tt(i) + tt_tmp + end do + end do + else + do k = 1, pver + do i = 1, ncol + tt_tmp = state%q(i,k,ixtt)*state%pdeldry(i,k)/gravit + tt (i) = tt(i) + tt_tmp + end do + end do + end if + end if + + ! Output energy diagnostics + + call outfld(name_out1 ,se , pcols ,lchnk ) + call outfld(name_out2 ,ke , pcols ,lchnk ) + call outfld(name_out3 ,wv , pcols ,lchnk ) + call outfld(name_out4 ,wl , pcols ,lchnk ) + call outfld(name_out5 ,wi , pcols ,lchnk ) + call outfld(name_out6 ,tt , pcols ,lchnk ) + end if + + + ! + ! Axial angular momentum diagnostics + ! + ! Code follows + ! + ! Lauritzen et al., (2014): Held-Suarez simulations with the Community Atmosphere Model + ! Spectral Element (CAM-SE) dynamical core: A global axial angularmomentum analysis using Eulerian + ! and floating Lagrangian vertical coordinates. J. Adv. Model. Earth Syst. 6,129-140, + ! doi:10.1002/2013MS000268 + ! + ! MR is equation (6) without \Delta A and sum over areas (areas are in units of radians**2) + ! MO is equation (7) without \Delta A and sum over areas (areas are in units of radians**2) + ! + name_out1 = 'MR_' //trim(outfld_name_suffix) + name_out2 = 'MO_' //trim(outfld_name_suffix) + + if ( hist_fld_active(name_out1).or.hist_fld_active(name_out2)) then + lchnk = state%lchnk + ncol = state%ncol + + mr_cnst = rearth**3/gravit + mo_cnst = omega*rearth**4/gravit + do k = 1, pver + do i = 1, ncol + cos_lat = cos(state%lat(i)) + mr_tmp = mr_cnst*state%u(i,k)*state%pdel(i,k)*cos_lat + mo_tmp = mo_cnst*state%pdel(i,k)*cos_lat**2 + + mr(i) = mr(i) + mr_tmp + mo(i) = mo(i) + mo_tmp + end do + end do + call outfld(name_out1 ,mr, pcols,lchnk ) + call outfld(name_out1 ,mo, pcols,lchnk ) + end if + end subroutine calc_te_and_aam_budgets + + +end module check_energy diff --git a/src/physics/camdev/physpkg.F90 b/src/physics/camdev/physpkg.F90 new file mode 100644 index 0000000000..a83b41688d --- /dev/null +++ b/src/physics/camdev/physpkg.F90 @@ -0,0 +1,2887 @@ +module physpkg + !----------------------------------------------------------------------- + ! Purpose: + ! + ! Provides the interface to CAM physics package + ! + ! Revision history: + ! Aug 2005, E. B. Kluzek, Creation of module from physpkg subroutine + ! 2005-10-17 B. Eaton Add contents of inti.F90 to phys_init(). Add + ! initialization of grid info in phys_state. + ! Nov 2010 A. Gettelman Put micro/macro physics into separate routines + ! June 2021 A. Herrington Move macro/micro/wetdep/radiation from tphysbc to tphysac + !----------------------------------------------------------------------- + + use shr_kind_mod, only: r8 => shr_kind_r8 + use spmd_utils, only: masterproc + use physconst, only: latvap, latice, rh2o + use physics_types, only: physics_state, physics_tend, physics_state_set_grid, & + physics_ptend, physics_tend_init, physics_update, & + physics_type_alloc, physics_ptend_dealloc,& + physics_state_alloc, physics_state_dealloc, physics_tend_alloc, physics_tend_dealloc + use phys_grid, only: get_ncols_p + use phys_gmean, only: gmean_mass + use ppgrid, only: begchunk, endchunk, pcols, pver, pverp, psubcols + use constituents, only: pcnst, cnst_name, cnst_get_ind + use camsrfexch, only: cam_out_t, cam_in_t + + use cam_control_mod, only: ideal_phys, adiabatic + use phys_control, only: phys_do_flux_avg, phys_getopts, waccmx_is + use scamMod, only: single_column, scm_crm_mode + use flux_avg, only: flux_avg_init + use perf_mod + use cam_logfile, only: iulog + use camsrfexch, only: cam_export + + use modal_aero_calcsize, only: modal_aero_calcsize_init, modal_aero_calcsize_diag, modal_aero_calcsize_reg + use modal_aero_wateruptake, only: modal_aero_wateruptake_init, modal_aero_wateruptake_dr, modal_aero_wateruptake_reg + + implicit none + private + save + + ! Public methods + public phys_register ! was initindx - register physics methods + public phys_init ! Public initialization method + public phys_run1 ! First phase of the public run method + public phys_run2 ! Second phase of the public run method + public phys_final ! Public finalization method + + ! Private module data + + ! Physics package options + character(len=16) :: shallow_scheme + character(len=16) :: macrop_scheme + character(len=16) :: microp_scheme + character(len=16) :: subcol_scheme + character(len=32) :: cam_take_snapshot_before ! Physics routine to take a snapshot "before" + character(len=32) :: cam_take_snapshot_after ! Physics routine to take a snapshot "after" + integer :: cld_macmic_num_steps ! Number of macro/micro substeps + integer :: cam_snapshot_before_num ! tape number for before snapshots + integer :: cam_snapshot_after_num ! tape number for after snapshots + logical :: do_clubb_sgs + logical :: use_subcol_microp ! if true, use subcolumns in microphysics + logical :: state_debug_checks ! Debug physics_state. + logical :: clim_modal_aero ! climate controled by prognostic or prescribed modal aerosols + logical :: prog_modal_aero ! Prognostic modal aerosols present + + ! Physics buffer index + integer :: teout_idx = 0 + + integer :: landm_idx = 0 + integer :: sgh_idx = 0 + integer :: sgh30_idx = 0 + + integer :: qini_idx = 0 + integer :: cldliqini_idx = 0 + integer :: cldiceini_idx = 0 + + integer :: prec_str_idx = 0 + integer :: snow_str_idx = 0 + integer :: prec_sed_idx = 0 + integer :: snow_sed_idx = 0 + integer :: prec_pcw_idx = 0 + integer :: snow_pcw_idx = 0 + integer :: prec_dp_idx = 0 + integer :: snow_dp_idx = 0 + integer :: prec_sh_idx = 0 + integer :: snow_sh_idx = 0 + integer :: dlfzm_idx = 0 ! detrained convective cloud water mixing ratio. + integer :: ducore_idx = 0 ! ducore index in physics buffer + integer :: dvcore_idx = 0 ! dvcore index in physics buffer + integer :: cmfmczm_idx = 0 ! Zhang-McFarlane convective mass fluxes + +!======================================================================= +contains +!======================================================================= + + subroutine phys_register + !----------------------------------------------------------------------- + ! + ! Purpose: Register constituents and physics buffer fields. + ! + ! Author: CSM Contact: M. Vertenstein, Aug. 1997 + ! B.A. Boville, Oct 2001 + ! A. Gettelman, Nov 2010 - put micro/macro physics into separate routines + ! + !----------------------------------------------------------------------- + use cam_abortutils, only: endrun + use physics_buffer, only: pbuf_init_time, pbuf_cam_snapshot_register + use physics_buffer, only: pbuf_add_field, dtype_r8, pbuf_register_subcol + use shr_kind_mod, only: r8 => shr_kind_r8 + use spmd_utils, only: masterproc + use constituents, only: pcnst, cnst_add, cnst_chk_dim, cnst_name + + use cam_control_mod, only: moist_physics + use chemistry, only: chem_register + use cloud_fraction, only: cldfrc_register + use rk_stratiform, only: rk_stratiform_register + use microp_driver, only: microp_driver_register + use microp_aero, only: microp_aero_register + use macrop_driver, only: macrop_driver_register + use clubb_intr, only: clubb_register_cam + use conv_water, only: conv_water_register + use physconst, only: mwdry, cpair, mwh2o, cpwv + use tracers, only: tracers_register + use check_energy, only: check_energy_register + use carma_intr, only: carma_register + use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_register + use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_register + use ghg_data, only: ghg_data_register + use vertical_diffusion, only: vd_register + use convect_deep, only: convect_deep_register + use convect_shallow, only: convect_shallow_register + use radiation, only: radiation_register + use co2_cycle, only: co2_register + use flux_avg, only: flux_avg_register + use iondrag, only: iondrag_register + use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_reg + use string_utils, only: to_lower + use prescribed_ozone, only: prescribed_ozone_register + use prescribed_volcaero,only: prescribed_volcaero_register + use prescribed_strataero,only: prescribed_strataero_register + use prescribed_aero, only: prescribed_aero_register + use prescribed_ghg, only: prescribed_ghg_register + use sslt_rebin, only: sslt_rebin_register + use aoa_tracers, only: aoa_tracers_register + use aircraft_emit, only: aircraft_emit_register + use cam_diagnostics, only: diag_register + use cloud_diagnostics, only: cloud_diagnostics_register + use cospsimulator_intr, only: cospsimulator_intr_register + use rad_constituents, only: rad_cnst_get_info ! Added to query if it is a modal aero sim or not + use subcol, only: subcol_register + use subcol_utils, only: is_subcol_on, subcol_get_scheme + use dyn_comp, only: dyn_register + use spcam_drivers, only: spcam_register + use offline_driver, only: offline_driver_reg + + !---------------------------Local variables----------------------------- + ! + integer :: m ! loop index + integer :: mm ! constituent index + integer :: nmodes + !----------------------------------------------------------------------- + + ! Get physics options + call phys_getopts(shallow_scheme_out = shallow_scheme, & + macrop_scheme_out = macrop_scheme, & + microp_scheme_out = microp_scheme, & + cld_macmic_num_steps_out = cld_macmic_num_steps, & + do_clubb_sgs_out = do_clubb_sgs, & + use_subcol_microp_out = use_subcol_microp, & + state_debug_checks_out = state_debug_checks, & + cam_take_snapshot_before_out= cam_take_snapshot_before, & + cam_take_snapshot_after_out = cam_take_snapshot_after, & + cam_snapshot_before_num_out = cam_snapshot_before_num, & + cam_snapshot_after_num_out = cam_snapshot_after_num) + + subcol_scheme = subcol_get_scheme() + + ! Initialize dyn_time_lvls + call pbuf_init_time() + + ! Register the subcol scheme + call subcol_register() + + ! Register water vapor. + ! ***** N.B. ***** This must be the first call to cnst_add so that + ! water vapor is constituent 1. + if (moist_physics) then + call cnst_add('Q', mwh2o, cpwv, 1.E-12_r8, mm, & + longname='Specific humidity', readiv=.true., is_convtran1=.true.) + else + call cnst_add('Q', mwh2o, cpwv, 0.0_r8, mm, & + longname='Specific humidity', readiv=.false., is_convtran1=.true.) + end if + + ! Topography file fields. + call pbuf_add_field('LANDM', 'global', dtype_r8, (/pcols/), landm_idx) + call pbuf_add_field('SGH', 'global', dtype_r8, (/pcols/), sgh_idx) + call pbuf_add_field('SGH30', 'global', dtype_r8, (/pcols/), sgh30_idx) + + ! Fields for physics package diagnostics + call pbuf_add_field('QINI', 'physpkg', dtype_r8, (/pcols,pver/), qini_idx) + call pbuf_add_field('CLDLIQINI', 'physpkg', dtype_r8, (/pcols,pver/), cldliqini_idx) + call pbuf_add_field('CLDICEINI', 'physpkg', dtype_r8, (/pcols,pver/), cldiceini_idx) + + ! check energy package + call check_energy_register + + ! If using a simple physics option (e.g., held_suarez, adiabatic), + ! the normal CAM physics parameterizations are not called. + if (moist_physics) then + + ! register fluxes for saving across time + if (phys_do_flux_avg()) call flux_avg_register() + + call cldfrc_register() + + ! cloud water + if( microp_scheme == 'RK' ) then + call rk_stratiform_register() + elseif( microp_scheme == 'MG' ) then + if (.not. do_clubb_sgs) call macrop_driver_register() + call microp_aero_register() + call microp_driver_register() + end if + + ! Register CLUBB_SGS here + if (do_clubb_sgs) call clubb_register_cam() + + call pbuf_add_field('PREC_STR', 'global',dtype_r8,(/pcols/),prec_str_idx) + call pbuf_add_field('SNOW_STR', 'global',dtype_r8,(/pcols/),snow_str_idx) + call pbuf_add_field('PREC_PCW', 'global',dtype_r8,(/pcols/),prec_pcw_idx) + call pbuf_add_field('SNOW_PCW', 'global',dtype_r8,(/pcols/),snow_pcw_idx) + call pbuf_add_field('PREC_SED', 'global',dtype_r8,(/pcols/),prec_sed_idx) + call pbuf_add_field('SNOW_SED', 'global',dtype_r8,(/pcols/),snow_sed_idx) + + if (is_subcol_on()) then + call pbuf_register_subcol('PREC_STR', 'phys_register', prec_str_idx) + call pbuf_register_subcol('SNOW_STR', 'phys_register', snow_str_idx) + call pbuf_register_subcol('PREC_PCW', 'phys_register', prec_pcw_idx) + call pbuf_register_subcol('SNOW_PCW', 'phys_register', snow_pcw_idx) + call pbuf_register_subcol('PREC_SED', 'phys_register', prec_sed_idx) + call pbuf_register_subcol('SNOW_SED', 'phys_register', snow_sed_idx) + end if + + ! Who should add FRACIS? + ! -- It does not seem that aero_intr should add it since FRACIS is used in convection + ! even if there are no prognostic aerosols ... so do it here for now + call pbuf_add_field('FRACIS','physpkg',dtype_r8,(/pcols,pver,pcnst/),m) + + call conv_water_register() + + ! Determine whether its a 'modal' aerosol simulation or not + call rad_cnst_get_info(0, nmodes=nmodes) + clim_modal_aero = (nmodes > 0) + + if (clim_modal_aero) then + call modal_aero_calcsize_reg() + call modal_aero_wateruptake_reg() + endif + + ! register chemical constituents including aerosols ... + call chem_register() + + ! co2 constituents + call co2_register() + + ! register data model ozone with pbuf + if (cam3_ozone_data_on) then + call cam3_ozone_data_register() + end if + call prescribed_volcaero_register() + call prescribed_strataero_register() + call prescribed_ozone_register() + call prescribed_aero_register() + call prescribed_ghg_register() + call sslt_rebin_register + + ! CAM3 prescribed aerosols + if (cam3_aero_data_on) then + call cam3_aero_data_register() + end if + + ! register various data model gasses with pbuf + call ghg_data_register() + + ! carma microphysics + ! + call carma_register() + + ! Register iondrag variables with pbuf + call iondrag_register() + + ! Register ionosphere variables with pbuf if mode set to ionosphere + if( waccmx_is('ionosphere') ) then + call waccmx_phys_ion_elec_temp_reg() + endif + + call aircraft_emit_register() + + ! deep convection + call convect_deep_register + + ! shallow convection + call convect_shallow_register + + + call spcam_register + + ! radiation + call radiation_register + call cloud_diagnostics_register + + ! COSP + call cospsimulator_intr_register + + ! vertical diffusion + call vd_register() + else + ! held_suarez/adiabatic physics option should be in simple_physics + call endrun('phys_register: moist_physics configuration error') + end if + + ! Register diagnostics PBUF + call diag_register() + + ! Register age of air tracers + call aoa_tracers_register() + + ! Register test tracers + call tracers_register() + + call dyn_register() + + ! All tracers registered, check that the dimensions are correct + call cnst_chk_dim() + + ! ***NOTE*** No registering constituents after the call to cnst_chk_dim. + + call offline_driver_reg() + + ! This needs to be last as it requires all pbuf fields to be added + if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then + call pbuf_cam_snapshot_register() + end if + + end subroutine phys_register + + + + !======================================================================= + + subroutine phys_inidat( cam_out, pbuf2d ) + use cam_abortutils, only: endrun + + use physics_buffer, only: pbuf_get_index, pbuf_get_field, physics_buffer_desc, pbuf_set_field, dyn_time_lvls + + + use cam_initfiles, only: initial_file_get_id, topo_file_get_id + use cam_grid_support, only: cam_grid_check, cam_grid_id + use cam_grid_support, only: cam_grid_get_dim_names + use pio, only: file_desc_t + use ncdio_atm, only: infld + use dycore, only: dycore_is + use polar_avg, only: polar_average + use short_lived_species, only: initialize_short_lived_species + use cam_control_mod, only: aqua_planet + use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_inidat + + type(cam_out_t), intent(inout) :: cam_out(begchunk:endchunk) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + integer :: lchnk, m, n, i, k, ncol + type(file_desc_t), pointer :: fh_ini, fh_topo + character(len=8) :: fieldname + real(r8), pointer :: tptr(:,:), tptr_2(:,:), tptr3d(:,:,:), tptr3d_2(:,:,:) + real(r8), pointer :: qpert(:,:) + + character(len=11) :: subname='phys_inidat' ! subroutine name + integer :: tpert_idx, qpert_idx, pblh_idx + + logical :: found=.false., found2=.false. + integer :: ierr + character(len=8) :: dim1name, dim2name + integer :: ixcldice, ixcldliq + integer :: grid_id ! grid ID for data mapping + + nullify(tptr,tptr_2,tptr3d,tptr3d_2) + + fh_ini => initial_file_get_id() + fh_topo => topo_file_get_id() + + ! dynamics variables are handled in dyn_init - here we read variables needed for physics + ! but not dynamics + + grid_id = cam_grid_id('physgrid') + if (.not. cam_grid_check(grid_id)) then + call endrun(trim(subname)//': Internal error, no "physgrid" grid') + end if + call cam_grid_get_dim_names(grid_id, dim1name, dim2name) + + allocate(tptr(1:pcols,begchunk:endchunk)) + + if (associated(fh_topo) .and. .not. aqua_planet) then + call infld('SGH', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr, found, gridname='physgrid') + if(.not. found) call endrun('ERROR: SGH not found on topo file') + + call pbuf_set_field(pbuf2d, sgh_idx, tptr) + + allocate(tptr_2(1:pcols,begchunk:endchunk)) + call infld('SGH30', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr_2, found, gridname='physgrid') + if(found) then + call pbuf_set_field(pbuf2d, sgh30_idx, tptr_2) + else + if (masterproc) write(iulog,*) 'Warning: Error reading SGH30 from topo file.' + if (masterproc) write(iulog,*) 'The field SGH30 will be filled using data from SGH.' + call pbuf_set_field(pbuf2d, sgh30_idx, tptr) + end if + + deallocate(tptr_2) + + call infld('LANDM_COSLAT', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr, found, gridname='physgrid') + + if(.not.found) call endrun(' ERROR: LANDM_COSLAT not found on topo dataset.') + + call pbuf_set_field(pbuf2d, landm_idx, tptr) + + else + call pbuf_set_field(pbuf2d, sgh_idx, 0._r8) + call pbuf_set_field(pbuf2d, sgh30_idx, 0._r8) + call pbuf_set_field(pbuf2d, landm_idx, 0._r8) + end if + + call infld('PBLH', fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr(:,:), found, gridname='physgrid') + if(.not. found) then + tptr(:,:) = 0._r8 + if (masterproc) write(iulog,*) 'PBLH initialized to 0.' + end if + pblh_idx = pbuf_get_index('pblh') + + call pbuf_set_field(pbuf2d, pblh_idx, tptr) + + call infld('TPERT', fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr(:,:), found, gridname='physgrid') + if(.not. found) then + tptr(:,:) = 0._r8 + if (masterproc) write(iulog,*) 'TPERT initialized to 0.' + end if + tpert_idx = pbuf_get_index( 'tpert') + call pbuf_set_field(pbuf2d, tpert_idx, tptr) + + fieldname='QPERT' + qpert_idx = pbuf_get_index( 'qpert',ierr) + if (qpert_idx > 0) then + call infld(fieldname, fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr, found, gridname='physgrid') + if(.not. found) then + tptr=0_r8 + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' + end if + + allocate(tptr3d_2(pcols,pcnst,begchunk:endchunk)) + tptr3d_2 = 0_r8 + tptr3d_2(:,1,:) = tptr(:,:) + + call pbuf_set_field(pbuf2d, qpert_idx, tptr3d_2) + deallocate(tptr3d_2) + end if + + fieldname='CUSH' + m = pbuf_get_index('cush', ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & + tptr, found, gridname='physgrid') + if(.not.found) then + if(masterproc) write(iulog,*) trim(fieldname), ' initialized to 1000.' + tptr=1000._r8 + end if + do n=1,dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr, start=(/1,n/), kount=(/pcols,1/)) + end do + deallocate(tptr) + end if + + ! + ! 3-D fields + ! + + allocate(tptr3d(pcols,pver,begchunk:endchunk)) + + fieldname='CLOUD' + m = pbuf_get_index('CLD') + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(found) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + else + call pbuf_set_field(pbuf2d, m, 0._r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' + end if + + fieldname='QCWAT' + m = pbuf_get_index(fieldname,ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(.not. found) then + call infld('Q',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if (found) then + if (masterproc) write(iulog,*) trim(fieldname), ' initialized with Q' + if(dycore_is('LR')) call polar_average(pver, tptr3d) + else + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to huge()' + tptr3d = huge(1.0_r8) + end if + end if + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + end if + + fieldname = 'ICCWAT' + m = pbuf_get_index(fieldname, ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(found) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + else + call cnst_get_ind('CLDICE', ixcldice) + call infld('CLDICE',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(found) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + else + call pbuf_set_field(pbuf2d, m, 0._r8) + end if + if (masterproc) then + if (found) then + write(iulog,*) trim(fieldname), ' initialized with CLDICE' + else + write(iulog,*) trim(fieldname), ' initialized to 0.0' + end if + end if + end if + end if + + fieldname = 'LCWAT' + m = pbuf_get_index(fieldname,ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(found) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + else + allocate(tptr3d_2(pcols,pver,begchunk:endchunk)) + call cnst_get_ind('CLDICE', ixcldice) + call cnst_get_ind('CLDLIQ', ixcldliq) + call infld('CLDICE',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + call infld('CLDLIQ',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d_2, found2, gridname='physgrid') + if(found .and. found2) then + do lchnk = begchunk, endchunk + ncol = get_ncols_p(lchnk) + tptr3d(:ncol,:,lchnk)=tptr3d(:ncol,:,lchnk)+tptr3d_2(:ncol,:,lchnk) + end do + if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDICE + CLDLIQ' + else if (found) then ! Data already loaded in tptr3d + if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDICE only' + else if (found2) then + tptr3d(:,:,:)=tptr3d_2(:,:,:) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDLIQ only' + end if + + if (found .or. found2) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + if(dycore_is('LR')) call polar_average(pver, tptr3d) + else + call pbuf_set_field(pbuf2d, m, 0._r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.0' + end if + deallocate(tptr3d_2) + end if + end if + + deallocate(tptr3d) + allocate(tptr3d(pcols,pver,begchunk:endchunk)) + + fieldname = 'TCWAT' + m = pbuf_get_index(fieldname,ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(.not.found) then + call infld('T', fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if (found) then + if(dycore_is('LR')) call polar_average(pver, tptr3d) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized with T' + else + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to huge()' + tptr3d = huge(1._r8) + end if + end if + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + end if + + deallocate(tptr3d) + allocate(tptr3d(pcols,pverp,begchunk:endchunk)) + + fieldname = 'TKE' + m = pbuf_get_index( 'tke') + call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if (found) then + call pbuf_set_field(pbuf2d, m, tptr3d) + else + call pbuf_set_field(pbuf2d, m, 0.01_r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.01' + end if + + + fieldname = 'KVM' + m = pbuf_get_index('kvm') + call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if (found) then + call pbuf_set_field(pbuf2d, m, tptr3d) + else + call pbuf_set_field(pbuf2d, m, 0._r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' + end if + + + fieldname = 'KVH' + m = pbuf_get_index('kvh') + call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if (found) then + call pbuf_set_field(pbuf2d, m, tptr3d) + else + call pbuf_set_field(pbuf2d, m, 0._r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' + end if + + deallocate(tptr3d) + allocate(tptr3d(pcols,pver,begchunk:endchunk)) + + fieldname = 'CONCLD' + m = pbuf_get_index('CONCLD',ierr) + if (m > 0) then + call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & + tptr3d, found, gridname='physgrid') + if(found) then + do n = 1, dyn_time_lvls + call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) + end do + else + call pbuf_set_field(pbuf2d, m, 0._r8) + if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' + end if + + deallocate (tptr3d) + end if + + call initialize_short_lived_species(fh_ini, pbuf2d) + + !--------------------------------------------------------------------------------- + ! If needed, get ion and electron temperature fields from initial condition file + !--------------------------------------------------------------------------------- + + call waccmx_phys_ion_elec_temp_inidat(fh_ini,pbuf2d) + + end subroutine phys_inidat + + + subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) + + !----------------------------------------------------------------------- + ! + ! Initialization of physics package. + ! + !----------------------------------------------------------------------- + + use physics_buffer, only: physics_buffer_desc, pbuf_initialize, pbuf_get_index + use physconst, only: rair, cpair, gravit, stebol, tmelt, & + latvap, latice, rh2o, rhoh2o, pstd, zvir, & + karman, rhodair, physconst_init + use ref_pres, only: pref_edge, pref_mid + + use carma_intr, only: carma_init + use cam_control_mod, only: initial_run + use check_energy, only: check_energy_init + use chemistry, only: chem_init + use prescribed_ozone, only: prescribed_ozone_init + use prescribed_ghg, only: prescribed_ghg_init + use prescribed_aero, only: prescribed_aero_init + use aerodep_flx, only: aerodep_flx_init + use aircraft_emit, only: aircraft_emit_init + use prescribed_volcaero,only: prescribed_volcaero_init + use prescribed_strataero,only: prescribed_strataero_init + use cloud_fraction, only: cldfrc_init + use cldfrc2m, only: cldfrc2m_init + use co2_cycle, only: co2_init, co2_transport + use convect_deep, only: convect_deep_init + use convect_shallow, only: convect_shallow_init + use cam_diagnostics, only: diag_init + use gw_drag, only: gw_init + use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_init + use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_init + use radheat, only: radheat_init + use radiation, only: radiation_init + use cloud_diagnostics, only: cloud_diagnostics_init + use rk_stratiform, only: rk_stratiform_init + use wv_saturation, only: wv_sat_init + use microp_driver, only: microp_driver_init + use microp_aero, only: microp_aero_init + use macrop_driver, only: macrop_driver_init + use conv_water, only: conv_water_init + use spcam_drivers, only: spcam_init + use tracers, only: tracers_init + use aoa_tracers, only: aoa_tracers_init + use rayleigh_friction, only: rayleigh_friction_init + use pbl_utils, only: pbl_utils_init + use vertical_diffusion, only: vertical_diffusion_init + use phys_debug_util, only: phys_debug_init + use phys_debug, only: phys_debug_state_init + use rad_constituents, only: rad_cnst_init + use aer_rad_props, only: aer_rad_props_init + use subcol, only: subcol_init + use qbo, only: qbo_init + use qneg_module, only: qneg_init + use lunar_tides, only: lunar_tides_init + use iondrag, only: iondrag_init, do_waccm_ions +#if ( defined OFFLINE_DYN ) + use metdata, only: metdata_phys_init +#endif + use epp_ionization, only: epp_ionization_init, epp_ionization_active + use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_init ! Initialization of ionosphere module (WACCM-X) + use waccmx_phys_intr, only: waccmx_phys_mspd_init ! Initialization of major species diffusion module (WACCM-X) + use clubb_intr, only: clubb_ini_cam + 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 cam_abortutils, only: endrun + use nudging, only: Nudge_Model, nudging_init + use cam_snapshot, only: cam_snapshot_init + use cam_history, only: addfld, register_vector_field, add_default + use phys_control, only: phys_getopts + + ! Input/output arguments + type(physics_state), pointer :: phys_state(:) + type(physics_tend ), pointer :: phys_tend(:) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + type(cam_in_t), intent(in) :: cam_in(begchunk:endchunk) + type(cam_out_t),intent(inout) :: cam_out(begchunk:endchunk) + + ! local variables + integer :: lchnk + integer :: ierr + + logical :: history_budget ! output tendencies and state variables for + ! temperature, water vapor, cloud + ! ice, cloud liquid, U, V + integer :: history_budget_histfile_num ! output history file number for budget fields + + !----------------------------------------------------------------------- + + call physics_type_alloc(phys_state, phys_tend, begchunk, endchunk, pcols) + + do lchnk = begchunk, endchunk + call physics_state_set_grid(lchnk, phys_state(lchnk)) + end do + + !------------------------------------------------------------------------------------------- + ! Initialize any variables in physconst which are not temporally and/or spatially constant + !------------------------------------------------------------------------------------------- + call physconst_init() + + ! Initialize debugging a physics column + call phys_debug_init() + + call pbuf_initialize(pbuf2d) + + ! Initialize subcol scheme + call subcol_init(pbuf2d) + + ! diag_init makes addfld calls for dynamics fields that are output from + ! the physics decomposition + call diag_init(pbuf2d) + + call check_energy_init() + + call tracers_init() + + ! age of air tracers + call aoa_tracers_init() + + teout_idx = pbuf_get_index( 'TEOUT') + + ! adiabatic or ideal physics should be only used if in simple_physics + if (adiabatic .or. ideal_phys) then + if (adiabatic) then + call endrun('phys_init: adiabatic configuration error') + else + call endrun('phys_init: ideal_phys configuration error') + end if + end if + + if (initial_run) then + call phys_inidat(cam_out, pbuf2d) + end if + + ! wv_saturation is relatively independent of everything else and + ! low level, so init it early. Must at least do this before radiation. + call wv_sat_init + + ! CAM3 prescribed aerosols + if (cam3_aero_data_on) call cam3_aero_data_init(phys_state) + + ! Initialize rad constituents and their properties + call rad_cnst_init() + call aer_rad_props_init() + + ! initialize carma + call carma_init() + + ! solar irradiance data modules + call solar_data_init() + + ! Prognostic chemistry. + call chem_init(phys_state,pbuf2d) + + ! Prescribed tracers + call prescribed_ozone_init() + call prescribed_ghg_init() + call prescribed_aero_init() + call aerodep_flx_init() + call aircraft_emit_init() + call prescribed_volcaero_init() + call prescribed_strataero_init() + + ! co2 cycle + if (co2_transport()) then + call co2_init() + end if + + ! CAM3 prescribed ozone + if (cam3_ozone_data_on) call cam3_ozone_data_init(phys_state) + + call gw_init() + + call rayleigh_friction_init() + + call pbl_utils_init(gravit, karman, cpair, rair, zvir) + call vertical_diffusion_init(pbuf2d) + + if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then + call waccmx_phys_mspd_init () + ! Initialization of ionosphere module if mode set to ionosphere + if( waccmx_is('ionosphere') ) then + call waccmx_phys_ion_elec_temp_init(pbuf2d) + endif + endif + + call radiation_init(pbuf2d) + + call cloud_diagnostics_init() + + call radheat_init(pref_mid) + + call convect_shallow_init(pref_edge, pbuf2d) + + call cldfrc_init() + call cldfrc2m_init() + + call convect_deep_init(pref_edge) + + if( microp_scheme == 'RK' ) then + call rk_stratiform_init() + elseif( microp_scheme == 'MG' ) then + if (.not. do_clubb_sgs) call macrop_driver_init(pbuf2d) + call microp_aero_init(pbuf2d) + call microp_driver_init(pbuf2d) + call conv_water_init + elseif( microp_scheme == 'SPCAM_m2005') then + call conv_water_init + end if + + + ! initiate CLUBB within CAM + if (do_clubb_sgs) call clubb_ini_cam(pbuf2d) + + call spcam_init(pbuf2d) + + call qbo_init + + call lunar_tides_init() + + call iondrag_init(pref_mid) + ! Geomagnetic module -- after iondrag_init + if (epp_ionization_active) then + call epp_ionization_init() + endif + +#if ( defined OFFLINE_DYN ) + call metdata_phys_init() +#endif + call sslt_rebin_init() + call tropopause_init() + call dadadj_init() + + prec_dp_idx = pbuf_get_index('PREC_DP') + snow_dp_idx = pbuf_get_index('SNOW_DP') + prec_sh_idx = pbuf_get_index('PREC_SH') + snow_sh_idx = pbuf_get_index('SNOW_SH') + + dlfzm_idx = pbuf_get_index('DLFZM', ierr) + cmfmczm_idx = pbuf_get_index('CMFMCDZM') + + call phys_getopts(prog_modal_aero_out=prog_modal_aero) + + ! Initialize Nudging Parameters + !-------------------------------- + if(Nudge_Model) call nudging_init + + if (clim_modal_aero) then + + ! If climate calculations are affected by prescribed modal aerosols, the + ! the initialization routine for the dry mode radius calculation is called + ! here. For prognostic MAM the initialization is called from + ! modal_aero_initialize + if (.not. prog_modal_aero) then + call modal_aero_calcsize_init(pbuf2d) + endif + + call modal_aero_wateruptake_init(pbuf2d) + + end if + + ! Initialize qneg3 and qneg4 + call qneg_init() + + ! Initialize the snapshot capability + call cam_snapshot_init(cam_in, cam_out, pbuf2d, begchunk) + + ! 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') + call addfld ( 'VTEND_DCONV', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by deep convection') + call register_vector_field ( 'UTEND_DCONV', 'VTEND_DCONV') + call addfld ( 'UTEND_SHCONV', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by shallow convection') + call addfld ( 'VTEND_SHCONV', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by shallow convection') + call register_vector_field ( 'UTEND_SHCONV', 'VTEND_SHCONV') + call addfld ( 'UTEND_MACROP', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by macrophysics') + call addfld ( 'VTEND_MACROP', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by macrophysics') + call register_vector_field ( 'UTEND_MACROP', 'VTEND_MACROP') + call addfld ( 'UTEND_VDIFF', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by vert. diffus.') + call addfld ( 'VTEND_VDIFF', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by vert. diffus.') + call register_vector_field ( 'UTEND_VDIFF', 'VTEND_VDIFF') + call addfld ( 'UTEND_RAYLEIGH', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by Rayleigh Fric.') + call addfld ( 'VTEND_RAYLEIGH', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by Rayleigh Fric.') + call register_vector_field ( 'UTEND_RAYLEIGH', 'VTEND_RAYLEIGH') + call addfld ( 'UTEND_GWDTOT', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by all GWs') + call addfld ( 'VTEND_GWDTOT', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by all GWs') + call register_vector_field ( 'UTEND_GWDTOT', 'VTEND_GWDTOT') + call addfld ( 'UTEND_QBORLX', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by QBO relaxation') + call addfld ( 'VTEND_QBORLX', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by QBO relaxation') + call register_vector_field ( 'UTEND_QBORLX', 'VTEND_QBORLX') + call addfld ( 'UTEND_LUNART', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by lunar tides') + call addfld ( 'VTEND_LUNART', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by lunar tides') + call register_vector_field ( 'UTEND_LUNART', 'VTEND_LUNART') + call addfld ( 'UTEND_IONDRG', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by ion drag') + call addfld ( 'VTEND_IONDRG', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by ion drag') + call register_vector_field ( 'UTEND_IONDRG', 'VTEND_IONDRG') + call addfld ( 'UTEND_NDG', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by nudging') + call addfld ( 'VTEND_NDG', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by nudging') + call register_vector_field ( 'UTEND_NDG', 'VTEND_NDG') + call addfld('UTEND_CORE', (/ 'lev' /), 'A', 'm/s2' , 'Zonal wind tendency due to dynamical core') + call addfld('VTEND_CORE', (/ 'lev' /), 'A', 'm/s2' , 'Meridional wind tendency due to dynamical core') + call register_vector_field('UTEND_CORE','VTEND_CORE') + + + call phys_getopts(history_budget_out = history_budget, & + history_budget_histfile_num_out = history_budget_histfile_num) + + if ( history_budget ) then + call add_default ( 'UTEND_DCONV' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_DCONV' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_SHCONV' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_SHCONV' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_MACROP' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_MACROP' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_VDIFF' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_VDIFF' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_RAYLEIGH' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_RAYLEIGH' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_GWDTOT' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_GWDTOT' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_QBORLX' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_QBORLX' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_LUNART' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_LUNART' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_IONDRG' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_IONDRG' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_NDG' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_NDG' , history_budget_histfile_num, ' ') + call add_default ( 'UTEND_CORE' , history_budget_histfile_num, ' ') + call add_default ( 'VTEND_CORE' , history_budget_histfile_num, ' ') + end if + + ducore_idx = pbuf_get_index('DUCORE') + dvcore_idx = pbuf_get_index('DVCORE') + + end subroutine phys_init + + ! + !----------------------------------------------------------------------- + ! + + subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out) + !----------------------------------------------------------------------- + ! + ! Purpose: + ! First part of atmospheric physics package before updating of surface models + ! + !----------------------------------------------------------------------- + use time_manager, only: get_nstep + use cam_diagnostics,only: diag_allocate, diag_physvar_ic + use check_energy, only: check_energy_gmean + use phys_control, only: phys_getopts + use spcam_drivers, only: tphysbc_spcam + use spmd_utils, only: mpicom + use physics_buffer, only: physics_buffer_desc, pbuf_get_chunk, pbuf_allocate +#if (defined BFB_CAM_SCAM_IOP ) + use cam_history, only: outfld +#endif + use cam_abortutils, only: endrun +#if ( defined OFFLINE_DYN ) + use metdata, only: get_met_srf1 +#endif + ! + ! Input arguments + ! + real(r8), intent(in) :: ztodt ! physics time step unless nstep=0 + ! + ! Input/Output 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, dimension(:,:) :: pbuf2d + type(cam_in_t), dimension(begchunk:endchunk) :: cam_in + type(cam_out_t), dimension(begchunk:endchunk) :: cam_out + !----------------------------------------------------------------------- + ! + !---------------------------Local workspace----------------------------- + ! + integer :: c ! indices + integer :: ncol ! number of columns + integer :: nstep ! current timestep number + logical :: use_spcam + type(physics_buffer_desc), pointer :: phys_buffer_chunk(:) + + call t_startf ('physpkg_st1') + nstep = get_nstep() + +#if ( defined OFFLINE_DYN ) + ! + ! if offline mode set SNOWH and TS for micro-phys + ! + call get_met_srf1( cam_in ) +#endif + + ! The following initialization depends on the import state (cam_in) + ! being initialized. This isn't true when cam_init is called, so need + ! to postpone this initialization to here. + if (nstep == 0 .and. phys_do_flux_avg()) call flux_avg_init(cam_in, pbuf2d) + + ! Compute total energy of input state and previous output state + call t_startf ('chk_en_gmean') + call check_energy_gmean(phys_state, pbuf2d, ztodt, nstep) + call t_stopf ('chk_en_gmean') + + call t_stopf ('physpkg_st1') + + call t_startf ('physpkg_st1') + + call pbuf_allocate(pbuf2d, 'physpkg') + call diag_allocate() + + !----------------------------------------------------------------------- + ! Advance time information + !----------------------------------------------------------------------- + + call phys_timestep_init(phys_state, cam_in, cam_out, pbuf2d) + + call t_stopf ('physpkg_st1') + +#ifdef TRACER_CHECK + call gmean_mass ('before tphysbc DRY', phys_state) +#endif + + + !----------------------------------------------------------------------- + ! Tendency physics before flux coupler invocation + !----------------------------------------------------------------------- + ! + +#if (defined BFB_CAM_SCAM_IOP ) + do c=begchunk, endchunk + call outfld('Tg',cam_in(c)%ts,pcols ,c ) + end do +#endif + + call t_barrierf('sync_bc_physics', mpicom) + call t_startf ('bc_physics') + call t_adj_detailf(+1) + + call phys_getopts( use_spcam_out = use_spcam) + +!$OMP PARALLEL DO PRIVATE (C, phys_buffer_chunk) + do c=begchunk, endchunk + ! + ! Output physics terms to IC file + ! + phys_buffer_chunk => pbuf_get_chunk(pbuf2d, c) + + call t_startf ('diag_physvar_ic') + call diag_physvar_ic ( c, phys_buffer_chunk, cam_out(c), cam_in(c) ) + call t_stopf ('diag_physvar_ic') + + if (use_spcam) then + call tphysbc_spcam (ztodt, phys_state(c), & + phys_tend(c), phys_buffer_chunk, & + cam_out(c), cam_in(c) ) + else + call tphysbc (ztodt, phys_state(c), & + phys_tend(c), phys_buffer_chunk, & + cam_out(c), cam_in(c) ) + end if + + end do + + call t_adj_detailf(-1) + call t_stopf ('bc_physics') + + ! Don't call the rest in CRM mode + if(single_column.and.scm_crm_mode) return + +#ifdef TRACER_CHECK + call gmean_mass ('between DRY', phys_state) +#endif + + end subroutine phys_run1 + + ! + !----------------------------------------------------------------------- + ! + + subroutine phys_run2(phys_state, ztodt, phys_tend, pbuf2d, cam_out, & + cam_in ) + !----------------------------------------------------------------------- + ! + ! Purpose: + ! Second part of atmospheric physics package after updating of surface models + ! + !----------------------------------------------------------------------- + use physics_buffer, only: physics_buffer_desc, pbuf_get_chunk, pbuf_deallocate, pbuf_update_tim_idx + use mo_lightning, only: lightning_no_prod + use cam_diagnostics, only: diag_deallocate, diag_surf + use physconst, only: stebol, latvap + use carma_intr, only: carma_accumulate_stats + use spmd_utils, only: mpicom + use iop_forcing, only: scam_use_iop_srf +#if ( defined OFFLINE_DYN ) + use metdata, only: get_met_srf2 +#endif + ! + ! Input arguments + ! + real(r8), intent(in) :: ztodt ! physics time step unless nstep=0 + ! + ! Input/Output 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, dimension(:,:) :: pbuf2d + + type(cam_out_t), intent(inout), dimension(begchunk:endchunk) :: cam_out + type(cam_in_t), intent(inout), dimension(begchunk:endchunk) :: cam_in + ! + !----------------------------------------------------------------------- + !---------------------------Local workspace----------------------------- + ! + integer :: c ! chunk index + integer :: ncol ! number of columns + type(physics_buffer_desc),pointer, dimension(:) :: phys_buffer_chunk + ! + ! If exit condition just return + ! + + if(single_column.and.scm_crm_mode) return + !----------------------------------------------------------------------- + ! if using IOP values for surface fluxes overwrite here after surface components run + !----------------------------------------------------------------------- + if (single_column) call scam_use_iop_srf(cam_in) + + !----------------------------------------------------------------------- + ! Tendency physics after coupler + ! Not necessary at terminal timestep. + !----------------------------------------------------------------------- + ! +#if ( defined OFFLINE_DYN ) + ! + ! if offline mode set SHFLX QFLX TAUX TAUY for vert diffusion + ! + call get_met_srf2( cam_in ) +#endif + ! Set lightning production of NO + call t_startf ('lightning_no_prod') + call lightning_no_prod( phys_state, pbuf2d, cam_in ) + call t_stopf ('lightning_no_prod') + + call t_barrierf('sync_ac_physics', mpicom) + call t_startf ('ac_physics') + call t_adj_detailf(+1) + +!$OMP PARALLEL DO PRIVATE (C, NCOL, phys_buffer_chunk) + + do c=begchunk,endchunk + ncol = get_ncols_p(c) + phys_buffer_chunk => pbuf_get_chunk(pbuf2d, c) + ! + ! surface diagnostics for history files + ! + call t_startf('diag_surf') + call diag_surf(cam_in(c), cam_out(c), phys_state(c), phys_buffer_chunk) + call t_stopf('diag_surf') + + call tphysac(ztodt, cam_in(c), & + cam_out(c), & + phys_state(c), phys_tend(c), phys_buffer_chunk) + end do ! Chunk loop + + call t_adj_detailf(-1) + call t_stopf('ac_physics') + +#ifdef TRACER_CHECK + call gmean_mass ('after tphysac FV:WET)', phys_state) +#endif + + call t_startf ('carma_accumulate_stats') + call carma_accumulate_stats() + call t_stopf ('carma_accumulate_stats') + + call t_startf ('physpkg_st2') + call pbuf_deallocate(pbuf2d, 'physpkg') + + call pbuf_update_tim_idx() + call diag_deallocate() + call t_stopf ('physpkg_st2') + + end subroutine phys_run2 + + ! + !----------------------------------------------------------------------- + ! + + subroutine phys_final( phys_state, phys_tend, pbuf2d ) + use physics_buffer, only : physics_buffer_desc, pbuf_deallocate + use chemistry, only : chem_final + use carma_intr, only : carma_final + use wv_saturation, only : wv_sat_final + !----------------------------------------------------------------------- + ! + ! Purpose: + ! Finalization of physics package + ! + !----------------------------------------------------------------------- + ! Input/output arguments + type(physics_state), pointer :: phys_state(:) + type(physics_tend ), pointer :: phys_tend(:) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + if(associated(pbuf2d)) then + call pbuf_deallocate(pbuf2d,'global') + deallocate(pbuf2d) + end if + deallocate(phys_state) + deallocate(phys_tend) + call chem_final + call carma_final + call wv_sat_final + + end subroutine phys_final + + + subroutine tphysac (ztodt, cam_in, & + cam_out, state, tend, pbuf) + !----------------------------------------------------------------------- + ! + ! Tendency physics after coupling to land, sea, and ice models. + ! + ! Computes the following: + ! + ! o Aerosol Emission at Surface + ! o Stratiform Macro-Microphysics + ! o Wet Scavenging of Aerosol + ! o Radiation + ! o Source-Sink for Advected Tracers + ! o Symmetric Turbulence Scheme - Vertical Diffusion + ! o Rayleigh Friction + ! o Dry Deposition of Aerosol + ! o Enforce Charge Neutrality ( Only for WACCM ) + ! o Gravity Wave Drag + ! o QBO Relaxation ( Only for WACCM ) + ! o Ion Drag ( Only for WACCM ) + ! o Scale Dry Mass Energy + !----------------------------------------------------------------------- + use physics_buffer, only: physics_buffer_desc, pbuf_set_field, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx + use shr_kind_mod, only: r8 => shr_kind_r8 + use chemistry, only: chem_is_active, chem_timestep_tend, chem_emissions + use cam_diagnostics, only: diag_phys_tend_writeout + use gw_drag, only: gw_tend + use vertical_diffusion, only: vertical_diffusion_tend + use rayleigh_friction, only: rayleigh_friction_tend + use constituents, only: cnst_get_ind + use physics_types, only: physics_state, physics_tend, physics_ptend, physics_update, & + physics_dme_adjust, set_dry_to_wet, physics_state_check + use waccmx_phys_intr, only: waccmx_phys_mspd_tend ! WACCM-X major diffusion + use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_tend ! WACCM-X + use aoa_tracers, only: aoa_tracers_timestep_tend + use physconst, only: rhoh2o, latvap,latice + use aero_model, only: aero_model_drydep + use check_energy, only: check_energy_chng, calc_te_and_aam_budgets + use check_energy, only: check_tracers_data, check_tracers_init, check_tracers_chng + use time_manager, only: get_nstep + use cam_abortutils, only: endrun + use dycore, only: dycore_is + use cam_control_mod, only: aqua_planet + use mo_gas_phase_chemdr,only: map2chm + use clybry_fam, only: clybry_fam_set + use charge_neutrality, only: charge_balance + use qbo, only: qbo_relax + use iondrag, only: iondrag_calc, do_waccm_ions + use perf_mod + use flux_avg, only: flux_avg_run + use cam_history, only: hist_fld_active, outfld + use qneg_module, only: qneg4 + use co2_cycle, only: co2_cycle_set_ptend + use nudging, only: Nudge_Model,Nudge_ON,nudging_timestep_tend + use cam_snapshot, only: cam_snapshot_all_outfld_tphysac + use cam_snapshot, only: cam_snapshot_ptend_outfld + use lunar_tides, only: lunar_tides_tend +!+++ARH +! use ssatcontrail, only: ssatcontrail_d0 +!---ARH + use physics_types, only: physics_ptend_init, physics_ptend_sum, physics_ptend_scale + use cam_snapshot, only: cam_snapshot_all_outfld_tphysbc + use microp_driver, only: microp_driver_tend + use microp_aero, only: microp_aero_run + use macrop_driver, only: macrop_driver_tend + use clubb_intr, only: clubb_tend_cam + use subcol, only: subcol_gen, subcol_ptend_avg + use subcol_utils, only: subcol_ptend_copy, is_subcol_on + use subcol_SILHS, only: subcol_SILHS_var_covar_driver + use subcol_SILHS, only: subcol_SILHS_fill_holes_conserv + use subcol_SILHS, only: subcol_SILHS_hydromet_conc_tend_lim + use micro_mg_cam, only: massless_droplet_destroyer + use convect_deep, only: convect_deep_tend_2, deep_scheme_does_scav_trans + use cloud_diagnostics, only: cloud_diagnostics_calc + use radiation, only: radiation_tend + use tropopause, only: tropopause_output + use cam_diagnostics, only: diag_phys_writeout, diag_conv, diag_clip_tend_writeout + use aero_model, only: aero_model_wetdep + use physics_buffer, only: col_type_subcol + use check_energy, only: check_energy_timestep_init + ! + ! Arguments + ! + real(r8), intent(in) :: ztodt ! Two times model timestep (2 delta-t) + + type(cam_in_t), intent(inout) :: cam_in + type(cam_out_t), intent(inout) :: cam_out + type(physics_state), intent(inout) :: state + type(physics_tend ), intent(inout) :: tend + type(physics_buffer_desc), pointer :: pbuf(:) + + + type(check_tracers_data):: tracerint ! tracer mass integrals and cummulative boundary fluxes + + ! + !---------------------------Local workspace----------------------------- + ! + type(physics_ptend) :: ptend ! indivdual parameterization tendencies + type(physics_ptend) :: ptend_macp_all ! sum of macrophysics tendencies (e.g. CLUBB) over substeps + type(physics_state) :: state_sc ! state for sub-columns + type(physics_ptend) :: ptend_sc ! ptend for sub-columns + type(physics_ptend) :: ptend_aero ! ptend for microp_aero + type(physics_ptend) :: ptend_aero_sc ! ptend for microp_aero on sub-columns + type(physics_tend) :: tend_sc ! tend for sub-columns + + integer :: nstep ! current timestep number + real(r8) :: zero(pcols) ! array of zeros + + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns + integer i,k,m ! Longitude, level indices + integer :: yr, mon, day, tod ! components of a date + integer :: ixq, ixcldice, ixcldliq ! constituent indices for vapor, cloud liquid and ice water. + + ! for macro/micro co-substepping + integer :: macmic_it ! iteration variables + real(r8) :: cld_macmic_ztodt ! modified timestep + + 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) pflx(pcols,pverp) ! Conv rain flux thru out btm of lev + real(r8) rtdt ! 1./ztodt + + 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) :: zero_sc(pcols*psubcols) ! array of zeros + real(r8) :: zero_tracers(pcols,pcnst) + + real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. + real(r8), pointer :: cmfmczm(:,:) ! ZM convective mass fluxes + + ! stratiform precipitation variables + real(r8),pointer :: prec_str(:) ! sfc flux of precip from stratiform (m/s) + real(r8),pointer :: snow_str(:) ! sfc flux of snow from stratiform (m/s) + real(r8),pointer :: prec_str_sc(:) ! sfc flux of precip from stratiform (m/s) -- for subcolumns + real(r8),pointer :: snow_str_sc(:) ! sfc flux of snow from stratiform (m/s) -- for subcolumns + real(r8),pointer :: prec_pcw(:) ! total precip from prognostic cloud scheme + real(r8),pointer :: snow_pcw(:) ! snow from prognostic cloud scheme + real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation + real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation + + ! Local copies for substepping + real(r8) :: prec_pcw_macmic(pcols) + real(r8) :: snow_pcw_macmic(pcols) + real(r8) :: prec_sed_macmic(pcols) + real(r8) :: snow_sed_macmic(pcols) + + 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) :: tmp_q (pcols,pver) ! tmp space + real(r8) :: tmp_cldliq(pcols,pver) ! tmp space + real(r8) :: tmp_cldice(pcols,pver) ! tmp space + real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space + real(r8) :: tmp_pdel (pcols,pver) ! tmp space + real(r8) :: tmp_ps (pcols) ! tmp space + + ! physics buffer fields for total energy and mass adjustment + integer itim_old, ifld + + real(r8), pointer, dimension(:,:) :: cld + real(r8), pointer, dimension(:,:) :: qini + real(r8), pointer, dimension(:,:) :: cldliqini + real(r8), pointer, dimension(:,:) :: cldiceini + real(r8), pointer, dimension(:,:) :: dtcore + real(r8), pointer, dimension(:,:) :: ducore + real(r8), pointer, dimension(:,:) :: dvcore + real(r8), pointer, dimension(:,:) :: ast ! relative humidity cloud fraction + + !----------------------------------------------------------------------- + lchnk = state%lchnk + ncol = state%ncol + + nstep = get_nstep() + rtdt = 1._r8/ztodt + + call cnst_get_ind('Q', ixq) + call cnst_get_ind('CLDLIQ', ixcldliq) + call cnst_get_ind('CLDICE', ixcldice) + + call pbuf_get_field(pbuf, prec_str_idx, prec_str ) + call pbuf_get_field(pbuf, snow_str_idx, snow_str ) + call pbuf_get_field(pbuf, prec_sed_idx, prec_sed ) + call pbuf_get_field(pbuf, snow_sed_idx, snow_sed ) + call pbuf_get_field(pbuf, prec_pcw_idx, prec_pcw ) + call pbuf_get_field(pbuf, snow_pcw_idx, snow_pcw ) + + if (is_subcol_on()) then + call pbuf_get_field(pbuf, prec_str_idx, prec_str_sc, col_type=col_type_subcol) + call pbuf_get_field(pbuf, snow_str_idx, snow_str_sc, col_type=col_type_subcol) + end if + + if (dlfzm_idx > 0) then + call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) + dlf(:ncol,:) = dlfzm(:ncol,:) + else + dlf(:,:) = 0._r8 + end if + call pbuf_get_field(pbuf, cmfmczm_idx, cmfmczm) + cmfmc(:ncol,:) = cmfmczm + + ! Adjust the surface fluxes to reduce instabilities in near sfc layer + if (phys_do_flux_avg()) then + call flux_avg_run(state, cam_in, pbuf, nstep, ztodt) + endif + + ! Validate the physics state. + if (state_debug_checks) & + call physics_state_check(state, name="before tphysac") + + call t_startf('tphysac_init') + ! Associate pointers with physics buffer fields + itim_old = pbuf_old_tim_idx() + + + ifld = pbuf_get_index('DTCORE') + call pbuf_get_field(pbuf, ifld, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + + call pbuf_get_field(pbuf, qini_idx, qini) + call pbuf_get_field(pbuf, cldliqini_idx, cldliqini) + call pbuf_get_field(pbuf, cldiceini_idx, cldiceini) + + ifld = pbuf_get_index('CLD') + call pbuf_get_field(pbuf, ifld, cld, start=(/1,1,itim_old/),kount=(/pcols,pver,1/)) + + ifld = pbuf_get_index('AST') + call pbuf_get_field(pbuf, ifld, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + + ! + ! accumulate fluxes into net flux array for spectral dycores + ! jrm Include latent heat of fusion for snow + ! + do i=1,ncol + tend%flx_net(i) = tend%flx_net(i) + cam_in%shf(i) + (cam_out%precc(i) & + + cam_out%precl(i))*latvap*rhoh2o & + + (cam_out%precsc(i) + cam_out%precsl(i))*latice*rhoh2o + end do + + ! emissions of aerosols and gas-phase chemistry constituents at surface + + if (trim(cam_take_snapshot_before) == "chem_emissions") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + call chem_emissions( state, cam_in ) + if (trim(cam_take_snapshot_after) == "chem_emissions") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + ! get nstep and zero array for energy checker + zero = 0._r8 + zero_sc(:) = 0._r8 + zero_tracers(:,:) = 0._r8 + nstep = get_nstep() + call check_tracers_init(state, tracerint) + + ! Check if latent heat flux exceeds the total moisture content of the + ! lowest model layer, thereby creating negative moisture. + + call qneg4('TPHYSAC', lchnk, ncol, ztodt , & + state%q(1,pver,1), state%rpdel(1,pver), & + cam_in%shf, cam_in%lhf, cam_in%cflx) + + call t_stopf('tphysac_init') + + if( microp_scheme == 'MG' ) then + ! Start co-substepping of macrophysics and microphysics + cld_macmic_ztodt = ztodt/cld_macmic_num_steps + + ! Clear precip fields that should accumulate. + prec_sed_macmic = 0._r8 + snow_sed_macmic = 0._r8 + prec_pcw_macmic = 0._r8 + snow_pcw_macmic = 0._r8 + +!+++ARH +! ! contrail parameterization +! ! see Chen et al., 2012: Global contrail coverage simulated +! ! by CAM5 with the inventory of 2006 global aircraft emissions, JAMES +! ! https://doi.org/10.1029/2011MS000105 +! call ssatcontrail_d0(state, pbuf, ztodt, ptend) +! call physics_update(state, ptend, ztodt, tend) +!---ARH + ! initialize ptend structures where macro and microphysics tendencies are + ! accumulated over macmic substeps + call physics_ptend_init(ptend_macp_all,state%psetcols,'macrophysics',lu=.true.,lv=.true.) + + do macmic_it = 1, cld_macmic_num_steps + + !=================================================== + ! Calculate macrophysical tendency (sedimentation, detrain, cloud fraction) + !=================================================== + + call t_startf('macrop_tend') + + ! ===================================================== + ! CLUBB call (PBL, shallow convection, macrophysics) + ! ===================================================== + + if (trim(cam_take_snapshot_before) == "clubb_tend_cam") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call clubb_tend_cam(state, ptend, pbuf, cld_macmic_ztodt,& + cmfmc, cam_in, macmic_it, cld_macmic_num_steps, & + dlf, det_s, det_ice) + + ! Since we "added" the reserved liquid back in this routine, we need + ! to account for it in the energy checker + flx_cnd(:ncol) = -1._r8*rliq(:ncol) + flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) + + ! Unfortunately, physics_update does not know what time period + ! "tend" is supposed to cover, and therefore can't update it + ! with substeps correctly. For now, work around this by scaling + ! ptend down by the number of substeps, then applying it for + ! the full time (ztodt). + call physics_ptend_scale(ptend, 1._r8/cld_macmic_num_steps, ncol) + + ! Update physics tendencies and copy state to state_eq, because that is + ! input for microphysics + if ( (trim(cam_take_snapshot_after) == "clubb_tend_cam") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_ptend_sum(ptend,ptend_macp_all,ncol) + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "clubb_tend_cam") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + ! Use actual qflux (not lhf/latvap) for consistency with surface fluxes and revised code + call check_energy_chng(state, tend, "clubb_tend", nstep, ztodt, & + cam_in%cflx(:ncol,1)/cld_macmic_num_steps, & + flx_cnd(:ncol)/cld_macmic_num_steps, & + det_ice(:ncol)/cld_macmic_num_steps, & + flx_heat(:ncol)/cld_macmic_num_steps) + + call t_stopf('macrop_tend') + + !=================================================== + ! Calculate cloud microphysics + !=================================================== + + if (is_subcol_on()) then + ! Allocate sub-column structures. + call physics_state_alloc(state_sc, lchnk, psubcols*pcols) + call physics_tend_alloc(tend_sc, psubcols*pcols) + + ! Generate sub-columns using the requested scheme + call subcol_gen(state, tend, state_sc, tend_sc, pbuf) + + !Initialize check energy for subcolumns + call check_energy_timestep_init(state_sc, tend_sc, pbuf, col_type_subcol) + end if + + if (trim(cam_take_snapshot_before) == "microp_section") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call t_startf('microp_aero_run') + call microp_aero_run(state, ptend_aero, cld_macmic_ztodt, pbuf) + call t_stopf('microp_aero_run') + + call t_startf('microp_tend') + + if (use_subcol_microp) then + + if (trim(cam_take_snapshot_before) == "microp_driver_tend_subcol") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state_sc, tend_sc, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call microp_driver_tend(state_sc, ptend_sc, cld_macmic_ztodt, pbuf) + ! Parameterize subcolumn effects on covariances, if enabled + if (trim(subcol_scheme) == 'SILHS') & + call subcol_SILHS_var_covar_driver( cld_macmic_ztodt, state_sc, ptend_sc, pbuf ) + + ! Average the sub-column ptend for use in gridded update - will not contain ptend_aero + call subcol_ptend_avg(ptend_sc, state_sc%ngrdcol, lchnk, ptend) + + ! Call the conservative hole filler. + ! Hole filling is only necessary when using subcolumns. + ! Note: this needs to be called after subcol_ptend_avg but before + ! physics_ptend_scale. + if (trim(subcol_scheme) == 'SILHS') & + call subcol_SILHS_fill_holes_conserv( state, cld_macmic_ztodt, & + ptend, pbuf ) + + ! Destroy massless droplets - Note this routine returns with no change unless + ! micro_do_massless_droplet_destroyer has been set to true + call massless_droplet_destroyer( cld_macmic_ztodt, state, & ! Intent(in) + ptend ) ! Intent(inout) + + ! Limit the value of hydrometeor concentrations in order to place + ! reasonable limits on hydrometeor drop size and keep them from + ! becoming too large. + ! Note: this needs to be called after hydrometeor mixing ratio + ! tendencies are adjusted by subcol_SILHS_fill_holes_conserv + ! and after massless drop concentrations are removed by the + ! subcol_SILHS_massless_droplet_destroyer, but before the + ! call to physics_ptend_scale. + if (trim(subcol_scheme) == 'SILHS') & + call subcol_SILHS_hydromet_conc_tend_lim( state, cld_macmic_ztodt, ptend ) + + ! Copy ptend_aero field to one dimensioned by sub-columns before summing with ptend + call subcol_ptend_copy(ptend_aero, state_sc, ptend_aero_sc) + call physics_ptend_sum(ptend_aero_sc, ptend_sc, state_sc%ncol) + call physics_ptend_dealloc(ptend_aero_sc) + + ! Have to scale and apply for full timestep to get tend right + ! (see above note for macrophysics). + call physics_ptend_scale(ptend_sc, 1._r8/cld_macmic_num_steps, ncol) + + if ( (trim(cam_take_snapshot_after) == "microp_driver_tend_subcol") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update (state_sc, ptend_sc, ztodt, tend_sc) + + if (trim(cam_take_snapshot_after) == "microp_driver_tend_subcol") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state_sc, tend_sc, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call check_energy_chng(state_sc, tend_sc, "microp_tend_subcol", & + nstep, ztodt, zero_sc, & + prec_str_sc(:state_sc%ncol)/cld_macmic_num_steps, & + snow_str_sc(:state_sc%ncol)/cld_macmic_num_steps, zero_sc) + + call physics_state_dealloc(state_sc) + call physics_tend_dealloc(tend_sc) + call physics_ptend_dealloc(ptend_sc) + else + call microp_driver_tend(state, ptend, cld_macmic_ztodt, pbuf) + end if + ! combine aero and micro tendencies for the grid + call physics_ptend_sum(ptend_aero, ptend, ncol) + call physics_ptend_dealloc(ptend_aero) + + ! Have to scale and apply for full timestep to get tend right + ! (see above note for macrophysics). + call physics_ptend_scale(ptend, 1._r8/cld_macmic_num_steps, ncol) + + call diag_clip_tend_writeout(state, ptend, ncol, lchnk, ixcldliq, ixcldice, ixq, ztodt, rtdt) + + if ( (trim(cam_take_snapshot_after) == "microp_section") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update (state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "microp_section") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call check_energy_chng(state, tend, "microp_tend", nstep, ztodt, & + zero, prec_str(:ncol)/cld_macmic_num_steps, & + snow_str(:ncol)/cld_macmic_num_steps, zero) + + call t_stopf('microp_tend') + + prec_sed_macmic(:ncol) = prec_sed_macmic(:ncol) + prec_sed(:ncol) + snow_sed_macmic(:ncol) = snow_sed_macmic(:ncol) + snow_sed(:ncol) + prec_pcw_macmic(:ncol) = prec_pcw_macmic(:ncol) + prec_pcw(:ncol) + snow_pcw_macmic(:ncol) = snow_pcw_macmic(:ncol) + snow_pcw(:ncol) + + end do ! end substepping over macrophysics/microphysics + + call outfld( 'UTEND_MACROP', ptend_macp_all%u, pcols, lchnk) + call outfld( 'VTEND_MACROP', ptend_macp_all%v, pcols, lchnk) + call physics_ptend_dealloc(ptend_macp_all) + + prec_sed(:ncol) = prec_sed_macmic(:ncol)/cld_macmic_num_steps + snow_sed(:ncol) = snow_sed_macmic(:ncol)/cld_macmic_num_steps + prec_pcw(:ncol) = prec_pcw_macmic(:ncol)/cld_macmic_num_steps + snow_pcw(:ncol) = snow_pcw_macmic(:ncol)/cld_macmic_num_steps + prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) + snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) + + endif + + if ( .not. deep_scheme_does_scav_trans() ) then + + ! ------------------------------------------------------------------------------- + ! 1. Wet Scavenging of Aerosols by Convective and Stratiform Precipitation. + ! 2. Convective Transport of Non-Water Aerosol Species. + ! + ! . Aerosol wet chemistry determines scavenging fractions, and transformations + ! . Then do convective transport of all trace species except qv,ql,qi. + ! . We needed to do the scavenging first to determine the interstitial fraction. + ! . When UNICON is used as unified convection, we should still perform + ! wet scavenging but not 'convect_deep_tend2'. + ! ------------------------------------------------------------------------------- + + call t_startf('bc_aerosols') + if (clim_modal_aero .and. .not. prog_modal_aero) then + call modal_aero_calcsize_diag(state, pbuf) + call modal_aero_wateruptake_dr(state, pbuf) + endif + + if (trim(cam_take_snapshot_before) == "aero_model_wetdep") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call aero_model_wetdep( state, ztodt, dlf, cam_out, ptend, pbuf) + if ( (trim(cam_take_snapshot_after) == "aero_model_wetdep") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "aero_model_wetdep") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call t_startf ('convect_deep_tend2') + call convect_deep_tend_2( state, ptend, ztodt, pbuf ) + call physics_update(state, ptend, ztodt, tend) + call t_stopf ('convect_deep_tend2') + + ! check tracer integrals + call check_tracers_chng(state, tracerint, "cmfmca", nstep, ztodt, zero_tracers) + + call t_stopf('bc_aerosols') + + endif + + !=================================================== + ! Moist physical parameteriztions complete: + ! send dynamical variables, and derived variables to history file + !=================================================== + + call t_startf('bc_history_write') + call diag_phys_writeout(state, pbuf) + call diag_conv(state, ztodt, pbuf) + + call t_stopf('bc_history_write') + + !=================================================== + ! Write cloud diagnostics on history file + !=================================================== + + call t_startf('bc_cld_diag_history_write') + + call cloud_diagnostics_calc(state, pbuf) + + call t_stopf('bc_cld_diag_history_write') + + !=================================================== + ! Radiation computations + !=================================================== + call t_startf('radiation') + + if (trim(cam_take_snapshot_before) == "radiation_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call radiation_tend( & + state, ptend, pbuf, cam_out, cam_in, net_flx) + + ! Set net flux used by spectral dycores + do i=1,ncol + tend%flx_net(i) = net_flx(i) + end do + + if ( (trim(cam_take_snapshot_after) == "radiation_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "radiation_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call check_energy_chng(state, tend, "radheat", nstep, ztodt, zero, zero, zero, net_flx) + + call t_stopf('radiation') + + ! Diagnose the location of the tropopause and its location to the history file(s). + call t_startf('tropopause') + call tropopause_output(state) + call t_stopf('tropopause') + + !=================================================== + ! Source/sink terms for advected tracers. + !=================================================== + call t_startf('adv_tracer_src_snk') + ! Test tracers + + if (trim(cam_take_snapshot_before) == "aoa_tracers_timestep_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + call aoa_tracers_timestep_tend(state, ptend, cam_in%cflx, cam_in%landfrac, ztodt) + if ( (trim(cam_take_snapshot_after) == "aoa_tracers_timestep_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + if (trim(cam_take_snapshot_after) == "aoa_tracers_timestep_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + call check_tracers_chng(state, tracerint, "aoa_tracers_timestep_tend", nstep, ztodt, & + cam_in%cflx) + + if (trim(cam_take_snapshot_before) == "co2_cycle_set_ptend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + call co2_cycle_set_ptend(state, pbuf, ptend) + if ( (trim(cam_take_snapshot_after) == "co2_cycle_set_ptend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + if (trim(cam_take_snapshot_after) == "co2_cycle_set_ptend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + !=================================================== + ! Chemistry and MAM calculation + ! MAM core aerosol conversion process is performed in the below 'chem_timestep_tend'. + ! In addition, surface flux of aerosol species other than 'dust' and 'sea salt', and + ! elevated emission of aerosol species are treated in 'chem_timestep_tend' before + ! Gas chemistry and MAM core aerosol conversion. + ! Note that surface flux is not added into the atmosphere, but elevated emission is + ! added into the atmosphere as tendency. + !=================================================== + if (chem_is_active()) then + + if (trim(cam_take_snapshot_before) == "chem_timestep_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & + pbuf, fh2o=fh2o) + + + if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "chem_timestep_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + call check_energy_chng(state, tend, "chem", nstep, ztodt, fh2o, zero, zero, zero) + call check_tracers_chng(state, tracerint, "chem_timestep_tend", nstep, ztodt, & + cam_in%cflx) + end if + call t_stopf('adv_tracer_src_snk') + + !=================================================== + ! Vertical diffusion/pbl calculation + ! Call vertical diffusion code (pbl, free atmosphere and molecular) + !=================================================== + + call t_startf('vertical_diffusion_tend') + + if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call vertical_diffusion_tend (ztodt ,state , cam_in, & + surfric ,obklen ,ptend ,ast ,pbuf ) + + !------------------------------------------ + ! Call major diffusion for extended model + !------------------------------------------ + if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then + call waccmx_phys_mspd_tend (ztodt ,state ,ptend) + endif + + if ( (trim(cam_take_snapshot_after) == "vertical_diffusion_section") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + if ( ptend%lu ) then + call outfld( 'UTEND_VDIFF', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_VDIFF', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "vertical_diffusion_section") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call t_stopf ('vertical_diffusion_tend') + + !=================================================== + ! Rayleigh friction calculation + !=================================================== + call t_startf('rayleigh_friction') + call rayleigh_friction_tend( ztodt, state, ptend) + if ( ptend%lu ) then + call outfld( 'UTEND_RAYLEIGH', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_RAYLEIGH', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + call t_stopf('rayleigh_friction') + + if (do_clubb_sgs) then + call check_energy_chng(state, tend, "vdiff", nstep, ztodt, zero, zero, zero, zero) + else + call check_energy_chng(state, tend, "vdiff", nstep, ztodt, cam_in%cflx(:,1), zero, & + zero, cam_in%shf) + endif + + call check_tracers_chng(state, tracerint, "vdiff", nstep, ztodt, cam_in%cflx) + + ! aerosol dry deposition processes + call t_startf('aero_drydep') + + if (trim(cam_take_snapshot_before) == "aero_model_drydep") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) + if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "aero_model_drydep") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call t_stopf('aero_drydep') + + !--------------------------------------------------------------------------------- + ! ... enforce charge neutrality + !--------------------------------------------------------------------------------- + call charge_balance(state, pbuf) + + !=================================================== + ! Gravity wave drag + !=================================================== + call t_startf('gw_tend') + + if (trim(cam_take_snapshot_before) == "gw_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call gw_tend(state, pbuf, ztodt, ptend, cam_in, flx_heat) + + if ( (trim(cam_take_snapshot_after) == "gw_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + if ( ptend%lu ) then + call outfld( 'UTEND_GWDTOT', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_GWDTOT', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "gw_tend") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + ! Check energy integrals + call check_energy_chng(state, tend, "gwdrag", nstep, ztodt, zero, & + zero, zero, flx_heat) + call t_stopf('gw_tend') + + ! QBO relaxation + + if (trim(cam_take_snapshot_before) == "qbo_relax") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call qbo_relax(state, pbuf, ptend) + if ( (trim(cam_take_snapshot_after) == "qbo_relax") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + if ( ptend%lu ) then + call outfld( 'UTEND_QBORLX', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_QBORLX', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "qbo_relax") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + ! Check energy integrals + call check_energy_chng(state, tend, "qborelax", nstep, ztodt, zero, zero, zero, zero) + + ! Lunar tides + call lunar_tides_tend( state, ptend ) + if ( ptend%lu ) then + call outfld( 'UTEND_LUNART', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_LUNART', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + ! Check energy integrals + call check_energy_chng(state, tend, "lunar_tides", nstep, ztodt, zero, zero, zero, zero) + + ! Ion drag calculation + call t_startf ( 'iondrag' ) + + if (trim(cam_take_snapshot_before) == "iondrag_calc_section") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + if ( do_waccm_ions ) then + call iondrag_calc( lchnk, ncol, state, ptend, pbuf, ztodt ) + else + call iondrag_calc( lchnk, ncol, state, ptend) + endif + !---------------------------------------------------------------------------- + ! Call ionosphere routines for extended model if mode is set to ionosphere + !---------------------------------------------------------------------------- + if( waccmx_is('ionosphere') ) then + call waccmx_phys_ion_elec_temp_tend(state, ptend, pbuf, ztodt) + endif + + if ( (trim(cam_take_snapshot_after) == "iondrag_calc_section") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + if ( ptend%lu ) then + call outfld( 'UTEND_IONDRG', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_IONDRG', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "iondrag_calc_section") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call calc_te_and_aam_budgets(state, 'pAP') + + !--------------------------------------------------------------------------------- + ! Enforce charge neutrality after O+ change from ionos_tend + !--------------------------------------------------------------------------------- + if( waccmx_is('ionosphere') ) then + call charge_balance(state, pbuf) + endif + + ! Check energy integrals + call check_energy_chng(state, tend, "iondrag", nstep, ztodt, zero, zero, zero, zero) + + call t_stopf ( 'iondrag' ) + + ! Update Nudging values, if needed + !---------------------------------- + if((Nudge_Model).and.(Nudge_ON)) then + call nudging_timestep_tend(state,ptend) + if ( ptend%lu ) then + call outfld( 'UTEND_NDG', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_NDG', ptend%v, pcols, lchnk) + end if + call physics_update(state,ptend,ztodt,tend) + call check_energy_chng(state, tend, "nudging", nstep, ztodt, zero, zero, zero, zero) + endif + + !-------------- Energy budget checks vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv + + ! Save total energy for global fixer in next timestep (FV and SE dycores) + call pbuf_set_field(pbuf, teout_idx, state%te_cur, (/1,itim_old/),(/pcols,1/)) + ! + ! FV: convert dry-type mixing ratios to moist here because physics_dme_adjust + ! assumes moist. This is done in p_d_coupling for other dynamics. Bundy, Feb 2004. + if ( dycore_is('LR').or. dycore_is('FV3')) call set_dry_to_wet(state) ! Physics had dry, dynamics wants moist + + ! Scale dry mass and energy (does nothing if dycore is EUL or SLD) + tmp_q (:ncol,:pver) = state%q(:ncol,:pver,ixq) + tmp_cldliq(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) + tmp_cldice(:ncol,:pver) = state%q(:ncol,:pver,ixcldice) + + ! For not ('FV'|'FV3'), physics_dme_adjust is called for energy diagnostic purposes only. So, save off tracers + if (.not.(dycore_is('FV').or.dycore_is('FV3')).and.& + (hist_fld_active('SE_pAM').or.hist_fld_active('KE_pAM').or.hist_fld_active('WV_pAM').or.& + hist_fld_active('WL_pAM').or.hist_fld_active('WI_pAM'))) then + tmp_trac(:ncol,:pver,:pcnst) = state%q(:ncol,:pver,:pcnst) + tmp_pdel(:ncol,:pver) = state%pdel(:ncol,:pver) + tmp_ps(:ncol) = state%ps(:ncol) + ! + ! pint, lnpint,rpdel are altered by dme_adjust but not used for tendencies in dynamics of SE + ! we do not reset them to pre-dme_adjust values + ! + if (dycore_is('SE')) call set_dry_to_wet(state) + + if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call physics_dme_adjust(state, tend, qini, ztodt) + + if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call calc_te_and_aam_budgets(state, 'pAM') + ! Restore pre-"physics_dme_adjust" tracers + state%q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst) + state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver) + state%ps(:ncol) = tmp_ps(:ncol) + end if + + if (dycore_is('LR') .or. dycore_is('FV3')) then + + if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call physics_dme_adjust(state, tend, qini, ztodt) + + if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call calc_te_and_aam_budgets(state, 'pAM') + endif + +!!! REMOVE THIS CALL, SINCE ONLY Q IS BEING ADJUSTED. WON'T BALANCE ENERGY. TE IS SAVED BEFORE THIS +!!! call check_energy_chng(state, tend, "drymass", nstep, ztodt, zero, zero, zero, zero) + + ! store T, U, and V in buffer for use in computing dynamics T-tendency in next timestep + do k = 1,pver + dtcore(:ncol,k) = state%t(:ncol,k) + ducore(:ncol,k) = state%u(:ncol,k) + dvcore(:ncol,k) = state%v(:ncol,k) + end do + + !-------------- Energy budget checks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + if (aqua_planet) then + labort = .false. + do i=1,ncol + if (cam_in%ocnfrac(i) /= 1._r8) then + labort = .true. + if (masterproc) write(iulog,*) 'oceanfrac(',i,')=',cam_in%ocnfrac(i) + end if + end do + if (labort) then + call endrun ('TPHYSAC error: in aquaplanet mode, but grid contains non-ocean point') + endif + endif + + call diag_phys_tend_writeout (state, pbuf, tend, ztodt, tmp_q, tmp_cldliq, tmp_cldice, & + qini, cldliqini, cldiceini) + + call clybry_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) + + end subroutine tphysac + + subroutine tphysbc (ztodt, state, & + tend, pbuf, & + cam_out, cam_in ) + !----------------------------------------------------------------------- + ! + ! Purpose: + ! Evaluate and apply physical processes that are calculated BEFORE + ! coupling to land, sea, and ice models. + ! + ! Processes currently included are: + ! + ! o Resetting Negative Tracers to Positive + ! o Global Mean Total Energy Fixer + ! o Dry Adjustment + ! o Asymmetric Turbulence Scheme - Deep Convection & Shallow Convection + ! + ! Method: + ! + ! Each parameterization should be implemented with this sequence of calls: + ! 1) Call physics interface + ! 2) Check energy + ! 3) Call physics_update + ! See Interface to Column Physics and Chemistry Packages + ! http://www.ccsm.ucar.edu/models/atm-cam/docs/phys-interface/index.html + ! + !----------------------------------------------------------------------- + + use physics_buffer, only: physics_buffer_desc, pbuf_get_field + use physics_buffer, only: pbuf_get_index, pbuf_old_tim_idx + use physics_buffer, only: col_type_subcol, dyn_time_lvls + use shr_kind_mod, only: r8 => shr_kind_r8 + + use dadadj_cam, only: dadadj_tend + use physics_types, only: physics_state, physics_tend, physics_ptend, & + physics_update, physics_ptend_init, physics_ptend_sum, & + physics_state_check, physics_ptend_scale + use cam_diagnostics, only: diag_conv_tend_ini, diag_phys_writeout, diag_conv, diag_export, diag_state_b4_phys_write + use cam_diagnostics, only: diag_clip_tend_writeout + use cam_history, only: outfld + use physconst, only: cpair, latvap + use constituents, only: pcnst, qmin, cnst_get_ind + use convect_deep, only: convect_deep_tend, convect_deep_tend_2, deep_scheme_does_scav_trans + use time_manager, only: is_first_step, get_nstep + use convect_shallow, only: convect_shallow_tend + use check_energy, only: check_energy_chng, check_energy_fix, check_energy_timestep_init + use check_energy, only: check_tracers_data, check_tracers_init, check_tracers_chng + use check_energy, only: calc_te_and_aam_budgets + use dycore, only: dycore_is + use radiation, only: radiation_tend + use perf_mod + use mo_gas_phase_chemdr,only: map2chm + use clybry_fam, only: clybry_fam_adj + use cam_abortutils, only: endrun + use subcol_utils, only: is_subcol_on + use qneg_module, only: qneg3 + use cam_snapshot, only: cam_snapshot_all_outfld_tphysbc + use cam_snapshot, only: cam_snapshot_ptend_outfld + + ! Arguments + + real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) + + type(physics_state), intent(inout) :: state + type(physics_tend ), intent(inout) :: tend + type(physics_buffer_desc), pointer :: pbuf(:) + + type(cam_out_t), intent(inout) :: cam_out + type(cam_in_t), intent(in) :: cam_in + + + ! + !---------------------------Local workspace----------------------------- + ! + + type(physics_ptend) :: ptend ! indivdual parameterization tendencies + + 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) pflx(pcols,pverp) ! Conv rain flux thru out btm of lev + 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. + + ! physics buffer fields to compute tendencies for stratiform package + integer itim_old, ifld + real(r8), pointer, dimension(:,:) :: cld ! cloud fraction + + ! physics buffer fields for total energy and mass adjustment + real(r8), pointer, dimension(: ) :: teout + real(r8), pointer, dimension(:,:) :: qini + real(r8), pointer, dimension(:,:) :: cldliqini + real(r8), pointer, dimension(:,:) :: cldiceini + real(r8), pointer, dimension(:,:) :: dtcore + real(r8), pointer, dimension(:,:) :: ducore + real(r8), pointer, dimension(:,:) :: dvcore + + real(r8), pointer, dimension(:,:,:) :: fracis ! fraction of transported species that are insoluble + + real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. + + ! convective precipitation variables + real(r8),pointer :: prec_dp(:) ! total precipitation from ZM convection + real(r8),pointer :: snow_dp(:) ! snow from ZM convection + real(r8),pointer :: prec_sh(:) ! total precipitation from Hack convection + real(r8),pointer :: snow_sh(:) ! snow from Hack convection + + ! stratiform precipitation variables + real(r8),pointer :: prec_str(:) ! sfc flux of precip from stratiform (m/s) + real(r8),pointer :: snow_str(:) ! sfc flux of snow from stratiform (m/s) + real(r8),pointer :: prec_str_sc(:) ! sfc flux of precip from stratiform (m/s) -- for subcolumns + real(r8),pointer :: snow_str_sc(:) ! sfc flux of snow from stratiform (m/s) -- for subcolumns + real(r8),pointer :: prec_pcw(:) ! total precip from prognostic cloud scheme + real(r8),pointer :: snow_pcw(:) ! snow from prognostic cloud scheme + real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation + real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation + + ! 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) :: flx_cnd(pcols) + real(r8) :: flx_heat(pcols) + type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes + real(r8) :: zero_tracers(pcols,pcnst) + + logical :: lq(pcnst) + + !----------------------------------------------------------------------- + + call t_startf('bc_init') + + zero = 0._r8 + zero_tracers(:,:) = 0._r8 + zero_sc(:) = 0._r8 + + lchnk = state%lchnk + ncol = state%ncol + + rtdt = 1._r8/ztodt + + nstep = get_nstep() + + ! Associate pointers with physics buffer fields + itim_old = pbuf_old_tim_idx() + ifld = pbuf_get_index('CLD') + call pbuf_get_field(pbuf, ifld, cld, (/1,1,itim_old/),(/pcols,pver,1/)) + + call pbuf_get_field(pbuf, teout_idx, teout, (/1,itim_old/), (/pcols,1/)) + + call pbuf_get_field(pbuf, qini_idx, qini) + call pbuf_get_field(pbuf, cldliqini_idx, cldliqini) + call pbuf_get_field(pbuf, cldiceini_idx, cldiceini) + + ifld = pbuf_get_index('DTCORE') + call pbuf_get_field(pbuf, ifld, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + + ifld = pbuf_get_index('FRACIS') + call pbuf_get_field(pbuf, ifld, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) + fracis (:ncol,:,1:pcnst) = 1._r8 + + ! Set physics tendencies to 0 + tend %dTdt(:ncol,:pver) = 0._r8 + tend %dudt(:ncol,:pver) = 0._r8 + tend %dvdt(:ncol,:pver) = 0._r8 + + ! Verify state coming from the dynamics + if (state_debug_checks) & + call physics_state_check(state, name="before tphysbc (dycore?)") + + call clybry_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) + + ! Since clybry_fam_adj operates directly on the tracers, and has no + ! physics_update call, re-run qneg3. + call qneg3('TPHYSBCc',lchnk ,ncol ,pcols ,pver , & + 1, pcnst, qmin ,state%q ) + + ! Validate output of clybry_fam_adj. + if (state_debug_checks) & + call physics_state_check(state, name="clybry_fam_adj") + + ! + ! Dump out "before physics" state + ! + call diag_state_b4_phys_write (state) + + ! compute mass integrals of input tracers state + call check_tracers_init(state, tracerint) + + call t_stopf('bc_init') + + !=================================================== + ! Global mean total energy fixer + !=================================================== + call t_startf('energy_fixer') + + call calc_te_and_aam_budgets(state, 'pBF') + if (dycore_is('LR') .or. dycore_is('FV3') .or. dycore_is('SE')) then + call check_energy_fix(state, ptend, nstep, flx_heat) + call physics_update(state, ptend, ztodt, tend) + call check_energy_chng(state, tend, "chkengyfix", nstep, ztodt, zero, zero, zero, flx_heat) + call outfld( 'EFIX', flx_heat , pcols, lchnk ) + end if + call calc_te_and_aam_budgets(state, 'pBP') + ! Save state for convective tendency calculations. + call diag_conv_tend_ini(state, pbuf) + + call cnst_get_ind('Q', ixq) + call cnst_get_ind('CLDLIQ', ixcldliq) + call cnst_get_ind('CLDICE', ixcldice) + qini (:ncol,:pver) = state%q(:ncol,:pver, 1) + cldliqini(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) + cldiceini(:ncol,:pver) = state%q(:ncol,:pver,ixcldice) + + call outfld('TEOUT', teout , pcols, lchnk ) + call outfld('TEINP', state%te_ini, pcols, lchnk ) + call outfld('TEFIX', state%te_cur, pcols, lchnk ) + + ! T, U, V tendency due to dynamics + if( nstep > dyn_time_lvls-1 ) then + dtcore(:ncol,:pver) = (state%t(:ncol,:pver) - dtcore(:ncol,:pver))/ztodt + ducore(:ncol,:pver) = (state%u(:ncol,:pver) - ducore(:ncol,:pver))/ztodt + dvcore(:ncol,:pver) = (state%v(:ncol,:pver) - dvcore(:ncol,:pver))/ztodt + call outfld( 'DTCORE', dtcore, pcols, lchnk ) + call outfld( 'UTEND_CORE', ducore, pcols, lchnk ) + call outfld( 'VTEND_CORE', dvcore, pcols, lchnk ) + end if + + call t_stopf('energy_fixer') + ! + !=================================================== + ! Dry adjustment + !=================================================== + call t_startf('dry_adjustment') + + if (trim(cam_take_snapshot_before) == "dadadj_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call dadadj_tend(ztodt, state, ptend) + + if ( (trim(cam_take_snapshot_after) == "dadadj_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "dadadj_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call t_stopf('dry_adjustment') + + !=================================================== + ! Moist convection + !=================================================== + call t_startf('moist_convection') + + call t_startf ('convect_deep_tend') + + if (trim(cam_take_snapshot_before) == "convect_deep_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call convect_deep_tend( & + cmfmc, cmfcme, & + pflx, zdu, & + rliq, rice, & + ztodt, & + state, ptend, cam_in%landfrac, pbuf) + + if ( (trim(cam_take_snapshot_after) == "convect_deep_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + + if ( ptend%lu ) then + call outfld( 'UTEND_DCONV', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_DCONV', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "convect_deep_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call t_stopf('convect_deep_tend') + + call pbuf_get_field(pbuf, prec_dp_idx, prec_dp ) + call pbuf_get_field(pbuf, snow_dp_idx, snow_dp ) + call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) + call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) + + call pbuf_get_field(pbuf, prec_str_idx, prec_str ) + call pbuf_get_field(pbuf, snow_str_idx, snow_str ) + call pbuf_get_field(pbuf, prec_sed_idx, prec_sed ) + call pbuf_get_field(pbuf, snow_sed_idx, snow_sed ) + call pbuf_get_field(pbuf, prec_pcw_idx, prec_pcw ) + call pbuf_get_field(pbuf, snow_pcw_idx, snow_pcw ) + + if (use_subcol_microp) then + call pbuf_get_field(pbuf, prec_str_idx, prec_str_sc, col_type=col_type_subcol) + call pbuf_get_field(pbuf, snow_str_idx, snow_str_sc, col_type=col_type_subcol) + end if + + ! Check energy integrals, including "reserved liquid" + flx_cnd(:ncol) = prec_dp(:ncol) + rliq(:ncol) + snow_dp(:ncol) = snow_dp(:ncol) + rice(:ncol) + call check_energy_chng(state, tend, "convect_deep", nstep, ztodt, zero, flx_cnd, snow_dp, zero) + snow_dp(:ncol) = snow_dp(:ncol) - rice(:ncol) + +!+++ARH Begin code block targeting for removal + ! + ! Call Hack (1994) convection scheme to deal with shallow/mid-level convection + ! + call t_startf ('convect_shallow_tend') + + if (dlfzm_idx > 0) then + call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) + dlf(:ncol,:) = dlfzm(:ncol,:) + else + dlf(:,:) = 0._r8 + end if + + if (trim(cam_take_snapshot_before) == "convect_shallow_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + !+++ARH Begin only subroutine whose removal breaks bfb in code block + call convect_shallow_tend (ztodt , cmfmc, & + dlf , dlf2 , rliq , rliq2, & + state , ptend , pbuf, cam_in) + !---ARH End only subroutine whose removal breaks bfb in code block + + call t_stopf ('convect_shallow_tend') + + if ( (trim(cam_take_snapshot_after) == "convect_shallow_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + if ( ptend%lu ) then + call outfld( 'UTEND_SHCONV', ptend%u, pcols, lchnk) + end if + if ( ptend%lv ) then + call outfld( 'VTEND_SHCONV', ptend%v, pcols, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "convect_shallow_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + flx_cnd(:ncol) = prec_sh(:ncol) + rliq2(:ncol) + call check_energy_chng(state, tend, "convect_shallow", nstep, ztodt, zero, flx_cnd, snow_sh, zero) + + call check_tracers_chng(state, tracerint, "convect_shallow", nstep, ztodt, zero_tracers) +!+++ARH End code block targeting for removal + + call t_stopf('moist_convection') + + if (is_first_step()) then + + !initiailize sedimentation arrays + prec_pcw = 0._r8 + snow_pcw = 0._r8 + prec_sed = 0._r8 + snow_sed = 0._r8 + prec_str = 0._r8 + snow_str = 0._r8 + + if (is_subcol_on()) then + prec_str_sc = 0._r8 + snow_str_sc = 0._r8 + end if + + !=================================================== + ! Radiation computations + !=================================================== + call t_startf('radiation') + + if (trim(cam_take_snapshot_before) == "radiation_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call radiation_tend( & + state, ptend, pbuf, cam_out, cam_in, net_flx) + + ! Set net flux used by spectral dycores + do i=1,ncol + tend%flx_net(i) = net_flx(i) + end do + + if ( (trim(cam_take_snapshot_after) == "radiation_tend") .and. & + (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then + call cam_snapshot_ptend_outfld(ptend, lchnk) + end if + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "radiation_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call check_energy_chng(state, tend, "radheat", nstep, ztodt, zero, zero, zero, net_flx) + + call t_stopf('radiation') + + end if + + ! Save atmospheric fields to force surface models + call t_startf('cam_export') + call cam_export (state,cam_out,pbuf) + call t_stopf('cam_export') + + ! Write export state to history file + call t_startf('diag_export') + call diag_export(cam_out) + call t_stopf('diag_export') + + end subroutine tphysbc + +subroutine phys_timestep_init(phys_state, cam_in, cam_out, pbuf2d) +!----------------------------------------------------------------------------------- +! +! Purpose: The place for parameterizations to call per timestep initializations. +! Generally this is used to update time interpolated fields from boundary +! datasets. +! +!----------------------------------------------------------------------------------- + use shr_kind_mod, only: r8 => shr_kind_r8 + use chemistry, only: chem_timestep_init + use chem_surfvals, only: chem_surfvals_set + use physics_types, only: physics_state + use physics_buffer, only: physics_buffer_desc + use carma_intr, only: carma_timestep_init + use ghg_data, only: ghg_data_timestep_init + use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_timestep_init + use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_timestep_init + use aoa_tracers, only: aoa_tracers_timestep_init + use vertical_diffusion, only: vertical_diffusion_ts_init + use radheat, only: radheat_timestep_init + use solar_data, only: solar_data_advance + use qbo, only: qbo_timestep_init + use iondrag, only: do_waccm_ions, iondrag_timestep_init + use perf_mod + + use prescribed_ozone, only: prescribed_ozone_adv + use prescribed_ghg, only: prescribed_ghg_adv + use prescribed_aero, only: prescribed_aero_adv + use aerodep_flx, only: aerodep_flx_adv + use aircraft_emit, only: aircraft_emit_adv + use prescribed_volcaero, only: prescribed_volcaero_adv + use prescribed_strataero,only: prescribed_strataero_adv + use mo_apex, only: mo_apex_init + use epp_ionization, only: epp_ionization_active + use iop_forcing, only: scam_use_iop_srf + use nudging, only: Nudge_Model, nudging_timestep_init + + implicit none + + type(physics_state), intent(inout), dimension(begchunk:endchunk) :: phys_state + type(cam_in_t), intent(inout), dimension(begchunk:endchunk) :: cam_in + type(cam_out_t), intent(inout), dimension(begchunk:endchunk) :: cam_out + + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + + !----------------------------------------------------------------------------- + + if (single_column) call scam_use_iop_srf(cam_in) + + ! update geomagnetic coordinates + if (epp_ionization_active .or. do_waccm_ions) then + call mo_apex_init(phys_state) + endif + + ! Chemistry surface values + call chem_surfvals_set() + + ! Solar irradiance + call solar_data_advance() + + ! Time interpolate for chemistry. + call chem_timestep_init(phys_state, pbuf2d) + + ! Prescribed tracers + call prescribed_ozone_adv(phys_state, pbuf2d) + call prescribed_ghg_adv(phys_state, pbuf2d) + call prescribed_aero_adv(phys_state, pbuf2d) + call aircraft_emit_adv(phys_state, pbuf2d) + call prescribed_volcaero_adv(phys_state, pbuf2d) + call prescribed_strataero_adv(phys_state, pbuf2d) + + ! prescribed aerosol deposition fluxes + call aerodep_flx_adv(phys_state, pbuf2d, cam_out) + + ! CAM3 prescribed aerosol masses + if (cam3_aero_data_on) call cam3_aero_data_timestep_init(pbuf2d, phys_state) + + ! CAM3 prescribed ozone data + if (cam3_ozone_data_on) call cam3_ozone_data_timestep_init(pbuf2d, phys_state) + + ! Time interpolate data models of gasses in pbuf2d + call ghg_data_timestep_init(pbuf2d, phys_state) + + ! Upper atmosphere radiative processes + call radheat_timestep_init(phys_state, pbuf2d) + + ! Time interpolate for vertical diffusion upper boundary condition + call vertical_diffusion_ts_init(pbuf2d, phys_state) + + !---------------------------------------------------------------------- + ! update QBO data for this time step + !---------------------------------------------------------------------- + call qbo_timestep_init + + call iondrag_timestep_init() + + call carma_timestep_init() + + ! age of air tracers + call aoa_tracers_timestep_init(phys_state) + + ! Update Nudging values, if needed + !---------------------------------- + if(Nudge_Model) call nudging_timestep_init(phys_state) + +end subroutine phys_timestep_init + +end module physpkg diff --git a/src/physics/camdev/zm_conv.F90 b/src/physics/camdev/zm_conv.F90 new file mode 100644 index 0000000000..7ef4d0d546 --- /dev/null +++ b/src/physics/camdev/zm_conv.F90 @@ -0,0 +1,4995 @@ +module zm_conv + +!--------------------------------------------------------------------------------- +! Purpose: +! +! Interface from Zhang-McFarlane convection scheme, includes evaporation of convective +! precip from the ZM scheme +! +! Apr 2006: RBN: Code added to perform a dilute ascent for closure of the CM mass flux +! based on an entra2ining plume a la Raymond and Blythe (1992) +! +! Author: Byron Boville, from code in tphysbc +! +!--------------------------------------------------------------------------------- + use shr_kind_mod, only: r8 => shr_kind_r8 + use spmd_utils, only: masterproc + use ppgrid, only: pcols, pver, pverp + use cloud_fraction, only: cldfrc_fice + use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & + cpwv, cpliq, rh2o,r_universal + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use zm_microphysics, only: zm_mphy, zm_aero_t, zm_conv_t + use cam_history, only: outfld + + + implicit none + + save + private ! Make default type private to the module +! +! PUBLIC: interfaces +! + public zm_convi ! ZM schemea + public zm_convr ! ZM schemea + public zm_conv_evap ! evaporation of precip from ZM schemea + public convtran ! convective transport + public momtran ! convective momentum transport + +! +! Private data +! + real(r8) rl ! wg latent heat of vaporization. + real(r8) cpres ! specific heat at constant pressure in j/kg-degk. + real(r8), parameter :: capelmt = 70._r8 ! threshold value for cape for deep convection. + real(r8) :: ke ! Tunable evaporation efficiency set from namelist input zmconv_ke + real(r8) :: ke_lnd + real(r8) :: c0_lnd ! set from namelist input zmconv_c0_lnd + real(r8) :: c0_ocn ! set from namelist input zmconv_c0_ocn + integer :: num_cin ! set from namelist input zmconv_num_cin + ! The number of negative buoyancy regions that are allowed + ! before the convection top and CAPE calculations are completed. + logical :: zm_org + real(r8) tau ! convective time scale + real(r8),parameter :: c1 = 6.112_r8 + real(r8),parameter :: c2 = 17.67_r8 + real(r8),parameter :: c3 = 243.5_r8 + real(r8) :: tfreez + real(r8) :: eps1 + real(r8) :: momcu + real(r8) :: momcd + + logical :: zmconv_microp + + logical :: no_deep_pbl ! default = .false. + ! no_deep_pbl = .true. eliminates deep convection entirely within PBL + + +!moved from moistconvection.F90 + real(r8) :: rgrav ! reciprocal of grav + real(r8) :: rgas ! gas constant for dry air + real(r8) :: grav ! = gravit + real(r8) :: cp ! = cpres = cpair + + integer limcnv ! top interface level limit for convection + + real(r8),parameter :: tiedke_add = 0.5_r8 + +! RBN: KE and PBL parcel + logical :: ltau_dynamic ! Use a dynamic tau calculation + logical :: lparcel_dynamic ! Calculate buoyancy/convective top base on parcel K.E. + logical :: lparcel_pbl ! Switch to turn on mixing of parcel MSE air, and picking laucnh level to be the top of the PBL. + +contains + + +subroutine zm_convi(limcnv_in, zmconv_c0_lnd, zmconv_c0_ocn, zmconv_ke, zmconv_ke_lnd, & + zmconv_momcu, zmconv_momcd, zmconv_num_cin, zmconv_org, & + zmconv_microp_in, no_deep_pbl_in) + + integer, intent(in) :: limcnv_in ! top interface level limit for convection + integer, intent(in) :: zmconv_num_cin ! Number negative buoyancy regions that are allowed + ! before the convection top and CAPE calculations are completed. + real(r8),intent(in) :: zmconv_c0_lnd + real(r8),intent(in) :: zmconv_c0_ocn + real(r8),intent(in) :: zmconv_ke + real(r8),intent(in) :: zmconv_ke_lnd + real(r8),intent(in) :: zmconv_momcu + real(r8),intent(in) :: zmconv_momcd + logical :: zmconv_org + logical, intent(in) :: zmconv_microp_in + logical, intent(in), optional :: no_deep_pbl_in ! no_deep_pbl = .true. eliminates ZM convection entirely within PBL + + + ! Initialization of ZM constants + limcnv = limcnv_in + tfreez = tmelt + eps1 = epsilo + rl = latvap + cpres = cpair + rgrav = 1.0_r8/gravit + rgas = rair + grav = gravit + cp = cpres + + c0_lnd = zmconv_c0_lnd + c0_ocn = zmconv_c0_ocn + num_cin = zmconv_num_cin + ke = zmconv_ke + ke_lnd = zmconv_ke_lnd + zm_org = zmconv_org + momcu = zmconv_momcu + momcd = zmconv_momcd + + zmconv_microp = zmconv_microp_in + + if ( present(no_deep_pbl_in) ) then + no_deep_pbl = no_deep_pbl_in + else + no_deep_pbl = .false. + endif + + tau = 3600._r8 + +! RBN: Modification logicals switches + + ltau_dynamic = .false. ! Use a dynamic tau calculation + lparcel_dynamic = .false. ! Calculate buoyancy/convective top base on parcel K.E. + + if ( masterproc ) then + write(iulog,*) 'tuning parameters zm_convi: tau',tau + write(iulog,*) 'tuning parameters zm_convi: c0_lnd',c0_lnd, ', c0_ocn', c0_ocn + write(iulog,*) 'tuning parameters zm_convi: num_cin', num_cin + write(iulog,*) 'tuning parameters zm_convi: ke',ke + write(iulog,*) 'tuning parameters zm_convi: no_deep_pbl',no_deep_pbl + endif + + if (masterproc) write(iulog,*)'**** ZM: DILUTE Buoyancy Calculation ****' + +end subroutine zm_convi + + + +subroutine zm_convr(lchnk ,ncol , & + t ,qh ,omega ,prec ,jctop ,jcbot , & + pblh ,zm ,geos ,zi ,qtnd , & + heat ,pap ,paph ,dpp , & + delt ,mcon ,cme ,cape , & + tpert ,dlf ,pflx ,zdu ,rprd , & + mu ,md ,du ,eu ,ed , & + dp ,dsubcld ,jt ,maxg ,ideep , & + ql ,rliq ,landfrac, & + org ,orgt ,org2d , & + dif ,dnlf ,dnif ,conv , & + aero , rice) +!----------------------------------------------------------------------- +! +! Purpose: +! Main driver for zhang-mcfarlane convection scheme +! +! Method: +! performs deep convective adjustment based on mass-flux closure +! algorithm. +! +! Author:guang jun zhang, m.lazare, n.mcfarlane. CAM Contact: P. Rasch +! +! This is contributed code not fully standardized by the CAM core group. +! All variables have been typed, where most are identified in comments +! The current procedure will be reimplemented in a subsequent version +! of the CAM where it will include a more straightforward formulation +! and will make use of the standard CAM nomenclature +! +!----------------------------------------------------------------------- + use phys_control, only: cam_physpkg_is + +! +! ************************ index of variables ********************** +! +! wg * alpha array of vertical differencing used (=1. for upstream). +! w * cape convective available potential energy. +! wg * capeg gathered convective available potential energy. +! c * capelmt threshold value for cape for deep convection. +! ic * cpres specific heat at constant pressure in j/kg-degk. +! i * dpp +! ic * delt length of model time-step in seconds. +! wg * dp layer thickness in mbs (between upper/lower interface). +! wg * dqdt mixing ratio tendency at gathered points. +! wg * dsdt dry static energy ("temp") tendency at gathered points. +! wg * dudt u-wind tendency at gathered points. +! wg * dvdt v-wind tendency at gathered points. +! wg * dsubcld layer thickness in mbs between lcl and maxi. +! ic * grav acceleration due to gravity in m/sec2. +! wg * du detrainment in updraft. specified in mid-layer +! wg * ed entrainment in downdraft. +! wg * eu entrainment in updraft. +! wg * hmn moist static energy. +! wg * hsat saturated moist static energy. +! w * ideep holds position of gathered points vs longitude index. +! ic * pver number of model levels. +! wg * j0 detrainment initiation level index. +! wg * jd downdraft initiation level index. +! ic * jlatpr gaussian latitude index for printing grids (if needed). +! wg * jt top level index of deep cumulus convection. +! w * lcl base level index of deep cumulus convection. +! wg * lclg gathered values of lcl. +! w * lel index of highest theoretical convective plume. +! wg * lelg gathered values of lel. +! w * lon index of onset level for deep convection. +! w * maxi index of level with largest moist static energy. +! wg * maxg gathered values of maxi. +! wg * mb cloud base mass flux. +! wg * mc net upward (scaled by mb) cloud mass flux. +! wg * md downward cloud mass flux (positive up). +! wg * mu upward cloud mass flux (positive up). specified +! at interface +! ic * msg number of missing moisture levels at the top of model. +! w * p grid slice of ambient mid-layer pressure in mbs. +! i * pblt row of pbl top indices. +! w * pcpdh scaled surface pressure. +! w * pf grid slice of ambient interface pressure in mbs. +! wg * pg grid slice of gathered values of p. +! w * q grid slice of mixing ratio. +! wg * qd grid slice of mixing ratio in downdraft. +! wg * qg grid slice of gathered values of q. +! i/o * qh grid slice of specific humidity. +! w * qh0 grid slice of initial specific humidity. +! wg * qhat grid slice of upper interface mixing ratio. +! wg * ql grid slice of cloud liquid water. +! wg * qs grid slice of saturation mixing ratio. +! w * qstp grid slice of parcel temp. saturation mixing ratio. +! wg * qstpg grid slice of gathered values of qstp. +! wg * qu grid slice of mixing ratio in updraft. +! ic * rgas dry air gas constant. +! wg * rl latent heat of vaporization. +! w * s grid slice of scaled dry static energy (t+gz/cp). +! wg * sd grid slice of dry static energy in downdraft. +! wg * sg grid slice of gathered values of s. +! wg * shat grid slice of upper interface dry static energy. +! wg * su grid slice of dry static energy in updraft. +! i/o * t +! o * jctop row of top-of-deep-convection indices passed out. +! O * jcbot row of base of cloud indices passed out. +! wg * tg grid slice of gathered values of t. +! w * tl row of parcel temperature at lcl. +! wg * tlg grid slice of gathered values of tl. +! w * tp grid slice of parcel temperatures. +! wg * tpg grid slice of gathered values of tp. +! i/o * u grid slice of u-wind (real). +! wg * ug grid slice of gathered values of u. +! i/o * utg grid slice of u-wind tendency (real). +! i/o * v grid slice of v-wind (real). +! w * va work array re-used by called subroutines. +! wg * vg grid slice of gathered values of v. +! i/o * vtg grid slice of v-wind tendency (real). +! i * w grid slice of diagnosed large-scale vertical velocity. +! w * z grid slice of ambient mid-layer height in metres. +! w * zf grid slice of ambient interface height in metres. +! wg * zfg grid slice of gathered values of zf. +! wg * zg grid slice of gathered values of z. +! +!----------------------------------------------------------------------- +! +! multi-level i/o fields: +! i => input arrays. +! i/o => input/output arrays. +! w => work arrays. +! wg => work arrays operating only on gathered points. +! ic => input data constants. +! c => data constants pertaining to subroutine itself. +! +! input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncol ! number of atmospheric columns + + real(r8), intent(in) :: t(pcols,pver) ! grid slice of temperature at mid-layer. + real(r8), intent(in) :: qh(pcols,pver) ! grid slice of specific humidity. + real(r8), intent(in) :: omega(pcols,pver) ! RBN - Omega to be used in parcel energy calculation + real(r8), intent(in) :: pap(pcols,pver) + real(r8), intent(in) :: paph(pcols,pver+1) + real(r8), intent(in) :: dpp(pcols,pver) ! local sigma half-level thickness (i.e. dshj). + real(r8), intent(in) :: zm(pcols,pver) + real(r8), intent(in) :: geos(pcols) + real(r8), intent(in) :: zi(pcols,pver+1) + real(r8), intent(in) :: pblh(pcols) + real(r8), intent(in) :: tpert(pcols) + real(r8), intent(in) :: landfrac(pcols) ! RBN Landfrac + + type(zm_conv_t), intent(inout) :: conv + type(zm_aero_t), intent(inout) :: aero ! aerosol object. intent(inout) because the + ! gathered arrays are set here + ! before passing object + ! to microphysics +! output arguments +! + real(r8), intent(out) :: qtnd(pcols,pver) ! specific humidity tendency (kg/kg/s) + real(r8), intent(out) :: heat(pcols,pver) ! heating rate (dry static energy tendency, W/kg) + real(r8), intent(out) :: mcon(pcols,pverp) + real(r8), intent(out) :: dlf(pcols,pver) ! scattrd version of the detraining cld h2o tend + real(r8), intent(out) :: pflx(pcols,pverp) ! scattered precip flux at each level + real(r8), intent(out) :: cme(pcols,pver) + real(r8), intent(out) :: cape(pcols) ! w convective available potential energy. + real(r8), intent(out) :: zdu(pcols,pver) + real(r8), intent(out) :: rprd(pcols,pver) ! rain production rate + real(r8), intent(out) :: dif(pcols,pver) ! detrained convective cloud ice mixing ratio. + real(r8), intent(out) :: dnlf(pcols,pver) ! detrained convective cloud water num concen. + real(r8), intent(out) :: dnif(pcols,pver) ! detrained convective cloud ice num concen. + +! move these vars from local storage to output so that convective +! transports can be done in outside of conv_cam. + real(r8), intent(out) :: mu(pcols,pver) + real(r8), intent(out) :: eu(pcols,pver) + real(r8), intent(out) :: du(pcols,pver) + real(r8), intent(out) :: md(pcols,pver) + real(r8), intent(out) :: ed(pcols,pver) + real(r8), intent(out) :: dp(pcols,pver) ! wg layer thickness in mbs (between upper/lower interface). + real(r8), intent(out) :: dsubcld(pcols) ! wg layer thickness in mbs between lcl and maxi. + real(r8), intent(out) :: jctop(pcols) ! o row of top-of-deep-convection indices passed out. + real(r8), intent(out) :: jcbot(pcols) ! o row of base of cloud indices passed out. + real(r8), intent(out) :: prec(pcols) + real(r8), intent(out) :: rliq(pcols) ! reserved liquid (not yet in cldliq) for energy integrals + real(r8), intent(out) :: rice(pcols) ! reserved ice (not yet in cldce) for energy integrals + + integer, intent(out) :: ideep(pcols) ! column indices of gathered points + + type(zm_conv_t) :: loc_conv + + real(r8), pointer :: org(:,:) ! Only used if zm_org is true + real(r8), pointer :: orgt(:,:) ! Only used if zm_org is true + real(r8), pointer :: org2d(:,:) ! Only used if zm_org is true + + real(r8) zs(pcols) + real(r8) dlg(pcols,pver) ! gathrd version of the detraining cld h2o tend + real(r8) pflxg(pcols,pverp) ! gather precip flux at each level + real(r8) cug(pcols,pver) ! gathered condensation rate + + real(r8) evpg(pcols,pver) ! gathered evap rate of rain in downdraft + real(r8) orgavg(pcols) + real(r8) dptot(pcols) + real(r8) mumax(pcols) + integer jt(pcols) ! wg top level index of deep cumulus convection. + integer maxg(pcols) ! wg gathered values of maxi. + integer lengath +! diagnostic field used by chem/wetdep codes + real(r8) ql(pcols,pver) ! wg grid slice of cloud liquid water. +! + real(r8) pblt(pcols) ! i row of pbl top indices. + + + + +! +!----------------------------------------------------------------------- +! +! general work fields (local variables): +! + real(r8) q(pcols,pver) ! w grid slice of mixing ratio. + real(r8) p(pcols,pver) ! w grid slice of ambient mid-layer pressure in mbs. + real(r8) z(pcols,pver) ! w grid slice of ambient mid-layer height in metres. + real(r8) s(pcols,pver) ! w grid slice of scaled dry static energy (t+gz/cp). + real(r8) tp(pcols,pver) ! w grid slice of parcel temperatures. + real(r8) zf(pcols,pver+1) ! w grid slice of ambient interface height in metres. + real(r8) pf(pcols,pver+1) ! w grid slice of ambient interface pressure in mbs. + real(r8) qstp(pcols,pver) ! w grid slice of parcel temp. saturation mixing ratio. + + real(r8) tl(pcols) ! w row of parcel temperature at lcl. + + integer lcl(pcols) ! w base level index of deep cumulus convection. + integer lel(pcols) ! w index of highest theoretical convective plume. + integer lon(pcols) ! w index of onset level for deep convection. + integer maxi(pcols) ! w index of level with largest moist static energy. + + real(r8) precip +! +! gathered work fields: +! + real(r8) qg(pcols,pver) ! wg grid slice of gathered values of q. + real(r8) tg(pcols,pver) ! w grid slice of temperature at interface. + real(r8) pg(pcols,pver) ! wg grid slice of gathered values of p. + real(r8) zg(pcols,pver) ! wg grid slice of gathered values of z. + real(r8) sg(pcols,pver) ! wg grid slice of gathered values of s. + real(r8) tpg(pcols,pver) ! wg grid slice of gathered values of tp. + real(r8) zfg(pcols,pver+1) ! wg grid slice of gathered values of zf. + real(r8) qstpg(pcols,pver) ! wg grid slice of gathered values of qstp. + real(r8) ug(pcols,pver) ! wg grid slice of gathered values of u. + real(r8) vg(pcols,pver) ! wg grid slice of gathered values of v. + real(r8) cmeg(pcols,pver) + + real(r8) rprdg(pcols,pver) ! wg gathered rain production rate + real(r8) capeg(pcols) ! wg gathered convective available potential energy. + real(r8) tlg(pcols) ! wg grid slice of gathered values of tl. + real(r8) landfracg(pcols) ! wg grid slice of landfrac + + integer lclg(pcols) ! wg gathered values of lcl. + integer lelg(pcols) +! +! work fields arising from gathered calculations. +! + real(r8) dqdt(pcols,pver) ! wg mixing ratio tendency at gathered points. + real(r8) dsdt(pcols,pver) ! wg dry static energy ("temp") tendency at gathered points. +! real(r8) alpha(pcols,pver) ! array of vertical differencing used (=1. for upstream). + real(r8) sd(pcols,pver) ! wg grid slice of dry static energy in downdraft. + real(r8) qd(pcols,pver) ! wg grid slice of mixing ratio in downdraft. + real(r8) mc(pcols,pver) ! wg net upward (scaled by mb) cloud mass flux. + real(r8) qhat(pcols,pver) ! wg grid slice of upper interface mixing ratio. + real(r8) qu(pcols,pver) ! wg grid slice of mixing ratio in updraft. + real(r8) su(pcols,pver) ! wg grid slice of dry static energy in updraft. + real(r8) qs(pcols,pver) ! wg grid slice of saturation mixing ratio. + real(r8) shat(pcols,pver) ! wg grid slice of upper interface dry static energy. + real(r8) hmn(pcols,pver) ! wg moist static energy. + real(r8) hsat(pcols,pver) ! wg saturated moist static energy. + real(r8) qlg(pcols,pver) + real(r8) dudt(pcols,pver) ! wg u-wind tendency at gathered points. + real(r8) dvdt(pcols,pver) ! wg v-wind tendency at gathered points. +! real(r8) ud(pcols,pver) +! real(r8) vd(pcols,pver) + + + + + + + + real(r8) qldeg(pcols,pver) ! cloud liquid water mixing ratio for detrainment (kg/kg) + real(r8) mb(pcols) ! wg cloud base mass flux. + + !RBN - Convective in-cloud vertical velocities. + real(r8) wm_incld(pcols) ! Convective in-cloud vertical velocity + real(r8) wm_incldg(pcols) ! Gathered Convective in-cloud vertical velocity + + integer jlcl(pcols) + integer j0(pcols) ! wg detrainment initiation level index. + integer jd(pcols) ! wg downdraft initiation level index. + + real(r8) delt ! length of model time-step in seconds. + + integer i + integer ii + integer k, kk, l, m + + integer msg ! ic number of missing moisture levels at the top of model. + real(r8) qdifr + real(r8) sdifr + + real(r8), parameter :: dcon = 25.e-6_r8 + real(r8), parameter :: mucon = 5.3_r8 + real(r8) negadq + logical doliq + + +! +!--------------------------Data statements------------------------------ + +! +! Set internal variable "msg" (convection limit) to "limcnv-1" +! + msg = limcnv - 1 +! +! initialize necessary arrays. +! zero out variables not used in cam +! + + if (zm_org) then + orgt(:,:) = 0._r8 + end if + + qtnd(:,:) = 0._r8 + heat(:,:) = 0._r8 + mcon(:,:) = 0._r8 + rliq(:ncol) = 0._r8 + rice(:ncol) = 0._r8 + + if (zmconv_microp) then + allocate( & + loc_conv%frz(pcols,pver), & + loc_conv%sprd(pcols,pver), & + loc_conv%wu(pcols,pver), & + loc_conv%qi(pcols,pver), & + loc_conv%qliq(pcols,pver), & + loc_conv%qice(pcols,pver), & + loc_conv%qrain(pcols,pver), & + loc_conv%qsnow(pcols,pver), & + loc_conv%di(pcols,pver), & + loc_conv%dnl(pcols,pver), & + loc_conv%dni(pcols,pver), & + loc_conv%qnl(pcols,pver), & + loc_conv%qni(pcols,pver), & + loc_conv%qnr(pcols,pver), & + loc_conv%qns(pcols,pver), & + loc_conv%qide(pcols,pver), & + loc_conv%qncde(pcols,pver), & + loc_conv%qnide(pcols,pver), & + loc_conv%autolm(pcols,pver), & + loc_conv%accrlm(pcols,pver), & + loc_conv%bergnm(pcols,pver), & + loc_conv%fhtimm(pcols,pver), & + loc_conv%fhtctm(pcols,pver), & + loc_conv%fhmlm(pcols,pver), & + loc_conv%hmpim(pcols,pver), & + loc_conv%accslm(pcols,pver), & + loc_conv%dlfm(pcols,pver), & + loc_conv%cmel(pcols,pver), & + loc_conv%autoln(pcols,pver), & + loc_conv%accrln(pcols,pver), & + loc_conv%bergnn(pcols,pver), & + loc_conv%fhtimn(pcols,pver), & + loc_conv%fhtctn(pcols,pver), & + loc_conv%fhmln(pcols,pver), & + loc_conv%accsln(pcols,pver), & + loc_conv%activn(pcols,pver), & + loc_conv%dlfn(pcols,pver), & + loc_conv%autoim(pcols,pver), & + loc_conv%accsim(pcols,pver), & + loc_conv%difm(pcols,pver), & + loc_conv%cmei(pcols,pver), & + loc_conv%nuclin(pcols,pver), & + loc_conv%autoin(pcols,pver), & + loc_conv%accsin(pcols,pver), & + loc_conv%hmpin(pcols,pver), & + loc_conv%difn(pcols,pver), & + loc_conv%trspcm(pcols,pver), & + loc_conv%trspcn(pcols,pver), & + loc_conv%trspim(pcols,pver), & + loc_conv%trspin(pcols,pver), & + loc_conv%lambdadpcu(pcols,pver), & + loc_conv%mudpcu(pcols,pver), & + loc_conv%dcape(pcols) ) + end if + +! +! initialize convective tendencies +! + prec(:ncol) = 0._r8 + do k = 1,pver + do i = 1,ncol + dqdt(i,k) = 0._r8 + dsdt(i,k) = 0._r8 + dudt(i,k) = 0._r8 + dvdt(i,k) = 0._r8 + pflx(i,k) = 0._r8 + pflxg(i,k) = 0._r8 + cme(i,k) = 0._r8 + rprd(i,k) = 0._r8 + zdu(i,k) = 0._r8 + ql(i,k) = 0._r8 + qlg(i,k) = 0._r8 + dlf(i,k) = 0._r8 + dlg(i,k) = 0._r8 + qldeg(i,k) = 0._r8 + + dif(i,k) = 0._r8 + dnlf(i,k) = 0._r8 + dnif(i,k) = 0._r8 + + end do + end do + + if (zmconv_microp) then + do k = 1,pver + do i = 1,ncol + loc_conv%qliq(i,k) = 0._r8 + loc_conv%qice(i,k) = 0._r8 + loc_conv%di(i,k) = 0._r8 + loc_conv%qrain(i,k)= 0._r8 + loc_conv%qsnow(i,k)= 0._r8 + loc_conv%dnl(i,k) = 0._r8 + loc_conv%dni(i,k) = 0._r8 + loc_conv%wu(i,k) = 0._r8 + loc_conv%qnl(i,k) = 0._r8 + loc_conv%qni(i,k) = 0._r8 + loc_conv%qnr(i,k) = 0._r8 + loc_conv%qns(i,k) = 0._r8 + loc_conv%frz(i,k) = 0._r8 + loc_conv%sprd(i,k) = 0._r8 + loc_conv%qide(i,k) = 0._r8 + loc_conv%qncde(i,k) = 0._r8 + loc_conv%qnide(i,k) = 0._r8 + + loc_conv%autolm(i,k) = 0._r8 + loc_conv%accrlm(i,k) = 0._r8 + loc_conv%bergnm(i,k) = 0._r8 + loc_conv%fhtimm(i,k) = 0._r8 + loc_conv%fhtctm(i,k) = 0._r8 + loc_conv%fhmlm (i,k) = 0._r8 + loc_conv%hmpim (i,k) = 0._r8 + loc_conv%accslm(i,k) = 0._r8 + loc_conv%dlfm (i,k) = 0._r8 + + loc_conv%autoln(i,k) = 0._r8 + loc_conv%accrln(i,k) = 0._r8 + loc_conv%bergnn(i,k) = 0._r8 + loc_conv%fhtimn(i,k) = 0._r8 + loc_conv%fhtctn(i,k) = 0._r8 + loc_conv%fhmln (i,k) = 0._r8 + loc_conv%accsln(i,k) = 0._r8 + loc_conv%activn(i,k) = 0._r8 + loc_conv%dlfn (i,k) = 0._r8 + loc_conv%cmel (i,k) = 0._r8 + + loc_conv%autoim(i,k) = 0._r8 + loc_conv%accsim(i,k) = 0._r8 + loc_conv%difm (i,k) = 0._r8 + loc_conv%cmei (i,k) = 0._r8 + + loc_conv%nuclin(i,k) = 0._r8 + loc_conv%autoin(i,k) = 0._r8 + loc_conv%accsin(i,k) = 0._r8 + loc_conv%hmpin (i,k) = 0._r8 + loc_conv%difn (i,k) = 0._r8 + + loc_conv%trspcm(i,k) = 0._r8 + loc_conv%trspcn(i,k) = 0._r8 + loc_conv%trspim(i,k) = 0._r8 + loc_conv%trspin(i,k) = 0._r8 + + conv%qi(i,k) = 0._r8 + conv%frz(i,k) = 0._r8 + conv%sprd(i,k) = 0._r8 + conv%qi(i,k) = 0._r8 + conv%qliq(i,k) = 0._r8 + conv%qice(i,k) = 0._r8 + conv%qnl(i,k) = 0._r8 + conv%qni(i,k) = 0._r8 + conv%qnr(i,k) = 0._r8 + conv%qns(i,k) = 0._r8 + conv%qrain(i,k) = 0._r8 + conv%qsnow(i,k) = 0._r8 + conv%wu(i,k) = 0._r8 + + conv%autolm(i,k) = 0._r8 + conv%accrlm(i,k) = 0._r8 + conv%bergnm(i,k) = 0._r8 + conv%fhtimm(i,k) = 0._r8 + conv%fhtctm(i,k) = 0._r8 + conv%fhmlm (i,k) = 0._r8 + conv%hmpim (i,k) = 0._r8 + conv%accslm(i,k) = 0._r8 + conv%dlfm (i,k) = 0._r8 + + conv%autoln(i,k) = 0._r8 + conv%accrln(i,k) = 0._r8 + conv%bergnn(i,k) = 0._r8 + conv%fhtimn(i,k) = 0._r8 + conv%fhtctn(i,k) = 0._r8 + conv%fhmln (i,k) = 0._r8 + conv%accsln(i,k) = 0._r8 + conv%activn(i,k) = 0._r8 + conv%dlfn (i,k) = 0._r8 + conv%cmel (i,k) = 0._r8 + + conv%autoim(i,k) = 0._r8 + conv%accsim(i,k) = 0._r8 + conv%difm (i,k) = 0._r8 + conv%cmei (i,k) = 0._r8 + + conv%nuclin(i,k) = 0._r8 + conv%autoin(i,k) = 0._r8 + conv%accsin(i,k) = 0._r8 + conv%hmpin (i,k) = 0._r8 + conv%difn (i,k) = 0._r8 + + conv%trspcm(i,k) = 0._r8 + conv%trspcn(i,k) = 0._r8 + conv%trspim(i,k) = 0._r8 + conv%trspin(i,k) = 0._r8 + + end do + end do + + conv%lambdadpcu = (mucon + 1._r8)/dcon + conv%mudpcu = mucon + loc_conv%lambdadpcu = conv%lambdadpcu + loc_conv%mudpcu = conv%mudpcu + + end if + + do i = 1,ncol + pflx(i,pverp) = 0 + pflxg(i,pverp) = 0 + end do +! + do i = 1,ncol + pblt(i) = pver + dsubcld(i) = 0._r8 + + + jctop(i) = pver + jcbot(i) = 1 + + wm_incld(i) = 0._r8 !RBN: Initialize in-cloud parcel velocity + + end do + + if (zmconv_microp) then + do i = 1,ncol + conv%dcape(i) = 0._r8 + loc_conv%dcape(i) = 0._r8 + end do + end if + + if (zm_org) then +! compute vertical average here + orgavg(:) = 0._r8 + dptot(:) = 0._r8 + + do k = 1, pver + do i = 1,ncol + if (org(i,k) .gt. 0) then + orgavg(i) = orgavg(i)+dpp(i,k)*org(i,k) + dptot(i) = dptot(i)+dpp(i,k) + endif + enddo + enddo + + do i = 1,ncol + if (dptot(i) .gt. 0) then + orgavg(i) = orgavg(i)/dptot(i) + endif + enddo + + do k = 1, pver + do i = 1, ncol + org2d(i,k) = orgavg(i) + enddo + enddo + + endif + +! +! calculate local pressure (mbs) and height (m) for both interface +! and mid-layer locations. +! + do i = 1,ncol + zs(i) = geos(i)*rgrav + + pf(i,pver+1) = paph(i,pver+1)*0.01_r8 + zf(i,pver+1) = zi(i,pver+1) + zs(i) + end do + do k = 1,pver + do i = 1,ncol + p(i,k) = pap(i,k)*0.01_r8 + pf(i,k) = paph(i,k)*0.01_r8 + z(i,k) = zm(i,k) + zs(i) + zf(i,k) = zi(i,k) + zs(i) + end do + end do +! + do k = pver - 1,msg + 1,-1 + do i = 1,ncol + if (abs(z(i,k)-zs(i)-pblh(i)) < (zf(i,k)-zf(i,k+1))*0.5_r8) pblt(i) = k + end do + end do +! +! store incoming specific humidity field for subsequent calculation +! of precipitation (through change in storage). +! define dry static energy (normalized by cp). +! + do k = 1,pver + do i = 1,ncol + q(i,k) = qh(i,k) + s(i,k) = t(i,k) + (grav/cpres)*z(i,k) + tp(i,k)=0.0_r8 + shat(i,k) = s(i,k) + qhat(i,k) = q(i,k) + end do + end do + + do i = 1,ncol + capeg(i) = 0._r8 + lclg(i) = 1 + lelg(i) = pver + maxg(i) = 1 + tlg(i) = 400._r8 + dsubcld(i) = 0._r8 + wm_incldg(i) = 0._r8 + end do + + + + if( cam_physpkg_is('cam3')) then + + ! For cam3 physics package, call non-dilute + + call buoyan(lchnk ,ncol , & + q ,t ,p ,z ,pf , & + tp ,qstp ,tl ,rl ,cape , & + pblt ,lcl ,lel ,lon ,maxi , & + rgas ,grav ,cpres ,msg , & + tpert ) + else + + ! Evaluate Tparcel, qs(Tparcel), buoyancy and CAPE, + ! lcl, lel, parcel launch level at index maxi()=hmax + + call buoyan_dilute(lchnk ,ncol , & + q ,t ,omega ,p ,z ,pf , & + tp ,qstp ,tl ,rl ,cape , & + pblt ,pblh ,lcl ,lel ,lon ,maxi , & + rgas ,grav ,cpres ,msg , & + zi, tpert , org2d , landfrac, wm_incld) + end if + +! +! determine whether grid points will undergo some deep convection +! (ideep=1) or not (ideep=0), based on values of cape,lcl,lel +! (require cape.gt. 0 and lel capelmt) then + lengath = lengath + 1 + ideep(lengath) = i + end if + end do + + if (lengath.eq.0) return +! +! obtain gathered arrays necessary for ensuing calculations. +! + do k = 1,pver + do i = 1,lengath + dp(i,k) = 0.01_r8*dpp(ideep(i),k) + qg(i,k) = q(ideep(i),k) + tg(i,k) = t(ideep(i),k) + pg(i,k) = p(ideep(i),k) + zg(i,k) = z(ideep(i),k) + sg(i,k) = s(ideep(i),k) + tpg(i,k) = tp(ideep(i),k) + zfg(i,k) = zf(ideep(i),k) + qstpg(i,k) = qstp(ideep(i),k) + ug(i,k) = 0._r8 + vg(i,k) = 0._r8 + end do + end do + + if (zmconv_microp) then + + if (aero%scheme == 'modal') then + + do m = 1, aero%nmodes + + do k = 1,pver + do i = 1,lengath + aero%numg_a(i,k,m) = aero%num_a(m)%val(ideep(i),k) + aero%dgnumg(i,k,m) = aero%dgnum(m)%val(ideep(i),k) + end do + end do + + do l = 1, aero%nspec(m) + do k = 1,pver + do i = 1,lengath + aero%mmrg_a(i,k,l,m) = aero%mmr_a(l,m)%val(ideep(i),k) + end do + end do + end do + + end do + + else if (aero%scheme == 'bulk') then + + do m = 1, aero%nbulk + do k = 1,pver + do i = 1,lengath + aero%mmrg_bulk(i,k,m) = aero%mmr_bulk(m)%val(ideep(i),k) + end do + end do + end do + + end if + + end if + +! + do i = 1,lengath + zfg(i,pver+1) = zf(ideep(i),pver+1) + end do + do i = 1,lengath + capeg(i) = cape(ideep(i)) + lclg(i) = lcl(ideep(i)) + lelg(i) = lel(ideep(i)) + maxg(i) = maxi(ideep(i)) + tlg(i) = tl(ideep(i)) + landfracg(i) = landfrac(ideep(i)) + wm_incldg(i) = wm_incld(ideep(i)) !RBN in-cloud convective vertical velocity. + end do +! +! calculate sub-cloud layer pressure "thickness" for use in +! closure and tendency routines. +! + do k = msg + 1,pver + do i = 1,lengath + if (k >= maxg(i)) then + dsubcld(i) = dsubcld(i) + dp(i,k) + end if + end do + end do +! +! define array of factors (alpha) which defines interfacial +! values, as well as interfacial values for (q,s) used in +! subsequent routines. +! + do k = msg + 2,pver + do i = 1,lengath +! alpha(i,k) = 0.5 + sdifr = 0._r8 + qdifr = 0._r8 + if (sg(i,k) > 0._r8 .or. sg(i,k-1) > 0._r8) & + sdifr = abs((sg(i,k)-sg(i,k-1))/max(sg(i,k-1),sg(i,k))) + if (qg(i,k) > 0._r8 .or. qg(i,k-1) > 0._r8) & + qdifr = abs((qg(i,k)-qg(i,k-1))/max(qg(i,k-1),qg(i,k))) + if (sdifr > 1.E-6_r8) then + shat(i,k) = log(sg(i,k-1)/sg(i,k))*sg(i,k-1)*sg(i,k)/(sg(i,k-1)-sg(i,k)) + else + shat(i,k) = 0.5_r8* (sg(i,k)+sg(i,k-1)) + end if + if (qdifr > 1.E-6_r8) then + qhat(i,k) = log(qg(i,k-1)/qg(i,k))*qg(i,k-1)*qg(i,k)/(qg(i,k-1)-qg(i,k)) + else + qhat(i,k) = 0.5_r8* (qg(i,k)+qg(i,k-1)) + end if + end do + end do +! +! obtain cloud properties. +! + + call cldprp(lchnk , & + qg ,tg ,ug ,vg ,pg , & + zg ,sg ,mu ,eu ,du , & + md ,ed ,sd ,qd ,mc , & + qu ,su ,zfg ,qs ,hmn , & + hsat ,shat ,qlg , & + cmeg ,maxg ,lelg ,jt ,jlcl , & + maxg ,j0 ,jd ,rl ,lengath , & + rgas ,grav ,cpres ,msg , & + pflxg ,evpg ,cug ,rprdg ,limcnv ,landfracg , & + qldeg ,aero ,loc_conv,qhat ) + + if (zmconv_microp) then + do i = 1,lengath + capeg(i) = capeg(i)+ loc_conv%dcape(i) + end do + end if + +! +! convert detrainment from units of "1/m" to "1/mb". +! + + do k = msg + 1,pver + do i = 1,lengath + du (i,k) = du (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + eu (i,k) = eu (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + ed (i,k) = ed (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + cug (i,k) = cug (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + cmeg (i,k) = cmeg (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + rprdg(i,k) = rprdg(i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + evpg (i,k) = evpg (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + end do + end do + + if (zmconv_microp) then + do k = msg + 1,pver + do i = 1,lengath + loc_conv%sprd(i,k) = loc_conv%sprd(i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + loc_conv%frz (i,k) = loc_conv%frz (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) + end do + end do + end if + + call closure(lchnk , & + qg ,tg ,pg ,zg ,sg , & + tpg ,qs ,qu ,su ,mc , & + du ,mu ,md ,qd ,sd , & + qhat ,shat ,dp ,qstpg ,zfg , & + qlg ,dsubcld ,mb ,capeg ,tlg , & + lclg ,lelg ,jt ,maxg ,1 , & + lengath ,rgas ,grav ,cpres ,rl , & + msg ,capelmt ,wm_incldg ) +! +! limit cloud base mass flux to theoretical upper bound. +! + do i=1,lengath + mumax(i) = 0 + end do + do k=msg + 2,pver + do i=1,lengath + mumax(i) = max(mumax(i), mu(i,k)/dp(i,k)) + end do + end do + + do i=1,lengath + if (mumax(i) > 0._r8) then + mb(i) = min(mb(i),0.5_r8/(delt*mumax(i))) + else + mb(i) = 0._r8 + endif + end do + ! If no_deep_pbl = .true., don't allow convection entirely + ! within PBL (suggestion of Bjorn Stevens, 8-2000) + + if (no_deep_pbl) then + do i=1,lengath + if (zm(ideep(i),jt(i)) < pblh(ideep(i))) mb(i) = 0 + end do + end if + + if (zmconv_microp) then + do k=msg+1,pver + do i=1,lengath + loc_conv%sprd(i,k) = loc_conv%sprd(i,k)*mb(i) + loc_conv%frz (i,k) = loc_conv%frz (i,k)*mb(i) + end do + end do + end if + + do k=msg+1,pver + do i=1,lengath + mu (i,k) = mu (i,k)*mb(i) + md (i,k) = md (i,k)*mb(i) + mc (i,k) = mc (i,k)*mb(i) + du (i,k) = du (i,k)*mb(i) + eu (i,k) = eu (i,k)*mb(i) + ed (i,k) = ed (i,k)*mb(i) + cmeg (i,k) = cmeg (i,k)*mb(i) + rprdg(i,k) = rprdg(i,k)*mb(i) + cug (i,k) = cug (i,k)*mb(i) + evpg (i,k) = evpg (i,k)*mb(i) + pflxg(i,k+1)= pflxg(i,k+1)*mb(i)*100._r8/grav + + + if ( zmconv_microp .and. mb(i).eq.0._r8) then + qlg (i,k) = 0._r8 + loc_conv%qliq (i,k) = 0._r8 + loc_conv%qice (i,k) = 0._r8 + loc_conv%qrain(i,k) = 0._r8 + loc_conv%qsnow(i,k) = 0._r8 + loc_conv%wu(i,k) = 0._r8 + loc_conv%qnl (i,k) = 0._r8 + loc_conv%qni (i,k) = 0._r8 + loc_conv%qnr (i,k) = 0._r8 + loc_conv%qns (i,k) = 0._r8 + + loc_conv%autolm(i,k) = 0._r8 + loc_conv%accrlm(i,k) = 0._r8 + loc_conv%bergnm(i,k) = 0._r8 + loc_conv%fhtimm(i,k) = 0._r8 + loc_conv%fhtctm(i,k) = 0._r8 + loc_conv%fhmlm (i,k) = 0._r8 + loc_conv%hmpim (i,k) = 0._r8 + loc_conv%accslm(i,k) = 0._r8 + loc_conv%dlfm (i,k) = 0._r8 + + loc_conv%autoln(i,k) = 0._r8 + loc_conv%accrln(i,k) = 0._r8 + loc_conv%bergnn(i,k) = 0._r8 + loc_conv%fhtimn(i,k) = 0._r8 + loc_conv%fhtctn(i,k) = 0._r8 + loc_conv%fhmln (i,k) = 0._r8 + loc_conv%accsln(i,k) = 0._r8 + loc_conv%activn(i,k) = 0._r8 + loc_conv%dlfn (i,k) = 0._r8 + loc_conv%cmel (i,k) = 0._r8 + + loc_conv%autoim(i,k) = 0._r8 + loc_conv%accsim(i,k) = 0._r8 + loc_conv%difm (i,k) = 0._r8 + loc_conv%cmei (i,k) = 0._r8 + + loc_conv%nuclin(i,k) = 0._r8 + loc_conv%autoin(i,k) = 0._r8 + loc_conv%accsin(i,k) = 0._r8 + loc_conv%hmpin (i,k) = 0._r8 + loc_conv%difn (i,k) = 0._r8 + + loc_conv%trspcm(i,k) = 0._r8 + loc_conv%trspcn(i,k) = 0._r8 + loc_conv%trspim(i,k) = 0._r8 + loc_conv%trspin(i,k) = 0._r8 + end if + end do + end do +! +! compute temperature and moisture changes due to convection. +! + call q1q2_pjr(lchnk , & + dqdt ,dsdt ,qg ,qs ,qu , & + su ,du ,qhat ,shat ,dp , & + mu ,md ,sd ,qd ,qldeg , & + dsubcld ,jt ,maxg ,1 ,lengath , & + cpres ,rl ,msg , & + dlg ,evpg ,cug , & + loc_conv ) +! +! gather back temperature and mixing ratio. +! + + if (zmconv_microp) then + do k = msg + 1,pver + do i = 1,lengath + if (dqdt(i,k)*2._r8*delt+qg(i,k)<0._r8) then + negadq = (dqdt(i,k)+0.5_r8*qg(i,k)/delt)/0.9999_r8 + dqdt(i,k) = dqdt(i,k)-negadq + + do kk=k,jt(i),-1 + if (negadq<0._r8) then + if (rprdg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then + dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres + if (rprdg(i,kk)>loc_conv%sprd(i,kk)) then + if(rprdg(i,kk)-loc_conv%sprd(i,kk)<-negadq*dp(i,k)/dp(i,kk)) then + dsdt(i,k) = dsdt(i,k) + (negadq+ (rprdg(i,kk)-loc_conv%sprd(i,kk))*dp(i,kk)/dp(i,k))*latice/cpres + loc_conv%sprd(i,kk) = negadq*dp(i,k)/dp(i,kk)+rprdg(i,kk) + end if + else + loc_conv%sprd(i,kk) = loc_conv%sprd(i,kk)+negadq*dp(i,k)/dp(i,kk) + dsdt(i,k) = dsdt(i,k) + negadq*latice/cpres + end if + rprdg(i,kk) = rprdg(i,kk)+negadq*dp(i,k)/dp(i,kk) + negadq = 0._r8 + else + negadq = rprdg(i,kk)*dp(i,kk)/dp(i,k)+negadq + dsdt(i,k) = dsdt(i,k) - rprdg(i,kk)*rl/cpres*dp(i,kk)/dp(i,k) + if (rprdg(i,kk)>loc_conv%sprd(i,kk)) then + dsdt(i,k) = dsdt(i,k) - loc_conv%sprd(i,kk)*latice/cpres*dp(i,kk)/dp(i,k) + loc_conv%sprd(i,kk) = 0._r8 + else + dsdt(i,k) = dsdt(i,k) -rprdg(i,kk)*latice/cpres*dp(i,kk)/dp(i,k) + loc_conv%sprd(i,kk)= loc_conv%sprd(i,kk)- rprdg(i,kk) + end if + rprdg(i,kk) = 0._r8 + end if + + if (dlg(i,kk)>loc_conv%di(i,kk)) then + doliq= .true. + else + doliq= .false. + end if + + if (negadq<0._r8) then + if (doliq) then + if (dlg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then + dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres + loc_conv%dnl(i,kk) = loc_conv%dnl(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/dlg(i,kk)) + dlg(i,kk) = dlg(i,kk)+negadq*dp(i,k)/dp(i,kk) + negadq = 0._r8 + else + negadq = negadq + dlg(i,kk)*dp(i,kk)/dp(i,k) + dsdt(i,k) = dsdt(i,k) - dlg(i,kk)*dp(i,kk)/dp(i,k)*rl/cpres + dlg(i,kk) = 0._r8 + loc_conv%dnl(i,kk) = 0._r8 + end if + else + if (loc_conv%di(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then + dsdt(i,k) = dsdt(i,k) + negadq*(rl+latice)/cpres + loc_conv%dni(i,kk) = loc_conv%dni(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/loc_conv%di(i,kk)) + loc_conv%di(i,kk) = loc_conv%di(i,kk)+negadq*dp(i,k)/dp(i,kk) + negadq = 0._r8 + else + negadq = negadq + loc_conv%di(i,kk)*dp(i,kk)/dp(i,k) + dsdt(i,k) = dsdt(i,k) - loc_conv%di(i,kk)*dp(i,kk)/dp(i,k)*(rl+latice)/cpres + loc_conv%di(i,kk) = 0._r8 + loc_conv%dni(i,kk) = 0._r8 + end if + doliq= .false. + end if + end if + if (negadq<0._r8 .and. doliq ) then + if (dlg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then + dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres + loc_conv%dnl(i,kk) = loc_conv%dnl(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/dlg(i,kk)) + dlg(i,kk) = dlg(i,kk)+negadq*dp(i,k)/dp(i,kk) + negadq = 0._r8 + else + negadq = negadq + dlg(i,kk)*dp(i,kk)/dp(i,k) + dsdt(i,k) = dsdt(i,k) - dlg(i,kk)*dp(i,kk)/dp(i,k)*rl/cpres + dlg(i,kk) = 0._r8 + loc_conv%dnl(i,kk) = 0._r8 + end if + end if + + end if + end do + + if (negadq<0._r8) then + dqdt(i,k) = dqdt(i,k) + negadq + end if + + end if + end do + end do + end if + + do k = msg + 1,pver + do i = 1,lengath +! +! q is updated to compute net precip. +! + q(ideep(i),k) = qh(ideep(i),k) + 2._r8*delt*dqdt(i,k) + qtnd(ideep(i),k) = dqdt (i,k) + cme (ideep(i),k) = cmeg (i,k) + rprd(ideep(i),k) = rprdg(i,k) + zdu (ideep(i),k) = du (i,k) + mcon(ideep(i),k) = mc (i,k) + heat(ideep(i),k) = dsdt (i,k)*cpres + dlf (ideep(i),k) = dlg (i,k) + pflx(ideep(i),k) = pflxg(i,k) + ql (ideep(i),k) = qlg (i,k) + end do + end do + + if (zmconv_microp) then + do k = msg + 1,pver + do i = 1,lengath + dif (ideep(i),k) = loc_conv%di (i,k) + dnlf(ideep(i),k) = loc_conv%dnl (i,k) + dnif(ideep(i),k) = loc_conv%dni (i,k) + + conv%qi (ideep(i),k) = loc_conv%qice(i,k) + conv%frz(ideep(i),k) = loc_conv%frz(i,k)*latice/cpres + conv%sprd(ideep(i),k) = loc_conv%sprd(i,k) + conv%wu (ideep(i),k) = loc_conv%wu (i,k) + conv%qliq(ideep(i),k) = loc_conv%qliq (i,k) + conv%qice(ideep(i),k) = loc_conv%qice (i,k) + conv%qrain(ideep(i),k) = loc_conv%qrain (i,k) + conv%qsnow(ideep(i),k) = loc_conv%qsnow (i,k) + conv%qnl(ideep(i),k) = loc_conv%qnl(i,k) + conv%qni(ideep(i),k) = loc_conv%qni(i,k) + conv%qnr(ideep(i),k) = loc_conv%qnr(i,k) + conv%qns(ideep(i),k) = loc_conv%qns(i,k) + + conv%autolm(ideep(i),k) = loc_conv%autolm(i,k) + conv%accrlm(ideep(i),k) = loc_conv%accrlm(i,k) + conv%bergnm(ideep(i),k) = loc_conv%bergnm(i,k) + conv%fhtimm(ideep(i),k) = loc_conv%fhtimm(i,k) + conv%fhtctm(ideep(i),k) = loc_conv%fhtctm(i,k) + conv%fhmlm (ideep(i),k) = loc_conv%fhmlm (i,k) + conv%hmpim (ideep(i),k) = loc_conv%hmpim (i,k) + conv%accslm(ideep(i),k) = loc_conv%accslm(i,k) + conv%dlfm (ideep(i),k) = loc_conv%dlfm (i,k) + + conv%autoln(ideep(i),k) = loc_conv%autoln(i,k) + conv%accrln(ideep(i),k) = loc_conv%accrln(i,k) + conv%bergnn(ideep(i),k) = loc_conv%bergnn(i,k) + conv%fhtimn(ideep(i),k) = loc_conv%fhtimn(i,k) + conv%fhtctn(ideep(i),k) = loc_conv%fhtctn(i,k) + conv%fhmln (ideep(i),k) = loc_conv%fhmln (i,k) + conv%accsln(ideep(i),k) = loc_conv%accsln(i,k) + conv%activn(ideep(i),k) = loc_conv%activn(i,k) + conv%dlfn (ideep(i),k) = loc_conv%dlfn (i,k) + conv%cmel (ideep(i),k) = loc_conv%cmel (i,k) + + conv%autoim(ideep(i),k) = loc_conv%autoim(i,k) + conv%accsim(ideep(i),k) = loc_conv%accsim(i,k) + conv%difm (ideep(i),k) = loc_conv%difm (i,k) + conv%cmei (ideep(i),k) = loc_conv%cmei (i,k) + + conv%nuclin(ideep(i),k) = loc_conv%nuclin(i,k) + conv%autoin(ideep(i),k) = loc_conv%autoin(i,k) + conv%accsin(ideep(i),k) = loc_conv%accsin(i,k) + conv%hmpin (ideep(i),k) = loc_conv%hmpin (i,k) + conv%difn (ideep(i),k) = loc_conv%difn (i,k) + + conv%trspcm(ideep(i),k) = loc_conv%trspcm(i,k) + conv%trspcn(ideep(i),k) = loc_conv%trspcn(i,k) + conv%trspim(ideep(i),k) = loc_conv%trspim(i,k) + conv%trspin(ideep(i),k) = loc_conv%trspin(i,k) + conv%lambdadpcu(ideep(i),k) = loc_conv%lambdadpcu(i,k) + conv%mudpcu(ideep(i),k) = loc_conv%mudpcu(i,k) + + end do + end do + + do k = msg + 1,pver + do i = 1,ncol + + !convert it from units of "kg/kg" to "g/m3" + + if(k.lt.pver) then + conv%qice (i,k) = 0.5_r8*(conv%qice(i,k)+conv%qice(i,k+1)) + conv%qliq (i,k) = 0.5_r8*(conv%qliq(i,k)+conv%qliq(i,k+1)) + conv%qrain (i,k) = 0.5_r8*(conv%qrain(i,k)+conv%qrain(i,k+1)) + conv%qsnow (i,k) = 0.5_r8*(conv%qsnow(i,k)+conv%qsnow(i,k+1)) + conv%qni (i,k) = 0.5_r8*(conv%qni(i,k)+conv%qni(i,k+1)) + conv%qnl (i,k) = 0.5_r8*(conv%qnl(i,k)+conv%qnl(i,k+1)) + conv%qnr (i,k) = 0.5_r8*(conv%qnr(i,k)+conv%qnr(i,k+1)) + conv%qns (i,k) = 0.5_r8*(conv%qns(i,k)+conv%qns(i,k+1)) + conv%wu(i,k) = 0.5_r8*(conv%wu(i,k)+conv%wu(i,k+1)) + end if + + if (t(i,k).gt. 273.15_r8 .and. t(i,k-1).le.273.15_r8) then + conv%qice (i,k-1) = conv%qice (i,k-1) + conv%qice (i,k) + conv%qice (i,k) = 0._r8 + conv%qni (i,k-1) = conv%qni (i,k-1) + conv%qni (i,k) + conv%qni (i,k) = 0._r8 + conv%qsnow (i,k-1) = conv%qsnow (i,k-1) + conv%qsnow (i,k) + conv%qsnow (i,k) = 0._r8 + conv%qns (i,k-1) = conv%qns (i,k-1) + conv%qns (i,k) + conv%qns (i,k) = 0._r8 + end if + + conv%qice (i,k) = conv%qice(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 + conv%qliq (i,k) = conv%qliq(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 + conv%qrain (i,k) = conv%qrain(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 + conv%qsnow (i,k) = conv%qsnow(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 + conv%qni (i,k) = conv%qni(i,k) * pap(i,k)/t(i,k)/rgas + conv%qnl (i,k) = conv%qnl(i,k) * pap(i,k)/t(i,k)/rgas + conv%qnr (i,k) = conv%qnr(i,k) * pap(i,k)/t(i,k)/rgas + conv%qns (i,k) = conv%qns(i,k) * pap(i,k)/t(i,k)/rgas + end do + end do + end if + +! + do i = 1,lengath + jctop(ideep(i)) = jt(i) + jcbot(ideep(i)) = maxg(i) + pflx(ideep(i),pverp) = pflxg(i,pverp) + end do + + if (zmconv_microp) then + do i = 1,lengath + conv%dcape(ideep(i)) = loc_conv%dcape(i) + end do + end if + +! Compute precip by integrating change in water vapor minus detrained cloud water + do k = pver,msg + 1,-1 + do i = 1,ncol + prec(i) = prec(i) - dpp(i,k)* (q(i,k)-qh(i,k)) - dpp(i,k)*(dlf(i,k)+dif(i,k))*2._r8*delt + end do + end do + +! obtain final precipitation rate in m/s. + do i = 1,ncol + prec(i) = rgrav*max(prec(i),0._r8)/ (2._r8*delt)/1000._r8 + end do + +! Compute reserved liquid (not yet in cldliq) for energy integrals. +! Treat rliq as flux out bottom, to be added back later. + do k = 1, pver + do i = 1, ncol + rliq(i) = rliq(i) + (dlf(i,k)+dif(i,k))*dpp(i,k)/gravit + rice(i) = rice(i) + dif(i,k)*dpp(i,k)/gravit + end do + end do + rliq(:ncol) = rliq(:ncol) /1000._r8 + rice(:ncol) = rice(:ncol) /1000._r8 + + if (zmconv_microp) then + deallocate( & + loc_conv%frz, & + loc_conv%sprd, & + loc_conv%wu, & + loc_conv%qi, & + loc_conv%qliq, & + loc_conv%qice, & + loc_conv%qrain, & + loc_conv%qsnow, & + loc_conv%di, & + loc_conv%dnl, & + loc_conv%dni, & + loc_conv%qnl, & + loc_conv%qni, & + loc_conv%qnr, & + loc_conv%qns, & + loc_conv%qide, & + loc_conv%qncde, & + loc_conv%qnide, & + loc_conv%autolm, & + loc_conv%accrlm, & + loc_conv%bergnm, & + loc_conv%fhtimm, & + loc_conv%fhtctm, & + loc_conv%fhmlm, & + loc_conv%hmpim, & + loc_conv%accslm, & + loc_conv%dlfm, & + loc_conv%cmel, & + loc_conv%autoln, & + loc_conv%accrln, & + loc_conv%bergnn, & + loc_conv%fhtimn, & + loc_conv%fhtctn, & + loc_conv%fhmln, & + loc_conv%accsln, & + loc_conv%activn, & + loc_conv%dlfn, & + loc_conv%autoim, & + loc_conv%accsim, & + loc_conv%difm, & + loc_conv%cmei, & + loc_conv%nuclin, & + loc_conv%autoin, & + loc_conv%accsin, & + loc_conv%hmpin, & + loc_conv%difn, & + loc_conv%trspcm, & + loc_conv%trspcn, & + loc_conv%trspim, & + loc_conv%trspin, & + loc_conv%lambdadpcu, & + loc_conv%mudpcu, & + loc_conv%dcape ) + end if + + return +end subroutine zm_convr + +!=============================================================================== +subroutine zm_conv_evap(ncol,lchnk, & + t,pmid,pdel,q, & + landfrac, & + tend_s, tend_s_snwprd, tend_s_snwevmlt, tend_q, & + prdprec, cldfrc, deltat, & + prec, snow, ntprprd, ntsnprd, flxprec, flxsnow, prdsnow) + + +!----------------------------------------------------------------------- +! Compute tendencies due to evaporation of rain from ZM scheme +!-- +! Compute the total precipitation and snow fluxes at the surface. +! Add in the latent heat of fusion for snow formation and melt, since it not dealt with +! in the Zhang-MacFarlane parameterization. +! Evaporate some of the precip directly into the environment using a Sundqvist type algorithm +!----------------------------------------------------------------------- + + use wv_saturation, only: qsat + use phys_grid, only: get_rlat_all_p + +!------------------------------Arguments-------------------------------- + integer,intent(in) :: ncol, lchnk ! number of columns and chunk index + real(r8),intent(in), dimension(pcols,pver) :: t ! temperature (K) + real(r8),intent(in), dimension(pcols,pver) :: pmid ! midpoint pressure (Pa) + real(r8),intent(in), dimension(pcols,pver) :: pdel ! layer thickness (Pa) + real(r8),intent(in), dimension(pcols,pver) :: q ! water vapor (kg/kg) + real(r8),intent(in), dimension(pcols) :: landfrac + real(r8),intent(inout), dimension(pcols,pver) :: tend_s ! heating rate (J/kg/s) + real(r8),intent(inout), dimension(pcols,pver) :: tend_q ! water vapor tendency (kg/kg/s) + real(r8),intent(out ), dimension(pcols,pver) :: tend_s_snwprd ! Heating rate of snow production + real(r8),intent(out ), dimension(pcols,pver) :: tend_s_snwevmlt ! Heating rate of evap/melting of snow + + + + real(r8), intent(in ) :: prdprec(pcols,pver)! precipitation production (kg/ks/s) + real(r8), intent(in ) :: cldfrc(pcols,pver) ! cloud fraction + real(r8), intent(in ) :: deltat ! time step + + real(r8), intent(inout) :: prec(pcols) ! Convective-scale preciptn rate + real(r8), intent(out) :: snow(pcols) ! Convective-scale snowfall rate + + real(r8), optional, intent(in), allocatable :: prdsnow(:,:) ! snow production (kg/ks/s) + +! +!---------------------------Local storage------------------------------- + + real(r8) :: es (pcols,pver) ! Saturation vapor pressure + real(r8) :: fice (pcols,pver) ! ice fraction in precip production + real(r8) :: fsnow_conv(pcols,pver) ! snow fraction in precip production + real(r8) :: qs (pcols,pver) ! saturation specific humidity + real(r8),intent(out) :: flxprec(pcols,pverp) ! Convective-scale flux of precip at interfaces (kg/m2/s) + real(r8),intent(out) :: flxsnow(pcols,pverp) ! Convective-scale flux of snow at interfaces (kg/m2/s) + real(r8),intent(out) :: ntprprd(pcols,pver) ! net precip production in layer + real(r8),intent(out) :: ntsnprd(pcols,pver) ! net snow production in layer + real(r8) :: work1 ! temp variable (pjr) + real(r8) :: work2 ! temp variable (pjr) + + real(r8) :: evpvint(pcols) ! vertical integral of evaporation + real(r8) :: evpprec(pcols) ! evaporation of precipitation (kg/kg/s) + real(r8) :: evpsnow(pcols) ! evaporation of snowfall (kg/kg/s) + real(r8) :: snowmlt(pcols) ! snow melt tendency in layer + real(r8) :: flxsntm(pcols) ! flux of snow into layer, after melting + + real(r8) :: kemask + real(r8) :: evplimit ! temp variable for evaporation limits + real(r8) :: rlat(pcols) + real(r8) :: dum + real(r8) :: omsm + + integer :: i,k ! longitude,level indices + logical :: old_snow + + +!----------------------------------------------------------------------- + + ! If prdsnow is passed in and allocated, then use it in the calculation, otherwise + ! use the old snow calculation + old_snow=.true. + if (present(prdsnow)) then + if (allocated(prdsnow)) then + old_snow=.false. + end if + end if + +! convert input precip to kg/m2/s + prec(:ncol) = prec(:ncol)*1000._r8 + +! determine saturation vapor pressure + + do k = 1,pver +!+++ARH + !call qsat(t(1:ncol,k), pmid(1:ncol,k), es(1:ncol,k), qs(1:ncol,k), ncol) + call qsat(t(1:ncol,k), pmid(1:ncol,k), es(1:ncol,k), qs(1:ncol,k)) +!---ARH + end do + +! determine ice fraction in rain production (use cloud water parameterization fraction at present) + call cldfrc_fice(ncol, t, fice, fsnow_conv) + +! zero the flux integrals on the top boundary + flxprec(:ncol,1) = 0._r8 + flxsnow(:ncol,1) = 0._r8 + evpvint(:ncol) = 0._r8 + omsm=0.9999_r8 + + do k = 1, pver + do i = 1, ncol + +! Melt snow falling into layer, if necessary. + if( old_snow ) then + if (t(i,k) > tmelt) then + flxsntm(i) = 0._r8 + snowmlt(i) = flxsnow(i,k) * gravit/ pdel(i,k) + else + flxsntm(i) = flxsnow(i,k) + snowmlt(i) = 0._r8 + end if + else + ! make sure melting snow doesn't reduce temperature below threshold + if (t(i,k) > tmelt) then + dum = -latice/cpres*flxsnow(i,k)*gravit/pdel(i,k)*deltat + if (t(i,k) + dum .le. tmelt) then + dum = (t(i,k)-tmelt)*cpres/latice/deltat + dum = dum/(flxsnow(i,k)*gravit/pdel(i,k)) + dum = max(0._r8,dum) + dum = min(1._r8,dum) + else + dum = 1._r8 + end if + dum = dum*omsm + flxsntm(i) = flxsnow(i,k)*(1.0_r8-dum) + snowmlt(i) = dum*flxsnow(i,k)*gravit/ pdel(i,k) + else + flxsntm(i) = flxsnow(i,k) + snowmlt(i) = 0._r8 + end if + end if + +! relative humidity depression must be > 0 for evaporation + evplimit = max(1._r8 - q(i,k)/qs(i,k), 0._r8) + + if (zm_org) then + kemask = ke * (1._r8 - landfrac(i)) + ke_lnd * landfrac(i) + else + kemask = ke + endif + +! total evaporation depends on flux in the top of the layer +! flux prec is the net production above layer minus evaporation into environmet + evpprec(i) = kemask * (1._r8 - cldfrc(i,k)) * evplimit * sqrt(flxprec(i,k)) +!********************************************************** +!! evpprec(i) = 0. ! turn off evaporation for now +!********************************************************** + +! Don't let evaporation supersaturate layer (approx). Layer may already be saturated. +! Currently does not include heating/cooling change to qs + evplimit = max(0._r8, (qs(i,k)-q(i,k)) / deltat) + +! Don't evaporate more than is falling into the layer - do not evaporate rain formed +! in this layer but if precip production is negative, remove from the available precip +! Negative precip production occurs because of evaporation in downdrafts. +!!$ evplimit = flxprec(i,k) * gravit / pdel(i,k) + min(prdprec(i,k), 0.) + evplimit = min(evplimit, flxprec(i,k) * gravit / pdel(i,k)) + +! Total evaporation cannot exceed input precipitation + evplimit = min(evplimit, (prec(i) - evpvint(i)) * gravit / pdel(i,k)) + + evpprec(i) = min(evplimit, evpprec(i)) + if( .not.old_snow ) then + evpprec(i) = max(0._r8, evpprec(i)) + evpprec(i) = evpprec(i)*omsm + end if + + +! evaporation of snow depends on snow fraction of total precipitation in the top after melting + if (flxprec(i,k) > 0._r8) then +! evpsnow(i) = evpprec(i) * flxsntm(i) / flxprec(i,k) +! prevent roundoff problems + work1 = min(max(0._r8,flxsntm(i)/flxprec(i,k)),1._r8) + evpsnow(i) = evpprec(i) * work1 + else + evpsnow(i) = 0._r8 + end if + +! vertically integrated evaporation + evpvint(i) = evpvint(i) + evpprec(i) * pdel(i,k)/gravit + +! net precip production is production - evaporation + ntprprd(i,k) = prdprec(i,k) - evpprec(i) +! net snow production is precip production * ice fraction - evaporation - melting +!pjrworks ntsnprd(i,k) = prdprec(i,k)*fice(i,k) - evpsnow(i) - snowmlt(i) +!pjrwrks2 ntsnprd(i,k) = prdprec(i,k)*fsnow_conv(i,k) - evpsnow(i) - snowmlt(i) +! the small amount added to flxprec in the work1 expression has been increased from +! 1e-36 to 8.64e-11 (1e-5 mm/day). This causes the temperature based partitioning +! scheme to be used for small flxprec amounts. This is to address error growth problems. + + if( old_snow ) then +#ifdef PERGRO + work1 = min(max(0._r8,flxsnow(i,k)/(flxprec(i,k)+8.64e-11_r8)),1._r8) +#else + if (flxprec(i,k).gt.0._r8) then + work1 = min(max(0._r8,flxsnow(i,k)/flxprec(i,k)),1._r8) + else + work1 = 0._r8 + endif +#endif + work2 = max(fsnow_conv(i,k), work1) + if (snowmlt(i).gt.0._r8) work2 = 0._r8 +! work2 = fsnow_conv(i,k) + ntsnprd(i,k) = prdprec(i,k)*work2 - evpsnow(i) - snowmlt(i) + tend_s_snwprd (i,k) = prdprec(i,k)*work2*latice + tend_s_snwevmlt(i,k) = - ( evpsnow(i) + snowmlt(i) )*latice + else + ntsnprd(i,k) = prdsnow(i,k) - min(flxsnow(i,k)*gravit/pdel(i,k), evpsnow(i)+snowmlt(i)) + tend_s_snwprd (i,k) = prdsnow(i,k)*latice + tend_s_snwevmlt(i,k) = -min(flxsnow(i,k)*gravit/pdel(i,k), evpsnow(i)+snowmlt(i) )*latice + end if + +! precipitation fluxes + flxprec(i,k+1) = flxprec(i,k) + ntprprd(i,k) * pdel(i,k)/gravit + flxsnow(i,k+1) = flxsnow(i,k) + ntsnprd(i,k) * pdel(i,k)/gravit + +! protect against rounding error + flxprec(i,k+1) = max(flxprec(i,k+1), 0._r8) + flxsnow(i,k+1) = max(flxsnow(i,k+1), 0._r8) +! more protection (pjr) +! flxsnow(i,k+1) = min(flxsnow(i,k+1), flxprec(i,k+1)) + +! heating (cooling) and moistening due to evaporation +! - latent heat of vaporization for precip production has already been accounted for +! - snow is contained in prec + if( old_snow ) then + tend_s(i,k) =-evpprec(i)*latvap + ntsnprd(i,k)*latice + else + tend_s(i,k) =-evpprec(i)*latvap + tend_s_snwevmlt(i,k) + end if + tend_q(i,k) = evpprec(i) + end do + end do + +! set output precipitation rates (m/s) + prec(:ncol) = flxprec(:ncol,pver+1) / 1000._r8 + snow(:ncol) = flxsnow(:ncol,pver+1) / 1000._r8 + +!********************************************************** +!!$ tend_s(:ncol,:) = 0. ! turn heating off +!********************************************************** + + end subroutine zm_conv_evap + + + +subroutine convtran(lchnk , & + doconvtran,q ,ncnst ,mu ,md , & + du ,eu ,ed ,dp ,dsubcld , & + jt ,mx ,ideep ,il1g ,il2g , & + nstep ,fracis ,dqdt ,dpdry ,dt) +!----------------------------------------------------------------------- +! +! Purpose: +! Convective transport of trace species +! +! Mixing ratios may be with respect to either dry or moist air +! +! Method: +! +! +! +! Author: P. Rasch +! +!----------------------------------------------------------------------- + use shr_kind_mod, only: r8 => shr_kind_r8 + use constituents, only: cnst_get_type_byind + use ppgrid + + implicit none +!----------------------------------------------------------------------- +! +! Input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncnst ! number of tracers to transport + logical, intent(in) :: doconvtran(ncnst) ! flag for doing convective transport + real(r8), intent(in) :: q(pcols,pver,ncnst) ! Tracer array including moisture + real(r8), intent(in) :: mu(pcols,pver) ! Mass flux up + real(r8), intent(in) :: md(pcols,pver) ! Mass flux down + real(r8), intent(in) :: du(pcols,pver) ! Mass detraining from updraft + real(r8), intent(in) :: eu(pcols,pver) ! Mass entraining from updraft + real(r8), intent(in) :: ed(pcols,pver) ! Mass entraining from downdraft + real(r8), intent(in) :: dp(pcols,pver) ! Delta pressure between interfaces + real(r8), intent(in) :: dsubcld(pcols) ! Delta pressure from cloud base to sfc + real(r8), intent(in) :: fracis(pcols,pver,ncnst) ! fraction of tracer that is insoluble + + integer, intent(in) :: jt(pcols) ! Index of cloud top for each column + integer, intent(in) :: mx(pcols) ! Index of cloud top for each column + integer, intent(in) :: ideep(pcols) ! Gathering array + integer, intent(in) :: il1g ! Gathered min lon indices over which to operate + integer, intent(in) :: il2g ! Gathered max lon indices over which to operate + integer, intent(in) :: nstep ! Time step index + + real(r8), intent(in) :: dpdry(pcols,pver) ! Delta pressure between interfaces + + real(r8), intent(in) :: dt ! 2 delta t (model time increment) + +! input/output + + real(r8), intent(out) :: dqdt(pcols,pver,ncnst) ! Tracer tendency array + +!--------------------------Local Variables------------------------------ + + integer i ! Work index + integer k ! Work index + integer kbm ! Highest altitude index of cloud base + integer kk ! Work index + integer kkp1 ! Work index + integer km1 ! Work index + integer kp1 ! Work index + integer ktm ! Highest altitude index of cloud top + integer m ! Work index + + real(r8) cabv ! Mix ratio of constituent above + real(r8) cbel ! Mix ratio of constituent below + real(r8) cdifr ! Normalized diff between cabv and cbel + real(r8) chat(pcols,pver) ! Mix ratio in env at interfaces + real(r8) cond(pcols,pver) ! Mix ratio in downdraft at interfaces + real(r8) const(pcols,pver) ! Gathered tracer array + real(r8) fisg(pcols,pver) ! gathered insoluble fraction of tracer + real(r8) conu(pcols,pver) ! Mix ratio in updraft at interfaces + real(r8) dcondt(pcols,pver) ! Gathered tend array + real(r8) small ! A small number + real(r8) mbsth ! Threshold for mass fluxes + real(r8) mupdudp ! A work variable + real(r8) minc ! A work variable + real(r8) maxc ! A work variable + real(r8) fluxin ! A work variable + real(r8) fluxout ! A work variable + real(r8) netflux ! A work variable + + real(r8) dutmp(pcols,pver) ! Mass detraining from updraft + real(r8) eutmp(pcols,pver) ! Mass entraining from updraft + real(r8) edtmp(pcols,pver) ! Mass entraining from downdraft + real(r8) dptmp(pcols,pver) ! Delta pressure between interfaces + real(r8) total(pcols) + real(r8) negadt,qtmp + +!----------------------------------------------------------------------- +! + small = 1.e-36_r8 +! mbsth is the threshold below which we treat the mass fluxes as zero (in mb/s) + mbsth = 1.e-15_r8 + +! Find the highest level top and bottom levels of convection + ktm = pver + kbm = pver + do i = il1g, il2g + ktm = min(ktm,jt(i)) + kbm = min(kbm,mx(i)) + end do + +! Loop ever each constituent + do m = 2, ncnst + if (doconvtran(m)) then + + if (cnst_get_type_byind(m).eq.'dry') then + do k = 1,pver + do i =il1g,il2g + dptmp(i,k) = dpdry(i,k) + dutmp(i,k) = du(i,k)*dp(i,k)/dpdry(i,k) + eutmp(i,k) = eu(i,k)*dp(i,k)/dpdry(i,k) + edtmp(i,k) = ed(i,k)*dp(i,k)/dpdry(i,k) + end do + end do + else + do k = 1,pver + do i =il1g,il2g + dptmp(i,k) = dp(i,k) + dutmp(i,k) = du(i,k) + eutmp(i,k) = eu(i,k) + edtmp(i,k) = ed(i,k) + end do + end do + endif +! dptmp = dp + +! Gather up the constituent and set tend to zero + do k = 1,pver + do i =il1g,il2g + const(i,k) = q(ideep(i),k,m) + fisg(i,k) = fracis(ideep(i),k,m) + end do + end do + +! From now on work only with gathered data + +! Interpolate environment tracer values to interfaces + do k = 1,pver + km1 = max(1,k-1) + do i = il1g, il2g + minc = min(const(i,km1),const(i,k)) + maxc = max(const(i,km1),const(i,k)) + if (minc < 0) then + cdifr = 0._r8 + else + cdifr = abs(const(i,k)-const(i,km1))/max(maxc,small) + endif + +! If the two layers differ significantly use a geometric averaging +! procedure + if (cdifr > 1.E-6_r8) then + cabv = max(const(i,km1),maxc*1.e-12_r8) + cbel = max(const(i,k),maxc*1.e-12_r8) + chat(i,k) = log(cabv/cbel)/(cabv-cbel)*cabv*cbel + + else ! Small diff, so just arithmetic mean + chat(i,k) = 0.5_r8* (const(i,k)+const(i,km1)) + end if + +! Provisional up and down draft values + conu(i,k) = chat(i,k) + cond(i,k) = chat(i,k) + +! provisional tends + dcondt(i,k) = 0._r8 + + end do + end do + +! Do levels adjacent to top and bottom + k = 2 + km1 = 1 + kk = pver + do i = il1g,il2g + mupdudp = mu(i,kk) + dutmp(i,kk)*dptmp(i,kk) + if (mupdudp > mbsth) then + conu(i,kk) = (+eutmp(i,kk)*fisg(i,kk)*const(i,kk)*dptmp(i,kk))/mupdudp + endif + if (md(i,k) < -mbsth) then + cond(i,k) = (-edtmp(i,km1)*fisg(i,km1)*const(i,km1)*dptmp(i,km1))/md(i,k) + endif + end do + +! Updraft from bottom to top + do kk = pver-1,1,-1 + kkp1 = min(pver,kk+1) + do i = il1g,il2g + mupdudp = mu(i,kk) + dutmp(i,kk)*dptmp(i,kk) + if (mupdudp > mbsth) then + conu(i,kk) = ( mu(i,kkp1)*conu(i,kkp1)+eutmp(i,kk)*fisg(i,kk)* & + const(i,kk)*dptmp(i,kk) )/mupdudp + endif + end do + end do + +! Downdraft from top to bottom + do k = 3,pver + km1 = max(1,k-1) + do i = il1g,il2g + if (md(i,k) < -mbsth) then + cond(i,k) = ( md(i,km1)*cond(i,km1)-edtmp(i,km1)*fisg(i,km1)*const(i,km1) & + *dptmp(i,km1) )/md(i,k) + endif + end do + end do + + + do k = ktm,pver + km1 = max(1,k-1) + kp1 = min(pver,k+1) + do i = il1g,il2g + +! version 1 hard to check for roundoff errors +! dcondt(i,k) = +! $ +(+mu(i,kp1)* (conu(i,kp1)-chat(i,kp1)) +! $ -mu(i,k)* (conu(i,k)-chat(i,k)) +! $ +md(i,kp1)* (cond(i,kp1)-chat(i,kp1)) +! $ -md(i,k)* (cond(i,k)-chat(i,k)) +! $ )/dp(i,k) + +! version 2 hard to limit fluxes +! fluxin = mu(i,kp1)*conu(i,kp1) + mu(i,k)*chat(i,k) +! $ -(md(i,k) *cond(i,k) + md(i,kp1)*chat(i,kp1)) +! fluxout = mu(i,k)*conu(i,k) + mu(i,kp1)*chat(i,kp1) +! $ -(md(i,kp1)*cond(i,kp1) + md(i,k)*chat(i,k)) + +! version 3 limit fluxes outside convection to mass in appropriate layer +! these limiters are probably only safe for positive definite quantitities +! it assumes that mu and md already satify a courant number limit of 1 + fluxin = mu(i,kp1)*conu(i,kp1)+ mu(i,k)*min(chat(i,k),const(i,km1)) & + -(md(i,k) *cond(i,k) + md(i,kp1)*min(chat(i,kp1),const(i,kp1))) + fluxout = mu(i,k)*conu(i,k) + mu(i,kp1)*min(chat(i,kp1),const(i,k)) & + -(md(i,kp1)*cond(i,kp1) + md(i,k)*min(chat(i,k),const(i,k))) + + netflux = fluxin - fluxout + if (abs(netflux) < max(fluxin,fluxout)*1.e-12_r8) then + netflux = 0._r8 + endif + dcondt(i,k) = netflux/dptmp(i,k) + end do + end do +! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +! + do k = kbm,pver + km1 = max(1,k-1) + do i = il1g,il2g + if (k == mx(i)) then + +! version 1 +! dcondt(i,k) = (1./dsubcld(i))* +! $ (-mu(i,k)*(conu(i,k)-chat(i,k)) +! $ -md(i,k)*(cond(i,k)-chat(i,k)) +! $ ) + +! version 2 +! fluxin = mu(i,k)*chat(i,k) - md(i,k)*cond(i,k) +! fluxout = mu(i,k)*conu(i,k) - md(i,k)*chat(i,k) +! version 3 + fluxin = mu(i,k)*min(chat(i,k),const(i,km1)) - md(i,k)*cond(i,k) + fluxout = mu(i,k)*conu(i,k) - md(i,k)*min(chat(i,k),const(i,k)) + + netflux = fluxin - fluxout + if (abs(netflux) < max(fluxin,fluxout)*1.e-12_r8) then + netflux = 0._r8 + endif +! dcondt(i,k) = netflux/dsubcld(i) + dcondt(i,k) = netflux/dptmp(i,k) + else if (k > mx(i)) then +! dcondt(i,k) = dcondt(i,k-1) + dcondt(i,k) = 0._r8 + end if + end do + end do + + if (zmconv_microp) then + do i = il1g,il2g + do k = jt(i),mx(i) + if (dcondt(i,k)*dt+const(i,k)<0._r8) then + negadt = dcondt(i,k)+const(i,k)/dt + dcondt(i,k) = -const(i,k)/dt + do kk= k+1, mx(i) + if (negadt<0._r8 .and. dcondt(i,kk)*dt+const(i,kk)>0._r8 ) then + qtmp = dcondt(i,kk)+negadt*dptmp(i,k)/dptmp(i,kk) + if (qtmp*dt+const(i,kk)>0._r8) then + dcondt(i,kk)= qtmp + negadt=0._r8 + else + negadt= negadt+(const(i,kk)/dt+dcondt(i,kk))*dptmp(i,kk)/dptmp(i,k) + dcondt(i,kk)= -const(i,kk)/dt + end if + + end if + end do + do kk= k-1, jt(i), -1 + if (negadt<0._r8 .and. dcondt(i,kk)*dt+const(i,kk)>0._r8 ) then + qtmp = dcondt(i,kk)+negadt*dptmp(i,k)/dptmp(i,kk) + if (qtmp*dt+const(i,kk)>0._r8) then + dcondt(i,kk)= qtmp + negadt=0._r8 + else + negadt= negadt+(const(i,kk)/dt+dcondt(i,kk))*dptmp(i,kk)/dptmp(i,k) + dcondt(i,kk)= -const(i,kk)/dt + end if + end if + end do + + if (negadt<0._r8) then + dcondt(i,k) = dcondt(i,k) + negadt + end if + end if + end do + end do + end if + + +! Initialize to zero everywhere, then scatter tendency back to full array + dqdt(:,:,m) = 0._r8 + do k = 1,pver + kp1 = min(pver,k+1) + do i = il1g,il2g + dqdt(ideep(i),k,m) = dcondt(i,k) + end do + end do + + end if ! for doconvtran + + end do + + return +end subroutine convtran + +!========================================================================================= + +subroutine momtran(lchnk, ncol, & + domomtran,q ,ncnst ,mu ,md , & + du ,eu ,ed ,dp ,dsubcld , & + jt ,mx ,ideep ,il1g ,il2g , & + nstep ,dqdt ,pguall ,pgdall, icwu, icwd, dt, seten ) +!----------------------------------------------------------------------- +! +! Purpose: +! Convective transport of momentum +! +! Mixing ratios may be with respect to either dry or moist air +! +! Method: +! Based on the convtran subroutine by P. Rasch +! +! +! Author: J. Richter and P. Rasch +! +!----------------------------------------------------------------------- + use shr_kind_mod, only: r8 => shr_kind_r8 + use constituents, only: cnst_get_type_byind + use ppgrid + + implicit none +!----------------------------------------------------------------------- +! +! Input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncol ! number of atmospheric columns + integer, intent(in) :: ncnst ! number of tracers to transport + logical, intent(in) :: domomtran(ncnst) ! flag for doing convective transport + real(r8), intent(in) :: q(pcols,pver,ncnst) ! Wind array + real(r8), intent(in) :: mu(pcols,pver) ! Mass flux up + real(r8), intent(in) :: md(pcols,pver) ! Mass flux down + real(r8), intent(in) :: du(pcols,pver) ! Mass detraining from updraft + real(r8), intent(in) :: eu(pcols,pver) ! Mass entraining from updraft + real(r8), intent(in) :: ed(pcols,pver) ! Mass entraining from downdraft + real(r8), intent(in) :: dp(pcols,pver) ! Delta pressure between interfaces + real(r8), intent(in) :: dsubcld(pcols) ! Delta pressure from cloud base to sfc + real(r8), intent(in) :: dt ! time step in seconds : 2*delta_t + + integer, intent(in) :: jt(pcols) ! Index of cloud top for each column + integer, intent(in) :: mx(pcols) ! Index of cloud top for each column + integer, intent(in) :: ideep(pcols) ! Gathering array + integer, intent(in) :: il1g ! Gathered min lon indices over which to operate + integer, intent(in) :: il2g ! Gathered max lon indices over which to operate + integer, intent(in) :: nstep ! Time step index + + + +! input/output + + real(r8), intent(out) :: dqdt(pcols,pver,ncnst) ! Tracer tendency array + +!--------------------------Local Variables------------------------------ + + integer i ! Work index + integer k ! Work index + integer kbm ! Highest altitude index of cloud base + integer kk ! Work index + integer kkp1 ! Work index + integer kkm1 ! Work index + integer km1 ! Work index + integer kp1 ! Work index + integer ktm ! Highest altitude index of cloud top + integer m ! Work index + integer ii ! Work index + + real(r8) cabv ! Mix ratio of constituent above + real(r8) cbel ! Mix ratio of constituent below + real(r8) cdifr ! Normalized diff between cabv and cbel + real(r8) chat(pcols,pver) ! Mix ratio in env at interfaces + real(r8) cond(pcols,pver) ! Mix ratio in downdraft at interfaces + real(r8) const(pcols,pver) ! Gathered wind array + real(r8) conu(pcols,pver) ! Mix ratio in updraft at interfaces + real(r8) dcondt(pcols,pver) ! Gathered tend array + real(r8) mbsth ! Threshold for mass fluxes + real(r8) mupdudp ! A work variable + real(r8) minc ! A work variable + real(r8) maxc ! A work variable + real(r8) fluxin ! A work variable + real(r8) fluxout ! A work variable + real(r8) netflux ! A work variable + + real(r8) sum ! sum + real(r8) sum2 ! sum2 + + real(r8) mududp(pcols,pver) ! working variable + real(r8) mddudp(pcols,pver) ! working variable + + real(r8) pgu(pcols,pver) ! Pressure gradient term for updraft + real(r8) pgd(pcols,pver) ! Pressure gradient term for downdraft + + real(r8),intent(out) :: pguall(pcols,pver,ncnst) ! Apparent force from updraft PG + real(r8),intent(out) :: pgdall(pcols,pver,ncnst) ! Apparent force from downdraft PG + + real(r8),intent(out) :: icwu(pcols,pver,ncnst) ! In-cloud winds in updraft + real(r8),intent(out) :: icwd(pcols,pver,ncnst) ! In-cloud winds in downdraft + + real(r8),intent(out) :: seten(pcols,pver) ! Dry static energy tendency + real(r8) gseten(pcols,pver) ! Gathered dry static energy tendency + + real(r8) mflux(pcols,pverp,ncnst) ! Gathered momentum flux + + real(r8) wind0(pcols,pver,ncnst) ! gathered wind before time step + real(r8) windf(pcols,pver,ncnst) ! gathered wind after time step + real(r8) fkeb, fket, ketend_cons, ketend, utop, ubot, vtop, vbot, gset2 + + +!----------------------------------------------------------------------- +! + +! Initialize outgoing fields + pguall(:,:,:) = 0.0_r8 + pgdall(:,:,:) = 0.0_r8 +! Initialize in-cloud winds to environmental wind + icwu(:ncol,:,:) = q(:ncol,:,:) + icwd(:ncol,:,:) = q(:ncol,:,:) + +! Initialize momentum flux and final winds + mflux(:,:,:) = 0.0_r8 + wind0(:,:,:) = 0.0_r8 + windf(:,:,:) = 0.0_r8 + +! Initialize dry static energy + + seten(:,:) = 0.0_r8 + gseten(:,:) = 0.0_r8 + +! mbsth is the threshold below which we treat the mass fluxes as zero (in mb/s) + mbsth = 1.e-15_r8 + +! Find the highest level top and bottom levels of convection + ktm = pver + kbm = pver + do i = il1g, il2g + ktm = min(ktm,jt(i)) + kbm = min(kbm,mx(i)) + end do + +! Loop ever each wind component + do m = 1, ncnst !start at m = 1 to transport momentum + if (domomtran(m)) then + +! Gather up the winds and set tend to zero + do k = 1,pver + do i =il1g,il2g + const(i,k) = q(ideep(i),k,m) + wind0(i,k,m) = const(i,k) + end do + end do + + +! From now on work only with gathered data + +! Interpolate winds to interfaces + + do k = 1,pver + km1 = max(1,k-1) + do i = il1g, il2g + + ! use arithmetic mean + chat(i,k) = 0.5_r8* (const(i,k)+const(i,km1)) + +! Provisional up and down draft values + conu(i,k) = chat(i,k) + cond(i,k) = chat(i,k) + +! provisional tends + dcondt(i,k) = 0._r8 + + end do + end do + + +! +! Pressure Perturbation Term +! + + !Top boundary: assume mu is zero + + k=1 + pgu(:il2g,k) = 0.0_r8 + pgd(:il2g,k) = 0.0_r8 + + do k=2,pver-1 + km1 = max(1,k-1) + kp1 = min(pver,k+1) + do i = il1g,il2g + + !interior points + + mududp(i,k) = ( mu(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) & + + mu(i,kp1) * (const(i,kp1) - const(i,k))/dp(i,k)) + + pgu(i,k) = - momcu * 0.5_r8 * mududp(i,k) + + + mddudp(i,k) = ( md(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) & + + md(i,kp1) * (const(i,kp1) - const(i,k))/dp(i,k)) + + pgd(i,k) = - momcd * 0.5_r8 * mddudp(i,k) + + + end do + end do + + ! bottom boundary + k = pver + km1 = max(1,k-1) + do i=il1g,il2g + + mududp(i,k) = mu(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) + pgu(i,k) = - momcu * mududp(i,k) + + mddudp(i,k) = md(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) + + pgd(i,k) = - momcd * mddudp(i,k) + + end do + + +! +! In-cloud velocity calculations +! + +! Do levels adjacent to top and bottom + k = 2 + km1 = 1 + kk = pver + kkm1 = max(1,kk-1) + do i = il1g,il2g + mupdudp = mu(i,kk) + du(i,kk)*dp(i,kk) + if (mupdudp > mbsth) then + + conu(i,kk) = (+eu(i,kk)*const(i,kk)*dp(i,kk)+pgu(i,kk)*dp(i,kk))/mupdudp + endif + if (md(i,k) < -mbsth) then + cond(i,k) = (-ed(i,km1)*const(i,km1)*dp(i,km1))-pgd(i,km1)*dp(i,km1)/md(i,k) + endif + + + end do + + + +! Updraft from bottom to top + do kk = pver-1,1,-1 + kkm1 = max(1,kk-1) + kkp1 = min(pver,kk+1) + do i = il1g,il2g + mupdudp = mu(i,kk) + du(i,kk)*dp(i,kk) + if (mupdudp > mbsth) then + + conu(i,kk) = ( mu(i,kkp1)*conu(i,kkp1)+eu(i,kk)* & + const(i,kk)*dp(i,kk)+pgu(i,kk)*dp(i,kk))/mupdudp + endif + end do + + end do + + +! Downdraft from top to bottom + do k = 3,pver + km1 = max(1,k-1) + do i = il1g,il2g + if (md(i,k) < -mbsth) then + + cond(i,k) = ( md(i,km1)*cond(i,km1)-ed(i,km1)*const(i,km1) & + *dp(i,km1)-pgd(i,km1)*dp(i,km1) )/md(i,k) + + endif + end do + end do + + + sum = 0._r8 + sum2 = 0._r8 + + + do k = ktm,pver + km1 = max(1,k-1) + kp1 = min(pver,k+1) + do i = il1g,il2g + ii = ideep(i) + +! version 1 hard to check for roundoff errors + dcondt(i,k) = & + +(mu(i,kp1)* (conu(i,kp1)-chat(i,kp1)) & + -mu(i,k)* (conu(i,k)-chat(i,k)) & + +md(i,kp1)* (cond(i,kp1)-chat(i,kp1)) & + -md(i,k)* (cond(i,k)-chat(i,k)) & + )/dp(i,k) + + end do + end do + + ! dcont for bottom layer + ! + do k = kbm,pver + km1 = max(1,k-1) + do i = il1g,il2g + if (k == mx(i)) then + + ! version 1 + dcondt(i,k) = (1._r8/dp(i,k))* & + (-mu(i,k)*(conu(i,k)-chat(i,k)) & + -md(i,k)*(cond(i,k)-chat(i,k)) & + ) + end if + end do + end do + +! Initialize to zero everywhere, then scatter tendency back to full array + dqdt(:,:,m) = 0._r8 + + do k = 1,pver + do i = il1g,il2g + ii = ideep(i) + dqdt(ii,k,m) = dcondt(i,k) + ! Output apparent force on the mean flow from pressure gradient + pguall(ii,k,m) = -pgu(i,k) + pgdall(ii,k,m) = -pgd(i,k) + icwu(ii,k,m) = conu(i,k) + icwd(ii,k,m) = cond(i,k) + end do + end do + + ! Calculate momentum flux in units of mb*m/s2 + + do k = ktm,pver + do i = il1g,il2g + ii = ideep(i) + mflux(i,k,m) = & + -mu(i,k)* (conu(i,k)-chat(i,k)) & + -md(i,k)* (cond(i,k)-chat(i,k)) + end do + end do + + + ! Calculate winds at the end of the time step + + do k = ktm,pver + do i = il1g,il2g + ii = ideep(i) + km1 = max(1,k-1) + kp1 = k+1 + windf(i,k,m) = const(i,k) - (mflux(i,kp1,m) - mflux(i,k,m)) * dt /dp(i,k) + + end do + end do + + end if ! for domomtran + end do + + ! Need to add an energy fix to account for the dissipation of kinetic energy + ! Formulation follows from Boville and Bretherton (2003) + ! formulation by PJR + + do k = ktm,pver + km1 = max(1,k-1) + kp1 = min(pver,k+1) + do i = il1g,il2g + + ii = ideep(i) + + ! calculate the KE fluxes at top and bot of layer + ! based on a discrete approximation to b&b eq(35) F_KE = u*F_u + v*F_v at interface + utop = (wind0(i,k,1)+wind0(i,km1,1))/2._r8 + vtop = (wind0(i,k,2)+wind0(i,km1,2))/2._r8 + ubot = (wind0(i,kp1,1)+wind0(i,k,1))/2._r8 + vbot = (wind0(i,kp1,2)+wind0(i,k,2))/2._r8 + fket = utop*mflux(i,k,1) + vtop*mflux(i,k,2) ! top of layer + fkeb = ubot*mflux(i,k+1,1) + vbot*mflux(i,k+1,2) ! bot of layer + + ! divergence of these fluxes should give a conservative redistribution of KE + ketend_cons = (fket-fkeb)/dp(i,k) + + ! tendency in kinetic energy resulting from the momentum transport + ketend = ((windf(i,k,1)**2 + windf(i,k,2)**2) - (wind0(i,k,1)**2 + wind0(i,k,2)**2))*0.5_r8/dt + + ! the difference should be the dissipation + gset2 = ketend_cons - ketend + gseten(i,k) = gset2 + + end do + + end do + + ! Scatter dry static energy to full array + do k = 1,pver + do i = il1g,il2g + ii = ideep(i) + seten(ii,k) = gseten(i,k) + + end do + end do + + return +end subroutine momtran + +!========================================================================================= + +subroutine buoyan(lchnk ,ncol , & + q ,t ,p ,z ,pf , & + tp ,qstp ,tl ,rl ,cape , & + pblt ,lcl ,lel ,lon ,mx , & + rd ,grav ,cp ,msg , & + tpert ) +!----------------------------------------------------------------------- +! +! Purpose: +! +! +! Method: +! +! +! +! Author: +! This is contributed code not fully standardized by the CCM core group. +! The documentation has been enhanced to the degree that we are able. +! Reviewed: P. Rasch, April 1996 +! +!----------------------------------------------------------------------- + implicit none +!----------------------------------------------------------------------- +! +! input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncol ! number of atmospheric columns + + real(r8), intent(in) :: q(pcols,pver) ! spec. humidity + real(r8), intent(in) :: t(pcols,pver) ! temperature + real(r8), intent(in) :: p(pcols,pver) ! pressure + real(r8), intent(in) :: z(pcols,pver) ! height + real(r8), intent(in) :: pf(pcols,pver+1) ! pressure at interfaces + real(r8), intent(in) :: pblt(pcols) ! index of pbl depth + real(r8), intent(in) :: tpert(pcols) ! perturbation temperature by pbl processes + +! +! output arguments +! + real(r8), intent(out) :: tp(pcols,pver) ! parcel temperature + real(r8), intent(out) :: qstp(pcols,pver) ! saturation mixing ratio of parcel + real(r8), intent(out) :: tl(pcols) ! parcel temperature at lcl + real(r8), intent(out) :: cape(pcols) ! convective aval. pot. energy. + integer lcl(pcols) ! + integer lel(pcols) ! + integer lon(pcols) ! level of onset of deep convection + integer mx(pcols) ! level of max moist static energy +! +!--------------------------Local Variables------------------------------ +! + real(r8) capeten(pcols,num_cin) ! provisional value of cape + real(r8) tv(pcols,pver) ! + real(r8) tpv(pcols,pver) ! + real(r8) buoy(pcols,pver) + + real(r8) a1(pcols) + real(r8) a2(pcols) + real(r8) estp(pcols) + real(r8) pl(pcols) + real(r8) plexp(pcols) + real(r8) hmax(pcols) + real(r8) hmn(pcols) + real(r8) y(pcols) + + logical plge600(pcols) + integer knt(pcols) + integer lelten(pcols,num_cin) + + real(r8) cp + real(r8) e + real(r8) grav + + integer i + integer k + integer msg + integer n + + real(r8) rd + real(r8) rl +#ifdef PERGRO + real(r8) rhd +#endif +! +!----------------------------------------------------------------------- +! + do n = 1,num_cin + do i = 1,ncol + lelten(i,n) = pver + capeten(i,n) = 0._r8 + end do + end do +! + do i = 1,ncol + lon(i) = pver + knt(i) = 0 + lel(i) = pver + mx(i) = lon(i) + cape(i) = 0._r8 + hmax(i) = 0._r8 + end do + + tp(:ncol,:) = t(:ncol,:) + qstp(:ncol,:) = q(:ncol,:) + +!!! RBN - Initialize tv and buoy for output. +!!! tv=tv : tpv=tpv : qstp=q : buoy=0. + tv(:ncol,:) = t(:ncol,:) *(1._r8+1.608_r8*q(:ncol,:))/ (1._r8+q(:ncol,:)) + tpv(:ncol,:) = tv(:ncol,:) + buoy(:ncol,:) = 0._r8 + +! +! set "launching" level(mx) to be at maximum moist static energy. +! search for this level stops at planetary boundary layer top. +! +#ifdef PERGRO + do k = pver,msg + 1,-1 + do i = 1,ncol + hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) +! +! Reset max moist static energy level when relative difference exceeds 1.e-4 +! + rhd = (hmn(i) - hmax(i))/(hmn(i) + hmax(i)) + if (k >= nint(pblt(i)) .and. k <= lon(i) .and. rhd > -1.e-4_r8) then + hmax(i) = hmn(i) + mx(i) = k + end if + end do + end do +#else + do k = pver,msg + 1,-1 + do i = 1,ncol + hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) + if (k >= nint(pblt(i)) .and. k <= lon(i) .and. hmn(i) > hmax(i)) then + hmax(i) = hmn(i) + mx(i) = k + end if + end do + end do +#endif +! + do i = 1,ncol + lcl(i) = mx(i) + e = p(i,mx(i))*q(i,mx(i))/ (eps1+q(i,mx(i))) + tl(i) = 2840._r8/ (3.5_r8*log(t(i,mx(i)))-log(e)-4.805_r8) + 55._r8 + if (tl(i) < t(i,mx(i))) then + plexp(i) = (1._r8/ (0.2854_r8* (1._r8-0.28_r8*q(i,mx(i))))) + pl(i) = p(i,mx(i))* (tl(i)/t(i,mx(i)))**plexp(i) + else + tl(i) = t(i,mx(i)) + pl(i) = p(i,mx(i)) + end if + end do + +! +! calculate lifting condensation level (lcl). +! + do k = pver,msg + 2,-1 + do i = 1,ncol + if (k <= mx(i) .and. (p(i,k) > pl(i) .and. p(i,k-1) <= pl(i))) then + lcl(i) = k - 1 + end if + end do + end do +! +! if lcl is above the nominal level of non-divergence (600 mbs), +! no deep convection is permitted (ensuing calculations +! skipped and cape retains initialized value of zero). +! + do i = 1,ncol + plge600(i) = pl(i).ge.600._r8 + end do +! +! initialize parcel properties in sub-cloud layer below lcl. +! + do k = pver,msg + 1,-1 + do i=1,ncol + if (k > lcl(i) .and. k <= mx(i) .and. plge600(i)) then + tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) + qstp(i,k) = q(i,mx(i)) + tp(i,k) = t(i,mx(i))* (p(i,k)/p(i,mx(i)))**(0.2854_r8* (1._r8-0.28_r8*q(i,mx(i)))) +! +! buoyancy is increased by 0.5 k as in tiedtke +! +!-jjh tpv (i,k)=tp(i,k)*(1.+1.608*q(i,mx(i)))/ +!-jjh 1 (1.+q(i,mx(i))) + tpv(i,k) = (tp(i,k)+tpert(i))*(1._r8+1.608_r8*q(i,mx(i)))/ (1._r8+q(i,mx(i))) + buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add + end if + end do + end do + +! +! define parcel properties at lcl (i.e. level immediately above pl). +! + do k = pver,msg + 1,-1 + do i=1,ncol + if (k == lcl(i) .and. plge600(i)) then + tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) + qstp(i,k) = q(i,mx(i)) + tp(i,k) = tl(i)* (p(i,k)/pl(i))**(0.2854_r8* (1._r8-0.28_r8*qstp(i,k))) +! estp(i) =exp(21.656_r8 - 5418._r8/tp(i,k)) +! use of different formulas for es has about 1 g/kg difference +! in qs at t= 300k, and 0.02 g/kg at t=263k, with the formula +! above giving larger qs. + call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) + a1(i) = cp / rl + qstp(i,k) * (1._r8+ qstp(i,k) / eps1) * rl * eps1 / & + (rd * tp(i,k) ** 2) + a2(i) = .5_r8* (qstp(i,k)* (1._r8+2._r8/eps1*qstp(i,k))* & + (1._r8+qstp(i,k)/eps1)*eps1**2*rl*rl/ & + (rd**2*tp(i,k)**4)-qstp(i,k)* & + (1._r8+qstp(i,k)/eps1)*2._r8*eps1*rl/ & + (rd*tp(i,k)**3)) + a1(i) = 1._r8/a1(i) + a2(i) = -a2(i)*a1(i)**3 + y(i) = q(i,mx(i)) - qstp(i,k) + tp(i,k) = tp(i,k) + a1(i)*y(i) + a2(i)*y(i)**2 + call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) +! +! buoyancy is increased by 0.5 k in cape calculation. +! dec. 9, 1994 +!-jjh tpv(i,k) =tp(i,k)*(1.+1.608*qstp(i,k))/(1.+q(i,mx(i))) +! + tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+q(i,mx(i))) + buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add + end if + end do + end do +! +! main buoyancy calculation. +! + do k = pver - 1,msg + 1,-1 + do i=1,ncol + if (k < lcl(i) .and. plge600(i)) then + tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) + qstp(i,k) = qstp(i,k+1) + tp(i,k) = tp(i,k+1)* (p(i,k)/p(i,k+1))**(0.2854_r8* (1._r8-0.28_r8*qstp(i,k))) + call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) + a1(i) = cp/rl + qstp(i,k)* (1._r8+qstp(i,k)/eps1)*rl*eps1/ (rd*tp(i,k)**2) + a2(i) = .5_r8* (qstp(i,k)* (1._r8+2._r8/eps1*qstp(i,k))* & + (1._r8+qstp(i,k)/eps1)*eps1**2*rl*rl/ & + (rd**2*tp(i,k)**4)-qstp(i,k)* & + (1._r8+qstp(i,k)/eps1)*2._r8*eps1*rl/ & + (rd*tp(i,k)**3)) + a1(i) = 1._r8/a1(i) + a2(i) = -a2(i)*a1(i)**3 + y(i) = qstp(i,k+1) - qstp(i,k) + tp(i,k) = tp(i,k) + a1(i)*y(i) + a2(i)*y(i)**2 + call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) +!-jjh tpv(i,k) =tp(i,k)*(1.+1.608*qstp(i,k))/ +!jt (1.+q(i,mx(i))) + tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k))/(1._r8+q(i,mx(i))) + buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add + end if + end do + end do + +! + do k = msg + 2,pver + do i = 1,ncol + if (k < lcl(i) .and. plge600(i)) then + if (buoy(i,k+1) > 0._r8 .and. buoy(i,k) <= 0._r8) then + knt(i) = min(5,knt(i) + 1) + lelten(i,knt(i)) = k + end if + end if + end do + end do +! +! calculate convective available potential energy (cape). +! + do n = 1,5 + do k = msg + 1,pver + do i = 1,ncol + if (plge600(i) .and. k <= mx(i) .and. k > lelten(i,n)) then + capeten(i,n) = capeten(i,n) + rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) + end if + end do + end do + end do +! +! find maximum cape from all possible tentative capes from +! one sounding, +! and use it as the final cape, april 26, 1995 +! + do n = 1,5 + do i = 1,ncol + if (capeten(i,n) > cape(i)) then + cape(i) = capeten(i,n) + lel(i) = lelten(i,n) + end if + end do + end do +! +! put lower bound on cape for diagnostic purposes. +! + do i = 1,ncol + cape(i) = max(cape(i), 0._r8) + end do +! + return +end subroutine buoyan + +subroutine cldprp(lchnk , & + q ,t ,u ,v ,p , & + z ,s ,mu ,eu ,du , & + md ,ed ,sd ,qd ,mc , & + qu ,su ,zf ,qst ,hmn , & + hsat ,shat ,ql , & + cmeg ,jb ,lel ,jt ,jlcl , & + mx ,j0 ,jd ,rl ,il2g , & + rd ,grav ,cp ,msg , & + pflx ,evp ,cu ,rprd ,limcnv ,landfrac, & + qcde ,aero ,loc_conv,qhat ) + +!----------------------------------------------------------------------- +! +! Purpose: +! +! +! Method: +! may 09/91 - guang jun zhang, m.lazare, n.mcfarlane. +! original version cldprop. +! +! Author: See above, modified by P. Rasch +! This is contributed code not fully standardized by the CCM core group. +! +! this code is very much rougher than virtually anything else in the CCM +! there are debug statements left strewn about and code segments disabled +! these are to facilitate future development. We expect to release a +! cleaner code in a future release +! +! the documentation has been enhanced to the degree that we are able +! +!----------------------------------------------------------------------- + + implicit none + +!------------------------------------------------------------------------------ +! +! Input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + + real(r8), intent(in) :: q(pcols,pver) ! spec. humidity of env + real(r8), intent(in) :: t(pcols,pver) ! temp of env + real(r8), intent(in) :: p(pcols,pver) ! pressure of env + real(r8), intent(in) :: z(pcols,pver) ! height of env + real(r8), intent(in) :: s(pcols,pver) ! normalized dry static energy of env + real(r8), intent(in) :: zf(pcols,pverp) ! height of interfaces + real(r8), intent(in) :: u(pcols,pver) ! zonal velocity of env + real(r8), intent(in) :: v(pcols,pver) ! merid. velocity of env + + real(r8), intent(in) :: landfrac(pcols) ! RBN Landfrac + + integer, intent(in) :: jb(pcols) ! updraft base level + integer, intent(in) :: lel(pcols) ! updraft launch level + integer, intent(out) :: jt(pcols) ! updraft plume top + integer, intent(out) :: jlcl(pcols) ! updraft lifting cond level + integer, intent(in) :: mx(pcols) ! updraft base level (same is jb) + integer, intent(out) :: j0(pcols) ! level where updraft begins detraining + integer, intent(out) :: jd(pcols) ! level of downdraft + integer, intent(in) :: limcnv ! convection limiting level + integer, intent(in) :: il2g !CORE GROUP REMOVE + integer, intent(in) :: msg ! missing moisture vals (always 0) + real(r8), intent(in) :: rl ! latent heat of vap + real(r8), intent(in) :: shat(pcols,pver) ! interface values of dry stat energy + real(r8), intent(in) :: qhat(pcols,pver) ! wg grid slice of upper interface mixing ratio. + type(zm_aero_t), intent(in) :: aero ! aerosol object + +! +! output +! + real(r8), intent(out) :: rprd(pcols,pver) ! rate of production of precip at that layer + real(r8), intent(out) :: du(pcols,pver) ! detrainement rate of updraft + real(r8), intent(out) :: ed(pcols,pver) ! entrainment rate of downdraft + real(r8), intent(out) :: eu(pcols,pver) ! entrainment rate of updraft + real(r8), intent(out) :: hmn(pcols,pver) ! moist stat energy of env + real(r8), intent(out) :: hsat(pcols,pver) ! sat moist stat energy of env + real(r8), intent(out) :: mc(pcols,pver) ! net mass flux + real(r8), intent(out) :: md(pcols,pver) ! downdraft mass flux + real(r8), intent(out) :: mu(pcols,pver) ! updraft mass flux + real(r8), intent(out) :: pflx(pcols,pverp) ! precipitation flux thru layer + real(r8), intent(out) :: qd(pcols,pver) ! spec humidity of downdraft + real(r8), intent(out) :: ql(pcols,pver) ! liq water of updraft + real(r8), intent(out) :: qst(pcols,pver) ! saturation mixing ratio of env. + real(r8), intent(out) :: qu(pcols,pver) ! spec hum of updraft + real(r8), intent(out) :: sd(pcols,pver) ! normalized dry stat energy of downdraft + real(r8), intent(out) :: su(pcols,pver) ! normalized dry stat energy of updraft + real(r8), intent(out) :: qcde(pcols,pver) ! cloud water mixing ratio for detrainment (kg/kg) + + type(zm_conv_t) :: loc_conv + + real(r8) rd ! gas constant for dry air + real(r8) grav ! gravity + real(r8) cp ! heat capacity of dry air + +! +! Local workspace +! + real(r8) gamma(pcols,pver) + real(r8) dz(pcols,pver) + real(r8) iprm(pcols,pver) + real(r8) hu(pcols,pver) + real(r8) hd(pcols,pver) + real(r8) eps(pcols,pver) + real(r8) f(pcols,pver) + real(r8) k1(pcols,pver) + real(r8) i2(pcols,pver) + real(r8) ihat(pcols,pver) + real(r8) i3(pcols,pver) + real(r8) idag(pcols,pver) + real(r8) i4(pcols,pver) + real(r8) qsthat(pcols,pver) + real(r8) hsthat(pcols,pver) + real(r8) gamhat(pcols,pver) + real(r8) cu(pcols,pver) + real(r8) evp(pcols,pver) + real(r8) cmeg(pcols,pver) + real(r8) qds(pcols,pver) +! RBN For c0mask + real(r8) c0mask(pcols) + + real(r8) hmin(pcols) + real(r8) expdif(pcols) + real(r8) expnum(pcols) + real(r8) ftemp(pcols) + real(r8) eps0(pcols) + real(r8) rmue(pcols) + real(r8) zuef(pcols) + real(r8) zdef(pcols) + real(r8) epsm(pcols) + real(r8) ratmjb(pcols) + real(r8) est(pcols) + real(r8) totpcp(pcols) + real(r8) totevp(pcols) + real(r8) alfa(pcols) + real(r8) ql1 + real(r8) tu + real(r8) estu + real(r8) qstu + + real(r8) small + real(r8) mdt + + real(r8) fice(pcols,pver) ! ice fraction in precip production + real(r8) tug(pcols,pver) + + real(r8) tvuo(pcols,pver) ! updraft virtual T w/o freezing heating + real(r8) tvu(pcols,pver) ! updraft virtual T with freezing heating + real(r8) totfrz(pcols) + real(r8) frz (pcols,pver) ! rate of freezing + integer jto(pcols) ! updraft plume old top + integer tmplel(pcols) + + integer iter, itnum + integer m + + integer khighest + integer klowest + integer kount + integer i,k + + logical doit(pcols) + logical done(pcols) +! +!------------------------------------------------------------------------------ +! + if (zmconv_microp) then + loc_conv%autolm(:il2g,:) = 0._r8 + loc_conv%accrlm(:il2g,:) = 0._r8 + loc_conv%bergnm(:il2g,:) = 0._r8 + loc_conv%fhtimm(:il2g,:) = 0._r8 + loc_conv%fhtctm(:il2g,:) = 0._r8 + loc_conv%fhmlm (:il2g,:) = 0._r8 + loc_conv%hmpim (:il2g,:) = 0._r8 + loc_conv%accslm(:il2g,:) = 0._r8 + loc_conv%dlfm (:il2g,:) = 0._r8 + + loc_conv%autoln(:il2g,:) = 0._r8 + loc_conv%accrln(:il2g,:) = 0._r8 + loc_conv%bergnn(:il2g,:) = 0._r8 + loc_conv%fhtimn(:il2g,:) = 0._r8 + loc_conv%fhtctn(:il2g,:) = 0._r8 + loc_conv%fhmln (:il2g,:) = 0._r8 + loc_conv%accsln(:il2g,:) = 0._r8 + loc_conv%activn(:il2g,:) = 0._r8 + loc_conv%dlfn (:il2g,:) = 0._r8 + + loc_conv%autoim(:il2g,:) = 0._r8 + loc_conv%accsim(:il2g,:) = 0._r8 + loc_conv%difm (:il2g,:) = 0._r8 + + loc_conv%nuclin(:il2g,:) = 0._r8 + loc_conv%autoin(:il2g,:) = 0._r8 + loc_conv%accsin(:il2g,:) = 0._r8 + loc_conv%hmpin (:il2g,:) = 0._r8 + loc_conv%difn (:il2g,:) = 0._r8 + + loc_conv%trspcm(:il2g,:) = 0._r8 + loc_conv%trspcn(:il2g,:) = 0._r8 + loc_conv%trspim(:il2g,:) = 0._r8 + loc_conv%trspin(:il2g,:) = 0._r8 + + loc_conv%dcape (:il2g) = 0._r8 + + end if + + do i = 1,il2g + ftemp(i) = 0._r8 + expnum(i) = 0._r8 + expdif(i) = 0._r8 + c0mask(i) = c0_ocn * (1._r8-landfrac(i)) + c0_lnd * landfrac(i) + end do +! +!jr Change from msg+1 to 1 to prevent blowup +! + do k = 1,pver + do i = 1,il2g + dz(i,k) = zf(i,k) - zf(i,k+1) + end do + end do + +! +! initialize many output and work variables to zero +! + pflx(:il2g,1) = 0 + + do k = 1,pver + do i = 1,il2g + k1(i,k) = 0._r8 + i2(i,k) = 0._r8 + i3(i,k) = 0._r8 + i4(i,k) = 0._r8 + mu(i,k) = 0._r8 + f(i,k) = 0._r8 + eps(i,k) = 0._r8 + eu(i,k) = 0._r8 + du(i,k) = 0._r8 + ql(i,k) = 0._r8 + cu(i,k) = 0._r8 + evp(i,k) = 0._r8 + cmeg(i,k) = 0._r8 + qds(i,k) = q(i,k) + md(i,k) = 0._r8 + ed(i,k) = 0._r8 + sd(i,k) = s(i,k) + qd(i,k) = q(i,k) + mc(i,k) = 0._r8 + qu(i,k) = q(i,k) + su(i,k) = s(i,k) + call qsat_hPa(t(i,k), p(i,k), est(i), qst(i,k)) + + if ( p(i,k)-est(i) <= 0._r8 ) then + qst(i,k) = 1.0_r8 + end if + + gamma(i,k) = qst(i,k)*(1._r8 + qst(i,k)/eps1)*eps1*rl/(rd*t(i,k)**2)*rl/cp + hmn(i,k) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) + hsat(i,k) = cp*t(i,k) + grav*z(i,k) + rl*qst(i,k) + hu(i,k) = hmn(i,k) + hd(i,k) = hmn(i,k) + rprd(i,k) = 0._r8 + + fice(i,k) = 0._r8 + tug(i,k) = 0._r8 + qcde(i,k) = 0._r8 + tvuo(i,k) = (shat(i,k) - grav/cp*zf(i,k))*(1._r8 + 0.608_r8*qhat(i,k)) + tvu(i,k) = tvuo(i,k) + frz(i,k) = 0._r8 + + end do + end do + if (zmconv_microp) then + do k = 1,pver + do i = 1,il2g + loc_conv%sprd(i,k) = 0._r8 + loc_conv%wu(i,k) = 0._r8 + loc_conv%cmel(i,k) = 0._r8 + loc_conv%cmei(i,k) = 0._r8 + loc_conv%qliq(i,k) = 0._r8 + loc_conv%qice(i,k) = 0._r8 + loc_conv%qnl(i,k) = 0._r8 + loc_conv%qni(i,k) = 0._r8 + loc_conv%qide(i,k) = 0._r8 + loc_conv%qncde(i,k) = 0._r8 + loc_conv%qnide(i,k) = 0._r8 + loc_conv%qnr(i,k) = 0._r8 + loc_conv%qns(i,k) = 0._r8 + loc_conv%qrain(i,k)= 0._r8 + loc_conv%qsnow(i,k)= 0._r8 + loc_conv%frz(i,k) = 0._r8 + end do + end do + end if +! +!jr Set to zero things which make this routine blow up +! + do k=1,msg + do i=1,il2g + rprd(i,k) = 0._r8 + end do + end do +! +! interpolate the layer values of qst, hsat and gamma to +! layer interfaces +! + do k = 1, msg+1 + do i = 1,il2g + hsthat(i,k) = hsat(i,k) + qsthat(i,k) = qst(i,k) + gamhat(i,k) = gamma(i,k) + end do + end do + do i = 1,il2g + totpcp(i) = 0._r8 + totevp(i) = 0._r8 + end do + do k = msg + 2,pver + do i = 1,il2g + if (abs(qst(i,k-1)-qst(i,k)) > 1.E-6_r8) then + qsthat(i,k) = log(qst(i,k-1)/qst(i,k))*qst(i,k-1)*qst(i,k)/ (qst(i,k-1)-qst(i,k)) + else + qsthat(i,k) = qst(i,k) + end if + hsthat(i,k) = cp*shat(i,k) + rl*qsthat(i,k) + if (abs(gamma(i,k-1)-gamma(i,k)) > 1.E-6_r8) then + gamhat(i,k) = log(gamma(i,k-1)/gamma(i,k))*gamma(i,k-1)*gamma(i,k)/ & + (gamma(i,k-1)-gamma(i,k)) + else + gamhat(i,k) = gamma(i,k) + end if + end do + end do +! +! initialize cloud top to highest plume top. +!jr changed hard-wired 4 to limcnv+1 (not to exceed pver) +! + jt(:) = pver + do i = 1,il2g + jt(i) = max(lel(i),limcnv+1) + jt(i) = min(jt(i),pver) + jd(i) = pver + jlcl(i) = lel(i) + hmin(i) = 1.E6_r8 + end do +! +! find the level of minimum hsat, where detrainment starts +! + + do k = msg + 1,pver + do i = 1,il2g + if (hsat(i,k) <= hmin(i) .and. k >= jt(i) .and. k <= jb(i)) then + hmin(i) = hsat(i,k) + j0(i) = k + end if + end do + end do + do i = 1,il2g + j0(i) = min(j0(i),jb(i)-2) + j0(i) = max(j0(i),jt(i)+2) +! +! Fix from Guang Zhang to address out of bounds array reference +! + j0(i) = min(j0(i),pver) + end do +! +! Initialize certain arrays inside cloud +! + do k = msg + 1,pver + do i = 1,il2g + if (k >= jt(i) .and. k <= jb(i)) then + hu(i,k) = hmn(i,mx(i)) + cp*tiedke_add + su(i,k) = s(i,mx(i)) + tiedke_add + end if + end do + end do +! +! ********************************************************* +! compute taylor series for approximate eps(z) below +! ********************************************************* +! + do k = pver - 1,msg + 1,-1 + do i = 1,il2g + if (k < jb(i) .and. k >= jt(i)) then + k1(i,k) = k1(i,k+1) + (hmn(i,mx(i))-hmn(i,k))*dz(i,k) + ihat(i,k) = 0.5_r8* (k1(i,k+1)+k1(i,k)) + i2(i,k) = i2(i,k+1) + ihat(i,k)*dz(i,k) + idag(i,k) = 0.5_r8* (i2(i,k+1)+i2(i,k)) + i3(i,k) = i3(i,k+1) + idag(i,k)*dz(i,k) + iprm(i,k) = 0.5_r8* (i3(i,k+1)+i3(i,k)) + i4(i,k) = i4(i,k+1) + iprm(i,k)*dz(i,k) + end if + end do + end do +! +! re-initialize hmin array for ensuing calculation. +! + do i = 1,il2g + hmin(i) = 1.E6_r8 + end do + do k = msg + 1,pver + do i = 1,il2g + if (k >= j0(i) .and. k <= jb(i) .and. hmn(i,k) <= hmin(i)) then + hmin(i) = hmn(i,k) + expdif(i) = hmn(i,mx(i)) - hmin(i) + end if + end do + end do +! +! ********************************************************* +! compute approximate eps(z) using above taylor series +! ********************************************************* +! + do k = msg + 2,pver + do i = 1,il2g + expnum(i) = 0._r8 + ftemp(i) = 0._r8 + if (k < jt(i) .or. k >= jb(i)) then + k1(i,k) = 0._r8 + expnum(i) = 0._r8 + else + expnum(i) = hmn(i,mx(i)) - (hsat(i,k-1)*(zf(i,k)-z(i,k)) + & + hsat(i,k)* (z(i,k-1)-zf(i,k)))/(z(i,k-1)-z(i,k)) + end if + if ((expdif(i) > 100._r8 .and. expnum(i) > 0._r8) .and. & + k1(i,k) > expnum(i)*dz(i,k)) then + ftemp(i) = expnum(i)/k1(i,k) + f(i,k) = ftemp(i) + i2(i,k)/k1(i,k)*ftemp(i)**2 + & + (2._r8*i2(i,k)**2-k1(i,k)*i3(i,k))/k1(i,k)**2* & + ftemp(i)**3 + (-5._r8*k1(i,k)*i2(i,k)*i3(i,k)+ & + 5._r8*i2(i,k)**3+k1(i,k)**2*i4(i,k))/ & + k1(i,k)**3*ftemp(i)**4 + f(i,k) = max(f(i,k),0._r8) + f(i,k) = min(f(i,k),0.0002_r8) + end if + end do + end do + do i = 1,il2g + if (j0(i) < jb(i)) then + if (f(i,j0(i)) < 1.E-6_r8 .and. f(i,j0(i)+1) > f(i,j0(i))) j0(i) = j0(i) + 1 + end if + end do + do k = msg + 2,pver + do i = 1,il2g + if (k >= jt(i) .and. k <= j0(i)) then + f(i,k) = max(f(i,k),f(i,k-1)) + end if + end do + end do + do i = 1,il2g + eps0(i) = f(i,j0(i)) + eps(i,jb(i)) = eps0(i) + end do +! +! This is set to match the Rasch and Kristjansson paper +! + do k = pver,msg + 1,-1 + do i = 1,il2g + if (k >= j0(i) .and. k <= jb(i)) then + eps(i,k) = f(i,j0(i)) + end if + end do + end do + do k = pver,msg + 1,-1 + do i = 1,il2g + if (k < j0(i) .and. k >= jt(i)) eps(i,k) = f(i,k) + end do + end do + + if (zmconv_microp) then + itnum = 2 + else + itnum = 1 + end if + + do iter=1, itnum + + if (zmconv_microp) then + do k = pver,msg + 1,-1 + do i = 1,il2g + cu(i,k) = 0._r8 + loc_conv%qliq(i,k) = 0._r8 + loc_conv%qice(i,k) = 0._r8 + ql(i,k) = 0._r8 + loc_conv%frz(i,k) = 0._r8 + end do + end do + do i = 1,il2g + totpcp(i) = 0._r8 + hu(i,jb(i)) = hmn(i,jb(i)) + cp*tiedke_add + end do + + end if + +! +! specify the updraft mass flux mu, entrainment eu, detrainment du +! and moist static energy hu. +! here and below mu, eu,du, md and ed are all normalized by mb +! + do i = 1,il2g + if (eps0(i) > 0._r8) then + mu(i,jb(i)) = 1._r8 + eu(i,jb(i)) = mu(i,jb(i))/dz(i,jb(i)) + end if + if (zmconv_microp) then + tmplel(i) = lel(i) + else + tmplel(i) = jt(i) + end if + end do + do k = pver,msg + 1,-1 + do i = 1,il2g + if (eps0(i) > 0._r8 .and. (k >= tmplel(i) .and. k < jb(i))) then + zuef(i) = zf(i,k) - zf(i,jb(i)) + rmue(i) = (1._r8/eps0(i))* (exp(eps(i,k+1)*zuef(i))-1._r8)/zuef(i) + mu(i,k) = (1._r8/eps0(i))* (exp(eps(i,k )*zuef(i))-1._r8)/zuef(i) + eu(i,k) = (rmue(i)-mu(i,k+1))/dz(i,k) + du(i,k) = (rmue(i)-mu(i,k))/dz(i,k) + end if + end do + end do + + khighest = pverp + klowest = 1 + do i=1,il2g + khighest = min(khighest,lel(i)) + klowest = max(klowest,jb(i)) + end do + do k = klowest-1,khighest,-1 + do i = 1,il2g + if (k <= jb(i)-1 .and. k >= lel(i) .and. eps0(i) > 0._r8) then + if (mu(i,k) < 0.02_r8) then + hu(i,k) = hmn(i,k) + mu(i,k) = 0._r8 + eu(i,k) = 0._r8 + du(i,k) = mu(i,k+1)/dz(i,k) + else + if (zmconv_microp) then + hu(i,k) = (mu(i,k+1)*hu(i,k+1) + dz(i,k)*(eu(i,k)*hmn(i,k) + & + latice*frz(i,k)))/(mu(i,k)+ dz(i,k)*du(i,k)) + else + hu(i,k) = mu(i,k+1)/mu(i,k)*hu(i,k+1) + & + dz(i,k)/mu(i,k)* (eu(i,k)*hmn(i,k)- du(i,k)*hsat(i,k)) + end if + end if + end if + end do + end do +! +! reset cloud top index beginning from two layers above the +! cloud base (i.e. if cloud is only one layer thick, top is not reset +! + do i=1,il2g + doit(i) = .true. + totfrz(i)= 0._r8 + do k = pver,msg + 1,-1 + totfrz(i)= totfrz(i)+ frz(i,k)*dz(i,k) + end do + end do + do k=klowest-2,khighest-1,-1 + do i=1,il2g + if (doit(i) .and. k <= jb(i)-2 .and. k >= lel(i)-1) then + if (hu(i,k) <= hsthat(i,k) .and. hu(i,k+1) > hsthat(i,k+1) & + .and. mu(i,k) >= 0.02_r8) then + if (hu(i,k)-hsthat(i,k) < -2000._r8) then + jt(i) = k + 1 + doit(i) = .false. + else + jt(i) = k + doit(i) = .false. + end if + else if ( (hu(i,k) > hu(i,jb(i)) .and. totfrz(i)<=0._r8) .or. mu(i,k) < 0.02_r8) then + jt(i) = k + 1 + doit(i) = .false. + end if + end if + end do + end do + + if (iter == 1) jto(:) = jt(:) + + do k = pver,msg + 1,-1 + do i = 1,il2g + if (k >= lel(i) .and. k <= jt(i) .and. eps0(i) > 0._r8) then + mu(i,k) = 0._r8 + eu(i,k) = 0._r8 + du(i,k) = 0._r8 + hu(i,k) = hmn(i,k) + end if + if (k == jt(i) .and. eps0(i) > 0._r8) then + du(i,k) = mu(i,k+1)/dz(i,k) + eu(i,k) = 0._r8 + mu(i,k) = 0._r8 + end if + end do + end do + + do i = 1,il2g + done(i) = .false. + end do + kount = 0 + do k = pver,msg + 2,-1 + do i = 1,il2g + if (k == jb(i) .and. eps0(i) > 0._r8) then + qu(i,k) = q(i,mx(i)) + su(i,k) = (hu(i,k)-rl*qu(i,k))/cp + end if + if (( .not. done(i) .and. k > jt(i) .and. k < jb(i)) .and. eps0(i) > 0._r8) then + su(i,k) = mu(i,k+1)/mu(i,k)*su(i,k+1) + & + dz(i,k)/mu(i,k)* (eu(i,k)-du(i,k))*s(i,k) + qu(i,k) = mu(i,k+1)/mu(i,k)*qu(i,k+1) + dz(i,k)/mu(i,k)* (eu(i,k)*q(i,k)- & + du(i,k)*qst(i,k)) + tu = su(i,k) - grav/cp*zf(i,k) + call qsat_hPa(tu, (p(i,k)+p(i,k-1))/2._r8, estu, qstu) + if (qu(i,k) >= qstu) then + jlcl(i) = k + kount = kount + 1 + done(i) = .true. + end if + end if + end do + if (kount >= il2g) goto 690 + end do +690 continue + do k = msg + 2,pver + do i = 1,il2g + if ((k > jt(i) .and. k <= jlcl(i)) .and. eps0(i) > 0._r8) then + su(i,k) = shat(i,k) + (hu(i,k)-hsthat(i,k))/(cp* (1._r8+gamhat(i,k))) + qu(i,k) = qsthat(i,k) + gamhat(i,k)*(hu(i,k)-hsthat(i,k))/ & + (rl* (1._r8+gamhat(i,k))) + end if + end do + end do + +! compute condensation in updraft + if (zmconv_microp) then + tmplel(:il2g) = jlcl(:il2g)+1 + else + tmplel(:il2g) = jb(:il2g) + end if + + do k = pver,msg + 2,-1 + do i = 1,il2g + if (k >= jt(i) .and. k < tmplel(i) .and. eps0(i) > 0._r8) then + if (zmconv_microp) then + cu(i,k) = ((mu(i,k)*su(i,k)-mu(i,k+1)*su(i,k+1))/ & + dz(i,k)- eu(i,k)*s(i,k)+du(i,k)*su(i,k))/(rl/cp) & + - latice*frz(i,k)/rl + else + + cu(i,k) = ((mu(i,k)*su(i,k)-mu(i,k+1)*su(i,k+1))/ & + dz(i,k)- (eu(i,k)-du(i,k))*s(i,k))/(rl/cp) + end if + if (k == jt(i)) cu(i,k) = 0._r8 + cu(i,k) = max(0._r8,cu(i,k)) + end if + end do + end do + + + if (zmconv_microp) then + + tug(:il2g,:) = t(:il2g,:) + fice(:,:) = 0._r8 + + do k = pver, msg+2, -1 + do i = 1, il2g + tug(i,k) = su(i,k) - grav/cp*zf(i,k) + end do + end do + + do k = 1, pver-1 + do i = 1, il2g + + if (tug(i,k+1) > 273.15_r8) then + ! If warmer than tmax then water phase + fice(i,k) = 0._r8 + + else if (tug(i,k+1) < 233.15_r8) then + ! If colder than tmin then ice phase + fice(i,k) = 1._r8 + + else + ! Otherwise mixed phase, with ice fraction decreasing linearly + ! from tmin to tmax + fice(i,k) =(273.15_r8 - tug(i,k+1)) / 40._r8 + end if + end do + end do + + do k = 1, pver + do i = 1,il2g + loc_conv%cmei(i,k) = cu(i,k)* fice(i,k) + loc_conv%cmel(i,k) = cu(i,k) * (1._r8-fice(i,k)) + end do + end do + + call zm_mphy(su, qu, mu, du, eu, loc_conv%cmel, loc_conv%cmei, zf, p, t, q, & + eps0, jb, jt, jlcl, msg, il2g, grav, cp, rd, aero, gamhat, & + loc_conv%qliq, loc_conv%qice, loc_conv%qnl, loc_conv%qni, qcde, loc_conv%qide, & + loc_conv%qncde, loc_conv%qnide, rprd, loc_conv%sprd, frz, & + loc_conv%wu, loc_conv%qrain, loc_conv%qsnow, loc_conv%qnr, loc_conv%qns, & + loc_conv%autolm, loc_conv%accrlm, loc_conv%bergnm, loc_conv%fhtimm, loc_conv%fhtctm, & + loc_conv%fhmlm, loc_conv%hmpim, loc_conv%accslm, loc_conv%dlfm, loc_conv%autoln, & + loc_conv%accrln, loc_conv%bergnn, loc_conv%fhtimn, loc_conv%fhtctn, & + loc_conv%fhmln, loc_conv%accsln, loc_conv%activn, loc_conv%dlfn, loc_conv%autoim, & + loc_conv%accsim, loc_conv%difm, loc_conv%nuclin, loc_conv%autoin, & + loc_conv%accsin, loc_conv%hmpin, loc_conv%difn, loc_conv%trspcm, loc_conv%trspcn, & + loc_conv%trspim, loc_conv%trspin, loc_conv%lambdadpcu, loc_conv%mudpcu ) + + + do k = pver,msg + 2,-1 + do i = 1,il2g + ql(i,k) = loc_conv%qliq(i,k)+ loc_conv%qice(i,k) + loc_conv%frz(i,k) = frz(i,k) + end do + end do + + do i = 1,il2g + if (iter == 2 .and. jt(i)> jto(i)) then + do k = jt(i), jto(i), -1 + loc_conv%frz(i,k) = 0.0_r8 + cu(i,k)=0.0_r8 + end do + end if + end do + + + do k = pver,msg + 2,-1 + do i = 1,il2g + if (k >= jt(i) .and. k < jb(i) .and. eps0(i) > 0._r8 .and. mu(i,k) >= 0.0_r8) then + totpcp(i) = totpcp(i) + dz(i,k)*(cu(i,k)-du(i,k)*(qcde(i,k+1)+loc_conv%qide(i,k+1) )) + end if + end do + end do + + do k = msg + 2,pver + do i = 1,il2g + if ((k > jt(i) .and. k <= jlcl(i)) .and. eps0(i) > 0._r8) then + if (iter == 1) tvuo(i,k)= (su(i,k) - grav/cp*zf(i,k))*(1._r8+0.608_r8*qu(i,k)) + if (iter == 2 .and. k > max(jt(i),jto(i)) ) then + tvu(i,k) = (su(i,k) - grav/cp*zf(i,k))*(1._r8 +0.608_r8*qu(i,k)) + loc_conv%dcape(i) = loc_conv%dcape(i)+ rd*(tvu(i,k)-tvuo(i,k))*log(p(i,k)/p(i,k-1)) + end if + end if + end do + end do + + else ! no convective microphysics + +! compute condensed liquid, rain production rate +! accumulate total precipitation (condensation - detrainment of liquid) +! Note ql1 = ql(k) + rprd(k)*dz(k)/mu(k) +! The differencing is somewhat strange (e.g. du(i,k)*ql(i,k+1)) but is +! consistently applied. +! mu, ql are interface quantities +! cu, du, eu, rprd are midpoint quantites + + do k = pver,msg + 2,-1 + do i = 1,il2g + rprd(i,k) = 0._r8 + if (k >= jt(i) .and. k < jb(i) .and. eps0(i) > 0._r8 .and. mu(i,k) >= 0.0_r8) then + if (mu(i,k) > 0._r8) then + ql1 = 1._r8/mu(i,k)* (mu(i,k+1)*ql(i,k+1)- & + dz(i,k)*du(i,k)*ql(i,k+1)+dz(i,k)*cu(i,k)) + ql(i,k) = ql1/ (1._r8+dz(i,k)*c0mask(i)) + else + ql(i,k) = 0._r8 + end if + totpcp(i) = totpcp(i) + dz(i,k)*(cu(i,k)-du(i,k)*ql(i,k+1)) + rprd(i,k) = c0mask(i)*mu(i,k)*ql(i,k) + qcde(i,k) = ql(i,k) + + if (zmconv_microp) then + loc_conv%qide(i,k) = 0._r8 + loc_conv%qncde(i,k) = 0._r8 + loc_conv%qnide(i,k) = 0._r8 + loc_conv%sprd(i,k) = 0._r8 + end if + + end if + end do + end do +! + end if ! zmconv_microp + + end do !iter +! +! specify downdraft properties (no downdrafts if jd.ge.jb). +! scale down downward mass flux profile so that net flux +! (up-down) at cloud base in not negative. +! + do i = 1,il2g +! +! in normal downdraft strength run alfa=0.2. In test4 alfa=0.1 +! + alfa(i) = 0.1_r8 + jt(i) = min(jt(i),jb(i)-1) + jd(i) = max(j0(i),jt(i)+1) + jd(i) = min(jd(i),jb(i)) + hd(i,jd(i)) = hmn(i,jd(i)-1) + if (jd(i) < jb(i) .and. eps0(i) > 0._r8) then + epsm(i) = eps0(i) + md(i,jd(i)) = -alfa(i)*epsm(i)/eps0(i) + end if + end do + do k = msg + 1,pver + do i = 1,il2g + if ((k > jd(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8) then + zdef(i) = zf(i,jd(i)) - zf(i,k) + md(i,k) = -alfa(i)/ (2._r8*eps0(i))*(exp(2._r8*epsm(i)*zdef(i))-1._r8)/zdef(i) + end if + end do + end do + + do k = msg + 1,pver + do i = 1,il2g + if ((k >= jt(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8 .and. jd(i) < jb(i)) then + ratmjb(i) = min(abs(mu(i,jb(i))/md(i,jb(i))),1._r8) + md(i,k) = md(i,k)*ratmjb(i) + end if + end do + end do + + small = 1.e-20_r8 + do k = msg + 1,pver + do i = 1,il2g + if ((k >= jt(i) .and. k <= pver) .and. eps0(i) > 0._r8) then + ed(i,k-1) = (md(i,k-1)-md(i,k))/dz(i,k-1) + mdt = min(md(i,k),-small) + hd(i,k) = (md(i,k-1)*hd(i,k-1) - dz(i,k-1)*ed(i,k-1)*hmn(i,k-1))/mdt + end if + end do + end do +! +! calculate updraft and downdraft properties. +! + do k = msg + 2,pver + do i = 1,il2g + if ((k >= jd(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8 .and. jd(i) < jb(i)) then + qds(i,k) = qsthat(i,k) + gamhat(i,k)*(hd(i,k)-hsthat(i,k))/ & + (rl*(1._r8 + gamhat(i,k))) + end if + end do + end do + + do i = 1,il2g + qd(i,jd(i)) = qds(i,jd(i)) + sd(i,jd(i)) = (hd(i,jd(i)) - rl*qd(i,jd(i)))/cp + end do +! + do k = msg + 2,pver + do i = 1,il2g + if (k >= jd(i) .and. k < jb(i) .and. eps0(i) > 0._r8) then + qd(i,k+1) = qds(i,k+1) + evp(i,k) = -ed(i,k)*q(i,k) + (md(i,k)*qd(i,k)-md(i,k+1)*qd(i,k+1))/dz(i,k) + evp(i,k) = max(evp(i,k),0._r8) + mdt = min(md(i,k+1),-small) + if (zmconv_microp) then + evp(i,k) = min(evp(i,k),rprd(i,k)) + end if + sd(i,k+1) = ((rl/cp*evp(i,k)-ed(i,k)*s(i,k))*dz(i,k) + md(i,k)*sd(i,k))/mdt + totevp(i) = totevp(i) - dz(i,k)*ed(i,k)*q(i,k) + end if + end do + end do + do i = 1,il2g +!*guang totevp(i) = totevp(i) + md(i,jd(i))*q(i,jd(i)-1) - + totevp(i) = totevp(i) + md(i,jd(i))*qd(i,jd(i)) - md(i,jb(i))*qd(i,jb(i)) + end do +!!$ if (.true.) then + if (.false.) then + do i = 1,il2g + k = jb(i) + if (eps0(i) > 0._r8) then + evp(i,k) = -ed(i,k)*q(i,k) + (md(i,k)*qd(i,k))/dz(i,k) + evp(i,k) = max(evp(i,k),0._r8) + totevp(i) = totevp(i) - dz(i,k)*ed(i,k)*q(i,k) + end if + end do + endif + + do i = 1,il2g + totpcp(i) = max(totpcp(i),0._r8) + totevp(i) = max(totevp(i),0._r8) + end do +! + do k = msg + 2,pver + do i = 1,il2g + if (totevp(i) > 0._r8 .and. totpcp(i) > 0._r8) then + md(i,k) = md (i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) + ed(i,k) = ed (i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) + evp(i,k) = evp(i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) + else + md(i,k) = 0._r8 + ed(i,k) = 0._r8 + evp(i,k) = 0._r8 + end if +! cmeg is the cloud water condensed - rain water evaporated +! rprd is the cloud water converted to rain - (rain evaporated) + cmeg(i,k) = cu(i,k) - evp(i,k) + rprd(i,k) = rprd(i,k)-evp(i,k) + end do + end do + +! compute the net precipitation flux across interfaces + pflx(:il2g,1) = 0._r8 + do k = 2,pverp + do i = 1,il2g + pflx(i,k) = pflx(i,k-1) + rprd(i,k-1)*dz(i,k-1) + end do + end do +! + do k = msg + 1,pver + do i = 1,il2g + mc(i,k) = mu(i,k) + md(i,k) + end do + end do +! + return +end subroutine cldprp + +subroutine closure(lchnk , & + q ,t ,p ,z ,s , & + tp ,qs ,qu ,su ,mc , & + du ,mu ,md ,qd ,sd , & + qhat ,shat ,dp ,qstp ,zf , & + ql ,dsubcld ,mb ,cape ,tl , & + lcl ,lel ,jt ,mx ,il1g , & + il2g ,rd ,grav ,cp ,rl , & + msg ,capelmt ,wm_ic ) +!----------------------------------------------------------------------- +! +! Purpose: +! +! +! Method: +! +! +! +! Author: G. Zhang and collaborators. CCM contact:P. Rasch +! This is contributed code not fully standardized by the CCM core group. +! +! this code is very much rougher than virtually anything else in the CCM +! We expect to release cleaner code in a future release +! +! the documentation has been enhanced to the degree that we are able +! +!----------------------------------------------------------------------- + +! +!-----------------------------Arguments--------------------------------- +! + integer, intent(in) :: lchnk ! chunk identifier + + real(r8), intent(inout) :: q(pcols,pver) ! spec humidity + real(r8), intent(inout) :: t(pcols,pver) ! temperature + real(r8), intent(inout) :: p(pcols,pver) ! pressure (mb) + real(r8), intent(inout) :: mb(pcols) ! cloud base mass flux + real(r8), intent(in) :: z(pcols,pver) ! height (m) + real(r8), intent(in) :: s(pcols,pver) ! normalized dry static energy + real(r8), intent(in) :: tp(pcols,pver) ! parcel temp + real(r8), intent(in) :: qs(pcols,pver) ! sat spec humidity + real(r8), intent(in) :: qu(pcols,pver) ! updraft spec. humidity + real(r8), intent(in) :: su(pcols,pver) ! normalized dry stat energy of updraft + real(r8), intent(in) :: mc(pcols,pver) ! net convective mass flux + real(r8), intent(in) :: du(pcols,pver) ! detrainment from updraft + real(r8), intent(in) :: mu(pcols,pver) ! mass flux of updraft + real(r8), intent(in) :: md(pcols,pver) ! mass flux of downdraft + real(r8), intent(in) :: qd(pcols,pver) ! spec. humidity of downdraft + real(r8), intent(in) :: sd(pcols,pver) ! dry static energy of downdraft + real(r8), intent(in) :: qhat(pcols,pver) ! environment spec humidity at interfaces + real(r8), intent(in) :: shat(pcols,pver) ! env. normalized dry static energy at intrfcs + real(r8), intent(in) :: dp(pcols,pver) ! pressure thickness of layers + real(r8), intent(in) :: qstp(pcols,pver) ! spec humidity of parcel + real(r8), intent(in) :: zf(pcols,pver+1) ! height of interface levels + real(r8), intent(in) :: ql(pcols,pver) ! liquid water mixing ratio + + real(r8), intent(in) :: cape(pcols) ! available pot. energy of column + real(r8), intent(in) :: tl(pcols) + real(r8), intent(in) :: dsubcld(pcols) ! thickness of subcloud layer + + integer, intent(in) :: lcl(pcols) ! index of lcl + integer, intent(in) :: lel(pcols) ! index of launch leve + integer, intent(in) :: jt(pcols) ! top of updraft + integer, intent(in) :: mx(pcols) ! base of updraft + +! RBN mean in-cloud vertical velocity for use in generating grid-box specific timescale. + real(r8), intent(in) :: wm_ic(pcols) ! in-cloud vertical velocity + +! + +! +!--------------------------Local variables------------------------------ +! + real(r8) dtpdt(pcols,pver) + real(r8) dqsdtp(pcols,pver) + real(r8) dtmdt(pcols,pver) + real(r8) dqmdt(pcols,pver) + real(r8) dboydt(pcols,pver) + real(r8) thetavp(pcols,pver) + real(r8) thetavm(pcols,pver) + + ! RBN Tau base on convective height and in-cloud vertical velocity. + + real(r8) tau_wz(pcols) + + real(r8) dtbdt(pcols),dqbdt(pcols),dtldt(pcols) + real(r8) beta + real(r8) capelmt + real(r8) cp + real(r8) dadt(pcols) + real(r8) debdt + real(r8) dltaa + real(r8) eb + real(r8) grav + + integer i + integer il1g + integer il2g + integer k, kmin, kmax + integer msg + + real(r8) rd + real(r8) rl +! change of subcloud layer properties due to convection is +! related to cumulus updrafts and downdrafts. +! mc(z)=f(z)*mb, mub=betau*mb, mdb=betad*mb are used +! to define betau, betad and f(z). +! note that this implies all time derivatives are in effect +! time derivatives per unit cloud-base mass flux, i.e. they +! have units of 1/mb instead of 1/sec. +! + do i = il1g,il2g + mb(i) = 0._r8 + eb = p(i,mx(i))*q(i,mx(i))/ (eps1+q(i,mx(i))) + dtbdt(i) = (1._r8/dsubcld(i))* (mu(i,mx(i))*(shat(i,mx(i))-su(i,mx(i)))+ & + md(i,mx(i))* (shat(i,mx(i))-sd(i,mx(i)))) + dqbdt(i) = (1._r8/dsubcld(i))* (mu(i,mx(i))*(qhat(i,mx(i))-qu(i,mx(i)))+ & + md(i,mx(i))* (qhat(i,mx(i))-qd(i,mx(i)))) + debdt = eps1*p(i,mx(i))/ (eps1+q(i,mx(i)))**2*dqbdt(i) + dtldt(i) = -2840._r8* (3.5_r8/t(i,mx(i))*dtbdt(i)-debdt/eb)/ & + (3.5_r8*log(t(i,mx(i)))-log(eb)-4.805_r8)**2 + end do +! +! dtmdt and dqmdt are cumulus heating and drying. +! + do k = msg + 1,pver + do i = il1g,il2g + dtmdt(i,k) = 0._r8 + dqmdt(i,k) = 0._r8 + end do + end do +! + do k = msg + 1,pver - 1 + do i = il1g,il2g + if (k == jt(i)) then + dtmdt(i,k) = (1._r8/dp(i,k))*(mu(i,k+1)* (su(i,k+1)-shat(i,k+1)- & + rl/cp*ql(i,k+1))+md(i,k+1)* (sd(i,k+1)-shat(i,k+1))) + dqmdt(i,k) = (1._r8/dp(i,k))*(mu(i,k+1)* (qu(i,k+1)- & + qhat(i,k+1)+ql(i,k+1))+md(i,k+1)*(qd(i,k+1)-qhat(i,k+1))) + end if + end do + end do +! + beta = 0._r8 + do k = msg + 1,pver - 1 + do i = il1g,il2g + if (k > jt(i) .and. k < mx(i)) then + dtmdt(i,k) = (mc(i,k)* (shat(i,k)-s(i,k))+mc(i,k+1)* (s(i,k)-shat(i,k+1)))/ & + dp(i,k) - rl/cp*du(i,k)*(beta*ql(i,k)+ (1-beta)*ql(i,k+1)) +! dqmdt(i,k)=(mc(i,k)*(qhat(i,k)-q(i,k)) +! 1 +mc(i,k+1)*(q(i,k)-qhat(i,k+1)))/dp(i,k) +! 2 +du(i,k)*(qs(i,k)-q(i,k)) +! 3 +du(i,k)*(beta*ql(i,k)+(1-beta)*ql(i,k+1)) + + dqmdt(i,k) = (mu(i,k+1)* (qu(i,k+1)-qhat(i,k+1)+cp/rl* (su(i,k+1)-s(i,k)))- & + mu(i,k)* (qu(i,k)-qhat(i,k)+cp/rl*(su(i,k)-s(i,k)))+md(i,k+1)* & + (qd(i,k+1)-qhat(i,k+1)+cp/rl*(sd(i,k+1)-s(i,k)))-md(i,k)* & + (qd(i,k)-qhat(i,k)+cp/rl*(sd(i,k)-s(i,k))))/dp(i,k) + & + du(i,k)* (beta*ql(i,k)+(1-beta)*ql(i,k+1)) + end if + end do + end do +! + do k = msg + 1,pver + do i = il1g,il2g + if (k >= lel(i) .and. k <= lcl(i)) then + thetavp(i,k) = tp(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+1.608_r8*qstp(i,k)-q(i,mx(i))) + thetavm(i,k) = t(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,k)) + dqsdtp(i,k) = qstp(i,k)* (1._r8+qstp(i,k)/eps1)*eps1*rl/(rd*tp(i,k)**2) +! +! dtpdt is the parcel temperature change due to change of +! subcloud layer properties during convection. +! + dtpdt(i,k) = tp(i,k)/ (1._r8+rl/cp* (dqsdtp(i,k)-qstp(i,k)/tp(i,k)))* & + (dtbdt(i)/t(i,mx(i))+rl/cp* (dqbdt(i)/tl(i)-q(i,mx(i))/ & + tl(i)**2*dtldt(i))) +! +! dboydt is the integrand of cape change. +! + dboydt(i,k) = ((dtpdt(i,k)/tp(i,k)+1._r8/(1._r8+1.608_r8*qstp(i,k)-q(i,mx(i)))* & + (1.608_r8 * dqsdtp(i,k) * dtpdt(i,k) -dqbdt(i))) - (dtmdt(i,k)/t(i,k)+0.608_r8/ & + (1._r8+0.608_r8*q(i,k))*dqmdt(i,k)))*grav*thetavp(i,k)/thetavm(i,k) + end if + end do + end do + +! + do k = msg + 1,pver + do i = il1g,il2g + if (k > lcl(i) .and. k < mx(i)) then + thetavp(i,k) = tp(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,mx(i))) + thetavm(i,k) = t(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,k)) +! +! dboydt is the integrand of cape change. +! + dboydt(i,k) = (dtbdt(i)/t(i,mx(i))+0.608_r8/ (1._r8+0.608_r8*q(i,mx(i)))*dqbdt(i)- & + dtmdt(i,k)/t(i,k)-0.608_r8/ (1._r8+0.608_r8*q(i,k))*dqmdt(i,k))* & + grav*thetavp(i,k)/thetavm(i,k) + end if + end do + end do + +! +! buoyant energy change is set to 2/3*excess cape per 3 hours +! + dadt(il1g:il2g) = 0._r8 + kmin = minval(lel(il1g:il2g)) + kmax = maxval(mx(il1g:il2g)) - 1 + do k = kmin, kmax + do i = il1g,il2g + if ( k >= lel(i) .and. k <= mx(i) - 1) then + dadt(i) = dadt(i) + dboydt(i,k)* (zf(i,k)-zf(i,k+1)) + endif + end do + end do + + + +!RBN calculate timescale based on convective height and mean in-cloud velocity. + + + + if (ltau_dynamic) then + do i = il1g,il2g + tau_wz(i) = 0._r8 + if (wm_ic(i) > 0._r8) then + tau_wz(i) = (z(i,lel(i))-z(i,mx(i)))/wm_ic(i) + else + tau_wz(i) = 10000._r8 + end if + write(iulog,*)'ZMTAU', tau_wz(i) + dltaa = -1._r8* (cape(i)-capelmt) + if (dadt(i) /= 0._r8) mb(i) = max(dltaa/tau/dadt(i),0._r8) + end do +! + call outfld('TAUZM',tau_wz, pcols, lchnk) + + else ! Use default constant value of tau + + do i = il1g,il2g + dltaa = -1._r8* (cape(i)-capelmt) + if (dadt(i) /= 0._r8) mb(i) = max(dltaa/tau/dadt(i),0._r8) + end do + ! + end if + + return + +end subroutine closure + +subroutine q1q2_pjr(lchnk , & + dqdt ,dsdt ,q ,qs ,qu , & + su ,du ,qhat ,shat ,dp , & + mu ,md ,sd ,qd ,ql , & + dsubcld ,jt ,mx ,il1g ,il2g , & + cp ,rl ,msg , & + dl ,evp ,cu , & + loc_conv) + + + implicit none + +!----------------------------------------------------------------------- +! +! Purpose: +! +! +! Method: +! +! +! +! Author: phil rasch dec 19 1995 +! +!----------------------------------------------------------------------- + + + real(r8), intent(in) :: cp + + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: il1g + integer, intent(in) :: il2g + integer, intent(in) :: msg + + real(r8), intent(in) :: q(pcols,pver) + real(r8), intent(in) :: qs(pcols,pver) + real(r8), intent(in) :: qu(pcols,pver) + real(r8), intent(in) :: su(pcols,pver) + real(r8), intent(in) :: du(pcols,pver) + real(r8), intent(in) :: qhat(pcols,pver) + real(r8), intent(in) :: shat(pcols,pver) + real(r8), intent(in) :: dp(pcols,pver) + real(r8), intent(in) :: mu(pcols,pver) + real(r8), intent(in) :: md(pcols,pver) + real(r8), intent(in) :: sd(pcols,pver) + real(r8), intent(in) :: qd(pcols,pver) + real(r8), intent(in) :: ql(pcols,pver) + real(r8), intent(in) :: evp(pcols,pver) + real(r8), intent(in) :: cu(pcols,pver) + real(r8), intent(in) :: dsubcld(pcols) + + real(r8),intent(out) :: dqdt(pcols,pver),dsdt(pcols,pver) + real(r8),intent(out) :: dl(pcols,pver) + + type(zm_conv_t) :: loc_conv + + integer kbm + integer ktm + integer jt(pcols) + integer mx(pcols) +! +! work fields: +! + integer i + integer k + + real(r8) emc + real(r8) rl +!------------------------------------------------------------------- + do k = msg + 1,pver + do i = il1g,il2g + dsdt(i,k) = 0._r8 + dqdt(i,k) = 0._r8 + dl(i,k) = 0._r8 + end do + end do + + if (zmconv_microp) then + do k = msg + 1,pver + do i = il1g,il2g + loc_conv%di(i,k) = 0._r8 + loc_conv%dnl(i,k) = 0._r8 + loc_conv%dni(i,k) = 0._r8 + end do + end do + end if +! +! find the highest level top and bottom levels of convection +! + ktm = pver + kbm = pver + do i = il1g, il2g + ktm = min(ktm,jt(i)) + kbm = min(kbm,mx(i)) + end do + + do k = ktm,pver-1 + do i = il1g,il2g + emc = -cu (i,k) & ! condensation in updraft + +evp(i,k) ! evaporating rain in downdraft + + dsdt(i,k) = -rl/cp*emc & + + (+mu(i,k+1)* (su(i,k+1)-shat(i,k+1)) & + -mu(i,k)* (su(i,k)-shat(i,k)) & + +md(i,k+1)* (sd(i,k+1)-shat(i,k+1)) & + -md(i,k)* (sd(i,k)-shat(i,k)) & + )/dp(i,k) + + if (zmconv_microp) dsdt(i,k) = dsdt(i,k) + latice/cp*loc_conv%frz(i,k) + + dqdt(i,k) = emc + & + (+mu(i,k+1)* (qu(i,k+1)-qhat(i,k+1)) & + -mu(i,k)* (qu(i,k)-qhat(i,k)) & + +md(i,k+1)* (qd(i,k+1)-qhat(i,k+1)) & + -md(i,k)* (qd(i,k)-qhat(i,k)) & + )/dp(i,k) + + dl(i,k) = du(i,k)*ql(i,k+1) + + if (zmconv_microp) then + loc_conv%di(i,k) = du(i,k)*loc_conv%qide(i,k+1) + loc_conv%dnl(i,k) = du(i,k)*loc_conv%qncde(i,k+1) + loc_conv%dni(i,k) = du(i,k)*loc_conv%qnide(i,k+1) + end if + + end do + end do + +! + do k = kbm,pver + do i = il1g,il2g + if (k == mx(i)) then + dsdt(i,k) = (1._r8/dsubcld(i))* & + (-mu(i,k)* (su(i,k)-shat(i,k)) & + -md(i,k)* (sd(i,k)-shat(i,k)) & + ) + dqdt(i,k) = (1._r8/dsubcld(i))* & + (-mu(i,k)*(qu(i,k)-qhat(i,k)) & + -md(i,k)*(qd(i,k)-qhat(i,k)) & + ) + else if (k > mx(i)) then + dsdt(i,k) = dsdt(i,k-1) + dqdt(i,k) = dqdt(i,k-1) + end if + end do + end do +! + return +end subroutine q1q2_pjr + +subroutine buoyan_dilute(lchnk ,ncol , & + q ,t ,omega ,p ,z ,pf , & + tp ,qstp ,tl ,rl ,cape , & + pblt ,pbl_z ,lcl ,lel ,lon ,mx , & + rd ,grav ,cp ,msg , & + zi, tpert ,org ,landfrac ,wm_incld) +!----------------------------------------------------------------------- +! +! Purpose: +! Calculates CAPE the lifting condensation level and the convective top +! where buoyancy is first -ve. +! +! Method: Calculates the parcel temperature based on a simple constant +! entraining plume model. CAPE is integrated from buoyancy. +! 09/09/04 - Simplest approach using an assumed entrainment rate for +! testing (dmpdp). +! 08/04/05 - Swap to convert dmpdz to dmpdp +! +! SCAM Logical Switches - DILUTE:RBN - Now Disabled +! --------------------- +! switch(1) = .T. - Uses the dilute parcel calculation to obtain tendencies. +! switch(2) = .T. - Includes entropy/q changes due to condensate loss and freezing. +! switch(3) = .T. - Adds the PBL Tpert for the parcel temperature at all levels. +! +! References: +! Raymond and Blythe (1992) JAS +! +! Author: +! Richard Neale - September 2004 +! +!----------------------------------------------------------------------- + implicit none +!----------------------------------------------------------------------- +! +! input arguments +! + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: ncol ! number of atmospheric columns + + real(r8), intent(in) :: q(pcols,pver) ! spec. humidity + real(r8), intent(in) :: t(pcols,pver) ! temperature + real(r8), intent(in) :: omega(pcols,pver) ! RBN - Omega to be use in parcel energy calculation. + real(r8), intent(in) :: p(pcols,pver) ! pressure + real(r8), intent(in) :: z(pcols,pver) ! height + real(r8), intent(in) :: pf(pcols,pver+1) ! pressure at interfaces + real(r8), intent(in) :: pblt(pcols) ! index of pbl depth + real(r8), intent(in) :: pbl_z(pcols) ! RBN: Previously diagnosed PBL height + real(r8), intent(in) :: tpert(pcols) ! perturbation temperature by pbl processes + +! RBN: Use z interface for parcel calculations. + real(r8), intent(in) :: zi(pcols,pver+1) ! height at interfaces + +! +! output arguments +! + real(r8), intent(out) :: tp(pcols,pver) ! parcel temperature + real(r8), intent(out) :: qstp(pcols,pver) ! saturation mixing ratio of parcel (only above lcl, just q below). + real(r8), intent(out) :: tl(pcols) ! parcel temperature at lcl + real(r8), intent(out) :: cape(pcols) ! convective aval. pot. energy. + real(r8), intent(out) :: wm_incld(pcols) ! Mean deep convective in-cloud vertical velocity. + + integer lcl(pcols) ! + integer lel(pcols) ! + integer lon(pcols) ! level of onset of deep convection + integer mx(pcols) ! level of max moist static energy + + real(r8), pointer :: org(:,:) ! organization parameter + real(r8), intent(in) :: landfrac(pcols) +! +!--------------------------Local Variables------------------------------ +! + real(r8) capeten(pcols,5) ! provisional value of cape + real(r8) tv(pcols,pver) ! + real(r8) tpv(pcols,pver) ! + real(r8) buoy(pcols,pver) + real(r8) w_incld(pcols,pver) + + + real(r8) a1(pcols) + real(r8) a2(pcols) + real(r8) estp(pcols) + real(r8) pl(pcols) + real(r8) plexp(pcols) + real(r8) hmax(pcols) + real(r8) hmn(pcols) + real(r8) y(pcols) + + logical plge600(pcols) + integer knt(pcols) + integer lelten(pcols,5) + + ! RBN variables for parcel total energy consideration + + + real(r8),parameter :: pini_ke = 200. ! Convective parcel initial kinetic energy (J/kg). + real(r8),parameter :: pe2ke_eff = 1.0_r8 ! PE->KE parcel energy conversion efficiency. + real(r8) :: plev_ke(pcols,pver) ! Parcel kinetic energy at a particular level (J/kg). + real(r8) :: w_nrg(pcols,pver) ! Energy associated with the large scale w(omega) + logical :: first_kelt0(pcols) ! Indicating first time ke<0 in a column. + + ! RBN parcel property variables + + + real(r8) :: hmn_lev(pcols,pver) ! Vertical profile of moist static energy for each column + real(r8) :: dp_lev(pcols,pver) ! Level dpressure between interfaces + real(r8) :: hmn_zdp(pcols,pver) ! Integrals of hmn_lev*dp_lev at each level + real(r8) :: q_zdp(pcols,pver) ! Integrals of q*dp_lev at each level + real(r8) :: dp_zfrac ! Fraction of vertical grid box below mixing top (usually pblt) + real(r8) :: parcel_ztop(pcols) ! Depth of parcel mixing (usually pblt) + real(r8) :: parcel_dp(pcols) ! Pressure integral over parcel mixing depth (usually pblt) + real(r8) :: parcel_hdp(pcols) ! Pressure*MSE integral over parcel mixing depth (usually pblt) + real(r8) :: parcel_qdp(pcols) ! Pressure*q integral over parcel mixing depth (usually pblt) + real(r8) :: hpar(pcols) ! Initial MSE of the parcel + real(r8) :: qpar(pcols) ! Initial humidity of the parcel + real(r8) :: ql(pcols) ! Initial parcel humidity (for ientropy routine) + integer :: ipar ! Index for top of parcel mixing/laucnh level. + + real(r8) cp + real(r8) e + real(r8) grav + + integer i + integer k + integer msg + integer n + + + real(r8) rd + real(r8) rl +#ifdef PERGRO + real(r8) rhd +#endif +! +!----------------------------------------------------------------------- +! + do n = 1,5 + do i = 1,ncol + lelten(i,n) = pver + capeten(i,n) = 0._r8 + end do + end do +! + do i = 1,ncol + lon(i) = pver + knt(i) = 0 + lel(i) = pver + mx(i) = lon(i) + cape(i) = 0._r8 + hmax(i) = 0._r8 + first_kelt0 = .True. +! pbl_z(i) = z(i,pblt(i)) + + parcel_ztop(i) = 0.5_r8*pbl_z(i) ! Boundary layer top for now, could be something else. + parcel_hdp(i) = 0._r8 + parcel_dp(i) = 0._r8 + parcel_qdp(i) = 0._r8 + hpar(i) = 0._r8 + qpar(i) = 0._r8 + end do + + tp(:ncol,:) = t(:ncol,:) + qstp(:ncol,:) = q(:ncol,:) + hmn_lev(:ncol,:) = 0._r8 ! RBN: MSE as a function of ncol and height + +!!! RBN - Initialize tv and buoy for output. +!!! tv=tv : tpv=tpv : qstp=q : buoy=0. + tv(:ncol,:) = t(:ncol,:) *(1._r8+1.608_r8*q(:ncol,:))/ (1._r8+q(:ncol,:)) + tpv(:ncol,:) = tv(:ncol,:) + buoy(:ncol,:) = 0._r8 + plev_ke(:ncol,:) = 0._r8 + w_incld(:ncol,:) = 0._r8 + w_nrg(:ncol,:) = -r_universal*t(:ncol,:)*omega(:ncol,:)/(grav*100._r8*p(:ncol,:)) + + lparcel_pbl = .true. ! Mix parcel properties and level accoring to a mixing length (PBLH mainly) + lparcel_dynamic = .false. ! Enable assumed dynamics of aparcel for buoy. profile and cloud top + + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! RBN - Mix the parcel over a certain dp or dz and take the launch level as the top level +! of this mixing region and the h properties as this mixed value +! Should be well mixed by other processes no in the very near PBL. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + + +if (lparcel_pbl) then + +! Vertical profile of MSE and pressure weighted of the same. + hmn_lev = cp*t + grav*z + rl*q + dp_lev(:ncol,1:pver) = pf(:ncol,2:pver+1)-pf(:ncol,1:pver) + hmn_zdp = hmn_lev*dp_lev + q_zdp = q*dp_lev + + +! Mix profile over vertical length scale of parcel_ztop. +! RBN XXX Still Needs to be fully tested XXXXX + + do i = 1,ncol ! Loop columns + do k = pver,msg + 1,-1 ! Loop levels bottom to top. + + + if (zi(i,k+1) <= parcel_ztop(i)) then ! Has to be relative to surface geo height. + ipar = k + + if (k.eq.pver) then ! Always at least the full depth of lowest model layer. + dp_zfrac = 1._r8 + else + dp_zfrac = min(1._r8,(parcel_ztop(i)-zi(i,k+1))/(zi(i,k)-zi(i,k+1))) ! Fraction of grid cell depth (mostly 1, except when parcel_ztop is in between levels. + end if +! + parcel_hdp(i) = parcel_hdp(i)+hmn_zdp(i,k)*dp_zfrac ! Sum parcel profile up to a certain level. + parcel_qdp(i) = parcel_qdp(i)+q_zdp(i,k)*dp_zfrac ! Sum parcel profile up to a certain level. + parcel_dp(i) = parcel_dp(i)+dp_lev(i,k)*dp_zfrac ! SUM dp's for weighting of parcel_hdp + + end if + end do + + hpar(i) = parcel_hdp(i)/parcel_dp(i) + qpar(i) = parcel_qdp(i)/parcel_dp(i) + mx(i) = ipar + end do + + end if ! RBN: End parcel mixing logic + + + + + + if (.not.lparcel_pbl) then ! Default method finding level of MSE maximum (nlev senstitve though) + ! + ! set "launching" level(mx) to be at maximum moist static energy. + ! search for this level stops at planetary boundary layer top. + ! +#ifdef PERGRO + do k = pver,msg + 1,-1 + do i = 1,ncol + hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) + ! + ! Reset max moist static energy level when relative difference exceeds 1.e-4 + ! + rhd = (hmn(i) - hmax(i))/(hmn(i) + hmax(i)) + if (k >= nint(pblt(i)) .and. k <= lon(i) .and. rhd > -1.e-4_r8) then + hmax(i) = hmn(i) + mx(i) = k + end if + end do + end do +#else + do k = pver,msg + 1,-1 + do i = 1,ncol + hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) + if (k >= nint(pblt(i)) .and. k <= lon(i) .and. hmn(i) > hmax(i)) then + hmax(i) = hmn(i) + mx(i) = k + end if + end do + end do +#endif + +end if ! Default method of determining parcel launch properties. + +! LCL dilute calculation - initialize to mx(i) +! Determine lcl in parcel_dilute and get pl,tl after parcel_dilute +! Original code actually sets LCL as level above where condensate forms. +! Therefore in parcel_dilute lcl(i) will be at first level where qsmix < qtmix. + + +if (lparcel_pbl) then + +! For parcel dilute need to invert hpar and qpar. +! Now need to supply ql(i) as it is mixed parcel version, just q(i,mx(i)) in default + + do i = 1,ncol ! Initialise LCL variables. + + lcl(i) = mx(i) +! tl(i) = (hpar(i)-rl*qpar(i)-grav*parcel_ztop(i))/cp + tl(i) = t(i,mx(i)) + ql(i) = qpar(i) + pl(i) = p(i,mx(i)) + + end do + +else + + do i = 1,ncol + lcl(i) = mx(i) + tl(i) = t(i,mx(i)) + ql(i) = q(i,mx(i)) + pl(i) = p(i,mx(i)) + end do + +end if ! Mixed parcel properties + + + +! +! main buoyancy calculation. +! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!! DILUTE PLUME CALCULATION USING ENTRAINING PLUME !!! +!!! RBN 9/9/04 !!! + + call parcel_dilute(lchnk, ncol, msg, mx, p, t, q, & + tpert, tp, tpv, qstp, pl, tl, ql, lcl, & + org, landfrac) + + +! If lcl is above the nominal level of non-divergence (600 mbs), +! no deep convection is permitted (ensuing calculations +! skipped and cape retains initialized value of zero). +! + do i = 1,ncol + plge600(i) = pl(i).ge.600._r8 ! Just change to always allow buoy calculation. + end do + +! +! Main buoyancy calculation. +! + do k = pver,msg + 1,-1 + do i=1,ncol + if (k <= mx(i) .and. plge600(i)) then ! Define buoy from launch level to cloud top. + tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) + buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add ! +0.5K or not? + else + qstp(i,k) = q(i,k) + tp(i,k) = t(i,k) + tpv(i,k) = tv(i,k) + endif + end do + end do + + + +!------------------------------------------------------------------------------- + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! +! -- RBN July 2006 -- +! If parcel obtains a total energy deficit (KE+PE) then +! it detrains. +! Assumes a parcel initial energy and PE->KE conversion +! efficiency. +! -RBN 3 Nov 2008 +! For CIN to really matter need to include the parcel calculation below the LCL +! +! -Calcuated bottom to top +! -Initializes parcel energy with initial value at hmax level +! -Increments KE base on buoyancy conversion with pe2ke efficiency +! -Parcel terminates at level of zero energy + + + + if (lparcel_dynamic) then ! Calculate dynamic parcel energy? + + do k = pver, msg + 2, -1 + do i = 1,ncol + if (k == mx(i)) then + plev_ke(i,k) = pini_ke + end if + if (k < mx(i).and.plge600(i)) then + plev_ke(i,k) = plev_ke(i,k) + pe2ke_eff*rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) + 0.5_r8*w_nrg(i,k)*w_nrg(i,k) + w_incld(i,k) = sqrt(max(0._r8,2._r8*plev_ke(i,k))) + if (plev_ke(i,k) <= 0._r8 .and. first_kelt0(i)) then ! Parcel terminates at level of zero energy + knt(i) = min(num_cin,knt(i) + 1) + lelten(i,knt(i)) = k + first_kelt0(i) = .False. ! Make sure that this bit of code cannot be used once ke<0. + end if + end if + end do + end do + + else ! Or default parcel energy. + + ! Default way to determine plume top + ! -Calculated top to bottom + ! -Starts at LCL + + do k = msg + 2,pver + do i = 1,ncol + if (k < lcl(i) .and. plge600(i)) then + if (buoy(i,k+1) > 0._r8 .and. buoy(i,k) <= 0._r8) then + knt(i) = min(num_cin,knt(i) + 1) + lelten(i,knt(i)) = k + end if + end if + end do + end do + + + end if ! End dynamic parcel logic + + + +! +! calculate convective available potential energy (cape). +! + do n = 1,num_cin + do k = msg + 1,pver + do i = 1,ncol + if (plge600(i) .and. k <= mx(i) .and. k > lelten(i,n)) then + capeten(i,n) = capeten(i,n) + rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) + end if + end do + end do + end do +! +! find maximum cape from all possible tentative capes from +! one sounding, +! and use it as the final cape, april 26, 1995 +! + do n = 1,num_cin + do i = 1,ncol + if (capeten(i,n) > cape(i)) then + cape(i) = capeten(i,n) + lel(i) = lelten(i,n) + end if + end do + end do + +! For dynamic parcel, Now we know convective top let's find mean in-cloud w + + if (lparcel_dynamic) then + do k = msg + 1,pver + do i = 1,ncol + if ( k >= lel(i) .and. k <= lcl(i) - 1) then + wm_incld(i) = wm_incld(i)+w_incld(i,k)*(pf(i,k+1)-pf(i,k))/(pf(i,lcl(i))-pf(i,lel(i))) + end if + end do + end do + + write(iulog,*)'WMINCLD =',wm_incld + write(iulog,*)'MINCLD =',w_incld + + end if + + call outfld('WINCLD', w_incld, pcols, lchnk) + call outfld('LCL',real(lcl,r8),pcols, lchnk) + call outfld('KHMAX',real(mx,r8),pcols, lchnk) + call outfld('PLCL', pl, pcols, lchnk) ! Pressure at the lifting condensation level. + call outfld('TLCL', tl, pcols, lchnk) ! Temp " + call outfld('LEL', real(lel,r8), pcols, lchnk) ! Level of neutral buoy + call outfld('HMAX', hmax, pcols, lchnk) + call outfld('KEPAR', plev_ke, pcols, lchnk) ! Parcel K.E. + call outfld('BUOY', buoy, pcols, lchnk) + call outfld('MWINCLD',wm_incld, pcols, lchnk) ! In-cloud vertical velocity + + +! +! put lower bound on cape for diagnostic purposes. +! + do i = 1,ncol + cape(i) = max(cape(i), 0._r8) + end do +! + return +end subroutine buoyan_dilute + +subroutine parcel_dilute (lchnk, ncol, msg, klaunch, p, t, q, & + tpert, tp, tpv, qstp, pl, tl, ql, lcl, & + org, landfrac) + +! Routine to determine +! 1. Tp - Parcel temperature +! 2. qstp - Saturated mixing ratio at the parcel temperature. + +!-------------------- +implicit none +!-------------------- + +integer, intent(in) :: lchnk +integer, intent(in) :: ncol +integer, intent(in) :: msg + +integer, intent(in), dimension(pcols) :: klaunch(pcols) + +real(r8), intent(in), dimension(pcols,pver) :: p +real(r8), intent(in), dimension(pcols,pver) :: t +real(r8), intent(in), dimension(pcols,pver) :: q +real(r8), intent(in), dimension(pcols) :: tpert ! PBL temperature perturbation. + +real(r8), intent(inout), dimension(pcols,pver) :: tp ! Parcel temp. +real(r8), intent(inout), dimension(pcols,pver) :: qstp ! Parcel water vapour (sat value above lcl). +real(r8), intent(inout), dimension(pcols) :: tl ! Actual temp of LCL. +real(r8), intent(inout), dimension(pcols) :: ql ! Actual humidity of LCL +real(r8), intent(inout), dimension(pcols) :: pl ! Actual pressure of LCL. + +integer, intent(inout), dimension(pcols) :: lcl ! Lifting condesation level (first model level with saturation). + +real(r8), intent(out), dimension(pcols,pver) :: tpv ! Define tpv within this routine. + +real(r8), pointer, dimension(:,:) :: org +real(r8), intent(in), dimension(pcols) :: landfrac +!-------------------- + +! Have to be careful as s is also dry static energy. + + +! If we are to retain the fact that CAM loops over grid-points in the internal +! loop then we need to dimension sp,atp,mp,xsh2o with ncol. + + +real(r8) tmix(pcols,pver) ! Tempertaure of the entraining parcel. +real(r8) qtmix(pcols,pver) ! Total water of the entraining parcel. +real(r8) qsmix(pcols,pver) ! Saturated mixing ratio at the tmix. +real(r8) smix(pcols,pver) ! Entropy of the entraining parcel. +real(r8) xsh2o(pcols,pver) ! Precipitate lost from parcel. +real(r8) ds_xsh2o(pcols,pver) ! Entropy change due to loss of condensate. +real(r8) ds_freeze(pcols,pver) ! Entropy change sue to freezing of precip. +real(r8) dmpdz2d(pcols,pver) ! variable detrainment rate + +real(r8) mp(pcols) ! Parcel mass flux. +real(r8) qtp(pcols) ! Parcel total water. +real(r8) sp(pcols) ! Parcel entropy. + +real(r8) sp0(pcols) ! Parcel launch entropy. +real(r8) qtp0(pcols) ! Parcel launch total water. +real(r8) mp0(pcols) ! Parcel launch relative mass flux. + +real(r8) lwmax ! Maximum condesate that can be held in cloud before rainout. +real(r8) dmpdp ! Parcel fractional mass entrainment rate (/mb). +!real(r8) dmpdpc ! In cloud parcel mass entrainment rate (/mb). +real(r8) dmpdz ! Parcel fractional mass entrainment rate (/m) +real(r8) dpdz,dzdp ! Hydrstatic relation and inverse of. +real(r8) senv ! Environmental entropy at each grid point. +real(r8) qtenv ! Environmental total water " " ". +real(r8) penv ! Environmental total pressure " " ". +real(r8) tenv ! Environmental total temperature " " ". +real(r8) new_s ! Hold value for entropy after condensation/freezing adjustments. +real(r8) new_q ! Hold value for total water after condensation/freezing adjustments. +real(r8) dp ! Layer thickness (center to center) +real(r8) tfguess ! First guess for entropy inversion - crucial for efficiency! +real(r8) tscool ! Super cooled temperature offset (in degC) (eg -35). + +real(r8) qxsk, qxskp1 ! LCL excess water (k, k+1) +real(r8) dsdp, dqtdp, dqxsdp ! LCL s, qt, p gradients (k, k+1) +real(r8) slcl,qtlcl,qslcl ! LCL s, qt, qs values. +real(r8) org2rkm, org2Tpert +real(r8) dmpdz_lnd, dmpdz_mask + +integer rcall ! Number of ientropy call for errors recording +integer nit_lheat ! Number of iterations for condensation/freezing loop. +integer i,k,ii ! Loop counters. + +!====================================================================== +! SUMMARY +! +! 9/9/04 - Assumes parcel is initiated from level of maxh (klaunch) +! and entrains at each level with a specified entrainment rate. +! +! 15/9/04 - Calculates lcl(i) based on k where qsmix is first < qtmix. +! +!====================================================================== +! +! Set some values that may be changed frequently. +! + +if (zm_org) then + org2rkm = 10._r8 + org2Tpert = 0._r8 +endif +nit_lheat = 2 ! iterations for ds,dq changes from condensation freezing. +dmpdz=-1.e-3_r8 ! Entrainment rate. (-ve for /m) +dmpdz_lnd=-1.e-3_r8 +!dmpdpc = 3.e-2_r8 ! In cloud entrainment rate (/mb). +lwmax = 1.e-3_r8 ! Need to put formula in for this. +tscool = -10.0_r8 ! Temp at which water loading freezes in the cloud. + +qtmix=0._r8 +smix=0._r8 + +qtenv = 0._r8 +senv = 0._r8 +tenv = 0._r8 +penv = 0._r8 + +qtp0 = 0._r8 +sp0 = 0._r8 +mp0 = 0._r8 + +qtp = 0._r8 +sp = 0._r8 +mp = 0._r8 + +new_q = 0._r8 +new_s = 0._r8 + +! **** Begin loops **** + +do k = pver, msg+1, -1 + do i=1,ncol + +! Initialize parcel values at launch level. + + if (k == klaunch(i)) then + qtp0(i) = ql(i) ! Parcel launch q (could be environment (default] or a BL mixed value. +! qtp0(i) = q(i,k) ! Parcel launch total water (assuming subsaturated) - OK????. + sp0(i) = entropy(tl(i),pl(i),qtp0(i)) ! Parcel launch entropy could be a mixed parcel. + mp0(i) = 1._r8 ! Parcel launch relative mass (i.e. 1 parcel stays 1 parcel for dmpdp=0, undilute). + smix(i,k) = sp0(i) + qtmix(i,k) = qtp0(i) + tfguess = t(i,k) + rcall = 1 + call ientropy (rcall,i,lchnk,smix(i,k),p(i,k),qtmix(i,k),tmix(i,k),qsmix(i,k),tfguess) + end if + +! Entraining levels + + if (k < klaunch(i)) then + +! Set environmental values for this level. + + dp = (p(i,k)-p(i,k+1)) ! In -ve mb as p decreasing with height - difference between center of layers. + qtenv = 0.5_r8*(q(i,k)+q(i,k+1)) ! Total water of environment. + tenv = 0.5_r8*(t(i,k)+t(i,k+1)) + penv = 0.5_r8*(p(i,k)+p(i,k+1)) + + senv = entropy(tenv,penv,qtenv) ! Entropy of environment. + +! Determine fractional entrainment rate /pa given value /m. + + dpdz = -(penv*grav)/(rgas*tenv) ! in mb/m since p in mb. + dzdp = 1._r8/dpdz ! in m/mb + if (zm_org) then + dmpdz_mask = landfrac(i) * dmpdz_lnd + (1._r8 - landfrac(i)) * dmpdz + dmpdp = (dmpdz_mask/(1._r8+org(i,k)*org2rkm))*dzdp ! /mb Fractional entrainment + else + dmpdp = dmpdz*dzdp + endif + +! Sum entrainment to current level +! entrains q,s out of intervening dp layers, in which linear variation is assumed +! so really it entrains the mean of the 2 stored values. + + sp(i) = sp(i) - dmpdp*dp*senv + qtp(i) = qtp(i) - dmpdp*dp*qtenv + mp(i) = mp(i) - dmpdp*dp + +! Entrain s and qt to next level. + + smix(i,k) = (sp0(i) + sp(i)) / (mp0(i) + mp(i)) + qtmix(i,k) = (qtp0(i) + qtp(i)) / (mp0(i) + mp(i)) + +! Invert entropy from s and q to determine T and saturation-capped q of mixture. +! t(i,k) used as a first guess so that it converges faster. + + tfguess = tmix(i,k+1) + rcall = 2 + call ientropy(rcall,i,lchnk,smix(i,k),p(i,k),qtmix(i,k),tmix(i,k),qsmix(i,k),tfguess) + +! +! Determine if this is lcl of this column if qsmix <= qtmix. +! FIRST LEVEL where this happens on ascending. + + if (qsmix(i,k) <= qtmix(i,k) .and. qsmix(i,k+1) > qtmix(i,k+1)) then + lcl(i) = k + qxsk = qtmix(i,k) - qsmix(i,k) + qxskp1 = qtmix(i,k+1) - qsmix(i,k+1) + dqxsdp = (qxsk - qxskp1)/dp + pl(i) = p(i,k+1) - qxskp1/dqxsdp ! pressure level of actual lcl. + dsdp = (smix(i,k) - smix(i,k+1))/dp + dqtdp = (qtmix(i,k) - qtmix(i,k+1))/dp + slcl = smix(i,k+1) + dsdp* (pl(i)-p(i,k+1)) + qtlcl = qtmix(i,k+1) + dqtdp*(pl(i)-p(i,k+1)) + + tfguess = tmix(i,k) + rcall = 3 + call ientropy (rcall,i,lchnk,slcl,pl(i),qtlcl,tl(i),qslcl,tfguess) + +! write(iulog,*)' ' +! write(iulog,*)' p',p(i,k+1),pl(i),p(i,lcl(i)) +! write(iulog,*)' t',tmix(i,k+1),tl(i),tmix(i,lcl(i)) +! write(iulog,*)' s',smix(i,k+1),slcl,smix(i,lcl(i)) +! write(iulog,*)'qt',qtmix(i,k+1),qtlcl,qtmix(i,lcl(i)) +! write(iulog,*)'qs',qsmix(i,k+1),qslcl,qsmix(i,lcl(i)) + + endif +! + end if ! k < klaunch + + + end do ! Levels loop +end do ! Columns loop + +!!!!!!!!!!!!!!!!!!!!!!!!!!END ENTRAINMENT LOOP!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +!! Could stop now and test with this as it will provide some estimate of buoyancy +!! without the effects of freezing/condensation taken into account for tmix. + +!! So we now have a profile of entropy and total water of the entraining parcel +!! Varying with height from the launch level klaunch parcel=environment. To the +!! top allowed level for the existence of convection. + +!! Now we have to adjust these values such that the water held in vaopor is < or +!! = to qsmix. Therefore, we assume that the cloud holds a certain amount of +!! condensate (lwmax) and the rest is rained out (xsh2o). This, obviously +!! provides latent heating to the mixed parcel and so this has to be added back +!! to it. But does this also increase qsmix as well? Also freezing processes + + +xsh2o = 0._r8 +ds_xsh2o = 0._r8 +ds_freeze = 0._r8 + +!!!!!!!!!!!!!!!!!!!!!!!!!PRECIPITATION/FREEZING LOOP!!!!!!!!!!!!!!!!!!!!!!!!!! +!! Iterate solution twice for accuracy + + + +do k = pver, msg+1, -1 + do i=1,ncol + +! Initialize variables at k=klaunch + + if (k == klaunch(i)) then + +! Set parcel values at launch level assume no liquid water. + + tp(i,k) = tmix(i,k) + qstp(i,k) = q(i,k) + if (zm_org) then + tpv(i,k) = (tp(i,k) + (org2Tpert*org(i,k)+tpert(i))) * (1._r8+1.608_r8*qstp(i,k)) / (1._r8+qstp(i,k)) + else + tpv(i,k) = (tp(i,k) + tpert(i)) * (1._r8+1.608_r8*qstp(i,k)) / (1._r8+qstp(i,k)) + endif + + end if + + if (k < klaunch(i)) then + +! Initiate loop if switch(2) = .T. - RBN:DILUTE - TAKEN OUT BUT COULD BE RETURNED LATER. + +! Iterate nit_lheat times for s,qt changes. + + do ii=0,nit_lheat-1 + +! Rain (xsh2o) is excess condensate, bar LWMAX (Accumulated loss from qtmix). + + xsh2o(i,k) = max (0._r8, qtmix(i,k) - qsmix(i,k) - lwmax) + +! Contribution to ds from precip loss of condensate (Accumulated change from smix).(-ve) + + ds_xsh2o(i,k) = ds_xsh2o(i,k+1) - cpliq * log (tmix(i,k)/tfreez) * max(0._r8,(xsh2o(i,k)-xsh2o(i,k+1))) +! +! Entropy of freezing: latice times amount of water involved divided by T. +! + + if (tmix(i,k) <= tfreez+tscool .and. ds_freeze(i,k+1) == 0._r8) then ! One off freezing of condensate. + ds_freeze(i,k) = (latice/tmix(i,k)) * max(0._r8,qtmix(i,k)-qsmix(i,k)-xsh2o(i,k)) ! Gain of LH + end if + + if (tmix(i,k) <= tfreez+tscool .and. ds_freeze(i,k+1) /= 0._r8) then ! Continual freezing of additional condensate. + ds_freeze(i,k) = ds_freeze(i,k+1)+(latice/tmix(i,k)) * max(0._r8,(qsmix(i,k+1)-qsmix(i,k))) + end if + +! Adjust entropy and accordingly to sum of ds (be careful of signs). + + new_s = smix(i,k) + ds_xsh2o(i,k) + ds_freeze(i,k) + +! Adjust liquid water and accordingly to xsh2o. + + new_q = qtmix(i,k) - xsh2o(i,k) + +! Invert entropy to get updated Tmix and qsmix of parcel. + + tfguess = tmix(i,k) + rcall = 4 + call ientropy (rcall,i,lchnk,new_s, p(i,k), new_q, tmix(i,k), qsmix(i,k), tfguess) + + end do ! Iteration loop for freezing processes. + +! tp - Parcel temp is temp of mixture. +! tpv - Parcel v. temp should be density temp with new_q total water. + + tp(i,k) = tmix(i,k) + +! tpv = tprho in the presence of condensate (i.e. when new_q > qsmix) + + if (new_q > qsmix(i,k)) then ! Super-saturated so condensate present - reduces buoyancy. + qstp(i,k) = qsmix(i,k) + else ! Just saturated/sub-saturated - no condensate virtual effects. + qstp(i,k) = new_q + end if + + if (zm_org) then + tpv(i,k) = (tp(i,k)+(org2Tpert*org(i,k)+tpert(i)))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+ new_q) + else + tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+ new_q) + endif + + end if ! k < klaunch + + end do ! Loop for columns + +end do ! Loop for vertical levels. + + +return +end subroutine parcel_dilute + +!----------------------------------------------------------------------------------------- +real(r8) function entropy(TK,p,qtot) +!----------------------------------------------------------------------------------------- +! +! TK(K),p(mb),qtot(kg/kg) +! from Raymond and Blyth 1992 +! + real(r8), intent(in) :: p,qtot,TK + real(r8) :: qv,qst,e,est,L + real(r8), parameter :: pref = 1000._r8 + +L = rl - (cpliq - cpwv)*(TK-tfreez) ! T IN CENTIGRADE + +call qsat_hPa(TK, p, est, qst) + +qv = min(qtot,qst) ! Partition qtot into vapor part only. +e = qv*p / (eps1 +qv) + +entropy = (cpres + qtot*cpliq)*log( TK/tfreez) - rgas*log( (p-e)/pref ) + & + L*qv/TK - qv*rh2o*log(qv/qst) + +end FUNCTION entropy + +! +!----------------------------------------------------------------------------------------- +SUBROUTINE ientropy (rcall,icol,lchnk,s,p,qt,T,qst,Tfg) +!----------------------------------------------------------------------------------------- +! +! p(mb), Tfg/T(K), qt/qv(kg/kg), s(J/kg). +! Inverts entropy, pressure and total water qt +! for T and saturated vapor mixing ratio +! + + use phys_grid, only: get_rlon_p, get_rlat_p + + integer, intent(in) :: icol, lchnk, rcall + real(r8), intent(in) :: s, p, Tfg, qt + real(r8), intent(out) :: qst, T + real(r8) :: est, this_lat,this_lon + real(r8) :: a,b,c,d,ebr,fa,fb,fc,pbr,qbr,rbr,sbr,tol1,xm,tol + integer :: i + + logical :: converged + + ! Max number of iteration loops. + integer, parameter :: LOOPMAX = 100 + real(r8), parameter :: EPS = 3.e-8_r8 + + converged = .false. + + ! Invert the entropy equation -- use Brent's method + ! Brent, R. P. Ch. 3-4 in Algorithms for Minimization Without Derivatives. Englewood Cliffs, NJ: Prentice-Hall, 1973. + + T = Tfg ! Better first guess based on Tprofile from conv. + + a = Tfg-10 !low bracket + b = Tfg+10 !high bracket + + fa = entropy(a, p, qt) - s + fb = entropy(b, p, qt) - s + + c=b + fc=fb + tol=0.001_r8 + + converge: do i=0, LOOPMAX + if ((fb > 0.0_r8 .and. fc > 0.0_r8) .or. & + (fb < 0.0_r8 .and. fc < 0.0_r8)) then + c=a + fc=fa + d=b-a + ebr=d + end if + if (abs(fc) < abs(fb)) then + a=b + b=c + c=a + fa=fb + fb=fc + fc=fa + end if + + tol1=2.0_r8*EPS*abs(b)+0.5_r8*tol + xm=0.5_r8*(c-b) + converged = (abs(xm) <= tol1 .or. fb == 0.0_r8) + if (converged) exit converge + + if (abs(ebr) >= tol1 .and. abs(fa) > abs(fb)) then + sbr=fb/fa + if (a == c) then + pbr=2.0_r8*xm*sbr + qbr=1.0_r8-sbr + else + qbr=fa/fc + rbr=fb/fc + pbr=sbr*(2.0_r8*xm*qbr*(qbr-rbr)-(b-a)*(rbr-1.0_r8)) + qbr=(qbr-1.0_r8)*(rbr-1.0_r8)*(sbr-1.0_r8) + end if + if (pbr > 0.0_r8) qbr=-qbr + pbr=abs(pbr) + if (2.0_r8*pbr < min(3.0_r8*xm*qbr-abs(tol1*qbr),abs(ebr*qbr))) then + ebr=d + d=pbr/qbr + else + d=xm + ebr=d + end if + else + d=xm + ebr=d + end if + a=b + fa=fb + b=b+merge(d,sign(tol1,xm), abs(d) > tol1 ) + + fb = entropy(b, p, qt) - s + + end do converge + + T = b + call qsat_hPa(T, p, est, qst) + + if (.not. converged) then + this_lat = get_rlat_p(lchnk, icol)*57.296_r8 + this_lon = get_rlon_p(lchnk, icol)*57.296_r8 + write(iulog,*) '*** ZM_CONV: IENTROPY: Failed and about to exit, info follows ****' + write(iulog,100) 'ZM_CONV: IENTROPY. Details: call#,lchnk,icol= ',rcall,lchnk,icol, & + ' lat: ',this_lat,' lon: ',this_lon, & + ' P(mb)= ', p, ' Tfg(K)= ', Tfg, ' qt(g/kg) = ', 1000._r8*qt, & + ' qst(g/kg) = ', 1000._r8*qst,', s(J/kg) = ',s + call endrun('**** ZM_CONV IENTROPY: Tmix did not converge ****') + end if + +100 format (A,I1,I4,I4,7(A,F6.2)) + +end SUBROUTINE ientropy + +! Wrapper for qsat_water that does translation between Pa and hPa +! qsat_water uses Pa internally, so get it right, need to pass in Pa. +! Afterward, set es back to hPa. +subroutine qsat_hPa(t, p, es, qm) + use wv_saturation, only: qsat_water + + ! Inputs + real(r8), intent(in) :: t ! Temperature (K) + real(r8), intent(in) :: p ! Pressure (hPa) + ! Outputs + real(r8), intent(out) :: es ! Saturation vapor pressure (hPa) + real(r8), intent(out) :: qm ! Saturation mass mixing ratio + ! (vapor mass over dry mass, kg/kg) + + call qsat_water(t, p*100._r8, es, qm) + + es = es*0.01_r8 + +end subroutine qsat_hPa + +end module zm_conv diff --git a/src/physics/camdev/zm_conv_intr.F90 b/src/physics/camdev/zm_conv_intr.F90 new file mode 100644 index 0000000000..893536c076 --- /dev/null +++ b/src/physics/camdev/zm_conv_intr.F90 @@ -0,0 +1,1405 @@ +module zm_conv_intr +!--------------------------------------------------------------------------------- +! Purpose: +! +! CAM interface to the Zhang-McFarlane deep convection scheme +! +! Author: D.B. Coleman +! January 2010 modified by J. Kay to add COSP simulator fields to physics buffer +!--------------------------------------------------------------------------------- + use shr_kind_mod, only: r8=>shr_kind_r8 + use physconst, only: cpair + use ppgrid, only: pver, pcols, pverp, begchunk, endchunk + use zm_conv, only: zm_conv_evap, zm_convr, convtran, momtran + use zm_microphysics, only: zm_aero_t, zm_conv_t + use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num, rad_cnst_get_aer_mmr, & + rad_cnst_get_aer_props, rad_cnst_get_mode_props !, & + use ndrop_bam, only: ndrop_bam_init + use cam_abortutils, only: endrun + use physconst, only: pi + use spmd_utils, only: masterproc + use perf_mod + use cam_logfile, only: iulog + use constituents, only: cnst_add + + implicit none + private + save + + ! Public methods + + public ::& + zm_conv_register, &! register fields in physics buffer + zm_conv_readnl, &! read namelist + zm_conv_init, &! initialize donner_deep module + zm_conv_tend, &! return tendencies + zm_conv_tend_2 ! return tendencies + + public :: zmconv_microp + + integer ::& ! indices for fields in the physics buffer + zm_mu_idx, & + zm_eu_idx, & + zm_du_idx, & + zm_md_idx, & + zm_ed_idx, & + zm_dp_idx, & + zm_dsubcld_idx, & + zm_jt_idx, & + zm_maxg_idx, & + zm_ideep_idx, & + dp_flxprc_idx, & + dp_flxsnw_idx, & + dp_cldliq_idx, & + ixorg, & + dp_cldice_idx, & + dlfzm_idx, & ! detrained convective cloud water mixing ratio. + difzm_idx, & ! detrained convective cloud ice mixing ratio. + dnlfzm_idx, & ! detrained convective cloud water num concen. + dnifzm_idx, & ! detrained convective cloud ice num concen. + prec_dp_idx, & + snow_dp_idx, & + mconzm_idx ! convective mass flux (Adam's reorder) + + + real(r8), parameter :: unset_r8 = huge(1.0_r8) + real(r8) :: zmconv_c0_lnd = unset_r8 + real(r8) :: zmconv_c0_ocn = unset_r8 + real(r8) :: zmconv_ke = unset_r8 + real(r8) :: zmconv_ke_lnd = unset_r8 + real(r8) :: zmconv_momcu = unset_r8 + real(r8) :: zmconv_momcd = unset_r8 + integer :: zmconv_num_cin ! Number of negative buoyancy regions that are allowed + ! before the convection top and CAPE calculations are completed. + logical :: zmconv_org ! Parameterization for sub-grid scale convective organization for the ZM deep + ! convective scheme based on Mapes and Neale (2011) + logical :: zmconv_microp = .false. ! switch for microphysics + + +! indices for fields in the physics buffer + integer :: cld_idx = 0 + integer :: icwmrdp_idx = 0 + integer :: rprddp_idx = 0 + integer :: fracis_idx = 0 + integer :: nevapr_dpcu_idx = 0 + integer :: dgnum_idx = 0 + + integer :: nmodes + integer :: nbulk + + type(zm_aero_t), allocatable :: aero(:) ! object contains information about the aerosols + +!========================================================================================= +contains +!========================================================================================= + +subroutine zm_conv_register + +!---------------------------------------- +! Purpose: register fields with the physics buffer +!---------------------------------------- + + use physics_buffer, only : pbuf_add_field, dtype_r8, dtype_i4 + + implicit none + + integer idx + + call pbuf_add_field('ZM_MU', 'physpkg', dtype_r8, (/pcols,pver/), zm_mu_idx) + call pbuf_add_field('ZM_EU', 'physpkg', dtype_r8, (/pcols,pver/), zm_eu_idx) + call pbuf_add_field('ZM_DU', 'physpkg', dtype_r8, (/pcols,pver/), zm_du_idx) + call pbuf_add_field('ZM_MD', 'physpkg', dtype_r8, (/pcols,pver/), zm_md_idx) + call pbuf_add_field('ZM_ED', 'physpkg', dtype_r8, (/pcols,pver/), zm_ed_idx) + + ! wg layer thickness in mbs (between upper/lower interface). + call pbuf_add_field('ZM_DP', 'physpkg', dtype_r8, (/pcols,pver/), zm_dp_idx) + + ! wg layer thickness in mbs between lcl and maxi. + call pbuf_add_field('ZM_DSUBCLD', 'physpkg', dtype_r8, (/pcols/), zm_dsubcld_idx) + + ! wg top level index of deep cumulus convection. + call pbuf_add_field('ZM_JT', 'physpkg', dtype_i4, (/pcols/), zm_jt_idx) + + ! wg gathered values of maxi. + call pbuf_add_field('ZM_MAXG', 'physpkg', dtype_i4, (/pcols/), zm_maxg_idx) + + ! map gathered points to chunk index + call pbuf_add_field('ZM_IDEEP', 'physpkg', dtype_i4, (/pcols/), zm_ideep_idx) + +! Flux of precipitation from deep convection (kg/m2/s) + call pbuf_add_field('DP_FLXPRC','global',dtype_r8,(/pcols,pverp/),dp_flxprc_idx) + +! Flux of snow from deep convection (kg/m2/s) + call pbuf_add_field('DP_FLXSNW','global',dtype_r8,(/pcols,pverp/),dp_flxsnw_idx) + +! deep gbm cloud liquid water (kg/kg) + call pbuf_add_field('DP_CLDLIQ','global',dtype_r8,(/pcols,pver/), dp_cldliq_idx) + +! deep gbm cloud liquid water (kg/kg) + call pbuf_add_field('DP_CLDICE','global',dtype_r8,(/pcols,pver/), dp_cldice_idx) + + call pbuf_add_field('ICWMRDP', 'physpkg',dtype_r8,(/pcols,pver/),icwmrdp_idx) + call pbuf_add_field('RPRDDP', 'physpkg',dtype_r8,(/pcols,pver/),rprddp_idx) + call pbuf_add_field('NEVAPR_DPCU','physpkg',dtype_r8,(/pcols,pver/),nevapr_dpcu_idx) + call pbuf_add_field('PREC_DP', 'physpkg',dtype_r8,(/pcols/), prec_dp_idx) + call pbuf_add_field('SNOW_DP', 'physpkg',dtype_r8,(/pcols/), snow_dp_idx) + + ! detrained convective cloud water mixing ratio. + call pbuf_add_field('DLFZM', 'physpkg', dtype_r8, (/pcols,pver/), dlfzm_idx) + ! detrained convective cloud ice mixing ratio. + call pbuf_add_field('DIFZM', 'physpkg', dtype_r8, (/pcols,pver/), difzm_idx) + ! convective mass fluxes + call pbuf_add_field('CMFMCDZM', 'physpkg', dtype_r8, (/pcols,pverp/), mconzm_idx) + + if (zmconv_microp) then + ! Only add the number conc fields if the microphysics is active. + + ! detrained convective cloud water num concen. + call pbuf_add_field('DNLFZM', 'physpkg', dtype_r8, (/pcols,pver/), dnlfzm_idx) + ! detrained convective cloud ice num concen. + call pbuf_add_field('DNIFZM', 'physpkg', dtype_r8, (/pcols,pver/), dnifzm_idx) + end if + + if (zmconv_org) then + call cnst_add('ZM_ORG',0._r8,0._r8,0._r8,ixorg,longname='organization parameter') + endif + +end subroutine zm_conv_register + +!========================================================================================= + +subroutine zm_conv_readnl(nlfile) + + use spmd_utils, only: mpicom, masterproc, masterprocid, mpi_real8, mpi_integer, mpi_logical + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + character(len=*), parameter :: subname = 'zm_conv_readnl' + + namelist /zmconv_nl/ zmconv_c0_lnd, zmconv_c0_ocn, zmconv_num_cin, & + zmconv_ke, zmconv_ke_lnd, zmconv_org, & + zmconv_momcu, zmconv_momcd, zmconv_microp + !----------------------------------------------------------------------------- + + if (masterproc) then + unitn = getunit() + open( unitn, file=trim(nlfile), status='old' ) + call find_group_name(unitn, 'zmconv_nl', status=ierr) + if (ierr == 0) then + read(unitn, zmconv_nl, iostat=ierr) + if (ierr /= 0) then + call endrun(subname // ':: ERROR reading namelist') + end if + end if + close(unitn) + call freeunit(unitn) + + end if + + ! Broadcast namelist variables + call mpi_bcast(zmconv_num_cin, 1, mpi_integer, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_num_cin") + call mpi_bcast(zmconv_c0_lnd, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_c0_lnd") + call mpi_bcast(zmconv_c0_ocn, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_c0_ocn") + call mpi_bcast(zmconv_ke, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_ke") + call mpi_bcast(zmconv_ke_lnd, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_ke_lnd") + call mpi_bcast(zmconv_momcu, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_momcu") + call mpi_bcast(zmconv_momcd, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_momcd") + call mpi_bcast(zmconv_org, 1, mpi_logical, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_org") + call mpi_bcast(zmconv_microp, 1, mpi_logical, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_microp") + +end subroutine zm_conv_readnl + +!========================================================================================= + +subroutine zm_conv_init(pref_edge) + +!---------------------------------------- +! Purpose: declare output fields, initialize variables needed by convection +!---------------------------------------- + + use cam_history, only: addfld, add_default, horiz_only + use ppgrid, only: pcols, pver + use zm_conv, only: zm_convi + use pmgrid, only: plev,plevp + use spmd_utils, only: masterproc + use phys_control, only: phys_deepconv_pbl, phys_getopts, cam_physpkg_is + use physics_buffer, only: pbuf_get_index + + implicit none + + real(r8),intent(in) :: pref_edge(plevp) ! reference pressures at interfaces + + + logical :: no_deep_pbl ! if true, no deep convection in PBL + integer limcnv ! top interface level limit for convection + integer k, istat + logical :: history_budget ! output tendencies and state variables for CAM4 + ! temperature, water vapor, cloud ice and cloud + ! liquid budgets. + integer :: history_budget_histfile_num ! output history file number for budget fields + +! Allocate the basic aero structure outside the zmconv_microp logical +! This allows the aero structure to be passed +! Note that all of the arrays inside this structure are conditionally allocated + + allocate(aero(begchunk:endchunk)) + +! +! Register fields with the output buffer +! + + if (zmconv_org) then + call addfld ('ZM_ORG ', (/ 'lev' /), 'A', '- ','Organization parameter') + call addfld ('ZM_ORG2D ', (/ 'lev' /), 'A', '- ','Organization parameter 2D') + endif + call addfld ('PRECZ', horiz_only, 'A', 'm/s','total precipitation from ZM convection') + call addfld ('ZMDT', (/ 'lev' /), 'A', 'K/s','T tendency - Zhang-McFarlane moist convection') + call addfld ('ZMDQ', (/ 'lev' /), 'A', 'kg/kg/s','Q tendency - Zhang-McFarlane moist convection') + call addfld ('ZMDICE', (/ 'lev' /), 'A', 'kg/kg/s','Cloud ice tendency - Zhang-McFarlane convection') + call addfld ('ZMDLIQ', (/ 'lev' /), 'A', 'kg/kg/s','Cloud liq tendency - Zhang-McFarlane convection') + call addfld ('EVAPTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Evaporation/snow prod from Zhang convection') + call addfld ('FZSNTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Rain to snow conversion from Zhang convection') + call addfld ('EVSNTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Snow to rain prod from Zhang convection') + call addfld ('EVAPQZM', (/ 'lev' /), 'A', 'kg/kg/s','Q tendency - Evaporation from Zhang-McFarlane moist convection') + + call addfld ('ZMFLXPRC', (/ 'ilev' /), 'A', 'kg/m2/s','Flux of precipitation from ZM convection' ) + call addfld ('ZMFLXSNW', (/ 'ilev' /), 'A', 'kg/m2/s','Flux of snow from ZM convection' ) + call addfld ('ZMNTPRPD', (/ 'lev' /) , 'A', 'kg/kg/s','Net precipitation production from ZM convection') + call addfld ('ZMNTSNPD', (/ 'lev' /) , 'A', 'kg/kg/s','Net snow production from ZM convection' ) + call addfld ('ZMEIHEAT', (/ 'lev' /) , 'A', 'W/kg' ,'Heating by ice and evaporation in ZM convection') + + call addfld ('CMFMCDZM', (/ 'ilev' /), 'A', 'kg/m2/s','Convection mass flux from ZM deep ') + call addfld ('PRECCDZM', horiz_only, 'A', 'm/s','Convective precipitation rate from ZM deep') + + call addfld ('PCONVB', horiz_only , 'A', 'Pa' ,'convection base pressure') + call addfld ('PCONVT', horiz_only , 'A', 'Pa' ,'convection top pressure') + + call addfld ('CAPE', horiz_only, 'A', 'J/kg', 'Convectively available potential energy') + call addfld ('FREQZM', horiz_only , 'A', 'fraction', 'Fractional occurance of ZM convection') + +! RBN: Output variables for more detailed ZM analysis (+dynamica parcel and tau) + + call addfld ('TAUZM', horiz_only, 'A', '/s ', 'ZM deep convection timescale') + call addfld ('WINCLD', (/ 'lev' /), 'A', 'm/s ', 'Deep convective in-cloud vertical velocity') + call addfld ('KEPAR', (/ 'lev' /), 'A', 'J/kg ', 'Convective parcel kinetic energy') + call addfld ('BUOY', (/ 'lev' /), 'A', 'K ', 'Buoyancy as temperature') + + call addfld ('MWINCLD', horiz_only,'A','m/s ', 'Deep convective mean in-cloud vertical velocity') + call addfld ('HMAX', horiz_only,'A','unitless', 'Moist Static energy maximum') + call addfld ('LCL', horiz_only,'A','unitless', 'Lifting condensation model level index') + call addfld ('LEL', horiz_only,'A','unitless', 'Convective top negative buoyancy level index') + call addfld ('KHMAX', horiz_only,'A','unitless', 'Moist Static energy maximum level index') + call addfld ('TLCL', horiz_only,'A','K ', 'Temperature at the lifting condensation level') + call addfld ('PLCL', horiz_only,'A','K ', 'Pressure at the lifting condensation level') + +!!!! + + call addfld ('ZMMTT', (/ 'lev' /), 'A', 'K/s', 'T tendency - ZM convective momentum transport') + call addfld ('ZMMTU', (/ 'lev' /), 'A', 'm/s2', 'U tendency - ZM convective momentum transport') + call addfld ('ZMMTV', (/ 'lev' /), 'A', 'm/s2', 'V tendency - ZM convective momentum transport') + + call addfld ('ZMMU', (/ 'lev' /), 'A', 'kg/m2/s', 'ZM convection updraft mass flux') + call addfld ('ZMMD', (/ 'lev' /), 'A', 'kg/m2/s', 'ZM convection downdraft mass flux') + + call addfld ('ZMUPGU', (/ 'lev' /), 'A', 'm/s2', 'zonal force from ZM updraft pressure gradient term') + call addfld ('ZMUPGD', (/ 'lev' /), 'A', 'm/s2', 'zonal force from ZM downdraft pressure gradient term') + call addfld ('ZMVPGU', (/ 'lev' /), 'A', 'm/s2', 'meridional force from ZM updraft pressure gradient term') + call addfld ('ZMVPGD', (/ 'lev' /), 'A', 'm/s2', 'merdional force from ZM downdraft pressure gradient term') + + call addfld ('ZMICUU', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud U updrafts') + call addfld ('ZMICUD', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud U downdrafts') + call addfld ('ZMICVU', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud V updrafts') + call addfld ('ZMICVD', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud V downdrafts') + + call addfld ('DIFZM' ,(/ 'lev' /), 'A','kg/kg/s ','Detrained ice water from ZM convection') + call addfld ('DLFZM' ,(/ 'lev' /), 'A','kg/kg/s ','Detrained liquid water from ZM convection') + + call phys_getopts( history_budget_out = history_budget, & + history_budget_histfile_num_out = history_budget_histfile_num) + + if (zmconv_org) then + call add_default('ZM_ORG', 1, ' ') + call add_default('ZM_ORG2D', 1, ' ') + endif + if ( history_budget ) then + call add_default('EVAPTZM ', history_budget_histfile_num, ' ') + call add_default('EVAPQZM ', history_budget_histfile_num, ' ') + call add_default('ZMDT ', history_budget_histfile_num, ' ') + call add_default('ZMDQ ', history_budget_histfile_num, ' ') + call add_default('ZMDLIQ ', history_budget_histfile_num, ' ') + call add_default('ZMDICE ', history_budget_histfile_num, ' ') + call add_default('ZMMTT ', history_budget_histfile_num, ' ') + end if + + if (zmconv_microp) then + call add_default ('DIFZM', 1, ' ') + call add_default ('DLFZM', 1, ' ') + end if +! +! Limit deep convection to regions below 40 mb +! Note this calculation is repeated in the shallow convection interface +! + limcnv = 0 ! null value to check against below + if (pref_edge(1) >= 4.e3_r8) then + limcnv = 1 + else + do k=1,plev + if (pref_edge(k) < 4.e3_r8 .and. pref_edge(k+1) >= 4.e3_r8) then + limcnv = k + exit + end if + end do + if ( limcnv == 0 ) limcnv = plevp + end if + + if (masterproc) then + write(iulog,*)'ZM_CONV_INIT: Deep convection will be capped at intfc ',limcnv, & + ' which is ',pref_edge(limcnv),' pascals' + end if + + no_deep_pbl = phys_deepconv_pbl() + call zm_convi(limcnv,zmconv_c0_lnd, zmconv_c0_ocn, zmconv_ke, zmconv_ke_lnd, & + zmconv_momcu, zmconv_momcd, zmconv_num_cin, zmconv_org, & + zmconv_microp, no_deep_pbl_in = no_deep_pbl) + + cld_idx = pbuf_get_index('CLD') + fracis_idx = pbuf_get_index('FRACIS') + + if (zmconv_microp) call zm_conv_micro_init() + +end subroutine zm_conv_init +!========================================================================================= +!subroutine zm_conv_tend(state, ptend, tdt) + +subroutine zm_conv_tend(pblh ,mcon ,cme , & + tpert ,pflx ,zdu , & + rliq ,rice ,ztodt , & + jctop ,jcbot , & + state ,ptend_all ,landfrac, pbuf) + + + use cam_history, only: outfld + use physics_types, only: physics_state, physics_ptend + use physics_types, only: physics_ptend_init, physics_update + use physics_types, only: physics_state_copy, physics_state_dealloc + use physics_types, only: physics_ptend_sum, physics_ptend_dealloc + + use phys_grid, only: get_lat_p, get_lon_p + use time_manager, only: get_nstep, is_first_step + use physics_buffer, only : pbuf_get_field, physics_buffer_desc, pbuf_old_tim_idx + use constituents, only: pcnst, cnst_get_ind, cnst_is_convtran1 + use check_energy, only: check_energy_chng + use physconst, only: gravit + use phys_control, only: cam_physpkg_is + + ! Arguments + + type(physics_state), intent(in),target :: state ! Physics state variables + type(physics_ptend), intent(out) :: ptend_all ! individual parameterization tendencies + type(physics_buffer_desc), pointer :: pbuf(:) + + real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) + real(r8), intent(in) :: pblh(pcols) ! Planetary boundary layer height + real(r8), intent(in) :: tpert(pcols) ! Thermal temperature excess + real(r8), intent(in) :: landfrac(pcols) ! RBN - Landfrac + + real(r8), intent(out) :: mcon(pcols,pverp) ! Convective mass flux--m sub c + real(r8), intent(out) :: pflx(pcols,pverp) ! scattered precip flux at each level + real(r8), intent(out) :: cme(pcols,pver) ! cmf condensation - evaporation + real(r8), intent(out) :: zdu(pcols,pver) ! detraining mass flux + + real(r8), intent(out) :: rliq(pcols) ! reserved liquid (not yet in cldliq) for energy integrals + real(r8), intent(out) :: rice(pcols) ! reserved ice (not yet in cldice) for energy integrals + + + ! Local variables + + type(zm_conv_t) :: conv + + integer :: i,k,l,m + integer :: ilon ! global longitude index of a column + integer :: ilat ! global latitude index of a column + integer :: nstep + integer :: ixcldice, ixcldliq ! constituent indices for cloud liquid and ice water. + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns + integer :: itim_old ! for physics buffer fields + + real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables + real(r8) :: ntprprd(pcols,pver) ! evap outfld: net precip production in layer + real(r8) :: ntsnprd(pcols,pver) ! evap outfld: net snow production in layer + real(r8) :: tend_s_snwprd (pcols,pver) ! Heating rate of snow production + real(r8) :: tend_s_snwevmlt(pcols,pver) ! Heating rate of evap/melting of snow + real(r8) :: fake_dpdry(pcols,pver) ! used in convtran call + + ! physics types + type(physics_state) :: state1 ! locally modify for evaporation to use, not returned + type(physics_ptend),target :: ptend_loc ! package tendencies + + ! physics buffer fields + real(r8), pointer, dimension(:) :: prec ! total precipitation + real(r8), pointer, dimension(:) :: snow ! snow from ZM convection + real(r8), pointer, dimension(:,:) :: cld + real(r8), pointer, dimension(:,:) :: ql ! wg grid slice of cloud liquid water. + real(r8), pointer, dimension(:,:) :: rprd ! rain production rate + real(r8), pointer, dimension(:,:,:) :: fracis ! fraction of transported species that are insoluble + real(r8), pointer, dimension(:,:) :: evapcdp ! Evaporation of deep convective precipitation + real(r8), pointer, dimension(:,:) :: flxprec ! Convective-scale flux of precip at interfaces (kg/m2/s) + real(r8), pointer, dimension(:,:) :: flxsnow ! Convective-scale flux of snow at interfaces (kg/m2/s) + real(r8), pointer, dimension(:,:) :: dp_cldliq + real(r8), pointer, dimension(:,:) :: dp_cldice + real(r8), pointer :: dlf(:,:) ! detrained convective cloud water mixing ratio. + real(r8), pointer :: dif(:,:) ! detrained convective cloud ice mixing ratio. + real(r8), pointer :: dnlf(:,:) ! detrained convective cloud water num concen. + real(r8), pointer :: dnif(:,:) ! detrained convective cloud ice num concen. + real(r8), pointer :: lambdadpcu(:,:) ! slope of cloud liquid size distr + real(r8), pointer :: mudpcu(:,:) ! width parameter of droplet size distr + real(r8), pointer :: mconzm(:,:) !convective mass fluxes + + real(r8), pointer :: mu(:,:) ! (pcols,pver) + real(r8), pointer :: eu(:,:) ! (pcols,pver) + real(r8), pointer :: du(:,:) ! (pcols,pver) + real(r8), pointer :: md(:,:) ! (pcols,pver) + real(r8), pointer :: ed(:,:) ! (pcols,pver) + real(r8), pointer :: dp(:,:) ! (pcols,pver) + real(r8), pointer :: dsubcld(:) ! (pcols) + integer, pointer :: jt(:) ! (pcols) + integer, pointer :: maxg(:) ! (pcols) + integer, pointer :: ideep(:) ! (pcols) + integer :: lengath + + real(r8) :: jctop(pcols) ! o row of top-of-deep-convection indices passed out. + real(r8) :: jcbot(pcols) ! o row of base of cloud indices passed out. + + real(r8) :: pcont(pcols), pconb(pcols), freqzm(pcols) + + ! history output fields + real(r8) :: cape(pcols) ! w convective available potential energy. + real(r8) :: mu_out(pcols,pver) + real(r8) :: md_out(pcols,pver) + + ! used in momentum transport calculation + real(r8) :: winds(pcols, pver, 2) + real(r8) :: wind_tends(pcols, pver, 2) + real(r8) :: pguall(pcols, pver, 2) + real(r8) :: pgdall(pcols, pver, 2) + real(r8) :: icwu(pcols,pver, 2) + real(r8) :: icwd(pcols,pver, 2) + real(r8) :: seten(pcols, pver) + logical :: l_windt(2) + real(r8) :: tfinal1, tfinal2 + integer :: ii + + real(r8),pointer :: zm_org2d(:,:) + real(r8),pointer :: orgt(:,:), org(:,:) + + logical :: lq(pcnst) + + !---------------------------------------------------------------------- + + ! initialize + lchnk = state%lchnk + ncol = state%ncol + nstep = get_nstep() + + if (zmconv_microp) then + allocate( & + conv%qi(pcols,pver), & + conv%qliq(pcols,pver), & + conv%qice(pcols,pver), & + conv%wu(pcols,pver), & + conv%sprd(pcols,pver), & + conv%qrain(pcols,pver), & + conv%qsnow(pcols,pver), & + conv%qnl(pcols,pver), & + conv%qni(pcols,pver), & + conv%qnr(pcols,pver), & + conv%qns(pcols,pver), & + conv%frz(pcols,pver), & + conv%autolm(pcols,pver), & + conv%accrlm(pcols,pver), & + conv%bergnm(pcols,pver), & + conv%fhtimm(pcols,pver), & + conv%fhtctm(pcols,pver), & + conv%fhmlm (pcols,pver), & + conv%hmpim (pcols,pver), & + conv%accslm(pcols,pver), & + conv%dlfm (pcols,pver), & + conv%autoln(pcols,pver), & + conv%accrln(pcols,pver), & + conv%bergnn(pcols,pver), & + conv%fhtimn(pcols,pver), & + conv%fhtctn(pcols,pver), & + conv%fhmln (pcols,pver), & + conv%accsln(pcols,pver), & + conv%activn(pcols,pver), & + conv%dlfn (pcols,pver), & + conv%autoim(pcols,pver), & + conv%accsim(pcols,pver), & + conv%difm (pcols,pver), & + conv%nuclin(pcols,pver), & + conv%autoin(pcols,pver), & + conv%accsin(pcols,pver), & + conv%hmpin (pcols,pver), & + conv%difn (pcols,pver), & + conv%cmel (pcols,pver), & + conv%cmei (pcols,pver), & + conv%trspcm(pcols,pver), & + conv%trspcn(pcols,pver), & + conv%trspim(pcols,pver), & + conv%trspin(pcols,pver), & + conv%lambdadpcu(pcols,pver), & + conv%mudpcu(pcols,pver), & + conv%dcape(pcols) ) + end if + + ftem = 0._r8 + mu_out(:,:) = 0._r8 + md_out(:,:) = 0._r8 + wind_tends(:ncol,:pver,:) = 0.0_r8 + + call physics_state_copy(state,state1) ! copy state to local state1. + + lq(:) = .FALSE. + lq(1) = .TRUE. + if (zmconv_org) then + lq(ixorg) = .TRUE. + endif + call physics_ptend_init(ptend_loc, state%psetcols, 'zm_convr', ls=.true., lq=lq)! initialize local ptend type + +! +! Associate pointers with physics buffer fields +! + itim_old = pbuf_old_tim_idx() + call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + + call pbuf_get_field(pbuf, icwmrdp_idx, ql ) + call pbuf_get_field(pbuf, rprddp_idx, rprd ) + call pbuf_get_field(pbuf, fracis_idx, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) + call pbuf_get_field(pbuf, nevapr_dpcu_idx, evapcdp ) + call pbuf_get_field(pbuf, prec_dp_idx, prec ) + call pbuf_get_field(pbuf, snow_dp_idx, snow ) + + call pbuf_get_field(pbuf, zm_mu_idx, mu) + call pbuf_get_field(pbuf, zm_eu_idx, eu) + call pbuf_get_field(pbuf, zm_du_idx, du) + call pbuf_get_field(pbuf, zm_md_idx, md) + call pbuf_get_field(pbuf, zm_ed_idx, ed) + call pbuf_get_field(pbuf, zm_dp_idx, dp) + call pbuf_get_field(pbuf, zm_dsubcld_idx, dsubcld) + call pbuf_get_field(pbuf, zm_jt_idx, jt) + call pbuf_get_field(pbuf, zm_maxg_idx, maxg) + call pbuf_get_field(pbuf, zm_ideep_idx, ideep) + + call pbuf_get_field(pbuf, dlfzm_idx, dlf) + call pbuf_get_field(pbuf, difzm_idx, dif) + call pbuf_get_field(pbuf, mconzm_idx, mconzm) + + + if (zmconv_microp) then + call pbuf_get_field(pbuf, dnlfzm_idx, dnlf) + call pbuf_get_field(pbuf, dnifzm_idx, dnif) + else + allocate(dnlf(pcols,pver), dnif(pcols,pver)) + end if + + if (zmconv_microp) then + + if (nmodes > 0) then + + ! Associate pointers with the modes and species that affect the climate + ! (list 0) + + do m = 1, nmodes + call rad_cnst_get_mode_num(0, m, 'a', state, pbuf, aero(lchnk)%num_a(m)%val) + call pbuf_get_field(pbuf, dgnum_idx, aero(lchnk)%dgnum(m)%val, start=(/1,1,m/), kount=(/pcols,pver,1/)) + + do l = 1, aero(lchnk)%nspec(m) + call rad_cnst_get_aer_mmr(0, m, l, 'a', state, pbuf, aero(lchnk)%mmr_a(l,m)%val) + end do + end do + + else if (nbulk > 0) then + + ! Associate pointers with the bulk aerosols that affect the climate + ! (list 0) + + do m = 1, nbulk + call rad_cnst_get_aer_mmr(0, m, state, pbuf, aero(lchnk)%mmr_bulk(m)%val) + end do + + end if + end if + +! +! Begin with Zhang-McFarlane (1996) convection parameterization +! + call t_startf ('zm_convr') + + if (zmconv_org) then + allocate(zm_org2d(pcols,pver)) + org => state%q(:,:,ixorg) + orgt => ptend_loc%q(:,:,ixorg) + endif + + call zm_convr( lchnk ,ncol , & + state%t ,state%q(:,:,1), state%omega, prec ,jctop ,jcbot , & + pblh ,state%zm ,state%phis ,state%zi ,ptend_loc%q(:,:,1) , & + ptend_loc%s , state%pmid ,state%pint ,state%pdel , & + .5_r8*ztodt ,mcon ,cme , cape, & + tpert ,dlf ,pflx ,zdu ,rprd , & + mu, md, du, eu, ed, & + dp, dsubcld, jt, maxg, ideep, & + ql, rliq, landfrac, & + org, orgt, zm_org2d, & + dif, dnlf, dnif, conv, & + aero(lchnk), rice) + + lengath = count(ideep > 0) + + call outfld('CAPE', cape, pcols, lchnk) ! RBN - CAPE output +! +! Output fractional occurance of ZM convection +! + freqzm(:) = 0._r8 + do i = 1,lengath + freqzm(ideep(i)) = 1.0_r8 + end do + call outfld('FREQZM ',freqzm ,pcols ,lchnk ) +! +! Convert mass flux from reported mb/s to kg/m^2/s +! + mcon(:ncol,:pver) = mcon(:ncol,:pver) * 100._r8/gravit + mconzm(:ncol,:pverp) = mcon(:ncol,:pverp) + + !call outfld('CMFMCDZM', mcon, pcols, lchnk) + call outfld('CMFMCDZM', mconzm, pcols, lchnk) + + ! Store upward and downward mass fluxes in un-gathered arrays + ! + convert from mb/s to kg/m^2/s + do i=1,lengath + do k=1,pver + ii = ideep(i) + mu_out(ii,k) = mu(i,k) * 100._r8/gravit + md_out(ii,k) = md(i,k) * 100._r8/gravit + end do + end do + + call outfld('ZMMU', mu_out, pcols, lchnk) + call outfld('ZMMD', md_out, pcols, lchnk) + + ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair + call outfld('ZMDT ',ftem ,pcols ,lchnk ) + call outfld('ZMDQ ',ptend_loc%q(1,1,1) ,pcols ,lchnk ) + call t_stopf ('zm_convr') + + call outfld('DIFZM' ,dif ,pcols, lchnk) + call outfld('DLFZM' ,dlf ,pcols, lchnk) + + if (zmconv_microp) call zm_conv_micro_outfld(conv, dnif, dnlf, lchnk, ncol) + + pcont(:ncol) = state%ps(:ncol) + pconb(:ncol) = state%ps(:ncol) + do i = 1,lengath + if (maxg(i).gt.jt(i)) then + pcont(ideep(i)) = state%pmid(ideep(i),jt(i)) ! gathered array (or jctop ungathered) + pconb(ideep(i)) = state%pmid(ideep(i),maxg(i))! gathered array + endif + ! write(iulog,*) ' pcont, pconb ', pcont(i), pconb(i), cnt(i), cnb(i) + end do + call outfld('PCONVT ',pcont ,pcols ,lchnk ) + call outfld('PCONVB ',pconb ,pcols ,lchnk ) + + call physics_ptend_init(ptend_all, state%psetcols, 'zm_conv_tend') + + ! add tendency from this process to tendencies from other processes + call physics_ptend_sum(ptend_loc,ptend_all, ncol) + + ! update physics state type state1 with ptend_loc + call physics_update(state1, ptend_loc, ztodt) + + ! initialize ptend for next process + lq(:) = .FALSE. + lq(1) = .TRUE. + if (zmconv_org) then + lq(ixorg) = .TRUE. + endif + call physics_ptend_init(ptend_loc, state1%psetcols, 'zm_conv_evap', ls=.true., lq=lq) + + call t_startf ('zm_conv_evap') +! +! Determine the phase of the precipitation produced and add latent heat of fusion +! Evaporate some of the precip directly into the environment (Sundqvist) +! Allow this to use the updated state1 and the fresh ptend_loc type +! heating and specific humidity tendencies produced +! + + call pbuf_get_field(pbuf, dp_flxprc_idx, flxprec ) + call pbuf_get_field(pbuf, dp_flxsnw_idx, flxsnow ) + call pbuf_get_field(pbuf, dp_cldliq_idx, dp_cldliq ) + call pbuf_get_field(pbuf, dp_cldice_idx, dp_cldice ) + dp_cldliq(:ncol,:) = 0._r8 + dp_cldice(:ncol,:) = 0._r8 + + call zm_conv_evap(state1%ncol,state1%lchnk, & + state1%t,state1%pmid,state1%pdel,state1%q(:pcols,:pver,1), & + landfrac, & + ptend_loc%s, tend_s_snwprd, tend_s_snwevmlt, ptend_loc%q(:pcols,:pver,1), & + rprd, cld, ztodt, & + prec, snow, ntprprd, ntsnprd , flxprec, flxsnow, conv%sprd) + + evapcdp(:ncol,:pver) = ptend_loc%q(:ncol,:pver,1) + + if (zmconv_org) then + ptend_loc%q(:ncol,:pver,ixorg) = min(1._r8,max(0._r8,(50._r8*1000._r8*1000._r8*abs(evapcdp(:ncol,:pver))) & + -(state%q(:ncol,:pver,ixorg)/10800._r8))) + ptend_loc%q(:ncol,:pver,ixorg) = (ptend_loc%q(:ncol,:pver,ixorg) - state%q(:ncol,:pver,ixorg))/ztodt + endif + +! +! Write out variables from zm_conv_evap +! + ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair + call outfld('EVAPTZM ',ftem ,pcols ,lchnk ) + ftem(:ncol,:pver) = tend_s_snwprd (:ncol,:pver)/cpair + call outfld('FZSNTZM ',ftem ,pcols ,lchnk ) + ftem(:ncol,:pver) = tend_s_snwevmlt(:ncol,:pver)/cpair + call outfld('EVSNTZM ',ftem ,pcols ,lchnk ) + call outfld('EVAPQZM ',ptend_loc%q(1,1,1) ,pcols ,lchnk ) + call outfld('ZMFLXPRC', flxprec, pcols, lchnk) + call outfld('ZMFLXSNW', flxsnow, pcols, lchnk) + call outfld('ZMNTPRPD', ntprprd, pcols, lchnk) + call outfld('ZMNTSNPD', ntsnprd, pcols, lchnk) + call outfld('ZMEIHEAT', ptend_loc%s, pcols, lchnk) + call outfld('CMFMCDZM ',mcon , pcols ,lchnk ) + call outfld('PRECCDZM ',prec, pcols ,lchnk ) + + + call t_stopf ('zm_conv_evap') + + call outfld('PRECZ ', prec , pcols, lchnk) + + ! add tendency from this process to tend from other processes here + call physics_ptend_sum(ptend_loc,ptend_all, ncol) + + ! update physics state type state1 with ptend_loc + call physics_update(state1, ptend_loc, ztodt) + + + ! Momentum Transport (non-cam3 physics) + + if ( .not. cam_physpkg_is('cam3')) then + + call physics_ptend_init(ptend_loc, state1%psetcols, 'momtran', ls=.true., lu=.true., lv=.true.) + + winds(:ncol,:pver,1) = state1%u(:ncol,:pver) + winds(:ncol,:pver,2) = state1%v(:ncol,:pver) + + l_windt(1) = .true. + l_windt(2) = .true. + + call t_startf ('momtran') + call momtran (lchnk, ncol, & + l_windt,winds, 2, mu, md, & + du, eu, ed, dp, dsubcld, & + jt, maxg, ideep, 1, lengath, & + nstep, wind_tends, pguall, pgdall, icwu, icwd, ztodt, seten ) + call t_stopf ('momtran') + + ptend_loc%u(:ncol,:pver) = wind_tends(:ncol,:pver,1) + ptend_loc%v(:ncol,:pver) = wind_tends(:ncol,:pver,2) + ptend_loc%s(:ncol,:pver) = seten(:ncol,:pver) + + call physics_ptend_sum(ptend_loc,ptend_all, ncol) + + ! update physics state type state1 with ptend_loc + call physics_update(state1, ptend_loc, ztodt) + + ftem(:ncol,:pver) = seten(:ncol,:pver)/cpair + if (zmconv_org) then + call outfld('ZM_ORG', state%q(:,:,ixorg), pcols, lchnk) + call outfld('ZM_ORG2D', zm_org2d, pcols, lchnk) + endif + call outfld('ZMMTT', ftem , pcols, lchnk) + call outfld('ZMMTU', wind_tends(1,1,1), pcols, lchnk) + call outfld('ZMMTV', wind_tends(1,1,2), pcols, lchnk) + + ! Output apparent force from pressure gradient + call outfld('ZMUPGU', pguall(1,1,1), pcols, lchnk) + call outfld('ZMUPGD', pgdall(1,1,1), pcols, lchnk) + call outfld('ZMVPGU', pguall(1,1,2), pcols, lchnk) + call outfld('ZMVPGD', pgdall(1,1,2), pcols, lchnk) + + ! Output in-cloud winds + call outfld('ZMICUU', icwu(1,1,1), pcols, lchnk) + call outfld('ZMICUD', icwd(1,1,1), pcols, lchnk) + call outfld('ZMICVU', icwu(1,1,2), pcols, lchnk) + call outfld('ZMICVD', icwd(1,1,2), pcols, lchnk) + + end if + + ! Transport cloud water and ice only + call cnst_get_ind('CLDLIQ', ixcldliq) + call cnst_get_ind('CLDICE', ixcldice) + + lq(:) = .FALSE. + lq(2:) = cnst_is_convtran1(2:) + call physics_ptend_init(ptend_loc, state1%psetcols, 'convtran1', lq=lq) + + + ! dpdry is not used in this call to convtran since the cloud liquid and ice mixing + ! ratios are moist + fake_dpdry(:,:) = 0._r8 + + call t_startf ('convtran1') + call convtran (lchnk, & + ptend_loc%lq,state1%q, pcnst, mu, md, & + du, eu, ed, dp, dsubcld, & + jt,maxg, ideep, 1, lengath, & + nstep, fracis, ptend_loc%q, fake_dpdry, ztodt) + call t_stopf ('convtran1') + + call outfld('ZMDICE ',ptend_loc%q(1,1,ixcldice) ,pcols ,lchnk ) + call outfld('ZMDLIQ ',ptend_loc%q(1,1,ixcldliq) ,pcols ,lchnk ) + + ! add tendency from this process to tend from other processes here + call physics_ptend_sum(ptend_loc,ptend_all, ncol) + + call physics_state_dealloc(state1) + call physics_ptend_dealloc(ptend_loc) + + if (zmconv_org) then + deallocate(zm_org2d) + end if + + if (zmconv_microp) then + deallocate( & + conv%qi, & + conv%qliq, & + conv%qice, & + conv%wu, & + conv%sprd, & + conv%qrain, & + conv%qsnow, & + conv%qnl, & + conv%qni, & + conv%qnr, & + conv%qns, & + conv%frz, & + conv%autolm, & + conv%accrlm, & + conv%bergnm, & + conv%fhtimm, & + conv%fhtctm, & + conv%fhmlm , & + conv%hmpim , & + conv%accslm, & + conv%dlfm , & + conv%autoln, & + conv%accrln, & + conv%bergnn, & + conv%fhtimn, & + conv%fhtctn, & + conv%fhmln , & + conv%accsln, & + conv%activn, & + conv%dlfn , & + conv%autoim, & + conv%accsim, & + conv%difm , & + conv%nuclin, & + conv%autoin, & + conv%accsin, & + conv%hmpin , & + conv%difn , & + conv%cmel , & + conv%cmei , & + conv%trspcm, & + conv%trspcn, & + conv%trspim, & + conv%trspin, & + conv%lambdadpcu, & + conv%mudpcu, & + conv%dcape ) + + else + + deallocate(dnlf, dnif) + + end if + +end subroutine zm_conv_tend +!========================================================================================= + + +subroutine zm_conv_tend_2( state, ptend, ztodt, pbuf) + + use physics_types, only: physics_state, physics_ptend, physics_ptend_init + use time_manager, only: get_nstep + use physics_buffer, only: pbuf_get_index, pbuf_get_field, physics_buffer_desc + use constituents, only: pcnst, cnst_is_convtran2 + +! Arguments + type(physics_state), intent(in ) :: state ! Physics state variables + type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies + + type(physics_buffer_desc), pointer :: pbuf(:) + + real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) + +! Local variables + integer :: i, lchnk, istat + integer :: lengath ! number of columns with deep convection + integer :: nstep + + real(r8), dimension(pcols,pver) :: dpdry + + ! physics buffer fields + real(r8), pointer :: fracis(:,:,:) ! fraction of transported species that are insoluble + real(r8), pointer :: mu(:,:) ! (pcols,pver) + real(r8), pointer :: eu(:,:) ! (pcols,pver) + real(r8), pointer :: du(:,:) ! (pcols,pver) + real(r8), pointer :: md(:,:) ! (pcols,pver) + real(r8), pointer :: ed(:,:) ! (pcols,pver) + real(r8), pointer :: dp(:,:) ! (pcols,pver) + real(r8), pointer :: dsubcld(:) ! (pcols) + integer, pointer :: jt(:) ! (pcols) + integer, pointer :: maxg(:) ! (pcols) + integer, pointer :: ideep(:) ! (pcols) + !----------------------------------------------------------------------------------- + + + call physics_ptend_init(ptend, state%psetcols, 'convtran2', lq=cnst_is_convtran2 ) + + call pbuf_get_field(pbuf, fracis_idx, fracis) + call pbuf_get_field(pbuf, zm_mu_idx, mu) + call pbuf_get_field(pbuf, zm_eu_idx, eu) + call pbuf_get_field(pbuf, zm_du_idx, du) + call pbuf_get_field(pbuf, zm_md_idx, md) + call pbuf_get_field(pbuf, zm_ed_idx, ed) + call pbuf_get_field(pbuf, zm_dp_idx, dp) + call pbuf_get_field(pbuf, zm_dsubcld_idx, dsubcld) + call pbuf_get_field(pbuf, zm_jt_idx, jt) + call pbuf_get_field(pbuf, zm_maxg_idx, maxg) + call pbuf_get_field(pbuf, zm_ideep_idx, ideep) + + lengath = count(ideep > 0) + + lchnk = state%lchnk + nstep = get_nstep() + + if (any(ptend%lq(:))) then + ! initialize dpdry for call to convtran + ! it is used for tracers of dry mixing ratio type + dpdry = 0._r8 + do i = 1, lengath + dpdry(i,:) = state%pdeldry(ideep(i),:)/100._r8 + end do + + call t_startf ('convtran2') + call convtran (lchnk, & + ptend%lq,state%q, pcnst, mu, md, & + du, eu, ed, dp, dsubcld, & + jt, maxg, ideep, 1, lengath, & + nstep, fracis, ptend%q, dpdry, ztodt) + call t_stopf ('convtran2') + end if + +end subroutine zm_conv_tend_2 + +!========================================================================================= + +subroutine zm_conv_micro_init() + + use cam_history, only: addfld, add_default, horiz_only + use ppgrid, only: pcols, pver + use pmgrid, only: plev,plevp + use phys_control, only: cam_physpkg_is + use physics_buffer, only: pbuf_get_index + use zm_microphysics, only: zm_mphyi + + implicit none + + integer :: i + + ! + ! Register fields with the output buffer + ! + call addfld ('ICIMRDP', (/ 'lev' /), 'A','kg/kg', 'Deep Convection in-cloud ice mixing ratio ') + call addfld ('CLDLIQZM',(/ 'lev' /), 'A','g/m3' ,'Cloud liquid water - ZM convection') + call addfld ('CLDICEZM',(/ 'lev' /), 'A','g/m3' ,'Cloud ice water - ZM convection') + call addfld ('CLIQSNUM',(/ 'lev' /), 'A','1' ,'Cloud liquid water sample number - ZM convection') + call addfld ('CICESNUM',(/ 'lev' /), 'A','1' ,'Cloud ice water sample number - ZM convection') + call addfld ('QRAINZM' ,(/ 'lev' /), 'A','g/m3' ,'rain water - ZM convection') + call addfld ('QSNOWZM' ,(/ 'lev' /), 'A','g/m3' ,'snow - ZM convection') + call addfld ('CRAINNUM',(/ 'lev' /), 'A','1' ,'Cloud rain water sample number - ZM convection') + call addfld ('CSNOWNUM',(/ 'lev' /), 'A','1' ,'Cloud snow sample number - ZM convection') + + call addfld ('DNIFZM' ,(/ 'lev' /), 'A','1/kg/s ' ,'Detrained ice water num concen from ZM convection') + call addfld ('DNLFZM' ,(/ 'lev' /), 'A','1/kg/s ' ,'Detrained liquid water num concen from ZM convection') + call addfld ('WUZM' ,(/ 'lev' /), 'A','m/s' ,'vertical velocity - ZM convection') + call addfld ('WUZMSNUM',(/ 'lev' /), 'A','1' ,'vertical velocity sample number - ZM convection') + + call addfld ('QNLZM',(/ 'lev' /), 'A','1/m3' ,'Cloud liquid water number concen - ZM convection') + call addfld ('QNIZM',(/ 'lev' /), 'A','1/m3' ,'Cloud ice number concen - ZM convection') + call addfld ('QNRZM',(/ 'lev' /), 'A','1/m3' ,'Cloud rain water number concen - ZM convection') + call addfld ('QNSZM',(/ 'lev' /), 'A','1/m3' ,'Cloud snow number concen - ZM convection') + + call addfld ('FRZZM',(/ 'lev' /), 'A','1/s' ,'mass tendency due to freezing - ZM convection') + + call addfld ('AUTOL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to autoconversion of droplets to rain') + call addfld ('ACCRL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of droplets by rain') + call addfld ('BERGN_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to Bergeron process') + call addfld ('FHTIM_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to immersion freezing') + call addfld ('FHTCT_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to contact freezing') + call addfld ('FHML_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to homogeneous freezing of droplet') + call addfld ('HMPI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to HM process') + call addfld ('ACCSL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of droplet by snow') + call addfld ('DLF_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to detrainment of droplet') + call addfld ('COND_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to condensation') + + call addfld ('AUTOL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to autoconversion of droplets to rain') + call addfld ('ACCRL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of droplets by rain') + call addfld ('BERGN_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to Bergeron process') + call addfld ('FHTIM_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to immersion freezing') + call addfld ('FHTCT_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to contact freezing') + call addfld ('FHML_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to homogeneous freezing of droplet') + call addfld ('ACCSL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of droplet by snow') + call addfld ('ACTIV_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to droplets activation') + call addfld ('DLF_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to detrainment of droplet') + + call addfld ('AUTOI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to autoconversion of ice to snow') + call addfld ('ACCSI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of ice by snow') + call addfld ('DIF_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to detrainment of cloud ice') + call addfld ('DEPOS_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to deposition') + + call addfld ('NUCLI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to ice nucleation') + call addfld ('AUTOI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to autoconversion of ice to snow') + call addfld ('ACCSI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of ice by snow') + call addfld ('HMPI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to HM process') + call addfld ('DIF_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to detrainment of cloud ice') + + call addfld ('TRSPC_M' ,(/ 'lev' /), 'A','kg/kg/m','mass tendency of droplets due to convective transport') + call addfld ('TRSPC_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency of droplets due to convective transport') + call addfld ('TRSPI_M' ,(/ 'lev' /), 'A','kg/kg/m','mass tendency of ice crystal due to convective transport') + call addfld ('TRSPI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency of ice crystal due to convective transport') + + + call add_default ('CLDLIQZM', 1, ' ') + call add_default ('CLDICEZM', 1, ' ') + call add_default ('CLIQSNUM', 1, ' ') + call add_default ('CICESNUM', 1, ' ') + call add_default ('DNIFZM', 1, ' ') + call add_default ('DNLFZM', 1, ' ') + call add_default ('WUZM', 1, ' ') + call add_default ('QRAINZM', 1, ' ') + call add_default ('QSNOWZM', 1, ' ') + call add_default ('CRAINNUM', 1, ' ') + call add_default ('CSNOWNUM', 1, ' ') + call add_default ('QNLZM', 1, ' ') + call add_default ('QNIZM', 1, ' ') + call add_default ('QNRZM', 1, ' ') + call add_default ('QNSZM', 1, ' ') + call add_default ('FRZZM', 1, ' ') + + ! Initialization for the microphysics + + call zm_mphyi() + + ! Initialize the aerosol object with data from the modes/species + ! affecting climate, + ! i.e., the list index is hardcoded to 0. + + call rad_cnst_get_info(0, nmodes=nmodes, naero=nbulk) + + + do i = begchunk, endchunk + call zm_aero_init(nmodes, nbulk, aero(i)) + end do + + if (nmodes > 0) then + + dgnum_idx = pbuf_get_index('DGNUM') + + else if (nbulk > 0 .and. cam_physpkg_is('cam4')) then + + ! This call is needed to allow running the ZM microphysics with the + ! cam4 physics package. + call ndrop_bam_init() + + end if + + end subroutine zm_conv_micro_init + + + subroutine zm_aero_init(nmodes, nbulk, aero) + + use pmgrid, only: plev,plevp + + ! Initialize the zm_aero_t object for modal aerosols + + integer, intent(in) :: nmodes + integer, intent(in) :: nbulk + type(zm_aero_t), intent(out) :: aero + + integer :: iaer, l, m + integer :: nspecmx ! max number of species in a mode + + character(len=20), allocatable :: aername(:) + character(len=32) :: str32 + character(len=*), parameter :: routine = 'zm_conv_init' + + real(r8) :: sigmag, dgnumlo, dgnumhi + real(r8) :: alnsg + !---------------------------------------------------------------------------------- + + aero%nmodes = nmodes + aero%nbulk = nbulk + + if (nmodes > 0) then + + ! Initialize the modal aerosol information + + aero%scheme = 'modal' + + ! Get number of species in each mode, and find max. + allocate(aero%nspec(aero%nmodes)) + nspecmx = 0 + do m = 1, aero%nmodes + + call rad_cnst_get_info(0, m, nspec=aero%nspec(m), mode_type=str32) + + nspecmx = max(nspecmx, aero%nspec(m)) + + ! save mode index for specified mode types + select case (trim(str32)) + case ('accum') + aero%mode_accum_idx = m + case ('aitken') + aero%mode_aitken_idx = m + case ('coarse') + aero%mode_coarse_idx = m + end select + + end do + + ! Check that required mode types were found + if (aero%mode_accum_idx == -1 .or. aero%mode_aitken_idx == -1 .or. aero%mode_coarse_idx == -1) then + write(iulog,*) routine//': ERROR required mode type not found - mode idx:', & + aero%mode_accum_idx, aero%mode_aitken_idx, aero%mode_coarse_idx + call endrun(routine//': ERROR required mode type not found') + end if + + ! find indices for the dust and seasalt species in the coarse mode + do l = 1, aero%nspec(aero%mode_coarse_idx) + call rad_cnst_get_info(0, aero%mode_coarse_idx, l, spec_type=str32) + select case (trim(str32)) + case ('dust') + aero%coarse_dust_idx = l + case ('seasalt') + aero%coarse_nacl_idx = l + end select + end do + ! Check that required modal specie types were found + if (aero%coarse_dust_idx == -1 .or. aero%coarse_nacl_idx == -1) then + write(iulog,*) routine//': ERROR required mode-species type not found - indicies:', & + aero%coarse_dust_idx, aero%coarse_nacl_idx + call endrun(routine//': ERROR required mode-species type not found') + end if + + allocate( & + aero%num_a(nmodes), & + aero%mmr_a(nspecmx,nmodes), & + aero%numg_a(pcols,pver,nmodes), & + aero%mmrg_a(pcols,pver,nspecmx,nmodes), & + aero%voltonumblo(nmodes), & + aero%voltonumbhi(nmodes), & + aero%specdens(nspecmx,nmodes), & + aero%spechygro(nspecmx,nmodes), & + aero%dgnum(nmodes), & + aero%dgnumg(pcols,pver,nmodes) ) + + + do m = 1, nmodes + + ! Properties of modes + call rad_cnst_get_mode_props(0, m, & + sigmag=sigmag, dgnumlo=dgnumlo, dgnumhi=dgnumhi) + + alnsg = log(sigmag) + aero%voltonumblo(m) = 1._r8 / ( (pi/6._r8)*(dgnumlo**3._r8)*exp(4.5_r8*alnsg**2._r8) ) + aero%voltonumbhi(m) = 1._r8 / ( (pi/6._r8)*(dgnumhi**3._r8)*exp(4.5_r8*alnsg**2._r8) ) + + ! save sigmag of aitken mode + if (m == aero%mode_aitken_idx) aero%sigmag_aitken = sigmag + + ! Properties of modal species + do l = 1, aero%nspec(m) + call rad_cnst_get_aer_props(0, m, l, density_aer=aero%specdens(l,m), & + hygro_aer=aero%spechygro(l,m)) + end do + end do + + else if (nbulk > 0) then + + aero%scheme = 'bulk' + + ! Props needed for BAM number concentration calcs. + allocate( & + aername(nbulk), & + aero%num_to_mass_aer(nbulk), & + aero%mmr_bulk(nbulk), & + aero%mmrg_bulk(pcols,plev,nbulk) ) + + do iaer = 1, aero%nbulk + call rad_cnst_get_aer_props(0, iaer, & + aername = aername(iaer), & + num_to_mass_aer = aero%num_to_mass_aer(iaer) ) + + ! Look for sulfate aerosol in this list (Bulk aerosol only) + if (trim(aername(iaer)) == 'SULFATE') aero%idxsul = iaer + if (trim(aername(iaer)) == 'DUST1') aero%idxdst1 = iaer + if (trim(aername(iaer)) == 'DUST2') aero%idxdst2 = iaer + if (trim(aername(iaer)) == 'DUST3') aero%idxdst3 = iaer + if (trim(aername(iaer)) == 'DUST4') aero%idxdst4 = iaer + if (trim(aername(iaer)) == 'BCPHI') aero%idxbcphi = iaer + end do + + end if + + end subroutine zm_aero_init + + subroutine zm_conv_micro_outfld(conv, dnif, dnlf, lchnk, ncol) + + use cam_history, only: outfld + + type(zm_conv_t),intent(in) :: conv + real(r8), intent(in) :: dnlf(:,:) ! detrained convective cloud water num concen. + real(r8), intent(in) :: dnif(:,:) ! detrained convective cloud ice num concen. + integer, intent(in) :: lchnk + integer, intent(in) :: ncol + + integer :: i,k + + real(r8) :: cice_snum(pcols,pver) ! convective cloud ice sample number. + real(r8) :: cliq_snum(pcols,pver) ! convective cloud liquid sample number. + real(r8) :: crain_snum(pcols,pver) ! convective rain water sample number. + real(r8) :: csnow_snum(pcols,pver) ! convective snow sample number. + real(r8) :: wu_snum(pcols,pver) ! vertical velocity sample number + + real(r8) :: qni_snum(pcols,pver) ! convective cloud ice number sample number. + real(r8) :: qnl_snum(pcols,pver) ! convective cloud liquid number sample number. + + do k = 1,pver + do i = 1,ncol + if (conv%qice(i,k) .gt. 0.0_r8) then + cice_snum(i,k) = 1.0_r8 + else + cice_snum(i,k) = 0.0_r8 + end if + if (conv%qliq(i,k) .gt. 0.0_r8) then + cliq_snum(i,k) = 1.0_r8 + else + cliq_snum(i,k) = 0.0_r8 + end if + if (conv%qsnow(i,k) .gt. 0.0_r8) then + csnow_snum(i,k) = 1.0_r8 + else + csnow_snum(i,k) = 0.0_r8 + end if + if (conv%qrain(i,k) .gt. 0.0_r8) then + crain_snum(i,k) = 1.0_r8 + else + crain_snum(i,k) = 0.0_r8 + end if + + if (conv%qnl(i,k) .gt. 0.0_r8) then + qnl_snum(i,k) = 1.0_r8 + else + qnl_snum(i,k) = 0.0_r8 + end if + if (conv%qni(i,k) .gt. 0.0_r8) then + qni_snum(i,k) = 1.0_r8 + else + qni_snum(i,k) = 0.0_r8 + end if + if (conv%wu(i,k) .gt. 0.0_r8) then + wu_snum(i,k) = 1.0_r8 + else + wu_snum(i,k) = 0.0_r8 + end if + + end do + end do + + call outfld('ICIMRDP ',conv%qi ,pcols, lchnk ) + call outfld('CLDLIQZM',conv%qliq ,pcols, lchnk) + call outfld('CLDICEZM',conv%qice ,pcols, lchnk) + call outfld('CLIQSNUM',cliq_snum ,pcols, lchnk) + call outfld('CICESNUM',cice_snum ,pcols, lchnk) + call outfld('QRAINZM' ,conv%qrain ,pcols, lchnk) + call outfld('QSNOWZM' ,conv%qsnow ,pcols, lchnk) + call outfld('CRAINNUM',crain_snum ,pcols, lchnk) + call outfld('CSNOWNUM',csnow_snum ,pcols, lchnk) + + call outfld('WUZM' ,conv%wu ,pcols, lchnk) + call outfld('WUZMSNUM',wu_snum ,pcols, lchnk) + call outfld('QNLZM' ,conv%qnl ,pcols, lchnk) + call outfld('QNIZM' ,conv%qni ,pcols, lchnk) + call outfld('QNRZM' ,conv%qnr ,pcols, lchnk) + call outfld('QNSZM' ,conv%qns ,pcols, lchnk) + call outfld('FRZZM' ,conv%frz ,pcols, lchnk) + + call outfld('AUTOL_M' ,conv%autolm ,pcols, lchnk) + call outfld('ACCRL_M' ,conv%accrlm ,pcols, lchnk) + call outfld('BERGN_M' ,conv%bergnm ,pcols, lchnk) + call outfld('FHTIM_M' ,conv%fhtimm ,pcols, lchnk) + call outfld('FHTCT_M' ,conv%fhtctm ,pcols, lchnk) + call outfld('FHML_M' ,conv%fhmlm ,pcols, lchnk) + call outfld('HMPI_M' ,conv%hmpim ,pcols, lchnk) + call outfld('ACCSL_M' ,conv%accslm ,pcols, lchnk) + call outfld('DLF_M' ,conv%dlfm ,pcols, lchnk) + + call outfld('AUTOL_N' ,conv%autoln ,pcols, lchnk) + call outfld('ACCRL_N' ,conv%accrln ,pcols, lchnk) + call outfld('BERGN_N' ,conv%bergnn ,pcols, lchnk) + call outfld('FHTIM_N' ,conv%fhtimn ,pcols, lchnk) + call outfld('FHTCT_N' ,conv%fhtctn ,pcols, lchnk) + call outfld('FHML_N' ,conv%fhmln ,pcols, lchnk) + call outfld('ACCSL_N' ,conv%accsln ,pcols, lchnk) + call outfld('ACTIV_N' ,conv%activn ,pcols, lchnk) + call outfld('DLF_N' ,conv%dlfn ,pcols, lchnk) + call outfld('AUTOI_M' ,conv%autoim ,pcols, lchnk) + call outfld('ACCSI_M' ,conv%accsim ,pcols, lchnk) + call outfld('DIF_M' ,conv%difm ,pcols, lchnk) + call outfld('NUCLI_N' ,conv%nuclin ,pcols, lchnk) + call outfld('AUTOI_N' ,conv%autoin ,pcols, lchnk) + call outfld('ACCSI_N' ,conv%accsin ,pcols, lchnk) + call outfld('HMPI_N' ,conv%hmpin ,pcols, lchnk) + call outfld('DIF_N' ,conv%difn ,pcols, lchnk) + call outfld('COND_M' ,conv%cmel ,pcols, lchnk) + call outfld('DEPOS_M' ,conv%cmei ,pcols, lchnk) + + call outfld('TRSPC_M' ,conv%trspcm ,pcols, lchnk) + call outfld('TRSPC_N' ,conv%trspcn ,pcols, lchnk) + call outfld('TRSPI_M' ,conv%trspim ,pcols, lchnk) + call outfld('TRSPI_N' ,conv%trspin ,pcols, lchnk) + call outfld('DNIFZM' ,dnif ,pcols, lchnk) + call outfld('DNLFZM' ,dnlf ,pcols, lchnk) + + end subroutine zm_conv_micro_outfld + +end module zm_conv_intr From 095d1274771c942a7c69addc0f85557dd78563e1 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 12 Aug 2021 14:14:05 -0600 Subject: [PATCH 029/466] switched directory to cam_dev --- bld/configure | 2 +- src/dynamics/eul/dyn_comp.F90 | 6 ++++-- src/physics/{camdev => cam_dev}/check_energy.F90 | 0 src/physics/{camdev => cam_dev}/physpkg.F90 | 0 src/physics/{camdev => cam_dev}/zm_conv.F90 | 0 src/physics/{camdev => cam_dev}/zm_conv_intr.F90 | 0 6 files changed, 5 insertions(+), 3 deletions(-) rename src/physics/{camdev => cam_dev}/check_energy.F90 (100%) rename src/physics/{camdev => cam_dev}/physpkg.F90 (100%) rename src/physics/{camdev => cam_dev}/zm_conv.F90 (100%) rename src/physics/{camdev => cam_dev}/zm_conv_intr.F90 (100%) diff --git a/bld/configure b/bld/configure index ef263c4114..f8a97af183 100755 --- a/bld/configure +++ b/bld/configure @@ -2108,7 +2108,7 @@ sub write_filepath print $fh "$camsrcdir/src/unit_drivers/${offline_drv}\n"; if ($camdev_phys) { - print $fh "$camsrcdir/src/physics/camdev\n"; + print $fh "$camsrcdir/src/physics/cam_dev\n"; } if ($simple_phys) { diff --git a/src/dynamics/eul/dyn_comp.F90 b/src/dynamics/eul/dyn_comp.F90 index 1726b35f1b..05b967b397 100644 --- a/src/dynamics/eul/dyn_comp.F90 +++ b/src/dynamics/eul/dyn_comp.F90 @@ -837,8 +837,10 @@ subroutine process_inidat(fieldname, m_cnst, fh) ret = pio_inq_varid(fh, cnst_name(m_cnst), varid) ret = pio_get_att(fh, varid, 'units', trunits) if (trunits(1:5) .ne. 'KG/KG' .and. trunits(1:5) .ne. 'kg/kg') then - call endrun(sub//': ERROR: Units for tracer ' & - //trim(cnst_name(m_cnst))//' must be in KG/KG') +!+++ARH +! call endrun(sub//': ERROR: Units for tracer ' & +! //trim(cnst_name(m_cnst))//' must be in KG/KG') +!---ARH end if else if (.not. analytic_ic_active()) then diff --git a/src/physics/camdev/check_energy.F90 b/src/physics/cam_dev/check_energy.F90 similarity index 100% rename from src/physics/camdev/check_energy.F90 rename to src/physics/cam_dev/check_energy.F90 diff --git a/src/physics/camdev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 similarity index 100% rename from src/physics/camdev/physpkg.F90 rename to src/physics/cam_dev/physpkg.F90 diff --git a/src/physics/camdev/zm_conv.F90 b/src/physics/cam_dev/zm_conv.F90 similarity index 100% rename from src/physics/camdev/zm_conv.F90 rename to src/physics/cam_dev/zm_conv.F90 diff --git a/src/physics/camdev/zm_conv_intr.F90 b/src/physics/cam_dev/zm_conv_intr.F90 similarity index 100% rename from src/physics/camdev/zm_conv_intr.F90 rename to src/physics/cam_dev/zm_conv_intr.F90 From 07c14c121c43d2d6991242482ee21afa8bb106e9 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 13 Aug 2021 15:39:34 -0600 Subject: [PATCH 030/466] fixed bug in cam64 so it runs with zm off --- bld/namelist_files/namelist_definition.xml | 67 ++++++++++++++++++++++ src/physics/cam/ref_pres.F90 | 5 +- src/physics/cam_dev/physpkg.F90 | 11 +++- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 0cf7d84012..601c1ac2a1 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5122,6 +5122,73 @@ Force scam to use the lat lon fields specified in the scam namelist not what is Default: FALSE + +SCAM to calculate or read tendencies from a global ana/dycore +Default: FALSE + + + +Use 1st order upwind for ana tendencies (instead of 2nd order space centered) +Default: FALSE + + + +Use scam state as center column in stencil for ana adv tendencies +Default: FALSE + + + +Use scam state as center column in stencil for ana adv tendencies +Default: FALSE + + + +Use scam state as center column in stencil for ana adv tendencies +Default: FALSE + + + +Use scam state as center column in stencil for ana adv tendencies +Default: FALSE + + + +Force scam to use tendencies directly from dycore or ana (not recalculated) +Default: FALSE + + + +Force scam to use omega directly from dycore or ana (not recalculated) +Default: FALSE + + + +Interpolate ana fields to constant pressure surfaces +Default: FALSE + + + + +template for analysis forcing dataset. +Default: set by build-namelist. + + + +templatefull path for analysis forcing dataset. +Default: set by build-namelist. + + 0) then + call pbuf_get_field(pbuf, cmfmczm_idx, cmfmczm) + cmfmc(:ncol,:) = cmfmczm + else + cmfmc(:ncol,:) = 0._r8 + end if ! Adjust the surface fluxes to reduce instabilities in near sfc layer if (phys_do_flux_avg()) then From 9cabd92b2c45e5c170f7d21e39d41060189e1e5a Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 26 Aug 2021 19:36:17 -0600 Subject: [PATCH 031/466] implemented mods to forced scam w/ 3D output --- bld/namelist_files/namelist_definition.xml | 6 + .../scam_STUB/scripts/STUB_iop.nc | Bin 0 -> 3376 bytes .../scam_STUB/scripts/make_basecase.auto.csh | 111 ++ .../scam_STUB/scripts/run_cases.csh | 70 + .../usermods_dirs/scam_STUB/shell_commands | 16 + .../usermods_dirs/scam_STUB/user_nl_cam | 41 + src/control/history_scam.F90 | 58 +- src/control/scamMod.F90 | 33 +- src/dynamics/eul/get_ana_dynfrc_4scam.F90 | 1634 +++++++++++++++++ src/dynamics/eul/iop.F90 | 13 + src/dynamics/eul/scmforecast.F90 | 534 +++++- src/physics/cam/iop_forcing.F90 | 13 + src/utils/time_manager.F90 | 73 +- 13 files changed, 2506 insertions(+), 96 deletions(-) create mode 100644 cime_config/usermods_dirs/scam_STUB/scripts/STUB_iop.nc create mode 100755 cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh create mode 100644 cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh create mode 100755 cime_config/usermods_dirs/scam_STUB/shell_commands create mode 100644 cime_config/usermods_dirs/scam_STUB/user_nl_cam create mode 100644 src/dynamics/eul/get_ana_dynfrc_4scam.F90 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 601c1ac2a1..4392e935ef 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5189,6 +5189,12 @@ templatefull path for analysis forcing dataset. Default: set by build-namelist. + +Force scam to compute large-scale forcing from renalysis or 3D model output +Default: FALSE + + hDwW8or zJcy!Ry@=ph(X)u&J$v#G@ZiCNc=Em3gw~M8EGp>0%bR^Ov+wtQ@6F4aGjk~;9y>r~ zK+;K=*+Rfn-4j9VTtTL&f9sxHhtAPM;(57cAmXMafDa z$lUy;Sy(ZQZ8TD=fzWf@JGdD6H5n0$iaHuIaHQp9XK^A&7Fn1h#eDvhK4SE*a;XBb zj!$_0>YU(YhS{W0B8Bm(iPF@`5^OJ&rigFTkc>*QjITUXm@G}^i-id?U71~~j-Or? z)p2Q4uNt^c&bQmmVA2lL=gkW(U)zt4=O%K+qxd`svIiuq-;S1_2XYFs<1^^Z+~O|e z4zUja=e4R&HK{Gz0@%2U93%loHuAZW@f^<#IjklalT}6~CJA$Ze!hU-oHxwl-|+KQ z`-y7;eP~Qg-Hx@-qOj6A&b{ZjGa3fmSCWK+Nf`+pF~)NU;`s(Tqa?#D=$ZuGEuLc) zs7=Cs0!IShk%X=&CP@AY34F3lCBs_Wg40x!U(DHdNbNBC4x!LMV|+L^^VuF})+>(5 zV!W?YPKOsGu|jP|YAgr?#eBu73)`Ey8-#d`zDiBMAPv7L=nn_RjL+>pQ)h9tGq-!n zB8Ys4DCUJsP}QW?*y(X8Ih0(3x>1u0jIV!m5=L$X--nox0|L6wiiznJQ@4EYYH?s~ zBs&S717$Xkz#F`?3K6EkVgXJ1My+nqL;nhokX=p!U(q9kBYOfoneI66sfsc)LUET!S^k7u(H{ za^uMN^3&tb%FhQrm0x*>%dc-)<+nFamfwE__;6|7#vRXmY#1nLZ>{0Fd3T_0K6p7| z-g|P_y#IaOd@!(NK74V)d{qC?Z4J-(#u+F&%dgF01wsv Ay#N3J literal 0 HcmV?d00001 diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh new file mode 100755 index 0000000000..e41abeb7cc --- /dev/null +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -0,0 +1,111 @@ +#!/bin/csh -f +# +# Makes base case that can later be spawned to different +# lats and lons. Start with ARM SGP coords cuz we're comfortable +# there, lots of data etc. ... + + +if ( "$#argv" != 3) then + echo "Wrong number of arguments specified:" + echo " -arg 1 lat" + echo " -arg 2 lon" + echo " -arg 3 case string" + exit +endif + +set n = 1 +set case_lat = "$argv[$n]" +set n = 2 +set case_lon = "$argv[$n]" +set n = 3 +set loc_string = "$argv[$n]" + +set src=cam6_3_006.dev +set srcpath=/home/$USER/src +set scratchdir=/scratch/cluster/$USER +set COMPSET=FSCAM + +set case_year = 2010 +set case_mon = 05 +set case_day = 01 + +set case_date = $case_year$case_mon$case_day +set case_sdate = $case_year"-"$case_mon"-"$case_day + +echo $case_date +echo $case_sdate + +set laa = `echo $case_lat | cut -d '.' -f 1` +echo $laa +set loo = `echo $case_lon | cut -d '.' -f 1` +echo $loo + +# set basecase name +set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64" + +# create new basecase +${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported + +cd ${scratchdir}/${CASE} + +sed -i 's/intel\/18.0.3/intel\/20.0.1/' ./env_mach_specific.xml +sed -i 's/intel\/mvapich2-2.3rc2-intel-18.0.3/intel\/mvapich2-2.1-qlc/' ./env_mach_specific.xml +./case.setup + +#./xmlchange DEBUG=TRUE +./xmlchange DOUT_S=FALSE + +### Append to CAM configure options +./xmlchange --append CAM_CONFIG_OPTS='-phys cam64 -nlev 58' + + +# ATM_NCPL should be at least 192 to accomodate +# high wind cases in SH winter +./xmlchange ATM_NCPL=96 + +# Default to 123 days of runtime +# i.e., 123*96=11808 +./xmlchange STOP_N=11807 +./xmlchange START_TOD=00000 +./xmlchange STOP_OPTION=nsteps + +echo "scm_use_ana_iop = .true.">>user_nl_cam + +echo "cld_macmic_num_steps=3">>user_nl_cam +#echo "deep_scheme = 'off'">>user_nl_cam + +#echo "clubb_timestep=150.D0">>user_nl_cam +#echo "clubb_gamma_coef = 0.27D0">>user_nl_cam +#echo "clubb_c14 = 1.6D0">>user_nl_cam +#echo "clubb_l_trapezoidal_rule_zm = .false.">>user_nl_cam +#echo "clubb_l_trapezoidal_rule_zt = .false.">>user_nl_cam + +echo "clubb_mf_nup = 100">>user_nl_cam +echo "clubb_mf_L0 = 15.D0">>user_nl_cam +echo "clubb_mf_Lopt = 0">>user_nl_cam +#echo "clubb_mf_a0 = 1.D0">>user_nl_cam +#echo "clubb_mf_b0 = 0.5D0">>user_nl_cam + +echo "do_clubb_mf = .true.">>user_nl_cam +echo "do_clubb_mf_diag = .true.">>user_nl_cam +#echo "zmconv_num_cin = 1">>user_nl_cam +echo "use_gw_front = .false.">>user_nl_cam +echo "use_gw_convect_dp = .false.">>user_nl_cam + +#Set case specific variables +./xmlchange PTS_LAT=${case_lat} +./xmlchange PTS_LON=${case_lon} +./xmlchange RUN_STARTDATE=${case_sdate} + +cp ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB/scripts/STUB_iop.nc ./ + +ncap2 --overwrite -s "bdate=${case_date}" STUB_iop.nc STUB_iop.nc +ncap2 --overwrite -s "lat[lat]=${case_lat}" STUB_iop.nc STUB_iop.nc +ncap2 --overwrite -s "lon[lon]=${case_lon}" STUB_iop.nc STUB_iop.nc + +pwd + +echo "READY TO BUILD/SUBMIT "${CASE} +./case.build +./case.submit +exit diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh new file mode 100644 index 0000000000..ef978c18b0 --- /dev/null +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -0,0 +1,70 @@ +#!/bin/csh -f + +set lat = 23.08900523560209 +set lon = 205 +set casenam = st10 +source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 24.03141361256544 +#set lon = 207.5 +#set casenam = st9 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 24.9738219895288 +#set lon = 210. +#set casenam = st8 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 25.91623036649214 +#set lon = 212.5 +#set casenam = st7 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 27.80104712041884 +#set lon = 217.5 +#set casenam = st6 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 29.68586387434554 +#set lon = 222.5 +#set casenam = st5 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 31.57068062827226 +#set lon = 228.75 +#set casenam = st4 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 32.5130890052356 +#set lon = 231.25 +#set casenam = st3 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 33.45549738219896 +#set lon = 233.75 +#set casenam = st2 +#source make_basecase.auto.csh $lat $lon $casenam + +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs + +#set lat = 33.45549738219896 +#set lon = 240. +#set casenam = st1 +#source make_basecase.auto.csh $lat $lon $casenam + diff --git a/cime_config/usermods_dirs/scam_STUB/shell_commands b/cime_config/usermods_dirs/scam_STUB/shell_commands new file mode 100755 index 0000000000..a14f805439 --- /dev/null +++ b/cime_config/usermods_dirs/scam_STUB/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +#./xmlchange PTS_LON=scmlon +#./xmlchange PTS_LAT=scmlat + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +#./xmlchange RUN_STARTDATE=yyyy-mm-dd +#./xmlchange START_TOD=0 +#./xmlchange STOP_OPTION=nsteps +#./xmlchange STOP_N=nnnn + +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. diff --git a/cime_config/usermods_dirs/scam_STUB/user_nl_cam b/cime_config/usermods_dirs/scam_STUB/user_nl_cam new file mode 100644 index 0000000000..8afb67ee1b --- /dev/null +++ b/cime_config/usermods_dirs/scam_STUB/user_nl_cam @@ -0,0 +1,41 @@ +!scmlon=$PTS_LON +!scmlat=$PTS_LAT +iopfile="$CASEROOT/STUB_iop.nc" +ncdata="/home/aherring/scam/inic/SCAM_IC_288x192_L58_48_BL10.nc" + + +bnd_topo="/fs/cgd/csm/inputdata/atm/cam/topo/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_c170103.nc" + +mfilt=2000 +nhtfrq=1 +avgflag_pertape(1)='A' + +scm_use_obs_uv = .false. +scm_relaxation = .false. +scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' +scm_relax_bot_p = 105000. +scm_relax_top_p = 200. +scm_relax_linear = .true. +scm_relax_tau_bot_sec = 864000. +scm_relax_tau_top_sec = 172800. + +use_scm_ana_frc = .true. +scm_ana_frc_path = "/project/amp/aherring/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/" +!scm_ana_frc_path = "/glade/scratch/aherring/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/" +scm_ana_frc_file_template = "cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010.cam.h2.%y-%m-%d-%s.nc" + +scm_ana_x_plevels = .true. +scm_ana_direct_omega = .true. +scm_ana_direct_ttend = .false. +scm_ana_t_react = .false. +scm_ana_q_react = .false. +scm_ana_u_react = .false. +scm_ana_v_react = .false. +scm_ana_upwind = .false. + + +use_gw_convect_dp = .false. +use_gw_convect_sh = .false. +use_gw_front = .false. diff --git a/src/control/history_scam.F90 b/src/control/history_scam.F90 index 2c81ce1a78..3288bfc7ca 100644 --- a/src/control/history_scam.F90 +++ b/src/control/history_scam.F90 @@ -45,7 +45,10 @@ subroutine scm_intht() call addfld ('UDIFF', (/ 'lev' /), 'A', 'K','difference from observed u wind', gridname='gauss_grid') call addfld ('VDIFF', (/ 'lev' /), 'A', 'K','difference from observed v wind', gridname='gauss_grid') - call addfld ('TOBS', (/ 'lev' /), 'A', 'K','observed temp') + call addfld ('TOBS', (/ 'lev' /), 'A', 'K','observed temp', gridname='gauss_grid') + call addfld ('UOBS', (/ 'lev' /), 'A', 'm/s','observed zonal wind', gridname='gauss_grid') + call addfld ('VOBS', (/ 'lev' /), 'A', 'm/s','observed meridional wind', gridname='gauss_grid') + call addfld ('QDIFF', (/ 'lev' /), 'A', 'kg/kg','difference from observed water', gridname='gauss_grid') call addfld ('QOBS', (/ 'lev' /), 'A', 'kg/kg','observed water', gridname='physgrid') @@ -100,6 +103,59 @@ subroutine scm_intht() call addfld ('NLTEN_PHYS', (/ 'lev' /), 'I','#/kg/s', 'NL vertical advective forcing', gridname='gauss_grid' ) call addfld ('NITEN_PHYS', (/ 'lev' /), 'I','#/kg/s', 'NI vertical advective forcing', gridname='gauss_grid' ) +!++jtb + call addfld ('U_IOP', (/ 'lev' /), 'I', 'm/s', 'Zonal Wind from IOP ', gridname='gauss_grid' ) + call addfld ('V_IOP', (/ 'lev' /), 'I', 'm/s', 'Mer. Wind from IOP ', gridname='gauss_grid' ) + call addfld ('OMEGA_IOP', (/ 'lev' /), 'I', 'Pa/s', 'Vertical velocity (from IOP) ', gridname='gauss_grid' ) + call addfld ('OMEGA_ANA', (/ 'lev' /), 'I', 'Pa/s', 'Vertical velocity (analysis) ', gridname='gauss_grid' ) + call addfld ('ETAD_ANA', (/ 'lev' /), 'I', 'Pa/s', 'Eta_dot (analysis) ', gridname='gauss_grid' ) + call addfld ('ZETA_ANA', (/ 'lev' /), 'I', '1/s', 'Rel. Vorticity (analysis) ', gridname='gauss_grid' ) + call addfld ('T_ANA', (/ 'lev' /), 'I', 'K', 'Temperature (analysis) ', gridname='gauss_grid' ) + call addfld ('Q_ANA', (/ 'lev' /), 'I', 'g/g', 'Spec. humidity (analysis) ', gridname='gauss_grid' ) + call addfld ('U_ANA', (/ 'lev' /), 'I', 'm/s', 'Zonal wind (analysis) ', gridname='gauss_grid' ) + call addfld ('V_ANA', (/ 'lev' /), 'I', 'm/s', 'Mer. Wind (analysis) ', gridname='gauss_grid' ) + call addfld ('TV_ANA', (/ 'lev' /), 'I', 'K', 'Temperature (analysis) ', gridname='gauss_grid' ) + call addfld ('TTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('QTEN_TOTDYN_ANA', (/ 'lev' /), 'I', 'kg/kg/s', 'tracer tendency (analysis)', gridname='gauss_grid' ) + + call addfld ('UTEN_TOTDYN_ANAR', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_TOTDYN_ANAR', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + + call addfld ('UTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('TTEN_DYCORE_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('OMEGA_DYCORE_ANA', (/ 'lev' /), 'I', 'Pa/s','Pressure tendency/velocity (analysis)', gridname='gauss_grid' ) + call addfld ('OMEGA_RECALC_ANA', (/ 'lev' /), 'I', 'Pa/s','Pressure tendency/velocity (analysis)', gridname='gauss_grid' ) + + call addfld ('UTEN_PRG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_PHIG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_KEG_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_VORT_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_PFRC_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_VADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_HADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('UTEN_CORIOL', (/ 'lev' /), 'I', 'm/s/s', 'Zonal wind tendency (analysis)', gridname='gauss_grid' ) + + + call addfld ('VTEN_VORT_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_PFRC_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_VADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_HADV_ANA', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + call addfld ('VTEN_CORIOL', (/ 'lev' /), 'I', 'm/s/s', 'Meridional wind tendency (analysis)', gridname='gauss_grid' ) + + call addfld ('TTEN_VADV_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('TTEN_HADV_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('TTEN_COMP_ANA', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('TTEN_COMP_IOP', (/ 'lev' /), 'I', 'K/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + + call addfld ('QTEN_VADV_ANA', (/ 'lev' /), 'I', '1/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + call addfld ('QTEN_HADV_ANA', (/ 'lev' /), 'I', '1/s', 'Temperature tendency (analysis)', gridname='gauss_grid' ) + +!--jtb + + end subroutine scm_intht !####################################################################### diff --git a/src/control/scamMod.F90 b/src/control/scamMod.F90 index b18169b340..b5506184cb 100644 --- a/src/control/scamMod.F90 +++ b/src/control/scamMod.F90 @@ -76,6 +76,24 @@ module scamMod character*(max_path_len), public :: lsmsurffile character*(max_path_len), public :: lsminifile +!++jtb +logical, public :: use_scm_ana_frc = .false. +character*(max_path_len), public :: scm_ana_frc_file_template +character*(max_path_len), public :: scm_ana_frc_path + +logical, public :: scm_ana_x_plevels = .true. +logical, public :: scm_ana_direct_omega = .false. +logical, public :: scm_ana_direct_ttend = .false. +logical, public :: scm_ana_t_react = .false. +logical, public :: scm_ana_q_react = .false. +logical, public :: scm_ana_u_react = .false. +logical, public :: scm_ana_v_react = .false. +logical, public :: scm_ana_upwind = .false. +!+++ARH +logical, public :: scm_use_ana_iop = .false. +!---ARH +!--jtb + ! note that scm_zadv_q is set to slt to be consistent with CAM BFB testing @@ -250,7 +268,13 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in) scm_cambfb_mode,scm_crm_mode,scm_zadv_uv,scm_zadv_T,scm_zadv_q,& scm_use_obs_T, scm_use_obs_uv, scm_use_obs_qv, & scm_relax_linear, scm_relax_tau_top_sec, & - scm_relax_tau_bot_sec, scm_force_latlon, scm_relax_fincl, scm_backfill_iop_w_init + scm_relax_tau_bot_sec, scm_force_latlon, scm_relax_fincl, scm_backfill_iop_w_init, & +!+jtb + use_scm_ana_frc, scm_ana_frc_path, scm_ana_frc_file_template, & + scm_ana_x_plevels, scm_ana_direct_omega, & + scm_ana_t_react, scm_ana_q_react, scm_ana_u_react, scm_ana_v_react, & + scm_ana_upwind, scm_ana_direct_ttend, scm_use_ana_iop +!--jtb single_column=single_column_in @@ -306,6 +330,9 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in) use_camiop = .false. endif +write(*,*) "!!!!!!!!!! ScamMod !!!!!!!! " +write(*,*) scm_force_latlon , scmlon, scmlat + ! If we are not forcing the lat and lon from the namelist use the closest lat and lon that is found in the IOP file. if (.not.scm_force_latlon) then call shr_scam_GetCloseLatLon( ncid, scmlat, scmlon, ioplat, ioplon, latidx, lonidx ) @@ -316,7 +343,9 @@ subroutine scam_readnl(nlfile,single_column_in,scmlat_in,scmlon_in) scmlat = ioplat scmlon = ioplon end if - +write(*,*) " after " , scmlon, scmlat + + if (masterproc) then write (iulog,*) 'Single Column Model Options: ' write (iulog,*) '=============================' diff --git a/src/dynamics/eul/get_ana_dynfrc_4scam.F90 b/src/dynamics/eul/get_ana_dynfrc_4scam.F90 new file mode 100644 index 0000000000..312402cdbe --- /dev/null +++ b/src/dynamics/eul/get_ana_dynfrc_4scam.F90 @@ -0,0 +1,1634 @@ +module get_ana_dynfrc_4scam + + use spmd_utils, only: masterproc + use cam_logfile, only: iulog + use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8, & + cs=>SHR_KIND_CS,cl=>SHR_KIND_CL + use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + pi => shr_const_pi , & + OOmega => shr_const_omega , & + rdair => shr_const_rdair , & + cpair => shr_const_cpdair + + use scamMod, only: use_scm_ana_frc, & + scm_ana_frc_path, & + scm_ana_frc_file_template, & + scm_ana_x_plevels, & + scm_ana_direct_omega, & + scm_ana_t_react, & + scm_ana_q_react, & + scm_ana_u_react, & + scm_ana_v_react, & + scm_ana_upwind, & + scm_ana_direct_ttend + + + + ! shr_const_mod is in ${CESMROOT}/cime/src/share/util/ + + implicit none + private + save + + public get_ana_dynfrc_fv +! +! Private module data +! + + real(r8) , save , allocatable :: T_1(:,:,:) , U_1(:,:,:), V_1(:,:,:), Q_1(:,:,:),PS_1(:,:),PHIS_1(:,:) + real(r8) , save , allocatable :: T_2(:,:,:) , U_2(:,:,:), V_2(:,:,:), Q_2(:,:,:),PS_2(:,:),PHIS_2(:,:) + real(r8) , save , allocatable :: UTCORE_1(:,:,:) , UTCORE_2(:,:,:) + real(r8) , save , allocatable :: VTCORE_1(:,:,:) , VTCORE_2(:,:,:) + real(r8) , save , allocatable :: TTCORE_1(:,:,:) , TTCORE_2(:,:,:) + real(r8) , save , allocatable :: OGCORE_1(:,:,:) , OGCORE_2(:,:,:) + real(r8) , save , allocatable :: lat_ana(:),lon_ana(:),lev_ana(:) + integer , save :: nlev_ana, nlon_ana, nlat_ana + + real(r8) , save , allocatable :: To_1(:,:,:) , Uo_1(:,:,:), Vo_1(:,:,:), Qo_1(:,:,:),PSo_1(:,:),PHISo_1(:,:) + real(r8) , save , allocatable :: To_2(:,:,:) , Uo_2(:,:,:), Vo_2(:,:,:), Qo_2(:,:,:),PSo_2(:,:),PHISo_2(:,:) + real(r8) , save , allocatable :: UTCOREo_1(:,:,:) , UTCOREo_2(:,:,:), UTCOREo_X(:,:,:) + real(r8) , save , allocatable :: VTCOREo_1(:,:,:) , VTCOREo_2(:,:,:), VTCOREo_X(:,:,:) + real(r8) , save , allocatable :: TTCOREo_1(:,:,:) , TTCOREo_2(:,:,:), TTCOREo_X(:,:,:) + real(r8) , save , allocatable :: OGCOREo_1(:,:,:) , OGCOREo_2(:,:,:), OGCOREo_X(:,:,:) + + + + real(r8) , save , allocatable :: ETAD_X(:,:,:) , OMG_X(:,:,:) + real(r8) , save , allocatable :: ZETA_X(:) + real(r8) , save , allocatable :: KEh_X(:,:,:) + real(r8) , save , allocatable :: Tv_X(:,:,:) + + real(r8) , save , allocatable :: pke_X(:,:,:),pko_X(:,:,:),phik_X(:,:,:),Thv_X(:,:,:) + real(r8) , save , allocatable :: ple_X(:,:,:) , plo_X(:,:,:), phi_X(:,:,:) + + real(r8) , save , allocatable :: To_X(:,:,:) , Uo_X(:,:,:), Vo_X(:,:,:), Qo_X(:,:,:),PSo_X(:,:),PHISo_X(:,:) + + +!======================================================================= +contains +!======================================================================= + +subroutine get_ana_dynfrc_fv ( scmlon, scmlat , & + omega_ana, etad_ana, zeta_ana, & + t_ana , tv_ana , & + q_ana , & + u_ana , & + v_ana , & + ps_ana , & + uten_hadv_ana , & + vten_hadv_ana , & + uten_pfrc_ana , & + vten_pfrc_ana , & + uten_vort_ana , & + vten_vort_ana , & + qten_hadv_ana , & + tten_hadv_ana , & + uten_vadv_ana , & + vten_vadv_ana , & + tten_vadv_ana , & + qten_vadv_ana , & + tten_comp_ana , & + uten_keg_ana , & + uten_phig_ana , & + uten_prg_ana , & + uten_dycore_ana , & + vten_dycore_ana , & + tten_dycore_ana , & + omega_dycore_ana , & + omega_recalc_ana , & + u_scm, v_scm, t_scm, q_scm, & + u_ana_diag, v_ana_diag, t_ana_diag, q_ana_diag ) + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! US and VS are input (D-grid velocities) +!-------------------------------------------- +! ub(i,j,L)= 0.5*(us(i-1,j,L) + us(i,j,L)) +! vb(i,j,L)= 0.5*(vs(i,j,L) + vs(i,j+1,L)) +! +! uc(i,j,L)= 0.5*(ub(i,j,L) + ub(i,j-1,L)) +! vc(i,j,L)= 0.5*(vb(i,j-1,L) + vb(i+1,j-1,L)) +!--------------------------------------------- +! Grid arrangement in FV latlon h,i-files +!--------------------------------------------- +! J=NY +! ... +! +! ub,vb(I,J) us(I,J),vc(I,J+1) +! +! +! vs(I,J),uc(I,J) ua,va,T,p(I,J) vs(I+1,J),uc(I+1,J) +! +! +! vc(I,J) +! +! +! ua,va,T,p(I,J-1) +! +! ... +! J=1 ... +!---------------------------------------------- + + use pmgrid, only : plev, plat, plevp, plon + use hycoef, only: hyai, hybi, ps0, hyam, hybm + use filenames, only: interpret_filename_spec + use time_manager, only: timemgr_time_ge,timemgr_time_inc,get_curr_date,get_step_size,is_first_step + use netcdf + use cam_abortutils, only: endrun + use ref_pres, only: pref_mid ! In Pascal + + real(r8), intent(in) :: scmlon, scmlat + real(r8), intent(out) :: omega_ana( plev ) + real(r8), intent(out) :: etad_ana(plev) + real(r8), intent(out) :: t_ana(plev) , tv_ana(plev) + real(r8), intent(out) :: zeta_ana(plev) + real(r8), intent(out) :: u_ana(plev) + real(r8), intent(out) :: v_ana(plev) + real(r8), intent(out) :: q_ana(plev) + real(r8), intent(out) :: ps_ana + real(r8), intent(out) :: uten_hadv_ana( plev ) + real(r8), intent(out) :: vten_hadv_ana( plev ) + real(r8), intent(out) :: uten_pfrc_ana( plev ) + real(r8), intent(out) :: vten_pfrc_ana( plev ) + real(r8), intent(out) :: qten_hadv_ana( plev ) + real(r8), intent(out) :: tten_hadv_ana( plev ) + real(r8), intent(out) :: qten_vadv_ana( plev ) + real(r8), intent(out) :: tten_vadv_ana( plev ) + real(r8), intent(out) :: uten_vadv_ana( plev ) + real(r8), intent(out) :: vten_vadv_ana( plev ) + + real(r8), intent(out) :: tten_comp_ana( plev ) + + real(r8), intent(out) :: uten_keg_ana( plev ) + real(r8), intent(out) :: uten_prg_ana( plev ) + real(r8), intent(out) :: uten_phig_ana( plev ) + real(r8), intent(out) :: uten_vort_ana( plev ) + real(r8), intent(out) :: vten_vort_ana( plev ) + real(r8), intent(out) :: uten_dycore_ana( plev ) + real(r8), intent(out) :: vten_dycore_ana( plev ) + real(r8), intent(out) :: tten_dycore_ana( plev ) + real(r8), intent(out) :: omega_recalc_ana( plev ) + real(r8), intent(out) :: omega_dycore_ana( plev ) + + real(r8), intent(in) :: u_scm(plev) + real(r8), intent(in) :: v_scm(plev) + real(r8), intent(in) :: t_scm(plev) + real(r8), intent(in) :: q_scm(plev) + + real(r8), intent(out) :: u_ana_diag(plev) + real(r8), intent(out) :: v_ana_diag(plev) + real(r8), intent(out) :: t_ana_diag(plev) + real(r8), intent(out) :: q_ana_diag(plev) + + integer, save :: iax, jax + integer, save :: Read_year2, Read_month2, Read_day2, Read_sec2, Read_YMD2 + integer, save :: nlev_alc, nlon_alc, nlat_alc + + !!logical , parameter :: l_vectinv = .FALSE. + !!real(r8) :: tv_ana(plev) + real(r8) :: rho_ana( plev ), plo_ana(plev) + + + + real(r8) :: scmlonx + + real(r8) :: ana_wgt1 , ana_wgt2 , dx0, dy, darea + + integer :: nx, ny,i,j,k,L,LM, iav(1),jav(1),iac,jac + + real(r8) , allocatable :: rlats(:),rlons(:) + real(r8) :: zeta(plev),absvo(plev) + ! Horz. gradient profiles (1=X, 2=Y) + real(r8) :: kehg_ana(plev,2),kehg_X(plev,2) + real(r8) :: phig_ana(plev,2),phig_X(plev,2) + real(r8) :: plog_ana(plev,2),plog_X(plev,2) + real(r8) :: teg_ana(plev,2), teg_X(plev,2) + real(r8) :: qg_ana(plev,2), qg_X(plev,2) + real(r8) :: ug_ana(plev,2), ug_X(plev,2) + real(r8) :: vg_ana(plev,2), vg_X(plev,2) + real(r8) :: lin_pfc_ana(plev,2) , lin_pfc_X(plev,2) + + real(r8) :: omega_ana_x(plev) + real(r8) :: alpha_react(plev) + + real(r8) :: lat_alc(3) , lon_alc(3) + real(r8) :: aalc(3,3,plev) + + + character(len=CL):: Ana_File_Template,Ana_file1,Ana_file2,Ana_Path + + + integer :: dyn_year,dyn_month,dyn_day,dyn_sec,year,month,day,sec + integer :: dyn_step,ymd1,ymd2,curr_sec,next_sec,curr_year,curr_month,curr_day,curr_ymd + + integer :: analysis_step + integer :: ana_year1, ana_month1, ana_day1, ana_sec1 + integer :: ana_year2, ana_month2, ana_day2, ana_sec2 + + logical :: l_Read_next_Ana, Alarm_Read_ana, Alarm_Bump_ana, initialize + + write(iulog,*) " version 07 of get_ana_dynfrc_4scam ... " + + + Alarm_Read_Ana = .FALSE. + Alarm_Bump_Ana = .FALSE. + + if ( scmlon < 0 ) then + scmlonx = scmlon + 360._r8 + else + scmlonx = scmlon + end if + + ! Default to 6 hour steps between ana + analysis_step = 6 * 3600 + + + Ana_path = trim(scm_ana_frc_path) + Ana_File_Template = trim(Ana_path)//trim(scm_ana_frc_file_template) + + + call get_curr_date(Year,Month,Day,Sec) + + curr_ymd = (Year*10000) + (Month*100) + Day + curr_sec = Sec + + ana_sec1 = ( Sec / analysis_step ) * analysis_step + ana_day1 = Day + ana_month1 = Month + ana_year1 = Year + + YMD1=(Ana_Year1*10000) + (Ana_Month1*100) + Ana_Day1 + + + call timemgr_time_inc(YMD1,Ana_Sec1, & + YMD2,Ana_Sec2,Analysis_Step,0,0) + + Ana_Year2 = YMD2 / 10000 + Ana_Month2 = (YMD2 - Ana_Year2*10000)/100 + Ana_Day2 = YMD2 - Ana_Year2*10000 - Ana_Month2*100 + + Ana_File1 = interpret_filename_spec(Ana_File_Template , & + yr_spec=Ana_Year1 , & + mon_spec=Ana_Month1, & + day_spec=Ana_Day1 , & + sec_spec=Ana_Sec1 ) + + Ana_File2 = interpret_filename_spec(Ana_File_Template , & + yr_spec=Ana_Year2 , & + mon_spec=Ana_Month2, & + day_spec=Ana_Day2 , & + sec_spec=Ana_Sec2 ) + + + l_Read_next_Ana = .FALSE. + ! On first time step, read in 2 analysis files + if (is_first_step().and.masterproc) then + write(iulog,*) " It's now (First time step):" , curr_YMD, curr_sec + write(iulog,*) "Read Initial ana files " + write(iulog,*) Ana_file1 + write(iulog,*) Ana_file2 + Alarm_Read_Ana = .TRUE. + Alarm_Bump_Ana = .FALSE. + else + ! On subsequent steps test to see if "Curr" date is later or same as "Read". + ! If it is, then l_read_next_ana=.TRUE. + call timemgr_time_ge(Read_ymd2, Read_Sec2, curr_YMD, curr_Sec, l_Read_next_ana ) + endif + + if (l_Read_next_Ana) then + Alarm_Read_Ana = .TRUE. + Alarm_Bump_Ana = .TRUE. + endif + + ! Aloocate space for analysis fields. + ! Read in both Initial Analysis files. Nothing to bump yet + if ( (Alarm_Read_Ana ) .AND. .NOT.(Alarm_Bump_Ana) ) then + initialize=.TRUE. + call read_netcdf_ana_fv_ini ( Ana_File1, nlon_ana, nlat_ana, nlev_ana ,iax, jax ) + + if ( plev /= nlev_ana) then + call endrun ("SCAM plev NE nlev_ana") + end if + + ! Full global fields + allocate( lat_ana(nlat_ana) , lon_ana(nlon_ana), lev_ana(nlev_ana) ) + allocate( U_1(nlon_ana, nlat_ana, nlev_ana), V_1(nlon_ana, nlat_ana, nlev_ana), T_1(nlon_ana, nlat_ana, nlev_ana), & + Q_1(nlon_ana, nlat_ana, nlev_ana), PS_1 (nlon_ana, nlat_ana ), PHIS_1 (nlon_ana, nlat_ana ) ) + allocate( U_2(nlon_ana, nlat_ana, nlev_ana), V_2(nlon_ana, nlat_ana, nlev_ana), T_2(nlon_ana, nlat_ana, nlev_ana), & + Q_2(nlon_ana, nlat_ana, nlev_ana), PS_2 (nlon_ana, nlat_ana ), PHIS_2 (nlon_ana, nlat_ana ) ) + + allocate( UTCORE_1(nlon_ana, nlat_ana, nlev_ana), UTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) + allocate( VTCORE_1(nlon_ana, nlat_ana, nlev_ana), VTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) + allocate( TTCORE_1(nlon_ana, nlat_ana, nlev_ana), TTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) + allocate( OGCORE_1(nlon_ana, nlat_ana, nlev_ana), OGCORE_2(nlon_ana, nlat_ana, nlev_ana) ) + + ! SCM "patches" + nlon_alc=3 + nlat_alc=3 + nlev_alc=nlev_ana + + + + ! Patches of full global fields + allocate( Uo_1(nlon_alc, nlat_alc, nlev_alc), Vo_1(nlon_alc, nlat_alc, nlev_alc), To_1(nlon_alc, nlat_alc, nlev_alc), & + Qo_1(nlon_alc, nlat_alc, nlev_alc), PSo_1 (nlon_alc, nlat_alc ), PHISo_1 (nlon_alc, nlat_alc ) ) + allocate( Uo_2(nlon_alc, nlat_alc, nlev_alc), Vo_2(nlon_alc, nlat_alc, nlev_alc), To_2(nlon_alc, nlat_alc, nlev_alc), & + Qo_2(nlon_alc, nlat_alc, nlev_alc), PSo_2 (nlon_alc, nlat_alc ), PHISo_2 (nlon_alc, nlat_alc ) ) + + allocate( UTCOREo_1(nlon_alc, nlat_alc, nlev_alc), UTCOREo_2(nlon_alc, nlat_alc, nlev_alc), UTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) + allocate( VTCOREo_1(nlon_alc, nlat_alc, nlev_alc), VTCOREo_2(nlon_alc, nlat_alc, nlev_alc), VTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) + allocate( TTCOREo_1(nlon_alc, nlat_alc, nlev_alc), TTCOREo_2(nlon_alc, nlat_alc, nlev_alc), TTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) + allocate( OGCOREo_1(nlon_alc, nlat_alc, nlev_alc), OGCOREo_2(nlon_alc, nlat_alc, nlev_alc), OGCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) + + allocate( Uo_X(nlon_alc, nlat_alc, nlev_alc), Vo_X(nlon_alc, nlat_alc, nlev_alc), To_X(nlon_alc, nlat_alc, nlev_alc), & + Qo_X(nlon_alc, nlat_alc, nlev_alc), PSo_X (nlon_alc, nlat_alc ), PHISo_X (nlon_alc, nlat_alc ) ) + allocate( ETAD_X(nlon_alc,nlat_alc,nlev_alc) ) + allocate( OMG_X(nlon_alc,nlat_alc,nlev_alc) ) + allocate( ple_X(nlon_alc, nlat_alc, nlev_alc+1), plo_X(nlon_alc, nlat_alc, nlev_alc), phi_X(nlon_alc, nlat_alc, nlev_alc+1) ) + allocate( pke_X(nlon_alc, nlat_alc, nlev_alc+1), pko_X(nlon_alc, nlat_alc, nlev_alc), phik_X(nlon_alc, nlat_alc, nlev_alc+1) ) + allocate( THv_X(nlon_alc, nlat_alc, nlev_alc ) ) + allocate( zeta_X(nlev_alc) ) + allocate( KEh_X(nlon_alc, nlat_alc, nlev_alc ) ) + allocate( Tv_X(nlon_alc, nlat_alc, nlev_alc ) ) + + call read_netcdf_ana_fv ( Ana_File1, nlon_ana, nlat_ana, nlev_ana, & + U_1, V_1, & + T_1, Q_1, PS_1, PHIS_1, & + lon_ana, lat_ana, lev_ana & + , utcore_1, vtcore_1, ttcore_1, ogcore_1 & + ) + write(*,*) " checks ... " + write(*,*) iax, jax + + call read_netcdf_ana_fv ( Ana_File2, nlon_ana, nlat_ana, nlev_ana, & + U_2, V_2, & + T_2, Q_2, PS_2, PHIS_2, & + lon_ana, lat_ana, lev_ana & + , utcore_2, vtcore_2, ttcore_2, ogcore_2 & + ) + + ! Make patches + Uo_1 = U_1(iax-1:iax+1,jax-1:jax+1,:) + Vo_1 = V_1(iax-1:iax+1,jax-1:jax+1,:) + To_1 = T_1(iax-1:iax+1,jax-1:jax+1,:) + Qo_1 = Q_1(iax-1:iax+1,jax-1:jax+1,:) + PSo_1 = PS_1(iax-1:iax+1,jax-1:jax+1 ) + PHISo_1 = PHIS_1(iax-1:iax+1,jax-1:jax+1 ) + UTCOREo_1 = UTCORE_1(iax-1:iax+1,jax-1:jax+1,:) + VTCOREo_1 = VTCORE_1(iax-1:iax+1,jax-1:jax+1,:) + TTCOREo_1 = TTCORE_1(iax-1:iax+1,jax-1:jax+1,:) + OGCOREo_1 = OGCORE_1(iax-1:iax+1,jax-1:jax+1,:) + + Uo_2 = U_2(iax-1:iax+1,jax-1:jax+1,:) + Vo_2 = V_2(iax-1:iax+1,jax-1:jax+1,:) + To_2 = T_2(iax-1:iax+1,jax-1:jax+1,:) + Qo_2 = Q_2(iax-1:iax+1,jax-1:jax+1,:) + PSo_2 = PS_2(iax-1:iax+1,jax-1:jax+1 ) + PHISo_2 = PHIS_2(iax-1:iax+1,jax-1:jax+1 ) + UTCOREo_2 = UTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + VTCOREo_2 = VTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + TTCOREo_2 = TTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + OGCOREo_2 = OGCORE_2(iax-1:iax+1,jax-1:jax+1,:) + + + ! Mark Ana date as read + Read_year2 = Ana_year2 + Read_month2 = Ana_month2 + Read_day2 = Ana_day2 + Read_sec2 = Ana_sec2 + Read_YMD2 =(Ana_Year2*10000) + (Ana_Month2*100) + Ana_Day2 + + end if + + ! Bump second analysis to first postion, and read in next analysis + if ( (Alarm_Read_Ana ) .AND. (Alarm_Bump_Ana) ) then + + Uo_1 = Uo_2 + Vo_1 = Vo_2 + To_1 = To_2 + Qo_1 = Qo_2 + PSo_1 = PSo_2 + PHISo_1 = PHISo_2 + UTCOREo_1 = UTCOREo_2 + VTCOREo_1 = VTCOREo_2 + TTCOREo_1 = TTCOREo_2 + + call read_netcdf_ana_fv ( Ana_File2, nlon_ana, nlat_ana, nlev_ana, & + U_2, V_2, & + T_2, Q_2, PS_2, PHIS_2, & + lon_ana, lat_ana, lev_ana & + , utcore_2, vtcore_2, ttcore_2, ogcore_2 & + ) + + ! Make patches + Uo_2 = U_2(iax-1:iax+1,jax-1:jax+1,:) + Vo_2 = V_2(iax-1:iax+1,jax-1:jax+1,:) + To_2 = T_2(iax-1:iax+1,jax-1:jax+1,:) + Qo_2 = Q_2(iax-1:iax+1,jax-1:jax+1,:) + PSo_2 = PS_2(iax-1:iax+1,jax-1:jax+1 ) + PHISo_2 = PHIS_2(iax-1:iax+1,jax-1:jax+1 ) + UTCOREo_2 = UTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + VTCOREo_2 = VTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + TTCOREo_2 = TTCORE_2(iax-1:iax+1,jax-1:jax+1,:) + OGCOREo_2 = OGCORE_2(iax-1:iax+1,jax-1:jax+1,:) + + + ! Mark Ana date as read + Read_year2 = Ana_year2 + Read_month2 = Ana_month2 + Read_day2 = Ana_day2 + Read_sec2 = Ana_sec2 + Read_YMD2=(Ana_Year2*10000) + (Ana_Month2*100) + Ana_Day2 + end if + + Alarm_Read_Ana = .FALSE. + Alarm_Bump_Ana = .FALSE. + + + + +#if 0 + call dynfrc_timewgts( & + (/ Ana_Year1, Ana_Month1, Ana_day1, Ana_sec1 /) , & + (/ Ana_Year2, Ana_Month2, Ana_day2, Ana_sec2 /) , & + ana_wgt1 , ana_wgt2 ) +#else + ana_wgt1 = 0._r8 ! 0=all weight on t+1 + ana_wgt2 = 1._r8 - ana_wgt1 +#endif + if (masterproc) write(iulog,*) " Ana forcing time wgts ",ana_wgt1,ana_wgt2 + + iac=2 + jac=2 + + + + Uo_X = ana_wgt1 * Uo_1 + ana_wgt2 * Uo_2 + Vo_X = ana_wgt1 * Vo_1 + ana_wgt2 * Vo_2 + To_X = ana_wgt1 * To_1 + ana_wgt2 * To_2 + Qo_X = ana_wgt1 * Qo_1 + ana_wgt2 * Qo_2 + PSo_X = ana_wgt1 * PSo_1 + ana_wgt2 * PSo_2 + PHISo_X = ana_wgt1 * PHISo_1 + ana_wgt2 * PHISo_2 + + UTCOREo_X = ana_wgt1 * UTCOREo_1 + ana_wgt2 * UTCOREo_2 + VTCOREo_X = ana_wgt1 * VTCOREo_1 + ana_wgt2 * VTCOREo_2 + TTCOREo_X = ana_wgt1 * TTCOREo_1 + ana_wgt2 * TTCOREo_2 + OGCOREo_X = ana_wgt1 * OGCOREo_1 + ana_wgt2 * OGCOREo_2 + + lon_alc = lon_ana(iax-1:iax+1) + lat_alc = lat_ana(jax-1:jax+1) + + if(masterproc) write(iulog,*) " SCM lon lat: ",scmlonx,scmlat + if(masterproc) write(iulog,*) " Closest Ana lon lat: ",lon_ana( iax ) , lat_ana( jax ) + + + ! Save off analysis fields for diagnostics and + ! other purposes + T_ana_diag(:) = To_X( iac, jac, :) + Q_ana_diag(:) = Qo_X( iac, jac, :) + U_ana_diag(:) = Uo_X( iac, jac, :) + V_ana_diag(:) = Vo_X( iac, jac, :) + + !================================================ + ! Patch in SCM profiles here if wanted. + ! This acts as "dynamical nudging", since + ! horizontal advective tendencies will become + ! stronger if SCM state drifts away from re-ana. + ! Note, this will only be effective w/ upwind + ! scheme, since 2nd order cntrd skips over central + ! point in stencil. + !---- + ! For stability it turns out may be good to scale + ! with pressure so that high-velocity strato winds + ! don't lead to CFL violations. So, as a bad, dirty, + ! dirty short term solution, weight "reaction" by + ! pref_mid. Clearly, better soln would be to + ! sub-step this part of the dynamics as is done + ! for the other "dycores". + !================================================= + ! Calculate "reaction coefficient" + !--------------------------------- + alpha_react(:)=1.0_r8 !1._r8 + + ! Adjust central profiles in stencils + !------------------------------------ + if (scm_ana_t_react) then + To_X( iac, jac, :) = alpha_react(:) * T_scm(:) & + + ( 1._r8-alpha_react(:) ) * To_X( iac, jac, :) + if(masterproc) write(iulog,*) " REACTING to SCM T-state ..... " + else + if(masterproc) write(iulog,*) " No reaction to SCM T-state ..... " + endif + if (scm_ana_q_react) then + Qo_X( iac, jac, :) = alpha_react(:) * Q_scm(:) & + + ( 1._r8-alpha_react(:) ) * Qo_X( iac, jac, :) + if(masterproc) write(iulog,*) " REACTING to SCM Q-state ..... " + else + if(masterproc) write(iulog,*) " No reaction to SCM Q-state ..... " + endif + if (scm_ana_u_react) then + Uo_X( iac, jac, :) = alpha_react(:) * U_scm(:) & + + ( 1._r8-alpha_react(:) ) * Uo_X( iac, jac, :) + if(masterproc) write(iulog,*) " REACTING to SCM U-state ..... " + else + if(masterproc) write(iulog,*) " No reaction to SCM U-state ..... " + endif + if (scm_ana_v_react) then + Vo_X( iac, jac, :) = alpha_react(:) * V_scm(:) & + + ( 1._r8-alpha_react(:) ) * Vo_X( iac, jac, :) + if(masterproc) write(iulog,*) " REACTING to SCM V-state ..... " + else + if(masterproc) write(iulog,*) " No reaction to SCM V-state ..... " + endif + + + + !========================================= + + call virtual_t( nlon_alc,nlat_alc,nlev_alc, & + To_X , Qo_X , Tv_X ) + + call makepr_fv( nlon_alc,nlat_alc,nlev_alc, & + tv_X , pso_X , phiso_X , & + plo_X, ple_X, phi_X ) + call etadot_fv ( nlon_alc , nlat_alc , nlev_alc , lon_alc , lat_alc , & + uo_X , & + vo_X , & + plo_X, ple_X , etad_X , omg_X ) + call zeta_fv( nlon_alc,nlat_alc,nlev_alc, & + lon_alc ,lat_alc , & + uo_X , vo_X , zeta_X ) + + call makepk_fv( nlon_alc,nlat_alc,nlev_alc, & + To_X , Qo_X , & + pso_X , phiso_X , & + pko_X, pke_X, phik_X, thv_X ) + + KEh_X = 0.5 * ( Uo_X**2 + Vo_X**2 ) + + + if (scm_ana_x_plevels) then + call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & + iac, jac, uo_X , plo_X ) + call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & + iac, jac, vo_X , plo_X ) + call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & + iac, jac, to_X , plo_X ) + call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & + iac, jac, qo_X , plo_X ) + call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & + iac, jac, tv_X , plo_X ) + !Retain p-frc calculation on eta??? + !call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc+1, & + ! iac, jac, phi_X , ple_X ) + if(masterproc) write(iulog,*) " calcs on PRESSURE levels " + else + if(masterproc) write(iulog,*) " calcs on ETA levels " + end if + + + zeta_ana = zeta_X + omega_recalc_ana = omg_X( iac,jac,:) + etad_ana = etad_X( iac,jac,:) + plo_ana = plo_X( iac,jac,:) + t_ana = To_X( iac,jac,:) + tv_ana = Tv_X( iac,jac,:) + q_ana = Qo_X( iac,jac,:) + ps_ana = PSo_X( iac,jac ) + + u_ana = Uo_X( iac,jac,:) + v_ana = Vo_X( iac,jac,:) + + rho_ana = plo_ana / ( Rdair * tv_ana ) + + uten_dycore_ana = UTCOREo_X( iac,jac,:) + vten_dycore_ana = VTCOREo_X( iac,jac,:) + tten_dycore_ana = TTCOREo_X( iac,jac,:) + omega_dycore_ana = OGCOREo_X( iac,jac,:) + + + ! Horz. gradient calcs + + kehg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, KEh_X ) + + ! T_x, T_y should be straight T (not virtual) + !!teg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, To_X ) + teg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Tv_X ) !test 05-31-21 + + qg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Qo_X ) + + ug_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Uo_X ) + + vg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Vo_X ) + + aalc = 0.5*( PHI_X( :, :, 2:nlev_alc+1) + PHI_X(: , : ,1:nlev_alc) ) + !!aalc = PHI_X( :, :, 2:nlev_alc+1) + !!aalc = PHI_X(: , : ,1:nlev_alc) + phig_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, aalc ) + + !Retain p-frc calculation on eta??? + !if (scm_ana_x_plevels) then ! No horz. p-gradient in p-coords + ! plog_X(:,1:2) = 0._r8 + !else + plog_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, plo_X(:,:,1:nlev_alc) ) + !plog_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, ple_X(:,:,1:nlev_alc) ) + !end if + + + +#if 1 + lin_pfc_X = lin_pfc_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, ple_X, phi_X ) +#else + lin_pfc_X = lin_pfc_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, pke_X, phik_X ) +#endif + + kehg_ana = kehg_X + plog_ana = plog_X + phig_ana = phig_X + teg_ana = teg_X + qg_ana = qg_X + ug_ana = ug_X + vg_ana = vg_X + lin_pfc_ana = lin_pfc_X + + !put together pieces for u*grad(u) form of U and V adv tendencies + + if ( scm_ana_upwind .OR. scm_ana_u_react ) then + uten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Uo_X ) + else + uten_hadv_ana = -u_ana * ug_ana(:,1) - v_ana * ug_ana(:,2) + end if + if ( scm_ana_upwind .OR. scm_ana_v_react ) then + vten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Vo_X ) + else + vten_hadv_ana = -u_ana * vg_ana(:,1) - v_ana * vg_ana(:,2) + end if + + ! Coriolis terms + !====================================== + absvo = 2._r8 * OOmega * sin( lat_ana(jax) * PI/180._r8 ) + !Allow Coriolis to react to SCM winds + uten_vort_ana = absvo * v_ana + vten_vort_ana = -absvo * u_ana + ! Force Coriolis to ALWAYS be calc w/ analysis winds + !!uten_vort_ana = absvo * v_ana_diag + !!vten_vort_ana = -absvo * u_ana_diag + ! ----- Diags for VI form (0-out) + uten_keg_ana = 0._r8 ! fill with 0 + + !!if (scm_ana_x_plevels) then ! No horz. p-gradient in p-coords + if (.FALSE.) then ! No horz. p-gradient in p-coords + uten_pfrc_ana = - phig_ana(:,1) + vten_pfrc_ana = - phig_ana(:,2) + else +#if 1 + !put together pieces for Pressure and Phi gradient tencency terms + uten_pfrc_ana = -(1._r8/rho_ana) * plog_ana(:,1) - phig_ana(:,1) + vten_pfrc_ana = -(1._r8/rho_ana) * plog_ana(:,2) - phig_ana(:,2) +#else + !Lin(1997) QJRMS pfrc tendency terms + uten_pfrc_ana = lin_pfc_ana(:,1) + vten_pfrc_ana = lin_pfc_ana(:,2) +#endif + end if + + + if ( scm_ana_upwind .OR. scm_ana_t_react ) then + tten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Tv_X ) + else + tten_hadv_ana = -u_ana * teg_ana(:,1) - v_ana * teg_ana(:,2) ! should be straight T (not virtual) + end if + if ( scm_ana_upwind .OR. scm_ana_q_react ) then + qten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Qo_X ) + else + qten_hadv_ana = -u_ana * qg_ana(:,1) - v_ana * qg_ana(:,2) + end if + + if (.not.(scm_ana_direct_omega)) then + omega_ana = omega_recalc_ana ! use reconstructed omega + if(masterproc) write(iulog,*) " Omega recalc from ana U,V etc." + else + omega_ana = omega_dycore_ana ! use direct omega from dycore/ana + if(masterproc) write(iulog,*) " Omega direct from ana" + end if + + + if (.not.(scm_ana_x_plevels)) then + !Tendencies due to vertical advection (etadot * D_eta ... ) + uten_vadv_ana = vadv_fv( nlev_alc, etad_ana, u_ana ) + vten_vadv_ana = vadv_fv( nlev_alc, etad_ana, v_ana ) + tten_vadv_ana = vadv_fv( nlev_alc, etad_ana, tv_ana ) ! should be straight T (not virtual) + qten_vadv_ana = vadv_fv( nlev_alc, etad_ana, q_ana ) + else + !Tendencies due to vertical advection (Omega * D_p ... ) + uten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, u_ana ) + vten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, v_ana ) + tten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, t_ana ) ! should be straight T (not virtual) + qten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, q_ana ) + end if + + tten_comp_ana = (1./cpair)*( omega_ana / rho_ana ) + + !DIags for pressure/geop grad forces + uten_phig_ana = - phig_ana(:,1) + uten_prg_ana = - (1._r8/rho_ana) * plog_ana(:,1) + + end subroutine get_ana_dynfrc_fv + +!----------------------------------------------------- +! Stuff ... useful ojala +!----------------------------------------------------- + !------------------------- + function vadv_fv( nlev, etad, aa ) result( tend ) + use hycoef, only: hyai, hybi, ps0, hyam, hybm + integer, intent(in) :: nlev + real(r8), intent(in) :: etad(nlev) , aa(nlev) + real(r8) :: tend(nlev) + real(r8) :: eta(nlev) + integer :: L + + eta = hybm+hyam + + do L=2,nlev-1 + tend(L) = etad(L)* ( aa(L+1) - aa(L-1) ) / ( eta(L+1) - eta(L-1) ) + end do + L=1 + tend(L) = etad(L)* ( aa(L+1) - aa(L) ) / ( eta(L+1) - eta(L) ) + L=nlev + tend(L) = etad(L)* ( aa(L) - aa(L-1) ) / ( eta(L) - eta(L-1) ) + + tend = -1.*tend ! for RHS consistency + + end function vadv_fv +!--------------------------- + !------------------------- + function vadv_fv_press( nlev, omega, plo, aa ) result( tend ) + integer, intent(in) :: nlev + real(r8), intent(in) :: omega(nlev) , aa(nlev),plo(nlev) + real(r8) :: tend(nlev) + integer :: L + + do L=2,nlev-1 + tend(L) = omega(L)* ( aa(L+1) - aa(L-1) ) / ( plo(L+1) - plo(L-1) ) + end do + L=1 + tend(L) = omega(L)* ( aa(L+1) - aa(L) ) / ( plo(L+1) - plo(L) ) + L=nlev + tend(L) = omega(L)* ( aa(L) - aa(L-1) ) / ( plo(L) - plo(L-1) ) + + tend = -1.*tend ! for RHS consistency + + end function vadv_fv_press +!--------------------------- + function lin_pfc_fv( nlon,nlat,nlev,iax,jax,lons,lats, pre, phi ) result( pfc ) + !use shr_kind_mod, only: r8 => shr_kind_r8 + !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + ! pi => shr_const_pi , & + ! omega => shr_const_omega + + integer, intent(in) :: nlon,nlat,nlev,iax,jax + real(r8), intent(in) :: pre(nlon,nlat,nlev+1),phi(nlon,nlat,nlev+1) + real(r8), intent(in) :: lats(nlat),lons(nlon) + real(r8) :: pfc(nlev,2) + real(r8) :: pfxW(nlev) , pfxE(nlev) + real(r8) :: pfyS(nlev) , pfyN(nlev) + real(r8) :: rlats(nlat),rlons(nlon),dx,dy,ds + real(r8) :: pr1,pr2,pr3,pr4, ph1,ph2,ph3,ph4 + integer :: L , igg + + ! Begin + rlons(:) = lons(:) * PI/180._r8 + rlats(:) = lats(:) * PI/180._r8 + + dx=( rlons(2)-rlons(1) ) * Rearth + dy=( rlats(2)-rlats(1) ) * Rearth + + ds = MAX( dx*cos(rlats(jax)) , .1 ) + igg = iax + do L=1,nlev + pr1 = pre(igg-1,jax,L+1) + pr2 = pre(igg ,jax,L+1) + pr3 = pre(igg ,jax,L ) + pr4 = pre(igg-1,jax,L ) + ph1 = phi(igg-1,jax,L+1) + ph2 = phi(igg ,jax,L+1) + ph3 = phi(igg ,jax,L ) + ph4 = phi(igg-1,jax,L ) + pfxW(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) + end do + igg = iax +1 + do L=1,nlev + pr1 = pre(igg-1,jax,L+1) + pr2 = pre(igg ,jax,L+1) + pr3 = pre(igg ,jax,L ) + pr4 = pre(igg-1,jax,L ) + ph1 = phi(igg-1,jax,L+1) + ph2 = phi(igg ,jax,L+1) + ph3 = phi(igg ,jax,L ) + ph4 = phi(igg-1,jax,L ) + pfxE(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) + end do + ds = dy + igg = jax + do L=1,nlev + pr1 = pre(iax,igg-1,L+1) + pr2 = pre(iax,igg ,L+1) + pr3 = pre(iax,igg ,L ) + pr4 = pre(iax,igg-1,L ) + ph1 = phi(iax,igg-1,L+1) + ph2 = phi(iax,igg ,L+1) + ph3 = phi(iax,igg ,L ) + ph4 = phi(iax,igg-1,L ) + pfyS(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) + end do + igg = jax +1 + do L=1,nlev + pr1 = pre(iax,igg-1,L+1) + pr2 = pre(iax,igg ,L+1) + pr3 = pre(iax,igg ,L ) + pr4 = pre(iax,igg-1,L ) + ph1 = phi(iax,igg-1,L+1) + ph2 = phi(iax,igg ,L+1) + ph3 = phi(iax,igg ,L ) + ph4 = phi(iax,igg-1,L ) + pfyN(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) + end do + + + do L=1,nlev + pfc(L,1) = 0.5*( pfxW(L) + pfxE(L) ) + pfc(L,2) = 0.5*( pfyS(L) + pfyN(L) ) + end do + + + + end function lin_pfc_fv + !------------------------- + function grad_fv( nlon,nlat,nlev,iax,jax,lons,lats, aa ) result( ga ) + !use shr_kind_mod, only: r8 => shr_kind_r8 + !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + ! pi => shr_const_pi , & + ! omega => shr_const_omega + + integer, intent(in) :: nlon,nlat,nlev,iax,jax + real(r8), intent(in) :: aa(nlon,nlat,nlev) + real(r8), intent(in) :: lats(nlat),lons(nlon) + real(r8) :: ga(nlev,2) + real(r8) :: rlats(nlat),rlons(nlon),dx,dy + integer :: L + + ! Begin + rlons(:) = lons(:) * PI/180._r8 + rlats(:) = lats(:) * PI/180._r8 + + dx=( rlons(2)-rlons(1) ) * Rearth + dy=( rlats(2)-rlats(1) ) * Rearth + + do L=1,nlev + ga(L,1) = (aa(iax+1,jax,L) - aa(iax-1,jax,L))/( 2.*dx*cos(rlats(jax)) + 0.1 ) + ga(L,2) = (aa(iax,jax+1,L) - aa(iax,jax-1,L))/( 2.*dy ) + end do + + + + end function grad_fv + !------------------------- + function upwind_hadv( nlon,nlat,nlev,iax,jax,lons,lats,u,v, aa ) result( hadv_tend ) + !use shr_kind_mod, only: r8 => shr_kind_r8 + !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + ! pi => shr_const_pi , & + ! omega => shr_const_omega + + integer, intent(in) :: nlon,nlat,nlev,iax,jax + real(r8), intent(in) :: aa(nlon,nlat,nlev) + real(r8), intent(in) :: lats(nlat),lons(nlon),u(nlev),v(nlev) + real(r8) :: hadv_tend(nlev) + real(r8) :: rlats(nlat),rlons(nlon),dx,dy,xten(nlev),yten(nlev) + integer :: L + + ! Begin + rlons(:) = lons(:) * PI/180._r8 + rlats(:) = lats(:) * PI/180._r8 + + dx=( rlons(2)-rlons(1) ) * Rearth + dy=( rlats(2)-rlats(1) ) * Rearth + + do L=1,nlev + if ( u(L) >= 0._r8 ) then + xten(L) = u(L) * ( aa(iax,jax,L) - aa(iax-1,jax,L))/( dx*cos(rlats(jax)) + 0.1 ) + else + xten(L) = u(L) * ( aa(iax+1,jax,L) - aa(iax,jax,L))/( dx*cos(rlats(jax)) + 0.1 ) + end if + end do + do L=1,nlev + if ( v(L) >= 0._r8 ) then + yten(L) = v(L) * ( aa(iax,jax,L) - aa(iax,jax-1,L))/( dy ) + else + yten(L) = v(L) * ( aa(iax,jax+1,L) - aa(iax,jax,L))/( dy ) + end if + end do + + hadv_tend(:) = -1._r8 * ( xten(:) + yten(:) ) + + + end function upwind_hadv +!========================================= + subroutine makepk_fv( nlon,nlat,nlev, t, q, ps, phis, pko, pke, phi, th ) + use hycoef, only: hyai, hybi, ps0, hyam, hybm + !!use shr_const_mod, only: rdair => shr_const_rdair, cpair => shr_const_cpdair, + integer, intent(in) :: nlon,nlat,nlev + real(r8), intent(in) :: t(nlon,nlat,nlev),q(nlon,nlat,nlev),ps(nlon,nlat),phis(nlon,nlat) + real(r8), intent(out) :: pko(nlon,nlat,nlev),th(nlon,nlat,nlev),pke(nlon,nlat,nlev+1), phi(nlon,nlat,nlev+1) + real(r8) :: ple(nlon,nlat,nlev+1),plo(nlon,nlat,nlev+1),rv(nlon,nlat,nlev+1) + real(r8) :: kappa, p00 + integer :: L + + do L=1,nlev+1 + ple(:,:,L) = hyai(L)*ps0 + hybi(L)*ps(:,:) + end do + do L=1,nlev + plo(:,:,L) = hyam(L)*ps0 + hybm(L)*ps(:,:) + end do + + kappa=rdair/cpair + + pko = plo**kappa + pke = ple**kappa + + p00 = 100000._r8 + th = ( ( p00 / plo)**kappa ) * t + + rv = 1._r8/(1._r8 - q) - 1._r8 + th = th*(1._r8 + 0.61_r8 * rv ) + + phi(:,:,nlev+1) = phis(:,:) + do L=nlev,1,-1 + phi(:,:,L) = phi(:,:,L+1) - ( CpAir * Th(:,:,L) ) * ( pke(:,:,L) - pke(:,:,L+1) ) / (p00**kappa ) + end do + + + end subroutine makepk_fv + +!============================================================================= + subroutine makepr_fv( nlon,nlat,nlev, t, ps, phis, plo, ple, phi ) + use hycoef, only: hyai, hybi, ps0, hyam, hybm + use shr_const_mod, only: rdair => shr_const_rdair + integer, intent(in) :: nlon,nlat,nlev + real(r8), intent(in) :: t(nlon,nlat,nlev),ps(nlon,nlat),phis(nlon,nlat) + real(r8), intent(out) :: plo(nlon,nlat,nlev), ple(nlon,nlat,nlev+1), phi(nlon,nlat,nlev+1) + real(r8) :: lnple(nlon,nlat,nlev+1) + integer :: L + + do L=1,nlev+1 + ple(:,:,L) = hyai(L)*ps0 + hybi(L)*ps(:,:) + end do + do L=1,nlev + plo(:,:,L) = hyam(L)*ps0 + hybm(L)*ps(:,:) + end do + + lnple = log( ple ) + phi(:,:,nlev+1) = phis(:,:) + do L=nlev,1,-1 + phi(:,:,L) = phi(:,:,L+1) - (RdAir * T(:,:,L) ) * ( lnple(:,:,L) - lnple(:,:,L+1) ) + !phi(:,:,L) = phi(:,:,L+1) - (RdAir * T(:,:,L) / plo(:,:,L) ) * ( ple(:,:,L) - ple(:,:,L+1) ) + end do + + end subroutine makepr_fv + +!============================================================================= + subroutine virtual_t( nlon,nlat,nlev, t, q, tv ) + use hycoef, only: hyai, hybi, ps0, hyam, hybm + use shr_const_mod, only: rdair => shr_const_rdair + integer, intent(in) :: nlon,nlat,nlev + real(r8), intent(in) :: t(nlon,nlat,nlev),q(nlon,nlat,nlev) + real(r8), intent(out) :: tv(nlon,nlat,nlev) + real(r8) :: rv(nlon,nlat,nlev) + integer :: L + + + rv = 1._r8/(1._r8 - q) - 1._r8 + tv = t*(1._r8 + 0.61_r8 * rv ) + + + end subroutine virtual_t + + !------------------------- + subroutine zeta_fv( nlon,nlat,nlev,lons,lats, u,v, zeta ) + !use shr_kind_mod, only: r8 => shr_kind_r8 + !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + ! pi => shr_const_pi , & + ! omega => shr_const_omega + + integer, intent(in) :: nlon,nlat,nlev + real(r8), intent(in) :: u(nlon,nlat,nlev),v(nlon,nlat,nlev) + real(r8), intent(out) :: zeta(nlev) + !real(r8), intent(in) :: u(iax-1:iax+1,jax-1:jax+1,nlev) + !real(r8), intent(in) :: v(iax-1:iax+1,jax-1:jax+1,nlev) + real(r8), intent(in) :: lats(nlat),lons(nlon) + real(r8) :: rlats(nlat),rlons(nlon) + real(r8) :: dy,dx0,dx,darea,voo,voo2 + + integer :: iap,jap,iam,jam,i,j,L,iax,jax + + iax=2 + jax=2 + write(*,*) " we're in subr. zeta_fv Lon Lat: " + write(*,*) lons(iax),lats(jax) + + rlons(:) = lons(:) * PI/180._r8 + rlats(:) = lats(:) * PI/180._r8 + + dx0 = rearth* ( rlons(2)-rlons(1) ) + dy = rearth* ( rlats(2)-rlats(1) ) + + darea = dy*dx0*cos( rlats(jax) ) + + write(*,*) dx0,dy,cos( rlats(jax) ) + + do L =1,nlev + zeta(L) = & + ( V(iax+1,jax, L) - V(iax-1,jax,L) ) / ( 2*dx0*cos( rlats(jax) ) ) & + - ( U(iax,jax+1, L) - U(iax,jax-1,L) ) / ( 2*dy ) + end do + + write(*,*) " vorticity est. ",zeta(nlev) + + end subroutine zeta_fv +!================================================================ + subroutine etadot_fv ( nlon, nlat, nlev, lons, lats, u, v, plo, ple, etadot , omega ) + use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 + use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + pi => shr_const_pi + use hycoef, only: hyai, hybi, ps0, hyam, hybm + + integer, intent(in) :: nlon,nlat,nlev + real(r8), intent(in) :: lons(nlon),lats(nlat) + real(r8), intent(in) :: u(nlon,nlat,nlev) , v(nlon,nlat,nlev) , plo( nlon,nlat,nlev) , ple( nlon,nlat,nlev+1) + real(r8), intent(out) :: etadot( nlon,nlat,nlev) ,omega(nlon,nlat,nlev) + !real(r8), intent(in) :: uc(:,:,:) , vc(:,:,:) , ple(:,:,:) + + ! Local variables + real(r8),allocatable :: div(:,:,:) + real(r8),allocatable :: mass(:,:,:), fuc(:,:,:),fvc(:,:,:) + real(r8) :: rlats(nlat), rlons(nlon), rcos1, eta(nlev+1) , dx,dy! radians + real(r8), allocatable :: etadot_t1(:,:), etadot_t2(:,:,:) + integer :: i,j,L,im1,jm1,ip1,jp1 + real :: uc_ijL , vc_ijL + + allocate ( div(nlon,nlat,nlev) ) + allocate ( mass(nlon,nlat,nlev), fuc(nlon,nlat,nlev),fvc(nlon,nlat+1,nlev) ) + allocate ( etadot_t1(nlon,nlat), etadot_t2(nlon,nlat,nlev) ) + + div = 0._r8 + fuc = 0._r8 + fvc = 0._r8 + mass = 0._r8 + etadot = 0._r8 + etadot_t1 = 0._r8 + etadot_t2 = 0._r8 + + rlons(:) = lons(:) * PI/180._r8 + rlats(:) = lats(:) * PI/180._r8 + + do L=1,nlev+1 + eta(L) = hyai(L) + hybi(L) ! 1._r8*L/(nlev+1) + end do + do L=1,nlev + mass(:,:,L) = ( ple(:,:,L+1)-ple(:,:,L) )/( eta(L+1)-eta(L) ) + end do + + ! calculate mass fluxes at gridbox edges, using upwind algorithm + do L=1,nlev + do j=1,nlat + do i=2,nlon + im1=i-1 + !if ( i == 1) im1=nlon + uc_ijL = 0.5*( u(im1,j,L) + u(i,j,L) ) + if ( uc_ijL < 0. ) fuc(i,j,L)= uc_ijL * mass(i,j,L) + if ( uc_ijL >= 0. ) fuc(i,j,L)= uc_ijL * mass(im1,j,L) + end do + end do + end do + ! Note: cos(lat) term incorporated into fluxes + do L=1,nlev + do j=2,nlat + do i=1,nlon + jm1=j-1 + vc_ijL = 0.5 * ( v(i,jm1,L)+v(i,j,L) ) + if ( vc_ijL < 0. ) fvc(i,j,L)= vc_ijL * mass(i,j,L) *cos( rlats(j) ) + if ( vc_ijL >= 0. ) fvc(i,j,L)= vc_ijL * mass(i,jm1,L) *cos( rlats(jm1) ) + end do + end do + end do + + + ! now calculate HORZ divergence of (FUC,FVC). Note coslat term already + ! incorporated in FVC. + do L=1,nlev + do j=1,nlat-1 + do i=1,nlon-1 + ip1=i+1 + jp1=j+1 + rcos1 = 1. /( Rearth*cos( rlats(j) ) ) + div(i,j,L) = rcos1 * ( FUC(ip1,j,L)-FUC(i,j,L) ) / (rlons(ip1)-rlons(i) ) & + + rcos1 * ( FVC(i,jp1,L)-FVC(i,j,L) ) / (rlats(jp1)-rlats(j) ) + end do + end do + end do + + + etadot_t1(:,:)=0._r8 + etadot_t2(:,:,:)=0._r8 + do L=1,nlev + etadot_t1(:,:) = etadot_t1(:,:) + div(:,:,L)*(eta(L+1)-eta(L)) + end do + do L=2,nlev + etadot_t2(:,:,L) = etadot_t2(:,:,L-1) + div(:,:,L)*(eta(L+1)-eta(L)) + end do + do L=1,nlev + etadot(:,:,L) = ( hybm(L)*etadot_t1(:,:) - etadot_t2(:,:,L) ) / mass(:,:,L) + end do + + dx=( rlons(2)-rlons(1) ) * Rearth + dy=( rlats(2)-rlats(1) ) * Rearth + omega = 0._r8 + +#if 1 + do L=1,nlev + do j=2,nlat-1 + do i=2,nlon-1 + omega(i,j,L) = u(i,j,L) * (plo(i+1,j,L)-plo(i-1,j,L))/( 2.*dx*cos(rlats(j)) + 0.1 ) & + + v(i,j,L) * (plo(i,j+1,L)-plo(i,j-1,L))/( 2.*dy ) & + - etadot_t2(i,j,L) + end do + end do + end do +#else + do L=1,nlev + do j=2,nlat-1 + do i=2,nlon-1 + omega(i,j,L) = etadot(i,j,L)*mass(i,j,L) + end do + end do + end do +#endif + + +end subroutine etadot_fv + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! Reading netcdf files +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!================================================================ + subroutine read_netcdf_ana_fv_ini( anal_file , nlon, nlat, nlev,lonidx,latidx ) + ! + ! READ_NETCDF_ANAL_INI: + ! Open the given analyses data file. Query dimesnisons. + ! Close. + !=============================================================== + use cam_abortutils, only : endrun + use netcdf + use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 + use hycoef, only: hyai, hybi, ps0, hyam, hybm + use shr_const_mod, only: rdair => shr_const_rdair + use scammod, only: scmlon,scmlat + use shr_scam_mod, only: shr_scam_getCloseLatLon ! Standardized system subroutines + + !------------- + character(len=*),intent(in):: anal_file + + integer, intent(out) :: nlon,nlat,nlev,latidx,lonidx + + ! Local values + !------------- + integer :: ncid,varid,istat + integer :: ilat,ilon,ilev + integer :: i,j,L + + real(r8) :: closelon,closelat + + logical :: l_have_us , l_have_vs + + l_have_us = .FALSE. + l_have_vs = .FALSE. + + ! masterporc does all of the work here + !----------------------------------------- + if(masterproc) then + + ! Open the given file + !----------------------- + istat=nf90_open(trim(anal_file),NF90_NOWRITE,ncid) + if(istat.ne.NF90_NOERR) then + write(iulog,*)'NF90_OPEN: failed for file ',trim(anal_file) + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + ! Read in Dimensions + !-------------------- + istat=nf90_inq_dimid(ncid,'lon',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_inquire_dimension(ncid,varid,len=nlon) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + istat=nf90_inq_dimid(ncid,'lat',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_inquire_dimension(ncid,varid,len=nlat) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + istat=nf90_inq_dimid(ncid,'lev',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_inquire_dimension(ncid,varid,len=nlev) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + call shr_scam_getCloseLatLon(ncid ,scmlat,scmlon,closelat,closelon,latidx,lonidx) + + ! Close the analyses file and exit + !----------------------- + istat=nf90_close(ncid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_EUL') + endif + + endif ! (masterproc) then + + + end subroutine read_netcdf_ana_fv_ini + +!================================================================ + subroutine read_netcdf_ana_fv( anal_file , nlon, nlat, nlev, & + u, v, & + t, q, ps, phis, & + lons, lats, levs & + , utcore, vtcore, ttcore, ogcore & + ) + ! + ! READ_NETCDF_ANAL : + ! Open the given analyses data file, read in + ! U,V,T,Q, and PS values as well as Lons, Lats. + !=============================================================== + use cam_abortutils, only : endrun + use netcdf + use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 + use hycoef, only: hyai, hybi, ps0, hyam, hybm + use shr_const_mod, only: rdair => shr_const_rdair + ! Arguments + !------------- + character(len=*),intent(in):: anal_file + + integer, intent(in ) :: nlon,nlat,nlev + real(r8), intent(out) :: U(nlon,nlat,nlev), V(nlon,nlat,nlev) + real(r8), intent(out) :: T(nlon,nlat,nlev), Q(nlon,nlat,nlev) + real(r8), intent(out) :: PS(nlon,nlat), PHIS(nlon,nlat) + !real(r8), intent(out) :: PHI(nlon,nlat,nlev+1),PLE(nlon,nlat,nlev+1),PLO(nlon,nlat,nlev) + real(r8), intent(out) :: Lats(nlat),Lons(nlon),Levs(nlev) + + real(r8), intent(out) :: UTCORE(nlon,nlat,nlev), VTCORE(nlon,nlat,nlev), TTCORE(nlon,nlat,nlev) + real(r8), intent(out) :: OGCORE(nlon,nlat,nlev) + + ! Local values + !------------- + integer :: ncid,varid,istat + integer :: ilat,ilon,ilev + integer :: i,j,L + + logical :: l_have_us , l_have_vs + + l_have_us = .FALSE. + l_have_vs = .FALSE. + + ! masterporc does all of the work here + !----------------------------------------- + if(masterproc) then + + ! Open the given file + !----------------------- + istat=nf90_open(trim(anal_file),NF90_NOWRITE,ncid) + if(istat.ne.NF90_NOERR) then + write(iulog,*)'NF90_OPEN: failed for file ',trim(anal_file) + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + end if + end if + + + + if(masterproc) then + + istat=nf90_inq_varid(ncid,'lon',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid,Lons) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + istat=nf90_inq_varid(ncid,'lat',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid,Lats) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + + istat=nf90_inq_varid(ncid,'lev',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid,Levs) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + + if(masterproc) then + ! Read in, transpose lat/lev indices, + ! and scatter data arrays + !---------------------------------- + ! First block reads U + !---------------------------------- + istat=nf90_inq_varid(ncid,'U',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid, U ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'V',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid, V ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + + + +!!!!!!!!!!!!!! + if(masterproc) then + istat=nf90_inq_varid(ncid,'T',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid, T ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'Q',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid, Q ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'PS',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + istat=nf90_get_var(ncid,varid,PS ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'PHIS',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_SE') + endif + istat=nf90_get_var(ncid,varid,PHIS ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + endif + endif ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'UTEND_CORE',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) "No UTEND_CORE on file: " + write(iulog,*) trim(anal_file) + utcore(:,:,:)=-9999._r8 + else + istat=nf90_get_var(ncid,varid,utcore ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + end if + end if + end if ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'VTEND_CORE',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) "No VTEND_CORE on file: " + write(iulog,*) trim(anal_file) + vtcore(:,:,:)=-9999._r8 + else + istat=nf90_get_var(ncid,varid,vtcore ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + end if + end if + end if ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'DTCORE',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) "No TTEND_CORE on file: " + write(iulog,*) trim(anal_file) + ttcore(:,:,:)=-9999._r8 + else + istat=nf90_get_var(ncid,varid,ttcore ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + end if + end if + end if ! (masterproc) then + + if(masterproc) then + istat=nf90_inq_varid(ncid,'OMEGA',varid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) "No OMEGA (core) on file: " + write(iulog,*) trim(anal_file) + ogcore(:,:,:)=-9999._r8 + else + istat=nf90_get_var(ncid,varid,ogcore ) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_FV') + end if + end if + end if ! (masterproc) then + + + if(masterproc) then + ! Close the analysis file + !----------------------- + istat=nf90_close(ncid) + if(istat.ne.NF90_NOERR) then + write(iulog,*) nf90_strerror(istat) + call endrun ('UPDATE_ANALYSES_EUL') + endif + end if + !------------ + + + write(*,*) "In read_netcdf_anal " + write(*,*) "Reading: ",anal_file + write(*,*) "Lons ..." + write(*,*) "Shape: ",shape(Lons) + write(*,*) "MinMax: ",minval(Lons),maxval(Lons) + write(*,*) "US and VS are presnt on file: ",l_have_us, l_have_vs + + + return + end subroutine read_netcdf_ana_fv +!================================================================ +!================================================================ + subroutine dynfrc_timewgts ( & + ana_prev_date, ana_next_date, & + wgt1 , wgt2 ) + + + use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 + use ESMF + use time_manager, only:timemgr_time_ge,timemgr_time_inc,get_curr_date,get_step_size + + integer, intent(in) :: ana_prev_date(4), ana_next_date(4) + real(r8) , intent(out) :: wgt1,wgt2 + + type(ESMF_Time) :: Date1,Date2,Date0 + type(ESMF_TimeInterval) :: DateDiff2,DateDiff0,DateDiff, AnaDiff + integer :: DeltaT0, DeltaT2 , YMD, Year,Month,Day,Sec, Ana_interval, rc + + call get_curr_date(Year,Month,Day,Sec) + YMD=(Year*10000) + (Month*100) + Day + + call ESMF_TimeSet(Date0,YY=Ana_prev_date(1), MM=Ana_prev_date(2) , & + DD= Ana_prev_date(3) , S= Ana_prev_date(4) ) + call ESMF_TimeSet(Date1,YY=Year,MM=Month,DD=Day,S=Sec) + + call ESMF_TimeSet(Date2,YY=Ana_next_date(1), MM=Ana_next_date(2) , & + DD= Ana_next_date(3) , S= Ana_next_date(4) ) + AnaDiff =Date2-Date0 + call ESMF_TimeIntervalGet(AnaDiff,S=Ana_interval ,rc=rc) + + DateDiff2 =Date2-Date1 + call ESMF_TimeIntervalGet(DateDiff2,S=DeltaT2,rc=rc) + DateDiff0 =Date1-Date0 + call ESMF_TimeIntervalGet(DateDiff0,S=DeltaT0,rc=rc) + + wgt1 = 1._r8 - ( 1._r8 * DeltaT0 ) / Ana_interval + wgt2 = 1._r8 - ( 1._r8 * DeltaT2 ) / Ana_interval + +end subroutine dynfrc_timewgts + + +!!!!!!!!!!!!!!!!!!!!!!!!!! + subroutine patch_eta_x_plv ( nx , ny, nL,ix, jx, aa, plo ) + integer, intent(in) :: nx,ny,nl,ix,jx + real(r8), intent(in) :: plo(nx,ny,nL) + real(r8), intent(inout) :: aa(nx,ny,nL) + + real(r8) :: plx(nL),plq(nL),aax(nL),aaq(nL),aat(nx,ny,nL) + real(r8) :: dp,dpk,dpk1,wtk,wtk1 + integer :: i,j,L,k + + + plx(:) = plo(ix,jx,:) ! target pressures + + do j=1,ny + do i=1,nx + plq(:) = plo(i,j,:) + aaq(:) = aa(i,j,:) + !if (plq(1) <= MINVAL(plx) ) aax(1) = aaq(1) + !if (plq(nl) > MAXVAL(plx) ) aax(nl) = aaq(nl) + do L=1,nl + do k=2,nl + if ( ( plx(L) <= plq(k) ).AND.(plx(L) > plq(k-1) ) ) then + dp = plq(k)-plq(k-1) + dpk1 = plx(L)-plq(k-1) + dpk = plq(k)-plx(L) + wtk1 = 1._r8 - dpk1 / dp + wtk = 1._r8 - dpk / dp + aax(L) = wtk * aaq(k) + wtk1 * aaq(k-1) + end if + end do + if ( plx(L) <= plq(1) ) aax(L)=aaq(1) + if ( plx(L) > plq(NL) ) aax(L)=aaq(NL) + end do + + aat(i,j,:)=aax(:) + end do + end do + + aa=aat + +!write(*,*) " mod " +!write(411) nx,ny,nL +!write(411) plo,aa,aat +!PAUSE + + + end subroutine patch_eta_x_plv + + +end module get_ana_dynfrc_4scam diff --git a/src/dynamics/eul/iop.F90 b/src/dynamics/eul/iop.F90 index 24791ad0ed..c51a168a45 100644 --- a/src/dynamics/eul/iop.F90 +++ b/src/dynamics/eul/iop.F90 @@ -204,6 +204,12 @@ subroutine readiopdata(timelevel) ntimelevel=n3 end if +!++jtb + write(*,*) "My copy of iop.F90 " + write(*,*) "Reading :",iopfile +!--jtb + + ! ! Open IOP dataset ! @@ -807,6 +813,13 @@ subroutine readiopdata(timelevel) endif call plevs0(1 ,plon ,plev ,ps(1,1,ntimelevel) ,pint,pmid ,pdel) call shr_sys_flush( iulog ) +!++jtb +! write(*,*) "Vertical Motion: " +! write(*,*) wfld +!!STOP +!--jtb + + ! ! Build interface vector for the specified omega profile ! (weighted average in pressure of specified level values) diff --git a/src/dynamics/eul/scmforecast.F90 b/src/dynamics/eul/scmforecast.F90 index f9c0cbc6a8..b52a3bd92c 100644 --- a/src/dynamics/eul/scmforecast.F90 +++ b/src/dynamics/eul/scmforecast.F90 @@ -1,3 +1,4 @@ +#define SCAMNUDGERUN module scmforecast ! --------------------------------------------------------------------------- ! ! ! @@ -9,7 +10,11 @@ module scmforecast use spmd_utils, only: masterproc use cam_logfile, only: iulog use cam_control_mod, only: adiabatic - +!++jtb +#ifdef SCAMNUDGERUN + use get_ana_dynfrc_4scam, only: get_ana_dynfrc_fv +#endif +!--jtb implicit none private save @@ -59,10 +64,20 @@ subroutine forecast( lat , nlon , ztodt , & scm_relax_tau_sec,scm_relax_tau_top_sec,scm_relax_top_p, & scm_relaxation,scm_use_obs_qv,scm_use_obs_t,scm_use_obs_uv,scm_zadv_q,scm_zadv_t, & scm_zadv_uv,tdiff,tobs,uobs,use_3dfrc,use_camiop,vertdivq, & - vertdivt,vertdivu,vertdivv,vobs,wfld,qinitobs,scm_relax_fincl + vertdivt,vertdivu,vertdivv,vobs,wfld,qinitobs,scm_relax_fincl, & +!++jtb + scmlon,scmlat, & + scm_ana_direct_ttend, & + scm_use_ana_iop +!--jtb use time_manager, only : get_curr_calday, get_nstep, get_step_size, is_first_step use cam_abortutils, only : endrun use string_utils, only: to_upper +!++jtb + use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters + pi => shr_const_pi , & + OOmega => shr_const_omega +!--jtb implicit none @@ -71,6 +86,7 @@ subroutine forecast( lat , nlon , ztodt , & ! ---------------------- ! character(len=*), parameter :: subname = "forecast" + real(r8),parameter :: hugebad=9.99e12_r8 ! --------------------------------------------------- ! ! x = t, u, v, q ! @@ -83,16 +99,16 @@ subroutine forecast( lat , nlon , ztodt , & integer, intent(in) :: nlon real(r8), intent(in) :: ztodt ! Twice time step unless nstep = 0 [ s ] - real(r8), intent(in) :: ps(plon) ! Surface pressure [ Pa ] - real(r8), intent(in) :: psm1(plon) ! Surface pressure [ Pa ] - real(r8), intent(in) :: psm2(plon) ! Surface pressure [ Pa ] + real(r8), intent(inout) :: ps(plon) ! Surface pressure [ Pa ] + real(r8), intent(inout) :: psm1(plon) ! Surface pressure [ Pa ] + real(r8), intent(inout) :: psm2(plon) ! Surface pressure [ Pa ] real(r8), intent(in) :: t3m1(plev) ! Temperature [ K ] - real(r8), intent(in) :: t3m2(plev) ! Temperature [ K ] + real(r8), intent(inout) :: t3m2(plev) ! Temperature [ K ] real(r8), intent(in) :: u3m1(plev) ! Zonal wind [ m/s ] - real(r8), intent(in) :: u3m2(plev) ! Zonal wind [ m/s ] + real(r8), intent(inout) :: u3m2(plev) ! Zonal wind [ m/s ] real(r8), intent(in) :: v3m1(plev) ! Meridional wind [ m/s ] - real(r8), intent(in) :: v3m2(plev) ! Meridional wind [ m/s ] + real(r8), intent(inout) :: v3m2(plev) ! Meridional wind [ m/s ] real(r8), intent(inout) :: q3m1(plev,pcnst) ! Tracers [ kg/kg, #/kg ] real(r8), intent(inout) :: q3m2(plev,pcnst) ! Tracers [ kg/kg, #/kg ] @@ -156,6 +172,7 @@ subroutine forecast( lat , nlon , ztodt , & real(r8) vten_zadv(plev) ! Vertical advective forcing of v [ m/s/s ] real(r8) qten_zadv(plev,pcnst) ! Vertical advective forcing of tracers [ #/kg/s, kg/kg/s ] + ! --------------------------- ! ! For 'scm_relaxation' switch ! ! --------------------------- ! @@ -169,6 +186,88 @@ subroutine forecast( lat , nlon , ztodt , & real(r8) rslope ! [optional] slope for linear relaxation profile real(r8) rycept ! [optional] y-intercept for linear relaxtion profile + +!++jtb +! ------------------------------------ ! +! Quantities derived from Analyses ! +! ------------------------------------ ! +!======================================! + real(r8) dynfrcp(plev) ! Scaling factor for ana-derived tends + logical l_vectinv + real(r8) omega_ana(plev) ! Vertical pressure velocity [ Pa/s ] + real(r8) etad_ana(plev) ! "Eta dot" velocity [ Pa/s ] + real(r8) T_ana(plev), Q_ana(plev) , Tv_ana(plev) ! + real(r8) u_ana(plev), v_ana(plev) ! + real(r8) zeta_ana(plev) ! + real(r8) ps_ana + real(r8) T_ana_diag(plev), Q_ana_diag(plev) ! + real(r8) u_ana_diag(plev), v_ana_diag(plev) ! + ! ----------------------------------- ! + ! vertical advective tendencies ! + ! ----------------------------------- ! + real(r8) tten_vadv_ana(plev) ! Vertical advective forcing of t [ K/s ] + real(r8) uten_vadv_ana(plev) ! Vertical advective forcing of u [ m/s/s ] + real(r8) vten_vadv_ana(plev) ! Vertical advective forcing of v [ m/s/s ] + real(r8) qten_vadv_ana(plev) ! Vertical advective forcing of tracers [ #/kg/s, kg/kg/s ] + ! ------------------------------------- ! + ! Horizontal advective/other tendencies ! + ! ------------------------------------- ! + real(r8) uten_hadv_ana(plev) ! of u [ m/s/s ] + real(r8) vten_hadv_ana(plev) ! of v [ m/s/s ] + real(r8) uten_pfrc_ana(plev) ! of u [ m/s/s ] + real(r8) vten_pfrc_ana(plev) ! of v [ m/s/s ] + real(r8) uten_vort_ana(plev) ! of u [ m/s/s ] + real(r8) vten_vort_ana(plev) ! of v [ m/s/s ] + real(r8) tten_hadv_ana(plev) ! of t [ K/s ] + real(r8) qten_hadv_ana(plev) ! of tracers [ #/kg/s, kg/kg/s ] + + !---------------------------------! + ! Adiabatic compression tendency ! + !---------------------------------! + real(r8) tten_comp_ana(plev) ! of t [ K/s ] + + + real(r8) uten_keg_ana(plev) ! of u [ m/s/s ] + real(r8) uten_prg_ana(plev) ! of u [ m/s/s ] + real(r8) uten_phig_ana(plev) ! of u [ m/s/s ] + ! ------------------------------------------ ! + ! Direct dycore or ana tendencies or quants ! + ! Not recalculated. ! + ! (not usually available, ! + ! set=-9999 if missing ) ! + ! ------------------------------------------ ! + real(r8) tten_dycore_ana(plev) ! Total direct Ana forcing of t [ K/s ] + real(r8) vten_dycore_ana(plev) ! Total direct Ana forcing of v [ m/s/s ] + real(r8) uten_dycore_ana(plev) ! Total direct Ana forcing of u [ m/s/s ] + real(r8) omega_dycore_ana(plev) ! Omega direct from Ana/dycore (not recalc) [ Pa/s ] + ! ----------------------------------- ! + ! total recalc. "dycore" tendencies ! + ! ----------------------------------- ! + real(r8) omega_recalc_ana(plev) ! Omega from Ana/dycore (recalculated) [ Pa/s ] + real(r8) tten_totdyn_ana(plev) ! Total Ana forcing of t [ K/s ] + real(r8) uten_totdyn_ana(plev) ! Total Ana forcing of u [ m/s/s ] + real(r8) vten_totdyn_ana(plev) ! Total Ana forcing of v [ m/s/s ] + real(r8) qten_totdyn_ana(plev) ! Total Ana forcing of tracers [ #/kg/s, kg/kg/s ] + real(r8) fcoriol,uten_coriol(plev),vten_coriol(plev) + real(r8) ufcstm2(plev),vfcstm2(plev) + real(r8) ufcor_0(plev),vfcor_0(plev) + real(r8) uten_totdyn_anax(plev) ! Total Ana forcing of u [ m/s/s ] + real(r8) vten_totdyn_anax(plev) ! Total Ana forcing of v [ m/s/s ] + real(r8) tfw0, tfw1, tfw2, tftotw,ztodtn,AA + integer nsubdyn,nt,nstep_curr + +!+++ARH + !logical use_ana_iop +!---ARH + logical l_use_reconst_ttend ! use reconstructed T-tendency based on analysis + logical l_use_direct_ttend ! use T-tendency direct from dycore + + + l_use_reconst_ttend = .NOT.( scm_ana_direct_ttend ) + l_use_direct_ttend = .NOT.( l_use_reconst_ttend ) + +!--jtb + !+++ BPM check what we have: if (masterproc .and. is_first_step()) write(iulog,*) 'SCAM FORECAST REPORT: ' , & 'have_divq ', have_divq , & @@ -253,8 +352,122 @@ subroutine forecast( lat , nlon , ztodt , & ! = .false. : Use User-generated SCAM IOP file ! ! ------------------------------------------------------- ! - - if( use_camiop ) then +#ifdef SCAMNUDGERUN + !!! use_ana_iop needs to get into namelist!! !!!! +!+++ARH + !use_ana_iop=.TRUE. + !!use_ana_iop=.FALSE. +!---ARH + l_vectinv =.FALSE. + +!+++ARH + !if (use_ana_iop) then + if (scm_use_ana_iop) then +!---ARH + call get_ana_dynfrc_fv ( scmlon, scmlat , & + omega_ana, etad_ana, zeta_ana, & + t_ana , tv_ana , & + q_ana , & + u_ana , & + v_ana , & + ps_ana , & + uten_hadv_ana , & + vten_hadv_ana , & + uten_pfrc_ana , & + vten_pfrc_ana , & + uten_vort_ana , & + vten_vort_ana , & + qten_hadv_ana , & + tten_hadv_ana , & + uten_vadv_ana , & + vten_vadv_ana , & + tten_vadv_ana , & + qten_vadv_ana , & + tten_comp_ana , & + uten_keg_ana , & + uten_phig_ana , & + uten_prg_ana , & + uten_dycore_ana , & + vten_dycore_ana , & + tten_dycore_ana , & + omega_dycore_ana , & + omega_recalc_ana , & + u3m2, v3m2, t3m2, q3m2(:,1), & + u_ana_diag, v_ana_diag, t_ana_diag, q_ana_diag ) + else + ! set these to a "bad" value + omega_ana = HugeBad + etad_ana = HugeBad + zeta_ana = HugeBad + t_ana = HugeBad + tv_ana = HugeBad + q_ana = HugeBad + u_ana = HugeBad + v_ana = HugeBad + t_ana_diag = HugeBad + q_ana_diag = HugeBad + u_ana_diag = HugeBad + v_ana_diag = HugeBad + ps_ana = HugeBad + uten_hadv_ana = HugeBad + vten_hadv_ana = HugeBad + uten_pfrc_ana = HugeBad + vten_pfrc_ana = HugeBad + uten_vort_ana = HugeBad + vten_vort_ana = HugeBad + qten_hadv_ana = HugeBad + tten_hadv_ana = HugeBad + uten_vadv_ana = HugeBad + vten_vadv_ana = HugeBad + tten_vadv_ana = HugeBad + qten_vadv_ana = HugeBad + tten_comp_ana = HugeBad + uten_keg_ana = HugeBad + uten_phig_ana = HugeBad + uten_prg_ana = HugeBad + uten_dycore_ana = HugeBad + vten_dycore_ana = HugeBad + tten_dycore_ana = HugeBad + omega_dycore_ana = HugeBad + omega_recalc_ana = HugeBad + endif + + ! -------------------------------------------------------------- ! + ! Re-Calculate midpoint pressure levels if PS_ANA is reasonable ! + ! -------------------------------------------------------------- ! + if (ps_ana < 500000._r8 ) then + psm1=ps_ana + call plevs0( nlon, plon, plev, psm1, pintm1, pmidm1, pdelm1 ) + end if + if(l_vectinv) then + uten_totdyn_ana = uten_hadv_ana + uten_pfrc_ana + uten_vadv_ana + vten_totdyn_ana = vten_hadv_ana + vten_pfrc_ana + vten_vadv_ana + uten_totdyn_anax = uten_hadv_ana + uten_pfrc_ana + uten_vadv_ana + vten_totdyn_anax = vten_hadv_ana + vten_pfrc_ana + vten_vadv_ana + else + uten_totdyn_ana = uten_hadv_ana + uten_vort_ana + uten_pfrc_ana + uten_vadv_ana + vten_totdyn_ana = vten_hadv_ana + vten_vort_ana + vten_pfrc_ana + vten_vadv_ana + uten_totdyn_anax = uten_hadv_ana + uten_vort_ana + uten_pfrc_ana + uten_vadv_ana + vten_totdyn_anax = vten_hadv_ana + vten_vort_ana + vten_pfrc_ana + vten_vadv_ana + endif + + tten_totdyn_ana = tten_hadv_ana + tten_vadv_ana + tten_comp_ana + qten_totdyn_ana = qten_hadv_ana + qten_vadv_ana +#else +!+++ARH + !use_ana_iop=.FALSE. +!---ARH +#endif + +!++jtb + ! Need 3rd option 'use_ana_iop' + ! - suboption: use {u,v,t,q}ten_vadv_ana OR recalculate with etad_ana + ! - what about other species in q? + ! - we might want to calculate fu,fv using evolving (local) u's and v's + ! to allow geostrophic adjustment. +!--jtb + +if( use_camiop ) then do k = 1, plev tfcst(k) = t3m2(k) + ztodt * tten_phys(k) + ztodt * divt3d(k) ufcst(k) = u3m2(k) + ztodt * uten_phys(k) + ztodt * divu3d(k) @@ -269,8 +482,11 @@ subroutine forecast( lat , nlon , ztodt , & enddo enddo - else - +else ! when use_camiop =.FALSE. +!+++ARH + !if( .NOT.(use_ana_iop) ) then + if( .NOT.(scm_use_ana_iop) ) then +!---ARH ! ---------------------------------------------------------------------------- ! ! Compute 'omega'( wfldint ) at the interface from the value at the mid-point. ! ! SCAM-IOP file must provide omega at the mid-point not at the interface. ! @@ -403,19 +619,197 @@ subroutine forecast( lat , nlon , ztodt , & call endrun( subname//':: divq not on the dataset. Unable to forecast Humidity. Stopping') end if - do k = 1, plev - tfcst(k) = t3m2(k) + ztodt * ( tten_phys(k) + divt(k) + tten_zadv(k) ) - ufcst(k) = u3m2(k) + ztodt * ( uten_phys(k) + divu(k) + uten_zadv(k) ) - vfcst(k) = v3m2(k) + ztodt * ( vten_phys(k) + divv(k) + vten_zadv(k) ) - do m = 1, pcnst - qfcst(1,k,m) = q3m2(k,m) + ztodt * ( qten_phys(k,m) + divq(k,m) + qten_zadv(k,m) ) + + nstep_curr = get_nstep() + + do k = 1, plev + tfcst(k) = t3m2(k) + ztodt * ( tten_phys(k) + divt(k) + tten_zadv(k) ) + ufcst(k) = u3m2(k) + ztodt * ( uten_phys(k) + divu(k) + uten_zadv(k) ) + vfcst(k) = v3m2(k) + ztodt * ( vten_phys(k) + divv(k) + vten_zadv(k) ) + do m = 1, pcnst + qfcst(1,k,m) = q3m2(k,m) + ztodt * ( qten_phys(k,m) + divq(k,m) + qten_zadv(k,m) ) + enddo enddo - enddo + else + !------------------------------------- + ! This is the use_ana_iop=.TRUE. block + !------------------------------------- + + nstep_curr = get_nstep() + + if (is_first_step()) then + u3m2 = u_ana + v3m2 = v_ana + t3m2 = t_ana + q3m2(:,1) = q_ana + psm2 = ps_ana + endif + + + ! ----------------------------------------------------- + ! Applied tendencies are in two + ! categories: 1) physics (includes nudging); + ! and 2) dynamics. Dynamics tendencies are + ! grouped and then scaled by dynfrcp. This is + ! to allow removal of unreliable analysis driven + ! dynamics tendencies above some pressure, + ! typically <~ 10Pa. + !------------------------------------------------------ + dynfrcp(:) = 1._r8 + where( pmidm1 < 10._r8) ! changed from 10. Test. + dynfrcp = 0._r8 + end where + !------------------------------------------------------ + fcoriol = 2._r8 * OOmega * sin( scmlat * PI/180._r8 ) + uten_coriol = fcoriol * v3m2 + vten_coriol = -fcoriol * u3m2 + nsubdyn = 1 + vfcst = v3m2 + ufcst = u3m2 + ztodtn = ztodt/nsubdyn + do nt= 1, nsubdyn + do k = 1, plev + ufcst(k) = ufcst(k) + ztodtn * ( uten_phys(k) & + + dynfrcp(k) * & + ( uten_hadv_ana(k) + uten_vadv_ana(k) & + + uten_vort_ana(k) & + !! + fcoriol * vfcstm2(k) & + + uten_pfrc_ana(k) ) ) + vfcst(k) = vfcst(k) + ztodtn * ( vten_phys(k) & + + dynfrcp(k) * & + ( vten_hadv_ana(k) + vten_vadv_ana(k) & + + vten_vort_ana(k) & + !! - fcoriol * ufcstm2(k) & + + vten_pfrc_ana(k) ) ) + end do + ufcstm2 = ufcst + vfcstm2 = vfcst + end do + + + ufcor_0 = ufcst + vfcor_0 = vfcst + +#if 0 + ! Implicit formulation of Coriolis terms + nsubdyn = 1 + ztodtn = ztodt/nsubdyn + AA = 1._r8/(1._r8 + (ztodtn*fcoriol)**2 ) + do nt= 1, nsubdyn + do k = 1, plev + ufcst(k) = dynfrcp(k) * AA * ( ufcstm2(k) + ztodtn*fcoriol*vfcstm2(k) ) & + + (1._r8 - dynfrcp(k) )*ufcst(k) + vfcst(k) = dynfrcp(k) * AA * ( vfcstm2(k) - ztodtn*fcoriol*ufcstm2(k) ) & + + (1._r8 - dynfrcp(k) )*vfcst(k) + end do + ufcstm2 = ufcst + vfcstm2 = vfcst + end do + + uten_vort_ana = (ufcst - ufcor_0 )/ztodt + vten_vort_ana = (vfcst - vfcor_0 )/ztodt +#endif + + uten_totdyn_ana = uten_hadv_ana + uten_vort_ana + uten_pfrc_ana + uten_vadv_ana + vten_totdyn_ana = vten_hadv_ana + vten_vort_ana + vten_pfrc_ana + vten_vadv_ana + +#if 1 + !---------------------------- + ! Calculate "usual" T-tendencies from complete IOP-file anyway + !---------------------------- + ! ---------------------------------------------------------------------------- ! + ! Compute 'omega'( wfldint ) at the interface from the value at the mid-point. ! + ! SCAM-IOP file must provide omega at the mid-point not at the interface. ! + ! ---------------------------------------------------------------------------- ! + wfldint(1) = 0._r8 + do k = 2, plev + weight = ( pintm1(k) - pmidm1(k-1) ) / ( pmidm1(k) - pmidm1(k-1) ) + wfldint(k) = ( 1._r8 - weight ) * wfld(k-1) + weight * wfld(k) + enddo + wfldint(plevp) = 0._r8 + ! ------------------------------------------------------------ ! + ! Compute Eulerian compression heating due to vertical motion. ! + ! ------------------------------------------------------------ ! + do k = 1, plev + tten_comp_EUL(k) = wfld(k) * t3m1(k) * rair / ( cpair * pmidm1(k) ) + enddo + ! ---------------------------------------------------------------------------- ! + ! Compute Centered Eulerian vertical advective tendencies for all 't, u, v, q' ! + ! ---------------------------------------------------------------------------- ! + do k = 2, plev - 1 + fac = 1._r8 / ( 2.0_r8 * pdelm1(k) ) + tten_zadv_EULc(k) = -fac * ( wfldint(k+1) * ( t3m1(k+1) - t3m1(k) ) + wfldint(k) * ( t3m1(k) - t3m1(k-1) ) ) + end do + k = 1 + fac = 1._r8 / ( 2.0_r8 * pdelm1(k) ) + tten_zadv_EULc(k) = -fac * ( wfldint(k+1) * ( t3m1(k+1) - t3m1(k) ) ) + k = plev + fac = 1._r8 / ( 2.0_r8 * pdelm1(k) ) + tten_zadv_EULc(k) = -fac * ( wfldint(k) * ( t3m1(k) - t3m1(k-1) ) ) + !---------------------------------------- + ! Replace ERA-derived T-tendencies with + ! IOP-file derived T-tendencies + !---------------------------------------- + !!tten_vadv_ana(:) = tten_zadv_EULc(:) + !!tten_comp_ana(:) = tten_comp_EUL(:) + !!tten_hadv_ana(:) = divt(:) + !------------------- + ! For output + !-------------------- + tten_zadv(:) = tten_zadv_EULc(:) + !---------------------------- + ! End of Calculate "usual" T-tendencies from complete IOP-file anyway + !---------------------------- +#endif + + + + if (l_use_reconst_ttend) then + do k=1,plev + tfcst(k) = t3m2(k) + ztodt * ( tten_phys(k) & + + dynfrcp(k) * & + ( tten_hadv_ana(k) + tten_vadv_ana(k) & + + tten_comp_ana(k) ) ) + end do + end if + + if (l_use_direct_ttend) then + do k=1,plev + tfcst(k) = t3m2(k) + ztodt * ( tten_phys(k) & + + dynfrcp(k) * & + ( tten_dycore_ana(k) ) ) + end do + end if + + do k=1,plev + do m = 1, 1 + qfcst(1,k,m) = q3m2(k,m) + ztodt * ( qten_phys(k,m) & + + dynfrcp(k) * & + ( qten_hadv_ana(k) + qten_vadv_ana(k) ) ) + enddo + enddo + + ps = ps_ana + + write(*,*) " Nstep " ,nstep_curr + if (mod( nstep_curr,10)==0) then + !ufcst = 0.5*(ufcst+u3m1) + !vfcst = 0.5*(vfcst+v3m1) + endif + + ! Zero-out NON ana_iop diagnostics + ! ???? + + end if ! END use_ana_iop IF block + + ! This code is executed regardless of use_ana_iop value ! ------------------ ! ! Diagnostic Outputs ! ! ------------------ ! - + call outfld( 'TOBS' , tobs, plon, dummy_dyndecomp ) + call outfld( 'UOBS' , uobs, plon, dummy_dyndecomp ) + call outfld( 'VOBS' , vobs, plon, dummy_dyndecomp ) call outfld( 'TTEN_XYADV' , divt, plon, dummy_dyndecomp ) call outfld( 'UTEN_XYADV' , divu, plon, dummy_dyndecomp ) call outfld( 'VTEN_XYADV' , divv, plon, dummy_dyndecomp ) @@ -438,29 +832,35 @@ subroutine forecast( lat , nlon , ztodt , & call outfld( 'UTEN_ZADV' , uten_zadv, plon, dummy_dyndecomp ) call outfld( 'VTEN_ZADV' , vten_zadv, plon, dummy_dyndecomp ) call outfld( 'QVTEN_ZADV' , qten_zadv(:,1), plon, dummy_dyndecomp ) - call outfld( 'TTEN_ZADV' , vertdivt, plon, dummy_dyndecomp ) - call outfld( 'QVTEN_ZADV' , vertdivq(:,1), plon, dummy_dyndecomp ) + !call outfld( 'TTEN_ZADV' , vertdivt, plon, dummy_dyndecomp ) + !call outfld( 'QVTEN_ZADV' , vertdivq(:,1), plon, dummy_dyndecomp ) - call outfld( 'TTEN_PHYS' , tten_phys, plon, dummy ) - call outfld( 'UTEN_PHYS' , uten_phys, plon, dummy ) - call outfld( 'VTEN_PHYS' , vten_phys, plon, dummy ) - call outfld( 'QVTEN_PHYS' , qten_phys(:,1), plon, dummy ) + call outfld( 'TTEN_COMP_IOP', tten_comp_eul, plon, dummy_dyndecomp ) - endif + call outfld( 'TTEN_PHYS' , tten_phys, plon, dummy_dyndecomp ) + call outfld( 'UTEN_PHYS' , uten_phys, plon, dummy_dyndecomp ) + call outfld( 'VTEN_PHYS' , vten_phys, plon, dummy_dyndecomp ) + call outfld( 'QVTEN_PHYS' , qten_phys(:,1), plon, dummy_dyndecomp ) + + end if ! END of use_camiop IF BLOCK +!!!!#if 0 +!+++ARH + !if( .NOT.(use_ana_iop) ) then + if( .NOT.(scm_use_ana_iop) ) then +!---ARH ! ---------------------------------------------------------------- ! ! Used the SCAM-IOP-specified state instead of forecasted state ! ! at each time step if specified by the switch. ! ! If SCAM-IOP has 't,u,v,q' profile at a single initial time step. ! - ! ---------------------------------------------------------------- ! - + ! ---------------------------------------------------------------- ! if( scm_use_obs_T .and. have_t ) then do k = 1, plev tfcst(k) = tobs(k) enddo endif - if( scm_use_obs_uv .and. have_u .and. have_v ) then + if( scm_use_obs_uv .and. have_u .and. have_v ) then do k = 1, plev ufcst(k) = uobs(k) vfcst(k) = vobs(k) @@ -540,7 +940,9 @@ subroutine forecast( lat , nlon , ztodt , & call outfld( 'TRELAX' , relax_T , plon, dummy ) call outfld( 'QRELAX' , relax_q(1:plev,1) , plon, dummy ) call outfld( 'TAURELAX' , rtau , plon, dummy ) - +!!!#endif + end if ! END of 2nd use_ana_iop BLOCK (exec for use_ana_iop=.F.) + ! --------------------------------------------------------- ! ! Assign the final forecasted state to the output variables ! ! --------------------------------------------------------- ! @@ -548,15 +950,79 @@ subroutine forecast( lat , nlon , ztodt , & t3(1:plev) = tfcst(1:plev) u3(1:plev) = ufcst(1:plev) v3(1:plev) = vfcst(1:plev) - q3(1:plev,1:pcnst) = qfcst(1,1:plev,1:pcnst) - + +!+++ARH + !if (use_ana_iop) then + if (scm_use_ana_iop) then +!---ARH + q3(1:plev,1:1) = qfcst(1,1:plev,1:1) + else + q3(1:plev,1:pcnst) = qfcst(1,1:plev,1:pcnst) + endif + tdiff(1:plev) = t3(1:plev) - tobs(1:plev) qdiff(1:plev) = q3(1:plev,1) - qobs(1:plev) + call outfld( 'QDIFF' , qdiff, plon, dummy_dyndecomp ) call outfld( 'TDIFF' , tdiff, plon, dummy_dyndecomp ) + +#ifdef SCAMNUDGERUN + call outfld( 'OMEGA_IOP' , wfld, plon, dummy_dyndecomp ) + call outfld( 'OMEGA_ANA' , omega_ana, plon, dummy_dyndecomp ) + call outfld( 'ETAD_ANA' , etad_ana, plon, dummy_dyndecomp ) + call outfld( 'ZETA_ANA' , zeta_ana, plon, dummy_dyndecomp ) + call outfld( 'T_ANA' , T_ana_diag, plon, dummy_dyndecomp ) + call outfld( 'Q_ANA' , Q_ana_diag, plon, dummy_dyndecomp ) + call outfld( 'TV_ANA' , Tv_ana, plon, dummy_dyndecomp ) + call outfld( 'U_ANA' , U_ana_diag, plon, dummy_dyndecomp ) + call outfld( 'V_ANA' , V_ana_diag, plon, dummy_dyndecomp ) + + call outfld( 'UTEN_CORIOL' , uten_coriol, plon, dummy_dyndecomp ) + call outfld( 'VTEN_CORIOL' , vten_coriol, plon, dummy_dyndecomp ) + + call outfld( 'UTEN_TOTDYN_ANA' , uten_totdyn_ana, plon, dummy_dyndecomp ) + call outfld( 'VTEN_TOTDYN_ANA' , vten_totdyn_ana, plon, dummy_dyndecomp ) + call outfld( 'TTEN_TOTDYN_ANA' , tten_totdyn_ana, plon, dummy_dyndecomp ) + call outfld( 'QTEN_TOTDYN_ANA' , qten_totdyn_ana, plon, dummy_dyndecomp ) + + call outfld( 'UTEN_TOTDYN_ANAR' , uten_totdyn_anax, plon, dummy_dyndecomp ) + call outfld( 'VTEN_TOTDYN_ANAR' , vten_totdyn_anax, plon, dummy_dyndecomp ) + + call outfld( 'UTEN_DYCORE_ANA' , uten_dycore_ana, plon, dummy_dyndecomp ) + call outfld( 'VTEN_DYCORE_ANA' , vten_dycore_ana, plon, dummy_dyndecomp ) + call outfld( 'TTEN_DYCORE_ANA' , tten_dycore_ana, plon, dummy_dyndecomp ) + call outfld( 'OMEGA_DYCORE_ANA', omega_dycore_ana, plon, dummy_dyndecomp ) + call outfld( 'OMEGA_RECALC_ANA', omega_recalc_ana, plon, dummy_dyndecomp ) + + call outfld( 'UTEN_HADV_ANA' , uten_hadv_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_VADV_ANA' , uten_vadv_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_VORT_ANA' , uten_vort_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_KEG_ANA' , uten_keg_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_PFRC_ANA' , uten_pfrc_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_PRG_ANA' , uten_prg_ana, plon, dummy_dyndecomp ) + call outfld( 'UTEN_PHIG_ANA' , uten_phig_ana, plon, dummy_dyndecomp ) + + call outfld( 'VTEN_HADV_ANA' , vten_hadv_ana, plon, dummy_dyndecomp ) + call outfld( 'VTEN_VADV_ANA' , vten_vadv_ana, plon, dummy_dyndecomp ) + call outfld( 'VTEN_VORT_ANA' , vten_vort_ana, plon, dummy_dyndecomp ) + call outfld( 'VTEN_PFRC_ANA' , vten_pfrc_ana, plon, dummy_dyndecomp ) + + call outfld( 'TTEN_HADV_ANA' , tten_hadv_ana, plon, dummy_dyndecomp ) + call outfld( 'TTEN_VADV_ANA' , tten_vadv_ana, plon, dummy_dyndecomp ) + call outfld( 'TTEN_COMP_ANA' , tten_comp_ana, plon, dummy_dyndecomp ) + + call outfld( 'QTEN_HADV_ANA' , qten_hadv_ana, plon, dummy_dyndecomp ) + call outfld( 'QTEN_VADV_ANA' , qten_vadv_ana, plon, dummy_dyndecomp ) + + if (have_u) call outfld( 'U_IOP' , uobs, plon, dummy_dyndecomp ) + if (have_u) call outfld( 'V_IOP' , vobs, plon, dummy_dyndecomp ) + +#endif return end subroutine forecast - end module scmforecast + + +end module scmforecast diff --git a/src/physics/cam/iop_forcing.F90 b/src/physics/cam/iop_forcing.F90 index 55259685b5..7f309caabc 100644 --- a/src/physics/cam/iop_forcing.F90 +++ b/src/physics/cam/iop_forcing.F90 @@ -29,6 +29,8 @@ subroutine scam_use_iop_srf( cam_in ) use physconst, only: stebol, latvap use scamMod use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use spmd_utils, only: masterproc implicit none save @@ -37,6 +39,17 @@ subroutine scam_use_iop_srf( cam_in ) integer :: c ! Chunk index integer :: ncol ! Number of columns + + if (masterproc) write(iulog,*) " Parameters in iop_forcing :" + if (masterproc) write(iulog,*) " scm_iop_lhflxshflxTg =", scm_iop_lhflxshflxTg + if (masterproc) write(iulog,*) " scm_iop_Tg =", scm_iop_Tg + if (masterproc) write(iulog,*) " scm_crm_mode =", scm_crm_mode + if (masterproc) write(iulog,*) " have_lhflx =", have_lhflx + if (masterproc) write(iulog,*) " have_shflx =", have_shflx + if (masterproc) write(iulog,*) " have_Tg =", have_Tg + if (masterproc) write(iulog,*) " Tground =", tground + + if( scm_iop_lhflxshflxTg .and. scm_iop_Tg ) then call endrun( 'scam_use_iop_srf : scm_iop_lhflxshflxTg and scm_iop_Tg must not be specified at the same time.') end if diff --git a/src/utils/time_manager.F90 b/src/utils/time_manager.F90 index 38ad3b4db2..012de9dd6f 100644 --- a/src/utils/time_manager.F90 +++ b/src/utils/time_manager.F90 @@ -26,8 +26,6 @@ module time_manager get_curr_date, &! return date components at end of current timestep get_prev_date, &! return date components at beginning of current timestep get_start_date, &! return components of the start date - get_stop_date, &! return components of the stop date - get_run_duration, &! return run duration in whole days and remaining seconds get_ref_date, &! return components of the reference date get_perp_date, &! return components of the perpetual date, and current time of day get_curr_time, &! return components of elapsed time since reference date at end of current timestep @@ -679,62 +677,6 @@ subroutine get_start_date(yr, mon, day, tod) call chkrc(rc, sub//': error return from ESMF_TimeGet') end subroutine get_start_date - -!========================================================================================= - -subroutine get_stop_date(yr, mon, day, tod) - - ! Return date components valid at end of run - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'get_stop_date' - integer :: rc - type(ESMF_Time) :: date - !---------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, stopTime=date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - -end subroutine get_stop_date - -!========================================================================================= - -subroutine get_run_duration(nday, nsec) - - ! Return run duration in days and seconds - - ! Arguments - integer, intent(out) ::& - nday, &! number of days in interval - nsec ! remainder in seconds - - ! Local variables - character(len=*), parameter :: sub = 'get_run_duration' - integer :: rc - type(ESMF_Time) :: start_time, stop_time - type(ESMF_TimeInterval) :: diff - !---------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, startTime=start_time, stopTime=stop_time, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - diff = stop_time - start_time - - call ESMF_TimeIntervalGet(diff, d=nday, s=nsec, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - -end subroutine get_run_duration - !========================================================================================= subroutine get_ref_date(yr, mon, day, tod) @@ -1203,13 +1145,26 @@ subroutine timemgr_time_inc(ymd1, tod1, ymd2, tod2, inc_s, inc_h, inc_d) type(ESMF_Time) :: date1 type(ESMF_Time) :: date2 + type(ESMF_TimeInterval) :: t_interval - integer :: year, month, day + integer :: year, month, day !----------------------------------------------------------------------------------------- ! set esmf time object date1 = TimeSetymd( ymd1, tod1, "date1" ) +!++jtb + if (present(inc_s)) then + if ((inc_s >= 10*365*86400) .OR. (inc_s == -999999)) then + ymd2 = ymd1 + 500 * 10000 + tod2 = 0 + if (masterproc) write(iulog,*) "500 year inc", ymd1,ymd2 + RETURN + end if + end if +!--jtb + + ! set esmf time interval object if (present(inc_s)) then call ESMF_TimeIntervalSet(t_interval, s=inc_s, rc=rc) From 17f0d897a2ad81c5abb1c3a9bbeaedda5206cb76 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sun, 29 Aug 2021 14:23:15 -0600 Subject: [PATCH 032/466] fixed restart capabilities --- src/physics/cam/clubb_intr.F90 | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 9c569eac1a..0cd3bf0740 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -398,17 +398,20 @@ subroutine clubb_register_cam( ) call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - call pbuf_add_field('QT_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) - call pbuf_add_field('THETAL_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) - call pbuf_add_field('RCM_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) - call pbuf_add_field('CLDFRAC_CLUBB_macmic','global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) - call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) - call pbuf_add_field('WPRTP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) - call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) + call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') + call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') + + call pbuf_add_field('QT_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) + call pbuf_add_field('THETAL_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) + call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) + call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) + call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) + call pbuf_add_field('WPRTP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) + call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) if (do_clubb_mf) then - call pbuf_add_field('edmf_thlflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) - call pbuf_add_field('edmf_qtflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) - call pbuf_add_field('edmf_thvflx_macmic' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) + call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) + call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) + call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) end if #endif @@ -1254,8 +1257,6 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) - - call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) @@ -1267,7 +1268,6 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if - call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') @@ -1414,7 +1414,6 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_L0' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') end if - call add_default( 'QT_macmic' , 1, ' ') call add_default( 'THETAL_macmic' , 1, ' ') call add_default( 'RCM_CLUBB_macmic' , 1, ' ') @@ -1427,7 +1426,6 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_qtflx_macmic' , 1, ' ') call add_default( 'edmf_thvflx_macmic' , 1, ' ') end if - end if if (history_amwg) then From 44a667c0da1de60c6501c5ba1ee4d41a5f9b8af1 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 10 Sep 2021 10:12:16 -0600 Subject: [PATCH 033/466] added commented out code for optimized L eqn --- src/physics/cam/clubb_mf.F90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 0928c89b7d..3797b13b13 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -439,8 +439,15 @@ subroutine integrate_mf( nz, call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, do_condensation, do_precip, ztop ) +!+++ARH dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - + !ztop = ztop - 1600._r8 + !if (ztop < 1._r8) then + ! dynamic_L0 = clubb_mf_a0 + !else + ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) + !end if +!---ARH else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then !dilute cape calculation !dmpdz = -1._r8*ent_zt(2:nz,:) From 064efe6785b507b59a1cb2a7ec0ba5c47f102bf6 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 10 Sep 2021 17:46:06 -0600 Subject: [PATCH 034/466] added TKE enhanced entrainment, namelist option to control enhanced entrainment --- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 5 ++++ .../scam_STUB/scripts/make_basecase.auto.csh | 9 ++++-- .../scam_STUB/scripts/run_cases.csh | 18 ++++++------ src/physics/cam/clubb_mf.F90 | 28 +++++++++++-------- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 43b943847a..f94d77cad8 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1858,6 +1858,7 @@ .false. 50.0 0.22 + 0.0 0 2.0 0.5 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 4392e935ef..eb67f100d0 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3738,6 +3738,11 @@ do_clubb_mf=FALSE. Default: 0.22 + +Weighting factor for CLUBB TKE on plume entrainment +Default: 0.0 + Real: number of plumes in mass flux ensemble diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index e41abeb7cc..d83eda8f07 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -41,7 +41,7 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64" +set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_0Lopt_3alphturb-nl" # create new basecase ${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported @@ -71,7 +71,7 @@ sed -i 's/intel\/mvapich2-2.3rc2-intel-18.0.3/intel\/mvapich2-2.1-qlc/' ./env_ma echo "scm_use_ana_iop = .true.">>user_nl_cam -echo "cld_macmic_num_steps=3">>user_nl_cam +echo "cld_macmic_num_steps=6">>user_nl_cam #echo "deep_scheme = 'off'">>user_nl_cam #echo "clubb_timestep=150.D0">>user_nl_cam @@ -81,10 +81,11 @@ echo "cld_macmic_num_steps=3">>user_nl_cam #echo "clubb_l_trapezoidal_rule_zt = .false.">>user_nl_cam echo "clubb_mf_nup = 100">>user_nl_cam -echo "clubb_mf_L0 = 15.D0">>user_nl_cam +echo "clubb_mf_L0 = 50.D0">>user_nl_cam echo "clubb_mf_Lopt = 0">>user_nl_cam #echo "clubb_mf_a0 = 1.D0">>user_nl_cam #echo "clubb_mf_b0 = 0.5D0">>user_nl_cam +echo "clubb_mf_aturb = 3.D0">>user_nl_cam echo "do_clubb_mf = .true.">>user_nl_cam echo "do_clubb_mf_diag = .true.">>user_nl_cam @@ -103,6 +104,8 @@ ncap2 --overwrite -s "bdate=${case_date}" STUB_iop.nc STUB_iop.nc ncap2 --overwrite -s "lat[lat]=${case_lat}" STUB_iop.nc STUB_iop.nc ncap2 --overwrite -s "lon[lon]=${case_lon}" STUB_iop.nc STUB_iop.nc +#cp /home/aherring/src/cam6_3_006.dev/usr_src/tke/clubb_mf.F90 SourceMods/src.cam/ + pwd echo "READY TO BUILD/SUBMIT "${CASE} diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index ef978c18b0..275ee3e8b7 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -1,9 +1,9 @@ #!/bin/csh -f -set lat = 23.08900523560209 -set lon = 205 -set casenam = st10 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 23.08900523560209 +#set lon = 205 +#set casenam = st10 +#source make_basecase.auto.csh $lat $lon $casenam #cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs @@ -49,12 +49,12 @@ source make_basecase.auto.csh $lat $lon $casenam #cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs -#set lat = 32.5130890052356 -#set lon = 231.25 -#set casenam = st3 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 32.5130890052356 +set lon = 231.25 +set casenam = st3 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ #set lat = 33.45549738219896 #set lon = 233.75 diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3797b13b13..da92144f1a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -29,12 +29,13 @@ module clubb_mf ! 3 = test plume L0 ! 4 = lel ! 5 = cape - integer :: clubb_mf_Lopt = 0 - real(r8) :: clubb_mf_a0 = 0._r8 - real(r8) :: clubb_mf_b0 = 0._r8 - real(r8) :: clubb_mf_L0 = 0._r8 - real(r8) :: clubb_mf_ent0 = 0._r8 - integer :: clubb_mf_nup = 0 + integer :: clubb_mf_Lopt = 0 + real(r8) :: clubb_mf_a0 = 0._r8 + real(r8) :: clubb_mf_b0 = 0._r8 + real(r8) :: clubb_mf_L0 = 0._r8 + real(r8) :: clubb_mf_ent0 = 0._r8 + real(r8) :: clubb_mf_alphturb= 0._r8 + integer :: clubb_mf_nup = 0 logical, protected :: do_clubb_mf = .false. logical, protected :: do_clubb_mf_diag = .false. logical, protected :: tht_tweaks = .true. @@ -57,8 +58,8 @@ subroutine clubb_mf_readnl(nlfile) integer :: iunit, read_status, ierr - namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_nup, & - do_clubb_mf, do_clubb_mf_diag + namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & + clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -82,6 +83,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_L0") call mpi_bcast(clubb_mf_ent0, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ent0") + call mpi_bcast(clubb_mf_alphturb,1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_alphturb") call mpi_bcast(clubb_mf_nup, 1, mpi_integer, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_nup") call mpi_bcast(do_clubb_mf, 1, mpi_logical, mstrid, mpicom, ierr) @@ -244,7 +247,7 @@ subroutine integrate_mf( nz, wlv, wtv, wp, & B, & ! thermodynamic grid entexp, entexpu, entw, & ! thermodynamic grid - lmixt, & ! thermodynamic grid + eturb, lmixt, & ! thermodynamic grid qtovqs, sevap, & ! thermodynamic grid betathl,betaqt, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid @@ -586,7 +589,8 @@ subroutine integrate_mf( nz, end if ! integrate updraft - entexp = exp(-ent(k+1,i)*dzt(k+1)) + eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + entexp = exp(-ent(k+1,i)*eturb*dzt(k+1)) entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) @@ -612,12 +616,12 @@ subroutine integrate_mf( nz, end if ! get wn^2 - wp = wb*ent(k+1,i) + wp = wb*ent(k+1,i)*eturb if (wp==0._r8) then wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) else entw = exp(-2._r8*wp*dzt(k+1)) - wn2 = entw*upw(k,i)**2._r8+wa*B/(wb*ent(k+1,i))*(1._r8-entw) + wn2 = entw*upw(k,i)**2._r8+(1._r8-entw)*wa*B/wp end if if (wn2>0._r8) then From b10b75ffa5588f452d69a9c3f1f710214a901007 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 15 Sep 2021 18:47:57 -0600 Subject: [PATCH 035/466] introduce minimum L0 parameter and limit dynamic_L0 with this value, currently set to 2 m. --- src/physics/cam/clubb_mf.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index da92144f1a..0fcf72ca0b 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -297,6 +297,9 @@ subroutine integrate_mf( nz, real(r8),parameter :: wstarmin = 1.e-3_r8, & pblhmin = 100._r8 ! + ! min values to avoid singularities + real(r8),parameter :: min_L0 = 2._r8 + ! ! to condensate or not to condensate logical :: do_condensation = .true. ! @@ -490,6 +493,9 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if + ! impose limiter on entrainment length scale + dynamic_L0 = max(min_L0,dynamic_L0) + if (debug) then ! overide stochastic entrainment with fixent ent(:,:) = fixent From 051dd52bb61b5439c9708611476f241c47a6960d Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 21 Sep 2021 17:00:11 -0600 Subject: [PATCH 036/466] removed test plume hieght print statment (causes some 3D failures) --- src/physics/cam/clubb_mf.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 0fcf72ca0b..2710d43a81 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1124,7 +1124,6 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & upqi(k+1) = qin upth(k+1) = thn else - print*, 'L0 HEIGHT ', zm(k) plumeheight = zm(k) exit end if From 1b5854ccf0843752298a7db3d45c1a6c69b08659 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 21 Sep 2021 18:24:55 -0600 Subject: [PATCH 037/466] big fix, zero index for s_aw flagged by compiler --- src/physics/cam/clubb_intr.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 0cd3bf0740..0831fc7922 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2777,7 +2777,7 @@ subroutine clubb_tend_cam( & !endif ! CFL limiter - s_aw(0) = 0._r8 + s_aw(1) = 0._r8 max_cfl(i)= 0._r8 do k=2,pverp max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) From 304cbacd25a9587f2b00b36326fa8b1e70e032bf Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 22 Sep 2021 09:22:14 -0600 Subject: [PATCH 038/466] bug fix in w eqn for test plume (didn't acct for entrainment) --- src/physics/cam/clubb_mf.F90 | 38 ++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 2710d43a81..42e8525849 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -444,7 +444,7 @@ subroutine integrate_mf( nz, !Test plume call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & - wa, do_condensation, do_precip, ztop ) + wa, wb, tke, do_condensation, do_precip, ztop ) !+++ARH dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) !ztop = ztop - 1600._r8 @@ -1029,9 +1029,9 @@ end subroutine knuth subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & - wa, do_condensation, do_precip, plumeheight ) + wa, wb, tke, do_condensation, do_precip, plumeheight ) !********************************************************************** - ! Calculate a single plume with zero entrainment + ! Calculate a single plume with fixed entrainment ! to be used for a dynamic mixing length calculation ! By Rachel Storer !********************************************************************** @@ -1039,20 +1039,24 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & integer, intent(in) :: nz real(r8), dimension(nz), intent(in) :: zm, dzt, iexner_zm, iexner_zt, & - p_zm, qt, thv, thl + p_zm, qt, thv, thl, tke real(r8), intent(in) :: wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, & - cwthv, zcb_unset, wa + cwthv, zcb_unset, wa, wb logical, intent(in) :: do_condensation, do_precip real(r8), intent(inout) :: plumeheight !local variables integer :: k - real(r8), parameter :: pent = 1.E-3_r8 - real(r8) :: thvn, qtn, thln, qcn, thn, qln, qin, qsn, lmixn, zcb, B, wn2, pentexp + real(r8) :: thvn, qtn, thln, qcn, thn, qln, qin, qsn, lmixn, zcb, B, wn2, pentexp, pturb, pentw, wp real(r8), dimension(nz) :: upw, upa, upqt, upthv, upthl, upth, upqs, & upqc, upql, upqi, supqt, supthl - + ! + ! fractional entrainment rate + real(r8), parameter :: pent = 1.E-3_r8 + ! + ! use tke enhanced entrainment + logical :: do_tptke = .false. upw(1) = 0.5_r8 * wmax upa(1) = 0.5_r8 * erf( wmax/(sqrt(2._r8)*sigmaw) ) @@ -1091,13 +1095,15 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & supthl(k+1) = 0._r8 end if ! integrate updraft - pentexp = exp(-pent*dzt(k+1)) + if (do_tptke) then + pturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k)) + else + pturb = 1._r8 + end if + pentexp = exp(-pent*pturb*dzt(k+1)) qtn = qt(k+1) *(1._r8-pentexp ) + upqt (k)*pentexp + supqt(k+1) thln = thl(k+1)*(1._r8-pentexp ) + upthl(k)*pentexp + supthl(k+1) - !qtn = upqt (k) + supqt(k+1) - !thln = upthl(k) + supthl(k+1) - ! get cloud, momentum levels if (do_condensation) then call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & @@ -1110,7 +1116,13 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & B=gravit*(0.5_r8*(thvn + upthv(k))/thv(k+1)-1._r8) ! get wn^2 - wn2 = upw(k)**2._r8+2._r8*wa*B*dzt(k+1) + wp = wb*pent*pturb + if (wp==0._r8) then + wn2 = upw(k)**2._r8+2._r8*wa*B*dzt(k+1) + else + pentw = exp(-2._r8*wp*dzt(k+1)) + wn2 = pentw*upw(k)**2._r8+(1._r8-pentw)*wa*B/wp + end if if (wn2>0._r8) then upw(k+1) = sqrt(wn2) From ae0063939baba175348839ca2f15cfa7499624a6 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 22 Sep 2021 09:44:13 -0600 Subject: [PATCH 039/466] corrected directory paths for MAGIC force SCAM script --- .../scam_STUB/scripts/make_basecase.auto.csh | 10 +-- .../scam_STUB/scripts/run_cases.csh | 90 +++++++++---------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index d83eda8f07..cc56a16080 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -41,7 +41,7 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_0Lopt_3alphturb-nl" +set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_3Lopt_3alph" # create new basecase ${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported @@ -82,10 +82,10 @@ echo "cld_macmic_num_steps=6">>user_nl_cam echo "clubb_mf_nup = 100">>user_nl_cam echo "clubb_mf_L0 = 50.D0">>user_nl_cam -echo "clubb_mf_Lopt = 0">>user_nl_cam -#echo "clubb_mf_a0 = 1.D0">>user_nl_cam -#echo "clubb_mf_b0 = 0.5D0">>user_nl_cam -echo "clubb_mf_aturb = 3.D0">>user_nl_cam +echo "clubb_mf_Lopt = 3">>user_nl_cam +echo "clubb_mf_a0 = 1.D0">>user_nl_cam +echo "clubb_mf_b0 = 0.5D0">>user_nl_cam +echo "clubb_mf_alphturb = 3.D0">>user_nl_cam echo "do_clubb_mf = .true.">>user_nl_cam echo "do_clubb_mf_diag = .true.">>user_nl_cam diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index 275ee3e8b7..37b5a72471 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -1,70 +1,70 @@ #!/bin/csh -f -#set lat = 23.08900523560209 -#set lon = 205 -#set casenam = st10 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 23.08900523560209 +set lon = 205 +set casenam = st10 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 24.03141361256544 -#set lon = 207.5 -#set casenam = st9 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 24.03141361256544 +set lon = 207.5 +set casenam = st9 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 24.9738219895288 -#set lon = 210. -#set casenam = st8 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 24.9738219895288 +set lon = 210. +set casenam = st8 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 25.91623036649214 -#set lon = 212.5 -#set casenam = st7 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 25.91623036649214 +set lon = 212.5 +set casenam = st7 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 27.80104712041884 -#set lon = 217.5 -#set casenam = st6 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 27.80104712041884 +set lon = 217.5 +set casenam = st6 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 29.68586387434554 -#set lon = 222.5 -#set casenam = st5 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 29.68586387434554 +set lon = 222.5 +set casenam = st5 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 31.57068062827226 -#set lon = 228.75 -#set casenam = st4 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 31.57068062827226 +set lon = 228.75 +set casenam = st4 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts set lat = 32.5130890052356 set lon = 231.25 set casenam = st3 source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ -#set lat = 33.45549738219896 -#set lon = 233.75 -#set casenam = st2 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 33.45549738219896 +set lon = 233.75 +set casenam = st2 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs +cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 33.45549738219896 -#set lon = 240. -#set casenam = st1 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 33.45549738219896 +set lon = 240. +set casenam = st1 +source make_basecase.auto.csh $lat $lon $casenam From e452fb85a98b83132903d24fe45a06c560a756aa Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Mon, 4 Oct 2021 14:12:32 -0600 Subject: [PATCH 040/466] New Poisson RNG --- src/physics/cam/clubb_mf.F90 | 81 ++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 42e8525849..bb0fd963eb 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -10,7 +10,7 @@ module clubb_mf use cam_logfile, only: iulog use cam_abortutils,only: endrun use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & - cpwv, cpliq, rh2o, zvir + cpwv, cpliq, rh2o, zvir, pi implicit none private @@ -297,9 +297,6 @@ subroutine integrate_mf( nz, real(r8),parameter :: wstarmin = 1.e-3_r8, & pblhmin = 100._r8 ! - ! min values to avoid singularities - real(r8),parameter :: min_L0 = 2._r8 - ! ! to condensate or not to condensate logical :: do_condensation = .true. ! @@ -493,9 +490,6 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if - ! impose limiter on entrainment length scale - dynamic_L0 = max(min_L0,dynamic_L0) - if (debug) then ! overide stochastic entrainment with fixent ent(:,:) = fixent @@ -992,12 +986,31 @@ subroutine poisson(nz,nup,lambda,poi,state) do i=1,nz do j=1,nup - call knuth(kiss_gen,lambda(i,j),poi(i,j)) + call whichRNG(kiss_gen,lambda(i,j),poi(i,j)) enddo enddo end subroutine poisson + subroutine whichRNG(kiss_gen,lambda,kout) + !********************************************************************** + ! Interface for the two poisson rng subroutines + ! chooses the appropriate subroutine based on the value of lambda + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + type(ShrKissRandGen), intent(inout) :: kiss_gen + real(r8), intent(in) :: lambda + integer, intent(out) :: kout + + if (lambda < 10) then + call knuth(kiss_gen,lambda,kout) + else + call hormann(kiss_gen,lambda,kout) + end if + + end subroutine whichRNG + subroutine knuth(kiss_gen,lambda,kout) !********************************************************************** ! Discrete random poisson from Knuth @@ -1027,6 +1040,58 @@ subroutine knuth(kiss_gen,lambda,kout) end subroutine knuth + subroutine hormann(kiss_gen,lambda,kout) + !********************************************************************** + ! Discrete random poisson from W. Hormann + ! Insurance: Mathematics and Economics 12, 39-45 (1993) + ! By Jake Reschke + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + type(ShrKissRandGen), intent(inout) :: kiss_gen + real(r8), intent(in) :: lambda + integer, intent(out) :: kout + + ! Local variables + real(r8), dimension(1,1) :: U,V + real(r8) :: a,b,vr,alphinv,us,loggam + integer :: k,i + + b = 0.931_r8 + 2.53_r8*sqrt(lambda) + a = -0.059_r8 + 0.02483_r8*b + vr = 0.9277_r8 - 3.6224_r8/(b - 2._r8) + alphinv = 1.1239_r8 + 1.328_r8/(b - 3.4_r8) + + do + call kiss_gen%random(U) + call kiss_gen%random(V) + U(1,1) = U(1,1) - 0.5_r8 + us = 0.5_r8 - abs(U(1,1)) + k = floor( (2._r8*a/us + b)*U(1,1) + lambda + 0.43_r8 ) + if (us >= 0.07_r8 .and. V(1,1) <= vr) then + kout = k + exit + end if + if (k <= 0 .or. (us < 0.013_r8 .and. V(1,1) > us)) then + cycle + end if + ! compute log(k!). If k >=10 use stirling's approximation + if (k < 10) then + loggam = 0._r8 + do i = 1, k + loggam = loggam + log(1._r8*i) + end do + else + loggam = log(sqrt(2._r8*pi)) + (k + 0.5_r8)*log(1._r8*k) - k + (1._r8/12._r8 - 1._r8/(360._r8*k*k))/k + end if + if (log( V(1,1)*alphinv/(a/(us*us) + b) ) <= -1._r8*lambda + k*log(lambda) - loggam) then + kout = k + exit + end if + end do + + end subroutine hormann + subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, wb, tke, do_condensation, do_precip, plumeheight ) From 91c263e6a94a99d13e93e669266594204ee3ada3 Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Tue, 5 Oct 2021 11:37:56 -0600 Subject: [PATCH 041/466] Updated after input from Maria and Mikael --- src/physics/cam/clubb_mf.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index bb0fd963eb..df090bacb5 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1042,7 +1042,8 @@ end subroutine knuth subroutine hormann(kiss_gen,lambda,kout) !********************************************************************** - ! Discrete random poisson from W. Hormann + ! Discrete random poisson + ! Implements PTRS algorithm from W. Hormann ! Insurance: Mathematics and Economics 12, 39-45 (1993) ! By Jake Reschke !********************************************************************** @@ -1060,7 +1061,7 @@ subroutine hormann(kiss_gen,lambda,kout) b = 0.931_r8 + 2.53_r8*sqrt(lambda) a = -0.059_r8 + 0.02483_r8*b vr = 0.9277_r8 - 3.6224_r8/(b - 2._r8) - alphinv = 1.1239_r8 + 1.328_r8/(b - 3.4_r8) + alphinv = 1.1239_r8 + 1.1328_r8/(b - 3.4_r8) do call kiss_gen%random(U) From c18bcf712fd8458d68dee8696ecb6a791a3a4a8b Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Tue, 5 Oct 2021 15:44:05 -0600 Subject: [PATCH 042/466] Made a few modfications requested by Adam H. --- src/physics/cam/clubb_mf.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index df090bacb5..ccae2a2af2 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1003,7 +1003,7 @@ subroutine whichRNG(kiss_gen,lambda,kout) real(r8), intent(in) :: lambda integer, intent(out) :: kout - if (lambda < 10) then + if (lambda < 10._r8) then call knuth(kiss_gen,lambda,kout) else call hormann(kiss_gen,lambda,kout) @@ -1043,8 +1043,8 @@ end subroutine knuth subroutine hormann(kiss_gen,lambda,kout) !********************************************************************** ! Discrete random poisson - ! Implements PTRS algorithm from W. Hormann - ! Insurance: Mathematics and Economics 12, 39-45 (1993) + ! Implements Poisson Transformed Rejection with Squeeze (PTRS) + ! from W. Hormann Insurance: Mathematics and Economics 12, 39-45 (1993) ! By Jake Reschke !********************************************************************** use shr_RandNum_mod, only: ShrKissRandGen From 1923f64fefd0293f9e85341b18c35c44cf620c0f Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sun, 10 Oct 2021 20:14:52 -0600 Subject: [PATCH 043/466] first attempt at coupling mf precip to CAM, invoke via namelist do_clubb_mf_precip --- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 + src/physics/cam/clubb_intr.F90 | 63 ++++++- src/physics/cam/clubb_mf.F90 | 176 +++++++------------ src/physics/cam/physpkg.F90 | 7 +- src/physics/cam_dev/physpkg.F90 | 6 +- 6 files changed, 140 insertions(+), 119 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index f94d77cad8..921d0fd3bd 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1856,6 +1856,7 @@ .false. .false. + .false. 50.0 0.22 0.0 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index eb67f100d0..51d9e27cd3 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3706,6 +3706,12 @@ If .true. add detailed budget terms to output by default. Note that do_clubb_mf Default: .false. + +If .true. turn on Suselj et al 2019 microphysics. +Default: .false. + + Entrainment length scale in meters for individual plumes. Not used if diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 0831fc7922..a67ceac17d 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -267,6 +267,12 @@ module clubb_intr mf_wprtp_macmic_idx, & mf_wpthvp_macmic_idx +!+++ARH + integer :: & + prec_sh_idx, & + snow_sh_idx +!---ARH + ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -1008,6 +1014,11 @@ subroutine clubb_ini_cam(pbuf2d) naai_idx = pbuf_get_index('NAAI') npccn_idx = pbuf_get_index('NPCCN') +!+++ARH + prec_sh_idx = pbuf_get_index('PREC_SH') + snow_sh_idx = pbuf_get_index('SNOW_SH') +!---ARH + iisclr_rt = -1 iisclr_thl = -1 iisclr_CO2 = -1 @@ -1215,6 +1226,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') + + call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') + call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') + ! ---------------------------------------------------------------------------- ! ! Below are for detailed analysis of EDMF Scheme ! ! ---------------------------------------------------------------------------- ! @@ -1344,6 +1359,8 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('THETAL', 1, ' ') call add_default('CONCLD', 1, ' ') call add_default('TKE_CLUBB', 1, ' ') + call add_default('ELEAK_CLUBB', 1, ' ') + call add_default('TFIX_CLUBB', 1, ' ') end if if (history_amwg) then @@ -1735,7 +1752,7 @@ subroutine clubb_tend_cam( & ! Variables below are needed to compute energy integrals for conservation real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis, se_a(pcols), se_b(pcols), clubb_s(pver) + real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] @@ -1863,6 +1880,11 @@ subroutine clubb_tend_cam( & real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. +!+++ARH + real(r8),pointer :: prec_sh(:) ! total precipitation from MF + real(r8),pointer :: snow_sh(:) ! snow from MF +!---ARH + real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) real(r8), pointer :: rcm_macmic(:,:) @@ -1942,6 +1964,7 @@ subroutine clubb_tend_cam( & mf_dry_u, mf_moist_u, & mf_dry_v, mf_moist_v, & mf_moist_qc, & + mf_sqt, mf_sthl, & mf_precc, & s_ae, s_aw, & s_awthl, s_awqt, & @@ -2109,6 +2132,11 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) +!+++ARH + call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) + call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) +!---ARH + ! SILHS covariance contributions call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) @@ -2761,6 +2789,7 @@ subroutine clubb_tend_cam( & mf_dry_u, mf_moist_u, & ! output - plume diagnostics mf_dry_v, mf_moist_v, & ! output - plume diagnostics mf_moist_qc, & ! output - plume diagnostics + mf_sqt, mf_sthl, & ! output - plume diagnostics mf_precc, & ! output - plume diagnostics s_ae, s_aw, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics @@ -2795,10 +2824,12 @@ subroutine clubb_tend_cam( & mf_qcforc = 0._r8 do k=2,pverp rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) + ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & + + mf_sqt(k) thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) + ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & + + mf_sthl(k) mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) @@ -2810,12 +2841,18 @@ subroutine clubb_tend_cam( & ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) end do - ! compute ensemble cloud + ! compute ensemble cloud properties mf_rcm = 0._r8 mf_cloudfrac = 0._r8 mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) mf_cloudfrac(:pverp)= mf_moist_a(:pverp) +!+++ARH + ! [kg/m2/s]->[m/s] + prec_sh(i) = mf_precc(1)/1000._r8 + snow_sh(i) = 0._r8 +!---ARH + end if ! Advance CLUBB CORE one timestep in the future @@ -3180,9 +3217,13 @@ subroutine clubb_tend_cam( & ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime +!+++ARH + ! subtract enthalpy of falling precip from tb + te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime +!---ARH ! Compute the disbalance of total energy, over depth where CLUBB is active - se_dis = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) ! Fix the total energy coming out of CLUBB so it achieves enery conservation. ! Apply this fixer throughout the column evenly, but only at layers where @@ -3193,9 +3234,11 @@ subroutine clubb_tend_cam( & ! variable. if (clubb_do_energyfix) then do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis*gravit + clubb_s(k) = clubb_s(k) - se_dis(i)*gravit enddo endif + ! convert to units of +ve [K] + se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point ! for all variables and therefore is never called in this loop @@ -3269,6 +3312,10 @@ subroutine clubb_tend_cam( & enddo ! end column loop + ! dte / hdtime = [kg/s2]/[s] = W/m2 + call outfld('ELEAK_CLUBB', (te_a - te_b)/hdtime, pcols, lchnk) + call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) + call outfld('KVH_CLUBB', khzm, pcols, lchnk) ! Add constant to ghost point so that output is not corrupted @@ -3746,6 +3793,10 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = wpthvp(:ncol,:) call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) +!+++ARH + call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) +!---ARH + call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index ccae2a2af2..28a521acdf 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -10,7 +10,7 @@ module clubb_mf use cam_logfile, only: iulog use cam_abortutils,only: endrun use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & - cpwv, cpliq, rh2o, zvir, pi + cpwv, cpliq, rh2o, zvir implicit none private @@ -35,11 +35,13 @@ module clubb_mf real(r8) :: clubb_mf_L0 = 0._r8 real(r8) :: clubb_mf_ent0 = 0._r8 real(r8) :: clubb_mf_alphturb= 0._r8 - integer :: clubb_mf_nup = 0 + integer, protected :: clubb_mf_nup = 0 logical, protected :: do_clubb_mf = .false. logical, protected :: do_clubb_mf_diag = .false. - logical, protected :: tht_tweaks = .true. - integer, protected :: mf_num_cin = 5 + logical :: do_clubb_mf_precip = .false. + logical :: tht_tweaks = .true. + integer :: mf_num_cin = 5 + contains subroutine clubb_mf_readnl(nlfile) @@ -59,7 +61,7 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & - clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag + clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -91,6 +93,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf") call mpi_bcast(do_clubb_mf_diag, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_diag") + call mpi_bcast(do_clubb_mf_precip, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_precip") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -108,31 +112,32 @@ subroutine integrate_mf( nz, th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input wpthlp_env, tke, tpert, & ! input - mcape, & ! output - plume diagnostics - upa, & ! output - plume diagnostics - upw, & ! output - plume diagnostics - upqt, & ! output - plume diagnostics - upthl, & ! output - plume diagnostics - upthv, & ! output - plume diagnostics - upth, & ! output - plume diagnostics - upqc, & ! output - plume diagnostics - upbuoy, & ! output - plume diagnostics - ent, & ! output - plume diagnostics - dry_a, moist_a, & ! output - plume diagnostics - dry_w, moist_w, & ! output - plume diagnostics - dry_qt, moist_qt, & ! output - plume diagnostics - dry_thl, moist_thl, & ! output - plume diagnostics - dry_u, moist_u, & ! output - plume diagnostics - dry_v, moist_v, & ! output - plume diagnostics - moist_qc, & ! output - plume diagnostics - precc, & ! output - plume diagnostics - ae, aw, & ! output - diagnosed fluxes BEFORE mean field update - awthl, awqt, & ! output - diagnosed fluxes BEFORE mean field update - awql, awqi, & ! output - diagnosed fluxes BEFORE mean field update - awth, awqv, & ! output - diagnosed fluxes BEFORE mean field update - awu, awv, & ! output - diagnosed fluxes BEFORE mean field update - thflx, qvflx, & ! output - diagnosed fluxes BEFORE mean field update - thvflx, qcflx, & ! output - diagnosed fluxes BEFORE mean field update + mcape, & ! output + upa, & ! output + upw, & ! output + upqt, & ! output + upthl, & ! output + upthv, & ! output + upth, & ! output + upqc, & ! output + upbuoy, & ! output + ent, & ! output + dry_a, moist_a, & ! output + dry_w, moist_w, & ! output + dry_qt, moist_qt, & ! output + dry_thl, moist_thl, & ! output + dry_u, moist_u, & ! output + dry_v, moist_v, & ! output + moist_qc, & ! output + sqt, sthl, & ! output - variables needed for solver + precc, & ! output + ae, aw, & ! output + awthl, awqt, & ! output + awql, awqi, & ! output + awth, awqv, & ! output + awu, awv, & ! output + thflx, qvflx, & ! output + thvflx, qcflx, & ! output thlflx, qtflx, & ! output - variables needed for solver ztop, dynamic_L0 ) @@ -198,6 +203,7 @@ subroutine integrate_mf( nz, dry_u, moist_u, & ! momentum grid dry_v, moist_v, & ! momentum grid moist_qc, & ! momentum grid + sqt, sthl, & ! thermodynamic grid precc, & ! momentum grid ae, aw, & ! momentum grid awthl, awqt, & ! momentum grid @@ -297,12 +303,12 @@ subroutine integrate_mf( nz, real(r8),parameter :: wstarmin = 1.e-3_r8, & pblhmin = 100._r8 ! + ! min values to avoid singularities + real(r8),parameter :: min_L0 = 2._r8 + ! ! to condensate or not to condensate logical :: do_condensation = .true. ! - ! to precip or not to precip - logical :: do_precip = .false. - ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 ! @@ -326,7 +332,6 @@ subroutine integrate_mf( nz, !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! INITIALIZE OUTPUT VARIABLES - ! set updraft properties to zero dry_a = 0._r8 moist_a = 0._r8 dry_w = 0._r8 @@ -340,8 +345,9 @@ subroutine integrate_mf( nz, dry_v = 0._r8 moist_v = 0._r8 moist_qc = 0._r8 + sqt = 0._r8 + sthl = 0._r8 precc = 0._r8 - ! outputs - variables needed for solver aw = 0._r8 awth = 0._r8 awthl = 0._r8 @@ -441,7 +447,7 @@ subroutine integrate_mf( nz, !Test plume call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & - wa, wb, tke, do_condensation, do_precip, ztop ) + wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) !+++ARH dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) !ztop = ztop - 1600._r8 @@ -490,6 +496,9 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if + ! impose limiter on entrainment length scale + dynamic_L0 = max(min_L0,dynamic_L0) + if (debug) then ! overide stochastic entrainment with fixent ent(:,:) = fixent @@ -579,7 +588,7 @@ subroutine integrate_mf( nz, do k=1,nz-1 ! get microphysics, autoconversion - if (do_precip .and. upqc(k,i) > 0._r8) then + if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair @@ -598,6 +607,12 @@ subroutine integrate_mf( nz, un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu +!+++ARH + ! convert source terms to a tendency + supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) + supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) +!---ARH + ! get cloud, momentum levels if (do_condensation) then call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & @@ -647,7 +662,7 @@ subroutine integrate_mf( nz, enddo ! downward sweep for rain evaporation, snow melting - if (do_precip) then + if (do_clubb_mf_precip) then do i=1,clubb_mf_nup do k=nz-1,1,-1 ! get rain evaporation @@ -659,6 +674,9 @@ subroutine integrate_mf( nz, qtovqs = min(1._r8,qtovqs) sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k+1,i),0._r8)) + ! limit evaporation to available precip + sevap = min(sevap,( uprr(k+1,i)/(rho_zt(k)*dzt(k)) - supqt(k,i)*(1._r8-fdd) )) + ! get rain rate uprr(k,i) = uprr(k+1,i) & - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) @@ -746,6 +764,8 @@ subroutine integrate_mf( nz, awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) + sqt(k) = sqt(k) + upa(k,i)*supqt(k,i) + sthl(k) = sthl(k) + upa(k,i)*supthl(k,i) precc(k)= precc(k)+ upa(k,i)*uprr(k,i) enddo enddo @@ -986,31 +1006,12 @@ subroutine poisson(nz,nup,lambda,poi,state) do i=1,nz do j=1,nup - call whichRNG(kiss_gen,lambda(i,j),poi(i,j)) + call knuth(kiss_gen,lambda(i,j),poi(i,j)) enddo enddo end subroutine poisson - subroutine whichRNG(kiss_gen,lambda,kout) - !********************************************************************** - ! Interface for the two poisson rng subroutines - ! chooses the appropriate subroutine based on the value of lambda - !********************************************************************** - use shr_RandNum_mod, only: ShrKissRandGen - - type(ShrKissRandGen), intent(inout) :: kiss_gen - real(r8), intent(in) :: lambda - integer, intent(out) :: kout - - if (lambda < 10._r8) then - call knuth(kiss_gen,lambda,kout) - else - call hormann(kiss_gen,lambda,kout) - end if - - end subroutine whichRNG - subroutine knuth(kiss_gen,lambda,kout) !********************************************************************** ! Discrete random poisson from Knuth @@ -1040,59 +1041,6 @@ subroutine knuth(kiss_gen,lambda,kout) end subroutine knuth - subroutine hormann(kiss_gen,lambda,kout) - !********************************************************************** - ! Discrete random poisson - ! Implements Poisson Transformed Rejection with Squeeze (PTRS) - ! from W. Hormann Insurance: Mathematics and Economics 12, 39-45 (1993) - ! By Jake Reschke - !********************************************************************** - use shr_RandNum_mod, only: ShrKissRandGen - - type(ShrKissRandGen), intent(inout) :: kiss_gen - real(r8), intent(in) :: lambda - integer, intent(out) :: kout - - ! Local variables - real(r8), dimension(1,1) :: U,V - real(r8) :: a,b,vr,alphinv,us,loggam - integer :: k,i - - b = 0.931_r8 + 2.53_r8*sqrt(lambda) - a = -0.059_r8 + 0.02483_r8*b - vr = 0.9277_r8 - 3.6224_r8/(b - 2._r8) - alphinv = 1.1239_r8 + 1.1328_r8/(b - 3.4_r8) - - do - call kiss_gen%random(U) - call kiss_gen%random(V) - U(1,1) = U(1,1) - 0.5_r8 - us = 0.5_r8 - abs(U(1,1)) - k = floor( (2._r8*a/us + b)*U(1,1) + lambda + 0.43_r8 ) - if (us >= 0.07_r8 .and. V(1,1) <= vr) then - kout = k - exit - end if - if (k <= 0 .or. (us < 0.013_r8 .and. V(1,1) > us)) then - cycle - end if - ! compute log(k!). If k >=10 use stirling's approximation - if (k < 10) then - loggam = 0._r8 - do i = 1, k - loggam = loggam + log(1._r8*i) - end do - else - loggam = log(sqrt(2._r8*pi)) + (k + 0.5_r8)*log(1._r8*k) - k + (1._r8/12._r8 - 1._r8/(360._r8*k*k))/k - end if - if (log( V(1,1)*alphinv/(a/(us*us) + b) ) <= -1._r8*lambda + k*log(lambda) - loggam) then - kout = k - exit - end if - end do - - end subroutine hormann - subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, wb, tke, do_condensation, do_precip, plumeheight ) @@ -1170,6 +1118,12 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & qtn = qt(k+1) *(1._r8-pentexp ) + upqt (k)*pentexp + supqt(k+1) thln = thl(k+1)*(1._r8-pentexp ) + upthl(k)*pentexp + supthl(k+1) +!+++ARH + ! convert source terms to a tendency + supqt(k+1) = supqt(k+1)*upw(k)/dzt(k+1) + supthl(k+1) = supthl(k+1)*upw(k)/dzt(k+1) +!---ARH + ! get cloud, momentum levels if (do_condensation) then call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 38cc4fca9d..72a3be6362 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -2203,6 +2203,7 @@ subroutine tphysbc (ztodt, state, & end if flx_cnd(:ncol) = prec_sh(:ncol) + rliq2(:ncol) + call check_energy_chng(state, tend, "convect_shallow", nstep, ztodt, zero, flx_cnd, snow_sh, zero) call check_tracers_chng(state, tracerint, "convect_shallow", nstep, ztodt, zero_tracers) @@ -2341,7 +2342,11 @@ subroutine tphysbc (ztodt, state, & ! Since we "added" the reserved liquid back in this routine, we need ! to account for it in the energy checker - flx_cnd(:ncol) = -1._r8*rliq(:ncol) +!+++ARH + ! add MF precip to flx_cnd [m/s] + flx_cnd(:ncol) = -1._r8*rliq(:ncol) + prec_sh(:ncol) + !flx_cnd(:ncol) = -1._r8*rliq(:ncol) +!---ARH flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) ! Unfortunately, physics_update does not know what time period diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index c252b11d6f..5038a38e39 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -1651,7 +1651,11 @@ subroutine tphysac (ztodt, cam_in, & ! Since we "added" the reserved liquid back in this routine, we need ! to account for it in the energy checker - flx_cnd(:ncol) = -1._r8*rliq(:ncol) +!+++ARH + ! add MF precip to flx_cnd [m/s] + flx_cnd(:ncol) = -1._r8*rliq(:ncol) + prec_sh(:ncol) + !flx_cnd(:ncol) = -1._r8*rliq(:ncol) +!---ARH flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) ! Unfortunately, physics_update does not know what time period From ec42d83367a8b72980d8b0696c0d9ea1769d105f Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 12 Oct 2021 17:03:19 -0600 Subject: [PATCH 044/466] bug fix in rain evap, indices offest by one level --- src/physics/cam/clubb_mf.F90 | 8 ++++---- src/physics/cam_dev/physpkg.F90 | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 28a521acdf..f01855cb36 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -664,7 +664,7 @@ subroutine integrate_mf( nz, ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then do i=1,clubb_mf_nup - do k=nz-1,1,-1 + do k=nz,2,-1 ! get rain evaporation if ((upqs(k,i) + upqs(k-1,i)).le.0._r8) then qtovqs = 0._r8 @@ -672,13 +672,13 @@ subroutine integrate_mf( nz, qtovqs = (upqt(k,i) + upqt(k-1,i))/(upqs(k,i) + upqs(k-1,i)) end if qtovqs = min(1._r8,qtovqs) - sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k+1,i),0._r8)) + sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k,i),0._r8)) ! limit evaporation to available precip - sevap = min(sevap,( uprr(k+1,i)/(rho_zt(k)*dzt(k)) - supqt(k,i)*(1._r8-fdd) )) + sevap = min(sevap,( uprr(k,i)/(rho_zt(k)*dzt(k)) - supqt(k,i)*(1._r8-fdd) )) ! get rain rate - uprr(k,i) = uprr(k+1,i) & + uprr(k-1,i) = uprr(k,i) & - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) if (debug) then diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index 5038a38e39..18a502ac5b 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -1469,6 +1469,11 @@ subroutine tphysac (ztodt, cam_in, & real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation +!+++ARH + real(r8),pointer :: prec_sh(:) ! total precipitation from Hack convection + real(r8),pointer :: snow_sh(:) ! snow from Hack convection +!---ARH + ! Local copies for substepping real(r8) :: prec_pcw_macmic(pcols) real(r8) :: snow_pcw_macmic(pcols) @@ -1568,6 +1573,10 @@ subroutine tphysac (ztodt, cam_in, & ifld = pbuf_get_index('AST') call pbuf_get_field(pbuf, ifld, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) +!+++ARH + call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) + call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) +!---ARH ! ! accumulate fluxes into net flux array for spectral dycores ! jrm Include latent heat of fusion for snow From 8f7e6305223ce5e8e64f54e3721aa3e628044521 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 22 Oct 2021 16:22:09 -0600 Subject: [PATCH 045/466] fix mass conservation bug in MF precip. Added LBA IOP (needs testing) --- .../usermods_dirs/scam_LBA/shell_commands | 16 ++++++++++++++ .../usermods_dirs/scam_LBA/user_nl_cam | 21 +++++++++++++++++++ .../scam_STUB/scripts/make_basecase.auto.csh | 13 ++++++++++-- src/physics/cam/clubb_intr.F90 | 21 ++++--------------- src/physics/cam/clubb_mf.F90 | 18 +++++++++------- 5 files changed, 63 insertions(+), 26 deletions(-) create mode 100755 cime_config/usermods_dirs/scam_LBA/shell_commands create mode 100644 cime_config/usermods_dirs/scam_LBA/user_nl_cam diff --git a/cime_config/usermods_dirs/scam_LBA/shell_commands b/cime_config/usermods_dirs/scam_LBA/shell_commands new file mode 100755 index 0000000000..3defb4be66 --- /dev/null +++ b/cime_config/usermods_dirs/scam_LBA/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +./xmlchange PTS_LON=0.0 +./xmlchange PTS_LAT=0.0 + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +./xmlchange RUN_STARTDATE=1999-02-23 +./xmlchange START_TOD=0 +./xmlchange STOP_OPTION=nminutes +./xmlchange STOP_N=590 + +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. diff --git a/cime_config/usermods_dirs/scam_LBA/user_nl_cam b/cime_config/usermods_dirs/scam_LBA/user_nl_cam new file mode 100644 index 0000000000..e7f05dcdc6 --- /dev/null +++ b/cime_config/usermods_dirs/scam_LBA/user_nl_cam @@ -0,0 +1,21 @@ + iopfile='/home/aherring/scam/iopfiles/iop_LBA.nc' + ncdata='$DIN_LOC_ROOT/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + nhtfrq = 1 + mfilt = 720 + scm_use_obs_uv = .true. + scm_relaxation = .true. + scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' + scm_relax_bot_p = 105000. + scm_relax_top_p = 200. + scm_relax_linear = .true. + scm_relax_tau_bot_sec = 864000. + scm_relax_tau_top_sec = 172800. + fincl1= 'CDNUMC', 'AQSNOW','ANSNOW','FREQSL','LS_FLXPRC','THETAL','CLDST', + 'DP_CLD','EFFCLD','FRECU','FREDP','FREQSH','FRETOT','OMEGAQ','SST', 'PRECSH', + 'edmf_upa' , 'edmf_upw' , 'edmf_upqt' , 'edmf_upthl' , 'edmf_upthv', + 'edmf_upth' , 'edmf_upqc' , 'edmf_upbuoy', 'edmf_upent' + use_gw_front = .false. + use_gw_convect_dp = .false. + scm_iop_lhflxshflxtg = .true. diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index cc56a16080..e366cf6a66 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -80,6 +80,17 @@ echo "cld_macmic_num_steps=6">>user_nl_cam #echo "clubb_l_trapezoidal_rule_zm = .false.">>user_nl_cam #echo "clubb_l_trapezoidal_rule_zt = .false.">>user_nl_cam +# c6 needs to be modified via SoureMods +#echo "clubb_c1 = 0.5">>user_nl_cam +#echo "clubb_c1b = 0.5">>user_nl_cam +#echo "clubb_C2rt = 0.5">>user_nl_cam +#echo "clubb_C2thl = 0.5">>user_nl_cam +#echo "clubb_C2rtthl = 0.65">>user_nl_cam +#echo "clubb_C4 = 2.6">>user_nl_cam +#echo "clubb_C8 = 2.1">>user_nl_cam +#echo "clubb_C8b = 0.0">>user_nl_cam +#echo "clubb_c14 = 1.1">>user_nl_cam + echo "clubb_mf_nup = 100">>user_nl_cam echo "clubb_mf_L0 = 50.D0">>user_nl_cam echo "clubb_mf_Lopt = 3">>user_nl_cam @@ -104,8 +115,6 @@ ncap2 --overwrite -s "bdate=${case_date}" STUB_iop.nc STUB_iop.nc ncap2 --overwrite -s "lat[lat]=${case_lat}" STUB_iop.nc STUB_iop.nc ncap2 --overwrite -s "lon[lon]=${case_lon}" STUB_iop.nc STUB_iop.nc -#cp /home/aherring/src/cam6_3_006.dev/usr_src/tke/clubb_mf.F90 SourceMods/src.cam/ - pwd echo "READY TO BUILD/SUBMIT "${CASE} diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index a67ceac17d..d37895a335 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -267,11 +267,9 @@ module clubb_intr mf_wprtp_macmic_idx, & mf_wpthvp_macmic_idx -!+++ARH integer :: & prec_sh_idx, & snow_sh_idx -!---ARH ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -1014,10 +1012,8 @@ subroutine clubb_ini_cam(pbuf2d) naai_idx = pbuf_get_index('NAAI') npccn_idx = pbuf_get_index('NPCCN') -!+++ARH prec_sh_idx = pbuf_get_index('PREC_SH') snow_sh_idx = pbuf_get_index('SNOW_SH') -!---ARH iisclr_rt = -1 iisclr_thl = -1 @@ -1880,10 +1876,9 @@ subroutine clubb_tend_cam( & real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. -!+++ARH - real(r8),pointer :: prec_sh(:) ! total precipitation from MF - real(r8),pointer :: snow_sh(:) ! snow from MF -!---ARH + ! MF precip + real(r8), pointer :: prec_sh(:) ! total precipitation from MF + real(r8), pointer :: snow_sh(:) ! snow from MF real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) @@ -2131,11 +2126,8 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, pblh_idx, pblh) call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - -!+++ARH call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) -!---ARH ! SILHS covariance contributions call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) @@ -2847,11 +2839,9 @@ subroutine clubb_tend_cam( & mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) mf_cloudfrac(:pverp)= mf_moist_a(:pverp) -!+++ARH ! [kg/m2/s]->[m/s] prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 -!---ARH end if @@ -3217,10 +3207,9 @@ subroutine clubb_tend_cam( & ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime -!+++ARH + ! subtract enthalpy of falling precip from tb te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime -!---ARH ! Compute the disbalance of total energy, over depth where CLUBB is active se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) @@ -3793,9 +3782,7 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = wpthvp(:ncol,:) call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) -!+++ARH call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) -!---ARH call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index f01855cb36..e13ffeef71 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -607,11 +607,9 @@ subroutine integrate_mf( nz, un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu -!+++ARH ! convert source terms to a tendency supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) -!---ARH ! get cloud, momentum levels if (do_condensation) then @@ -689,6 +687,7 @@ subroutine integrate_mf( nz, ! update source terms lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) + ! scale autoconv by factor (1-fdd)? supqt(k,i) = supqt(k,i) + sevap supthl(k,i) = supthl(k,i) - lmixt*sevap*iexner_zt(k)/cpair end do @@ -764,12 +763,19 @@ subroutine integrate_mf( nz, awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) - sqt(k) = sqt(k) + upa(k,i)*supqt(k,i) - sthl(k) = sthl(k) + upa(k,i)*supthl(k,i) - precc(k)= precc(k)+ upa(k,i)*uprr(k,i) + if (k > 1) then + ! scale autoconv by factor (1-fdd)? + sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) + sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) + end if enddo enddo + ! downward sweep to get ensemble mean precip + do k = nz,2,-1 + precc(k-1) = precc(k) - rho_zt(k)*dzt(k)*sqt(k) + end do + awthl_conv = awthl awqt_conv = awqt awthv_conv = awthv @@ -1118,11 +1124,9 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & qtn = qt(k+1) *(1._r8-pentexp ) + upqt (k)*pentexp + supqt(k+1) thln = thl(k+1)*(1._r8-pentexp ) + upthl(k)*pentexp + supthl(k+1) -!+++ARH ! convert source terms to a tendency supqt(k+1) = supqt(k+1)*upw(k)/dzt(k+1) supthl(k+1) = supthl(k+1)*upw(k)/dzt(k+1) -!---ARH ! get cloud, momentum levels if (do_condensation) then From 64bcb783ab1724716ac46f90a5241d34c3a42520 Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Tue, 26 Oct 2021 14:57:54 -0600 Subject: [PATCH 046/466] Implemented implicit method for clubb mf upw equation. Added logical option to use implicit method, with default value false --- src/physics/cam/clubb_mf.F90 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e13ffeef71..5db7983890 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -260,6 +260,7 @@ subroutine integrate_mf( nz, qtn, qsn, & ! momentum grid qcn, qln, qin, & ! momentum grid un, vn, wn2, & ! momentum grid + wn, & ! momentum grid lmixn, srfarea, & ! momentum grid srfwqtu, srfwthvu, & facqtu, facthvu @@ -309,6 +310,9 @@ subroutine integrate_mf( nz, ! to condensate or not to condensate logical :: do_condensation = .true. ! + ! use implicit method for plume updraft velocity + logical :: do_implicit = .false. + ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 ! @@ -628,17 +632,23 @@ subroutine integrate_mf( nz, end if end if - ! get wn^2 - wp = wb*ent(k+1,i)*eturb - if (wp==0._r8) then - wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) + if (do_implicit) then + wp = clubb_mf_alphturb*wb*ent(k+1,i)*sqrt(tke(k+1))*dzt(k+1) + wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1))*(upw(k,i)**2._r8 + 2._r8*wa*B*dzt(k+1))) )/(1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1)) else - entw = exp(-2._r8*wp*dzt(k+1)) - wn2 = entw*upw(k,i)**2._r8+(1._r8-entw)*wa*B/wp + ! get wn2 + wp = wb*ent(k+1,i)*eturb + if (wp==0._r8) then + wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) + else + entw = exp(-2._r8*wp*dzt(k+1)) + wn2 = entw*upw(k,i)**2._r8+(1._r8-entw)*wa*B/wp + end if + wn = sqrt(max(wn2, 0._r8)) end if - if (wn2>0._r8) then - upw(k+1,i) = sqrt(wn2) + if (wn>0._r8) then + upw(k+1,i) = wn upthv(k+1,i) = thvn upthl(k+1,i) = thln upqt(k+1,i) = qtn From ee0830c983ae6a043f7917480871af4249c1b81b Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Tue, 26 Oct 2021 18:24:42 -0600 Subject: [PATCH 047/466] Implicit method now used midpoint TKE --- src/physics/cam/clubb_mf.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 5db7983890..42e1c07489 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -633,8 +633,9 @@ subroutine integrate_mf( nz, end if if (do_implicit) then - wp = clubb_mf_alphturb*wb*ent(k+1,i)*sqrt(tke(k+1))*dzt(k+1) - wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1))*(upw(k,i)**2._r8 + 2._r8*wa*B*dzt(k+1))) )/(1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1)) + wp = clubb_mf_alphturb*wb*ent(k+1,i)*sqrt(0.5_r8*(tke(k+1)+tke(k)))*dzt(k+1) + wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1))* & + (upw(k,i)**2._r8 + 2._r8*wa*B*dzt(k+1))) )/(1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1)) else ! get wn2 wp = wb*ent(k+1,i)*eturb From 4434260d2fe1a4ce951ed2b0b880fe39e52ca51f Mon Sep 17 00:00:00 2001 From: Jake Reschke Date: Thu, 28 Oct 2021 16:07:03 -0600 Subject: [PATCH 048/466] put new poisson RNG back into clubb_mf.F90 --- src/physics/cam/clubb_mf.F90 | 82 ++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 42e1c07489..00606ba220 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -10,7 +10,7 @@ module clubb_mf use cam_logfile, only: iulog use cam_abortutils,only: endrun use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & - cpwv, cpliq, rh2o, zvir + cpwv, cpliq, rh2o, zvir, pi implicit none private @@ -304,9 +304,6 @@ subroutine integrate_mf( nz, real(r8),parameter :: wstarmin = 1.e-3_r8, & pblhmin = 100._r8 ! - ! min values to avoid singularities - real(r8),parameter :: min_L0 = 2._r8 - ! ! to condensate or not to condensate logical :: do_condensation = .true. ! @@ -500,9 +497,6 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if - ! impose limiter on entrainment length scale - dynamic_L0 = max(min_L0,dynamic_L0) - if (debug) then ! overide stochastic entrainment with fixent ent(:,:) = fixent @@ -1023,12 +1017,31 @@ subroutine poisson(nz,nup,lambda,poi,state) do i=1,nz do j=1,nup - call knuth(kiss_gen,lambda(i,j),poi(i,j)) + call hybridRNG(kiss_gen,lambda(i,j),poi(i,j)) enddo enddo end subroutine poisson + subroutine hybridRNG(kiss_gen,lambda,kout) + !********************************************************************** + ! Interface for the two poisson rng subroutines + ! chooses the appropriate subroutine based on the value of lambda + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + type(ShrKissRandGen), intent(inout) :: kiss_gen + real(r8), intent(in) :: lambda + integer, intent(out) :: kout + + if (lambda < 10._r8) then + call knuth(kiss_gen,lambda,kout) + else + call hormann(kiss_gen,lambda,kout) + end if + + end subroutine hybridRNG + subroutine knuth(kiss_gen,lambda,kout) !********************************************************************** ! Discrete random poisson from Knuth @@ -1058,6 +1071,59 @@ subroutine knuth(kiss_gen,lambda,kout) end subroutine knuth + subroutine hormann(kiss_gen,lambda,kout) + !********************************************************************** + ! Discrete random poisson + ! Implements Poisson Transformed Rejection with Squeeze (PTRS) + ! from W. Hormann Insurance: Mathematics and Economics 12, 39-45 (1993) + ! By Jake Reschke + !********************************************************************** + use shr_RandNum_mod, only: ShrKissRandGen + + type(ShrKissRandGen), intent(inout) :: kiss_gen + real(r8), intent(in) :: lambda + integer, intent(out) :: kout + + ! Local variables + real(r8), dimension(1,1) :: U,V + real(r8) :: a,b,vr,alphinv,us,loggam + integer :: k,i + + b = 0.931_r8 + 2.53_r8*sqrt(lambda) + a = -0.059_r8 + 0.02483_r8*b + vr = 0.9277_r8 - 3.6224_r8/(b - 2._r8) + alphinv = 1.1239_r8 + 1.1328_r8/(b - 3.4_r8) + + do + call kiss_gen%random(U) + call kiss_gen%random(V) + U(1,1) = U(1,1) - 0.5_r8 + us = 0.5_r8 - abs(U(1,1)) + k = floor( (2._r8*a/us + b)*U(1,1) + lambda + 0.43_r8 ) + if (us >= 0.07_r8 .and. V(1,1) <= vr) then + kout = k + exit + end if + if (k <= 0 .or. (us < 0.013_r8 .and. V(1,1) > us)) then + cycle + end if + ! compute log(k!). If k >=10 use stirling's approximation + if (k < 10) then + loggam = 0._r8 + do i = 1, k + loggam = loggam + log(1._r8*i) + end do + else + loggam = log(sqrt(2._r8*pi)) + (k + 0.5_r8)*log(1._r8*k) - k + (1._r8/12._r8 - 1._r8/(360._r8*k*k))/k + end if + if (log( V(1,1)*alphinv/(a/(us*us) + b) ) <= -1._r8*lambda + k*log(lambda) - loggam) then + kout = k + exit + end if + end do + + end subroutine hormann + subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, wb, tke, do_condensation, do_precip, plumeheight ) From 7048528a41f3bd4c533c064cbd319e4e6059cd4f Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 28 Oct 2021 18:51:44 -0600 Subject: [PATCH 049/466] provide avg of precc over subcycles to CPL --- src/physics/cam/physpkg.F90 | 19 +++++++++++++++++-- src/physics/cam_dev/physpkg.F90 | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index 72a3be6362..6fd44897f3 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1977,6 +1977,11 @@ subroutine tphysbc (ztodt, state, & real(r8) :: prec_sed_macmic(pcols) real(r8) :: snow_sed_macmic(pcols) +!+++ARH + real(r8) :: prec_sh_macmic(pcols) + real(r8) :: snow_sh_macmic(pcols) +!---ARH + ! energy checking variables real(r8) :: zero(pcols) ! array of zeros real(r8) :: zero_sc(pcols*psubcols) ! array of zeros @@ -2273,7 +2278,10 @@ subroutine tphysbc (ztodt, state, & snow_sed_macmic = 0._r8 prec_pcw_macmic = 0._r8 snow_pcw_macmic = 0._r8 - +!+++ARH + prec_sh_macmic = 0._r8 + snow_sh_macmic = 0._r8 +!---ARH do macmic_it = 1, cld_macmic_num_steps !=================================================== @@ -2379,6 +2387,10 @@ subroutine tphysbc (ztodt, state, & endif call t_stopf('macrop_tend') +!+++ARH + prec_sh_macmic(:ncol) = prec_sh_macmic(:ncol) + prec_sh(:ncol) + snow_sh_macmic(:ncol) = snow_sh_macmic(:ncol) + snow_sh(:ncol) +!---ARH !=================================================== ! Calculate cloud microphysics @@ -2516,7 +2528,10 @@ subroutine tphysbc (ztodt, state, & snow_pcw(:ncol) = snow_pcw_macmic(:ncol)/cld_macmic_num_steps prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) - +!+++ARH + prec_sh(:ncol) = prec_sh_macmic(:ncol)/cld_macmic_num_steps + snow_sh(:ncol) = snow_sh_macmic(:ncol)/cld_macmic_num_steps +!---ARH endif ! Add the precipitation from CARMA to the precipitation from stratiform. diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index 18a502ac5b..78df1d194b 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -1480,6 +1480,11 @@ subroutine tphysac (ztodt, cam_in, & real(r8) :: prec_sed_macmic(pcols) real(r8) :: snow_sed_macmic(pcols) +!+++ARH + real(r8) :: prec_sh_macmic(pcols) + real(r8) :: snow_sh_macmic(pcols) +!---ARH + logical :: labort ! abort flag real(r8) tvm(pcols,pver) ! virtual temperature @@ -1624,6 +1629,10 @@ subroutine tphysac (ztodt, cam_in, & snow_sed_macmic = 0._r8 prec_pcw_macmic = 0._r8 snow_pcw_macmic = 0._r8 +!+++ARH + prec_sh_macmic = 0._r8 + snow_sh_macmic = 0._r8 +!---ARH !+++ARH ! ! contrail parameterization @@ -1696,7 +1705,10 @@ subroutine tphysac (ztodt, cam_in, & flx_heat(:ncol)/cld_macmic_num_steps) call t_stopf('macrop_tend') - +!+++ARH + prec_sh_macmic(:ncol) = prec_sh_macmic(:ncol) + prec_sh(:ncol) + snow_sh_macmic(:ncol) = snow_sh_macmic(:ncol) + snow_sh(:ncol) +!---ARH !=================================================== ! Calculate cloud microphysics !=================================================== @@ -1838,6 +1850,10 @@ subroutine tphysac (ztodt, cam_in, & snow_pcw(:ncol) = snow_pcw_macmic(:ncol)/cld_macmic_num_steps prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) +!+++ARH + prec_sh(:ncol) = prec_sh_macmic(:ncol)/cld_macmic_num_steps + snow_sh(:ncol) = snow_sh_macmic(:ncol)/cld_macmic_num_steps +!---ARH endif From 043462e4d559b32b810b3c6ef3e694bca93894b8 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Mon, 1 Nov 2021 09:47:37 -0600 Subject: [PATCH 050/466] EDMF convective cloud added to shallow convective cloud fraction and mixing ratio variables in pbuf for radiation --- src/physics/cam/clubb_intr.F90 | 110 ++++++++++++++++++++++++--------- 1 file changed, 80 insertions(+), 30 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d37895a335..1a933820cd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -212,6 +212,9 @@ module clubb_intr kvh_idx, & ! CLUBB eddy diffusivity on thermo levels pblh_idx, & ! PBL pbuf icwmrdp_idx, & ! In cloud mixing ratio for deep convection +!+++MKW + icwmrsh_idx, & ! In cloud mixing ratio for shallow convection (MF) +!---MKW tke_idx, & ! turbulent kinetic energy tpert_idx, & ! temperature perturbation from PBL fice_idx, & ! fice_idx index in physics buffer @@ -267,9 +270,11 @@ module clubb_intr mf_wprtp_macmic_idx, & mf_wpthvp_macmic_idx +!+++ARH integer :: & prec_sh_idx, & snow_sh_idx +!---ARH ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -1003,6 +1008,9 @@ subroutine clubb_ini_cam(pbuf2d) qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio +!+++MKW + icwmrsh_idx = pbuf_get_index('ICWMRSH') ! In-cloud shallow convective mixing ratio (EDMF) +!---MKW sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG @@ -1012,8 +1020,10 @@ subroutine clubb_ini_cam(pbuf2d) naai_idx = pbuf_get_index('NAAI') npccn_idx = pbuf_get_index('NPCCN') +!+++ARH prec_sh_idx = pbuf_get_index('PREC_SH') snow_sh_idx = pbuf_get_index('SNOW_SH') +!---ARH iisclr_rt = -1 iisclr_thl = -1 @@ -1847,6 +1857,9 @@ subroutine clubb_tend_cam( & real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] +!+++MKW + real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] +!---MKW real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] @@ -1876,9 +1889,10 @@ subroutine clubb_tend_cam( & real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - ! MF precip - real(r8), pointer :: prec_sh(:) ! total precipitation from MF - real(r8), pointer :: snow_sh(:) ! snow from MF +!+++ARH + real(r8),pointer :: prec_sh(:) ! total precipitation from MF + real(r8),pointer :: snow_sh(:) ! snow from MF +!---ARH real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) @@ -1918,7 +1932,7 @@ subroutine clubb_tend_cam( & mf_thflx_output, mf_qvflx_output, & mf_thlflx_output, mf_qtflx_output, & mf_thvflx_output, & - mf_rcm_output, mf_cloudfrac_output, & + mf_rcm_output, & mf_precc_output ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & @@ -1927,7 +1941,9 @@ subroutine clubb_tend_cam( & ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output ! thermodynamic grid + mf_qcforc_output, & ! thermodynamic grid + mf_qc_output, mf_cloudfrac_output ! thermodynamic grid + ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & @@ -1952,26 +1968,30 @@ subroutine clubb_tend_cam( & ! MF Plume real(r8), pointer :: tpert(:) - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - mf_sqt, mf_sthl, & - mf_precc, & - s_ae, s_aw, & - s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awth, s_awqv, & - s_awu, s_awv, & - mf_thflx, mf_qvflx, & - mf_thlflx, mf_qtflx, & - mf_thvflx, mf_qcflx, & - mf_thforc, mf_qvforc, & - mf_qcforc, & - mf_rcm, mf_cloudfrac + real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & + mf_dry_w, mf_moist_w, & + mf_dry_qt, mf_moist_qt, & + mf_dry_thl, mf_moist_thl, & + mf_dry_u, mf_moist_u, & + mf_dry_v, mf_moist_v, & + mf_moist_qc, & + mf_sqt, mf_sthl, & + mf_precc, & + s_ae, s_aw, & + s_awthl, s_awqt, & + s_awql, s_awqi, & + s_awth, s_awqv, & + s_awu, s_awv, & + mf_thflx, mf_qvflx, & + mf_thlflx, mf_qtflx, & + mf_thvflx, mf_qcflx, & + mf_thforc, mf_qvforc, & + mf_qcforc, & + mf_rcm, mf_cloudfrac, & +!+++MKW + mf_qc_zt, mf_cloudfrac_zt +!---MKW + ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & mf_upw, & @@ -2125,9 +2145,15 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, kvh_idx, khzm) call pbuf_get_field(pbuf, pblh_idx, pblh) call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) +!+++MKW + call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) +!---MKW call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) + +!+++ARH call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) +!---ARH ! SILHS covariance contributions call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) @@ -2409,6 +2435,9 @@ subroutine clubb_tend_cam( & mf_qcforc_output(:,:) = 0._r8 mf_rcm_output(:,:) = 0._r8 mf_cloudfrac_output(:,:) = 0._r8 +!+++MKW + mf_qc_output(:,:) = 0._r8 +!---MKW mf_ztop_output(:) = 0._r8 mf_L0_output(:) = 0._r8 mf_cape_output(:) = 0._r8 @@ -2839,9 +2868,11 @@ subroutine clubb_tend_cam( & mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) mf_cloudfrac(:pverp)= mf_moist_a(:pverp) +!+++ARH ! [kg/m2/s]->[m/s] prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 +!---ARH end if @@ -2942,6 +2973,11 @@ subroutine clubb_tend_cam( & rtp2_zt = zm2zt_api(rtp2_in) thl2_zt = zm2zt_api(thlp2_in) wp2_zt = zm2zt_api(wp2_in) +!+++MKW + ! Need moist_qc and cloudfrac on thermo grid for output + mf_qc_zt = zm2zt_api(mf_moist_qc) + mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) +!---MKW ! Arrays need to be "flipped" to CAM grid @@ -3036,7 +3072,6 @@ subroutine clubb_tend_cam( & mf_thflx_output(i,pverp-k+1) = mf_thflx(k) mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(k) mf_precc_output(i,pverp-k+1) = mf_precc(k) if (k.ne.1) then mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) @@ -3045,6 +3080,10 @@ subroutine clubb_tend_cam( & mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) +!+++MKW + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) + mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) +!---MKW end if mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) @@ -3207,9 +3246,10 @@ subroutine clubb_tend_cam( & ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime - +!+++ARH ! subtract enthalpy of falling precip from tb te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime +!---ARH ! Compute the disbalance of total energy, over depth where CLUBB is active se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) @@ -3618,7 +3658,10 @@ subroutine clubb_tend_cam( & ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = 0._r8 +!+++MKW + shalcu(i,k) = mf_cloudfrac_output(i,k);!0._r8 + sh_icwmr(i,k) = mf_qc_output(i,k); +!---MKW if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 @@ -3628,7 +3671,7 @@ subroutine clubb_tend_cam( & ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) + concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) enddo enddo @@ -3707,7 +3750,9 @@ subroutine clubb_tend_cam( & do k=1,pver do i=1,ncol - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) +!+++MKW + cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) +!---MKW enddo enddo @@ -3782,7 +3827,9 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = wpthvp(:ncol,:) call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) +!+++ARH call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) +!---ARH call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) @@ -3810,6 +3857,9 @@ subroutine clubb_tend_cam( & call outfld( 'SL', sl_output, pcols, lchnk ) call outfld( 'CONCLD', concld, pcols, lchnk ) call outfld( 'DP_CLD', deepcu, pcols, lchnk ) +!+++MKW + call outfld( 'SH_CLD', shalcu, pcols, lchnk ) +!---MKW call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) From e35668e5e5bac886f1926a2bdd54caf51733e7a7 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Mon, 1 Nov 2021 16:24:17 -0600 Subject: [PATCH 051/466] Removed developer initials where present --- src/physics/cam/clubb_intr.F90 | 22 ---------------------- src/physics/cam/clubb_mf.F90 | 14 +++++++------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 1a933820cd..2a201119c0 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -212,9 +212,7 @@ module clubb_intr kvh_idx, & ! CLUBB eddy diffusivity on thermo levels pblh_idx, & ! PBL pbuf icwmrdp_idx, & ! In cloud mixing ratio for deep convection -!+++MKW icwmrsh_idx, & ! In cloud mixing ratio for shallow convection (MF) -!---MKW tke_idx, & ! turbulent kinetic energy tpert_idx, & ! temperature perturbation from PBL fice_idx, & ! fice_idx index in physics buffer @@ -1008,9 +1006,7 @@ subroutine clubb_ini_cam(pbuf2d) qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio -!+++MKW icwmrsh_idx = pbuf_get_index('ICWMRSH') ! In-cloud shallow convective mixing ratio (EDMF) -!---MKW sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG @@ -1857,9 +1853,7 @@ subroutine clubb_tend_cam( & real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] -!+++MKW real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] -!---MKW real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] @@ -1988,9 +1982,7 @@ subroutine clubb_tend_cam( & mf_thforc, mf_qvforc, & mf_qcforc, & mf_rcm, mf_cloudfrac, & -!+++MKW mf_qc_zt, mf_cloudfrac_zt -!---MKW ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & @@ -2145,9 +2137,7 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, kvh_idx, khzm) call pbuf_get_field(pbuf, pblh_idx, pblh) call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) -!+++MKW call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) -!---MKW call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) !+++ARH @@ -2435,9 +2425,7 @@ subroutine clubb_tend_cam( & mf_qcforc_output(:,:) = 0._r8 mf_rcm_output(:,:) = 0._r8 mf_cloudfrac_output(:,:) = 0._r8 -!+++MKW mf_qc_output(:,:) = 0._r8 -!---MKW mf_ztop_output(:) = 0._r8 mf_L0_output(:) = 0._r8 mf_cape_output(:) = 0._r8 @@ -2973,11 +2961,9 @@ subroutine clubb_tend_cam( & rtp2_zt = zm2zt_api(rtp2_in) thl2_zt = zm2zt_api(thlp2_in) wp2_zt = zm2zt_api(wp2_in) -!+++MKW ! Need moist_qc and cloudfrac on thermo grid for output mf_qc_zt = zm2zt_api(mf_moist_qc) mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) -!---MKW ! Arrays need to be "flipped" to CAM grid @@ -3080,10 +3066,8 @@ subroutine clubb_tend_cam( & mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) -!+++MKW mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) -!---MKW end if mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) @@ -3658,10 +3642,8 @@ subroutine clubb_tend_cam( & ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) -!+++MKW shalcu(i,k) = mf_cloudfrac_output(i,k);!0._r8 sh_icwmr(i,k) = mf_qc_output(i,k); -!---MKW if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 @@ -3750,9 +3732,7 @@ subroutine clubb_tend_cam( & do k=1,pver do i=1,ncol -!+++MKW cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) -!---MKW enddo enddo @@ -3857,9 +3837,7 @@ subroutine clubb_tend_cam( & call outfld( 'SL', sl_output, pcols, lchnk ) call outfld( 'CONCLD', concld, pcols, lchnk ) call outfld( 'DP_CLD', deepcu, pcols, lchnk ) -!+++MKW call outfld( 'SH_CLD', shalcu, pcols, lchnk ) -!---MKW call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 00606ba220..b7ee534a9c 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -223,7 +223,7 @@ subroutine integrate_mf( nz, real(r8), dimension(nz) :: moist_th, dry_th, & ! momentum grid awthv, awqc, & ! momentum grid awthl_conv, awqt_conv, & ! momentum grid - thv_env_zm, awthv_conv, & ! MKW + thv_env_zm, awthv_conv, & ! thl_env_zm, qt_env_zm, & ! momentum grid thl_env, qt_env, & ! thermodynamic grid thv_env @@ -264,7 +264,7 @@ subroutine integrate_mf( nz, lmixn, srfarea, & ! momentum grid srfwqtu, srfwthvu, & facqtu, facthvu -!+++ARH + ! ! cape variables real(r8), dimension(nz) :: t_zt @@ -280,7 +280,7 @@ subroutine integrate_mf( nz, real(r8) :: landfrac integer :: kpbl, msg, & lon, mx -!---ARH + ! ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & @@ -449,7 +449,7 @@ subroutine integrate_mf( nz, call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) -!+++ARH + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) !ztop = ztop - 1600._r8 !if (ztop < 1._r8) then @@ -457,7 +457,7 @@ subroutine integrate_mf( nz, !else ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) !end if -!---ARH + else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then !dilute cape calculation !dmpdz = -1._r8*ent_zt(2:nz,:) @@ -1793,7 +1793,7 @@ subroutine parcel_dilute (nz, nup, msg, klaunch, p, z, t, q, & end do ! Levels loop end do ! Columns loop -!+++ARH + ! if ( masterproc ) then ! do k = 1,msg-1 ! do i = 1,nup @@ -1801,7 +1801,7 @@ subroutine parcel_dilute (nz, nup, msg, klaunch, p, z, t, q, & ! end do ! end do ! end if -!---ARH + !!!!!!!!!!!!!!!!!!!!!!!!!!END ENTRAINMENT LOOP!!!!!!!!!!!!!!!!!!!!!!!!!!!! From e26e6e34a0565f3128f1dcf30226c12209808cd8 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Mon, 1 Nov 2021 16:26:24 -0600 Subject: [PATCH 052/466] Removed more initials and undid some initial removing edits in clubb_mf --- src/physics/cam/clubb_intr.F90 | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 2a201119c0..087584bec6 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -268,11 +268,9 @@ module clubb_intr mf_wprtp_macmic_idx, & mf_wpthvp_macmic_idx -!+++ARH integer :: & prec_sh_idx, & snow_sh_idx -!---ARH ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -1016,10 +1014,8 @@ subroutine clubb_ini_cam(pbuf2d) naai_idx = pbuf_get_index('NAAI') npccn_idx = pbuf_get_index('NPCCN') -!+++ARH prec_sh_idx = pbuf_get_index('PREC_SH') snow_sh_idx = pbuf_get_index('SNOW_SH') -!---ARH iisclr_rt = -1 iisclr_thl = -1 @@ -1883,10 +1879,8 @@ subroutine clubb_tend_cam( & real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. -!+++ARH real(r8),pointer :: prec_sh(:) ! total precipitation from MF real(r8),pointer :: snow_sh(:) ! snow from MF -!---ARH real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) @@ -2140,10 +2134,8 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) -!+++ARH call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) -!---ARH ! SILHS covariance contributions call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) @@ -2856,11 +2848,9 @@ subroutine clubb_tend_cam( & mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) mf_cloudfrac(:pverp)= mf_moist_a(:pverp) -!+++ARH ! [kg/m2/s]->[m/s] prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 -!---ARH end if @@ -3230,10 +3220,8 @@ subroutine clubb_tend_cam( & ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime -!+++ARH ! subtract enthalpy of falling precip from tb te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime -!---ARH ! Compute the disbalance of total energy, over depth where CLUBB is active se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) @@ -3807,9 +3795,7 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = wpthvp(:ncol,:) call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) -!+++ARH call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) -!---ARH call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) From 561a0e5b0b251d29da2a6ac9ba8633938ef4e3cb Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Mon, 1 Nov 2021 16:28:14 -0600 Subject: [PATCH 053/466] Removed accidental Matlab syntax --- src/physics/cam/clubb_intr.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 087584bec6..d7acc72d2a 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3630,8 +3630,8 @@ subroutine clubb_tend_cam( & ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = mf_cloudfrac_output(i,k);!0._r8 - sh_icwmr(i,k) = mf_qc_output(i,k); + shalcu(i,k) = mf_cloudfrac_output(i,k)!0._r8 + sh_icwmr(i,k) = mf_qc_output(i,k) if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 From 62d9a0fbdaeecf48186be23878420fa65b6ebcf5 Mon Sep 17 00:00:00 2001 From: mikaelwitte Date: Tue, 2 Nov 2021 14:30:10 -0600 Subject: [PATCH 054/466] Commented outfld for ICWMRSH in convect_shallow, added outfld call to clubb_intr --- src/physics/cam/clubb_intr.F90 | 1 + src/physics/cam/convect_shallow.F90 | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d7acc72d2a..51d188ea63 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3879,6 +3879,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) + call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) end if if (macmic_it==cld_macmic_num_steps) then diff --git a/src/physics/cam/convect_shallow.F90 b/src/physics/cam/convect_shallow.F90 index f4f40d7d50..036eb04d2d 100644 --- a/src/physics/cam/convect_shallow.F90 +++ b/src/physics/cam/convect_shallow.F90 @@ -737,7 +737,7 @@ subroutine convect_shallow_tend( ztodt , cmfmc , & ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair - call outfld( 'ICWMRSH ', icwmr , pcols , lchnk ) +! call outfld( 'ICWMRSH ', icwmr , pcols , lchnk ) ! For CLUBB-MF, need to output ICWMRSH in clubb_intr call outfld( 'CMFDT ', ftem , pcols , lchnk ) call outfld( 'CMFDQ ', ptend_loc%q(1,1,1) , pcols , lchnk ) From 72c298a655defa6a1359769faf7a373691c7e48b Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 2 Nov 2021 17:22:31 -0600 Subject: [PATCH 055/466] put limiter on tke enhanced fractional entrainmnet --- src/physics/cam/clubb_mf.F90 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index b7ee534a9c..638be56450 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -304,12 +304,6 @@ subroutine integrate_mf( nz, real(r8),parameter :: wstarmin = 1.e-3_r8, & pblhmin = 100._r8 ! - ! to condensate or not to condensate - logical :: do_condensation = .true. - ! - ! use implicit method for plume updraft velocity - logical :: do_implicit = .false. - ! ! evaporation efficiency after Suselj etal 2019 real(r8),parameter :: ke = 2.5e-4_r8 ! @@ -319,9 +313,18 @@ subroutine integrate_mf( nz, ! fixed entrainment rate (debug only) real(r8),parameter :: fixent = 1.e-3_r8 ! + ! limiter for tke enahnced fractional entrainment + real(r8),parameter :: max_eturb = 25._r8 + ! + ! to condensate or not to condensate + logical :: do_condensation = .true. + ! ! to upwind (stagger environ values) logical :: pupwind = .true. ! + ! use implicit method for plume updraft velocity + logical :: do_implicit = .false. + ! ! to scale surface fluxes logical :: scalesrf = .false. ! @@ -596,7 +599,7 @@ subroutine integrate_mf( nz, end if ! integrate updraft - eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + eturb = min(1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i),max_eturb) entexp = exp(-ent(k+1,i)*eturb*dzt(k+1)) entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) From 709e5f6cd333592c9743d236c62900a61babecea Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 2 Nov 2021 17:28:07 -0600 Subject: [PATCH 056/466] added logical to turn off mf radiation (do_mf_rad in clubb_intr) --- src/physics/cam/clubb_intr.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 51d188ea63..c67fa1a13f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1991,7 +1991,7 @@ subroutine clubb_tend_cam( & ! CFL limiter vars real(r8), dimension(pcols) :: max_cfl real(r8) :: cflval, cflfac - logical :: cfllim + logical :: cfllim, do_mf_rad ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid @@ -2852,6 +2852,8 @@ subroutine clubb_tend_cam( & prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 + do_mf_rad = .false. + end if ! Advance CLUBB CORE one timestep in the future @@ -3622,7 +3624,7 @@ subroutine clubb_tend_cam( & deepcu(:,pver) = 0.0_r8 shalcu(:,pver) = 0.0_r8 - + sh_icwmr(:,pver) = 0.0_r8 do k=1,pver-1 do i=1,ncol ! diagnose the deep convective cloud fraction, as done in macrophysics based on the @@ -3630,9 +3632,12 @@ subroutine clubb_tend_cam( & ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = mf_cloudfrac_output(i,k)!0._r8 - sh_icwmr(i,k) = mf_qc_output(i,k) - + + if (do_mf_rad) then + shalcu(i,k) = mf_cloudfrac_output(i,k) + sh_icwmr(i,k) = mf_qc_output(i,k) + end if + if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 endif From 6dc7dfd3d23f5792d0b26e20defd36618900af57 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 5 Nov 2021 13:01:50 -0600 Subject: [PATCH 057/466] fixed radiation bug, add namelist do_clubb_mf_rad to turn on radiation --- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 +++++ src/physics/cam/clubb_intr.F90 | 24 +++++++++----------- src/physics/cam/clubb_mf.F90 | 13 +++++++---- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 921d0fd3bd..05e2347306 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1857,6 +1857,7 @@ .false. .false. .false. + .false. 50.0 0.22 0.0 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 51d9e27cd3..61b68ecabd 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3712,6 +3712,12 @@ If .true. turn on Suselj et al 2019 microphysics. Default: .false. + +If .true. couple MF plumes to radiation +Default: .false. + + Entrainment length scale in meters for individual plumes. Not used if diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index c67fa1a13f..0579eaf55d 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -30,7 +30,7 @@ module clubb_intr #ifdef CLUBB_SGS use clubb_api_module, only: pdf_parameter, implicit_coefs_terms use clubb_api_module, only: clubb_config_flags_type - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup + use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad use cam_history_support, only: add_hist_coord #endif @@ -1990,8 +1990,8 @@ subroutine clubb_tend_cam( & mf_upent ! CFL limiter vars real(r8), dimension(pcols) :: max_cfl - real(r8) :: cflval, cflfac - logical :: cfllim, do_mf_rad + real(r8) :: cflval, cflfac + logical :: cfllim ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid @@ -2802,10 +2802,6 @@ subroutine clubb_tend_cam( & mf_thlflx, mf_qtflx, & ! output - variables needed for solver mf_ztop_output(i), mf_L0_output(i) ) - !if ( masterproc ) then - ! write(iulog,*) "mf cape ", mf_cape_output(i) - !endif - ! CFL limiter s_aw(1) = 0._r8 max_cfl(i)= 0._r8 @@ -2852,8 +2848,6 @@ subroutine clubb_tend_cam( & prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 - do_mf_rad = .false. - end if ! Advance CLUBB CORE one timestep in the future @@ -3622,9 +3616,9 @@ subroutine clubb_tend_cam( & ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! ! --------------------------------------------------------------------------------- ! - deepcu(:,pver) = 0.0_r8 - shalcu(:,pver) = 0.0_r8 - sh_icwmr(:,pver) = 0.0_r8 + deepcu = 0.0_r8 + shalcu = 0.0_r8 + do k=1,pver-1 do i=1,ncol ! diagnose the deep convective cloud fraction, as done in macrophysics based on the @@ -3633,7 +3627,7 @@ subroutine clubb_tend_cam( & ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - if (do_mf_rad) then + if (do_clubb_mf_rad) then shalcu(i,k) = mf_cloudfrac_output(i,k) sh_icwmr(i,k) = mf_qc_output(i,k) end if @@ -3641,6 +3635,10 @@ subroutine clubb_tend_cam( & if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 endif + + if (shalcu(i,k) <= frac_limit .or. sh_icwmr(i,k) < ic_limit) then + shalcu(i,k) = 0._r8 + endif ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 638be56450..ed66111cff 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -20,7 +20,8 @@ module clubb_mf clubb_mf_readnl, & do_clubb_mf, & do_clubb_mf_diag, & - clubb_mf_nup + clubb_mf_nup, & + do_clubb_mf_rad ! ! Lopt 0 = fixed L0 @@ -38,6 +39,7 @@ module clubb_mf integer, protected :: clubb_mf_nup = 0 logical, protected :: do_clubb_mf = .false. logical, protected :: do_clubb_mf_diag = .false. + logical, protected :: do_clubb_mf_rad = .false. logical :: do_clubb_mf_precip = .false. logical :: tht_tweaks = .true. integer :: mf_num_cin = 5 @@ -61,7 +63,7 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & - clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip + clubb_mf_nup, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -95,6 +97,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_diag") call mpi_bcast(do_clubb_mf_precip, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_precip") + call mpi_bcast(do_clubb_mf_rad, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_rad") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -314,7 +318,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: fixent = 1.e-3_r8 ! ! limiter for tke enahnced fractional entrainment - real(r8),parameter :: max_eturb = 25._r8 + real(r8),parameter :: max_eturb = 10._r8 ! ! to condensate or not to condensate logical :: do_condensation = .true. @@ -599,7 +603,8 @@ subroutine integrate_mf( nz, end if ! integrate updraft - eturb = min(1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i),max_eturb) + !eturb = min(1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i),max_eturb) + eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) entexp = exp(-ent(k+1,i)*eturb*dzt(k+1)) entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) From 9fb4e8dd3e866e88c62b9482e581078440cadddd Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 5 Nov 2021 16:43:05 -0600 Subject: [PATCH 058/466] implemented logic for AS positive detrainment limiter --- src/physics/cam/clubb_mf.F90 | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index ed66111cff..e1c3ad49aa 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -257,7 +257,8 @@ subroutine integrate_mf( nz, wlv, wtv, wp, & B, & ! thermodynamic grid entexp, entexpu, entw, & ! thermodynamic grid - eturb, lmixt, & ! thermodynamic grid + Mn, & ! momentum grid + eturb, det, lmixt, & ! thermodynamic grid qtovqs, sevap, & ! thermodynamic grid betathl,betaqt, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid @@ -317,7 +318,11 @@ subroutine integrate_mf( nz, ! fixed entrainment rate (debug only) real(r8),parameter :: fixent = 1.e-3_r8 ! + ! Arakawa and Schubert detrainment limiter + logical :: do_aspd = .false. + ! ! limiter for tke enahnced fractional entrainment + ! (only used when do_aspd = .true.) real(r8),parameter :: max_eturb = 10._r8 ! ! to condensate or not to condensate @@ -603,8 +608,10 @@ subroutine integrate_mf( nz, end if ! integrate updraft - !eturb = min(1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i),max_eturb) eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + if (do_aspd) then + eturb = min(eturb,max_eturb) + end if entexp = exp(-ent(k+1,i)*eturb*dzt(k+1)) entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) @@ -672,6 +679,26 @@ subroutine integrate_mf( nz, enddo enddo + if (do_aspd) then + do k=1,nz-1 + do i=1,clubb_mf_nup + Mn = rho_zm(k)*upa(k,i)*upw(k,i) + if (Mn>0._r8) then + ! diagnose detrainment + det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & + /(Mn*dzt(k+1)) + + if (det <= 0._r8) then + ! diagnose area to eliminate detrainment and conserve mass + Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) + upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) + end if + ! + end if + end do + end do + end if + ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then do i=1,clubb_mf_nup From d917b1bea730cc95f9ce74d876301c4c033d14c7 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sat, 6 Nov 2021 10:35:33 -0600 Subject: [PATCH 059/466] updated dataset paths for CAM FORC SCAM --- .../scam_STUB/scripts/make_basecase.auto.csh | 14 ++++++++------ cime_config/usermods_dirs/scam_STUB/user_nl_cam | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index e366cf6a66..85918362b3 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -73,6 +73,9 @@ echo "scm_use_ana_iop = .true.">>user_nl_cam echo "cld_macmic_num_steps=6">>user_nl_cam #echo "deep_scheme = 'off'">>user_nl_cam +#echo "zmconv_num_cin = 1">>user_nl_cam +echo "use_gw_front = .false.">>user_nl_cam +echo "use_gw_convect_dp = .false.">>user_nl_cam #echo "clubb_timestep=150.D0">>user_nl_cam #echo "clubb_gamma_coef = 0.27D0">>user_nl_cam @@ -91,6 +94,11 @@ echo "cld_macmic_num_steps=6">>user_nl_cam #echo "clubb_C8b = 0.0">>user_nl_cam #echo "clubb_c14 = 1.1">>user_nl_cam +echo "do_clubb_mf = .true.">>user_nl_cam +echo "do_clubb_mf_diag = .true.">>user_nl_cam +echo "do_clubb_mf_precip = .true.">>user_nl_cam +echo "do_clubb_mf_rad = .false.">>user_nl_cam + echo "clubb_mf_nup = 100">>user_nl_cam echo "clubb_mf_L0 = 50.D0">>user_nl_cam echo "clubb_mf_Lopt = 3">>user_nl_cam @@ -98,12 +106,6 @@ echo "clubb_mf_a0 = 1.D0">>user_nl_cam echo "clubb_mf_b0 = 0.5D0">>user_nl_cam echo "clubb_mf_alphturb = 3.D0">>user_nl_cam -echo "do_clubb_mf = .true.">>user_nl_cam -echo "do_clubb_mf_diag = .true.">>user_nl_cam -#echo "zmconv_num_cin = 1">>user_nl_cam -echo "use_gw_front = .false.">>user_nl_cam -echo "use_gw_convect_dp = .false.">>user_nl_cam - #Set case specific variables ./xmlchange PTS_LAT=${case_lat} ./xmlchange PTS_LON=${case_lon} diff --git a/cime_config/usermods_dirs/scam_STUB/user_nl_cam b/cime_config/usermods_dirs/scam_STUB/user_nl_cam index 8afb67ee1b..38c4dc8d96 100644 --- a/cime_config/usermods_dirs/scam_STUB/user_nl_cam +++ b/cime_config/usermods_dirs/scam_STUB/user_nl_cam @@ -2,9 +2,10 @@ !scmlat=$PTS_LAT iopfile="$CASEROOT/STUB_iop.nc" ncdata="/home/aherring/scam/inic/SCAM_IC_288x192_L58_48_BL10.nc" - +!ncdata = '/glade/work/aherring/grids/vertical-res/L58/SCAM_IC_288x192_L58_48_BL10.nc' bnd_topo="/fs/cgd/csm/inputdata/atm/cam/topo/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_c170103.nc" +!bnd_topo = '/glade/p/cesmdata/inputdata/atm/cam/topo/fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_sgh30_24km_GRNL_c170103.nc' mfilt=2000 nhtfrq=1 @@ -23,7 +24,7 @@ scm_relax_tau_top_sec = 172800. use_scm_ana_frc = .true. scm_ana_frc_path = "/project/amp/aherring/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/" -!scm_ana_frc_path = "/glade/scratch/aherring/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/" +!scm_ana_frc_path = "/glade/p/cesm/amwg/aherring/FORC_FOR_SCAM/cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010/run/" scm_ana_frc_file_template = "cam6_3_006.dev_FHIST_f09_f09_mg17_144pes_210818_L58_cam64_MJJA2010.cam.h2.%y-%m-%d-%s.nc" scm_ana_x_plevels = .true. From 118cc3f0f1bf2436ba8772c99c81b2573a1621f5 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sat, 6 Nov 2021 10:51:39 -0600 Subject: [PATCH 060/466] updated paths for LBA case --- cime_config/usermods_dirs/scam_LBA/user_nl_cam | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cime_config/usermods_dirs/scam_LBA/user_nl_cam b/cime_config/usermods_dirs/scam_LBA/user_nl_cam index e7f05dcdc6..b204788727 100644 --- a/cime_config/usermods_dirs/scam_LBA/user_nl_cam +++ b/cime_config/usermods_dirs/scam_LBA/user_nl_cam @@ -1,5 +1,9 @@ - iopfile='/home/aherring/scam/iopfiles/iop_LBA.nc' - ncdata='$DIN_LOC_ROOT/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + !iopfile='/home/aherring/scam/iopfiles/iop_LBA.nc' + iopfile='/glade/work/aherring/grids/vertical-res/SCAM_LBA' + + !ncdata='$DIN_LOC_ROOT/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + ncdata='/glade/work/aherring/grids/vertical-res/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + nhtfrq = 1 mfilt = 720 scm_use_obs_uv = .true. From 20c4744ce9f4b9313f21f97ed142d5ad14d74479 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sat, 6 Nov 2021 17:27:03 -0600 Subject: [PATCH 061/466] don't apply aspd limiter to plume top --- .../scam_STUB/scripts/make_basecase.auto.csh | 2 +- src/physics/cam/clubb_mf.F90 | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index 85918362b3..b486101c30 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -41,7 +41,7 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_3Lopt_3alph" +set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_3Lopt_3alph_aspd" # create new basecase ${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e1c3ad49aa..b0639fdc2f 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -319,7 +319,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: fixent = 1.e-3_r8 ! ! Arakawa and Schubert detrainment limiter - logical :: do_aspd = .false. + logical :: do_aspd = .true. ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) @@ -682,12 +682,12 @@ subroutine integrate_mf( nz, if (do_aspd) then do k=1,nz-1 do i=1,clubb_mf_nup - Mn = rho_zm(k)*upa(k,i)*upw(k,i) - if (Mn>0._r8) then + ! + if (upw(k+1,i)>0._r8) then ! diagnose detrainment + Mn = rho_zm(k)*upa(k,i)*upw(k,i) det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & /(Mn*dzt(k+1)) - if (det <= 0._r8) then ! diagnose area to eliminate detrainment and conserve mass Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) @@ -695,6 +695,7 @@ subroutine integrate_mf( nz, end if ! end if + ! end do end do end if From ae5eb4491ce369e570a12de647386877085044e7 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sat, 6 Nov 2021 17:39:55 -0600 Subject: [PATCH 062/466] turn of do_aspd by default (again) --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index b0639fdc2f..e96d7ad846 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -319,7 +319,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: fixent = 1.e-3_r8 ! ! Arakawa and Schubert detrainment limiter - logical :: do_aspd = .true. + logical :: do_aspd = .false. ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) From b8c5f47e9b1b62f31f6eeb5f002ae7bc87e3f165 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Mon, 8 Nov 2021 10:57:06 -0700 Subject: [PATCH 063/466] add total convective area in ASpd loop --- src/physics/cam/clubb_mf.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e96d7ad846..c40910392e 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -230,7 +230,7 @@ subroutine integrate_mf( nz, thv_env_zm, awthv_conv, & ! thl_env_zm, qt_env_zm, & ! momentum grid thl_env, qt_env, & ! thermodynamic grid - thv_env + thv_env, ac ! ! updraft properties real(r8), dimension(nz,clubb_mf_nup) :: upqv, upqs, & ! momentum grid @@ -387,6 +387,7 @@ subroutine integrate_mf( nz, ! this is the environmental area - by default 1. ae = 1._r8 + ac = 0._r8 ! START MAIN COMPUTATION upw = 0._r8 @@ -688,13 +689,14 @@ subroutine integrate_mf( nz, Mn = rho_zm(k)*upa(k,i)*upw(k,i) det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & /(Mn*dzt(k+1)) - if (det <= 0._r8) then + if (det < 0._r8) then ! diagnose area to eliminate detrainment and conserve mass Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) end if ! end if + ac(k+1) = ac(k+1) + upa(k+1,i) ! end do end do From 69723a557047e704a75071923961e9a915398c52 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Fri, 12 Nov 2021 13:09:20 -0700 Subject: [PATCH 064/466] change from ilev to lev in cloudfrac addfld --- src/physics/cam/clubb_intr.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 0579eaf55d..feb1854754 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1266,7 +1266,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_cloudfrac', (/ 'ilev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) From a518593c6c6b43923b5fda9034c7e16549c55807 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 4 Jan 2022 13:32:40 -0700 Subject: [PATCH 065/466] create clubbmf branch for merging --- src/physics/cam_dev/check_energy.F90 | 1004 ------ src/physics/cam_dev/zm_conv.F90 | 4995 -------------------------- src/physics/cam_dev/zm_conv_intr.F90 | 1405 -------- 3 files changed, 7404 deletions(-) delete mode 100644 src/physics/cam_dev/check_energy.F90 delete mode 100644 src/physics/cam_dev/zm_conv.F90 delete mode 100644 src/physics/cam_dev/zm_conv_intr.F90 diff --git a/src/physics/cam_dev/check_energy.F90 b/src/physics/cam_dev/check_energy.F90 deleted file mode 100644 index 6fd157628f..0000000000 --- a/src/physics/cam_dev/check_energy.F90 +++ /dev/null @@ -1,1004 +0,0 @@ - -module check_energy - -!--------------------------------------------------------------------------------- -! Purpose: -! -! Module to check -! 1. vertically integrated total energy and water conservation for each -! column within the physical parameterizations -! -! 2. global mean total energy conservation between the physics output state -! and the input state on the next time step. -! -! 3. add a globally uniform heating term to account for any change of total energy in 2. -! -! Author: Byron Boville Oct 31, 2002 -! -! Modifications: -! 03.03.29 Boville Add global energy check and fixer. -! -!--------------------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use ppgrid, only: pcols, pver, begchunk, endchunk - use spmd_utils, only: masterproc - - use gmean_mod, only: gmean - use physconst, only: gravit, latvap, latice, cpair, cpairv - use physics_types, only: physics_state, physics_tend, physics_ptend, physics_ptend_init - use constituents, only: cnst_get_ind, pcnst, cnst_name, cnst_get_type_byind - use time_manager, only: is_first_step - use cam_logfile, only: iulog - - implicit none - private - -! Public types: - public check_tracers_data - -! Public methods - public :: check_energy_readnl ! read namelist values - public :: check_energy_register ! register fields in physics buffer - public :: check_energy_get_integrals ! get energy integrals computed in check_energy_gmean - public :: check_energy_init ! initialization of module - public :: check_energy_timestep_init ! timestep initialization of energy integrals and cumulative boundary fluxes - public :: check_energy_chng ! check changes in integrals against cumulative boundary fluxes - public :: check_energy_gmean ! global means of physics input and output total energy - public :: check_energy_fix ! add global mean energy difference as a heating - public :: check_tracers_init ! initialize tracer integrals and cumulative boundary fluxes - public :: check_tracers_chng ! check changes in integrals against cumulative boundary fluxes - - public :: calc_te_and_aam_budgets ! calculate and output total energy and axial angular momentum diagnostics - -! Private module data - - logical :: print_energy_errors = .false. - - real(r8) :: teout_glob ! global mean energy of output state - real(r8) :: teinp_glob ! global mean energy of input state - real(r8) :: tedif_glob ! global mean energy difference - real(r8) :: psurf_glob ! global mean surface pressure - real(r8) :: ptopb_glob ! global mean top boundary pressure - real(r8) :: heat_glob ! global mean heating rate - -! Physics buffer indices - - integer :: teout_idx = 0 ! teout index in physics buffer - integer :: dtcore_idx = 0 ! dtcore index in physics buffer - integer :: ducore_idx = 0 ! ducore index in physics buffer - integer :: dvcore_idx = 0 ! dvcore index in physics buffer - - type check_tracers_data - real(r8) :: tracer(pcols,pcnst) ! initial vertically integrated total (kinetic + static) energy - real(r8) :: tracer_tnd(pcols,pcnst) ! cumulative boundary flux of total energy - integer :: count(pcnst) ! count of values with significant imbalances - end type check_tracers_data - - -!=============================================================================== -contains -!=============================================================================== - -subroutine check_energy_readnl(nlfile) - - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical - use cam_abortutils, only: endrun - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - ! Local variables - integer :: unitn, ierr - character(len=*), parameter :: sub = 'check_energy_readnl' - - namelist /check_energy_nl/ print_energy_errors - !----------------------------------------------------------------------------- - - ! Read namelist - if (masterproc) then - unitn = getunit() - open( unitn, file=trim(nlfile), status='old' ) - call find_group_name(unitn, 'check_energy_nl', status=ierr) - if (ierr == 0) then - read(unitn, check_energy_nl, iostat=ierr) - if (ierr /= 0) then - call endrun(sub//': FATAL: reading namelist') - end if - end if - close(unitn) - call freeunit(unitn) - end if - - call mpi_bcast(print_energy_errors, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: print_energy_errors") - - if (masterproc) then - write(iulog,*) 'check_energy options:' - write(iulog,*) ' print_energy_errors =', print_energy_errors - end if - -end subroutine check_energy_readnl - -!=============================================================================== - - subroutine check_energy_register() -! -! Register fields in the physics buffer. -! -!----------------------------------------------------------------------- - - use physics_buffer, only : pbuf_add_field, dtype_r8, dyn_time_lvls - use physics_buffer, only : pbuf_register_subcol - use subcol_utils, only : is_subcol_on - -!----------------------------------------------------------------------- - -! Request physics buffer space for fields that persist across timesteps. - - call pbuf_add_field('TEOUT', 'global',dtype_r8 , (/pcols,dyn_time_lvls/), teout_idx) - call pbuf_add_field('DTCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dtcore_idx) - call pbuf_add_field('DUCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),ducore_idx) - call pbuf_add_field('DVCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dvcore_idx) - if(is_subcol_on()) then - call pbuf_register_subcol('TEOUT', 'phys_register', teout_idx) - call pbuf_register_subcol('DTCORE', 'phys_register', dtcore_idx) - call pbuf_register_subcol('DUCORE', 'phys_register', ducore_idx) - call pbuf_register_subcol('DVCORE', 'phys_register', dvcore_idx) - end if - - end subroutine check_energy_register - -!=============================================================================== - -subroutine check_energy_get_integrals( tedif_glob_out, heat_glob_out ) - -!----------------------------------------------------------------------- -! Purpose: Return energy integrals -!----------------------------------------------------------------------- - - real(r8), intent(out), optional :: tedif_glob_out - real(r8), intent(out), optional :: heat_glob_out - -!----------------------------------------------------------------------- - - if ( present(tedif_glob_out) ) then - tedif_glob_out = tedif_glob - endif - if ( present(heat_glob_out) ) then - heat_glob_out = heat_glob - endif - -end subroutine check_energy_get_integrals - -!================================================================================================ - - subroutine check_energy_init() -! -! Initialize the energy conservation module -! -!----------------------------------------------------------------------- - use cam_history, only: addfld, add_default, horiz_only - use phys_control, only: phys_getopts - - implicit none - - logical :: history_budget, history_waccm - integer :: history_budget_histfile_num ! output history file number for budget fields - -!----------------------------------------------------------------------- - - call phys_getopts( history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num, & - history_waccm_out = history_waccm ) - -! register history variables - call addfld('TEINP', horiz_only, 'A', 'J/m2', 'Total energy of physics input') - call addfld('TEOUT', horiz_only, 'A', 'J/m2', 'Total energy of physics output') - call addfld('TEFIX', horiz_only, 'A', 'J/m2', 'Total energy after fixer') - call addfld('EFIX', horiz_only, 'A', 'W/m2', 'Effective sensible heat flux due to energy fixer') - call addfld('DTCORE', (/ 'lev' /), 'A', 'K/s' , 'T tendency due to dynamical core') - - if ( history_budget ) then - call add_default ('DTCORE', history_budget_histfile_num, ' ') - end if - if ( history_waccm ) then - call add_default ('DTCORE', 1, ' ') - end if - - end subroutine check_energy_init - -!=============================================================================== - - subroutine check_energy_timestep_init(state, tend, pbuf, col_type) - use physics_buffer, only : physics_buffer_desc, pbuf_set_field - use cam_abortutils, only: endrun -!----------------------------------------------------------------------- -! Compute initial values of energy and water integrals, -! zero cumulative tendencies -!----------------------------------------------------------------------- -!------------------------------Arguments-------------------------------- - - type(physics_state), intent(inout) :: state - type(physics_tend ), intent(inout) :: tend - type(physics_buffer_desc), pointer :: pbuf(:) - integer, optional :: col_type ! Flag inidicating whether using grid or subcolumns -!---------------------------Local storage------------------------------- - - real(r8) :: ke(state%ncol) ! vertical integral of kinetic energy - real(r8) :: se(state%ncol) ! vertical integral of static energy - real(r8) :: wv(state%ncol) ! vertical integral of water (vapor) - real(r8) :: wl(state%ncol) ! vertical integral of water (liquid) - real(r8) :: wi(state%ncol) ! vertical integral of water (ice) - - real(r8),allocatable :: cpairv_loc(:,:,:) - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - integer i,k ! column, level indices - integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices - integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices - integer :: ixgrau ! GRAUQM index -!----------------------------------------------------------------------- - - lchnk = state%lchnk - ncol = state%ncol - call cnst_get_ind('CLDICE', ixcldice, abort=.false.) - call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) - call cnst_get_ind('RAINQM', ixrain, abort=.false.) - call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) - call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) - - ! cpairv_loc needs to be allocated to a size which matches state and ptend - ! If psetcols == pcols, cpairv is the correct size and just copy into cpairv_loc - ! If psetcols > pcols and all cpairv match cpair, then assign the constant cpair - - if (state%psetcols == pcols) then - allocate (cpairv_loc(state%psetcols,pver,begchunk:endchunk)) - cpairv_loc(:,:,:) = cpairv(:,:,:) - else if (state%psetcols > pcols .and. all(cpairv(:,:,:) == cpair)) then - allocate(cpairv_loc(state%psetcols,pver,begchunk:endchunk)) - cpairv_loc(:,:,:) = cpair - else - call endrun('check_energy_timestep_init: cpairv is not allowed to vary when subcolumns are turned on') - end if - - ! Compute vertical integrals of dry static energy (modified), kinetic energy and water (vapor, liquid, ice) - ke = 0._r8 - se = 0._r8 - wv = 0._r8 - wl = 0._r8 - wi = 0._r8 - do k = 1, pver - do i = 1, ncol - ke(i) = ke(i) + 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit - se(i) = se(i) + state%t(i,k)*cpairv_loc(i,k,lchnk)*state%pdel(i,k)/gravit - wv(i) = wv(i) + state%q(i,k,1) *state%pdel(i,k)/gravit - end do - end do - do i = 1, ncol - se(i) = se(i) + state%phis(i)*state%ps(i)/gravit - end do - - ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. - if (ixcldliq > 1 .and. ixcldice > 1) then - do k = 1, pver - do i = 1, ncol - wl(i) = wl(i) + state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit - wi(i) = wi(i) + state%q(i,k,ixcldice)*state%pdel(i,k)/gravit - end do - end do - end if - - ! Don't require precip either, if microphysics doesn't add it. - if (ixrain > 1 .and. ixsnow > 1) then - do k = 1, pver - do i = 1, ncol - wl(i) = wl(i) + state%q(i,k,ixrain)*state%pdel(i,k)/gravit - wi(i) = wi(i) + state%q(i,k,ixsnow)*state%pdel(i,k)/gravit - end do - end do - end if - - ! Don't require graupel/hail either, if microphysics doesn't add it. - if (ixgrau > 1) then - do k = 1, pver - do i = 1, ncol - wi(i) = wi(i) + state%q(i,k,ixgrau)*state%pdel(i,k)/gravit - end do - end do - end if - -! Compute vertical integrals of frozen static energy and total water. - do i = 1, ncol - state%te_ini(i) = se(i) + ke(i) + (latvap+latice)*wv(i) + latice*wl(i) - state%tw_ini(i) = wv(i) + wl(i) + wi(i) - - state%te_cur(i) = state%te_ini(i) - state%tw_cur(i) = state%tw_ini(i) - end do - -! zero cummulative boundary fluxes - tend%te_tnd(:ncol) = 0._r8 - tend%tw_tnd(:ncol) = 0._r8 - - state%count = 0 - -! initialize physics buffer - if (is_first_step()) then - call pbuf_set_field(pbuf, teout_idx, state%te_ini, col_type=col_type) - end if - - deallocate(cpairv_loc) - - end subroutine check_energy_timestep_init - -!=============================================================================== - - subroutine check_energy_chng(state, tend, name, nstep, ztodt, & - flx_vap, flx_cnd, flx_ice, flx_sen) - use cam_abortutils, only: endrun - -!----------------------------------------------------------------------- -! Check that the energy and water change matches the boundary fluxes -!----------------------------------------------------------------------- -!------------------------------Arguments-------------------------------- - - type(physics_state) , intent(inout) :: state - type(physics_tend ) , intent(inout) :: tend - character*(*),intent(in) :: name ! parameterization name for fluxes - integer , intent(in ) :: nstep ! current timestep number - real(r8), intent(in ) :: ztodt ! 2 delta t (model time increment) - real(r8), intent(in ) :: flx_vap(:) ! (pcols) - boundary flux of vapor (kg/m2/s) - real(r8), intent(in ) :: flx_cnd(:) ! (pcols) -boundary flux of liquid+ice (m/s) (precip?) - real(r8), intent(in ) :: flx_ice(:) ! (pcols) -boundary flux of ice (m/s) (snow?) - real(r8), intent(in ) :: flx_sen(:) ! (pcols) -boundary flux of sensible heat (w/m2) - -!******************** BAB ****************************************************** -!******* Note that the precip and ice fluxes are in precip units (m/s). ******** -!******* I would prefer to have kg/m2/s. ******** -!******* I would also prefer liquid (not total) and ice fluxes ******** -!******************************************************************************* - -!---------------------------Local storage------------------------------- - - real(r8) :: te_xpd(state%ncol) ! expected value (f0 + dt*boundary_flux) - real(r8) :: te_dif(state%ncol) ! energy of input state - original energy - real(r8) :: te_tnd(state%ncol) ! tendency from last process - real(r8) :: te_rer(state%ncol) ! relative error in energy column - - real(r8) :: tw_xpd(state%ncol) ! expected value (w0 + dt*boundary_flux) - real(r8) :: tw_dif(state%ncol) ! tw_inp - original water - real(r8) :: tw_tnd(state%ncol) ! tendency from last process - real(r8) :: tw_rer(state%ncol) ! relative error in water column - - real(r8) :: ke(state%ncol) ! vertical integral of kinetic energy - real(r8) :: se(state%ncol) ! vertical integral of static energy - real(r8) :: wv(state%ncol) ! vertical integral of water (vapor) - real(r8) :: wl(state%ncol) ! vertical integral of water (liquid) - real(r8) :: wi(state%ncol) ! vertical integral of water (ice) - - real(r8) :: te(state%ncol) ! vertical integral of total energy - real(r8) :: tw(state%ncol) ! vertical integral of total water - - real(r8),allocatable :: cpairv_loc(:,:,:) - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - integer i,k ! column, level indices - integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices - integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices - integer :: ixgrau ! GRAUQM index -!----------------------------------------------------------------------- - - lchnk = state%lchnk - ncol = state%ncol - call cnst_get_ind('CLDICE', ixcldice, abort=.false.) - call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) - call cnst_get_ind('RAINQM', ixrain, abort=.false.) - call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) - call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) - - ! cpairv_loc needs to be allocated to a size which matches state and ptend - ! If psetcols == pcols, cpairv is the correct size and just copy into cpairv_loc - ! If psetcols > pcols and all cpairv match cpair, then assign the constant cpair - - if (state%psetcols == pcols) then - allocate (cpairv_loc(state%psetcols,pver,begchunk:endchunk)) - cpairv_loc(:,:,:) = cpairv(:,:,:) - else if (state%psetcols > pcols .and. all(cpairv(:,:,:) == cpair)) then - allocate(cpairv_loc(state%psetcols,pver,begchunk:endchunk)) - cpairv_loc(:,:,:) = cpair - else - call endrun('check_energy_chng: cpairv is not allowed to vary when subcolumns are turned on') - end if - - ! Compute vertical integrals of dry static energy (modified), kinetic energy and water (vapor, liquid, ice) - ke = 0._r8 - se = 0._r8 - wv = 0._r8 - wl = 0._r8 - wi = 0._r8 - do k = 1, pver - do i = 1, ncol - ke(i) = ke(i) + 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit - se(i) = se(i) + state%t(i,k)*cpairv_loc(i,k,lchnk)*state%pdel(i,k)/gravit - wv(i) = wv(i) + state%q(i,k,1) *state%pdel(i,k)/gravit - end do - end do - do i = 1, ncol - se(i) = se(i) + state%phis(i)*state%ps(i)/gravit - end do - - ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. - if (ixcldliq > 1 .and. ixcldice > 1) then - do k = 1, pver - do i = 1, ncol - wl(i) = wl(i) + state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit - wi(i) = wi(i) + state%q(i,k,ixcldice)*state%pdel(i,k)/gravit - end do - end do - end if - - ! Don't require precip either, if microphysics doesn't add it. - if (ixrain > 1 .and. ixsnow > 1) then - do k = 1, pver - do i = 1, ncol - wl(i) = wl(i) + state%q(i,k,ixrain)*state%pdel(i,k)/gravit - wi(i) = wi(i) + state%q(i,k,ixsnow)*state%pdel(i,k)/gravit - end do - end do - end if - - ! Don't require graupel/hail either, if microphysics doesn't add it. - if (ixgrau > 1) then - do k = 1, pver - do i = 1, ncol - wi(i) = wi(i) + state%q(i,k,ixgrau)*state%pdel(i,k)/gravit - end do - end do - end if - - ! Compute vertical integrals of frozen static energy and total water. - do i = 1, ncol - te(i) = se(i) + ke(i) + (latvap+latice)*wv(i) + latice*wl(i) - tw(i) = wv(i) + wl(i) + wi(i) - end do - - ! compute expected values and tendencies - do i = 1, ncol - ! change in static energy and total water - te_dif(i) = te(i) - state%te_cur(i) - tw_dif(i) = tw(i) - state%tw_cur(i) - - ! expected tendencies from boundary fluxes for last process - te_tnd(i) = flx_vap(i)*(latvap+latice) - (flx_cnd(i) - flx_ice(i))*1000._r8*latice + flx_sen(i) - tw_tnd(i) = flx_vap(i) - flx_cnd(i) *1000._r8 - - ! cummulative tendencies from boundary fluxes - tend%te_tnd(i) = tend%te_tnd(i) + te_tnd(i) - tend%tw_tnd(i) = tend%tw_tnd(i) + tw_tnd(i) - - ! expected new values from previous state plus boundary fluxes - te_xpd(i) = state%te_cur(i) + te_tnd(i)*ztodt - tw_xpd(i) = state%tw_cur(i) + tw_tnd(i)*ztodt - - ! relative error, expected value - input state / previous state - te_rer(i) = (te_xpd(i) - te(i)) / state%te_cur(i) - end do - - ! relative error for total water (allow for dry atmosphere) - tw_rer = 0._r8 - where (state%tw_cur(:ncol) > 0._r8) - tw_rer(:ncol) = (tw_xpd(:ncol) - tw(:ncol)) / state%tw_cur(:ncol) - end where - - ! error checking - if (print_energy_errors) then - if (any(abs(te_rer(1:ncol)) > 1.E-14_r8 .or. abs(tw_rer(1:ncol)) > 1.E-10_r8)) then - do i = 1, ncol - ! the relative error threshold for the water budget has been reduced to 1.e-10 - ! to avoid messages generated by QNEG3 calls - ! PJR- change to identify if error in energy or water - if (abs(te_rer(i)) > 1.E-14_r8 ) then - state%count = state%count + 1 - write(iulog,*) "significant energy conservation error after ", name, & - " count", state%count, " nstep", nstep, "chunk", lchnk, "col", i - write(iulog,*) te(i),te_xpd(i),te_dif(i),tend%te_tnd(i)*ztodt, & - te_tnd(i)*ztodt,te_rer(i) - endif - if ( abs(tw_rer(i)) > 1.E-10_r8) then - state%count = state%count + 1 - write(iulog,*) "significant water conservation error after ", name, & - " count", state%count, " nstep", nstep, "chunk", lchnk, "col", i - write(iulog,*) tw(i),tw_xpd(i),tw_dif(i),tend%tw_tnd(i)*ztodt, & - tw_tnd(i)*ztodt,tw_rer(i) - end if - end do - end if - end if - - ! copy new value to state - do i = 1, ncol - state%te_cur(i) = te(i) - state%tw_cur(i) = tw(i) - end do - - deallocate(cpairv_loc) - - end subroutine check_energy_chng - - -!=============================================================================== - subroutine check_energy_gmean(state, pbuf2d, dtime, nstep) - - use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_chunk - -!----------------------------------------------------------------------- -! Compute global mean total energy of physics input and output states -!----------------------------------------------------------------------- -!------------------------------Arguments-------------------------------- - - type(physics_state), intent(in ), dimension(begchunk:endchunk) :: state - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - real(r8), intent(in) :: dtime ! physics time step - integer , intent(in) :: nstep ! current timestep number - -!---------------------------Local storage------------------------------- - integer :: ncol ! number of active columns - integer :: lchnk ! chunk index - - real(r8) :: te(pcols,begchunk:endchunk,3) - ! total energy of input/output states (copy) - real(r8) :: te_glob(3) ! global means of total energy - real(r8), pointer :: teout(:) -!----------------------------------------------------------------------- - - ! Copy total energy out of input and output states - do lchnk = begchunk, endchunk - ncol = state(lchnk)%ncol - ! input energy - te(:ncol,lchnk,1) = state(lchnk)%te_ini(:ncol) - ! output energy - call pbuf_get_field(pbuf_get_chunk(pbuf2d,lchnk),teout_idx, teout) - - te(:ncol,lchnk,2) = teout(1:ncol) - ! surface pressure for heating rate - te(:ncol,lchnk,3) = state(lchnk)%pint(:ncol,pver+1) - end do - - ! Compute global means of input and output energies and of - ! surface pressure for heating rate (assume uniform ptop) - call gmean(te, te_glob, 3) - - if (begchunk .le. endchunk) then - teinp_glob = te_glob(1) - teout_glob = te_glob(2) - psurf_glob = te_glob(3) - ptopb_glob = state(begchunk)%pint(1,1) - - ! Global mean total energy difference - tedif_glob = teinp_glob - teout_glob - heat_glob = -tedif_glob/dtime * gravit / (psurf_glob - ptopb_glob) - - if (masterproc) then - write(iulog,'(1x,a9,1x,i8,4(1x,e25.17))') "nstep, te", nstep, teinp_glob, teout_glob, heat_glob, psurf_glob - end if - else - heat_glob = 0._r8 - end if ! (begchunk .le. endchunk) - - end subroutine check_energy_gmean - -!=============================================================================== - subroutine check_energy_fix(state, ptend, nstep, eshflx) - -!----------------------------------------------------------------------- -! Add heating rate required for global mean total energy conservation -!----------------------------------------------------------------------- -!------------------------------Arguments-------------------------------- - - type(physics_state), intent(in ) :: state - type(physics_ptend), intent(out) :: ptend - - integer , intent(in ) :: nstep ! time step number - real(r8), intent(out ) :: eshflx(pcols) ! effective sensible heat flux - -!---------------------------Local storage------------------------------- - integer :: i ! column - integer :: ncol ! number of atmospheric columns in chunk -!----------------------------------------------------------------------- - ncol = state%ncol - - call physics_ptend_init(ptend, state%psetcols, 'chkenergyfix', ls=.true.) - -#if ( defined OFFLINE_DYN ) - ! disable the energy fix for offline driver - heat_glob = 0._r8 -#endif -! add (-) global mean total energy difference as heating - ptend%s(:ncol,:pver) = heat_glob -!!$ write(iulog,*) "chk_fix: heat", state%lchnk, ncol, heat_glob - -! compute effective sensible heat flux - do i = 1, ncol - eshflx(i) = heat_glob * (state%pint(i,pver+1) - state%pint(i,1)) / gravit - end do -!!! if (nstep > 0) write(iulog,*) "heat", heat_glob, eshflx(1) - - return - end subroutine check_energy_fix - - -!=============================================================================== - subroutine check_tracers_init(state, tracerint) - -!----------------------------------------------------------------------- -! Compute initial values of tracers integrals, -! zero cumulative tendencies -!----------------------------------------------------------------------- - -!------------------------------Arguments-------------------------------- - - type(physics_state), intent(in) :: state - type(check_tracers_data), intent(out) :: tracerint - -!---------------------------Local storage------------------------------- - - real(r8) :: tr(pcols) ! vertical integral of tracer - real(r8) :: trpdel(pcols, pver) ! pdel for tracer - - integer ncol ! number of atmospheric columns - integer i,k,m ! column, level,constituent indices - integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices - integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices - integer :: ixgrau ! GRAUQM index -!----------------------------------------------------------------------- - - ncol = state%ncol - call cnst_get_ind('CLDICE', ixcldice, abort=.false.) - call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) - call cnst_get_ind('RAINQM', ixrain, abort=.false.) - call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) - call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) - - - do m = 1,pcnst - - if ( any(m == (/ 1, ixcldliq, ixcldice, & - ixrain, ixsnow, ixgrau /)) ) exit ! dont process water substances - ! they are checked in check_energy - - if (cnst_get_type_byind(m).eq.'dry') then - trpdel(:ncol,:) = state%pdeldry(:ncol,:) - else - trpdel(:ncol,:) = state%pdel(:ncol,:) - endif - - ! Compute vertical integrals of tracer - tr = 0._r8 - do k = 1, pver - do i = 1, ncol - tr(i) = tr(i) + state%q(i,k,m)*trpdel(i,k)/gravit - end do - end do - - ! Compute vertical integrals of frozen static tracers and total water. - do i = 1, ncol - tracerint%tracer(i,m) = tr(i) - end do - - ! zero cummulative boundary fluxes - tracerint%tracer_tnd(:ncol,m) = 0._r8 - - tracerint%count(m) = 0 - - end do - - return - end subroutine check_tracers_init - -!=============================================================================== - subroutine check_tracers_chng(state, tracerint, name, nstep, ztodt, cflx) - -!----------------------------------------------------------------------- -! Check that the tracers and water change matches the boundary fluxes -! these checks are not save when there are tracers transformations, as -! they only check to see whether a mass change in the column is -! associated with a flux -!----------------------------------------------------------------------- - - use cam_abortutils, only: endrun - - - implicit none - -!------------------------------Arguments-------------------------------- - - type(physics_state) , intent(in ) :: state - type(check_tracers_data), intent(inout) :: tracerint! tracers integrals and boundary fluxes - character*(*),intent(in) :: name ! parameterization name for fluxes - integer , intent(in ) :: nstep ! current timestep number - real(r8), intent(in ) :: ztodt ! 2 delta t (model time increment) - real(r8), intent(in ) :: cflx(pcols,pcnst) ! boundary flux of tracers (kg/m2/s) - -!---------------------------Local storage------------------------------- - - real(r8) :: tracer_inp(pcols,pcnst) ! total tracer of new (input) state - real(r8) :: tracer_xpd(pcols,pcnst) ! expected value (w0 + dt*boundary_flux) - real(r8) :: tracer_dif(pcols,pcnst) ! tracer_inp - original tracer - real(r8) :: tracer_tnd(pcols,pcnst) ! tendency from last process - real(r8) :: tracer_rer(pcols,pcnst) ! relative error in tracer column - - real(r8) :: tr(pcols) ! vertical integral of tracer - real(r8) :: trpdel(pcols, pver) ! pdel for tracer - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - integer i,k ! column, level indices - integer :: ixcldice, ixcldliq ! CLDICE and CLDLIQ indices - integer :: ixrain, ixsnow ! RAINQM and SNOWQM indices - integer :: ixgrau ! GRAUQM index - integer :: m ! tracer index - character(len=8) :: tracname ! tracername -!----------------------------------------------------------------------- -!!$ if (.true.) return - - lchnk = state%lchnk - ncol = state%ncol - call cnst_get_ind('CLDICE', ixcldice, abort=.false.) - call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) - call cnst_get_ind('RAINQM', ixrain, abort=.false.) - call cnst_get_ind('SNOWQM', ixsnow, abort=.false.) - call cnst_get_ind('GRAUQM', ixgrau, abort=.false.) - - do m = 1,pcnst - - if ( any(m == (/ 1, ixcldliq, ixcldice, & - ixrain, ixsnow, ixgrau /)) ) exit ! dont process water substances - ! they are checked in check_energy - tracname = cnst_name(m) - if (cnst_get_type_byind(m).eq.'dry') then - trpdel(:ncol,:) = state%pdeldry(:ncol,:) - else - trpdel(:ncol,:) = state%pdel(:ncol,:) - endif - - ! Compute vertical integrals tracers - tr = 0._r8 - do k = 1, pver - do i = 1, ncol - tr(i) = tr(i) + state%q(i,k,m)*trpdel(i,k)/gravit - end do - end do - - ! Compute vertical integrals of tracer - do i = 1, ncol - tracer_inp(i,m) = tr(i) - end do - - ! compute expected values and tendencies - do i = 1, ncol - ! change in tracers - tracer_dif(i,m) = tracer_inp(i,m) - tracerint%tracer(i,m) - - ! expected tendencies from boundary fluxes for last process - tracer_tnd(i,m) = cflx(i,m) - - ! cummulative tendencies from boundary fluxes - tracerint%tracer_tnd(i,m) = tracerint%tracer_tnd(i,m) + tracer_tnd(i,m) - - ! expected new values from original values plus boundary fluxes - tracer_xpd(i,m) = tracerint%tracer(i,m) + tracerint%tracer_tnd(i,m)*ztodt - - ! relative error, expected value - input value / original - tracer_rer(i,m) = (tracer_xpd(i,m) - tracer_inp(i,m)) / tracerint%tracer(i,m) - end do - -!! final loop for error checking -! do i = 1, ncol - -!! error messages -! if (abs(enrgy_rer(i)) > 1.E-14 .or. abs(water_rer(i)) > 1.E-14) then -! tracerint%count = tracerint%count + 1 -! write(iulog,*) "significant conservations error after ", name, & -! " count", tracerint%count, " nstep", nstep, "chunk", lchnk, "col", i -! write(iulog,*) enrgy_inp(i),enrgy_xpd(i),enrgy_dif(i),tracerint%enrgy_tnd(i)*ztodt, & -! enrgy_tnd(i)*ztodt,enrgy_rer(i) -! write(iulog,*) water_inp(i),water_xpd(i),water_dif(i),tracerint%water_tnd(i)*ztodt, & -! water_tnd(i)*ztodt,water_rer(i) -! end if -! end do - - - ! final loop for error checking - if ( maxval(tracer_rer) > 1.E-14_r8 ) then - write(iulog,*) "CHECK_TRACERS TRACER large rel error" - write(iulog,*) tracer_rer - endif - - do i = 1, ncol - ! error messages - if (abs(tracer_rer(i,m)) > 1.E-14_r8 ) then - tracerint%count = tracerint%count + 1 - write(iulog,*) "CHECK_TRACERS TRACER significant conservation error after ", name, & - " count", tracerint%count, " nstep", nstep, "chunk", lchnk, "col",i - write(iulog,*)' process name, tracname, index ', name, tracname, m - write(iulog,*)" input integral ",tracer_inp(i,m) - write(iulog,*)" expected integral ", tracer_xpd(i,m) - write(iulog,*)" input - inital integral ",tracer_dif(i,m) - write(iulog,*)" cumulative tend ",tracerint%tracer_tnd(i,m)*ztodt - write(iulog,*)" process tend ",tracer_tnd(i,m)*ztodt - write(iulog,*)" relative error ",tracer_rer(i,m) - call endrun() - end if - end do - end do - - return - end subroutine check_tracers_chng - -!####################################################################### - - subroutine calc_te_and_aam_budgets(state, outfld_name_suffix) - use physconst, only: gravit,cpair,pi,rearth,omega - use cam_history, only: hist_fld_active, outfld - -!------------------------------Arguments-------------------------------- - - type(physics_state), intent(inout) :: state - character*(*),intent(in) :: outfld_name_suffix ! suffix for "outfld" names - -!---------------------------Local storage------------------------------- - - real(r8) :: se(pcols) ! Dry Static energy (J/m2) - real(r8) :: ke(pcols) ! kinetic energy (J/m2) - real(r8) :: wv(pcols) ! column integrated vapor (kg/m2) - real(r8) :: wl(pcols) ! column integrated liquid (kg/m2) - real(r8) :: wi(pcols) ! column integrated ice (kg/m2) - real(r8) :: tt(pcols) ! column integrated test tracer (kg/m2) - real(r8) :: mr(pcols) ! column integrated wind axial angular momentum (kg*m2/s) - real(r8) :: mo(pcols) ! column integrated mass axial angular momentum (kg*m2/s) - real(r8) :: se_tmp,ke_tmp,wv_tmp,wl_tmp,wi_tmp,tt_tmp,mr_tmp,mo_tmp,cos_lat - real(r8) :: mr_cnst, mo_cnst - - integer lchnk ! chunk identifier - integer ncol ! number of atmospheric columns - integer i,k ! column, level indices - integer :: ixcldice, ixcldliq,ixtt ! CLDICE and CLDLIQ indices - character(len=16) :: name_out1,name_out2,name_out3,name_out4,name_out5,name_out6 -!----------------------------------------------------------------------- - - name_out1 = 'SE_' //trim(outfld_name_suffix) - name_out2 = 'KE_' //trim(outfld_name_suffix) - name_out3 = 'WV_' //trim(outfld_name_suffix) - name_out4 = 'WL_' //trim(outfld_name_suffix) - name_out5 = 'WI_' //trim(outfld_name_suffix) - name_out6 = 'TT_' //trim(outfld_name_suffix) - - if ( hist_fld_active(name_out1).or.hist_fld_active(name_out2).or.hist_fld_active(name_out3).or.& - hist_fld_active(name_out4).or.hist_fld_active(name_out5).or.hist_fld_active(name_out6)) then - - lchnk = state%lchnk - ncol = state%ncol - call cnst_get_ind('CLDICE', ixcldice, abort=.false.) - call cnst_get_ind('CLDLIQ', ixcldliq, abort=.false.) - call cnst_get_ind('TT_LW' , ixtt , abort=.false.) - - ! Compute frozen static energy in 3 parts: KE, SE, and energy associated with vapor and liquid - - se = 0._r8 - ke = 0._r8 - wv = 0._r8 - wl = 0._r8 - wi = 0._r8 - tt = 0._r8 - - do k = 1, pver - do i = 1, ncol - ke_tmp = 0.5_r8*(state%u(i,k)**2 + state%v(i,k)**2)*state%pdel(i,k)/gravit - se_tmp = cpair*state%t(i,k) *state%pdel(i,k)/gravit - wv_tmp = state%q(i,k,1 ) *state%pdel(i,k)/gravit - - se (i) = se (i) + se_tmp - ke (i) = ke (i) + ke_tmp - wv (i) = wv (i) + wv_tmp - end do - end do - do i = 1, ncol - se(i) = se(i) + state%phis(i)*state%ps(i)/gravit - end do - - ! Don't require cloud liq/ice to be present. Allows for adiabatic/ideal phys. - - if (ixcldliq > 1) then - do k = 1, pver - do i = 1, ncol - wl_tmp = state%q(i,k,ixcldliq)*state%pdel(i,k)/gravit - wl (i) = wl(i) + wl_tmp - end do - end do - end if - - if (ixcldice > 1) then - do k = 1, pver - do i = 1, ncol - wi_tmp = state%q(i,k,ixcldice)*state%pdel(i,k)/gravit - wi(i) = wi(i) + wi_tmp - end do - end do - end if - - if (ixtt > 1) then - if (name_out6 == 'TT_pAM') then - ! - ! after dme_adjust mixing ratios are all wet - ! - do k = 1, pver - do i = 1, ncol - tt_tmp = state%q(i,k,ixtt)*state%pdel(i,k)/gravit - tt (i) = tt(i) + tt_tmp - end do - end do - else - do k = 1, pver - do i = 1, ncol - tt_tmp = state%q(i,k,ixtt)*state%pdeldry(i,k)/gravit - tt (i) = tt(i) + tt_tmp - end do - end do - end if - end if - - ! Output energy diagnostics - - call outfld(name_out1 ,se , pcols ,lchnk ) - call outfld(name_out2 ,ke , pcols ,lchnk ) - call outfld(name_out3 ,wv , pcols ,lchnk ) - call outfld(name_out4 ,wl , pcols ,lchnk ) - call outfld(name_out5 ,wi , pcols ,lchnk ) - call outfld(name_out6 ,tt , pcols ,lchnk ) - end if - - - ! - ! Axial angular momentum diagnostics - ! - ! Code follows - ! - ! Lauritzen et al., (2014): Held-Suarez simulations with the Community Atmosphere Model - ! Spectral Element (CAM-SE) dynamical core: A global axial angularmomentum analysis using Eulerian - ! and floating Lagrangian vertical coordinates. J. Adv. Model. Earth Syst. 6,129-140, - ! doi:10.1002/2013MS000268 - ! - ! MR is equation (6) without \Delta A and sum over areas (areas are in units of radians**2) - ! MO is equation (7) without \Delta A and sum over areas (areas are in units of radians**2) - ! - name_out1 = 'MR_' //trim(outfld_name_suffix) - name_out2 = 'MO_' //trim(outfld_name_suffix) - - if ( hist_fld_active(name_out1).or.hist_fld_active(name_out2)) then - lchnk = state%lchnk - ncol = state%ncol - - mr_cnst = rearth**3/gravit - mo_cnst = omega*rearth**4/gravit - do k = 1, pver - do i = 1, ncol - cos_lat = cos(state%lat(i)) - mr_tmp = mr_cnst*state%u(i,k)*state%pdel(i,k)*cos_lat - mo_tmp = mo_cnst*state%pdel(i,k)*cos_lat**2 - - mr(i) = mr(i) + mr_tmp - mo(i) = mo(i) + mo_tmp - end do - end do - call outfld(name_out1 ,mr, pcols,lchnk ) - call outfld(name_out1 ,mo, pcols,lchnk ) - end if - end subroutine calc_te_and_aam_budgets - - -end module check_energy diff --git a/src/physics/cam_dev/zm_conv.F90 b/src/physics/cam_dev/zm_conv.F90 deleted file mode 100644 index 7ef4d0d546..0000000000 --- a/src/physics/cam_dev/zm_conv.F90 +++ /dev/null @@ -1,4995 +0,0 @@ -module zm_conv - -!--------------------------------------------------------------------------------- -! Purpose: -! -! Interface from Zhang-McFarlane convection scheme, includes evaporation of convective -! precip from the ZM scheme -! -! Apr 2006: RBN: Code added to perform a dilute ascent for closure of the CM mass flux -! based on an entra2ining plume a la Raymond and Blythe (1992) -! -! Author: Byron Boville, from code in tphysbc -! -!--------------------------------------------------------------------------------- - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmd_utils, only: masterproc - use ppgrid, only: pcols, pver, pverp - use cloud_fraction, only: cldfrc_fice - use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & - cpwv, cpliq, rh2o,r_universal - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use zm_microphysics, only: zm_mphy, zm_aero_t, zm_conv_t - use cam_history, only: outfld - - - implicit none - - save - private ! Make default type private to the module -! -! PUBLIC: interfaces -! - public zm_convi ! ZM schemea - public zm_convr ! ZM schemea - public zm_conv_evap ! evaporation of precip from ZM schemea - public convtran ! convective transport - public momtran ! convective momentum transport - -! -! Private data -! - real(r8) rl ! wg latent heat of vaporization. - real(r8) cpres ! specific heat at constant pressure in j/kg-degk. - real(r8), parameter :: capelmt = 70._r8 ! threshold value for cape for deep convection. - real(r8) :: ke ! Tunable evaporation efficiency set from namelist input zmconv_ke - real(r8) :: ke_lnd - real(r8) :: c0_lnd ! set from namelist input zmconv_c0_lnd - real(r8) :: c0_ocn ! set from namelist input zmconv_c0_ocn - integer :: num_cin ! set from namelist input zmconv_num_cin - ! The number of negative buoyancy regions that are allowed - ! before the convection top and CAPE calculations are completed. - logical :: zm_org - real(r8) tau ! convective time scale - real(r8),parameter :: c1 = 6.112_r8 - real(r8),parameter :: c2 = 17.67_r8 - real(r8),parameter :: c3 = 243.5_r8 - real(r8) :: tfreez - real(r8) :: eps1 - real(r8) :: momcu - real(r8) :: momcd - - logical :: zmconv_microp - - logical :: no_deep_pbl ! default = .false. - ! no_deep_pbl = .true. eliminates deep convection entirely within PBL - - -!moved from moistconvection.F90 - real(r8) :: rgrav ! reciprocal of grav - real(r8) :: rgas ! gas constant for dry air - real(r8) :: grav ! = gravit - real(r8) :: cp ! = cpres = cpair - - integer limcnv ! top interface level limit for convection - - real(r8),parameter :: tiedke_add = 0.5_r8 - -! RBN: KE and PBL parcel - logical :: ltau_dynamic ! Use a dynamic tau calculation - logical :: lparcel_dynamic ! Calculate buoyancy/convective top base on parcel K.E. - logical :: lparcel_pbl ! Switch to turn on mixing of parcel MSE air, and picking laucnh level to be the top of the PBL. - -contains - - -subroutine zm_convi(limcnv_in, zmconv_c0_lnd, zmconv_c0_ocn, zmconv_ke, zmconv_ke_lnd, & - zmconv_momcu, zmconv_momcd, zmconv_num_cin, zmconv_org, & - zmconv_microp_in, no_deep_pbl_in) - - integer, intent(in) :: limcnv_in ! top interface level limit for convection - integer, intent(in) :: zmconv_num_cin ! Number negative buoyancy regions that are allowed - ! before the convection top and CAPE calculations are completed. - real(r8),intent(in) :: zmconv_c0_lnd - real(r8),intent(in) :: zmconv_c0_ocn - real(r8),intent(in) :: zmconv_ke - real(r8),intent(in) :: zmconv_ke_lnd - real(r8),intent(in) :: zmconv_momcu - real(r8),intent(in) :: zmconv_momcd - logical :: zmconv_org - logical, intent(in) :: zmconv_microp_in - logical, intent(in), optional :: no_deep_pbl_in ! no_deep_pbl = .true. eliminates ZM convection entirely within PBL - - - ! Initialization of ZM constants - limcnv = limcnv_in - tfreez = tmelt - eps1 = epsilo - rl = latvap - cpres = cpair - rgrav = 1.0_r8/gravit - rgas = rair - grav = gravit - cp = cpres - - c0_lnd = zmconv_c0_lnd - c0_ocn = zmconv_c0_ocn - num_cin = zmconv_num_cin - ke = zmconv_ke - ke_lnd = zmconv_ke_lnd - zm_org = zmconv_org - momcu = zmconv_momcu - momcd = zmconv_momcd - - zmconv_microp = zmconv_microp_in - - if ( present(no_deep_pbl_in) ) then - no_deep_pbl = no_deep_pbl_in - else - no_deep_pbl = .false. - endif - - tau = 3600._r8 - -! RBN: Modification logicals switches - - ltau_dynamic = .false. ! Use a dynamic tau calculation - lparcel_dynamic = .false. ! Calculate buoyancy/convective top base on parcel K.E. - - if ( masterproc ) then - write(iulog,*) 'tuning parameters zm_convi: tau',tau - write(iulog,*) 'tuning parameters zm_convi: c0_lnd',c0_lnd, ', c0_ocn', c0_ocn - write(iulog,*) 'tuning parameters zm_convi: num_cin', num_cin - write(iulog,*) 'tuning parameters zm_convi: ke',ke - write(iulog,*) 'tuning parameters zm_convi: no_deep_pbl',no_deep_pbl - endif - - if (masterproc) write(iulog,*)'**** ZM: DILUTE Buoyancy Calculation ****' - -end subroutine zm_convi - - - -subroutine zm_convr(lchnk ,ncol , & - t ,qh ,omega ,prec ,jctop ,jcbot , & - pblh ,zm ,geos ,zi ,qtnd , & - heat ,pap ,paph ,dpp , & - delt ,mcon ,cme ,cape , & - tpert ,dlf ,pflx ,zdu ,rprd , & - mu ,md ,du ,eu ,ed , & - dp ,dsubcld ,jt ,maxg ,ideep , & - ql ,rliq ,landfrac, & - org ,orgt ,org2d , & - dif ,dnlf ,dnif ,conv , & - aero , rice) -!----------------------------------------------------------------------- -! -! Purpose: -! Main driver for zhang-mcfarlane convection scheme -! -! Method: -! performs deep convective adjustment based on mass-flux closure -! algorithm. -! -! Author:guang jun zhang, m.lazare, n.mcfarlane. CAM Contact: P. Rasch -! -! This is contributed code not fully standardized by the CAM core group. -! All variables have been typed, where most are identified in comments -! The current procedure will be reimplemented in a subsequent version -! of the CAM where it will include a more straightforward formulation -! and will make use of the standard CAM nomenclature -! -!----------------------------------------------------------------------- - use phys_control, only: cam_physpkg_is - -! -! ************************ index of variables ********************** -! -! wg * alpha array of vertical differencing used (=1. for upstream). -! w * cape convective available potential energy. -! wg * capeg gathered convective available potential energy. -! c * capelmt threshold value for cape for deep convection. -! ic * cpres specific heat at constant pressure in j/kg-degk. -! i * dpp -! ic * delt length of model time-step in seconds. -! wg * dp layer thickness in mbs (between upper/lower interface). -! wg * dqdt mixing ratio tendency at gathered points. -! wg * dsdt dry static energy ("temp") tendency at gathered points. -! wg * dudt u-wind tendency at gathered points. -! wg * dvdt v-wind tendency at gathered points. -! wg * dsubcld layer thickness in mbs between lcl and maxi. -! ic * grav acceleration due to gravity in m/sec2. -! wg * du detrainment in updraft. specified in mid-layer -! wg * ed entrainment in downdraft. -! wg * eu entrainment in updraft. -! wg * hmn moist static energy. -! wg * hsat saturated moist static energy. -! w * ideep holds position of gathered points vs longitude index. -! ic * pver number of model levels. -! wg * j0 detrainment initiation level index. -! wg * jd downdraft initiation level index. -! ic * jlatpr gaussian latitude index for printing grids (if needed). -! wg * jt top level index of deep cumulus convection. -! w * lcl base level index of deep cumulus convection. -! wg * lclg gathered values of lcl. -! w * lel index of highest theoretical convective plume. -! wg * lelg gathered values of lel. -! w * lon index of onset level for deep convection. -! w * maxi index of level with largest moist static energy. -! wg * maxg gathered values of maxi. -! wg * mb cloud base mass flux. -! wg * mc net upward (scaled by mb) cloud mass flux. -! wg * md downward cloud mass flux (positive up). -! wg * mu upward cloud mass flux (positive up). specified -! at interface -! ic * msg number of missing moisture levels at the top of model. -! w * p grid slice of ambient mid-layer pressure in mbs. -! i * pblt row of pbl top indices. -! w * pcpdh scaled surface pressure. -! w * pf grid slice of ambient interface pressure in mbs. -! wg * pg grid slice of gathered values of p. -! w * q grid slice of mixing ratio. -! wg * qd grid slice of mixing ratio in downdraft. -! wg * qg grid slice of gathered values of q. -! i/o * qh grid slice of specific humidity. -! w * qh0 grid slice of initial specific humidity. -! wg * qhat grid slice of upper interface mixing ratio. -! wg * ql grid slice of cloud liquid water. -! wg * qs grid slice of saturation mixing ratio. -! w * qstp grid slice of parcel temp. saturation mixing ratio. -! wg * qstpg grid slice of gathered values of qstp. -! wg * qu grid slice of mixing ratio in updraft. -! ic * rgas dry air gas constant. -! wg * rl latent heat of vaporization. -! w * s grid slice of scaled dry static energy (t+gz/cp). -! wg * sd grid slice of dry static energy in downdraft. -! wg * sg grid slice of gathered values of s. -! wg * shat grid slice of upper interface dry static energy. -! wg * su grid slice of dry static energy in updraft. -! i/o * t -! o * jctop row of top-of-deep-convection indices passed out. -! O * jcbot row of base of cloud indices passed out. -! wg * tg grid slice of gathered values of t. -! w * tl row of parcel temperature at lcl. -! wg * tlg grid slice of gathered values of tl. -! w * tp grid slice of parcel temperatures. -! wg * tpg grid slice of gathered values of tp. -! i/o * u grid slice of u-wind (real). -! wg * ug grid slice of gathered values of u. -! i/o * utg grid slice of u-wind tendency (real). -! i/o * v grid slice of v-wind (real). -! w * va work array re-used by called subroutines. -! wg * vg grid slice of gathered values of v. -! i/o * vtg grid slice of v-wind tendency (real). -! i * w grid slice of diagnosed large-scale vertical velocity. -! w * z grid slice of ambient mid-layer height in metres. -! w * zf grid slice of ambient interface height in metres. -! wg * zfg grid slice of gathered values of zf. -! wg * zg grid slice of gathered values of z. -! -!----------------------------------------------------------------------- -! -! multi-level i/o fields: -! i => input arrays. -! i/o => input/output arrays. -! w => work arrays. -! wg => work arrays operating only on gathered points. -! ic => input data constants. -! c => data constants pertaining to subroutine itself. -! -! input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: t(pcols,pver) ! grid slice of temperature at mid-layer. - real(r8), intent(in) :: qh(pcols,pver) ! grid slice of specific humidity. - real(r8), intent(in) :: omega(pcols,pver) ! RBN - Omega to be used in parcel energy calculation - real(r8), intent(in) :: pap(pcols,pver) - real(r8), intent(in) :: paph(pcols,pver+1) - real(r8), intent(in) :: dpp(pcols,pver) ! local sigma half-level thickness (i.e. dshj). - real(r8), intent(in) :: zm(pcols,pver) - real(r8), intent(in) :: geos(pcols) - real(r8), intent(in) :: zi(pcols,pver+1) - real(r8), intent(in) :: pblh(pcols) - real(r8), intent(in) :: tpert(pcols) - real(r8), intent(in) :: landfrac(pcols) ! RBN Landfrac - - type(zm_conv_t), intent(inout) :: conv - type(zm_aero_t), intent(inout) :: aero ! aerosol object. intent(inout) because the - ! gathered arrays are set here - ! before passing object - ! to microphysics -! output arguments -! - real(r8), intent(out) :: qtnd(pcols,pver) ! specific humidity tendency (kg/kg/s) - real(r8), intent(out) :: heat(pcols,pver) ! heating rate (dry static energy tendency, W/kg) - real(r8), intent(out) :: mcon(pcols,pverp) - real(r8), intent(out) :: dlf(pcols,pver) ! scattrd version of the detraining cld h2o tend - real(r8), intent(out) :: pflx(pcols,pverp) ! scattered precip flux at each level - real(r8), intent(out) :: cme(pcols,pver) - real(r8), intent(out) :: cape(pcols) ! w convective available potential energy. - real(r8), intent(out) :: zdu(pcols,pver) - real(r8), intent(out) :: rprd(pcols,pver) ! rain production rate - real(r8), intent(out) :: dif(pcols,pver) ! detrained convective cloud ice mixing ratio. - real(r8), intent(out) :: dnlf(pcols,pver) ! detrained convective cloud water num concen. - real(r8), intent(out) :: dnif(pcols,pver) ! detrained convective cloud ice num concen. - -! move these vars from local storage to output so that convective -! transports can be done in outside of conv_cam. - real(r8), intent(out) :: mu(pcols,pver) - real(r8), intent(out) :: eu(pcols,pver) - real(r8), intent(out) :: du(pcols,pver) - real(r8), intent(out) :: md(pcols,pver) - real(r8), intent(out) :: ed(pcols,pver) - real(r8), intent(out) :: dp(pcols,pver) ! wg layer thickness in mbs (between upper/lower interface). - real(r8), intent(out) :: dsubcld(pcols) ! wg layer thickness in mbs between lcl and maxi. - real(r8), intent(out) :: jctop(pcols) ! o row of top-of-deep-convection indices passed out. - real(r8), intent(out) :: jcbot(pcols) ! o row of base of cloud indices passed out. - real(r8), intent(out) :: prec(pcols) - real(r8), intent(out) :: rliq(pcols) ! reserved liquid (not yet in cldliq) for energy integrals - real(r8), intent(out) :: rice(pcols) ! reserved ice (not yet in cldce) for energy integrals - - integer, intent(out) :: ideep(pcols) ! column indices of gathered points - - type(zm_conv_t) :: loc_conv - - real(r8), pointer :: org(:,:) ! Only used if zm_org is true - real(r8), pointer :: orgt(:,:) ! Only used if zm_org is true - real(r8), pointer :: org2d(:,:) ! Only used if zm_org is true - - real(r8) zs(pcols) - real(r8) dlg(pcols,pver) ! gathrd version of the detraining cld h2o tend - real(r8) pflxg(pcols,pverp) ! gather precip flux at each level - real(r8) cug(pcols,pver) ! gathered condensation rate - - real(r8) evpg(pcols,pver) ! gathered evap rate of rain in downdraft - real(r8) orgavg(pcols) - real(r8) dptot(pcols) - real(r8) mumax(pcols) - integer jt(pcols) ! wg top level index of deep cumulus convection. - integer maxg(pcols) ! wg gathered values of maxi. - integer lengath -! diagnostic field used by chem/wetdep codes - real(r8) ql(pcols,pver) ! wg grid slice of cloud liquid water. -! - real(r8) pblt(pcols) ! i row of pbl top indices. - - - - -! -!----------------------------------------------------------------------- -! -! general work fields (local variables): -! - real(r8) q(pcols,pver) ! w grid slice of mixing ratio. - real(r8) p(pcols,pver) ! w grid slice of ambient mid-layer pressure in mbs. - real(r8) z(pcols,pver) ! w grid slice of ambient mid-layer height in metres. - real(r8) s(pcols,pver) ! w grid slice of scaled dry static energy (t+gz/cp). - real(r8) tp(pcols,pver) ! w grid slice of parcel temperatures. - real(r8) zf(pcols,pver+1) ! w grid slice of ambient interface height in metres. - real(r8) pf(pcols,pver+1) ! w grid slice of ambient interface pressure in mbs. - real(r8) qstp(pcols,pver) ! w grid slice of parcel temp. saturation mixing ratio. - - real(r8) tl(pcols) ! w row of parcel temperature at lcl. - - integer lcl(pcols) ! w base level index of deep cumulus convection. - integer lel(pcols) ! w index of highest theoretical convective plume. - integer lon(pcols) ! w index of onset level for deep convection. - integer maxi(pcols) ! w index of level with largest moist static energy. - - real(r8) precip -! -! gathered work fields: -! - real(r8) qg(pcols,pver) ! wg grid slice of gathered values of q. - real(r8) tg(pcols,pver) ! w grid slice of temperature at interface. - real(r8) pg(pcols,pver) ! wg grid slice of gathered values of p. - real(r8) zg(pcols,pver) ! wg grid slice of gathered values of z. - real(r8) sg(pcols,pver) ! wg grid slice of gathered values of s. - real(r8) tpg(pcols,pver) ! wg grid slice of gathered values of tp. - real(r8) zfg(pcols,pver+1) ! wg grid slice of gathered values of zf. - real(r8) qstpg(pcols,pver) ! wg grid slice of gathered values of qstp. - real(r8) ug(pcols,pver) ! wg grid slice of gathered values of u. - real(r8) vg(pcols,pver) ! wg grid slice of gathered values of v. - real(r8) cmeg(pcols,pver) - - real(r8) rprdg(pcols,pver) ! wg gathered rain production rate - real(r8) capeg(pcols) ! wg gathered convective available potential energy. - real(r8) tlg(pcols) ! wg grid slice of gathered values of tl. - real(r8) landfracg(pcols) ! wg grid slice of landfrac - - integer lclg(pcols) ! wg gathered values of lcl. - integer lelg(pcols) -! -! work fields arising from gathered calculations. -! - real(r8) dqdt(pcols,pver) ! wg mixing ratio tendency at gathered points. - real(r8) dsdt(pcols,pver) ! wg dry static energy ("temp") tendency at gathered points. -! real(r8) alpha(pcols,pver) ! array of vertical differencing used (=1. for upstream). - real(r8) sd(pcols,pver) ! wg grid slice of dry static energy in downdraft. - real(r8) qd(pcols,pver) ! wg grid slice of mixing ratio in downdraft. - real(r8) mc(pcols,pver) ! wg net upward (scaled by mb) cloud mass flux. - real(r8) qhat(pcols,pver) ! wg grid slice of upper interface mixing ratio. - real(r8) qu(pcols,pver) ! wg grid slice of mixing ratio in updraft. - real(r8) su(pcols,pver) ! wg grid slice of dry static energy in updraft. - real(r8) qs(pcols,pver) ! wg grid slice of saturation mixing ratio. - real(r8) shat(pcols,pver) ! wg grid slice of upper interface dry static energy. - real(r8) hmn(pcols,pver) ! wg moist static energy. - real(r8) hsat(pcols,pver) ! wg saturated moist static energy. - real(r8) qlg(pcols,pver) - real(r8) dudt(pcols,pver) ! wg u-wind tendency at gathered points. - real(r8) dvdt(pcols,pver) ! wg v-wind tendency at gathered points. -! real(r8) ud(pcols,pver) -! real(r8) vd(pcols,pver) - - - - - - - - real(r8) qldeg(pcols,pver) ! cloud liquid water mixing ratio for detrainment (kg/kg) - real(r8) mb(pcols) ! wg cloud base mass flux. - - !RBN - Convective in-cloud vertical velocities. - real(r8) wm_incld(pcols) ! Convective in-cloud vertical velocity - real(r8) wm_incldg(pcols) ! Gathered Convective in-cloud vertical velocity - - integer jlcl(pcols) - integer j0(pcols) ! wg detrainment initiation level index. - integer jd(pcols) ! wg downdraft initiation level index. - - real(r8) delt ! length of model time-step in seconds. - - integer i - integer ii - integer k, kk, l, m - - integer msg ! ic number of missing moisture levels at the top of model. - real(r8) qdifr - real(r8) sdifr - - real(r8), parameter :: dcon = 25.e-6_r8 - real(r8), parameter :: mucon = 5.3_r8 - real(r8) negadq - logical doliq - - -! -!--------------------------Data statements------------------------------ - -! -! Set internal variable "msg" (convection limit) to "limcnv-1" -! - msg = limcnv - 1 -! -! initialize necessary arrays. -! zero out variables not used in cam -! - - if (zm_org) then - orgt(:,:) = 0._r8 - end if - - qtnd(:,:) = 0._r8 - heat(:,:) = 0._r8 - mcon(:,:) = 0._r8 - rliq(:ncol) = 0._r8 - rice(:ncol) = 0._r8 - - if (zmconv_microp) then - allocate( & - loc_conv%frz(pcols,pver), & - loc_conv%sprd(pcols,pver), & - loc_conv%wu(pcols,pver), & - loc_conv%qi(pcols,pver), & - loc_conv%qliq(pcols,pver), & - loc_conv%qice(pcols,pver), & - loc_conv%qrain(pcols,pver), & - loc_conv%qsnow(pcols,pver), & - loc_conv%di(pcols,pver), & - loc_conv%dnl(pcols,pver), & - loc_conv%dni(pcols,pver), & - loc_conv%qnl(pcols,pver), & - loc_conv%qni(pcols,pver), & - loc_conv%qnr(pcols,pver), & - loc_conv%qns(pcols,pver), & - loc_conv%qide(pcols,pver), & - loc_conv%qncde(pcols,pver), & - loc_conv%qnide(pcols,pver), & - loc_conv%autolm(pcols,pver), & - loc_conv%accrlm(pcols,pver), & - loc_conv%bergnm(pcols,pver), & - loc_conv%fhtimm(pcols,pver), & - loc_conv%fhtctm(pcols,pver), & - loc_conv%fhmlm(pcols,pver), & - loc_conv%hmpim(pcols,pver), & - loc_conv%accslm(pcols,pver), & - loc_conv%dlfm(pcols,pver), & - loc_conv%cmel(pcols,pver), & - loc_conv%autoln(pcols,pver), & - loc_conv%accrln(pcols,pver), & - loc_conv%bergnn(pcols,pver), & - loc_conv%fhtimn(pcols,pver), & - loc_conv%fhtctn(pcols,pver), & - loc_conv%fhmln(pcols,pver), & - loc_conv%accsln(pcols,pver), & - loc_conv%activn(pcols,pver), & - loc_conv%dlfn(pcols,pver), & - loc_conv%autoim(pcols,pver), & - loc_conv%accsim(pcols,pver), & - loc_conv%difm(pcols,pver), & - loc_conv%cmei(pcols,pver), & - loc_conv%nuclin(pcols,pver), & - loc_conv%autoin(pcols,pver), & - loc_conv%accsin(pcols,pver), & - loc_conv%hmpin(pcols,pver), & - loc_conv%difn(pcols,pver), & - loc_conv%trspcm(pcols,pver), & - loc_conv%trspcn(pcols,pver), & - loc_conv%trspim(pcols,pver), & - loc_conv%trspin(pcols,pver), & - loc_conv%lambdadpcu(pcols,pver), & - loc_conv%mudpcu(pcols,pver), & - loc_conv%dcape(pcols) ) - end if - -! -! initialize convective tendencies -! - prec(:ncol) = 0._r8 - do k = 1,pver - do i = 1,ncol - dqdt(i,k) = 0._r8 - dsdt(i,k) = 0._r8 - dudt(i,k) = 0._r8 - dvdt(i,k) = 0._r8 - pflx(i,k) = 0._r8 - pflxg(i,k) = 0._r8 - cme(i,k) = 0._r8 - rprd(i,k) = 0._r8 - zdu(i,k) = 0._r8 - ql(i,k) = 0._r8 - qlg(i,k) = 0._r8 - dlf(i,k) = 0._r8 - dlg(i,k) = 0._r8 - qldeg(i,k) = 0._r8 - - dif(i,k) = 0._r8 - dnlf(i,k) = 0._r8 - dnif(i,k) = 0._r8 - - end do - end do - - if (zmconv_microp) then - do k = 1,pver - do i = 1,ncol - loc_conv%qliq(i,k) = 0._r8 - loc_conv%qice(i,k) = 0._r8 - loc_conv%di(i,k) = 0._r8 - loc_conv%qrain(i,k)= 0._r8 - loc_conv%qsnow(i,k)= 0._r8 - loc_conv%dnl(i,k) = 0._r8 - loc_conv%dni(i,k) = 0._r8 - loc_conv%wu(i,k) = 0._r8 - loc_conv%qnl(i,k) = 0._r8 - loc_conv%qni(i,k) = 0._r8 - loc_conv%qnr(i,k) = 0._r8 - loc_conv%qns(i,k) = 0._r8 - loc_conv%frz(i,k) = 0._r8 - loc_conv%sprd(i,k) = 0._r8 - loc_conv%qide(i,k) = 0._r8 - loc_conv%qncde(i,k) = 0._r8 - loc_conv%qnide(i,k) = 0._r8 - - loc_conv%autolm(i,k) = 0._r8 - loc_conv%accrlm(i,k) = 0._r8 - loc_conv%bergnm(i,k) = 0._r8 - loc_conv%fhtimm(i,k) = 0._r8 - loc_conv%fhtctm(i,k) = 0._r8 - loc_conv%fhmlm (i,k) = 0._r8 - loc_conv%hmpim (i,k) = 0._r8 - loc_conv%accslm(i,k) = 0._r8 - loc_conv%dlfm (i,k) = 0._r8 - - loc_conv%autoln(i,k) = 0._r8 - loc_conv%accrln(i,k) = 0._r8 - loc_conv%bergnn(i,k) = 0._r8 - loc_conv%fhtimn(i,k) = 0._r8 - loc_conv%fhtctn(i,k) = 0._r8 - loc_conv%fhmln (i,k) = 0._r8 - loc_conv%accsln(i,k) = 0._r8 - loc_conv%activn(i,k) = 0._r8 - loc_conv%dlfn (i,k) = 0._r8 - loc_conv%cmel (i,k) = 0._r8 - - loc_conv%autoim(i,k) = 0._r8 - loc_conv%accsim(i,k) = 0._r8 - loc_conv%difm (i,k) = 0._r8 - loc_conv%cmei (i,k) = 0._r8 - - loc_conv%nuclin(i,k) = 0._r8 - loc_conv%autoin(i,k) = 0._r8 - loc_conv%accsin(i,k) = 0._r8 - loc_conv%hmpin (i,k) = 0._r8 - loc_conv%difn (i,k) = 0._r8 - - loc_conv%trspcm(i,k) = 0._r8 - loc_conv%trspcn(i,k) = 0._r8 - loc_conv%trspim(i,k) = 0._r8 - loc_conv%trspin(i,k) = 0._r8 - - conv%qi(i,k) = 0._r8 - conv%frz(i,k) = 0._r8 - conv%sprd(i,k) = 0._r8 - conv%qi(i,k) = 0._r8 - conv%qliq(i,k) = 0._r8 - conv%qice(i,k) = 0._r8 - conv%qnl(i,k) = 0._r8 - conv%qni(i,k) = 0._r8 - conv%qnr(i,k) = 0._r8 - conv%qns(i,k) = 0._r8 - conv%qrain(i,k) = 0._r8 - conv%qsnow(i,k) = 0._r8 - conv%wu(i,k) = 0._r8 - - conv%autolm(i,k) = 0._r8 - conv%accrlm(i,k) = 0._r8 - conv%bergnm(i,k) = 0._r8 - conv%fhtimm(i,k) = 0._r8 - conv%fhtctm(i,k) = 0._r8 - conv%fhmlm (i,k) = 0._r8 - conv%hmpim (i,k) = 0._r8 - conv%accslm(i,k) = 0._r8 - conv%dlfm (i,k) = 0._r8 - - conv%autoln(i,k) = 0._r8 - conv%accrln(i,k) = 0._r8 - conv%bergnn(i,k) = 0._r8 - conv%fhtimn(i,k) = 0._r8 - conv%fhtctn(i,k) = 0._r8 - conv%fhmln (i,k) = 0._r8 - conv%accsln(i,k) = 0._r8 - conv%activn(i,k) = 0._r8 - conv%dlfn (i,k) = 0._r8 - conv%cmel (i,k) = 0._r8 - - conv%autoim(i,k) = 0._r8 - conv%accsim(i,k) = 0._r8 - conv%difm (i,k) = 0._r8 - conv%cmei (i,k) = 0._r8 - - conv%nuclin(i,k) = 0._r8 - conv%autoin(i,k) = 0._r8 - conv%accsin(i,k) = 0._r8 - conv%hmpin (i,k) = 0._r8 - conv%difn (i,k) = 0._r8 - - conv%trspcm(i,k) = 0._r8 - conv%trspcn(i,k) = 0._r8 - conv%trspim(i,k) = 0._r8 - conv%trspin(i,k) = 0._r8 - - end do - end do - - conv%lambdadpcu = (mucon + 1._r8)/dcon - conv%mudpcu = mucon - loc_conv%lambdadpcu = conv%lambdadpcu - loc_conv%mudpcu = conv%mudpcu - - end if - - do i = 1,ncol - pflx(i,pverp) = 0 - pflxg(i,pverp) = 0 - end do -! - do i = 1,ncol - pblt(i) = pver - dsubcld(i) = 0._r8 - - - jctop(i) = pver - jcbot(i) = 1 - - wm_incld(i) = 0._r8 !RBN: Initialize in-cloud parcel velocity - - end do - - if (zmconv_microp) then - do i = 1,ncol - conv%dcape(i) = 0._r8 - loc_conv%dcape(i) = 0._r8 - end do - end if - - if (zm_org) then -! compute vertical average here - orgavg(:) = 0._r8 - dptot(:) = 0._r8 - - do k = 1, pver - do i = 1,ncol - if (org(i,k) .gt. 0) then - orgavg(i) = orgavg(i)+dpp(i,k)*org(i,k) - dptot(i) = dptot(i)+dpp(i,k) - endif - enddo - enddo - - do i = 1,ncol - if (dptot(i) .gt. 0) then - orgavg(i) = orgavg(i)/dptot(i) - endif - enddo - - do k = 1, pver - do i = 1, ncol - org2d(i,k) = orgavg(i) - enddo - enddo - - endif - -! -! calculate local pressure (mbs) and height (m) for both interface -! and mid-layer locations. -! - do i = 1,ncol - zs(i) = geos(i)*rgrav - - pf(i,pver+1) = paph(i,pver+1)*0.01_r8 - zf(i,pver+1) = zi(i,pver+1) + zs(i) - end do - do k = 1,pver - do i = 1,ncol - p(i,k) = pap(i,k)*0.01_r8 - pf(i,k) = paph(i,k)*0.01_r8 - z(i,k) = zm(i,k) + zs(i) - zf(i,k) = zi(i,k) + zs(i) - end do - end do -! - do k = pver - 1,msg + 1,-1 - do i = 1,ncol - if (abs(z(i,k)-zs(i)-pblh(i)) < (zf(i,k)-zf(i,k+1))*0.5_r8) pblt(i) = k - end do - end do -! -! store incoming specific humidity field for subsequent calculation -! of precipitation (through change in storage). -! define dry static energy (normalized by cp). -! - do k = 1,pver - do i = 1,ncol - q(i,k) = qh(i,k) - s(i,k) = t(i,k) + (grav/cpres)*z(i,k) - tp(i,k)=0.0_r8 - shat(i,k) = s(i,k) - qhat(i,k) = q(i,k) - end do - end do - - do i = 1,ncol - capeg(i) = 0._r8 - lclg(i) = 1 - lelg(i) = pver - maxg(i) = 1 - tlg(i) = 400._r8 - dsubcld(i) = 0._r8 - wm_incldg(i) = 0._r8 - end do - - - - if( cam_physpkg_is('cam3')) then - - ! For cam3 physics package, call non-dilute - - call buoyan(lchnk ,ncol , & - q ,t ,p ,z ,pf , & - tp ,qstp ,tl ,rl ,cape , & - pblt ,lcl ,lel ,lon ,maxi , & - rgas ,grav ,cpres ,msg , & - tpert ) - else - - ! Evaluate Tparcel, qs(Tparcel), buoyancy and CAPE, - ! lcl, lel, parcel launch level at index maxi()=hmax - - call buoyan_dilute(lchnk ,ncol , & - q ,t ,omega ,p ,z ,pf , & - tp ,qstp ,tl ,rl ,cape , & - pblt ,pblh ,lcl ,lel ,lon ,maxi , & - rgas ,grav ,cpres ,msg , & - zi, tpert , org2d , landfrac, wm_incld) - end if - -! -! determine whether grid points will undergo some deep convection -! (ideep=1) or not (ideep=0), based on values of cape,lcl,lel -! (require cape.gt. 0 and lel capelmt) then - lengath = lengath + 1 - ideep(lengath) = i - end if - end do - - if (lengath.eq.0) return -! -! obtain gathered arrays necessary for ensuing calculations. -! - do k = 1,pver - do i = 1,lengath - dp(i,k) = 0.01_r8*dpp(ideep(i),k) - qg(i,k) = q(ideep(i),k) - tg(i,k) = t(ideep(i),k) - pg(i,k) = p(ideep(i),k) - zg(i,k) = z(ideep(i),k) - sg(i,k) = s(ideep(i),k) - tpg(i,k) = tp(ideep(i),k) - zfg(i,k) = zf(ideep(i),k) - qstpg(i,k) = qstp(ideep(i),k) - ug(i,k) = 0._r8 - vg(i,k) = 0._r8 - end do - end do - - if (zmconv_microp) then - - if (aero%scheme == 'modal') then - - do m = 1, aero%nmodes - - do k = 1,pver - do i = 1,lengath - aero%numg_a(i,k,m) = aero%num_a(m)%val(ideep(i),k) - aero%dgnumg(i,k,m) = aero%dgnum(m)%val(ideep(i),k) - end do - end do - - do l = 1, aero%nspec(m) - do k = 1,pver - do i = 1,lengath - aero%mmrg_a(i,k,l,m) = aero%mmr_a(l,m)%val(ideep(i),k) - end do - end do - end do - - end do - - else if (aero%scheme == 'bulk') then - - do m = 1, aero%nbulk - do k = 1,pver - do i = 1,lengath - aero%mmrg_bulk(i,k,m) = aero%mmr_bulk(m)%val(ideep(i),k) - end do - end do - end do - - end if - - end if - -! - do i = 1,lengath - zfg(i,pver+1) = zf(ideep(i),pver+1) - end do - do i = 1,lengath - capeg(i) = cape(ideep(i)) - lclg(i) = lcl(ideep(i)) - lelg(i) = lel(ideep(i)) - maxg(i) = maxi(ideep(i)) - tlg(i) = tl(ideep(i)) - landfracg(i) = landfrac(ideep(i)) - wm_incldg(i) = wm_incld(ideep(i)) !RBN in-cloud convective vertical velocity. - end do -! -! calculate sub-cloud layer pressure "thickness" for use in -! closure and tendency routines. -! - do k = msg + 1,pver - do i = 1,lengath - if (k >= maxg(i)) then - dsubcld(i) = dsubcld(i) + dp(i,k) - end if - end do - end do -! -! define array of factors (alpha) which defines interfacial -! values, as well as interfacial values for (q,s) used in -! subsequent routines. -! - do k = msg + 2,pver - do i = 1,lengath -! alpha(i,k) = 0.5 - sdifr = 0._r8 - qdifr = 0._r8 - if (sg(i,k) > 0._r8 .or. sg(i,k-1) > 0._r8) & - sdifr = abs((sg(i,k)-sg(i,k-1))/max(sg(i,k-1),sg(i,k))) - if (qg(i,k) > 0._r8 .or. qg(i,k-1) > 0._r8) & - qdifr = abs((qg(i,k)-qg(i,k-1))/max(qg(i,k-1),qg(i,k))) - if (sdifr > 1.E-6_r8) then - shat(i,k) = log(sg(i,k-1)/sg(i,k))*sg(i,k-1)*sg(i,k)/(sg(i,k-1)-sg(i,k)) - else - shat(i,k) = 0.5_r8* (sg(i,k)+sg(i,k-1)) - end if - if (qdifr > 1.E-6_r8) then - qhat(i,k) = log(qg(i,k-1)/qg(i,k))*qg(i,k-1)*qg(i,k)/(qg(i,k-1)-qg(i,k)) - else - qhat(i,k) = 0.5_r8* (qg(i,k)+qg(i,k-1)) - end if - end do - end do -! -! obtain cloud properties. -! - - call cldprp(lchnk , & - qg ,tg ,ug ,vg ,pg , & - zg ,sg ,mu ,eu ,du , & - md ,ed ,sd ,qd ,mc , & - qu ,su ,zfg ,qs ,hmn , & - hsat ,shat ,qlg , & - cmeg ,maxg ,lelg ,jt ,jlcl , & - maxg ,j0 ,jd ,rl ,lengath , & - rgas ,grav ,cpres ,msg , & - pflxg ,evpg ,cug ,rprdg ,limcnv ,landfracg , & - qldeg ,aero ,loc_conv,qhat ) - - if (zmconv_microp) then - do i = 1,lengath - capeg(i) = capeg(i)+ loc_conv%dcape(i) - end do - end if - -! -! convert detrainment from units of "1/m" to "1/mb". -! - - do k = msg + 1,pver - do i = 1,lengath - du (i,k) = du (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - eu (i,k) = eu (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - ed (i,k) = ed (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - cug (i,k) = cug (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - cmeg (i,k) = cmeg (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - rprdg(i,k) = rprdg(i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - evpg (i,k) = evpg (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - end do - end do - - if (zmconv_microp) then - do k = msg + 1,pver - do i = 1,lengath - loc_conv%sprd(i,k) = loc_conv%sprd(i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - loc_conv%frz (i,k) = loc_conv%frz (i,k)* (zfg(i,k)-zfg(i,k+1))/dp(i,k) - end do - end do - end if - - call closure(lchnk , & - qg ,tg ,pg ,zg ,sg , & - tpg ,qs ,qu ,su ,mc , & - du ,mu ,md ,qd ,sd , & - qhat ,shat ,dp ,qstpg ,zfg , & - qlg ,dsubcld ,mb ,capeg ,tlg , & - lclg ,lelg ,jt ,maxg ,1 , & - lengath ,rgas ,grav ,cpres ,rl , & - msg ,capelmt ,wm_incldg ) -! -! limit cloud base mass flux to theoretical upper bound. -! - do i=1,lengath - mumax(i) = 0 - end do - do k=msg + 2,pver - do i=1,lengath - mumax(i) = max(mumax(i), mu(i,k)/dp(i,k)) - end do - end do - - do i=1,lengath - if (mumax(i) > 0._r8) then - mb(i) = min(mb(i),0.5_r8/(delt*mumax(i))) - else - mb(i) = 0._r8 - endif - end do - ! If no_deep_pbl = .true., don't allow convection entirely - ! within PBL (suggestion of Bjorn Stevens, 8-2000) - - if (no_deep_pbl) then - do i=1,lengath - if (zm(ideep(i),jt(i)) < pblh(ideep(i))) mb(i) = 0 - end do - end if - - if (zmconv_microp) then - do k=msg+1,pver - do i=1,lengath - loc_conv%sprd(i,k) = loc_conv%sprd(i,k)*mb(i) - loc_conv%frz (i,k) = loc_conv%frz (i,k)*mb(i) - end do - end do - end if - - do k=msg+1,pver - do i=1,lengath - mu (i,k) = mu (i,k)*mb(i) - md (i,k) = md (i,k)*mb(i) - mc (i,k) = mc (i,k)*mb(i) - du (i,k) = du (i,k)*mb(i) - eu (i,k) = eu (i,k)*mb(i) - ed (i,k) = ed (i,k)*mb(i) - cmeg (i,k) = cmeg (i,k)*mb(i) - rprdg(i,k) = rprdg(i,k)*mb(i) - cug (i,k) = cug (i,k)*mb(i) - evpg (i,k) = evpg (i,k)*mb(i) - pflxg(i,k+1)= pflxg(i,k+1)*mb(i)*100._r8/grav - - - if ( zmconv_microp .and. mb(i).eq.0._r8) then - qlg (i,k) = 0._r8 - loc_conv%qliq (i,k) = 0._r8 - loc_conv%qice (i,k) = 0._r8 - loc_conv%qrain(i,k) = 0._r8 - loc_conv%qsnow(i,k) = 0._r8 - loc_conv%wu(i,k) = 0._r8 - loc_conv%qnl (i,k) = 0._r8 - loc_conv%qni (i,k) = 0._r8 - loc_conv%qnr (i,k) = 0._r8 - loc_conv%qns (i,k) = 0._r8 - - loc_conv%autolm(i,k) = 0._r8 - loc_conv%accrlm(i,k) = 0._r8 - loc_conv%bergnm(i,k) = 0._r8 - loc_conv%fhtimm(i,k) = 0._r8 - loc_conv%fhtctm(i,k) = 0._r8 - loc_conv%fhmlm (i,k) = 0._r8 - loc_conv%hmpim (i,k) = 0._r8 - loc_conv%accslm(i,k) = 0._r8 - loc_conv%dlfm (i,k) = 0._r8 - - loc_conv%autoln(i,k) = 0._r8 - loc_conv%accrln(i,k) = 0._r8 - loc_conv%bergnn(i,k) = 0._r8 - loc_conv%fhtimn(i,k) = 0._r8 - loc_conv%fhtctn(i,k) = 0._r8 - loc_conv%fhmln (i,k) = 0._r8 - loc_conv%accsln(i,k) = 0._r8 - loc_conv%activn(i,k) = 0._r8 - loc_conv%dlfn (i,k) = 0._r8 - loc_conv%cmel (i,k) = 0._r8 - - loc_conv%autoim(i,k) = 0._r8 - loc_conv%accsim(i,k) = 0._r8 - loc_conv%difm (i,k) = 0._r8 - loc_conv%cmei (i,k) = 0._r8 - - loc_conv%nuclin(i,k) = 0._r8 - loc_conv%autoin(i,k) = 0._r8 - loc_conv%accsin(i,k) = 0._r8 - loc_conv%hmpin (i,k) = 0._r8 - loc_conv%difn (i,k) = 0._r8 - - loc_conv%trspcm(i,k) = 0._r8 - loc_conv%trspcn(i,k) = 0._r8 - loc_conv%trspim(i,k) = 0._r8 - loc_conv%trspin(i,k) = 0._r8 - end if - end do - end do -! -! compute temperature and moisture changes due to convection. -! - call q1q2_pjr(lchnk , & - dqdt ,dsdt ,qg ,qs ,qu , & - su ,du ,qhat ,shat ,dp , & - mu ,md ,sd ,qd ,qldeg , & - dsubcld ,jt ,maxg ,1 ,lengath , & - cpres ,rl ,msg , & - dlg ,evpg ,cug , & - loc_conv ) -! -! gather back temperature and mixing ratio. -! - - if (zmconv_microp) then - do k = msg + 1,pver - do i = 1,lengath - if (dqdt(i,k)*2._r8*delt+qg(i,k)<0._r8) then - negadq = (dqdt(i,k)+0.5_r8*qg(i,k)/delt)/0.9999_r8 - dqdt(i,k) = dqdt(i,k)-negadq - - do kk=k,jt(i),-1 - if (negadq<0._r8) then - if (rprdg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then - dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres - if (rprdg(i,kk)>loc_conv%sprd(i,kk)) then - if(rprdg(i,kk)-loc_conv%sprd(i,kk)<-negadq*dp(i,k)/dp(i,kk)) then - dsdt(i,k) = dsdt(i,k) + (negadq+ (rprdg(i,kk)-loc_conv%sprd(i,kk))*dp(i,kk)/dp(i,k))*latice/cpres - loc_conv%sprd(i,kk) = negadq*dp(i,k)/dp(i,kk)+rprdg(i,kk) - end if - else - loc_conv%sprd(i,kk) = loc_conv%sprd(i,kk)+negadq*dp(i,k)/dp(i,kk) - dsdt(i,k) = dsdt(i,k) + negadq*latice/cpres - end if - rprdg(i,kk) = rprdg(i,kk)+negadq*dp(i,k)/dp(i,kk) - negadq = 0._r8 - else - negadq = rprdg(i,kk)*dp(i,kk)/dp(i,k)+negadq - dsdt(i,k) = dsdt(i,k) - rprdg(i,kk)*rl/cpres*dp(i,kk)/dp(i,k) - if (rprdg(i,kk)>loc_conv%sprd(i,kk)) then - dsdt(i,k) = dsdt(i,k) - loc_conv%sprd(i,kk)*latice/cpres*dp(i,kk)/dp(i,k) - loc_conv%sprd(i,kk) = 0._r8 - else - dsdt(i,k) = dsdt(i,k) -rprdg(i,kk)*latice/cpres*dp(i,kk)/dp(i,k) - loc_conv%sprd(i,kk)= loc_conv%sprd(i,kk)- rprdg(i,kk) - end if - rprdg(i,kk) = 0._r8 - end if - - if (dlg(i,kk)>loc_conv%di(i,kk)) then - doliq= .true. - else - doliq= .false. - end if - - if (negadq<0._r8) then - if (doliq) then - if (dlg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then - dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres - loc_conv%dnl(i,kk) = loc_conv%dnl(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/dlg(i,kk)) - dlg(i,kk) = dlg(i,kk)+negadq*dp(i,k)/dp(i,kk) - negadq = 0._r8 - else - negadq = negadq + dlg(i,kk)*dp(i,kk)/dp(i,k) - dsdt(i,k) = dsdt(i,k) - dlg(i,kk)*dp(i,kk)/dp(i,k)*rl/cpres - dlg(i,kk) = 0._r8 - loc_conv%dnl(i,kk) = 0._r8 - end if - else - if (loc_conv%di(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then - dsdt(i,k) = dsdt(i,k) + negadq*(rl+latice)/cpres - loc_conv%dni(i,kk) = loc_conv%dni(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/loc_conv%di(i,kk)) - loc_conv%di(i,kk) = loc_conv%di(i,kk)+negadq*dp(i,k)/dp(i,kk) - negadq = 0._r8 - else - negadq = negadq + loc_conv%di(i,kk)*dp(i,kk)/dp(i,k) - dsdt(i,k) = dsdt(i,k) - loc_conv%di(i,kk)*dp(i,kk)/dp(i,k)*(rl+latice)/cpres - loc_conv%di(i,kk) = 0._r8 - loc_conv%dni(i,kk) = 0._r8 - end if - doliq= .false. - end if - end if - if (negadq<0._r8 .and. doliq ) then - if (dlg(i,kk)> -negadq*dp(i,k)/dp(i,kk)) then - dsdt(i,k) = dsdt(i,k) + negadq*rl/cpres - loc_conv%dnl(i,kk) = loc_conv%dnl(i,kk)*(1._r8+negadq*dp(i,k)/dp(i,kk)/dlg(i,kk)) - dlg(i,kk) = dlg(i,kk)+negadq*dp(i,k)/dp(i,kk) - negadq = 0._r8 - else - negadq = negadq + dlg(i,kk)*dp(i,kk)/dp(i,k) - dsdt(i,k) = dsdt(i,k) - dlg(i,kk)*dp(i,kk)/dp(i,k)*rl/cpres - dlg(i,kk) = 0._r8 - loc_conv%dnl(i,kk) = 0._r8 - end if - end if - - end if - end do - - if (negadq<0._r8) then - dqdt(i,k) = dqdt(i,k) + negadq - end if - - end if - end do - end do - end if - - do k = msg + 1,pver - do i = 1,lengath -! -! q is updated to compute net precip. -! - q(ideep(i),k) = qh(ideep(i),k) + 2._r8*delt*dqdt(i,k) - qtnd(ideep(i),k) = dqdt (i,k) - cme (ideep(i),k) = cmeg (i,k) - rprd(ideep(i),k) = rprdg(i,k) - zdu (ideep(i),k) = du (i,k) - mcon(ideep(i),k) = mc (i,k) - heat(ideep(i),k) = dsdt (i,k)*cpres - dlf (ideep(i),k) = dlg (i,k) - pflx(ideep(i),k) = pflxg(i,k) - ql (ideep(i),k) = qlg (i,k) - end do - end do - - if (zmconv_microp) then - do k = msg + 1,pver - do i = 1,lengath - dif (ideep(i),k) = loc_conv%di (i,k) - dnlf(ideep(i),k) = loc_conv%dnl (i,k) - dnif(ideep(i),k) = loc_conv%dni (i,k) - - conv%qi (ideep(i),k) = loc_conv%qice(i,k) - conv%frz(ideep(i),k) = loc_conv%frz(i,k)*latice/cpres - conv%sprd(ideep(i),k) = loc_conv%sprd(i,k) - conv%wu (ideep(i),k) = loc_conv%wu (i,k) - conv%qliq(ideep(i),k) = loc_conv%qliq (i,k) - conv%qice(ideep(i),k) = loc_conv%qice (i,k) - conv%qrain(ideep(i),k) = loc_conv%qrain (i,k) - conv%qsnow(ideep(i),k) = loc_conv%qsnow (i,k) - conv%qnl(ideep(i),k) = loc_conv%qnl(i,k) - conv%qni(ideep(i),k) = loc_conv%qni(i,k) - conv%qnr(ideep(i),k) = loc_conv%qnr(i,k) - conv%qns(ideep(i),k) = loc_conv%qns(i,k) - - conv%autolm(ideep(i),k) = loc_conv%autolm(i,k) - conv%accrlm(ideep(i),k) = loc_conv%accrlm(i,k) - conv%bergnm(ideep(i),k) = loc_conv%bergnm(i,k) - conv%fhtimm(ideep(i),k) = loc_conv%fhtimm(i,k) - conv%fhtctm(ideep(i),k) = loc_conv%fhtctm(i,k) - conv%fhmlm (ideep(i),k) = loc_conv%fhmlm (i,k) - conv%hmpim (ideep(i),k) = loc_conv%hmpim (i,k) - conv%accslm(ideep(i),k) = loc_conv%accslm(i,k) - conv%dlfm (ideep(i),k) = loc_conv%dlfm (i,k) - - conv%autoln(ideep(i),k) = loc_conv%autoln(i,k) - conv%accrln(ideep(i),k) = loc_conv%accrln(i,k) - conv%bergnn(ideep(i),k) = loc_conv%bergnn(i,k) - conv%fhtimn(ideep(i),k) = loc_conv%fhtimn(i,k) - conv%fhtctn(ideep(i),k) = loc_conv%fhtctn(i,k) - conv%fhmln (ideep(i),k) = loc_conv%fhmln (i,k) - conv%accsln(ideep(i),k) = loc_conv%accsln(i,k) - conv%activn(ideep(i),k) = loc_conv%activn(i,k) - conv%dlfn (ideep(i),k) = loc_conv%dlfn (i,k) - conv%cmel (ideep(i),k) = loc_conv%cmel (i,k) - - conv%autoim(ideep(i),k) = loc_conv%autoim(i,k) - conv%accsim(ideep(i),k) = loc_conv%accsim(i,k) - conv%difm (ideep(i),k) = loc_conv%difm (i,k) - conv%cmei (ideep(i),k) = loc_conv%cmei (i,k) - - conv%nuclin(ideep(i),k) = loc_conv%nuclin(i,k) - conv%autoin(ideep(i),k) = loc_conv%autoin(i,k) - conv%accsin(ideep(i),k) = loc_conv%accsin(i,k) - conv%hmpin (ideep(i),k) = loc_conv%hmpin (i,k) - conv%difn (ideep(i),k) = loc_conv%difn (i,k) - - conv%trspcm(ideep(i),k) = loc_conv%trspcm(i,k) - conv%trspcn(ideep(i),k) = loc_conv%trspcn(i,k) - conv%trspim(ideep(i),k) = loc_conv%trspim(i,k) - conv%trspin(ideep(i),k) = loc_conv%trspin(i,k) - conv%lambdadpcu(ideep(i),k) = loc_conv%lambdadpcu(i,k) - conv%mudpcu(ideep(i),k) = loc_conv%mudpcu(i,k) - - end do - end do - - do k = msg + 1,pver - do i = 1,ncol - - !convert it from units of "kg/kg" to "g/m3" - - if(k.lt.pver) then - conv%qice (i,k) = 0.5_r8*(conv%qice(i,k)+conv%qice(i,k+1)) - conv%qliq (i,k) = 0.5_r8*(conv%qliq(i,k)+conv%qliq(i,k+1)) - conv%qrain (i,k) = 0.5_r8*(conv%qrain(i,k)+conv%qrain(i,k+1)) - conv%qsnow (i,k) = 0.5_r8*(conv%qsnow(i,k)+conv%qsnow(i,k+1)) - conv%qni (i,k) = 0.5_r8*(conv%qni(i,k)+conv%qni(i,k+1)) - conv%qnl (i,k) = 0.5_r8*(conv%qnl(i,k)+conv%qnl(i,k+1)) - conv%qnr (i,k) = 0.5_r8*(conv%qnr(i,k)+conv%qnr(i,k+1)) - conv%qns (i,k) = 0.5_r8*(conv%qns(i,k)+conv%qns(i,k+1)) - conv%wu(i,k) = 0.5_r8*(conv%wu(i,k)+conv%wu(i,k+1)) - end if - - if (t(i,k).gt. 273.15_r8 .and. t(i,k-1).le.273.15_r8) then - conv%qice (i,k-1) = conv%qice (i,k-1) + conv%qice (i,k) - conv%qice (i,k) = 0._r8 - conv%qni (i,k-1) = conv%qni (i,k-1) + conv%qni (i,k) - conv%qni (i,k) = 0._r8 - conv%qsnow (i,k-1) = conv%qsnow (i,k-1) + conv%qsnow (i,k) - conv%qsnow (i,k) = 0._r8 - conv%qns (i,k-1) = conv%qns (i,k-1) + conv%qns (i,k) - conv%qns (i,k) = 0._r8 - end if - - conv%qice (i,k) = conv%qice(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 - conv%qliq (i,k) = conv%qliq(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 - conv%qrain (i,k) = conv%qrain(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 - conv%qsnow (i,k) = conv%qsnow(i,k) * pap(i,k)/t(i,k)/rgas *1000._r8 - conv%qni (i,k) = conv%qni(i,k) * pap(i,k)/t(i,k)/rgas - conv%qnl (i,k) = conv%qnl(i,k) * pap(i,k)/t(i,k)/rgas - conv%qnr (i,k) = conv%qnr(i,k) * pap(i,k)/t(i,k)/rgas - conv%qns (i,k) = conv%qns(i,k) * pap(i,k)/t(i,k)/rgas - end do - end do - end if - -! - do i = 1,lengath - jctop(ideep(i)) = jt(i) - jcbot(ideep(i)) = maxg(i) - pflx(ideep(i),pverp) = pflxg(i,pverp) - end do - - if (zmconv_microp) then - do i = 1,lengath - conv%dcape(ideep(i)) = loc_conv%dcape(i) - end do - end if - -! Compute precip by integrating change in water vapor minus detrained cloud water - do k = pver,msg + 1,-1 - do i = 1,ncol - prec(i) = prec(i) - dpp(i,k)* (q(i,k)-qh(i,k)) - dpp(i,k)*(dlf(i,k)+dif(i,k))*2._r8*delt - end do - end do - -! obtain final precipitation rate in m/s. - do i = 1,ncol - prec(i) = rgrav*max(prec(i),0._r8)/ (2._r8*delt)/1000._r8 - end do - -! Compute reserved liquid (not yet in cldliq) for energy integrals. -! Treat rliq as flux out bottom, to be added back later. - do k = 1, pver - do i = 1, ncol - rliq(i) = rliq(i) + (dlf(i,k)+dif(i,k))*dpp(i,k)/gravit - rice(i) = rice(i) + dif(i,k)*dpp(i,k)/gravit - end do - end do - rliq(:ncol) = rliq(:ncol) /1000._r8 - rice(:ncol) = rice(:ncol) /1000._r8 - - if (zmconv_microp) then - deallocate( & - loc_conv%frz, & - loc_conv%sprd, & - loc_conv%wu, & - loc_conv%qi, & - loc_conv%qliq, & - loc_conv%qice, & - loc_conv%qrain, & - loc_conv%qsnow, & - loc_conv%di, & - loc_conv%dnl, & - loc_conv%dni, & - loc_conv%qnl, & - loc_conv%qni, & - loc_conv%qnr, & - loc_conv%qns, & - loc_conv%qide, & - loc_conv%qncde, & - loc_conv%qnide, & - loc_conv%autolm, & - loc_conv%accrlm, & - loc_conv%bergnm, & - loc_conv%fhtimm, & - loc_conv%fhtctm, & - loc_conv%fhmlm, & - loc_conv%hmpim, & - loc_conv%accslm, & - loc_conv%dlfm, & - loc_conv%cmel, & - loc_conv%autoln, & - loc_conv%accrln, & - loc_conv%bergnn, & - loc_conv%fhtimn, & - loc_conv%fhtctn, & - loc_conv%fhmln, & - loc_conv%accsln, & - loc_conv%activn, & - loc_conv%dlfn, & - loc_conv%autoim, & - loc_conv%accsim, & - loc_conv%difm, & - loc_conv%cmei, & - loc_conv%nuclin, & - loc_conv%autoin, & - loc_conv%accsin, & - loc_conv%hmpin, & - loc_conv%difn, & - loc_conv%trspcm, & - loc_conv%trspcn, & - loc_conv%trspim, & - loc_conv%trspin, & - loc_conv%lambdadpcu, & - loc_conv%mudpcu, & - loc_conv%dcape ) - end if - - return -end subroutine zm_convr - -!=============================================================================== -subroutine zm_conv_evap(ncol,lchnk, & - t,pmid,pdel,q, & - landfrac, & - tend_s, tend_s_snwprd, tend_s_snwevmlt, tend_q, & - prdprec, cldfrc, deltat, & - prec, snow, ntprprd, ntsnprd, flxprec, flxsnow, prdsnow) - - -!----------------------------------------------------------------------- -! Compute tendencies due to evaporation of rain from ZM scheme -!-- -! Compute the total precipitation and snow fluxes at the surface. -! Add in the latent heat of fusion for snow formation and melt, since it not dealt with -! in the Zhang-MacFarlane parameterization. -! Evaporate some of the precip directly into the environment using a Sundqvist type algorithm -!----------------------------------------------------------------------- - - use wv_saturation, only: qsat - use phys_grid, only: get_rlat_all_p - -!------------------------------Arguments-------------------------------- - integer,intent(in) :: ncol, lchnk ! number of columns and chunk index - real(r8),intent(in), dimension(pcols,pver) :: t ! temperature (K) - real(r8),intent(in), dimension(pcols,pver) :: pmid ! midpoint pressure (Pa) - real(r8),intent(in), dimension(pcols,pver) :: pdel ! layer thickness (Pa) - real(r8),intent(in), dimension(pcols,pver) :: q ! water vapor (kg/kg) - real(r8),intent(in), dimension(pcols) :: landfrac - real(r8),intent(inout), dimension(pcols,pver) :: tend_s ! heating rate (J/kg/s) - real(r8),intent(inout), dimension(pcols,pver) :: tend_q ! water vapor tendency (kg/kg/s) - real(r8),intent(out ), dimension(pcols,pver) :: tend_s_snwprd ! Heating rate of snow production - real(r8),intent(out ), dimension(pcols,pver) :: tend_s_snwevmlt ! Heating rate of evap/melting of snow - - - - real(r8), intent(in ) :: prdprec(pcols,pver)! precipitation production (kg/ks/s) - real(r8), intent(in ) :: cldfrc(pcols,pver) ! cloud fraction - real(r8), intent(in ) :: deltat ! time step - - real(r8), intent(inout) :: prec(pcols) ! Convective-scale preciptn rate - real(r8), intent(out) :: snow(pcols) ! Convective-scale snowfall rate - - real(r8), optional, intent(in), allocatable :: prdsnow(:,:) ! snow production (kg/ks/s) - -! -!---------------------------Local storage------------------------------- - - real(r8) :: es (pcols,pver) ! Saturation vapor pressure - real(r8) :: fice (pcols,pver) ! ice fraction in precip production - real(r8) :: fsnow_conv(pcols,pver) ! snow fraction in precip production - real(r8) :: qs (pcols,pver) ! saturation specific humidity - real(r8),intent(out) :: flxprec(pcols,pverp) ! Convective-scale flux of precip at interfaces (kg/m2/s) - real(r8),intent(out) :: flxsnow(pcols,pverp) ! Convective-scale flux of snow at interfaces (kg/m2/s) - real(r8),intent(out) :: ntprprd(pcols,pver) ! net precip production in layer - real(r8),intent(out) :: ntsnprd(pcols,pver) ! net snow production in layer - real(r8) :: work1 ! temp variable (pjr) - real(r8) :: work2 ! temp variable (pjr) - - real(r8) :: evpvint(pcols) ! vertical integral of evaporation - real(r8) :: evpprec(pcols) ! evaporation of precipitation (kg/kg/s) - real(r8) :: evpsnow(pcols) ! evaporation of snowfall (kg/kg/s) - real(r8) :: snowmlt(pcols) ! snow melt tendency in layer - real(r8) :: flxsntm(pcols) ! flux of snow into layer, after melting - - real(r8) :: kemask - real(r8) :: evplimit ! temp variable for evaporation limits - real(r8) :: rlat(pcols) - real(r8) :: dum - real(r8) :: omsm - - integer :: i,k ! longitude,level indices - logical :: old_snow - - -!----------------------------------------------------------------------- - - ! If prdsnow is passed in and allocated, then use it in the calculation, otherwise - ! use the old snow calculation - old_snow=.true. - if (present(prdsnow)) then - if (allocated(prdsnow)) then - old_snow=.false. - end if - end if - -! convert input precip to kg/m2/s - prec(:ncol) = prec(:ncol)*1000._r8 - -! determine saturation vapor pressure - - do k = 1,pver -!+++ARH - !call qsat(t(1:ncol,k), pmid(1:ncol,k), es(1:ncol,k), qs(1:ncol,k), ncol) - call qsat(t(1:ncol,k), pmid(1:ncol,k), es(1:ncol,k), qs(1:ncol,k)) -!---ARH - end do - -! determine ice fraction in rain production (use cloud water parameterization fraction at present) - call cldfrc_fice(ncol, t, fice, fsnow_conv) - -! zero the flux integrals on the top boundary - flxprec(:ncol,1) = 0._r8 - flxsnow(:ncol,1) = 0._r8 - evpvint(:ncol) = 0._r8 - omsm=0.9999_r8 - - do k = 1, pver - do i = 1, ncol - -! Melt snow falling into layer, if necessary. - if( old_snow ) then - if (t(i,k) > tmelt) then - flxsntm(i) = 0._r8 - snowmlt(i) = flxsnow(i,k) * gravit/ pdel(i,k) - else - flxsntm(i) = flxsnow(i,k) - snowmlt(i) = 0._r8 - end if - else - ! make sure melting snow doesn't reduce temperature below threshold - if (t(i,k) > tmelt) then - dum = -latice/cpres*flxsnow(i,k)*gravit/pdel(i,k)*deltat - if (t(i,k) + dum .le. tmelt) then - dum = (t(i,k)-tmelt)*cpres/latice/deltat - dum = dum/(flxsnow(i,k)*gravit/pdel(i,k)) - dum = max(0._r8,dum) - dum = min(1._r8,dum) - else - dum = 1._r8 - end if - dum = dum*omsm - flxsntm(i) = flxsnow(i,k)*(1.0_r8-dum) - snowmlt(i) = dum*flxsnow(i,k)*gravit/ pdel(i,k) - else - flxsntm(i) = flxsnow(i,k) - snowmlt(i) = 0._r8 - end if - end if - -! relative humidity depression must be > 0 for evaporation - evplimit = max(1._r8 - q(i,k)/qs(i,k), 0._r8) - - if (zm_org) then - kemask = ke * (1._r8 - landfrac(i)) + ke_lnd * landfrac(i) - else - kemask = ke - endif - -! total evaporation depends on flux in the top of the layer -! flux prec is the net production above layer minus evaporation into environmet - evpprec(i) = kemask * (1._r8 - cldfrc(i,k)) * evplimit * sqrt(flxprec(i,k)) -!********************************************************** -!! evpprec(i) = 0. ! turn off evaporation for now -!********************************************************** - -! Don't let evaporation supersaturate layer (approx). Layer may already be saturated. -! Currently does not include heating/cooling change to qs - evplimit = max(0._r8, (qs(i,k)-q(i,k)) / deltat) - -! Don't evaporate more than is falling into the layer - do not evaporate rain formed -! in this layer but if precip production is negative, remove from the available precip -! Negative precip production occurs because of evaporation in downdrafts. -!!$ evplimit = flxprec(i,k) * gravit / pdel(i,k) + min(prdprec(i,k), 0.) - evplimit = min(evplimit, flxprec(i,k) * gravit / pdel(i,k)) - -! Total evaporation cannot exceed input precipitation - evplimit = min(evplimit, (prec(i) - evpvint(i)) * gravit / pdel(i,k)) - - evpprec(i) = min(evplimit, evpprec(i)) - if( .not.old_snow ) then - evpprec(i) = max(0._r8, evpprec(i)) - evpprec(i) = evpprec(i)*omsm - end if - - -! evaporation of snow depends on snow fraction of total precipitation in the top after melting - if (flxprec(i,k) > 0._r8) then -! evpsnow(i) = evpprec(i) * flxsntm(i) / flxprec(i,k) -! prevent roundoff problems - work1 = min(max(0._r8,flxsntm(i)/flxprec(i,k)),1._r8) - evpsnow(i) = evpprec(i) * work1 - else - evpsnow(i) = 0._r8 - end if - -! vertically integrated evaporation - evpvint(i) = evpvint(i) + evpprec(i) * pdel(i,k)/gravit - -! net precip production is production - evaporation - ntprprd(i,k) = prdprec(i,k) - evpprec(i) -! net snow production is precip production * ice fraction - evaporation - melting -!pjrworks ntsnprd(i,k) = prdprec(i,k)*fice(i,k) - evpsnow(i) - snowmlt(i) -!pjrwrks2 ntsnprd(i,k) = prdprec(i,k)*fsnow_conv(i,k) - evpsnow(i) - snowmlt(i) -! the small amount added to flxprec in the work1 expression has been increased from -! 1e-36 to 8.64e-11 (1e-5 mm/day). This causes the temperature based partitioning -! scheme to be used for small flxprec amounts. This is to address error growth problems. - - if( old_snow ) then -#ifdef PERGRO - work1 = min(max(0._r8,flxsnow(i,k)/(flxprec(i,k)+8.64e-11_r8)),1._r8) -#else - if (flxprec(i,k).gt.0._r8) then - work1 = min(max(0._r8,flxsnow(i,k)/flxprec(i,k)),1._r8) - else - work1 = 0._r8 - endif -#endif - work2 = max(fsnow_conv(i,k), work1) - if (snowmlt(i).gt.0._r8) work2 = 0._r8 -! work2 = fsnow_conv(i,k) - ntsnprd(i,k) = prdprec(i,k)*work2 - evpsnow(i) - snowmlt(i) - tend_s_snwprd (i,k) = prdprec(i,k)*work2*latice - tend_s_snwevmlt(i,k) = - ( evpsnow(i) + snowmlt(i) )*latice - else - ntsnprd(i,k) = prdsnow(i,k) - min(flxsnow(i,k)*gravit/pdel(i,k), evpsnow(i)+snowmlt(i)) - tend_s_snwprd (i,k) = prdsnow(i,k)*latice - tend_s_snwevmlt(i,k) = -min(flxsnow(i,k)*gravit/pdel(i,k), evpsnow(i)+snowmlt(i) )*latice - end if - -! precipitation fluxes - flxprec(i,k+1) = flxprec(i,k) + ntprprd(i,k) * pdel(i,k)/gravit - flxsnow(i,k+1) = flxsnow(i,k) + ntsnprd(i,k) * pdel(i,k)/gravit - -! protect against rounding error - flxprec(i,k+1) = max(flxprec(i,k+1), 0._r8) - flxsnow(i,k+1) = max(flxsnow(i,k+1), 0._r8) -! more protection (pjr) -! flxsnow(i,k+1) = min(flxsnow(i,k+1), flxprec(i,k+1)) - -! heating (cooling) and moistening due to evaporation -! - latent heat of vaporization for precip production has already been accounted for -! - snow is contained in prec - if( old_snow ) then - tend_s(i,k) =-evpprec(i)*latvap + ntsnprd(i,k)*latice - else - tend_s(i,k) =-evpprec(i)*latvap + tend_s_snwevmlt(i,k) - end if - tend_q(i,k) = evpprec(i) - end do - end do - -! set output precipitation rates (m/s) - prec(:ncol) = flxprec(:ncol,pver+1) / 1000._r8 - snow(:ncol) = flxsnow(:ncol,pver+1) / 1000._r8 - -!********************************************************** -!!$ tend_s(:ncol,:) = 0. ! turn heating off -!********************************************************** - - end subroutine zm_conv_evap - - - -subroutine convtran(lchnk , & - doconvtran,q ,ncnst ,mu ,md , & - du ,eu ,ed ,dp ,dsubcld , & - jt ,mx ,ideep ,il1g ,il2g , & - nstep ,fracis ,dqdt ,dpdry ,dt) -!----------------------------------------------------------------------- -! -! Purpose: -! Convective transport of trace species -! -! Mixing ratios may be with respect to either dry or moist air -! -! Method: -! -! -! -! Author: P. Rasch -! -!----------------------------------------------------------------------- - use shr_kind_mod, only: r8 => shr_kind_r8 - use constituents, only: cnst_get_type_byind - use ppgrid - - implicit none -!----------------------------------------------------------------------- -! -! Input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncnst ! number of tracers to transport - logical, intent(in) :: doconvtran(ncnst) ! flag for doing convective transport - real(r8), intent(in) :: q(pcols,pver,ncnst) ! Tracer array including moisture - real(r8), intent(in) :: mu(pcols,pver) ! Mass flux up - real(r8), intent(in) :: md(pcols,pver) ! Mass flux down - real(r8), intent(in) :: du(pcols,pver) ! Mass detraining from updraft - real(r8), intent(in) :: eu(pcols,pver) ! Mass entraining from updraft - real(r8), intent(in) :: ed(pcols,pver) ! Mass entraining from downdraft - real(r8), intent(in) :: dp(pcols,pver) ! Delta pressure between interfaces - real(r8), intent(in) :: dsubcld(pcols) ! Delta pressure from cloud base to sfc - real(r8), intent(in) :: fracis(pcols,pver,ncnst) ! fraction of tracer that is insoluble - - integer, intent(in) :: jt(pcols) ! Index of cloud top for each column - integer, intent(in) :: mx(pcols) ! Index of cloud top for each column - integer, intent(in) :: ideep(pcols) ! Gathering array - integer, intent(in) :: il1g ! Gathered min lon indices over which to operate - integer, intent(in) :: il2g ! Gathered max lon indices over which to operate - integer, intent(in) :: nstep ! Time step index - - real(r8), intent(in) :: dpdry(pcols,pver) ! Delta pressure between interfaces - - real(r8), intent(in) :: dt ! 2 delta t (model time increment) - -! input/output - - real(r8), intent(out) :: dqdt(pcols,pver,ncnst) ! Tracer tendency array - -!--------------------------Local Variables------------------------------ - - integer i ! Work index - integer k ! Work index - integer kbm ! Highest altitude index of cloud base - integer kk ! Work index - integer kkp1 ! Work index - integer km1 ! Work index - integer kp1 ! Work index - integer ktm ! Highest altitude index of cloud top - integer m ! Work index - - real(r8) cabv ! Mix ratio of constituent above - real(r8) cbel ! Mix ratio of constituent below - real(r8) cdifr ! Normalized diff between cabv and cbel - real(r8) chat(pcols,pver) ! Mix ratio in env at interfaces - real(r8) cond(pcols,pver) ! Mix ratio in downdraft at interfaces - real(r8) const(pcols,pver) ! Gathered tracer array - real(r8) fisg(pcols,pver) ! gathered insoluble fraction of tracer - real(r8) conu(pcols,pver) ! Mix ratio in updraft at interfaces - real(r8) dcondt(pcols,pver) ! Gathered tend array - real(r8) small ! A small number - real(r8) mbsth ! Threshold for mass fluxes - real(r8) mupdudp ! A work variable - real(r8) minc ! A work variable - real(r8) maxc ! A work variable - real(r8) fluxin ! A work variable - real(r8) fluxout ! A work variable - real(r8) netflux ! A work variable - - real(r8) dutmp(pcols,pver) ! Mass detraining from updraft - real(r8) eutmp(pcols,pver) ! Mass entraining from updraft - real(r8) edtmp(pcols,pver) ! Mass entraining from downdraft - real(r8) dptmp(pcols,pver) ! Delta pressure between interfaces - real(r8) total(pcols) - real(r8) negadt,qtmp - -!----------------------------------------------------------------------- -! - small = 1.e-36_r8 -! mbsth is the threshold below which we treat the mass fluxes as zero (in mb/s) - mbsth = 1.e-15_r8 - -! Find the highest level top and bottom levels of convection - ktm = pver - kbm = pver - do i = il1g, il2g - ktm = min(ktm,jt(i)) - kbm = min(kbm,mx(i)) - end do - -! Loop ever each constituent - do m = 2, ncnst - if (doconvtran(m)) then - - if (cnst_get_type_byind(m).eq.'dry') then - do k = 1,pver - do i =il1g,il2g - dptmp(i,k) = dpdry(i,k) - dutmp(i,k) = du(i,k)*dp(i,k)/dpdry(i,k) - eutmp(i,k) = eu(i,k)*dp(i,k)/dpdry(i,k) - edtmp(i,k) = ed(i,k)*dp(i,k)/dpdry(i,k) - end do - end do - else - do k = 1,pver - do i =il1g,il2g - dptmp(i,k) = dp(i,k) - dutmp(i,k) = du(i,k) - eutmp(i,k) = eu(i,k) - edtmp(i,k) = ed(i,k) - end do - end do - endif -! dptmp = dp - -! Gather up the constituent and set tend to zero - do k = 1,pver - do i =il1g,il2g - const(i,k) = q(ideep(i),k,m) - fisg(i,k) = fracis(ideep(i),k,m) - end do - end do - -! From now on work only with gathered data - -! Interpolate environment tracer values to interfaces - do k = 1,pver - km1 = max(1,k-1) - do i = il1g, il2g - minc = min(const(i,km1),const(i,k)) - maxc = max(const(i,km1),const(i,k)) - if (minc < 0) then - cdifr = 0._r8 - else - cdifr = abs(const(i,k)-const(i,km1))/max(maxc,small) - endif - -! If the two layers differ significantly use a geometric averaging -! procedure - if (cdifr > 1.E-6_r8) then - cabv = max(const(i,km1),maxc*1.e-12_r8) - cbel = max(const(i,k),maxc*1.e-12_r8) - chat(i,k) = log(cabv/cbel)/(cabv-cbel)*cabv*cbel - - else ! Small diff, so just arithmetic mean - chat(i,k) = 0.5_r8* (const(i,k)+const(i,km1)) - end if - -! Provisional up and down draft values - conu(i,k) = chat(i,k) - cond(i,k) = chat(i,k) - -! provisional tends - dcondt(i,k) = 0._r8 - - end do - end do - -! Do levels adjacent to top and bottom - k = 2 - km1 = 1 - kk = pver - do i = il1g,il2g - mupdudp = mu(i,kk) + dutmp(i,kk)*dptmp(i,kk) - if (mupdudp > mbsth) then - conu(i,kk) = (+eutmp(i,kk)*fisg(i,kk)*const(i,kk)*dptmp(i,kk))/mupdudp - endif - if (md(i,k) < -mbsth) then - cond(i,k) = (-edtmp(i,km1)*fisg(i,km1)*const(i,km1)*dptmp(i,km1))/md(i,k) - endif - end do - -! Updraft from bottom to top - do kk = pver-1,1,-1 - kkp1 = min(pver,kk+1) - do i = il1g,il2g - mupdudp = mu(i,kk) + dutmp(i,kk)*dptmp(i,kk) - if (mupdudp > mbsth) then - conu(i,kk) = ( mu(i,kkp1)*conu(i,kkp1)+eutmp(i,kk)*fisg(i,kk)* & - const(i,kk)*dptmp(i,kk) )/mupdudp - endif - end do - end do - -! Downdraft from top to bottom - do k = 3,pver - km1 = max(1,k-1) - do i = il1g,il2g - if (md(i,k) < -mbsth) then - cond(i,k) = ( md(i,km1)*cond(i,km1)-edtmp(i,km1)*fisg(i,km1)*const(i,km1) & - *dptmp(i,km1) )/md(i,k) - endif - end do - end do - - - do k = ktm,pver - km1 = max(1,k-1) - kp1 = min(pver,k+1) - do i = il1g,il2g - -! version 1 hard to check for roundoff errors -! dcondt(i,k) = -! $ +(+mu(i,kp1)* (conu(i,kp1)-chat(i,kp1)) -! $ -mu(i,k)* (conu(i,k)-chat(i,k)) -! $ +md(i,kp1)* (cond(i,kp1)-chat(i,kp1)) -! $ -md(i,k)* (cond(i,k)-chat(i,k)) -! $ )/dp(i,k) - -! version 2 hard to limit fluxes -! fluxin = mu(i,kp1)*conu(i,kp1) + mu(i,k)*chat(i,k) -! $ -(md(i,k) *cond(i,k) + md(i,kp1)*chat(i,kp1)) -! fluxout = mu(i,k)*conu(i,k) + mu(i,kp1)*chat(i,kp1) -! $ -(md(i,kp1)*cond(i,kp1) + md(i,k)*chat(i,k)) - -! version 3 limit fluxes outside convection to mass in appropriate layer -! these limiters are probably only safe for positive definite quantitities -! it assumes that mu and md already satify a courant number limit of 1 - fluxin = mu(i,kp1)*conu(i,kp1)+ mu(i,k)*min(chat(i,k),const(i,km1)) & - -(md(i,k) *cond(i,k) + md(i,kp1)*min(chat(i,kp1),const(i,kp1))) - fluxout = mu(i,k)*conu(i,k) + mu(i,kp1)*min(chat(i,kp1),const(i,k)) & - -(md(i,kp1)*cond(i,kp1) + md(i,k)*min(chat(i,k),const(i,k))) - - netflux = fluxin - fluxout - if (abs(netflux) < max(fluxin,fluxout)*1.e-12_r8) then - netflux = 0._r8 - endif - dcondt(i,k) = netflux/dptmp(i,k) - end do - end do -! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -! - do k = kbm,pver - km1 = max(1,k-1) - do i = il1g,il2g - if (k == mx(i)) then - -! version 1 -! dcondt(i,k) = (1./dsubcld(i))* -! $ (-mu(i,k)*(conu(i,k)-chat(i,k)) -! $ -md(i,k)*(cond(i,k)-chat(i,k)) -! $ ) - -! version 2 -! fluxin = mu(i,k)*chat(i,k) - md(i,k)*cond(i,k) -! fluxout = mu(i,k)*conu(i,k) - md(i,k)*chat(i,k) -! version 3 - fluxin = mu(i,k)*min(chat(i,k),const(i,km1)) - md(i,k)*cond(i,k) - fluxout = mu(i,k)*conu(i,k) - md(i,k)*min(chat(i,k),const(i,k)) - - netflux = fluxin - fluxout - if (abs(netflux) < max(fluxin,fluxout)*1.e-12_r8) then - netflux = 0._r8 - endif -! dcondt(i,k) = netflux/dsubcld(i) - dcondt(i,k) = netflux/dptmp(i,k) - else if (k > mx(i)) then -! dcondt(i,k) = dcondt(i,k-1) - dcondt(i,k) = 0._r8 - end if - end do - end do - - if (zmconv_microp) then - do i = il1g,il2g - do k = jt(i),mx(i) - if (dcondt(i,k)*dt+const(i,k)<0._r8) then - negadt = dcondt(i,k)+const(i,k)/dt - dcondt(i,k) = -const(i,k)/dt - do kk= k+1, mx(i) - if (negadt<0._r8 .and. dcondt(i,kk)*dt+const(i,kk)>0._r8 ) then - qtmp = dcondt(i,kk)+negadt*dptmp(i,k)/dptmp(i,kk) - if (qtmp*dt+const(i,kk)>0._r8) then - dcondt(i,kk)= qtmp - negadt=0._r8 - else - negadt= negadt+(const(i,kk)/dt+dcondt(i,kk))*dptmp(i,kk)/dptmp(i,k) - dcondt(i,kk)= -const(i,kk)/dt - end if - - end if - end do - do kk= k-1, jt(i), -1 - if (negadt<0._r8 .and. dcondt(i,kk)*dt+const(i,kk)>0._r8 ) then - qtmp = dcondt(i,kk)+negadt*dptmp(i,k)/dptmp(i,kk) - if (qtmp*dt+const(i,kk)>0._r8) then - dcondt(i,kk)= qtmp - negadt=0._r8 - else - negadt= negadt+(const(i,kk)/dt+dcondt(i,kk))*dptmp(i,kk)/dptmp(i,k) - dcondt(i,kk)= -const(i,kk)/dt - end if - end if - end do - - if (negadt<0._r8) then - dcondt(i,k) = dcondt(i,k) + negadt - end if - end if - end do - end do - end if - - -! Initialize to zero everywhere, then scatter tendency back to full array - dqdt(:,:,m) = 0._r8 - do k = 1,pver - kp1 = min(pver,k+1) - do i = il1g,il2g - dqdt(ideep(i),k,m) = dcondt(i,k) - end do - end do - - end if ! for doconvtran - - end do - - return -end subroutine convtran - -!========================================================================================= - -subroutine momtran(lchnk, ncol, & - domomtran,q ,ncnst ,mu ,md , & - du ,eu ,ed ,dp ,dsubcld , & - jt ,mx ,ideep ,il1g ,il2g , & - nstep ,dqdt ,pguall ,pgdall, icwu, icwd, dt, seten ) -!----------------------------------------------------------------------- -! -! Purpose: -! Convective transport of momentum -! -! Mixing ratios may be with respect to either dry or moist air -! -! Method: -! Based on the convtran subroutine by P. Rasch -! -! -! Author: J. Richter and P. Rasch -! -!----------------------------------------------------------------------- - use shr_kind_mod, only: r8 => shr_kind_r8 - use constituents, only: cnst_get_type_byind - use ppgrid - - implicit none -!----------------------------------------------------------------------- -! -! Input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns - integer, intent(in) :: ncnst ! number of tracers to transport - logical, intent(in) :: domomtran(ncnst) ! flag for doing convective transport - real(r8), intent(in) :: q(pcols,pver,ncnst) ! Wind array - real(r8), intent(in) :: mu(pcols,pver) ! Mass flux up - real(r8), intent(in) :: md(pcols,pver) ! Mass flux down - real(r8), intent(in) :: du(pcols,pver) ! Mass detraining from updraft - real(r8), intent(in) :: eu(pcols,pver) ! Mass entraining from updraft - real(r8), intent(in) :: ed(pcols,pver) ! Mass entraining from downdraft - real(r8), intent(in) :: dp(pcols,pver) ! Delta pressure between interfaces - real(r8), intent(in) :: dsubcld(pcols) ! Delta pressure from cloud base to sfc - real(r8), intent(in) :: dt ! time step in seconds : 2*delta_t - - integer, intent(in) :: jt(pcols) ! Index of cloud top for each column - integer, intent(in) :: mx(pcols) ! Index of cloud top for each column - integer, intent(in) :: ideep(pcols) ! Gathering array - integer, intent(in) :: il1g ! Gathered min lon indices over which to operate - integer, intent(in) :: il2g ! Gathered max lon indices over which to operate - integer, intent(in) :: nstep ! Time step index - - - -! input/output - - real(r8), intent(out) :: dqdt(pcols,pver,ncnst) ! Tracer tendency array - -!--------------------------Local Variables------------------------------ - - integer i ! Work index - integer k ! Work index - integer kbm ! Highest altitude index of cloud base - integer kk ! Work index - integer kkp1 ! Work index - integer kkm1 ! Work index - integer km1 ! Work index - integer kp1 ! Work index - integer ktm ! Highest altitude index of cloud top - integer m ! Work index - integer ii ! Work index - - real(r8) cabv ! Mix ratio of constituent above - real(r8) cbel ! Mix ratio of constituent below - real(r8) cdifr ! Normalized diff between cabv and cbel - real(r8) chat(pcols,pver) ! Mix ratio in env at interfaces - real(r8) cond(pcols,pver) ! Mix ratio in downdraft at interfaces - real(r8) const(pcols,pver) ! Gathered wind array - real(r8) conu(pcols,pver) ! Mix ratio in updraft at interfaces - real(r8) dcondt(pcols,pver) ! Gathered tend array - real(r8) mbsth ! Threshold for mass fluxes - real(r8) mupdudp ! A work variable - real(r8) minc ! A work variable - real(r8) maxc ! A work variable - real(r8) fluxin ! A work variable - real(r8) fluxout ! A work variable - real(r8) netflux ! A work variable - - real(r8) sum ! sum - real(r8) sum2 ! sum2 - - real(r8) mududp(pcols,pver) ! working variable - real(r8) mddudp(pcols,pver) ! working variable - - real(r8) pgu(pcols,pver) ! Pressure gradient term for updraft - real(r8) pgd(pcols,pver) ! Pressure gradient term for downdraft - - real(r8),intent(out) :: pguall(pcols,pver,ncnst) ! Apparent force from updraft PG - real(r8),intent(out) :: pgdall(pcols,pver,ncnst) ! Apparent force from downdraft PG - - real(r8),intent(out) :: icwu(pcols,pver,ncnst) ! In-cloud winds in updraft - real(r8),intent(out) :: icwd(pcols,pver,ncnst) ! In-cloud winds in downdraft - - real(r8),intent(out) :: seten(pcols,pver) ! Dry static energy tendency - real(r8) gseten(pcols,pver) ! Gathered dry static energy tendency - - real(r8) mflux(pcols,pverp,ncnst) ! Gathered momentum flux - - real(r8) wind0(pcols,pver,ncnst) ! gathered wind before time step - real(r8) windf(pcols,pver,ncnst) ! gathered wind after time step - real(r8) fkeb, fket, ketend_cons, ketend, utop, ubot, vtop, vbot, gset2 - - -!----------------------------------------------------------------------- -! - -! Initialize outgoing fields - pguall(:,:,:) = 0.0_r8 - pgdall(:,:,:) = 0.0_r8 -! Initialize in-cloud winds to environmental wind - icwu(:ncol,:,:) = q(:ncol,:,:) - icwd(:ncol,:,:) = q(:ncol,:,:) - -! Initialize momentum flux and final winds - mflux(:,:,:) = 0.0_r8 - wind0(:,:,:) = 0.0_r8 - windf(:,:,:) = 0.0_r8 - -! Initialize dry static energy - - seten(:,:) = 0.0_r8 - gseten(:,:) = 0.0_r8 - -! mbsth is the threshold below which we treat the mass fluxes as zero (in mb/s) - mbsth = 1.e-15_r8 - -! Find the highest level top and bottom levels of convection - ktm = pver - kbm = pver - do i = il1g, il2g - ktm = min(ktm,jt(i)) - kbm = min(kbm,mx(i)) - end do - -! Loop ever each wind component - do m = 1, ncnst !start at m = 1 to transport momentum - if (domomtran(m)) then - -! Gather up the winds and set tend to zero - do k = 1,pver - do i =il1g,il2g - const(i,k) = q(ideep(i),k,m) - wind0(i,k,m) = const(i,k) - end do - end do - - -! From now on work only with gathered data - -! Interpolate winds to interfaces - - do k = 1,pver - km1 = max(1,k-1) - do i = il1g, il2g - - ! use arithmetic mean - chat(i,k) = 0.5_r8* (const(i,k)+const(i,km1)) - -! Provisional up and down draft values - conu(i,k) = chat(i,k) - cond(i,k) = chat(i,k) - -! provisional tends - dcondt(i,k) = 0._r8 - - end do - end do - - -! -! Pressure Perturbation Term -! - - !Top boundary: assume mu is zero - - k=1 - pgu(:il2g,k) = 0.0_r8 - pgd(:il2g,k) = 0.0_r8 - - do k=2,pver-1 - km1 = max(1,k-1) - kp1 = min(pver,k+1) - do i = il1g,il2g - - !interior points - - mududp(i,k) = ( mu(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) & - + mu(i,kp1) * (const(i,kp1) - const(i,k))/dp(i,k)) - - pgu(i,k) = - momcu * 0.5_r8 * mududp(i,k) - - - mddudp(i,k) = ( md(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) & - + md(i,kp1) * (const(i,kp1) - const(i,k))/dp(i,k)) - - pgd(i,k) = - momcd * 0.5_r8 * mddudp(i,k) - - - end do - end do - - ! bottom boundary - k = pver - km1 = max(1,k-1) - do i=il1g,il2g - - mududp(i,k) = mu(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) - pgu(i,k) = - momcu * mududp(i,k) - - mddudp(i,k) = md(i,k) * (const(i,k)- const(i,km1))/dp(i,km1) - - pgd(i,k) = - momcd * mddudp(i,k) - - end do - - -! -! In-cloud velocity calculations -! - -! Do levels adjacent to top and bottom - k = 2 - km1 = 1 - kk = pver - kkm1 = max(1,kk-1) - do i = il1g,il2g - mupdudp = mu(i,kk) + du(i,kk)*dp(i,kk) - if (mupdudp > mbsth) then - - conu(i,kk) = (+eu(i,kk)*const(i,kk)*dp(i,kk)+pgu(i,kk)*dp(i,kk))/mupdudp - endif - if (md(i,k) < -mbsth) then - cond(i,k) = (-ed(i,km1)*const(i,km1)*dp(i,km1))-pgd(i,km1)*dp(i,km1)/md(i,k) - endif - - - end do - - - -! Updraft from bottom to top - do kk = pver-1,1,-1 - kkm1 = max(1,kk-1) - kkp1 = min(pver,kk+1) - do i = il1g,il2g - mupdudp = mu(i,kk) + du(i,kk)*dp(i,kk) - if (mupdudp > mbsth) then - - conu(i,kk) = ( mu(i,kkp1)*conu(i,kkp1)+eu(i,kk)* & - const(i,kk)*dp(i,kk)+pgu(i,kk)*dp(i,kk))/mupdudp - endif - end do - - end do - - -! Downdraft from top to bottom - do k = 3,pver - km1 = max(1,k-1) - do i = il1g,il2g - if (md(i,k) < -mbsth) then - - cond(i,k) = ( md(i,km1)*cond(i,km1)-ed(i,km1)*const(i,km1) & - *dp(i,km1)-pgd(i,km1)*dp(i,km1) )/md(i,k) - - endif - end do - end do - - - sum = 0._r8 - sum2 = 0._r8 - - - do k = ktm,pver - km1 = max(1,k-1) - kp1 = min(pver,k+1) - do i = il1g,il2g - ii = ideep(i) - -! version 1 hard to check for roundoff errors - dcondt(i,k) = & - +(mu(i,kp1)* (conu(i,kp1)-chat(i,kp1)) & - -mu(i,k)* (conu(i,k)-chat(i,k)) & - +md(i,kp1)* (cond(i,kp1)-chat(i,kp1)) & - -md(i,k)* (cond(i,k)-chat(i,k)) & - )/dp(i,k) - - end do - end do - - ! dcont for bottom layer - ! - do k = kbm,pver - km1 = max(1,k-1) - do i = il1g,il2g - if (k == mx(i)) then - - ! version 1 - dcondt(i,k) = (1._r8/dp(i,k))* & - (-mu(i,k)*(conu(i,k)-chat(i,k)) & - -md(i,k)*(cond(i,k)-chat(i,k)) & - ) - end if - end do - end do - -! Initialize to zero everywhere, then scatter tendency back to full array - dqdt(:,:,m) = 0._r8 - - do k = 1,pver - do i = il1g,il2g - ii = ideep(i) - dqdt(ii,k,m) = dcondt(i,k) - ! Output apparent force on the mean flow from pressure gradient - pguall(ii,k,m) = -pgu(i,k) - pgdall(ii,k,m) = -pgd(i,k) - icwu(ii,k,m) = conu(i,k) - icwd(ii,k,m) = cond(i,k) - end do - end do - - ! Calculate momentum flux in units of mb*m/s2 - - do k = ktm,pver - do i = il1g,il2g - ii = ideep(i) - mflux(i,k,m) = & - -mu(i,k)* (conu(i,k)-chat(i,k)) & - -md(i,k)* (cond(i,k)-chat(i,k)) - end do - end do - - - ! Calculate winds at the end of the time step - - do k = ktm,pver - do i = il1g,il2g - ii = ideep(i) - km1 = max(1,k-1) - kp1 = k+1 - windf(i,k,m) = const(i,k) - (mflux(i,kp1,m) - mflux(i,k,m)) * dt /dp(i,k) - - end do - end do - - end if ! for domomtran - end do - - ! Need to add an energy fix to account for the dissipation of kinetic energy - ! Formulation follows from Boville and Bretherton (2003) - ! formulation by PJR - - do k = ktm,pver - km1 = max(1,k-1) - kp1 = min(pver,k+1) - do i = il1g,il2g - - ii = ideep(i) - - ! calculate the KE fluxes at top and bot of layer - ! based on a discrete approximation to b&b eq(35) F_KE = u*F_u + v*F_v at interface - utop = (wind0(i,k,1)+wind0(i,km1,1))/2._r8 - vtop = (wind0(i,k,2)+wind0(i,km1,2))/2._r8 - ubot = (wind0(i,kp1,1)+wind0(i,k,1))/2._r8 - vbot = (wind0(i,kp1,2)+wind0(i,k,2))/2._r8 - fket = utop*mflux(i,k,1) + vtop*mflux(i,k,2) ! top of layer - fkeb = ubot*mflux(i,k+1,1) + vbot*mflux(i,k+1,2) ! bot of layer - - ! divergence of these fluxes should give a conservative redistribution of KE - ketend_cons = (fket-fkeb)/dp(i,k) - - ! tendency in kinetic energy resulting from the momentum transport - ketend = ((windf(i,k,1)**2 + windf(i,k,2)**2) - (wind0(i,k,1)**2 + wind0(i,k,2)**2))*0.5_r8/dt - - ! the difference should be the dissipation - gset2 = ketend_cons - ketend - gseten(i,k) = gset2 - - end do - - end do - - ! Scatter dry static energy to full array - do k = 1,pver - do i = il1g,il2g - ii = ideep(i) - seten(ii,k) = gseten(i,k) - - end do - end do - - return -end subroutine momtran - -!========================================================================================= - -subroutine buoyan(lchnk ,ncol , & - q ,t ,p ,z ,pf , & - tp ,qstp ,tl ,rl ,cape , & - pblt ,lcl ,lel ,lon ,mx , & - rd ,grav ,cp ,msg , & - tpert ) -!----------------------------------------------------------------------- -! -! Purpose: -! -! -! Method: -! -! -! -! Author: -! This is contributed code not fully standardized by the CCM core group. -! The documentation has been enhanced to the degree that we are able. -! Reviewed: P. Rasch, April 1996 -! -!----------------------------------------------------------------------- - implicit none -!----------------------------------------------------------------------- -! -! input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: q(pcols,pver) ! spec. humidity - real(r8), intent(in) :: t(pcols,pver) ! temperature - real(r8), intent(in) :: p(pcols,pver) ! pressure - real(r8), intent(in) :: z(pcols,pver) ! height - real(r8), intent(in) :: pf(pcols,pver+1) ! pressure at interfaces - real(r8), intent(in) :: pblt(pcols) ! index of pbl depth - real(r8), intent(in) :: tpert(pcols) ! perturbation temperature by pbl processes - -! -! output arguments -! - real(r8), intent(out) :: tp(pcols,pver) ! parcel temperature - real(r8), intent(out) :: qstp(pcols,pver) ! saturation mixing ratio of parcel - real(r8), intent(out) :: tl(pcols) ! parcel temperature at lcl - real(r8), intent(out) :: cape(pcols) ! convective aval. pot. energy. - integer lcl(pcols) ! - integer lel(pcols) ! - integer lon(pcols) ! level of onset of deep convection - integer mx(pcols) ! level of max moist static energy -! -!--------------------------Local Variables------------------------------ -! - real(r8) capeten(pcols,num_cin) ! provisional value of cape - real(r8) tv(pcols,pver) ! - real(r8) tpv(pcols,pver) ! - real(r8) buoy(pcols,pver) - - real(r8) a1(pcols) - real(r8) a2(pcols) - real(r8) estp(pcols) - real(r8) pl(pcols) - real(r8) plexp(pcols) - real(r8) hmax(pcols) - real(r8) hmn(pcols) - real(r8) y(pcols) - - logical plge600(pcols) - integer knt(pcols) - integer lelten(pcols,num_cin) - - real(r8) cp - real(r8) e - real(r8) grav - - integer i - integer k - integer msg - integer n - - real(r8) rd - real(r8) rl -#ifdef PERGRO - real(r8) rhd -#endif -! -!----------------------------------------------------------------------- -! - do n = 1,num_cin - do i = 1,ncol - lelten(i,n) = pver - capeten(i,n) = 0._r8 - end do - end do -! - do i = 1,ncol - lon(i) = pver - knt(i) = 0 - lel(i) = pver - mx(i) = lon(i) - cape(i) = 0._r8 - hmax(i) = 0._r8 - end do - - tp(:ncol,:) = t(:ncol,:) - qstp(:ncol,:) = q(:ncol,:) - -!!! RBN - Initialize tv and buoy for output. -!!! tv=tv : tpv=tpv : qstp=q : buoy=0. - tv(:ncol,:) = t(:ncol,:) *(1._r8+1.608_r8*q(:ncol,:))/ (1._r8+q(:ncol,:)) - tpv(:ncol,:) = tv(:ncol,:) - buoy(:ncol,:) = 0._r8 - -! -! set "launching" level(mx) to be at maximum moist static energy. -! search for this level stops at planetary boundary layer top. -! -#ifdef PERGRO - do k = pver,msg + 1,-1 - do i = 1,ncol - hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) -! -! Reset max moist static energy level when relative difference exceeds 1.e-4 -! - rhd = (hmn(i) - hmax(i))/(hmn(i) + hmax(i)) - if (k >= nint(pblt(i)) .and. k <= lon(i) .and. rhd > -1.e-4_r8) then - hmax(i) = hmn(i) - mx(i) = k - end if - end do - end do -#else - do k = pver,msg + 1,-1 - do i = 1,ncol - hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) - if (k >= nint(pblt(i)) .and. k <= lon(i) .and. hmn(i) > hmax(i)) then - hmax(i) = hmn(i) - mx(i) = k - end if - end do - end do -#endif -! - do i = 1,ncol - lcl(i) = mx(i) - e = p(i,mx(i))*q(i,mx(i))/ (eps1+q(i,mx(i))) - tl(i) = 2840._r8/ (3.5_r8*log(t(i,mx(i)))-log(e)-4.805_r8) + 55._r8 - if (tl(i) < t(i,mx(i))) then - plexp(i) = (1._r8/ (0.2854_r8* (1._r8-0.28_r8*q(i,mx(i))))) - pl(i) = p(i,mx(i))* (tl(i)/t(i,mx(i)))**plexp(i) - else - tl(i) = t(i,mx(i)) - pl(i) = p(i,mx(i)) - end if - end do - -! -! calculate lifting condensation level (lcl). -! - do k = pver,msg + 2,-1 - do i = 1,ncol - if (k <= mx(i) .and. (p(i,k) > pl(i) .and. p(i,k-1) <= pl(i))) then - lcl(i) = k - 1 - end if - end do - end do -! -! if lcl is above the nominal level of non-divergence (600 mbs), -! no deep convection is permitted (ensuing calculations -! skipped and cape retains initialized value of zero). -! - do i = 1,ncol - plge600(i) = pl(i).ge.600._r8 - end do -! -! initialize parcel properties in sub-cloud layer below lcl. -! - do k = pver,msg + 1,-1 - do i=1,ncol - if (k > lcl(i) .and. k <= mx(i) .and. plge600(i)) then - tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) - qstp(i,k) = q(i,mx(i)) - tp(i,k) = t(i,mx(i))* (p(i,k)/p(i,mx(i)))**(0.2854_r8* (1._r8-0.28_r8*q(i,mx(i)))) -! -! buoyancy is increased by 0.5 k as in tiedtke -! -!-jjh tpv (i,k)=tp(i,k)*(1.+1.608*q(i,mx(i)))/ -!-jjh 1 (1.+q(i,mx(i))) - tpv(i,k) = (tp(i,k)+tpert(i))*(1._r8+1.608_r8*q(i,mx(i)))/ (1._r8+q(i,mx(i))) - buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add - end if - end do - end do - -! -! define parcel properties at lcl (i.e. level immediately above pl). -! - do k = pver,msg + 1,-1 - do i=1,ncol - if (k == lcl(i) .and. plge600(i)) then - tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) - qstp(i,k) = q(i,mx(i)) - tp(i,k) = tl(i)* (p(i,k)/pl(i))**(0.2854_r8* (1._r8-0.28_r8*qstp(i,k))) -! estp(i) =exp(21.656_r8 - 5418._r8/tp(i,k)) -! use of different formulas for es has about 1 g/kg difference -! in qs at t= 300k, and 0.02 g/kg at t=263k, with the formula -! above giving larger qs. - call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) - a1(i) = cp / rl + qstp(i,k) * (1._r8+ qstp(i,k) / eps1) * rl * eps1 / & - (rd * tp(i,k) ** 2) - a2(i) = .5_r8* (qstp(i,k)* (1._r8+2._r8/eps1*qstp(i,k))* & - (1._r8+qstp(i,k)/eps1)*eps1**2*rl*rl/ & - (rd**2*tp(i,k)**4)-qstp(i,k)* & - (1._r8+qstp(i,k)/eps1)*2._r8*eps1*rl/ & - (rd*tp(i,k)**3)) - a1(i) = 1._r8/a1(i) - a2(i) = -a2(i)*a1(i)**3 - y(i) = q(i,mx(i)) - qstp(i,k) - tp(i,k) = tp(i,k) + a1(i)*y(i) + a2(i)*y(i)**2 - call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) -! -! buoyancy is increased by 0.5 k in cape calculation. -! dec. 9, 1994 -!-jjh tpv(i,k) =tp(i,k)*(1.+1.608*qstp(i,k))/(1.+q(i,mx(i))) -! - tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+q(i,mx(i))) - buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add - end if - end do - end do -! -! main buoyancy calculation. -! - do k = pver - 1,msg + 1,-1 - do i=1,ncol - if (k < lcl(i) .and. plge600(i)) then - tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) - qstp(i,k) = qstp(i,k+1) - tp(i,k) = tp(i,k+1)* (p(i,k)/p(i,k+1))**(0.2854_r8* (1._r8-0.28_r8*qstp(i,k))) - call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) - a1(i) = cp/rl + qstp(i,k)* (1._r8+qstp(i,k)/eps1)*rl*eps1/ (rd*tp(i,k)**2) - a2(i) = .5_r8* (qstp(i,k)* (1._r8+2._r8/eps1*qstp(i,k))* & - (1._r8+qstp(i,k)/eps1)*eps1**2*rl*rl/ & - (rd**2*tp(i,k)**4)-qstp(i,k)* & - (1._r8+qstp(i,k)/eps1)*2._r8*eps1*rl/ & - (rd*tp(i,k)**3)) - a1(i) = 1._r8/a1(i) - a2(i) = -a2(i)*a1(i)**3 - y(i) = qstp(i,k+1) - qstp(i,k) - tp(i,k) = tp(i,k) + a1(i)*y(i) + a2(i)*y(i)**2 - call qsat_hPa(tp(i,k), p(i,k), estp(i), qstp(i,k)) -!-jjh tpv(i,k) =tp(i,k)*(1.+1.608*qstp(i,k))/ -!jt (1.+q(i,mx(i))) - tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k))/(1._r8+q(i,mx(i))) - buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add - end if - end do - end do - -! - do k = msg + 2,pver - do i = 1,ncol - if (k < lcl(i) .and. plge600(i)) then - if (buoy(i,k+1) > 0._r8 .and. buoy(i,k) <= 0._r8) then - knt(i) = min(5,knt(i) + 1) - lelten(i,knt(i)) = k - end if - end if - end do - end do -! -! calculate convective available potential energy (cape). -! - do n = 1,5 - do k = msg + 1,pver - do i = 1,ncol - if (plge600(i) .and. k <= mx(i) .and. k > lelten(i,n)) then - capeten(i,n) = capeten(i,n) + rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) - end if - end do - end do - end do -! -! find maximum cape from all possible tentative capes from -! one sounding, -! and use it as the final cape, april 26, 1995 -! - do n = 1,5 - do i = 1,ncol - if (capeten(i,n) > cape(i)) then - cape(i) = capeten(i,n) - lel(i) = lelten(i,n) - end if - end do - end do -! -! put lower bound on cape for diagnostic purposes. -! - do i = 1,ncol - cape(i) = max(cape(i), 0._r8) - end do -! - return -end subroutine buoyan - -subroutine cldprp(lchnk , & - q ,t ,u ,v ,p , & - z ,s ,mu ,eu ,du , & - md ,ed ,sd ,qd ,mc , & - qu ,su ,zf ,qst ,hmn , & - hsat ,shat ,ql , & - cmeg ,jb ,lel ,jt ,jlcl , & - mx ,j0 ,jd ,rl ,il2g , & - rd ,grav ,cp ,msg , & - pflx ,evp ,cu ,rprd ,limcnv ,landfrac, & - qcde ,aero ,loc_conv,qhat ) - -!----------------------------------------------------------------------- -! -! Purpose: -! -! -! Method: -! may 09/91 - guang jun zhang, m.lazare, n.mcfarlane. -! original version cldprop. -! -! Author: See above, modified by P. Rasch -! This is contributed code not fully standardized by the CCM core group. -! -! this code is very much rougher than virtually anything else in the CCM -! there are debug statements left strewn about and code segments disabled -! these are to facilitate future development. We expect to release a -! cleaner code in a future release -! -! the documentation has been enhanced to the degree that we are able -! -!----------------------------------------------------------------------- - - implicit none - -!------------------------------------------------------------------------------ -! -! Input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - - real(r8), intent(in) :: q(pcols,pver) ! spec. humidity of env - real(r8), intent(in) :: t(pcols,pver) ! temp of env - real(r8), intent(in) :: p(pcols,pver) ! pressure of env - real(r8), intent(in) :: z(pcols,pver) ! height of env - real(r8), intent(in) :: s(pcols,pver) ! normalized dry static energy of env - real(r8), intent(in) :: zf(pcols,pverp) ! height of interfaces - real(r8), intent(in) :: u(pcols,pver) ! zonal velocity of env - real(r8), intent(in) :: v(pcols,pver) ! merid. velocity of env - - real(r8), intent(in) :: landfrac(pcols) ! RBN Landfrac - - integer, intent(in) :: jb(pcols) ! updraft base level - integer, intent(in) :: lel(pcols) ! updraft launch level - integer, intent(out) :: jt(pcols) ! updraft plume top - integer, intent(out) :: jlcl(pcols) ! updraft lifting cond level - integer, intent(in) :: mx(pcols) ! updraft base level (same is jb) - integer, intent(out) :: j0(pcols) ! level where updraft begins detraining - integer, intent(out) :: jd(pcols) ! level of downdraft - integer, intent(in) :: limcnv ! convection limiting level - integer, intent(in) :: il2g !CORE GROUP REMOVE - integer, intent(in) :: msg ! missing moisture vals (always 0) - real(r8), intent(in) :: rl ! latent heat of vap - real(r8), intent(in) :: shat(pcols,pver) ! interface values of dry stat energy - real(r8), intent(in) :: qhat(pcols,pver) ! wg grid slice of upper interface mixing ratio. - type(zm_aero_t), intent(in) :: aero ! aerosol object - -! -! output -! - real(r8), intent(out) :: rprd(pcols,pver) ! rate of production of precip at that layer - real(r8), intent(out) :: du(pcols,pver) ! detrainement rate of updraft - real(r8), intent(out) :: ed(pcols,pver) ! entrainment rate of downdraft - real(r8), intent(out) :: eu(pcols,pver) ! entrainment rate of updraft - real(r8), intent(out) :: hmn(pcols,pver) ! moist stat energy of env - real(r8), intent(out) :: hsat(pcols,pver) ! sat moist stat energy of env - real(r8), intent(out) :: mc(pcols,pver) ! net mass flux - real(r8), intent(out) :: md(pcols,pver) ! downdraft mass flux - real(r8), intent(out) :: mu(pcols,pver) ! updraft mass flux - real(r8), intent(out) :: pflx(pcols,pverp) ! precipitation flux thru layer - real(r8), intent(out) :: qd(pcols,pver) ! spec humidity of downdraft - real(r8), intent(out) :: ql(pcols,pver) ! liq water of updraft - real(r8), intent(out) :: qst(pcols,pver) ! saturation mixing ratio of env. - real(r8), intent(out) :: qu(pcols,pver) ! spec hum of updraft - real(r8), intent(out) :: sd(pcols,pver) ! normalized dry stat energy of downdraft - real(r8), intent(out) :: su(pcols,pver) ! normalized dry stat energy of updraft - real(r8), intent(out) :: qcde(pcols,pver) ! cloud water mixing ratio for detrainment (kg/kg) - - type(zm_conv_t) :: loc_conv - - real(r8) rd ! gas constant for dry air - real(r8) grav ! gravity - real(r8) cp ! heat capacity of dry air - -! -! Local workspace -! - real(r8) gamma(pcols,pver) - real(r8) dz(pcols,pver) - real(r8) iprm(pcols,pver) - real(r8) hu(pcols,pver) - real(r8) hd(pcols,pver) - real(r8) eps(pcols,pver) - real(r8) f(pcols,pver) - real(r8) k1(pcols,pver) - real(r8) i2(pcols,pver) - real(r8) ihat(pcols,pver) - real(r8) i3(pcols,pver) - real(r8) idag(pcols,pver) - real(r8) i4(pcols,pver) - real(r8) qsthat(pcols,pver) - real(r8) hsthat(pcols,pver) - real(r8) gamhat(pcols,pver) - real(r8) cu(pcols,pver) - real(r8) evp(pcols,pver) - real(r8) cmeg(pcols,pver) - real(r8) qds(pcols,pver) -! RBN For c0mask - real(r8) c0mask(pcols) - - real(r8) hmin(pcols) - real(r8) expdif(pcols) - real(r8) expnum(pcols) - real(r8) ftemp(pcols) - real(r8) eps0(pcols) - real(r8) rmue(pcols) - real(r8) zuef(pcols) - real(r8) zdef(pcols) - real(r8) epsm(pcols) - real(r8) ratmjb(pcols) - real(r8) est(pcols) - real(r8) totpcp(pcols) - real(r8) totevp(pcols) - real(r8) alfa(pcols) - real(r8) ql1 - real(r8) tu - real(r8) estu - real(r8) qstu - - real(r8) small - real(r8) mdt - - real(r8) fice(pcols,pver) ! ice fraction in precip production - real(r8) tug(pcols,pver) - - real(r8) tvuo(pcols,pver) ! updraft virtual T w/o freezing heating - real(r8) tvu(pcols,pver) ! updraft virtual T with freezing heating - real(r8) totfrz(pcols) - real(r8) frz (pcols,pver) ! rate of freezing - integer jto(pcols) ! updraft plume old top - integer tmplel(pcols) - - integer iter, itnum - integer m - - integer khighest - integer klowest - integer kount - integer i,k - - logical doit(pcols) - logical done(pcols) -! -!------------------------------------------------------------------------------ -! - if (zmconv_microp) then - loc_conv%autolm(:il2g,:) = 0._r8 - loc_conv%accrlm(:il2g,:) = 0._r8 - loc_conv%bergnm(:il2g,:) = 0._r8 - loc_conv%fhtimm(:il2g,:) = 0._r8 - loc_conv%fhtctm(:il2g,:) = 0._r8 - loc_conv%fhmlm (:il2g,:) = 0._r8 - loc_conv%hmpim (:il2g,:) = 0._r8 - loc_conv%accslm(:il2g,:) = 0._r8 - loc_conv%dlfm (:il2g,:) = 0._r8 - - loc_conv%autoln(:il2g,:) = 0._r8 - loc_conv%accrln(:il2g,:) = 0._r8 - loc_conv%bergnn(:il2g,:) = 0._r8 - loc_conv%fhtimn(:il2g,:) = 0._r8 - loc_conv%fhtctn(:il2g,:) = 0._r8 - loc_conv%fhmln (:il2g,:) = 0._r8 - loc_conv%accsln(:il2g,:) = 0._r8 - loc_conv%activn(:il2g,:) = 0._r8 - loc_conv%dlfn (:il2g,:) = 0._r8 - - loc_conv%autoim(:il2g,:) = 0._r8 - loc_conv%accsim(:il2g,:) = 0._r8 - loc_conv%difm (:il2g,:) = 0._r8 - - loc_conv%nuclin(:il2g,:) = 0._r8 - loc_conv%autoin(:il2g,:) = 0._r8 - loc_conv%accsin(:il2g,:) = 0._r8 - loc_conv%hmpin (:il2g,:) = 0._r8 - loc_conv%difn (:il2g,:) = 0._r8 - - loc_conv%trspcm(:il2g,:) = 0._r8 - loc_conv%trspcn(:il2g,:) = 0._r8 - loc_conv%trspim(:il2g,:) = 0._r8 - loc_conv%trspin(:il2g,:) = 0._r8 - - loc_conv%dcape (:il2g) = 0._r8 - - end if - - do i = 1,il2g - ftemp(i) = 0._r8 - expnum(i) = 0._r8 - expdif(i) = 0._r8 - c0mask(i) = c0_ocn * (1._r8-landfrac(i)) + c0_lnd * landfrac(i) - end do -! -!jr Change from msg+1 to 1 to prevent blowup -! - do k = 1,pver - do i = 1,il2g - dz(i,k) = zf(i,k) - zf(i,k+1) - end do - end do - -! -! initialize many output and work variables to zero -! - pflx(:il2g,1) = 0 - - do k = 1,pver - do i = 1,il2g - k1(i,k) = 0._r8 - i2(i,k) = 0._r8 - i3(i,k) = 0._r8 - i4(i,k) = 0._r8 - mu(i,k) = 0._r8 - f(i,k) = 0._r8 - eps(i,k) = 0._r8 - eu(i,k) = 0._r8 - du(i,k) = 0._r8 - ql(i,k) = 0._r8 - cu(i,k) = 0._r8 - evp(i,k) = 0._r8 - cmeg(i,k) = 0._r8 - qds(i,k) = q(i,k) - md(i,k) = 0._r8 - ed(i,k) = 0._r8 - sd(i,k) = s(i,k) - qd(i,k) = q(i,k) - mc(i,k) = 0._r8 - qu(i,k) = q(i,k) - su(i,k) = s(i,k) - call qsat_hPa(t(i,k), p(i,k), est(i), qst(i,k)) - - if ( p(i,k)-est(i) <= 0._r8 ) then - qst(i,k) = 1.0_r8 - end if - - gamma(i,k) = qst(i,k)*(1._r8 + qst(i,k)/eps1)*eps1*rl/(rd*t(i,k)**2)*rl/cp - hmn(i,k) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) - hsat(i,k) = cp*t(i,k) + grav*z(i,k) + rl*qst(i,k) - hu(i,k) = hmn(i,k) - hd(i,k) = hmn(i,k) - rprd(i,k) = 0._r8 - - fice(i,k) = 0._r8 - tug(i,k) = 0._r8 - qcde(i,k) = 0._r8 - tvuo(i,k) = (shat(i,k) - grav/cp*zf(i,k))*(1._r8 + 0.608_r8*qhat(i,k)) - tvu(i,k) = tvuo(i,k) - frz(i,k) = 0._r8 - - end do - end do - if (zmconv_microp) then - do k = 1,pver - do i = 1,il2g - loc_conv%sprd(i,k) = 0._r8 - loc_conv%wu(i,k) = 0._r8 - loc_conv%cmel(i,k) = 0._r8 - loc_conv%cmei(i,k) = 0._r8 - loc_conv%qliq(i,k) = 0._r8 - loc_conv%qice(i,k) = 0._r8 - loc_conv%qnl(i,k) = 0._r8 - loc_conv%qni(i,k) = 0._r8 - loc_conv%qide(i,k) = 0._r8 - loc_conv%qncde(i,k) = 0._r8 - loc_conv%qnide(i,k) = 0._r8 - loc_conv%qnr(i,k) = 0._r8 - loc_conv%qns(i,k) = 0._r8 - loc_conv%qrain(i,k)= 0._r8 - loc_conv%qsnow(i,k)= 0._r8 - loc_conv%frz(i,k) = 0._r8 - end do - end do - end if -! -!jr Set to zero things which make this routine blow up -! - do k=1,msg - do i=1,il2g - rprd(i,k) = 0._r8 - end do - end do -! -! interpolate the layer values of qst, hsat and gamma to -! layer interfaces -! - do k = 1, msg+1 - do i = 1,il2g - hsthat(i,k) = hsat(i,k) - qsthat(i,k) = qst(i,k) - gamhat(i,k) = gamma(i,k) - end do - end do - do i = 1,il2g - totpcp(i) = 0._r8 - totevp(i) = 0._r8 - end do - do k = msg + 2,pver - do i = 1,il2g - if (abs(qst(i,k-1)-qst(i,k)) > 1.E-6_r8) then - qsthat(i,k) = log(qst(i,k-1)/qst(i,k))*qst(i,k-1)*qst(i,k)/ (qst(i,k-1)-qst(i,k)) - else - qsthat(i,k) = qst(i,k) - end if - hsthat(i,k) = cp*shat(i,k) + rl*qsthat(i,k) - if (abs(gamma(i,k-1)-gamma(i,k)) > 1.E-6_r8) then - gamhat(i,k) = log(gamma(i,k-1)/gamma(i,k))*gamma(i,k-1)*gamma(i,k)/ & - (gamma(i,k-1)-gamma(i,k)) - else - gamhat(i,k) = gamma(i,k) - end if - end do - end do -! -! initialize cloud top to highest plume top. -!jr changed hard-wired 4 to limcnv+1 (not to exceed pver) -! - jt(:) = pver - do i = 1,il2g - jt(i) = max(lel(i),limcnv+1) - jt(i) = min(jt(i),pver) - jd(i) = pver - jlcl(i) = lel(i) - hmin(i) = 1.E6_r8 - end do -! -! find the level of minimum hsat, where detrainment starts -! - - do k = msg + 1,pver - do i = 1,il2g - if (hsat(i,k) <= hmin(i) .and. k >= jt(i) .and. k <= jb(i)) then - hmin(i) = hsat(i,k) - j0(i) = k - end if - end do - end do - do i = 1,il2g - j0(i) = min(j0(i),jb(i)-2) - j0(i) = max(j0(i),jt(i)+2) -! -! Fix from Guang Zhang to address out of bounds array reference -! - j0(i) = min(j0(i),pver) - end do -! -! Initialize certain arrays inside cloud -! - do k = msg + 1,pver - do i = 1,il2g - if (k >= jt(i) .and. k <= jb(i)) then - hu(i,k) = hmn(i,mx(i)) + cp*tiedke_add - su(i,k) = s(i,mx(i)) + tiedke_add - end if - end do - end do -! -! ********************************************************* -! compute taylor series for approximate eps(z) below -! ********************************************************* -! - do k = pver - 1,msg + 1,-1 - do i = 1,il2g - if (k < jb(i) .and. k >= jt(i)) then - k1(i,k) = k1(i,k+1) + (hmn(i,mx(i))-hmn(i,k))*dz(i,k) - ihat(i,k) = 0.5_r8* (k1(i,k+1)+k1(i,k)) - i2(i,k) = i2(i,k+1) + ihat(i,k)*dz(i,k) - idag(i,k) = 0.5_r8* (i2(i,k+1)+i2(i,k)) - i3(i,k) = i3(i,k+1) + idag(i,k)*dz(i,k) - iprm(i,k) = 0.5_r8* (i3(i,k+1)+i3(i,k)) - i4(i,k) = i4(i,k+1) + iprm(i,k)*dz(i,k) - end if - end do - end do -! -! re-initialize hmin array for ensuing calculation. -! - do i = 1,il2g - hmin(i) = 1.E6_r8 - end do - do k = msg + 1,pver - do i = 1,il2g - if (k >= j0(i) .and. k <= jb(i) .and. hmn(i,k) <= hmin(i)) then - hmin(i) = hmn(i,k) - expdif(i) = hmn(i,mx(i)) - hmin(i) - end if - end do - end do -! -! ********************************************************* -! compute approximate eps(z) using above taylor series -! ********************************************************* -! - do k = msg + 2,pver - do i = 1,il2g - expnum(i) = 0._r8 - ftemp(i) = 0._r8 - if (k < jt(i) .or. k >= jb(i)) then - k1(i,k) = 0._r8 - expnum(i) = 0._r8 - else - expnum(i) = hmn(i,mx(i)) - (hsat(i,k-1)*(zf(i,k)-z(i,k)) + & - hsat(i,k)* (z(i,k-1)-zf(i,k)))/(z(i,k-1)-z(i,k)) - end if - if ((expdif(i) > 100._r8 .and. expnum(i) > 0._r8) .and. & - k1(i,k) > expnum(i)*dz(i,k)) then - ftemp(i) = expnum(i)/k1(i,k) - f(i,k) = ftemp(i) + i2(i,k)/k1(i,k)*ftemp(i)**2 + & - (2._r8*i2(i,k)**2-k1(i,k)*i3(i,k))/k1(i,k)**2* & - ftemp(i)**3 + (-5._r8*k1(i,k)*i2(i,k)*i3(i,k)+ & - 5._r8*i2(i,k)**3+k1(i,k)**2*i4(i,k))/ & - k1(i,k)**3*ftemp(i)**4 - f(i,k) = max(f(i,k),0._r8) - f(i,k) = min(f(i,k),0.0002_r8) - end if - end do - end do - do i = 1,il2g - if (j0(i) < jb(i)) then - if (f(i,j0(i)) < 1.E-6_r8 .and. f(i,j0(i)+1) > f(i,j0(i))) j0(i) = j0(i) + 1 - end if - end do - do k = msg + 2,pver - do i = 1,il2g - if (k >= jt(i) .and. k <= j0(i)) then - f(i,k) = max(f(i,k),f(i,k-1)) - end if - end do - end do - do i = 1,il2g - eps0(i) = f(i,j0(i)) - eps(i,jb(i)) = eps0(i) - end do -! -! This is set to match the Rasch and Kristjansson paper -! - do k = pver,msg + 1,-1 - do i = 1,il2g - if (k >= j0(i) .and. k <= jb(i)) then - eps(i,k) = f(i,j0(i)) - end if - end do - end do - do k = pver,msg + 1,-1 - do i = 1,il2g - if (k < j0(i) .and. k >= jt(i)) eps(i,k) = f(i,k) - end do - end do - - if (zmconv_microp) then - itnum = 2 - else - itnum = 1 - end if - - do iter=1, itnum - - if (zmconv_microp) then - do k = pver,msg + 1,-1 - do i = 1,il2g - cu(i,k) = 0._r8 - loc_conv%qliq(i,k) = 0._r8 - loc_conv%qice(i,k) = 0._r8 - ql(i,k) = 0._r8 - loc_conv%frz(i,k) = 0._r8 - end do - end do - do i = 1,il2g - totpcp(i) = 0._r8 - hu(i,jb(i)) = hmn(i,jb(i)) + cp*tiedke_add - end do - - end if - -! -! specify the updraft mass flux mu, entrainment eu, detrainment du -! and moist static energy hu. -! here and below mu, eu,du, md and ed are all normalized by mb -! - do i = 1,il2g - if (eps0(i) > 0._r8) then - mu(i,jb(i)) = 1._r8 - eu(i,jb(i)) = mu(i,jb(i))/dz(i,jb(i)) - end if - if (zmconv_microp) then - tmplel(i) = lel(i) - else - tmplel(i) = jt(i) - end if - end do - do k = pver,msg + 1,-1 - do i = 1,il2g - if (eps0(i) > 0._r8 .and. (k >= tmplel(i) .and. k < jb(i))) then - zuef(i) = zf(i,k) - zf(i,jb(i)) - rmue(i) = (1._r8/eps0(i))* (exp(eps(i,k+1)*zuef(i))-1._r8)/zuef(i) - mu(i,k) = (1._r8/eps0(i))* (exp(eps(i,k )*zuef(i))-1._r8)/zuef(i) - eu(i,k) = (rmue(i)-mu(i,k+1))/dz(i,k) - du(i,k) = (rmue(i)-mu(i,k))/dz(i,k) - end if - end do - end do - - khighest = pverp - klowest = 1 - do i=1,il2g - khighest = min(khighest,lel(i)) - klowest = max(klowest,jb(i)) - end do - do k = klowest-1,khighest,-1 - do i = 1,il2g - if (k <= jb(i)-1 .and. k >= lel(i) .and. eps0(i) > 0._r8) then - if (mu(i,k) < 0.02_r8) then - hu(i,k) = hmn(i,k) - mu(i,k) = 0._r8 - eu(i,k) = 0._r8 - du(i,k) = mu(i,k+1)/dz(i,k) - else - if (zmconv_microp) then - hu(i,k) = (mu(i,k+1)*hu(i,k+1) + dz(i,k)*(eu(i,k)*hmn(i,k) + & - latice*frz(i,k)))/(mu(i,k)+ dz(i,k)*du(i,k)) - else - hu(i,k) = mu(i,k+1)/mu(i,k)*hu(i,k+1) + & - dz(i,k)/mu(i,k)* (eu(i,k)*hmn(i,k)- du(i,k)*hsat(i,k)) - end if - end if - end if - end do - end do -! -! reset cloud top index beginning from two layers above the -! cloud base (i.e. if cloud is only one layer thick, top is not reset -! - do i=1,il2g - doit(i) = .true. - totfrz(i)= 0._r8 - do k = pver,msg + 1,-1 - totfrz(i)= totfrz(i)+ frz(i,k)*dz(i,k) - end do - end do - do k=klowest-2,khighest-1,-1 - do i=1,il2g - if (doit(i) .and. k <= jb(i)-2 .and. k >= lel(i)-1) then - if (hu(i,k) <= hsthat(i,k) .and. hu(i,k+1) > hsthat(i,k+1) & - .and. mu(i,k) >= 0.02_r8) then - if (hu(i,k)-hsthat(i,k) < -2000._r8) then - jt(i) = k + 1 - doit(i) = .false. - else - jt(i) = k - doit(i) = .false. - end if - else if ( (hu(i,k) > hu(i,jb(i)) .and. totfrz(i)<=0._r8) .or. mu(i,k) < 0.02_r8) then - jt(i) = k + 1 - doit(i) = .false. - end if - end if - end do - end do - - if (iter == 1) jto(:) = jt(:) - - do k = pver,msg + 1,-1 - do i = 1,il2g - if (k >= lel(i) .and. k <= jt(i) .and. eps0(i) > 0._r8) then - mu(i,k) = 0._r8 - eu(i,k) = 0._r8 - du(i,k) = 0._r8 - hu(i,k) = hmn(i,k) - end if - if (k == jt(i) .and. eps0(i) > 0._r8) then - du(i,k) = mu(i,k+1)/dz(i,k) - eu(i,k) = 0._r8 - mu(i,k) = 0._r8 - end if - end do - end do - - do i = 1,il2g - done(i) = .false. - end do - kount = 0 - do k = pver,msg + 2,-1 - do i = 1,il2g - if (k == jb(i) .and. eps0(i) > 0._r8) then - qu(i,k) = q(i,mx(i)) - su(i,k) = (hu(i,k)-rl*qu(i,k))/cp - end if - if (( .not. done(i) .and. k > jt(i) .and. k < jb(i)) .and. eps0(i) > 0._r8) then - su(i,k) = mu(i,k+1)/mu(i,k)*su(i,k+1) + & - dz(i,k)/mu(i,k)* (eu(i,k)-du(i,k))*s(i,k) - qu(i,k) = mu(i,k+1)/mu(i,k)*qu(i,k+1) + dz(i,k)/mu(i,k)* (eu(i,k)*q(i,k)- & - du(i,k)*qst(i,k)) - tu = su(i,k) - grav/cp*zf(i,k) - call qsat_hPa(tu, (p(i,k)+p(i,k-1))/2._r8, estu, qstu) - if (qu(i,k) >= qstu) then - jlcl(i) = k - kount = kount + 1 - done(i) = .true. - end if - end if - end do - if (kount >= il2g) goto 690 - end do -690 continue - do k = msg + 2,pver - do i = 1,il2g - if ((k > jt(i) .and. k <= jlcl(i)) .and. eps0(i) > 0._r8) then - su(i,k) = shat(i,k) + (hu(i,k)-hsthat(i,k))/(cp* (1._r8+gamhat(i,k))) - qu(i,k) = qsthat(i,k) + gamhat(i,k)*(hu(i,k)-hsthat(i,k))/ & - (rl* (1._r8+gamhat(i,k))) - end if - end do - end do - -! compute condensation in updraft - if (zmconv_microp) then - tmplel(:il2g) = jlcl(:il2g)+1 - else - tmplel(:il2g) = jb(:il2g) - end if - - do k = pver,msg + 2,-1 - do i = 1,il2g - if (k >= jt(i) .and. k < tmplel(i) .and. eps0(i) > 0._r8) then - if (zmconv_microp) then - cu(i,k) = ((mu(i,k)*su(i,k)-mu(i,k+1)*su(i,k+1))/ & - dz(i,k)- eu(i,k)*s(i,k)+du(i,k)*su(i,k))/(rl/cp) & - - latice*frz(i,k)/rl - else - - cu(i,k) = ((mu(i,k)*su(i,k)-mu(i,k+1)*su(i,k+1))/ & - dz(i,k)- (eu(i,k)-du(i,k))*s(i,k))/(rl/cp) - end if - if (k == jt(i)) cu(i,k) = 0._r8 - cu(i,k) = max(0._r8,cu(i,k)) - end if - end do - end do - - - if (zmconv_microp) then - - tug(:il2g,:) = t(:il2g,:) - fice(:,:) = 0._r8 - - do k = pver, msg+2, -1 - do i = 1, il2g - tug(i,k) = su(i,k) - grav/cp*zf(i,k) - end do - end do - - do k = 1, pver-1 - do i = 1, il2g - - if (tug(i,k+1) > 273.15_r8) then - ! If warmer than tmax then water phase - fice(i,k) = 0._r8 - - else if (tug(i,k+1) < 233.15_r8) then - ! If colder than tmin then ice phase - fice(i,k) = 1._r8 - - else - ! Otherwise mixed phase, with ice fraction decreasing linearly - ! from tmin to tmax - fice(i,k) =(273.15_r8 - tug(i,k+1)) / 40._r8 - end if - end do - end do - - do k = 1, pver - do i = 1,il2g - loc_conv%cmei(i,k) = cu(i,k)* fice(i,k) - loc_conv%cmel(i,k) = cu(i,k) * (1._r8-fice(i,k)) - end do - end do - - call zm_mphy(su, qu, mu, du, eu, loc_conv%cmel, loc_conv%cmei, zf, p, t, q, & - eps0, jb, jt, jlcl, msg, il2g, grav, cp, rd, aero, gamhat, & - loc_conv%qliq, loc_conv%qice, loc_conv%qnl, loc_conv%qni, qcde, loc_conv%qide, & - loc_conv%qncde, loc_conv%qnide, rprd, loc_conv%sprd, frz, & - loc_conv%wu, loc_conv%qrain, loc_conv%qsnow, loc_conv%qnr, loc_conv%qns, & - loc_conv%autolm, loc_conv%accrlm, loc_conv%bergnm, loc_conv%fhtimm, loc_conv%fhtctm, & - loc_conv%fhmlm, loc_conv%hmpim, loc_conv%accslm, loc_conv%dlfm, loc_conv%autoln, & - loc_conv%accrln, loc_conv%bergnn, loc_conv%fhtimn, loc_conv%fhtctn, & - loc_conv%fhmln, loc_conv%accsln, loc_conv%activn, loc_conv%dlfn, loc_conv%autoim, & - loc_conv%accsim, loc_conv%difm, loc_conv%nuclin, loc_conv%autoin, & - loc_conv%accsin, loc_conv%hmpin, loc_conv%difn, loc_conv%trspcm, loc_conv%trspcn, & - loc_conv%trspim, loc_conv%trspin, loc_conv%lambdadpcu, loc_conv%mudpcu ) - - - do k = pver,msg + 2,-1 - do i = 1,il2g - ql(i,k) = loc_conv%qliq(i,k)+ loc_conv%qice(i,k) - loc_conv%frz(i,k) = frz(i,k) - end do - end do - - do i = 1,il2g - if (iter == 2 .and. jt(i)> jto(i)) then - do k = jt(i), jto(i), -1 - loc_conv%frz(i,k) = 0.0_r8 - cu(i,k)=0.0_r8 - end do - end if - end do - - - do k = pver,msg + 2,-1 - do i = 1,il2g - if (k >= jt(i) .and. k < jb(i) .and. eps0(i) > 0._r8 .and. mu(i,k) >= 0.0_r8) then - totpcp(i) = totpcp(i) + dz(i,k)*(cu(i,k)-du(i,k)*(qcde(i,k+1)+loc_conv%qide(i,k+1) )) - end if - end do - end do - - do k = msg + 2,pver - do i = 1,il2g - if ((k > jt(i) .and. k <= jlcl(i)) .and. eps0(i) > 0._r8) then - if (iter == 1) tvuo(i,k)= (su(i,k) - grav/cp*zf(i,k))*(1._r8+0.608_r8*qu(i,k)) - if (iter == 2 .and. k > max(jt(i),jto(i)) ) then - tvu(i,k) = (su(i,k) - grav/cp*zf(i,k))*(1._r8 +0.608_r8*qu(i,k)) - loc_conv%dcape(i) = loc_conv%dcape(i)+ rd*(tvu(i,k)-tvuo(i,k))*log(p(i,k)/p(i,k-1)) - end if - end if - end do - end do - - else ! no convective microphysics - -! compute condensed liquid, rain production rate -! accumulate total precipitation (condensation - detrainment of liquid) -! Note ql1 = ql(k) + rprd(k)*dz(k)/mu(k) -! The differencing is somewhat strange (e.g. du(i,k)*ql(i,k+1)) but is -! consistently applied. -! mu, ql are interface quantities -! cu, du, eu, rprd are midpoint quantites - - do k = pver,msg + 2,-1 - do i = 1,il2g - rprd(i,k) = 0._r8 - if (k >= jt(i) .and. k < jb(i) .and. eps0(i) > 0._r8 .and. mu(i,k) >= 0.0_r8) then - if (mu(i,k) > 0._r8) then - ql1 = 1._r8/mu(i,k)* (mu(i,k+1)*ql(i,k+1)- & - dz(i,k)*du(i,k)*ql(i,k+1)+dz(i,k)*cu(i,k)) - ql(i,k) = ql1/ (1._r8+dz(i,k)*c0mask(i)) - else - ql(i,k) = 0._r8 - end if - totpcp(i) = totpcp(i) + dz(i,k)*(cu(i,k)-du(i,k)*ql(i,k+1)) - rprd(i,k) = c0mask(i)*mu(i,k)*ql(i,k) - qcde(i,k) = ql(i,k) - - if (zmconv_microp) then - loc_conv%qide(i,k) = 0._r8 - loc_conv%qncde(i,k) = 0._r8 - loc_conv%qnide(i,k) = 0._r8 - loc_conv%sprd(i,k) = 0._r8 - end if - - end if - end do - end do -! - end if ! zmconv_microp - - end do !iter -! -! specify downdraft properties (no downdrafts if jd.ge.jb). -! scale down downward mass flux profile so that net flux -! (up-down) at cloud base in not negative. -! - do i = 1,il2g -! -! in normal downdraft strength run alfa=0.2. In test4 alfa=0.1 -! - alfa(i) = 0.1_r8 - jt(i) = min(jt(i),jb(i)-1) - jd(i) = max(j0(i),jt(i)+1) - jd(i) = min(jd(i),jb(i)) - hd(i,jd(i)) = hmn(i,jd(i)-1) - if (jd(i) < jb(i) .and. eps0(i) > 0._r8) then - epsm(i) = eps0(i) - md(i,jd(i)) = -alfa(i)*epsm(i)/eps0(i) - end if - end do - do k = msg + 1,pver - do i = 1,il2g - if ((k > jd(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8) then - zdef(i) = zf(i,jd(i)) - zf(i,k) - md(i,k) = -alfa(i)/ (2._r8*eps0(i))*(exp(2._r8*epsm(i)*zdef(i))-1._r8)/zdef(i) - end if - end do - end do - - do k = msg + 1,pver - do i = 1,il2g - if ((k >= jt(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8 .and. jd(i) < jb(i)) then - ratmjb(i) = min(abs(mu(i,jb(i))/md(i,jb(i))),1._r8) - md(i,k) = md(i,k)*ratmjb(i) - end if - end do - end do - - small = 1.e-20_r8 - do k = msg + 1,pver - do i = 1,il2g - if ((k >= jt(i) .and. k <= pver) .and. eps0(i) > 0._r8) then - ed(i,k-1) = (md(i,k-1)-md(i,k))/dz(i,k-1) - mdt = min(md(i,k),-small) - hd(i,k) = (md(i,k-1)*hd(i,k-1) - dz(i,k-1)*ed(i,k-1)*hmn(i,k-1))/mdt - end if - end do - end do -! -! calculate updraft and downdraft properties. -! - do k = msg + 2,pver - do i = 1,il2g - if ((k >= jd(i) .and. k <= jb(i)) .and. eps0(i) > 0._r8 .and. jd(i) < jb(i)) then - qds(i,k) = qsthat(i,k) + gamhat(i,k)*(hd(i,k)-hsthat(i,k))/ & - (rl*(1._r8 + gamhat(i,k))) - end if - end do - end do - - do i = 1,il2g - qd(i,jd(i)) = qds(i,jd(i)) - sd(i,jd(i)) = (hd(i,jd(i)) - rl*qd(i,jd(i)))/cp - end do -! - do k = msg + 2,pver - do i = 1,il2g - if (k >= jd(i) .and. k < jb(i) .and. eps0(i) > 0._r8) then - qd(i,k+1) = qds(i,k+1) - evp(i,k) = -ed(i,k)*q(i,k) + (md(i,k)*qd(i,k)-md(i,k+1)*qd(i,k+1))/dz(i,k) - evp(i,k) = max(evp(i,k),0._r8) - mdt = min(md(i,k+1),-small) - if (zmconv_microp) then - evp(i,k) = min(evp(i,k),rprd(i,k)) - end if - sd(i,k+1) = ((rl/cp*evp(i,k)-ed(i,k)*s(i,k))*dz(i,k) + md(i,k)*sd(i,k))/mdt - totevp(i) = totevp(i) - dz(i,k)*ed(i,k)*q(i,k) - end if - end do - end do - do i = 1,il2g -!*guang totevp(i) = totevp(i) + md(i,jd(i))*q(i,jd(i)-1) - - totevp(i) = totevp(i) + md(i,jd(i))*qd(i,jd(i)) - md(i,jb(i))*qd(i,jb(i)) - end do -!!$ if (.true.) then - if (.false.) then - do i = 1,il2g - k = jb(i) - if (eps0(i) > 0._r8) then - evp(i,k) = -ed(i,k)*q(i,k) + (md(i,k)*qd(i,k))/dz(i,k) - evp(i,k) = max(evp(i,k),0._r8) - totevp(i) = totevp(i) - dz(i,k)*ed(i,k)*q(i,k) - end if - end do - endif - - do i = 1,il2g - totpcp(i) = max(totpcp(i),0._r8) - totevp(i) = max(totevp(i),0._r8) - end do -! - do k = msg + 2,pver - do i = 1,il2g - if (totevp(i) > 0._r8 .and. totpcp(i) > 0._r8) then - md(i,k) = md (i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) - ed(i,k) = ed (i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) - evp(i,k) = evp(i,k)*min(1._r8, totpcp(i)/(totevp(i)+totpcp(i))) - else - md(i,k) = 0._r8 - ed(i,k) = 0._r8 - evp(i,k) = 0._r8 - end if -! cmeg is the cloud water condensed - rain water evaporated -! rprd is the cloud water converted to rain - (rain evaporated) - cmeg(i,k) = cu(i,k) - evp(i,k) - rprd(i,k) = rprd(i,k)-evp(i,k) - end do - end do - -! compute the net precipitation flux across interfaces - pflx(:il2g,1) = 0._r8 - do k = 2,pverp - do i = 1,il2g - pflx(i,k) = pflx(i,k-1) + rprd(i,k-1)*dz(i,k-1) - end do - end do -! - do k = msg + 1,pver - do i = 1,il2g - mc(i,k) = mu(i,k) + md(i,k) - end do - end do -! - return -end subroutine cldprp - -subroutine closure(lchnk , & - q ,t ,p ,z ,s , & - tp ,qs ,qu ,su ,mc , & - du ,mu ,md ,qd ,sd , & - qhat ,shat ,dp ,qstp ,zf , & - ql ,dsubcld ,mb ,cape ,tl , & - lcl ,lel ,jt ,mx ,il1g , & - il2g ,rd ,grav ,cp ,rl , & - msg ,capelmt ,wm_ic ) -!----------------------------------------------------------------------- -! -! Purpose: -! -! -! Method: -! -! -! -! Author: G. Zhang and collaborators. CCM contact:P. Rasch -! This is contributed code not fully standardized by the CCM core group. -! -! this code is very much rougher than virtually anything else in the CCM -! We expect to release cleaner code in a future release -! -! the documentation has been enhanced to the degree that we are able -! -!----------------------------------------------------------------------- - -! -!-----------------------------Arguments--------------------------------- -! - integer, intent(in) :: lchnk ! chunk identifier - - real(r8), intent(inout) :: q(pcols,pver) ! spec humidity - real(r8), intent(inout) :: t(pcols,pver) ! temperature - real(r8), intent(inout) :: p(pcols,pver) ! pressure (mb) - real(r8), intent(inout) :: mb(pcols) ! cloud base mass flux - real(r8), intent(in) :: z(pcols,pver) ! height (m) - real(r8), intent(in) :: s(pcols,pver) ! normalized dry static energy - real(r8), intent(in) :: tp(pcols,pver) ! parcel temp - real(r8), intent(in) :: qs(pcols,pver) ! sat spec humidity - real(r8), intent(in) :: qu(pcols,pver) ! updraft spec. humidity - real(r8), intent(in) :: su(pcols,pver) ! normalized dry stat energy of updraft - real(r8), intent(in) :: mc(pcols,pver) ! net convective mass flux - real(r8), intent(in) :: du(pcols,pver) ! detrainment from updraft - real(r8), intent(in) :: mu(pcols,pver) ! mass flux of updraft - real(r8), intent(in) :: md(pcols,pver) ! mass flux of downdraft - real(r8), intent(in) :: qd(pcols,pver) ! spec. humidity of downdraft - real(r8), intent(in) :: sd(pcols,pver) ! dry static energy of downdraft - real(r8), intent(in) :: qhat(pcols,pver) ! environment spec humidity at interfaces - real(r8), intent(in) :: shat(pcols,pver) ! env. normalized dry static energy at intrfcs - real(r8), intent(in) :: dp(pcols,pver) ! pressure thickness of layers - real(r8), intent(in) :: qstp(pcols,pver) ! spec humidity of parcel - real(r8), intent(in) :: zf(pcols,pver+1) ! height of interface levels - real(r8), intent(in) :: ql(pcols,pver) ! liquid water mixing ratio - - real(r8), intent(in) :: cape(pcols) ! available pot. energy of column - real(r8), intent(in) :: tl(pcols) - real(r8), intent(in) :: dsubcld(pcols) ! thickness of subcloud layer - - integer, intent(in) :: lcl(pcols) ! index of lcl - integer, intent(in) :: lel(pcols) ! index of launch leve - integer, intent(in) :: jt(pcols) ! top of updraft - integer, intent(in) :: mx(pcols) ! base of updraft - -! RBN mean in-cloud vertical velocity for use in generating grid-box specific timescale. - real(r8), intent(in) :: wm_ic(pcols) ! in-cloud vertical velocity - -! - -! -!--------------------------Local variables------------------------------ -! - real(r8) dtpdt(pcols,pver) - real(r8) dqsdtp(pcols,pver) - real(r8) dtmdt(pcols,pver) - real(r8) dqmdt(pcols,pver) - real(r8) dboydt(pcols,pver) - real(r8) thetavp(pcols,pver) - real(r8) thetavm(pcols,pver) - - ! RBN Tau base on convective height and in-cloud vertical velocity. - - real(r8) tau_wz(pcols) - - real(r8) dtbdt(pcols),dqbdt(pcols),dtldt(pcols) - real(r8) beta - real(r8) capelmt - real(r8) cp - real(r8) dadt(pcols) - real(r8) debdt - real(r8) dltaa - real(r8) eb - real(r8) grav - - integer i - integer il1g - integer il2g - integer k, kmin, kmax - integer msg - - real(r8) rd - real(r8) rl -! change of subcloud layer properties due to convection is -! related to cumulus updrafts and downdrafts. -! mc(z)=f(z)*mb, mub=betau*mb, mdb=betad*mb are used -! to define betau, betad and f(z). -! note that this implies all time derivatives are in effect -! time derivatives per unit cloud-base mass flux, i.e. they -! have units of 1/mb instead of 1/sec. -! - do i = il1g,il2g - mb(i) = 0._r8 - eb = p(i,mx(i))*q(i,mx(i))/ (eps1+q(i,mx(i))) - dtbdt(i) = (1._r8/dsubcld(i))* (mu(i,mx(i))*(shat(i,mx(i))-su(i,mx(i)))+ & - md(i,mx(i))* (shat(i,mx(i))-sd(i,mx(i)))) - dqbdt(i) = (1._r8/dsubcld(i))* (mu(i,mx(i))*(qhat(i,mx(i))-qu(i,mx(i)))+ & - md(i,mx(i))* (qhat(i,mx(i))-qd(i,mx(i)))) - debdt = eps1*p(i,mx(i))/ (eps1+q(i,mx(i)))**2*dqbdt(i) - dtldt(i) = -2840._r8* (3.5_r8/t(i,mx(i))*dtbdt(i)-debdt/eb)/ & - (3.5_r8*log(t(i,mx(i)))-log(eb)-4.805_r8)**2 - end do -! -! dtmdt and dqmdt are cumulus heating and drying. -! - do k = msg + 1,pver - do i = il1g,il2g - dtmdt(i,k) = 0._r8 - dqmdt(i,k) = 0._r8 - end do - end do -! - do k = msg + 1,pver - 1 - do i = il1g,il2g - if (k == jt(i)) then - dtmdt(i,k) = (1._r8/dp(i,k))*(mu(i,k+1)* (su(i,k+1)-shat(i,k+1)- & - rl/cp*ql(i,k+1))+md(i,k+1)* (sd(i,k+1)-shat(i,k+1))) - dqmdt(i,k) = (1._r8/dp(i,k))*(mu(i,k+1)* (qu(i,k+1)- & - qhat(i,k+1)+ql(i,k+1))+md(i,k+1)*(qd(i,k+1)-qhat(i,k+1))) - end if - end do - end do -! - beta = 0._r8 - do k = msg + 1,pver - 1 - do i = il1g,il2g - if (k > jt(i) .and. k < mx(i)) then - dtmdt(i,k) = (mc(i,k)* (shat(i,k)-s(i,k))+mc(i,k+1)* (s(i,k)-shat(i,k+1)))/ & - dp(i,k) - rl/cp*du(i,k)*(beta*ql(i,k)+ (1-beta)*ql(i,k+1)) -! dqmdt(i,k)=(mc(i,k)*(qhat(i,k)-q(i,k)) -! 1 +mc(i,k+1)*(q(i,k)-qhat(i,k+1)))/dp(i,k) -! 2 +du(i,k)*(qs(i,k)-q(i,k)) -! 3 +du(i,k)*(beta*ql(i,k)+(1-beta)*ql(i,k+1)) - - dqmdt(i,k) = (mu(i,k+1)* (qu(i,k+1)-qhat(i,k+1)+cp/rl* (su(i,k+1)-s(i,k)))- & - mu(i,k)* (qu(i,k)-qhat(i,k)+cp/rl*(su(i,k)-s(i,k)))+md(i,k+1)* & - (qd(i,k+1)-qhat(i,k+1)+cp/rl*(sd(i,k+1)-s(i,k)))-md(i,k)* & - (qd(i,k)-qhat(i,k)+cp/rl*(sd(i,k)-s(i,k))))/dp(i,k) + & - du(i,k)* (beta*ql(i,k)+(1-beta)*ql(i,k+1)) - end if - end do - end do -! - do k = msg + 1,pver - do i = il1g,il2g - if (k >= lel(i) .and. k <= lcl(i)) then - thetavp(i,k) = tp(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+1.608_r8*qstp(i,k)-q(i,mx(i))) - thetavm(i,k) = t(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,k)) - dqsdtp(i,k) = qstp(i,k)* (1._r8+qstp(i,k)/eps1)*eps1*rl/(rd*tp(i,k)**2) -! -! dtpdt is the parcel temperature change due to change of -! subcloud layer properties during convection. -! - dtpdt(i,k) = tp(i,k)/ (1._r8+rl/cp* (dqsdtp(i,k)-qstp(i,k)/tp(i,k)))* & - (dtbdt(i)/t(i,mx(i))+rl/cp* (dqbdt(i)/tl(i)-q(i,mx(i))/ & - tl(i)**2*dtldt(i))) -! -! dboydt is the integrand of cape change. -! - dboydt(i,k) = ((dtpdt(i,k)/tp(i,k)+1._r8/(1._r8+1.608_r8*qstp(i,k)-q(i,mx(i)))* & - (1.608_r8 * dqsdtp(i,k) * dtpdt(i,k) -dqbdt(i))) - (dtmdt(i,k)/t(i,k)+0.608_r8/ & - (1._r8+0.608_r8*q(i,k))*dqmdt(i,k)))*grav*thetavp(i,k)/thetavm(i,k) - end if - end do - end do - -! - do k = msg + 1,pver - do i = il1g,il2g - if (k > lcl(i) .and. k < mx(i)) then - thetavp(i,k) = tp(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,mx(i))) - thetavm(i,k) = t(i,k)* (1000._r8/p(i,k))** (rd/cp)*(1._r8+0.608_r8*q(i,k)) -! -! dboydt is the integrand of cape change. -! - dboydt(i,k) = (dtbdt(i)/t(i,mx(i))+0.608_r8/ (1._r8+0.608_r8*q(i,mx(i)))*dqbdt(i)- & - dtmdt(i,k)/t(i,k)-0.608_r8/ (1._r8+0.608_r8*q(i,k))*dqmdt(i,k))* & - grav*thetavp(i,k)/thetavm(i,k) - end if - end do - end do - -! -! buoyant energy change is set to 2/3*excess cape per 3 hours -! - dadt(il1g:il2g) = 0._r8 - kmin = minval(lel(il1g:il2g)) - kmax = maxval(mx(il1g:il2g)) - 1 - do k = kmin, kmax - do i = il1g,il2g - if ( k >= lel(i) .and. k <= mx(i) - 1) then - dadt(i) = dadt(i) + dboydt(i,k)* (zf(i,k)-zf(i,k+1)) - endif - end do - end do - - - -!RBN calculate timescale based on convective height and mean in-cloud velocity. - - - - if (ltau_dynamic) then - do i = il1g,il2g - tau_wz(i) = 0._r8 - if (wm_ic(i) > 0._r8) then - tau_wz(i) = (z(i,lel(i))-z(i,mx(i)))/wm_ic(i) - else - tau_wz(i) = 10000._r8 - end if - write(iulog,*)'ZMTAU', tau_wz(i) - dltaa = -1._r8* (cape(i)-capelmt) - if (dadt(i) /= 0._r8) mb(i) = max(dltaa/tau/dadt(i),0._r8) - end do -! - call outfld('TAUZM',tau_wz, pcols, lchnk) - - else ! Use default constant value of tau - - do i = il1g,il2g - dltaa = -1._r8* (cape(i)-capelmt) - if (dadt(i) /= 0._r8) mb(i) = max(dltaa/tau/dadt(i),0._r8) - end do - ! - end if - - return - -end subroutine closure - -subroutine q1q2_pjr(lchnk , & - dqdt ,dsdt ,q ,qs ,qu , & - su ,du ,qhat ,shat ,dp , & - mu ,md ,sd ,qd ,ql , & - dsubcld ,jt ,mx ,il1g ,il2g , & - cp ,rl ,msg , & - dl ,evp ,cu , & - loc_conv) - - - implicit none - -!----------------------------------------------------------------------- -! -! Purpose: -! -! -! Method: -! -! -! -! Author: phil rasch dec 19 1995 -! -!----------------------------------------------------------------------- - - - real(r8), intent(in) :: cp - - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: il1g - integer, intent(in) :: il2g - integer, intent(in) :: msg - - real(r8), intent(in) :: q(pcols,pver) - real(r8), intent(in) :: qs(pcols,pver) - real(r8), intent(in) :: qu(pcols,pver) - real(r8), intent(in) :: su(pcols,pver) - real(r8), intent(in) :: du(pcols,pver) - real(r8), intent(in) :: qhat(pcols,pver) - real(r8), intent(in) :: shat(pcols,pver) - real(r8), intent(in) :: dp(pcols,pver) - real(r8), intent(in) :: mu(pcols,pver) - real(r8), intent(in) :: md(pcols,pver) - real(r8), intent(in) :: sd(pcols,pver) - real(r8), intent(in) :: qd(pcols,pver) - real(r8), intent(in) :: ql(pcols,pver) - real(r8), intent(in) :: evp(pcols,pver) - real(r8), intent(in) :: cu(pcols,pver) - real(r8), intent(in) :: dsubcld(pcols) - - real(r8),intent(out) :: dqdt(pcols,pver),dsdt(pcols,pver) - real(r8),intent(out) :: dl(pcols,pver) - - type(zm_conv_t) :: loc_conv - - integer kbm - integer ktm - integer jt(pcols) - integer mx(pcols) -! -! work fields: -! - integer i - integer k - - real(r8) emc - real(r8) rl -!------------------------------------------------------------------- - do k = msg + 1,pver - do i = il1g,il2g - dsdt(i,k) = 0._r8 - dqdt(i,k) = 0._r8 - dl(i,k) = 0._r8 - end do - end do - - if (zmconv_microp) then - do k = msg + 1,pver - do i = il1g,il2g - loc_conv%di(i,k) = 0._r8 - loc_conv%dnl(i,k) = 0._r8 - loc_conv%dni(i,k) = 0._r8 - end do - end do - end if -! -! find the highest level top and bottom levels of convection -! - ktm = pver - kbm = pver - do i = il1g, il2g - ktm = min(ktm,jt(i)) - kbm = min(kbm,mx(i)) - end do - - do k = ktm,pver-1 - do i = il1g,il2g - emc = -cu (i,k) & ! condensation in updraft - +evp(i,k) ! evaporating rain in downdraft - - dsdt(i,k) = -rl/cp*emc & - + (+mu(i,k+1)* (su(i,k+1)-shat(i,k+1)) & - -mu(i,k)* (su(i,k)-shat(i,k)) & - +md(i,k+1)* (sd(i,k+1)-shat(i,k+1)) & - -md(i,k)* (sd(i,k)-shat(i,k)) & - )/dp(i,k) - - if (zmconv_microp) dsdt(i,k) = dsdt(i,k) + latice/cp*loc_conv%frz(i,k) - - dqdt(i,k) = emc + & - (+mu(i,k+1)* (qu(i,k+1)-qhat(i,k+1)) & - -mu(i,k)* (qu(i,k)-qhat(i,k)) & - +md(i,k+1)* (qd(i,k+1)-qhat(i,k+1)) & - -md(i,k)* (qd(i,k)-qhat(i,k)) & - )/dp(i,k) - - dl(i,k) = du(i,k)*ql(i,k+1) - - if (zmconv_microp) then - loc_conv%di(i,k) = du(i,k)*loc_conv%qide(i,k+1) - loc_conv%dnl(i,k) = du(i,k)*loc_conv%qncde(i,k+1) - loc_conv%dni(i,k) = du(i,k)*loc_conv%qnide(i,k+1) - end if - - end do - end do - -! - do k = kbm,pver - do i = il1g,il2g - if (k == mx(i)) then - dsdt(i,k) = (1._r8/dsubcld(i))* & - (-mu(i,k)* (su(i,k)-shat(i,k)) & - -md(i,k)* (sd(i,k)-shat(i,k)) & - ) - dqdt(i,k) = (1._r8/dsubcld(i))* & - (-mu(i,k)*(qu(i,k)-qhat(i,k)) & - -md(i,k)*(qd(i,k)-qhat(i,k)) & - ) - else if (k > mx(i)) then - dsdt(i,k) = dsdt(i,k-1) - dqdt(i,k) = dqdt(i,k-1) - end if - end do - end do -! - return -end subroutine q1q2_pjr - -subroutine buoyan_dilute(lchnk ,ncol , & - q ,t ,omega ,p ,z ,pf , & - tp ,qstp ,tl ,rl ,cape , & - pblt ,pbl_z ,lcl ,lel ,lon ,mx , & - rd ,grav ,cp ,msg , & - zi, tpert ,org ,landfrac ,wm_incld) -!----------------------------------------------------------------------- -! -! Purpose: -! Calculates CAPE the lifting condensation level and the convective top -! where buoyancy is first -ve. -! -! Method: Calculates the parcel temperature based on a simple constant -! entraining plume model. CAPE is integrated from buoyancy. -! 09/09/04 - Simplest approach using an assumed entrainment rate for -! testing (dmpdp). -! 08/04/05 - Swap to convert dmpdz to dmpdp -! -! SCAM Logical Switches - DILUTE:RBN - Now Disabled -! --------------------- -! switch(1) = .T. - Uses the dilute parcel calculation to obtain tendencies. -! switch(2) = .T. - Includes entropy/q changes due to condensate loss and freezing. -! switch(3) = .T. - Adds the PBL Tpert for the parcel temperature at all levels. -! -! References: -! Raymond and Blythe (1992) JAS -! -! Author: -! Richard Neale - September 2004 -! -!----------------------------------------------------------------------- - implicit none -!----------------------------------------------------------------------- -! -! input arguments -! - integer, intent(in) :: lchnk ! chunk identifier - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: q(pcols,pver) ! spec. humidity - real(r8), intent(in) :: t(pcols,pver) ! temperature - real(r8), intent(in) :: omega(pcols,pver) ! RBN - Omega to be use in parcel energy calculation. - real(r8), intent(in) :: p(pcols,pver) ! pressure - real(r8), intent(in) :: z(pcols,pver) ! height - real(r8), intent(in) :: pf(pcols,pver+1) ! pressure at interfaces - real(r8), intent(in) :: pblt(pcols) ! index of pbl depth - real(r8), intent(in) :: pbl_z(pcols) ! RBN: Previously diagnosed PBL height - real(r8), intent(in) :: tpert(pcols) ! perturbation temperature by pbl processes - -! RBN: Use z interface for parcel calculations. - real(r8), intent(in) :: zi(pcols,pver+1) ! height at interfaces - -! -! output arguments -! - real(r8), intent(out) :: tp(pcols,pver) ! parcel temperature - real(r8), intent(out) :: qstp(pcols,pver) ! saturation mixing ratio of parcel (only above lcl, just q below). - real(r8), intent(out) :: tl(pcols) ! parcel temperature at lcl - real(r8), intent(out) :: cape(pcols) ! convective aval. pot. energy. - real(r8), intent(out) :: wm_incld(pcols) ! Mean deep convective in-cloud vertical velocity. - - integer lcl(pcols) ! - integer lel(pcols) ! - integer lon(pcols) ! level of onset of deep convection - integer mx(pcols) ! level of max moist static energy - - real(r8), pointer :: org(:,:) ! organization parameter - real(r8), intent(in) :: landfrac(pcols) -! -!--------------------------Local Variables------------------------------ -! - real(r8) capeten(pcols,5) ! provisional value of cape - real(r8) tv(pcols,pver) ! - real(r8) tpv(pcols,pver) ! - real(r8) buoy(pcols,pver) - real(r8) w_incld(pcols,pver) - - - real(r8) a1(pcols) - real(r8) a2(pcols) - real(r8) estp(pcols) - real(r8) pl(pcols) - real(r8) plexp(pcols) - real(r8) hmax(pcols) - real(r8) hmn(pcols) - real(r8) y(pcols) - - logical plge600(pcols) - integer knt(pcols) - integer lelten(pcols,5) - - ! RBN variables for parcel total energy consideration - - - real(r8),parameter :: pini_ke = 200. ! Convective parcel initial kinetic energy (J/kg). - real(r8),parameter :: pe2ke_eff = 1.0_r8 ! PE->KE parcel energy conversion efficiency. - real(r8) :: plev_ke(pcols,pver) ! Parcel kinetic energy at a particular level (J/kg). - real(r8) :: w_nrg(pcols,pver) ! Energy associated with the large scale w(omega) - logical :: first_kelt0(pcols) ! Indicating first time ke<0 in a column. - - ! RBN parcel property variables - - - real(r8) :: hmn_lev(pcols,pver) ! Vertical profile of moist static energy for each column - real(r8) :: dp_lev(pcols,pver) ! Level dpressure between interfaces - real(r8) :: hmn_zdp(pcols,pver) ! Integrals of hmn_lev*dp_lev at each level - real(r8) :: q_zdp(pcols,pver) ! Integrals of q*dp_lev at each level - real(r8) :: dp_zfrac ! Fraction of vertical grid box below mixing top (usually pblt) - real(r8) :: parcel_ztop(pcols) ! Depth of parcel mixing (usually pblt) - real(r8) :: parcel_dp(pcols) ! Pressure integral over parcel mixing depth (usually pblt) - real(r8) :: parcel_hdp(pcols) ! Pressure*MSE integral over parcel mixing depth (usually pblt) - real(r8) :: parcel_qdp(pcols) ! Pressure*q integral over parcel mixing depth (usually pblt) - real(r8) :: hpar(pcols) ! Initial MSE of the parcel - real(r8) :: qpar(pcols) ! Initial humidity of the parcel - real(r8) :: ql(pcols) ! Initial parcel humidity (for ientropy routine) - integer :: ipar ! Index for top of parcel mixing/laucnh level. - - real(r8) cp - real(r8) e - real(r8) grav - - integer i - integer k - integer msg - integer n - - - real(r8) rd - real(r8) rl -#ifdef PERGRO - real(r8) rhd -#endif -! -!----------------------------------------------------------------------- -! - do n = 1,5 - do i = 1,ncol - lelten(i,n) = pver - capeten(i,n) = 0._r8 - end do - end do -! - do i = 1,ncol - lon(i) = pver - knt(i) = 0 - lel(i) = pver - mx(i) = lon(i) - cape(i) = 0._r8 - hmax(i) = 0._r8 - first_kelt0 = .True. -! pbl_z(i) = z(i,pblt(i)) - - parcel_ztop(i) = 0.5_r8*pbl_z(i) ! Boundary layer top for now, could be something else. - parcel_hdp(i) = 0._r8 - parcel_dp(i) = 0._r8 - parcel_qdp(i) = 0._r8 - hpar(i) = 0._r8 - qpar(i) = 0._r8 - end do - - tp(:ncol,:) = t(:ncol,:) - qstp(:ncol,:) = q(:ncol,:) - hmn_lev(:ncol,:) = 0._r8 ! RBN: MSE as a function of ncol and height - -!!! RBN - Initialize tv and buoy for output. -!!! tv=tv : tpv=tpv : qstp=q : buoy=0. - tv(:ncol,:) = t(:ncol,:) *(1._r8+1.608_r8*q(:ncol,:))/ (1._r8+q(:ncol,:)) - tpv(:ncol,:) = tv(:ncol,:) - buoy(:ncol,:) = 0._r8 - plev_ke(:ncol,:) = 0._r8 - w_incld(:ncol,:) = 0._r8 - w_nrg(:ncol,:) = -r_universal*t(:ncol,:)*omega(:ncol,:)/(grav*100._r8*p(:ncol,:)) - - lparcel_pbl = .true. ! Mix parcel properties and level accoring to a mixing length (PBLH mainly) - lparcel_dynamic = .false. ! Enable assumed dynamics of aparcel for buoy. profile and cloud top - - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! RBN - Mix the parcel over a certain dp or dz and take the launch level as the top level -! of this mixing region and the h properties as this mixed value -! Should be well mixed by other processes no in the very near PBL. -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - -if (lparcel_pbl) then - -! Vertical profile of MSE and pressure weighted of the same. - hmn_lev = cp*t + grav*z + rl*q - dp_lev(:ncol,1:pver) = pf(:ncol,2:pver+1)-pf(:ncol,1:pver) - hmn_zdp = hmn_lev*dp_lev - q_zdp = q*dp_lev - - -! Mix profile over vertical length scale of parcel_ztop. -! RBN XXX Still Needs to be fully tested XXXXX - - do i = 1,ncol ! Loop columns - do k = pver,msg + 1,-1 ! Loop levels bottom to top. - - - if (zi(i,k+1) <= parcel_ztop(i)) then ! Has to be relative to surface geo height. - ipar = k - - if (k.eq.pver) then ! Always at least the full depth of lowest model layer. - dp_zfrac = 1._r8 - else - dp_zfrac = min(1._r8,(parcel_ztop(i)-zi(i,k+1))/(zi(i,k)-zi(i,k+1))) ! Fraction of grid cell depth (mostly 1, except when parcel_ztop is in between levels. - end if -! - parcel_hdp(i) = parcel_hdp(i)+hmn_zdp(i,k)*dp_zfrac ! Sum parcel profile up to a certain level. - parcel_qdp(i) = parcel_qdp(i)+q_zdp(i,k)*dp_zfrac ! Sum parcel profile up to a certain level. - parcel_dp(i) = parcel_dp(i)+dp_lev(i,k)*dp_zfrac ! SUM dp's for weighting of parcel_hdp - - end if - end do - - hpar(i) = parcel_hdp(i)/parcel_dp(i) - qpar(i) = parcel_qdp(i)/parcel_dp(i) - mx(i) = ipar - end do - - end if ! RBN: End parcel mixing logic - - - - - - if (.not.lparcel_pbl) then ! Default method finding level of MSE maximum (nlev senstitve though) - ! - ! set "launching" level(mx) to be at maximum moist static energy. - ! search for this level stops at planetary boundary layer top. - ! -#ifdef PERGRO - do k = pver,msg + 1,-1 - do i = 1,ncol - hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) - ! - ! Reset max moist static energy level when relative difference exceeds 1.e-4 - ! - rhd = (hmn(i) - hmax(i))/(hmn(i) + hmax(i)) - if (k >= nint(pblt(i)) .and. k <= lon(i) .and. rhd > -1.e-4_r8) then - hmax(i) = hmn(i) - mx(i) = k - end if - end do - end do -#else - do k = pver,msg + 1,-1 - do i = 1,ncol - hmn(i) = cp*t(i,k) + grav*z(i,k) + rl*q(i,k) - if (k >= nint(pblt(i)) .and. k <= lon(i) .and. hmn(i) > hmax(i)) then - hmax(i) = hmn(i) - mx(i) = k - end if - end do - end do -#endif - -end if ! Default method of determining parcel launch properties. - -! LCL dilute calculation - initialize to mx(i) -! Determine lcl in parcel_dilute and get pl,tl after parcel_dilute -! Original code actually sets LCL as level above where condensate forms. -! Therefore in parcel_dilute lcl(i) will be at first level where qsmix < qtmix. - - -if (lparcel_pbl) then - -! For parcel dilute need to invert hpar and qpar. -! Now need to supply ql(i) as it is mixed parcel version, just q(i,mx(i)) in default - - do i = 1,ncol ! Initialise LCL variables. - - lcl(i) = mx(i) -! tl(i) = (hpar(i)-rl*qpar(i)-grav*parcel_ztop(i))/cp - tl(i) = t(i,mx(i)) - ql(i) = qpar(i) - pl(i) = p(i,mx(i)) - - end do - -else - - do i = 1,ncol - lcl(i) = mx(i) - tl(i) = t(i,mx(i)) - ql(i) = q(i,mx(i)) - pl(i) = p(i,mx(i)) - end do - -end if ! Mixed parcel properties - - - -! -! main buoyancy calculation. -! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! DILUTE PLUME CALCULATION USING ENTRAINING PLUME !!! -!!! RBN 9/9/04 !!! - - call parcel_dilute(lchnk, ncol, msg, mx, p, t, q, & - tpert, tp, tpv, qstp, pl, tl, ql, lcl, & - org, landfrac) - - -! If lcl is above the nominal level of non-divergence (600 mbs), -! no deep convection is permitted (ensuing calculations -! skipped and cape retains initialized value of zero). -! - do i = 1,ncol - plge600(i) = pl(i).ge.600._r8 ! Just change to always allow buoy calculation. - end do - -! -! Main buoyancy calculation. -! - do k = pver,msg + 1,-1 - do i=1,ncol - if (k <= mx(i) .and. plge600(i)) then ! Define buoy from launch level to cloud top. - tv(i,k) = t(i,k)* (1._r8+1.608_r8*q(i,k))/ (1._r8+q(i,k)) - buoy(i,k) = tpv(i,k) - tv(i,k) + tiedke_add ! +0.5K or not? - else - qstp(i,k) = q(i,k) - tp(i,k) = t(i,k) - tpv(i,k) = tv(i,k) - endif - end do - end do - - - -!------------------------------------------------------------------------------- - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! -! -- RBN July 2006 -- -! If parcel obtains a total energy deficit (KE+PE) then -! it detrains. -! Assumes a parcel initial energy and PE->KE conversion -! efficiency. -! -RBN 3 Nov 2008 -! For CIN to really matter need to include the parcel calculation below the LCL -! -! -Calcuated bottom to top -! -Initializes parcel energy with initial value at hmax level -! -Increments KE base on buoyancy conversion with pe2ke efficiency -! -Parcel terminates at level of zero energy - - - - if (lparcel_dynamic) then ! Calculate dynamic parcel energy? - - do k = pver, msg + 2, -1 - do i = 1,ncol - if (k == mx(i)) then - plev_ke(i,k) = pini_ke - end if - if (k < mx(i).and.plge600(i)) then - plev_ke(i,k) = plev_ke(i,k) + pe2ke_eff*rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) + 0.5_r8*w_nrg(i,k)*w_nrg(i,k) - w_incld(i,k) = sqrt(max(0._r8,2._r8*plev_ke(i,k))) - if (plev_ke(i,k) <= 0._r8 .and. first_kelt0(i)) then ! Parcel terminates at level of zero energy - knt(i) = min(num_cin,knt(i) + 1) - lelten(i,knt(i)) = k - first_kelt0(i) = .False. ! Make sure that this bit of code cannot be used once ke<0. - end if - end if - end do - end do - - else ! Or default parcel energy. - - ! Default way to determine plume top - ! -Calculated top to bottom - ! -Starts at LCL - - do k = msg + 2,pver - do i = 1,ncol - if (k < lcl(i) .and. plge600(i)) then - if (buoy(i,k+1) > 0._r8 .and. buoy(i,k) <= 0._r8) then - knt(i) = min(num_cin,knt(i) + 1) - lelten(i,knt(i)) = k - end if - end if - end do - end do - - - end if ! End dynamic parcel logic - - - -! -! calculate convective available potential energy (cape). -! - do n = 1,num_cin - do k = msg + 1,pver - do i = 1,ncol - if (plge600(i) .and. k <= mx(i) .and. k > lelten(i,n)) then - capeten(i,n) = capeten(i,n) + rd*buoy(i,k)*log(pf(i,k+1)/pf(i,k)) - end if - end do - end do - end do -! -! find maximum cape from all possible tentative capes from -! one sounding, -! and use it as the final cape, april 26, 1995 -! - do n = 1,num_cin - do i = 1,ncol - if (capeten(i,n) > cape(i)) then - cape(i) = capeten(i,n) - lel(i) = lelten(i,n) - end if - end do - end do - -! For dynamic parcel, Now we know convective top let's find mean in-cloud w - - if (lparcel_dynamic) then - do k = msg + 1,pver - do i = 1,ncol - if ( k >= lel(i) .and. k <= lcl(i) - 1) then - wm_incld(i) = wm_incld(i)+w_incld(i,k)*(pf(i,k+1)-pf(i,k))/(pf(i,lcl(i))-pf(i,lel(i))) - end if - end do - end do - - write(iulog,*)'WMINCLD =',wm_incld - write(iulog,*)'MINCLD =',w_incld - - end if - - call outfld('WINCLD', w_incld, pcols, lchnk) - call outfld('LCL',real(lcl,r8),pcols, lchnk) - call outfld('KHMAX',real(mx,r8),pcols, lchnk) - call outfld('PLCL', pl, pcols, lchnk) ! Pressure at the lifting condensation level. - call outfld('TLCL', tl, pcols, lchnk) ! Temp " - call outfld('LEL', real(lel,r8), pcols, lchnk) ! Level of neutral buoy - call outfld('HMAX', hmax, pcols, lchnk) - call outfld('KEPAR', plev_ke, pcols, lchnk) ! Parcel K.E. - call outfld('BUOY', buoy, pcols, lchnk) - call outfld('MWINCLD',wm_incld, pcols, lchnk) ! In-cloud vertical velocity - - -! -! put lower bound on cape for diagnostic purposes. -! - do i = 1,ncol - cape(i) = max(cape(i), 0._r8) - end do -! - return -end subroutine buoyan_dilute - -subroutine parcel_dilute (lchnk, ncol, msg, klaunch, p, t, q, & - tpert, tp, tpv, qstp, pl, tl, ql, lcl, & - org, landfrac) - -! Routine to determine -! 1. Tp - Parcel temperature -! 2. qstp - Saturated mixing ratio at the parcel temperature. - -!-------------------- -implicit none -!-------------------- - -integer, intent(in) :: lchnk -integer, intent(in) :: ncol -integer, intent(in) :: msg - -integer, intent(in), dimension(pcols) :: klaunch(pcols) - -real(r8), intent(in), dimension(pcols,pver) :: p -real(r8), intent(in), dimension(pcols,pver) :: t -real(r8), intent(in), dimension(pcols,pver) :: q -real(r8), intent(in), dimension(pcols) :: tpert ! PBL temperature perturbation. - -real(r8), intent(inout), dimension(pcols,pver) :: tp ! Parcel temp. -real(r8), intent(inout), dimension(pcols,pver) :: qstp ! Parcel water vapour (sat value above lcl). -real(r8), intent(inout), dimension(pcols) :: tl ! Actual temp of LCL. -real(r8), intent(inout), dimension(pcols) :: ql ! Actual humidity of LCL -real(r8), intent(inout), dimension(pcols) :: pl ! Actual pressure of LCL. - -integer, intent(inout), dimension(pcols) :: lcl ! Lifting condesation level (first model level with saturation). - -real(r8), intent(out), dimension(pcols,pver) :: tpv ! Define tpv within this routine. - -real(r8), pointer, dimension(:,:) :: org -real(r8), intent(in), dimension(pcols) :: landfrac -!-------------------- - -! Have to be careful as s is also dry static energy. - - -! If we are to retain the fact that CAM loops over grid-points in the internal -! loop then we need to dimension sp,atp,mp,xsh2o with ncol. - - -real(r8) tmix(pcols,pver) ! Tempertaure of the entraining parcel. -real(r8) qtmix(pcols,pver) ! Total water of the entraining parcel. -real(r8) qsmix(pcols,pver) ! Saturated mixing ratio at the tmix. -real(r8) smix(pcols,pver) ! Entropy of the entraining parcel. -real(r8) xsh2o(pcols,pver) ! Precipitate lost from parcel. -real(r8) ds_xsh2o(pcols,pver) ! Entropy change due to loss of condensate. -real(r8) ds_freeze(pcols,pver) ! Entropy change sue to freezing of precip. -real(r8) dmpdz2d(pcols,pver) ! variable detrainment rate - -real(r8) mp(pcols) ! Parcel mass flux. -real(r8) qtp(pcols) ! Parcel total water. -real(r8) sp(pcols) ! Parcel entropy. - -real(r8) sp0(pcols) ! Parcel launch entropy. -real(r8) qtp0(pcols) ! Parcel launch total water. -real(r8) mp0(pcols) ! Parcel launch relative mass flux. - -real(r8) lwmax ! Maximum condesate that can be held in cloud before rainout. -real(r8) dmpdp ! Parcel fractional mass entrainment rate (/mb). -!real(r8) dmpdpc ! In cloud parcel mass entrainment rate (/mb). -real(r8) dmpdz ! Parcel fractional mass entrainment rate (/m) -real(r8) dpdz,dzdp ! Hydrstatic relation and inverse of. -real(r8) senv ! Environmental entropy at each grid point. -real(r8) qtenv ! Environmental total water " " ". -real(r8) penv ! Environmental total pressure " " ". -real(r8) tenv ! Environmental total temperature " " ". -real(r8) new_s ! Hold value for entropy after condensation/freezing adjustments. -real(r8) new_q ! Hold value for total water after condensation/freezing adjustments. -real(r8) dp ! Layer thickness (center to center) -real(r8) tfguess ! First guess for entropy inversion - crucial for efficiency! -real(r8) tscool ! Super cooled temperature offset (in degC) (eg -35). - -real(r8) qxsk, qxskp1 ! LCL excess water (k, k+1) -real(r8) dsdp, dqtdp, dqxsdp ! LCL s, qt, p gradients (k, k+1) -real(r8) slcl,qtlcl,qslcl ! LCL s, qt, qs values. -real(r8) org2rkm, org2Tpert -real(r8) dmpdz_lnd, dmpdz_mask - -integer rcall ! Number of ientropy call for errors recording -integer nit_lheat ! Number of iterations for condensation/freezing loop. -integer i,k,ii ! Loop counters. - -!====================================================================== -! SUMMARY -! -! 9/9/04 - Assumes parcel is initiated from level of maxh (klaunch) -! and entrains at each level with a specified entrainment rate. -! -! 15/9/04 - Calculates lcl(i) based on k where qsmix is first < qtmix. -! -!====================================================================== -! -! Set some values that may be changed frequently. -! - -if (zm_org) then - org2rkm = 10._r8 - org2Tpert = 0._r8 -endif -nit_lheat = 2 ! iterations for ds,dq changes from condensation freezing. -dmpdz=-1.e-3_r8 ! Entrainment rate. (-ve for /m) -dmpdz_lnd=-1.e-3_r8 -!dmpdpc = 3.e-2_r8 ! In cloud entrainment rate (/mb). -lwmax = 1.e-3_r8 ! Need to put formula in for this. -tscool = -10.0_r8 ! Temp at which water loading freezes in the cloud. - -qtmix=0._r8 -smix=0._r8 - -qtenv = 0._r8 -senv = 0._r8 -tenv = 0._r8 -penv = 0._r8 - -qtp0 = 0._r8 -sp0 = 0._r8 -mp0 = 0._r8 - -qtp = 0._r8 -sp = 0._r8 -mp = 0._r8 - -new_q = 0._r8 -new_s = 0._r8 - -! **** Begin loops **** - -do k = pver, msg+1, -1 - do i=1,ncol - -! Initialize parcel values at launch level. - - if (k == klaunch(i)) then - qtp0(i) = ql(i) ! Parcel launch q (could be environment (default] or a BL mixed value. -! qtp0(i) = q(i,k) ! Parcel launch total water (assuming subsaturated) - OK????. - sp0(i) = entropy(tl(i),pl(i),qtp0(i)) ! Parcel launch entropy could be a mixed parcel. - mp0(i) = 1._r8 ! Parcel launch relative mass (i.e. 1 parcel stays 1 parcel for dmpdp=0, undilute). - smix(i,k) = sp0(i) - qtmix(i,k) = qtp0(i) - tfguess = t(i,k) - rcall = 1 - call ientropy (rcall,i,lchnk,smix(i,k),p(i,k),qtmix(i,k),tmix(i,k),qsmix(i,k),tfguess) - end if - -! Entraining levels - - if (k < klaunch(i)) then - -! Set environmental values for this level. - - dp = (p(i,k)-p(i,k+1)) ! In -ve mb as p decreasing with height - difference between center of layers. - qtenv = 0.5_r8*(q(i,k)+q(i,k+1)) ! Total water of environment. - tenv = 0.5_r8*(t(i,k)+t(i,k+1)) - penv = 0.5_r8*(p(i,k)+p(i,k+1)) - - senv = entropy(tenv,penv,qtenv) ! Entropy of environment. - -! Determine fractional entrainment rate /pa given value /m. - - dpdz = -(penv*grav)/(rgas*tenv) ! in mb/m since p in mb. - dzdp = 1._r8/dpdz ! in m/mb - if (zm_org) then - dmpdz_mask = landfrac(i) * dmpdz_lnd + (1._r8 - landfrac(i)) * dmpdz - dmpdp = (dmpdz_mask/(1._r8+org(i,k)*org2rkm))*dzdp ! /mb Fractional entrainment - else - dmpdp = dmpdz*dzdp - endif - -! Sum entrainment to current level -! entrains q,s out of intervening dp layers, in which linear variation is assumed -! so really it entrains the mean of the 2 stored values. - - sp(i) = sp(i) - dmpdp*dp*senv - qtp(i) = qtp(i) - dmpdp*dp*qtenv - mp(i) = mp(i) - dmpdp*dp - -! Entrain s and qt to next level. - - smix(i,k) = (sp0(i) + sp(i)) / (mp0(i) + mp(i)) - qtmix(i,k) = (qtp0(i) + qtp(i)) / (mp0(i) + mp(i)) - -! Invert entropy from s and q to determine T and saturation-capped q of mixture. -! t(i,k) used as a first guess so that it converges faster. - - tfguess = tmix(i,k+1) - rcall = 2 - call ientropy(rcall,i,lchnk,smix(i,k),p(i,k),qtmix(i,k),tmix(i,k),qsmix(i,k),tfguess) - -! -! Determine if this is lcl of this column if qsmix <= qtmix. -! FIRST LEVEL where this happens on ascending. - - if (qsmix(i,k) <= qtmix(i,k) .and. qsmix(i,k+1) > qtmix(i,k+1)) then - lcl(i) = k - qxsk = qtmix(i,k) - qsmix(i,k) - qxskp1 = qtmix(i,k+1) - qsmix(i,k+1) - dqxsdp = (qxsk - qxskp1)/dp - pl(i) = p(i,k+1) - qxskp1/dqxsdp ! pressure level of actual lcl. - dsdp = (smix(i,k) - smix(i,k+1))/dp - dqtdp = (qtmix(i,k) - qtmix(i,k+1))/dp - slcl = smix(i,k+1) + dsdp* (pl(i)-p(i,k+1)) - qtlcl = qtmix(i,k+1) + dqtdp*(pl(i)-p(i,k+1)) - - tfguess = tmix(i,k) - rcall = 3 - call ientropy (rcall,i,lchnk,slcl,pl(i),qtlcl,tl(i),qslcl,tfguess) - -! write(iulog,*)' ' -! write(iulog,*)' p',p(i,k+1),pl(i),p(i,lcl(i)) -! write(iulog,*)' t',tmix(i,k+1),tl(i),tmix(i,lcl(i)) -! write(iulog,*)' s',smix(i,k+1),slcl,smix(i,lcl(i)) -! write(iulog,*)'qt',qtmix(i,k+1),qtlcl,qtmix(i,lcl(i)) -! write(iulog,*)'qs',qsmix(i,k+1),qslcl,qsmix(i,lcl(i)) - - endif -! - end if ! k < klaunch - - - end do ! Levels loop -end do ! Columns loop - -!!!!!!!!!!!!!!!!!!!!!!!!!!END ENTRAINMENT LOOP!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -!! Could stop now and test with this as it will provide some estimate of buoyancy -!! without the effects of freezing/condensation taken into account for tmix. - -!! So we now have a profile of entropy and total water of the entraining parcel -!! Varying with height from the launch level klaunch parcel=environment. To the -!! top allowed level for the existence of convection. - -!! Now we have to adjust these values such that the water held in vaopor is < or -!! = to qsmix. Therefore, we assume that the cloud holds a certain amount of -!! condensate (lwmax) and the rest is rained out (xsh2o). This, obviously -!! provides latent heating to the mixed parcel and so this has to be added back -!! to it. But does this also increase qsmix as well? Also freezing processes - - -xsh2o = 0._r8 -ds_xsh2o = 0._r8 -ds_freeze = 0._r8 - -!!!!!!!!!!!!!!!!!!!!!!!!!PRECIPITATION/FREEZING LOOP!!!!!!!!!!!!!!!!!!!!!!!!!! -!! Iterate solution twice for accuracy - - - -do k = pver, msg+1, -1 - do i=1,ncol - -! Initialize variables at k=klaunch - - if (k == klaunch(i)) then - -! Set parcel values at launch level assume no liquid water. - - tp(i,k) = tmix(i,k) - qstp(i,k) = q(i,k) - if (zm_org) then - tpv(i,k) = (tp(i,k) + (org2Tpert*org(i,k)+tpert(i))) * (1._r8+1.608_r8*qstp(i,k)) / (1._r8+qstp(i,k)) - else - tpv(i,k) = (tp(i,k) + tpert(i)) * (1._r8+1.608_r8*qstp(i,k)) / (1._r8+qstp(i,k)) - endif - - end if - - if (k < klaunch(i)) then - -! Initiate loop if switch(2) = .T. - RBN:DILUTE - TAKEN OUT BUT COULD BE RETURNED LATER. - -! Iterate nit_lheat times for s,qt changes. - - do ii=0,nit_lheat-1 - -! Rain (xsh2o) is excess condensate, bar LWMAX (Accumulated loss from qtmix). - - xsh2o(i,k) = max (0._r8, qtmix(i,k) - qsmix(i,k) - lwmax) - -! Contribution to ds from precip loss of condensate (Accumulated change from smix).(-ve) - - ds_xsh2o(i,k) = ds_xsh2o(i,k+1) - cpliq * log (tmix(i,k)/tfreez) * max(0._r8,(xsh2o(i,k)-xsh2o(i,k+1))) -! -! Entropy of freezing: latice times amount of water involved divided by T. -! - - if (tmix(i,k) <= tfreez+tscool .and. ds_freeze(i,k+1) == 0._r8) then ! One off freezing of condensate. - ds_freeze(i,k) = (latice/tmix(i,k)) * max(0._r8,qtmix(i,k)-qsmix(i,k)-xsh2o(i,k)) ! Gain of LH - end if - - if (tmix(i,k) <= tfreez+tscool .and. ds_freeze(i,k+1) /= 0._r8) then ! Continual freezing of additional condensate. - ds_freeze(i,k) = ds_freeze(i,k+1)+(latice/tmix(i,k)) * max(0._r8,(qsmix(i,k+1)-qsmix(i,k))) - end if - -! Adjust entropy and accordingly to sum of ds (be careful of signs). - - new_s = smix(i,k) + ds_xsh2o(i,k) + ds_freeze(i,k) - -! Adjust liquid water and accordingly to xsh2o. - - new_q = qtmix(i,k) - xsh2o(i,k) - -! Invert entropy to get updated Tmix and qsmix of parcel. - - tfguess = tmix(i,k) - rcall = 4 - call ientropy (rcall,i,lchnk,new_s, p(i,k), new_q, tmix(i,k), qsmix(i,k), tfguess) - - end do ! Iteration loop for freezing processes. - -! tp - Parcel temp is temp of mixture. -! tpv - Parcel v. temp should be density temp with new_q total water. - - tp(i,k) = tmix(i,k) - -! tpv = tprho in the presence of condensate (i.e. when new_q > qsmix) - - if (new_q > qsmix(i,k)) then ! Super-saturated so condensate present - reduces buoyancy. - qstp(i,k) = qsmix(i,k) - else ! Just saturated/sub-saturated - no condensate virtual effects. - qstp(i,k) = new_q - end if - - if (zm_org) then - tpv(i,k) = (tp(i,k)+(org2Tpert*org(i,k)+tpert(i)))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+ new_q) - else - tpv(i,k) = (tp(i,k)+tpert(i))* (1._r8+1.608_r8*qstp(i,k)) / (1._r8+ new_q) - endif - - end if ! k < klaunch - - end do ! Loop for columns - -end do ! Loop for vertical levels. - - -return -end subroutine parcel_dilute - -!----------------------------------------------------------------------------------------- -real(r8) function entropy(TK,p,qtot) -!----------------------------------------------------------------------------------------- -! -! TK(K),p(mb),qtot(kg/kg) -! from Raymond and Blyth 1992 -! - real(r8), intent(in) :: p,qtot,TK - real(r8) :: qv,qst,e,est,L - real(r8), parameter :: pref = 1000._r8 - -L = rl - (cpliq - cpwv)*(TK-tfreez) ! T IN CENTIGRADE - -call qsat_hPa(TK, p, est, qst) - -qv = min(qtot,qst) ! Partition qtot into vapor part only. -e = qv*p / (eps1 +qv) - -entropy = (cpres + qtot*cpliq)*log( TK/tfreez) - rgas*log( (p-e)/pref ) + & - L*qv/TK - qv*rh2o*log(qv/qst) - -end FUNCTION entropy - -! -!----------------------------------------------------------------------------------------- -SUBROUTINE ientropy (rcall,icol,lchnk,s,p,qt,T,qst,Tfg) -!----------------------------------------------------------------------------------------- -! -! p(mb), Tfg/T(K), qt/qv(kg/kg), s(J/kg). -! Inverts entropy, pressure and total water qt -! for T and saturated vapor mixing ratio -! - - use phys_grid, only: get_rlon_p, get_rlat_p - - integer, intent(in) :: icol, lchnk, rcall - real(r8), intent(in) :: s, p, Tfg, qt - real(r8), intent(out) :: qst, T - real(r8) :: est, this_lat,this_lon - real(r8) :: a,b,c,d,ebr,fa,fb,fc,pbr,qbr,rbr,sbr,tol1,xm,tol - integer :: i - - logical :: converged - - ! Max number of iteration loops. - integer, parameter :: LOOPMAX = 100 - real(r8), parameter :: EPS = 3.e-8_r8 - - converged = .false. - - ! Invert the entropy equation -- use Brent's method - ! Brent, R. P. Ch. 3-4 in Algorithms for Minimization Without Derivatives. Englewood Cliffs, NJ: Prentice-Hall, 1973. - - T = Tfg ! Better first guess based on Tprofile from conv. - - a = Tfg-10 !low bracket - b = Tfg+10 !high bracket - - fa = entropy(a, p, qt) - s - fb = entropy(b, p, qt) - s - - c=b - fc=fb - tol=0.001_r8 - - converge: do i=0, LOOPMAX - if ((fb > 0.0_r8 .and. fc > 0.0_r8) .or. & - (fb < 0.0_r8 .and. fc < 0.0_r8)) then - c=a - fc=fa - d=b-a - ebr=d - end if - if (abs(fc) < abs(fb)) then - a=b - b=c - c=a - fa=fb - fb=fc - fc=fa - end if - - tol1=2.0_r8*EPS*abs(b)+0.5_r8*tol - xm=0.5_r8*(c-b) - converged = (abs(xm) <= tol1 .or. fb == 0.0_r8) - if (converged) exit converge - - if (abs(ebr) >= tol1 .and. abs(fa) > abs(fb)) then - sbr=fb/fa - if (a == c) then - pbr=2.0_r8*xm*sbr - qbr=1.0_r8-sbr - else - qbr=fa/fc - rbr=fb/fc - pbr=sbr*(2.0_r8*xm*qbr*(qbr-rbr)-(b-a)*(rbr-1.0_r8)) - qbr=(qbr-1.0_r8)*(rbr-1.0_r8)*(sbr-1.0_r8) - end if - if (pbr > 0.0_r8) qbr=-qbr - pbr=abs(pbr) - if (2.0_r8*pbr < min(3.0_r8*xm*qbr-abs(tol1*qbr),abs(ebr*qbr))) then - ebr=d - d=pbr/qbr - else - d=xm - ebr=d - end if - else - d=xm - ebr=d - end if - a=b - fa=fb - b=b+merge(d,sign(tol1,xm), abs(d) > tol1 ) - - fb = entropy(b, p, qt) - s - - end do converge - - T = b - call qsat_hPa(T, p, est, qst) - - if (.not. converged) then - this_lat = get_rlat_p(lchnk, icol)*57.296_r8 - this_lon = get_rlon_p(lchnk, icol)*57.296_r8 - write(iulog,*) '*** ZM_CONV: IENTROPY: Failed and about to exit, info follows ****' - write(iulog,100) 'ZM_CONV: IENTROPY. Details: call#,lchnk,icol= ',rcall,lchnk,icol, & - ' lat: ',this_lat,' lon: ',this_lon, & - ' P(mb)= ', p, ' Tfg(K)= ', Tfg, ' qt(g/kg) = ', 1000._r8*qt, & - ' qst(g/kg) = ', 1000._r8*qst,', s(J/kg) = ',s - call endrun('**** ZM_CONV IENTROPY: Tmix did not converge ****') - end if - -100 format (A,I1,I4,I4,7(A,F6.2)) - -end SUBROUTINE ientropy - -! Wrapper for qsat_water that does translation between Pa and hPa -! qsat_water uses Pa internally, so get it right, need to pass in Pa. -! Afterward, set es back to hPa. -subroutine qsat_hPa(t, p, es, qm) - use wv_saturation, only: qsat_water - - ! Inputs - real(r8), intent(in) :: t ! Temperature (K) - real(r8), intent(in) :: p ! Pressure (hPa) - ! Outputs - real(r8), intent(out) :: es ! Saturation vapor pressure (hPa) - real(r8), intent(out) :: qm ! Saturation mass mixing ratio - ! (vapor mass over dry mass, kg/kg) - - call qsat_water(t, p*100._r8, es, qm) - - es = es*0.01_r8 - -end subroutine qsat_hPa - -end module zm_conv diff --git a/src/physics/cam_dev/zm_conv_intr.F90 b/src/physics/cam_dev/zm_conv_intr.F90 deleted file mode 100644 index 893536c076..0000000000 --- a/src/physics/cam_dev/zm_conv_intr.F90 +++ /dev/null @@ -1,1405 +0,0 @@ -module zm_conv_intr -!--------------------------------------------------------------------------------- -! Purpose: -! -! CAM interface to the Zhang-McFarlane deep convection scheme -! -! Author: D.B. Coleman -! January 2010 modified by J. Kay to add COSP simulator fields to physics buffer -!--------------------------------------------------------------------------------- - use shr_kind_mod, only: r8=>shr_kind_r8 - use physconst, only: cpair - use ppgrid, only: pver, pcols, pverp, begchunk, endchunk - use zm_conv, only: zm_conv_evap, zm_convr, convtran, momtran - use zm_microphysics, only: zm_aero_t, zm_conv_t - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num, rad_cnst_get_aer_mmr, & - rad_cnst_get_aer_props, rad_cnst_get_mode_props !, & - use ndrop_bam, only: ndrop_bam_init - use cam_abortutils, only: endrun - use physconst, only: pi - use spmd_utils, only: masterproc - use perf_mod - use cam_logfile, only: iulog - use constituents, only: cnst_add - - implicit none - private - save - - ! Public methods - - public ::& - zm_conv_register, &! register fields in physics buffer - zm_conv_readnl, &! read namelist - zm_conv_init, &! initialize donner_deep module - zm_conv_tend, &! return tendencies - zm_conv_tend_2 ! return tendencies - - public :: zmconv_microp - - integer ::& ! indices for fields in the physics buffer - zm_mu_idx, & - zm_eu_idx, & - zm_du_idx, & - zm_md_idx, & - zm_ed_idx, & - zm_dp_idx, & - zm_dsubcld_idx, & - zm_jt_idx, & - zm_maxg_idx, & - zm_ideep_idx, & - dp_flxprc_idx, & - dp_flxsnw_idx, & - dp_cldliq_idx, & - ixorg, & - dp_cldice_idx, & - dlfzm_idx, & ! detrained convective cloud water mixing ratio. - difzm_idx, & ! detrained convective cloud ice mixing ratio. - dnlfzm_idx, & ! detrained convective cloud water num concen. - dnifzm_idx, & ! detrained convective cloud ice num concen. - prec_dp_idx, & - snow_dp_idx, & - mconzm_idx ! convective mass flux (Adam's reorder) - - - real(r8), parameter :: unset_r8 = huge(1.0_r8) - real(r8) :: zmconv_c0_lnd = unset_r8 - real(r8) :: zmconv_c0_ocn = unset_r8 - real(r8) :: zmconv_ke = unset_r8 - real(r8) :: zmconv_ke_lnd = unset_r8 - real(r8) :: zmconv_momcu = unset_r8 - real(r8) :: zmconv_momcd = unset_r8 - integer :: zmconv_num_cin ! Number of negative buoyancy regions that are allowed - ! before the convection top and CAPE calculations are completed. - logical :: zmconv_org ! Parameterization for sub-grid scale convective organization for the ZM deep - ! convective scheme based on Mapes and Neale (2011) - logical :: zmconv_microp = .false. ! switch for microphysics - - -! indices for fields in the physics buffer - integer :: cld_idx = 0 - integer :: icwmrdp_idx = 0 - integer :: rprddp_idx = 0 - integer :: fracis_idx = 0 - integer :: nevapr_dpcu_idx = 0 - integer :: dgnum_idx = 0 - - integer :: nmodes - integer :: nbulk - - type(zm_aero_t), allocatable :: aero(:) ! object contains information about the aerosols - -!========================================================================================= -contains -!========================================================================================= - -subroutine zm_conv_register - -!---------------------------------------- -! Purpose: register fields with the physics buffer -!---------------------------------------- - - use physics_buffer, only : pbuf_add_field, dtype_r8, dtype_i4 - - implicit none - - integer idx - - call pbuf_add_field('ZM_MU', 'physpkg', dtype_r8, (/pcols,pver/), zm_mu_idx) - call pbuf_add_field('ZM_EU', 'physpkg', dtype_r8, (/pcols,pver/), zm_eu_idx) - call pbuf_add_field('ZM_DU', 'physpkg', dtype_r8, (/pcols,pver/), zm_du_idx) - call pbuf_add_field('ZM_MD', 'physpkg', dtype_r8, (/pcols,pver/), zm_md_idx) - call pbuf_add_field('ZM_ED', 'physpkg', dtype_r8, (/pcols,pver/), zm_ed_idx) - - ! wg layer thickness in mbs (between upper/lower interface). - call pbuf_add_field('ZM_DP', 'physpkg', dtype_r8, (/pcols,pver/), zm_dp_idx) - - ! wg layer thickness in mbs between lcl and maxi. - call pbuf_add_field('ZM_DSUBCLD', 'physpkg', dtype_r8, (/pcols/), zm_dsubcld_idx) - - ! wg top level index of deep cumulus convection. - call pbuf_add_field('ZM_JT', 'physpkg', dtype_i4, (/pcols/), zm_jt_idx) - - ! wg gathered values of maxi. - call pbuf_add_field('ZM_MAXG', 'physpkg', dtype_i4, (/pcols/), zm_maxg_idx) - - ! map gathered points to chunk index - call pbuf_add_field('ZM_IDEEP', 'physpkg', dtype_i4, (/pcols/), zm_ideep_idx) - -! Flux of precipitation from deep convection (kg/m2/s) - call pbuf_add_field('DP_FLXPRC','global',dtype_r8,(/pcols,pverp/),dp_flxprc_idx) - -! Flux of snow from deep convection (kg/m2/s) - call pbuf_add_field('DP_FLXSNW','global',dtype_r8,(/pcols,pverp/),dp_flxsnw_idx) - -! deep gbm cloud liquid water (kg/kg) - call pbuf_add_field('DP_CLDLIQ','global',dtype_r8,(/pcols,pver/), dp_cldliq_idx) - -! deep gbm cloud liquid water (kg/kg) - call pbuf_add_field('DP_CLDICE','global',dtype_r8,(/pcols,pver/), dp_cldice_idx) - - call pbuf_add_field('ICWMRDP', 'physpkg',dtype_r8,(/pcols,pver/),icwmrdp_idx) - call pbuf_add_field('RPRDDP', 'physpkg',dtype_r8,(/pcols,pver/),rprddp_idx) - call pbuf_add_field('NEVAPR_DPCU','physpkg',dtype_r8,(/pcols,pver/),nevapr_dpcu_idx) - call pbuf_add_field('PREC_DP', 'physpkg',dtype_r8,(/pcols/), prec_dp_idx) - call pbuf_add_field('SNOW_DP', 'physpkg',dtype_r8,(/pcols/), snow_dp_idx) - - ! detrained convective cloud water mixing ratio. - call pbuf_add_field('DLFZM', 'physpkg', dtype_r8, (/pcols,pver/), dlfzm_idx) - ! detrained convective cloud ice mixing ratio. - call pbuf_add_field('DIFZM', 'physpkg', dtype_r8, (/pcols,pver/), difzm_idx) - ! convective mass fluxes - call pbuf_add_field('CMFMCDZM', 'physpkg', dtype_r8, (/pcols,pverp/), mconzm_idx) - - if (zmconv_microp) then - ! Only add the number conc fields if the microphysics is active. - - ! detrained convective cloud water num concen. - call pbuf_add_field('DNLFZM', 'physpkg', dtype_r8, (/pcols,pver/), dnlfzm_idx) - ! detrained convective cloud ice num concen. - call pbuf_add_field('DNIFZM', 'physpkg', dtype_r8, (/pcols,pver/), dnifzm_idx) - end if - - if (zmconv_org) then - call cnst_add('ZM_ORG',0._r8,0._r8,0._r8,ixorg,longname='organization parameter') - endif - -end subroutine zm_conv_register - -!========================================================================================= - -subroutine zm_conv_readnl(nlfile) - - use spmd_utils, only: mpicom, masterproc, masterprocid, mpi_real8, mpi_integer, mpi_logical - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - - ! Local variables - integer :: unitn, ierr - character(len=*), parameter :: subname = 'zm_conv_readnl' - - namelist /zmconv_nl/ zmconv_c0_lnd, zmconv_c0_ocn, zmconv_num_cin, & - zmconv_ke, zmconv_ke_lnd, zmconv_org, & - zmconv_momcu, zmconv_momcd, zmconv_microp - !----------------------------------------------------------------------------- - - if (masterproc) then - unitn = getunit() - open( unitn, file=trim(nlfile), status='old' ) - call find_group_name(unitn, 'zmconv_nl', status=ierr) - if (ierr == 0) then - read(unitn, zmconv_nl, iostat=ierr) - if (ierr /= 0) then - call endrun(subname // ':: ERROR reading namelist') - end if - end if - close(unitn) - call freeunit(unitn) - - end if - - ! Broadcast namelist variables - call mpi_bcast(zmconv_num_cin, 1, mpi_integer, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_num_cin") - call mpi_bcast(zmconv_c0_lnd, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_c0_lnd") - call mpi_bcast(zmconv_c0_ocn, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_c0_ocn") - call mpi_bcast(zmconv_ke, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_ke") - call mpi_bcast(zmconv_ke_lnd, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_ke_lnd") - call mpi_bcast(zmconv_momcu, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_momcu") - call mpi_bcast(zmconv_momcd, 1, mpi_real8, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_momcd") - call mpi_bcast(zmconv_org, 1, mpi_logical, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_org") - call mpi_bcast(zmconv_microp, 1, mpi_logical, masterprocid, mpicom, ierr) - if (ierr /= 0) call endrun("zm_conv_readnl: FATAL: mpi_bcast: zmconv_microp") - -end subroutine zm_conv_readnl - -!========================================================================================= - -subroutine zm_conv_init(pref_edge) - -!---------------------------------------- -! Purpose: declare output fields, initialize variables needed by convection -!---------------------------------------- - - use cam_history, only: addfld, add_default, horiz_only - use ppgrid, only: pcols, pver - use zm_conv, only: zm_convi - use pmgrid, only: plev,plevp - use spmd_utils, only: masterproc - use phys_control, only: phys_deepconv_pbl, phys_getopts, cam_physpkg_is - use physics_buffer, only: pbuf_get_index - - implicit none - - real(r8),intent(in) :: pref_edge(plevp) ! reference pressures at interfaces - - - logical :: no_deep_pbl ! if true, no deep convection in PBL - integer limcnv ! top interface level limit for convection - integer k, istat - logical :: history_budget ! output tendencies and state variables for CAM4 - ! temperature, water vapor, cloud ice and cloud - ! liquid budgets. - integer :: history_budget_histfile_num ! output history file number for budget fields - -! Allocate the basic aero structure outside the zmconv_microp logical -! This allows the aero structure to be passed -! Note that all of the arrays inside this structure are conditionally allocated - - allocate(aero(begchunk:endchunk)) - -! -! Register fields with the output buffer -! - - if (zmconv_org) then - call addfld ('ZM_ORG ', (/ 'lev' /), 'A', '- ','Organization parameter') - call addfld ('ZM_ORG2D ', (/ 'lev' /), 'A', '- ','Organization parameter 2D') - endif - call addfld ('PRECZ', horiz_only, 'A', 'm/s','total precipitation from ZM convection') - call addfld ('ZMDT', (/ 'lev' /), 'A', 'K/s','T tendency - Zhang-McFarlane moist convection') - call addfld ('ZMDQ', (/ 'lev' /), 'A', 'kg/kg/s','Q tendency - Zhang-McFarlane moist convection') - call addfld ('ZMDICE', (/ 'lev' /), 'A', 'kg/kg/s','Cloud ice tendency - Zhang-McFarlane convection') - call addfld ('ZMDLIQ', (/ 'lev' /), 'A', 'kg/kg/s','Cloud liq tendency - Zhang-McFarlane convection') - call addfld ('EVAPTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Evaporation/snow prod from Zhang convection') - call addfld ('FZSNTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Rain to snow conversion from Zhang convection') - call addfld ('EVSNTZM', (/ 'lev' /), 'A', 'K/s','T tendency - Snow to rain prod from Zhang convection') - call addfld ('EVAPQZM', (/ 'lev' /), 'A', 'kg/kg/s','Q tendency - Evaporation from Zhang-McFarlane moist convection') - - call addfld ('ZMFLXPRC', (/ 'ilev' /), 'A', 'kg/m2/s','Flux of precipitation from ZM convection' ) - call addfld ('ZMFLXSNW', (/ 'ilev' /), 'A', 'kg/m2/s','Flux of snow from ZM convection' ) - call addfld ('ZMNTPRPD', (/ 'lev' /) , 'A', 'kg/kg/s','Net precipitation production from ZM convection') - call addfld ('ZMNTSNPD', (/ 'lev' /) , 'A', 'kg/kg/s','Net snow production from ZM convection' ) - call addfld ('ZMEIHEAT', (/ 'lev' /) , 'A', 'W/kg' ,'Heating by ice and evaporation in ZM convection') - - call addfld ('CMFMCDZM', (/ 'ilev' /), 'A', 'kg/m2/s','Convection mass flux from ZM deep ') - call addfld ('PRECCDZM', horiz_only, 'A', 'm/s','Convective precipitation rate from ZM deep') - - call addfld ('PCONVB', horiz_only , 'A', 'Pa' ,'convection base pressure') - call addfld ('PCONVT', horiz_only , 'A', 'Pa' ,'convection top pressure') - - call addfld ('CAPE', horiz_only, 'A', 'J/kg', 'Convectively available potential energy') - call addfld ('FREQZM', horiz_only , 'A', 'fraction', 'Fractional occurance of ZM convection') - -! RBN: Output variables for more detailed ZM analysis (+dynamica parcel and tau) - - call addfld ('TAUZM', horiz_only, 'A', '/s ', 'ZM deep convection timescale') - call addfld ('WINCLD', (/ 'lev' /), 'A', 'm/s ', 'Deep convective in-cloud vertical velocity') - call addfld ('KEPAR', (/ 'lev' /), 'A', 'J/kg ', 'Convective parcel kinetic energy') - call addfld ('BUOY', (/ 'lev' /), 'A', 'K ', 'Buoyancy as temperature') - - call addfld ('MWINCLD', horiz_only,'A','m/s ', 'Deep convective mean in-cloud vertical velocity') - call addfld ('HMAX', horiz_only,'A','unitless', 'Moist Static energy maximum') - call addfld ('LCL', horiz_only,'A','unitless', 'Lifting condensation model level index') - call addfld ('LEL', horiz_only,'A','unitless', 'Convective top negative buoyancy level index') - call addfld ('KHMAX', horiz_only,'A','unitless', 'Moist Static energy maximum level index') - call addfld ('TLCL', horiz_only,'A','K ', 'Temperature at the lifting condensation level') - call addfld ('PLCL', horiz_only,'A','K ', 'Pressure at the lifting condensation level') - -!!!! - - call addfld ('ZMMTT', (/ 'lev' /), 'A', 'K/s', 'T tendency - ZM convective momentum transport') - call addfld ('ZMMTU', (/ 'lev' /), 'A', 'm/s2', 'U tendency - ZM convective momentum transport') - call addfld ('ZMMTV', (/ 'lev' /), 'A', 'm/s2', 'V tendency - ZM convective momentum transport') - - call addfld ('ZMMU', (/ 'lev' /), 'A', 'kg/m2/s', 'ZM convection updraft mass flux') - call addfld ('ZMMD', (/ 'lev' /), 'A', 'kg/m2/s', 'ZM convection downdraft mass flux') - - call addfld ('ZMUPGU', (/ 'lev' /), 'A', 'm/s2', 'zonal force from ZM updraft pressure gradient term') - call addfld ('ZMUPGD', (/ 'lev' /), 'A', 'm/s2', 'zonal force from ZM downdraft pressure gradient term') - call addfld ('ZMVPGU', (/ 'lev' /), 'A', 'm/s2', 'meridional force from ZM updraft pressure gradient term') - call addfld ('ZMVPGD', (/ 'lev' /), 'A', 'm/s2', 'merdional force from ZM downdraft pressure gradient term') - - call addfld ('ZMICUU', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud U updrafts') - call addfld ('ZMICUD', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud U downdrafts') - call addfld ('ZMICVU', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud V updrafts') - call addfld ('ZMICVD', (/ 'lev' /), 'A', 'm/s', 'ZM in-cloud V downdrafts') - - call addfld ('DIFZM' ,(/ 'lev' /), 'A','kg/kg/s ','Detrained ice water from ZM convection') - call addfld ('DLFZM' ,(/ 'lev' /), 'A','kg/kg/s ','Detrained liquid water from ZM convection') - - call phys_getopts( history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num) - - if (zmconv_org) then - call add_default('ZM_ORG', 1, ' ') - call add_default('ZM_ORG2D', 1, ' ') - endif - if ( history_budget ) then - call add_default('EVAPTZM ', history_budget_histfile_num, ' ') - call add_default('EVAPQZM ', history_budget_histfile_num, ' ') - call add_default('ZMDT ', history_budget_histfile_num, ' ') - call add_default('ZMDQ ', history_budget_histfile_num, ' ') - call add_default('ZMDLIQ ', history_budget_histfile_num, ' ') - call add_default('ZMDICE ', history_budget_histfile_num, ' ') - call add_default('ZMMTT ', history_budget_histfile_num, ' ') - end if - - if (zmconv_microp) then - call add_default ('DIFZM', 1, ' ') - call add_default ('DLFZM', 1, ' ') - end if -! -! Limit deep convection to regions below 40 mb -! Note this calculation is repeated in the shallow convection interface -! - limcnv = 0 ! null value to check against below - if (pref_edge(1) >= 4.e3_r8) then - limcnv = 1 - else - do k=1,plev - if (pref_edge(k) < 4.e3_r8 .and. pref_edge(k+1) >= 4.e3_r8) then - limcnv = k - exit - end if - end do - if ( limcnv == 0 ) limcnv = plevp - end if - - if (masterproc) then - write(iulog,*)'ZM_CONV_INIT: Deep convection will be capped at intfc ',limcnv, & - ' which is ',pref_edge(limcnv),' pascals' - end if - - no_deep_pbl = phys_deepconv_pbl() - call zm_convi(limcnv,zmconv_c0_lnd, zmconv_c0_ocn, zmconv_ke, zmconv_ke_lnd, & - zmconv_momcu, zmconv_momcd, zmconv_num_cin, zmconv_org, & - zmconv_microp, no_deep_pbl_in = no_deep_pbl) - - cld_idx = pbuf_get_index('CLD') - fracis_idx = pbuf_get_index('FRACIS') - - if (zmconv_microp) call zm_conv_micro_init() - -end subroutine zm_conv_init -!========================================================================================= -!subroutine zm_conv_tend(state, ptend, tdt) - -subroutine zm_conv_tend(pblh ,mcon ,cme , & - tpert ,pflx ,zdu , & - rliq ,rice ,ztodt , & - jctop ,jcbot , & - state ,ptend_all ,landfrac, pbuf) - - - use cam_history, only: outfld - use physics_types, only: physics_state, physics_ptend - use physics_types, only: physics_ptend_init, physics_update - use physics_types, only: physics_state_copy, physics_state_dealloc - use physics_types, only: physics_ptend_sum, physics_ptend_dealloc - - use phys_grid, only: get_lat_p, get_lon_p - use time_manager, only: get_nstep, is_first_step - use physics_buffer, only : pbuf_get_field, physics_buffer_desc, pbuf_old_tim_idx - use constituents, only: pcnst, cnst_get_ind, cnst_is_convtran1 - use check_energy, only: check_energy_chng - use physconst, only: gravit - use phys_control, only: cam_physpkg_is - - ! Arguments - - type(physics_state), intent(in),target :: state ! Physics state variables - type(physics_ptend), intent(out) :: ptend_all ! individual parameterization tendencies - type(physics_buffer_desc), pointer :: pbuf(:) - - real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) - real(r8), intent(in) :: pblh(pcols) ! Planetary boundary layer height - real(r8), intent(in) :: tpert(pcols) ! Thermal temperature excess - real(r8), intent(in) :: landfrac(pcols) ! RBN - Landfrac - - real(r8), intent(out) :: mcon(pcols,pverp) ! Convective mass flux--m sub c - real(r8), intent(out) :: pflx(pcols,pverp) ! scattered precip flux at each level - real(r8), intent(out) :: cme(pcols,pver) ! cmf condensation - evaporation - real(r8), intent(out) :: zdu(pcols,pver) ! detraining mass flux - - real(r8), intent(out) :: rliq(pcols) ! reserved liquid (not yet in cldliq) for energy integrals - real(r8), intent(out) :: rice(pcols) ! reserved ice (not yet in cldice) for energy integrals - - - ! Local variables - - type(zm_conv_t) :: conv - - integer :: i,k,l,m - integer :: ilon ! global longitude index of a column - integer :: ilat ! global latitude index of a column - integer :: nstep - integer :: ixcldice, ixcldliq ! constituent indices for cloud liquid and ice water. - integer :: lchnk ! chunk identifier - integer :: ncol ! number of atmospheric columns - integer :: itim_old ! for physics buffer fields - - real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables - real(r8) :: ntprprd(pcols,pver) ! evap outfld: net precip production in layer - real(r8) :: ntsnprd(pcols,pver) ! evap outfld: net snow production in layer - real(r8) :: tend_s_snwprd (pcols,pver) ! Heating rate of snow production - real(r8) :: tend_s_snwevmlt(pcols,pver) ! Heating rate of evap/melting of snow - real(r8) :: fake_dpdry(pcols,pver) ! used in convtran call - - ! physics types - type(physics_state) :: state1 ! locally modify for evaporation to use, not returned - type(physics_ptend),target :: ptend_loc ! package tendencies - - ! physics buffer fields - real(r8), pointer, dimension(:) :: prec ! total precipitation - real(r8), pointer, dimension(:) :: snow ! snow from ZM convection - real(r8), pointer, dimension(:,:) :: cld - real(r8), pointer, dimension(:,:) :: ql ! wg grid slice of cloud liquid water. - real(r8), pointer, dimension(:,:) :: rprd ! rain production rate - real(r8), pointer, dimension(:,:,:) :: fracis ! fraction of transported species that are insoluble - real(r8), pointer, dimension(:,:) :: evapcdp ! Evaporation of deep convective precipitation - real(r8), pointer, dimension(:,:) :: flxprec ! Convective-scale flux of precip at interfaces (kg/m2/s) - real(r8), pointer, dimension(:,:) :: flxsnow ! Convective-scale flux of snow at interfaces (kg/m2/s) - real(r8), pointer, dimension(:,:) :: dp_cldliq - real(r8), pointer, dimension(:,:) :: dp_cldice - real(r8), pointer :: dlf(:,:) ! detrained convective cloud water mixing ratio. - real(r8), pointer :: dif(:,:) ! detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlf(:,:) ! detrained convective cloud water num concen. - real(r8), pointer :: dnif(:,:) ! detrained convective cloud ice num concen. - real(r8), pointer :: lambdadpcu(:,:) ! slope of cloud liquid size distr - real(r8), pointer :: mudpcu(:,:) ! width parameter of droplet size distr - real(r8), pointer :: mconzm(:,:) !convective mass fluxes - - real(r8), pointer :: mu(:,:) ! (pcols,pver) - real(r8), pointer :: eu(:,:) ! (pcols,pver) - real(r8), pointer :: du(:,:) ! (pcols,pver) - real(r8), pointer :: md(:,:) ! (pcols,pver) - real(r8), pointer :: ed(:,:) ! (pcols,pver) - real(r8), pointer :: dp(:,:) ! (pcols,pver) - real(r8), pointer :: dsubcld(:) ! (pcols) - integer, pointer :: jt(:) ! (pcols) - integer, pointer :: maxg(:) ! (pcols) - integer, pointer :: ideep(:) ! (pcols) - integer :: lengath - - real(r8) :: jctop(pcols) ! o row of top-of-deep-convection indices passed out. - real(r8) :: jcbot(pcols) ! o row of base of cloud indices passed out. - - real(r8) :: pcont(pcols), pconb(pcols), freqzm(pcols) - - ! history output fields - real(r8) :: cape(pcols) ! w convective available potential energy. - real(r8) :: mu_out(pcols,pver) - real(r8) :: md_out(pcols,pver) - - ! used in momentum transport calculation - real(r8) :: winds(pcols, pver, 2) - real(r8) :: wind_tends(pcols, pver, 2) - real(r8) :: pguall(pcols, pver, 2) - real(r8) :: pgdall(pcols, pver, 2) - real(r8) :: icwu(pcols,pver, 2) - real(r8) :: icwd(pcols,pver, 2) - real(r8) :: seten(pcols, pver) - logical :: l_windt(2) - real(r8) :: tfinal1, tfinal2 - integer :: ii - - real(r8),pointer :: zm_org2d(:,:) - real(r8),pointer :: orgt(:,:), org(:,:) - - logical :: lq(pcnst) - - !---------------------------------------------------------------------- - - ! initialize - lchnk = state%lchnk - ncol = state%ncol - nstep = get_nstep() - - if (zmconv_microp) then - allocate( & - conv%qi(pcols,pver), & - conv%qliq(pcols,pver), & - conv%qice(pcols,pver), & - conv%wu(pcols,pver), & - conv%sprd(pcols,pver), & - conv%qrain(pcols,pver), & - conv%qsnow(pcols,pver), & - conv%qnl(pcols,pver), & - conv%qni(pcols,pver), & - conv%qnr(pcols,pver), & - conv%qns(pcols,pver), & - conv%frz(pcols,pver), & - conv%autolm(pcols,pver), & - conv%accrlm(pcols,pver), & - conv%bergnm(pcols,pver), & - conv%fhtimm(pcols,pver), & - conv%fhtctm(pcols,pver), & - conv%fhmlm (pcols,pver), & - conv%hmpim (pcols,pver), & - conv%accslm(pcols,pver), & - conv%dlfm (pcols,pver), & - conv%autoln(pcols,pver), & - conv%accrln(pcols,pver), & - conv%bergnn(pcols,pver), & - conv%fhtimn(pcols,pver), & - conv%fhtctn(pcols,pver), & - conv%fhmln (pcols,pver), & - conv%accsln(pcols,pver), & - conv%activn(pcols,pver), & - conv%dlfn (pcols,pver), & - conv%autoim(pcols,pver), & - conv%accsim(pcols,pver), & - conv%difm (pcols,pver), & - conv%nuclin(pcols,pver), & - conv%autoin(pcols,pver), & - conv%accsin(pcols,pver), & - conv%hmpin (pcols,pver), & - conv%difn (pcols,pver), & - conv%cmel (pcols,pver), & - conv%cmei (pcols,pver), & - conv%trspcm(pcols,pver), & - conv%trspcn(pcols,pver), & - conv%trspim(pcols,pver), & - conv%trspin(pcols,pver), & - conv%lambdadpcu(pcols,pver), & - conv%mudpcu(pcols,pver), & - conv%dcape(pcols) ) - end if - - ftem = 0._r8 - mu_out(:,:) = 0._r8 - md_out(:,:) = 0._r8 - wind_tends(:ncol,:pver,:) = 0.0_r8 - - call physics_state_copy(state,state1) ! copy state to local state1. - - lq(:) = .FALSE. - lq(1) = .TRUE. - if (zmconv_org) then - lq(ixorg) = .TRUE. - endif - call physics_ptend_init(ptend_loc, state%psetcols, 'zm_convr', ls=.true., lq=lq)! initialize local ptend type - -! -! Associate pointers with physics buffer fields -! - itim_old = pbuf_old_tim_idx() - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - - call pbuf_get_field(pbuf, icwmrdp_idx, ql ) - call pbuf_get_field(pbuf, rprddp_idx, rprd ) - call pbuf_get_field(pbuf, fracis_idx, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) - call pbuf_get_field(pbuf, nevapr_dpcu_idx, evapcdp ) - call pbuf_get_field(pbuf, prec_dp_idx, prec ) - call pbuf_get_field(pbuf, snow_dp_idx, snow ) - - call pbuf_get_field(pbuf, zm_mu_idx, mu) - call pbuf_get_field(pbuf, zm_eu_idx, eu) - call pbuf_get_field(pbuf, zm_du_idx, du) - call pbuf_get_field(pbuf, zm_md_idx, md) - call pbuf_get_field(pbuf, zm_ed_idx, ed) - call pbuf_get_field(pbuf, zm_dp_idx, dp) - call pbuf_get_field(pbuf, zm_dsubcld_idx, dsubcld) - call pbuf_get_field(pbuf, zm_jt_idx, jt) - call pbuf_get_field(pbuf, zm_maxg_idx, maxg) - call pbuf_get_field(pbuf, zm_ideep_idx, ideep) - - call pbuf_get_field(pbuf, dlfzm_idx, dlf) - call pbuf_get_field(pbuf, difzm_idx, dif) - call pbuf_get_field(pbuf, mconzm_idx, mconzm) - - - if (zmconv_microp) then - call pbuf_get_field(pbuf, dnlfzm_idx, dnlf) - call pbuf_get_field(pbuf, dnifzm_idx, dnif) - else - allocate(dnlf(pcols,pver), dnif(pcols,pver)) - end if - - if (zmconv_microp) then - - if (nmodes > 0) then - - ! Associate pointers with the modes and species that affect the climate - ! (list 0) - - do m = 1, nmodes - call rad_cnst_get_mode_num(0, m, 'a', state, pbuf, aero(lchnk)%num_a(m)%val) - call pbuf_get_field(pbuf, dgnum_idx, aero(lchnk)%dgnum(m)%val, start=(/1,1,m/), kount=(/pcols,pver,1/)) - - do l = 1, aero(lchnk)%nspec(m) - call rad_cnst_get_aer_mmr(0, m, l, 'a', state, pbuf, aero(lchnk)%mmr_a(l,m)%val) - end do - end do - - else if (nbulk > 0) then - - ! Associate pointers with the bulk aerosols that affect the climate - ! (list 0) - - do m = 1, nbulk - call rad_cnst_get_aer_mmr(0, m, state, pbuf, aero(lchnk)%mmr_bulk(m)%val) - end do - - end if - end if - -! -! Begin with Zhang-McFarlane (1996) convection parameterization -! - call t_startf ('zm_convr') - - if (zmconv_org) then - allocate(zm_org2d(pcols,pver)) - org => state%q(:,:,ixorg) - orgt => ptend_loc%q(:,:,ixorg) - endif - - call zm_convr( lchnk ,ncol , & - state%t ,state%q(:,:,1), state%omega, prec ,jctop ,jcbot , & - pblh ,state%zm ,state%phis ,state%zi ,ptend_loc%q(:,:,1) , & - ptend_loc%s , state%pmid ,state%pint ,state%pdel , & - .5_r8*ztodt ,mcon ,cme , cape, & - tpert ,dlf ,pflx ,zdu ,rprd , & - mu, md, du, eu, ed, & - dp, dsubcld, jt, maxg, ideep, & - ql, rliq, landfrac, & - org, orgt, zm_org2d, & - dif, dnlf, dnif, conv, & - aero(lchnk), rice) - - lengath = count(ideep > 0) - - call outfld('CAPE', cape, pcols, lchnk) ! RBN - CAPE output -! -! Output fractional occurance of ZM convection -! - freqzm(:) = 0._r8 - do i = 1,lengath - freqzm(ideep(i)) = 1.0_r8 - end do - call outfld('FREQZM ',freqzm ,pcols ,lchnk ) -! -! Convert mass flux from reported mb/s to kg/m^2/s -! - mcon(:ncol,:pver) = mcon(:ncol,:pver) * 100._r8/gravit - mconzm(:ncol,:pverp) = mcon(:ncol,:pverp) - - !call outfld('CMFMCDZM', mcon, pcols, lchnk) - call outfld('CMFMCDZM', mconzm, pcols, lchnk) - - ! Store upward and downward mass fluxes in un-gathered arrays - ! + convert from mb/s to kg/m^2/s - do i=1,lengath - do k=1,pver - ii = ideep(i) - mu_out(ii,k) = mu(i,k) * 100._r8/gravit - md_out(ii,k) = md(i,k) * 100._r8/gravit - end do - end do - - call outfld('ZMMU', mu_out, pcols, lchnk) - call outfld('ZMMD', md_out, pcols, lchnk) - - ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair - call outfld('ZMDT ',ftem ,pcols ,lchnk ) - call outfld('ZMDQ ',ptend_loc%q(1,1,1) ,pcols ,lchnk ) - call t_stopf ('zm_convr') - - call outfld('DIFZM' ,dif ,pcols, lchnk) - call outfld('DLFZM' ,dlf ,pcols, lchnk) - - if (zmconv_microp) call zm_conv_micro_outfld(conv, dnif, dnlf, lchnk, ncol) - - pcont(:ncol) = state%ps(:ncol) - pconb(:ncol) = state%ps(:ncol) - do i = 1,lengath - if (maxg(i).gt.jt(i)) then - pcont(ideep(i)) = state%pmid(ideep(i),jt(i)) ! gathered array (or jctop ungathered) - pconb(ideep(i)) = state%pmid(ideep(i),maxg(i))! gathered array - endif - ! write(iulog,*) ' pcont, pconb ', pcont(i), pconb(i), cnt(i), cnb(i) - end do - call outfld('PCONVT ',pcont ,pcols ,lchnk ) - call outfld('PCONVB ',pconb ,pcols ,lchnk ) - - call physics_ptend_init(ptend_all, state%psetcols, 'zm_conv_tend') - - ! add tendency from this process to tendencies from other processes - call physics_ptend_sum(ptend_loc,ptend_all, ncol) - - ! update physics state type state1 with ptend_loc - call physics_update(state1, ptend_loc, ztodt) - - ! initialize ptend for next process - lq(:) = .FALSE. - lq(1) = .TRUE. - if (zmconv_org) then - lq(ixorg) = .TRUE. - endif - call physics_ptend_init(ptend_loc, state1%psetcols, 'zm_conv_evap', ls=.true., lq=lq) - - call t_startf ('zm_conv_evap') -! -! Determine the phase of the precipitation produced and add latent heat of fusion -! Evaporate some of the precip directly into the environment (Sundqvist) -! Allow this to use the updated state1 and the fresh ptend_loc type -! heating and specific humidity tendencies produced -! - - call pbuf_get_field(pbuf, dp_flxprc_idx, flxprec ) - call pbuf_get_field(pbuf, dp_flxsnw_idx, flxsnow ) - call pbuf_get_field(pbuf, dp_cldliq_idx, dp_cldliq ) - call pbuf_get_field(pbuf, dp_cldice_idx, dp_cldice ) - dp_cldliq(:ncol,:) = 0._r8 - dp_cldice(:ncol,:) = 0._r8 - - call zm_conv_evap(state1%ncol,state1%lchnk, & - state1%t,state1%pmid,state1%pdel,state1%q(:pcols,:pver,1), & - landfrac, & - ptend_loc%s, tend_s_snwprd, tend_s_snwevmlt, ptend_loc%q(:pcols,:pver,1), & - rprd, cld, ztodt, & - prec, snow, ntprprd, ntsnprd , flxprec, flxsnow, conv%sprd) - - evapcdp(:ncol,:pver) = ptend_loc%q(:ncol,:pver,1) - - if (zmconv_org) then - ptend_loc%q(:ncol,:pver,ixorg) = min(1._r8,max(0._r8,(50._r8*1000._r8*1000._r8*abs(evapcdp(:ncol,:pver))) & - -(state%q(:ncol,:pver,ixorg)/10800._r8))) - ptend_loc%q(:ncol,:pver,ixorg) = (ptend_loc%q(:ncol,:pver,ixorg) - state%q(:ncol,:pver,ixorg))/ztodt - endif - -! -! Write out variables from zm_conv_evap -! - ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpair - call outfld('EVAPTZM ',ftem ,pcols ,lchnk ) - ftem(:ncol,:pver) = tend_s_snwprd (:ncol,:pver)/cpair - call outfld('FZSNTZM ',ftem ,pcols ,lchnk ) - ftem(:ncol,:pver) = tend_s_snwevmlt(:ncol,:pver)/cpair - call outfld('EVSNTZM ',ftem ,pcols ,lchnk ) - call outfld('EVAPQZM ',ptend_loc%q(1,1,1) ,pcols ,lchnk ) - call outfld('ZMFLXPRC', flxprec, pcols, lchnk) - call outfld('ZMFLXSNW', flxsnow, pcols, lchnk) - call outfld('ZMNTPRPD', ntprprd, pcols, lchnk) - call outfld('ZMNTSNPD', ntsnprd, pcols, lchnk) - call outfld('ZMEIHEAT', ptend_loc%s, pcols, lchnk) - call outfld('CMFMCDZM ',mcon , pcols ,lchnk ) - call outfld('PRECCDZM ',prec, pcols ,lchnk ) - - - call t_stopf ('zm_conv_evap') - - call outfld('PRECZ ', prec , pcols, lchnk) - - ! add tendency from this process to tend from other processes here - call physics_ptend_sum(ptend_loc,ptend_all, ncol) - - ! update physics state type state1 with ptend_loc - call physics_update(state1, ptend_loc, ztodt) - - - ! Momentum Transport (non-cam3 physics) - - if ( .not. cam_physpkg_is('cam3')) then - - call physics_ptend_init(ptend_loc, state1%psetcols, 'momtran', ls=.true., lu=.true., lv=.true.) - - winds(:ncol,:pver,1) = state1%u(:ncol,:pver) - winds(:ncol,:pver,2) = state1%v(:ncol,:pver) - - l_windt(1) = .true. - l_windt(2) = .true. - - call t_startf ('momtran') - call momtran (lchnk, ncol, & - l_windt,winds, 2, mu, md, & - du, eu, ed, dp, dsubcld, & - jt, maxg, ideep, 1, lengath, & - nstep, wind_tends, pguall, pgdall, icwu, icwd, ztodt, seten ) - call t_stopf ('momtran') - - ptend_loc%u(:ncol,:pver) = wind_tends(:ncol,:pver,1) - ptend_loc%v(:ncol,:pver) = wind_tends(:ncol,:pver,2) - ptend_loc%s(:ncol,:pver) = seten(:ncol,:pver) - - call physics_ptend_sum(ptend_loc,ptend_all, ncol) - - ! update physics state type state1 with ptend_loc - call physics_update(state1, ptend_loc, ztodt) - - ftem(:ncol,:pver) = seten(:ncol,:pver)/cpair - if (zmconv_org) then - call outfld('ZM_ORG', state%q(:,:,ixorg), pcols, lchnk) - call outfld('ZM_ORG2D', zm_org2d, pcols, lchnk) - endif - call outfld('ZMMTT', ftem , pcols, lchnk) - call outfld('ZMMTU', wind_tends(1,1,1), pcols, lchnk) - call outfld('ZMMTV', wind_tends(1,1,2), pcols, lchnk) - - ! Output apparent force from pressure gradient - call outfld('ZMUPGU', pguall(1,1,1), pcols, lchnk) - call outfld('ZMUPGD', pgdall(1,1,1), pcols, lchnk) - call outfld('ZMVPGU', pguall(1,1,2), pcols, lchnk) - call outfld('ZMVPGD', pgdall(1,1,2), pcols, lchnk) - - ! Output in-cloud winds - call outfld('ZMICUU', icwu(1,1,1), pcols, lchnk) - call outfld('ZMICUD', icwd(1,1,1), pcols, lchnk) - call outfld('ZMICVU', icwu(1,1,2), pcols, lchnk) - call outfld('ZMICVD', icwd(1,1,2), pcols, lchnk) - - end if - - ! Transport cloud water and ice only - call cnst_get_ind('CLDLIQ', ixcldliq) - call cnst_get_ind('CLDICE', ixcldice) - - lq(:) = .FALSE. - lq(2:) = cnst_is_convtran1(2:) - call physics_ptend_init(ptend_loc, state1%psetcols, 'convtran1', lq=lq) - - - ! dpdry is not used in this call to convtran since the cloud liquid and ice mixing - ! ratios are moist - fake_dpdry(:,:) = 0._r8 - - call t_startf ('convtran1') - call convtran (lchnk, & - ptend_loc%lq,state1%q, pcnst, mu, md, & - du, eu, ed, dp, dsubcld, & - jt,maxg, ideep, 1, lengath, & - nstep, fracis, ptend_loc%q, fake_dpdry, ztodt) - call t_stopf ('convtran1') - - call outfld('ZMDICE ',ptend_loc%q(1,1,ixcldice) ,pcols ,lchnk ) - call outfld('ZMDLIQ ',ptend_loc%q(1,1,ixcldliq) ,pcols ,lchnk ) - - ! add tendency from this process to tend from other processes here - call physics_ptend_sum(ptend_loc,ptend_all, ncol) - - call physics_state_dealloc(state1) - call physics_ptend_dealloc(ptend_loc) - - if (zmconv_org) then - deallocate(zm_org2d) - end if - - if (zmconv_microp) then - deallocate( & - conv%qi, & - conv%qliq, & - conv%qice, & - conv%wu, & - conv%sprd, & - conv%qrain, & - conv%qsnow, & - conv%qnl, & - conv%qni, & - conv%qnr, & - conv%qns, & - conv%frz, & - conv%autolm, & - conv%accrlm, & - conv%bergnm, & - conv%fhtimm, & - conv%fhtctm, & - conv%fhmlm , & - conv%hmpim , & - conv%accslm, & - conv%dlfm , & - conv%autoln, & - conv%accrln, & - conv%bergnn, & - conv%fhtimn, & - conv%fhtctn, & - conv%fhmln , & - conv%accsln, & - conv%activn, & - conv%dlfn , & - conv%autoim, & - conv%accsim, & - conv%difm , & - conv%nuclin, & - conv%autoin, & - conv%accsin, & - conv%hmpin , & - conv%difn , & - conv%cmel , & - conv%cmei , & - conv%trspcm, & - conv%trspcn, & - conv%trspim, & - conv%trspin, & - conv%lambdadpcu, & - conv%mudpcu, & - conv%dcape ) - - else - - deallocate(dnlf, dnif) - - end if - -end subroutine zm_conv_tend -!========================================================================================= - - -subroutine zm_conv_tend_2( state, ptend, ztodt, pbuf) - - use physics_types, only: physics_state, physics_ptend, physics_ptend_init - use time_manager, only: get_nstep - use physics_buffer, only: pbuf_get_index, pbuf_get_field, physics_buffer_desc - use constituents, only: pcnst, cnst_is_convtran2 - -! Arguments - type(physics_state), intent(in ) :: state ! Physics state variables - type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencies - - type(physics_buffer_desc), pointer :: pbuf(:) - - real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) - -! Local variables - integer :: i, lchnk, istat - integer :: lengath ! number of columns with deep convection - integer :: nstep - - real(r8), dimension(pcols,pver) :: dpdry - - ! physics buffer fields - real(r8), pointer :: fracis(:,:,:) ! fraction of transported species that are insoluble - real(r8), pointer :: mu(:,:) ! (pcols,pver) - real(r8), pointer :: eu(:,:) ! (pcols,pver) - real(r8), pointer :: du(:,:) ! (pcols,pver) - real(r8), pointer :: md(:,:) ! (pcols,pver) - real(r8), pointer :: ed(:,:) ! (pcols,pver) - real(r8), pointer :: dp(:,:) ! (pcols,pver) - real(r8), pointer :: dsubcld(:) ! (pcols) - integer, pointer :: jt(:) ! (pcols) - integer, pointer :: maxg(:) ! (pcols) - integer, pointer :: ideep(:) ! (pcols) - !----------------------------------------------------------------------------------- - - - call physics_ptend_init(ptend, state%psetcols, 'convtran2', lq=cnst_is_convtran2 ) - - call pbuf_get_field(pbuf, fracis_idx, fracis) - call pbuf_get_field(pbuf, zm_mu_idx, mu) - call pbuf_get_field(pbuf, zm_eu_idx, eu) - call pbuf_get_field(pbuf, zm_du_idx, du) - call pbuf_get_field(pbuf, zm_md_idx, md) - call pbuf_get_field(pbuf, zm_ed_idx, ed) - call pbuf_get_field(pbuf, zm_dp_idx, dp) - call pbuf_get_field(pbuf, zm_dsubcld_idx, dsubcld) - call pbuf_get_field(pbuf, zm_jt_idx, jt) - call pbuf_get_field(pbuf, zm_maxg_idx, maxg) - call pbuf_get_field(pbuf, zm_ideep_idx, ideep) - - lengath = count(ideep > 0) - - lchnk = state%lchnk - nstep = get_nstep() - - if (any(ptend%lq(:))) then - ! initialize dpdry for call to convtran - ! it is used for tracers of dry mixing ratio type - dpdry = 0._r8 - do i = 1, lengath - dpdry(i,:) = state%pdeldry(ideep(i),:)/100._r8 - end do - - call t_startf ('convtran2') - call convtran (lchnk, & - ptend%lq,state%q, pcnst, mu, md, & - du, eu, ed, dp, dsubcld, & - jt, maxg, ideep, 1, lengath, & - nstep, fracis, ptend%q, dpdry, ztodt) - call t_stopf ('convtran2') - end if - -end subroutine zm_conv_tend_2 - -!========================================================================================= - -subroutine zm_conv_micro_init() - - use cam_history, only: addfld, add_default, horiz_only - use ppgrid, only: pcols, pver - use pmgrid, only: plev,plevp - use phys_control, only: cam_physpkg_is - use physics_buffer, only: pbuf_get_index - use zm_microphysics, only: zm_mphyi - - implicit none - - integer :: i - - ! - ! Register fields with the output buffer - ! - call addfld ('ICIMRDP', (/ 'lev' /), 'A','kg/kg', 'Deep Convection in-cloud ice mixing ratio ') - call addfld ('CLDLIQZM',(/ 'lev' /), 'A','g/m3' ,'Cloud liquid water - ZM convection') - call addfld ('CLDICEZM',(/ 'lev' /), 'A','g/m3' ,'Cloud ice water - ZM convection') - call addfld ('CLIQSNUM',(/ 'lev' /), 'A','1' ,'Cloud liquid water sample number - ZM convection') - call addfld ('CICESNUM',(/ 'lev' /), 'A','1' ,'Cloud ice water sample number - ZM convection') - call addfld ('QRAINZM' ,(/ 'lev' /), 'A','g/m3' ,'rain water - ZM convection') - call addfld ('QSNOWZM' ,(/ 'lev' /), 'A','g/m3' ,'snow - ZM convection') - call addfld ('CRAINNUM',(/ 'lev' /), 'A','1' ,'Cloud rain water sample number - ZM convection') - call addfld ('CSNOWNUM',(/ 'lev' /), 'A','1' ,'Cloud snow sample number - ZM convection') - - call addfld ('DNIFZM' ,(/ 'lev' /), 'A','1/kg/s ' ,'Detrained ice water num concen from ZM convection') - call addfld ('DNLFZM' ,(/ 'lev' /), 'A','1/kg/s ' ,'Detrained liquid water num concen from ZM convection') - call addfld ('WUZM' ,(/ 'lev' /), 'A','m/s' ,'vertical velocity - ZM convection') - call addfld ('WUZMSNUM',(/ 'lev' /), 'A','1' ,'vertical velocity sample number - ZM convection') - - call addfld ('QNLZM',(/ 'lev' /), 'A','1/m3' ,'Cloud liquid water number concen - ZM convection') - call addfld ('QNIZM',(/ 'lev' /), 'A','1/m3' ,'Cloud ice number concen - ZM convection') - call addfld ('QNRZM',(/ 'lev' /), 'A','1/m3' ,'Cloud rain water number concen - ZM convection') - call addfld ('QNSZM',(/ 'lev' /), 'A','1/m3' ,'Cloud snow number concen - ZM convection') - - call addfld ('FRZZM',(/ 'lev' /), 'A','1/s' ,'mass tendency due to freezing - ZM convection') - - call addfld ('AUTOL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to autoconversion of droplets to rain') - call addfld ('ACCRL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of droplets by rain') - call addfld ('BERGN_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to Bergeron process') - call addfld ('FHTIM_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to immersion freezing') - call addfld ('FHTCT_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to contact freezing') - call addfld ('FHML_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to homogeneous freezing of droplet') - call addfld ('HMPI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to HM process') - call addfld ('ACCSL_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of droplet by snow') - call addfld ('DLF_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to detrainment of droplet') - call addfld ('COND_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to condensation') - - call addfld ('AUTOL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to autoconversion of droplets to rain') - call addfld ('ACCRL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of droplets by rain') - call addfld ('BERGN_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to Bergeron process') - call addfld ('FHTIM_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to immersion freezing') - call addfld ('FHTCT_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to contact freezing') - call addfld ('FHML_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to homogeneous freezing of droplet') - call addfld ('ACCSL_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of droplet by snow') - call addfld ('ACTIV_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to droplets activation') - call addfld ('DLF_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to detrainment of droplet') - - call addfld ('AUTOI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to autoconversion of ice to snow') - call addfld ('ACCSI_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to accretion of ice by snow') - call addfld ('DIF_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to detrainment of cloud ice') - call addfld ('DEPOS_M' ,(/ 'lev' /), 'A','kg/kg/m' ,'mass tendency due to deposition') - - call addfld ('NUCLI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to ice nucleation') - call addfld ('AUTOI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to autoconversion of ice to snow') - call addfld ('ACCSI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to accretion of ice by snow') - call addfld ('HMPI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to HM process') - call addfld ('DIF_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency due to detrainment of cloud ice') - - call addfld ('TRSPC_M' ,(/ 'lev' /), 'A','kg/kg/m','mass tendency of droplets due to convective transport') - call addfld ('TRSPC_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency of droplets due to convective transport') - call addfld ('TRSPI_M' ,(/ 'lev' /), 'A','kg/kg/m','mass tendency of ice crystal due to convective transport') - call addfld ('TRSPI_N' ,(/ 'lev' /), 'A','1/kg/m' ,'num tendency of ice crystal due to convective transport') - - - call add_default ('CLDLIQZM', 1, ' ') - call add_default ('CLDICEZM', 1, ' ') - call add_default ('CLIQSNUM', 1, ' ') - call add_default ('CICESNUM', 1, ' ') - call add_default ('DNIFZM', 1, ' ') - call add_default ('DNLFZM', 1, ' ') - call add_default ('WUZM', 1, ' ') - call add_default ('QRAINZM', 1, ' ') - call add_default ('QSNOWZM', 1, ' ') - call add_default ('CRAINNUM', 1, ' ') - call add_default ('CSNOWNUM', 1, ' ') - call add_default ('QNLZM', 1, ' ') - call add_default ('QNIZM', 1, ' ') - call add_default ('QNRZM', 1, ' ') - call add_default ('QNSZM', 1, ' ') - call add_default ('FRZZM', 1, ' ') - - ! Initialization for the microphysics - - call zm_mphyi() - - ! Initialize the aerosol object with data from the modes/species - ! affecting climate, - ! i.e., the list index is hardcoded to 0. - - call rad_cnst_get_info(0, nmodes=nmodes, naero=nbulk) - - - do i = begchunk, endchunk - call zm_aero_init(nmodes, nbulk, aero(i)) - end do - - if (nmodes > 0) then - - dgnum_idx = pbuf_get_index('DGNUM') - - else if (nbulk > 0 .and. cam_physpkg_is('cam4')) then - - ! This call is needed to allow running the ZM microphysics with the - ! cam4 physics package. - call ndrop_bam_init() - - end if - - end subroutine zm_conv_micro_init - - - subroutine zm_aero_init(nmodes, nbulk, aero) - - use pmgrid, only: plev,plevp - - ! Initialize the zm_aero_t object for modal aerosols - - integer, intent(in) :: nmodes - integer, intent(in) :: nbulk - type(zm_aero_t), intent(out) :: aero - - integer :: iaer, l, m - integer :: nspecmx ! max number of species in a mode - - character(len=20), allocatable :: aername(:) - character(len=32) :: str32 - character(len=*), parameter :: routine = 'zm_conv_init' - - real(r8) :: sigmag, dgnumlo, dgnumhi - real(r8) :: alnsg - !---------------------------------------------------------------------------------- - - aero%nmodes = nmodes - aero%nbulk = nbulk - - if (nmodes > 0) then - - ! Initialize the modal aerosol information - - aero%scheme = 'modal' - - ! Get number of species in each mode, and find max. - allocate(aero%nspec(aero%nmodes)) - nspecmx = 0 - do m = 1, aero%nmodes - - call rad_cnst_get_info(0, m, nspec=aero%nspec(m), mode_type=str32) - - nspecmx = max(nspecmx, aero%nspec(m)) - - ! save mode index for specified mode types - select case (trim(str32)) - case ('accum') - aero%mode_accum_idx = m - case ('aitken') - aero%mode_aitken_idx = m - case ('coarse') - aero%mode_coarse_idx = m - end select - - end do - - ! Check that required mode types were found - if (aero%mode_accum_idx == -1 .or. aero%mode_aitken_idx == -1 .or. aero%mode_coarse_idx == -1) then - write(iulog,*) routine//': ERROR required mode type not found - mode idx:', & - aero%mode_accum_idx, aero%mode_aitken_idx, aero%mode_coarse_idx - call endrun(routine//': ERROR required mode type not found') - end if - - ! find indices for the dust and seasalt species in the coarse mode - do l = 1, aero%nspec(aero%mode_coarse_idx) - call rad_cnst_get_info(0, aero%mode_coarse_idx, l, spec_type=str32) - select case (trim(str32)) - case ('dust') - aero%coarse_dust_idx = l - case ('seasalt') - aero%coarse_nacl_idx = l - end select - end do - ! Check that required modal specie types were found - if (aero%coarse_dust_idx == -1 .or. aero%coarse_nacl_idx == -1) then - write(iulog,*) routine//': ERROR required mode-species type not found - indicies:', & - aero%coarse_dust_idx, aero%coarse_nacl_idx - call endrun(routine//': ERROR required mode-species type not found') - end if - - allocate( & - aero%num_a(nmodes), & - aero%mmr_a(nspecmx,nmodes), & - aero%numg_a(pcols,pver,nmodes), & - aero%mmrg_a(pcols,pver,nspecmx,nmodes), & - aero%voltonumblo(nmodes), & - aero%voltonumbhi(nmodes), & - aero%specdens(nspecmx,nmodes), & - aero%spechygro(nspecmx,nmodes), & - aero%dgnum(nmodes), & - aero%dgnumg(pcols,pver,nmodes) ) - - - do m = 1, nmodes - - ! Properties of modes - call rad_cnst_get_mode_props(0, m, & - sigmag=sigmag, dgnumlo=dgnumlo, dgnumhi=dgnumhi) - - alnsg = log(sigmag) - aero%voltonumblo(m) = 1._r8 / ( (pi/6._r8)*(dgnumlo**3._r8)*exp(4.5_r8*alnsg**2._r8) ) - aero%voltonumbhi(m) = 1._r8 / ( (pi/6._r8)*(dgnumhi**3._r8)*exp(4.5_r8*alnsg**2._r8) ) - - ! save sigmag of aitken mode - if (m == aero%mode_aitken_idx) aero%sigmag_aitken = sigmag - - ! Properties of modal species - do l = 1, aero%nspec(m) - call rad_cnst_get_aer_props(0, m, l, density_aer=aero%specdens(l,m), & - hygro_aer=aero%spechygro(l,m)) - end do - end do - - else if (nbulk > 0) then - - aero%scheme = 'bulk' - - ! Props needed for BAM number concentration calcs. - allocate( & - aername(nbulk), & - aero%num_to_mass_aer(nbulk), & - aero%mmr_bulk(nbulk), & - aero%mmrg_bulk(pcols,plev,nbulk) ) - - do iaer = 1, aero%nbulk - call rad_cnst_get_aer_props(0, iaer, & - aername = aername(iaer), & - num_to_mass_aer = aero%num_to_mass_aer(iaer) ) - - ! Look for sulfate aerosol in this list (Bulk aerosol only) - if (trim(aername(iaer)) == 'SULFATE') aero%idxsul = iaer - if (trim(aername(iaer)) == 'DUST1') aero%idxdst1 = iaer - if (trim(aername(iaer)) == 'DUST2') aero%idxdst2 = iaer - if (trim(aername(iaer)) == 'DUST3') aero%idxdst3 = iaer - if (trim(aername(iaer)) == 'DUST4') aero%idxdst4 = iaer - if (trim(aername(iaer)) == 'BCPHI') aero%idxbcphi = iaer - end do - - end if - - end subroutine zm_aero_init - - subroutine zm_conv_micro_outfld(conv, dnif, dnlf, lchnk, ncol) - - use cam_history, only: outfld - - type(zm_conv_t),intent(in) :: conv - real(r8), intent(in) :: dnlf(:,:) ! detrained convective cloud water num concen. - real(r8), intent(in) :: dnif(:,:) ! detrained convective cloud ice num concen. - integer, intent(in) :: lchnk - integer, intent(in) :: ncol - - integer :: i,k - - real(r8) :: cice_snum(pcols,pver) ! convective cloud ice sample number. - real(r8) :: cliq_snum(pcols,pver) ! convective cloud liquid sample number. - real(r8) :: crain_snum(pcols,pver) ! convective rain water sample number. - real(r8) :: csnow_snum(pcols,pver) ! convective snow sample number. - real(r8) :: wu_snum(pcols,pver) ! vertical velocity sample number - - real(r8) :: qni_snum(pcols,pver) ! convective cloud ice number sample number. - real(r8) :: qnl_snum(pcols,pver) ! convective cloud liquid number sample number. - - do k = 1,pver - do i = 1,ncol - if (conv%qice(i,k) .gt. 0.0_r8) then - cice_snum(i,k) = 1.0_r8 - else - cice_snum(i,k) = 0.0_r8 - end if - if (conv%qliq(i,k) .gt. 0.0_r8) then - cliq_snum(i,k) = 1.0_r8 - else - cliq_snum(i,k) = 0.0_r8 - end if - if (conv%qsnow(i,k) .gt. 0.0_r8) then - csnow_snum(i,k) = 1.0_r8 - else - csnow_snum(i,k) = 0.0_r8 - end if - if (conv%qrain(i,k) .gt. 0.0_r8) then - crain_snum(i,k) = 1.0_r8 - else - crain_snum(i,k) = 0.0_r8 - end if - - if (conv%qnl(i,k) .gt. 0.0_r8) then - qnl_snum(i,k) = 1.0_r8 - else - qnl_snum(i,k) = 0.0_r8 - end if - if (conv%qni(i,k) .gt. 0.0_r8) then - qni_snum(i,k) = 1.0_r8 - else - qni_snum(i,k) = 0.0_r8 - end if - if (conv%wu(i,k) .gt. 0.0_r8) then - wu_snum(i,k) = 1.0_r8 - else - wu_snum(i,k) = 0.0_r8 - end if - - end do - end do - - call outfld('ICIMRDP ',conv%qi ,pcols, lchnk ) - call outfld('CLDLIQZM',conv%qliq ,pcols, lchnk) - call outfld('CLDICEZM',conv%qice ,pcols, lchnk) - call outfld('CLIQSNUM',cliq_snum ,pcols, lchnk) - call outfld('CICESNUM',cice_snum ,pcols, lchnk) - call outfld('QRAINZM' ,conv%qrain ,pcols, lchnk) - call outfld('QSNOWZM' ,conv%qsnow ,pcols, lchnk) - call outfld('CRAINNUM',crain_snum ,pcols, lchnk) - call outfld('CSNOWNUM',csnow_snum ,pcols, lchnk) - - call outfld('WUZM' ,conv%wu ,pcols, lchnk) - call outfld('WUZMSNUM',wu_snum ,pcols, lchnk) - call outfld('QNLZM' ,conv%qnl ,pcols, lchnk) - call outfld('QNIZM' ,conv%qni ,pcols, lchnk) - call outfld('QNRZM' ,conv%qnr ,pcols, lchnk) - call outfld('QNSZM' ,conv%qns ,pcols, lchnk) - call outfld('FRZZM' ,conv%frz ,pcols, lchnk) - - call outfld('AUTOL_M' ,conv%autolm ,pcols, lchnk) - call outfld('ACCRL_M' ,conv%accrlm ,pcols, lchnk) - call outfld('BERGN_M' ,conv%bergnm ,pcols, lchnk) - call outfld('FHTIM_M' ,conv%fhtimm ,pcols, lchnk) - call outfld('FHTCT_M' ,conv%fhtctm ,pcols, lchnk) - call outfld('FHML_M' ,conv%fhmlm ,pcols, lchnk) - call outfld('HMPI_M' ,conv%hmpim ,pcols, lchnk) - call outfld('ACCSL_M' ,conv%accslm ,pcols, lchnk) - call outfld('DLF_M' ,conv%dlfm ,pcols, lchnk) - - call outfld('AUTOL_N' ,conv%autoln ,pcols, lchnk) - call outfld('ACCRL_N' ,conv%accrln ,pcols, lchnk) - call outfld('BERGN_N' ,conv%bergnn ,pcols, lchnk) - call outfld('FHTIM_N' ,conv%fhtimn ,pcols, lchnk) - call outfld('FHTCT_N' ,conv%fhtctn ,pcols, lchnk) - call outfld('FHML_N' ,conv%fhmln ,pcols, lchnk) - call outfld('ACCSL_N' ,conv%accsln ,pcols, lchnk) - call outfld('ACTIV_N' ,conv%activn ,pcols, lchnk) - call outfld('DLF_N' ,conv%dlfn ,pcols, lchnk) - call outfld('AUTOI_M' ,conv%autoim ,pcols, lchnk) - call outfld('ACCSI_M' ,conv%accsim ,pcols, lchnk) - call outfld('DIF_M' ,conv%difm ,pcols, lchnk) - call outfld('NUCLI_N' ,conv%nuclin ,pcols, lchnk) - call outfld('AUTOI_N' ,conv%autoin ,pcols, lchnk) - call outfld('ACCSI_N' ,conv%accsin ,pcols, lchnk) - call outfld('HMPI_N' ,conv%hmpin ,pcols, lchnk) - call outfld('DIF_N' ,conv%difn ,pcols, lchnk) - call outfld('COND_M' ,conv%cmel ,pcols, lchnk) - call outfld('DEPOS_M' ,conv%cmei ,pcols, lchnk) - - call outfld('TRSPC_M' ,conv%trspcm ,pcols, lchnk) - call outfld('TRSPC_N' ,conv%trspcn ,pcols, lchnk) - call outfld('TRSPI_M' ,conv%trspim ,pcols, lchnk) - call outfld('TRSPI_N' ,conv%trspin ,pcols, lchnk) - call outfld('DNIFZM' ,dnif ,pcols, lchnk) - call outfld('DNLFZM' ,dnlf ,pcols, lchnk) - - end subroutine zm_conv_micro_outfld - -end module zm_conv_intr From ca499a34473df52bf98df633adb2e5309e5fa8b5 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 4 Jan 2022 13:38:38 -0700 Subject: [PATCH 066/466] remove cam_dev --- src/physics/cam_dev/physpkg.F90 | 2921 ------------------------------- 1 file changed, 2921 deletions(-) delete mode 100644 src/physics/cam_dev/physpkg.F90 diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 deleted file mode 100644 index 78df1d194b..0000000000 --- a/src/physics/cam_dev/physpkg.F90 +++ /dev/null @@ -1,2921 +0,0 @@ -module physpkg - !----------------------------------------------------------------------- - ! Purpose: - ! - ! Provides the interface to CAM physics package - ! - ! Revision history: - ! Aug 2005, E. B. Kluzek, Creation of module from physpkg subroutine - ! 2005-10-17 B. Eaton Add contents of inti.F90 to phys_init(). Add - ! initialization of grid info in phys_state. - ! Nov 2010 A. Gettelman Put micro/macro physics into separate routines - ! June 2021 A. Herrington Move macro/micro/wetdep/radiation from tphysbc to tphysac - !----------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmd_utils, only: masterproc - use physconst, only: latvap, latice, rh2o - use physics_types, only: physics_state, physics_tend, physics_state_set_grid, & - physics_ptend, physics_tend_init, physics_update, & - physics_type_alloc, physics_ptend_dealloc,& - physics_state_alloc, physics_state_dealloc, physics_tend_alloc, physics_tend_dealloc - use phys_grid, only: get_ncols_p - use phys_gmean, only: gmean_mass - use ppgrid, only: begchunk, endchunk, pcols, pver, pverp, psubcols - use constituents, only: pcnst, cnst_name, cnst_get_ind - use camsrfexch, only: cam_out_t, cam_in_t - - use cam_control_mod, only: ideal_phys, adiabatic - use phys_control, only: phys_do_flux_avg, phys_getopts, waccmx_is - use scamMod, only: single_column, scm_crm_mode - use flux_avg, only: flux_avg_init - use perf_mod - use cam_logfile, only: iulog - use camsrfexch, only: cam_export - - use modal_aero_calcsize, only: modal_aero_calcsize_init, modal_aero_calcsize_diag, modal_aero_calcsize_reg - use modal_aero_wateruptake, only: modal_aero_wateruptake_init, modal_aero_wateruptake_dr, modal_aero_wateruptake_reg - - implicit none - private - save - - ! Public methods - public phys_register ! was initindx - register physics methods - public phys_init ! Public initialization method - public phys_run1 ! First phase of the public run method - public phys_run2 ! Second phase of the public run method - public phys_final ! Public finalization method - - ! Private module data - - ! Physics package options - character(len=16) :: shallow_scheme - character(len=16) :: macrop_scheme - character(len=16) :: microp_scheme - character(len=16) :: subcol_scheme - character(len=32) :: cam_take_snapshot_before ! Physics routine to take a snapshot "before" - character(len=32) :: cam_take_snapshot_after ! Physics routine to take a snapshot "after" - integer :: cld_macmic_num_steps ! Number of macro/micro substeps - integer :: cam_snapshot_before_num ! tape number for before snapshots - integer :: cam_snapshot_after_num ! tape number for after snapshots - logical :: do_clubb_sgs - logical :: use_subcol_microp ! if true, use subcolumns in microphysics - logical :: state_debug_checks ! Debug physics_state. - logical :: clim_modal_aero ! climate controled by prognostic or prescribed modal aerosols - logical :: prog_modal_aero ! Prognostic modal aerosols present - - ! Physics buffer index - integer :: teout_idx = 0 - - integer :: landm_idx = 0 - integer :: sgh_idx = 0 - integer :: sgh30_idx = 0 - - integer :: qini_idx = 0 - integer :: cldliqini_idx = 0 - integer :: cldiceini_idx = 0 - - integer :: prec_str_idx = 0 - integer :: snow_str_idx = 0 - integer :: prec_sed_idx = 0 - integer :: snow_sed_idx = 0 - integer :: prec_pcw_idx = 0 - integer :: snow_pcw_idx = 0 - integer :: prec_dp_idx = 0 - integer :: snow_dp_idx = 0 - integer :: prec_sh_idx = 0 - integer :: snow_sh_idx = 0 - integer :: dlfzm_idx = 0 ! detrained convective cloud water mixing ratio. - integer :: ducore_idx = 0 ! ducore index in physics buffer - integer :: dvcore_idx = 0 ! dvcore index in physics buffer - integer :: cmfmczm_idx = 0 ! Zhang-McFarlane convective mass fluxes - -!======================================================================= -contains -!======================================================================= - - subroutine phys_register - !----------------------------------------------------------------------- - ! - ! Purpose: Register constituents and physics buffer fields. - ! - ! Author: CSM Contact: M. Vertenstein, Aug. 1997 - ! B.A. Boville, Oct 2001 - ! A. Gettelman, Nov 2010 - put micro/macro physics into separate routines - ! - !----------------------------------------------------------------------- - use cam_abortutils, only: endrun - use physics_buffer, only: pbuf_init_time, pbuf_cam_snapshot_register - use physics_buffer, only: pbuf_add_field, dtype_r8, pbuf_register_subcol - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmd_utils, only: masterproc - use constituents, only: pcnst, cnst_add, cnst_chk_dim, cnst_name - - use cam_control_mod, only: moist_physics - use chemistry, only: chem_register - use cloud_fraction, only: cldfrc_register - use rk_stratiform, only: rk_stratiform_register - use microp_driver, only: microp_driver_register - use microp_aero, only: microp_aero_register - use macrop_driver, only: macrop_driver_register - use clubb_intr, only: clubb_register_cam - use conv_water, only: conv_water_register - use physconst, only: mwdry, cpair, mwh2o, cpwv - use tracers, only: tracers_register - use check_energy, only: check_energy_register - use carma_intr, only: carma_register - use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_register - use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_register - use ghg_data, only: ghg_data_register - use vertical_diffusion, only: vd_register - use convect_deep, only: convect_deep_register - use convect_shallow, only: convect_shallow_register - use radiation, only: radiation_register - use co2_cycle, only: co2_register - use flux_avg, only: flux_avg_register - use iondrag, only: iondrag_register - use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_reg - use string_utils, only: to_lower - use prescribed_ozone, only: prescribed_ozone_register - use prescribed_volcaero,only: prescribed_volcaero_register - use prescribed_strataero,only: prescribed_strataero_register - use prescribed_aero, only: prescribed_aero_register - use prescribed_ghg, only: prescribed_ghg_register - use sslt_rebin, only: sslt_rebin_register - use aoa_tracers, only: aoa_tracers_register - use aircraft_emit, only: aircraft_emit_register - use cam_diagnostics, only: diag_register - use cloud_diagnostics, only: cloud_diagnostics_register - use cospsimulator_intr, only: cospsimulator_intr_register - use rad_constituents, only: rad_cnst_get_info ! Added to query if it is a modal aero sim or not - use subcol, only: subcol_register - use subcol_utils, only: is_subcol_on, subcol_get_scheme - use dyn_comp, only: dyn_register - use spcam_drivers, only: spcam_register - use offline_driver, only: offline_driver_reg - - !---------------------------Local variables----------------------------- - ! - integer :: m ! loop index - integer :: mm ! constituent index - integer :: nmodes - !----------------------------------------------------------------------- - - ! Get physics options - call phys_getopts(shallow_scheme_out = shallow_scheme, & - macrop_scheme_out = macrop_scheme, & - microp_scheme_out = microp_scheme, & - cld_macmic_num_steps_out = cld_macmic_num_steps, & - do_clubb_sgs_out = do_clubb_sgs, & - use_subcol_microp_out = use_subcol_microp, & - state_debug_checks_out = state_debug_checks, & - cam_take_snapshot_before_out= cam_take_snapshot_before, & - cam_take_snapshot_after_out = cam_take_snapshot_after, & - cam_snapshot_before_num_out = cam_snapshot_before_num, & - cam_snapshot_after_num_out = cam_snapshot_after_num) - - subcol_scheme = subcol_get_scheme() - - ! Initialize dyn_time_lvls - call pbuf_init_time() - - ! Register the subcol scheme - call subcol_register() - - ! Register water vapor. - ! ***** N.B. ***** This must be the first call to cnst_add so that - ! water vapor is constituent 1. - if (moist_physics) then - call cnst_add('Q', mwh2o, cpwv, 1.E-12_r8, mm, & - longname='Specific humidity', readiv=.true., is_convtran1=.true.) - else - call cnst_add('Q', mwh2o, cpwv, 0.0_r8, mm, & - longname='Specific humidity', readiv=.false., is_convtran1=.true.) - end if - - ! Topography file fields. - call pbuf_add_field('LANDM', 'global', dtype_r8, (/pcols/), landm_idx) - call pbuf_add_field('SGH', 'global', dtype_r8, (/pcols/), sgh_idx) - call pbuf_add_field('SGH30', 'global', dtype_r8, (/pcols/), sgh30_idx) - - ! Fields for physics package diagnostics - call pbuf_add_field('QINI', 'physpkg', dtype_r8, (/pcols,pver/), qini_idx) - call pbuf_add_field('CLDLIQINI', 'physpkg', dtype_r8, (/pcols,pver/), cldliqini_idx) - call pbuf_add_field('CLDICEINI', 'physpkg', dtype_r8, (/pcols,pver/), cldiceini_idx) - - ! check energy package - call check_energy_register - - ! If using a simple physics option (e.g., held_suarez, adiabatic), - ! the normal CAM physics parameterizations are not called. - if (moist_physics) then - - ! register fluxes for saving across time - if (phys_do_flux_avg()) call flux_avg_register() - - call cldfrc_register() - - ! cloud water - if( microp_scheme == 'RK' ) then - call rk_stratiform_register() - elseif( microp_scheme == 'MG' ) then - if (.not. do_clubb_sgs) call macrop_driver_register() - call microp_aero_register() - call microp_driver_register() - end if - - ! Register CLUBB_SGS here - if (do_clubb_sgs) call clubb_register_cam() - - call pbuf_add_field('PREC_STR', 'global',dtype_r8,(/pcols/),prec_str_idx) - call pbuf_add_field('SNOW_STR', 'global',dtype_r8,(/pcols/),snow_str_idx) - call pbuf_add_field('PREC_PCW', 'global',dtype_r8,(/pcols/),prec_pcw_idx) - call pbuf_add_field('SNOW_PCW', 'global',dtype_r8,(/pcols/),snow_pcw_idx) - call pbuf_add_field('PREC_SED', 'global',dtype_r8,(/pcols/),prec_sed_idx) - call pbuf_add_field('SNOW_SED', 'global',dtype_r8,(/pcols/),snow_sed_idx) - - if (is_subcol_on()) then - call pbuf_register_subcol('PREC_STR', 'phys_register', prec_str_idx) - call pbuf_register_subcol('SNOW_STR', 'phys_register', snow_str_idx) - call pbuf_register_subcol('PREC_PCW', 'phys_register', prec_pcw_idx) - call pbuf_register_subcol('SNOW_PCW', 'phys_register', snow_pcw_idx) - call pbuf_register_subcol('PREC_SED', 'phys_register', prec_sed_idx) - call pbuf_register_subcol('SNOW_SED', 'phys_register', snow_sed_idx) - end if - - ! Who should add FRACIS? - ! -- It does not seem that aero_intr should add it since FRACIS is used in convection - ! even if there are no prognostic aerosols ... so do it here for now - call pbuf_add_field('FRACIS','physpkg',dtype_r8,(/pcols,pver,pcnst/),m) - - call conv_water_register() - - ! Determine whether its a 'modal' aerosol simulation or not - call rad_cnst_get_info(0, nmodes=nmodes) - clim_modal_aero = (nmodes > 0) - - if (clim_modal_aero) then - call modal_aero_calcsize_reg() - call modal_aero_wateruptake_reg() - endif - - ! register chemical constituents including aerosols ... - call chem_register() - - ! co2 constituents - call co2_register() - - ! register data model ozone with pbuf - if (cam3_ozone_data_on) then - call cam3_ozone_data_register() - end if - call prescribed_volcaero_register() - call prescribed_strataero_register() - call prescribed_ozone_register() - call prescribed_aero_register() - call prescribed_ghg_register() - call sslt_rebin_register - - ! CAM3 prescribed aerosols - if (cam3_aero_data_on) then - call cam3_aero_data_register() - end if - - ! register various data model gasses with pbuf - call ghg_data_register() - - ! carma microphysics - ! - call carma_register() - - ! Register iondrag variables with pbuf - call iondrag_register() - - ! Register ionosphere variables with pbuf if mode set to ionosphere - if( waccmx_is('ionosphere') ) then - call waccmx_phys_ion_elec_temp_reg() - endif - - call aircraft_emit_register() - - ! deep convection - call convect_deep_register - - ! shallow convection - call convect_shallow_register - - - call spcam_register - - ! radiation - call radiation_register - call cloud_diagnostics_register - - ! COSP - call cospsimulator_intr_register - - ! vertical diffusion - call vd_register() - else - ! held_suarez/adiabatic physics option should be in simple_physics - call endrun('phys_register: moist_physics configuration error') - end if - - ! Register diagnostics PBUF - call diag_register() - - ! Register age of air tracers - call aoa_tracers_register() - - ! Register test tracers - call tracers_register() - - call dyn_register() - - ! All tracers registered, check that the dimensions are correct - call cnst_chk_dim() - - ! ***NOTE*** No registering constituents after the call to cnst_chk_dim. - - call offline_driver_reg() - - ! This needs to be last as it requires all pbuf fields to be added - if (cam_snapshot_before_num > 0 .or. cam_snapshot_after_num > 0) then - call pbuf_cam_snapshot_register() - end if - - end subroutine phys_register - - - - !======================================================================= - - subroutine phys_inidat( cam_out, pbuf2d ) - use cam_abortutils, only: endrun - - use physics_buffer, only: pbuf_get_index, pbuf_get_field, physics_buffer_desc, pbuf_set_field, dyn_time_lvls - - - use cam_initfiles, only: initial_file_get_id, topo_file_get_id - use cam_grid_support, only: cam_grid_check, cam_grid_id - use cam_grid_support, only: cam_grid_get_dim_names - use pio, only: file_desc_t - use ncdio_atm, only: infld - use dycore, only: dycore_is - use polar_avg, only: polar_average - use short_lived_species, only: initialize_short_lived_species - use cam_control_mod, only: aqua_planet - use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_inidat - - type(cam_out_t), intent(inout) :: cam_out(begchunk:endchunk) - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - integer :: lchnk, m, n, i, k, ncol - type(file_desc_t), pointer :: fh_ini, fh_topo - character(len=8) :: fieldname - real(r8), pointer :: tptr(:,:), tptr_2(:,:), tptr3d(:,:,:), tptr3d_2(:,:,:) - real(r8), pointer :: qpert(:,:) - - character(len=11) :: subname='phys_inidat' ! subroutine name - integer :: tpert_idx, qpert_idx, pblh_idx - - logical :: found=.false., found2=.false. - integer :: ierr - character(len=8) :: dim1name, dim2name - integer :: ixcldice, ixcldliq - integer :: grid_id ! grid ID for data mapping - - nullify(tptr,tptr_2,tptr3d,tptr3d_2) - - fh_ini => initial_file_get_id() - fh_topo => topo_file_get_id() - - ! dynamics variables are handled in dyn_init - here we read variables needed for physics - ! but not dynamics - - grid_id = cam_grid_id('physgrid') - if (.not. cam_grid_check(grid_id)) then - call endrun(trim(subname)//': Internal error, no "physgrid" grid') - end if - call cam_grid_get_dim_names(grid_id, dim1name, dim2name) - - allocate(tptr(1:pcols,begchunk:endchunk)) - - if (associated(fh_topo) .and. .not. aqua_planet) then - call infld('SGH', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr, found, gridname='physgrid') - if(.not. found) call endrun('ERROR: SGH not found on topo file') - - call pbuf_set_field(pbuf2d, sgh_idx, tptr) - - allocate(tptr_2(1:pcols,begchunk:endchunk)) - call infld('SGH30', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr_2, found, gridname='physgrid') - if(found) then - call pbuf_set_field(pbuf2d, sgh30_idx, tptr_2) - else - if (masterproc) write(iulog,*) 'Warning: Error reading SGH30 from topo file.' - if (masterproc) write(iulog,*) 'The field SGH30 will be filled using data from SGH.' - call pbuf_set_field(pbuf2d, sgh30_idx, tptr) - end if - - deallocate(tptr_2) - - call infld('LANDM_COSLAT', fh_topo, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr, found, gridname='physgrid') - - if(.not.found) call endrun(' ERROR: LANDM_COSLAT not found on topo dataset.') - - call pbuf_set_field(pbuf2d, landm_idx, tptr) - - else - call pbuf_set_field(pbuf2d, sgh_idx, 0._r8) - call pbuf_set_field(pbuf2d, sgh30_idx, 0._r8) - call pbuf_set_field(pbuf2d, landm_idx, 0._r8) - end if - - call infld('PBLH', fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr(:,:), found, gridname='physgrid') - if(.not. found) then - tptr(:,:) = 0._r8 - if (masterproc) write(iulog,*) 'PBLH initialized to 0.' - end if - pblh_idx = pbuf_get_index('pblh') - - call pbuf_set_field(pbuf2d, pblh_idx, tptr) - - call infld('TPERT', fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr(:,:), found, gridname='physgrid') - if(.not. found) then - tptr(:,:) = 0._r8 - if (masterproc) write(iulog,*) 'TPERT initialized to 0.' - end if - tpert_idx = pbuf_get_index( 'tpert') - call pbuf_set_field(pbuf2d, tpert_idx, tptr) - - fieldname='QPERT' - qpert_idx = pbuf_get_index( 'qpert',ierr) - if (qpert_idx > 0) then - call infld(fieldname, fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr, found, gridname='physgrid') - if(.not. found) then - tptr=0_r8 - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' - end if - - allocate(tptr3d_2(pcols,pcnst,begchunk:endchunk)) - tptr3d_2 = 0_r8 - tptr3d_2(:,1,:) = tptr(:,:) - - call pbuf_set_field(pbuf2d, qpert_idx, tptr3d_2) - deallocate(tptr3d_2) - end if - - fieldname='CUSH' - m = pbuf_get_index('cush', ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, dim2name, 1, pcols, begchunk, endchunk, & - tptr, found, gridname='physgrid') - if(.not.found) then - if(masterproc) write(iulog,*) trim(fieldname), ' initialized to 1000.' - tptr=1000._r8 - end if - do n=1,dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr, start=(/1,n/), kount=(/pcols,1/)) - end do - deallocate(tptr) - end if - - ! - ! 3-D fields - ! - - allocate(tptr3d(pcols,pver,begchunk:endchunk)) - - fieldname='CLOUD' - m = pbuf_get_index('CLD') - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(found) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - else - call pbuf_set_field(pbuf2d, m, 0._r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' - end if - - fieldname='QCWAT' - m = pbuf_get_index(fieldname,ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(.not. found) then - call infld('Q',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if (found) then - if (masterproc) write(iulog,*) trim(fieldname), ' initialized with Q' - if(dycore_is('LR')) call polar_average(pver, tptr3d) - else - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to huge()' - tptr3d = huge(1.0_r8) - end if - end if - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - end if - - fieldname = 'ICCWAT' - m = pbuf_get_index(fieldname, ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(found) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - else - call cnst_get_ind('CLDICE', ixcldice) - call infld('CLDICE',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(found) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - else - call pbuf_set_field(pbuf2d, m, 0._r8) - end if - if (masterproc) then - if (found) then - write(iulog,*) trim(fieldname), ' initialized with CLDICE' - else - write(iulog,*) trim(fieldname), ' initialized to 0.0' - end if - end if - end if - end if - - fieldname = 'LCWAT' - m = pbuf_get_index(fieldname,ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(found) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - else - allocate(tptr3d_2(pcols,pver,begchunk:endchunk)) - call cnst_get_ind('CLDICE', ixcldice) - call cnst_get_ind('CLDLIQ', ixcldliq) - call infld('CLDICE',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - call infld('CLDLIQ',fh_ini,dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d_2, found2, gridname='physgrid') - if(found .and. found2) then - do lchnk = begchunk, endchunk - ncol = get_ncols_p(lchnk) - tptr3d(:ncol,:,lchnk)=tptr3d(:ncol,:,lchnk)+tptr3d_2(:ncol,:,lchnk) - end do - if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDICE + CLDLIQ' - else if (found) then ! Data already loaded in tptr3d - if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDICE only' - else if (found2) then - tptr3d(:,:,:)=tptr3d_2(:,:,:) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized with CLDLIQ only' - end if - - if (found .or. found2) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - if(dycore_is('LR')) call polar_average(pver, tptr3d) - else - call pbuf_set_field(pbuf2d, m, 0._r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.0' - end if - deallocate(tptr3d_2) - end if - end if - - deallocate(tptr3d) - allocate(tptr3d(pcols,pver,begchunk:endchunk)) - - fieldname = 'TCWAT' - m = pbuf_get_index(fieldname,ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(.not.found) then - call infld('T', fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if (found) then - if(dycore_is('LR')) call polar_average(pver, tptr3d) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized with T' - else - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to huge()' - tptr3d = huge(1._r8) - end if - end if - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - end if - - deallocate(tptr3d) - allocate(tptr3d(pcols,pverp,begchunk:endchunk)) - - fieldname = 'TKE' - m = pbuf_get_index( 'tke') - call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if (found) then - call pbuf_set_field(pbuf2d, m, tptr3d) - else - call pbuf_set_field(pbuf2d, m, 0.01_r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.01' - end if - - - fieldname = 'KVM' - m = pbuf_get_index('kvm') - call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if (found) then - call pbuf_set_field(pbuf2d, m, tptr3d) - else - call pbuf_set_field(pbuf2d, m, 0._r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' - end if - - - fieldname = 'KVH' - m = pbuf_get_index('kvh') - call infld(fieldname, fh_ini, dim1name, 'ilev', dim2name, 1, pcols, 1, pverp, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if (found) then - call pbuf_set_field(pbuf2d, m, tptr3d) - else - call pbuf_set_field(pbuf2d, m, 0._r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' - end if - - deallocate(tptr3d) - allocate(tptr3d(pcols,pver,begchunk:endchunk)) - - fieldname = 'CONCLD' - m = pbuf_get_index('CONCLD',ierr) - if (m > 0) then - call infld(fieldname, fh_ini, dim1name, 'lev', dim2name, 1, pcols, 1, pver, begchunk, endchunk, & - tptr3d, found, gridname='physgrid') - if(found) then - do n = 1, dyn_time_lvls - call pbuf_set_field(pbuf2d, m, tptr3d, (/1,1,n/),(/pcols,pver,1/)) - end do - else - call pbuf_set_field(pbuf2d, m, 0._r8) - if (masterproc) write(iulog,*) trim(fieldname), ' initialized to 0.' - end if - - deallocate (tptr3d) - end if - - call initialize_short_lived_species(fh_ini, pbuf2d) - - !--------------------------------------------------------------------------------- - ! If needed, get ion and electron temperature fields from initial condition file - !--------------------------------------------------------------------------------- - - call waccmx_phys_ion_elec_temp_inidat(fh_ini,pbuf2d) - - end subroutine phys_inidat - - - subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) - - !----------------------------------------------------------------------- - ! - ! Initialization of physics package. - ! - !----------------------------------------------------------------------- - - use physics_buffer, only: physics_buffer_desc, pbuf_initialize, pbuf_get_index - use physconst, only: rair, cpair, gravit, stebol, tmelt, & - latvap, latice, rh2o, rhoh2o, pstd, zvir, & - karman, rhodair, physconst_init - use ref_pres, only: pref_edge, pref_mid - - use carma_intr, only: carma_init - use cam_control_mod, only: initial_run - use check_energy, only: check_energy_init - use chemistry, only: chem_init - use prescribed_ozone, only: prescribed_ozone_init - use prescribed_ghg, only: prescribed_ghg_init - use prescribed_aero, only: prescribed_aero_init - use aerodep_flx, only: aerodep_flx_init - use aircraft_emit, only: aircraft_emit_init - use prescribed_volcaero,only: prescribed_volcaero_init - use prescribed_strataero,only: prescribed_strataero_init - use cloud_fraction, only: cldfrc_init - use cldfrc2m, only: cldfrc2m_init - use co2_cycle, only: co2_init, co2_transport - use convect_deep, only: convect_deep_init - use convect_shallow, only: convect_shallow_init - use cam_diagnostics, only: diag_init - use gw_drag, only: gw_init - use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_init - use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_init - use radheat, only: radheat_init - use radiation, only: radiation_init - use cloud_diagnostics, only: cloud_diagnostics_init - use rk_stratiform, only: rk_stratiform_init - use wv_saturation, only: wv_sat_init - use microp_driver, only: microp_driver_init - use microp_aero, only: microp_aero_init - use macrop_driver, only: macrop_driver_init - use conv_water, only: conv_water_init - use spcam_drivers, only: spcam_init - use tracers, only: tracers_init - use aoa_tracers, only: aoa_tracers_init - use rayleigh_friction, only: rayleigh_friction_init - use pbl_utils, only: pbl_utils_init - use vertical_diffusion, only: vertical_diffusion_init - use phys_debug_util, only: phys_debug_init - use phys_debug, only: phys_debug_state_init - use rad_constituents, only: rad_cnst_init - use aer_rad_props, only: aer_rad_props_init - use subcol, only: subcol_init - use qbo, only: qbo_init - use qneg_module, only: qneg_init - use lunar_tides, only: lunar_tides_init - use iondrag, only: iondrag_init, do_waccm_ions -#if ( defined OFFLINE_DYN ) - use metdata, only: metdata_phys_init -#endif - use epp_ionization, only: epp_ionization_init, epp_ionization_active - use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_init ! Initialization of ionosphere module (WACCM-X) - use waccmx_phys_intr, only: waccmx_phys_mspd_init ! Initialization of major species diffusion module (WACCM-X) - use clubb_intr, only: clubb_ini_cam - 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 cam_abortutils, only: endrun - use nudging, only: Nudge_Model, nudging_init - use cam_snapshot, only: cam_snapshot_init - use cam_history, only: addfld, register_vector_field, add_default - use phys_control, only: phys_getopts - - ! Input/output arguments - type(physics_state), pointer :: phys_state(:) - type(physics_tend ), pointer :: phys_tend(:) - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - type(cam_in_t), intent(in) :: cam_in(begchunk:endchunk) - type(cam_out_t),intent(inout) :: cam_out(begchunk:endchunk) - - ! local variables - integer :: lchnk - integer :: ierr - - logical :: history_budget ! output tendencies and state variables for - ! temperature, water vapor, cloud - ! ice, cloud liquid, U, V - integer :: history_budget_histfile_num ! output history file number for budget fields - - !----------------------------------------------------------------------- - - call physics_type_alloc(phys_state, phys_tend, begchunk, endchunk, pcols) - - do lchnk = begchunk, endchunk - call physics_state_set_grid(lchnk, phys_state(lchnk)) - end do - - !------------------------------------------------------------------------------------------- - ! Initialize any variables in physconst which are not temporally and/or spatially constant - !------------------------------------------------------------------------------------------- - call physconst_init() - - ! Initialize debugging a physics column - call phys_debug_init() - - call pbuf_initialize(pbuf2d) - - ! Initialize subcol scheme - call subcol_init(pbuf2d) - - ! diag_init makes addfld calls for dynamics fields that are output from - ! the physics decomposition - call diag_init(pbuf2d) - - call check_energy_init() - - call tracers_init() - - ! age of air tracers - call aoa_tracers_init() - - teout_idx = pbuf_get_index( 'TEOUT') - - ! adiabatic or ideal physics should be only used if in simple_physics - if (adiabatic .or. ideal_phys) then - if (adiabatic) then - call endrun('phys_init: adiabatic configuration error') - else - call endrun('phys_init: ideal_phys configuration error') - end if - end if - - if (initial_run) then - call phys_inidat(cam_out, pbuf2d) - end if - - ! wv_saturation is relatively independent of everything else and - ! low level, so init it early. Must at least do this before radiation. - call wv_sat_init - - ! CAM3 prescribed aerosols - if (cam3_aero_data_on) call cam3_aero_data_init(phys_state) - - ! Initialize rad constituents and their properties - call rad_cnst_init() - call aer_rad_props_init() - - ! initialize carma - call carma_init() - - ! solar irradiance data modules - call solar_data_init() - - ! Prognostic chemistry. - call chem_init(phys_state,pbuf2d) - - ! Prescribed tracers - call prescribed_ozone_init() - call prescribed_ghg_init() - call prescribed_aero_init() - call aerodep_flx_init() - call aircraft_emit_init() - call prescribed_volcaero_init() - call prescribed_strataero_init() - - ! co2 cycle - if (co2_transport()) then - call co2_init() - end if - - ! CAM3 prescribed ozone - if (cam3_ozone_data_on) call cam3_ozone_data_init(phys_state) - - call gw_init() - - call rayleigh_friction_init() - - call pbl_utils_init(gravit, karman, cpair, rair, zvir) - call vertical_diffusion_init(pbuf2d) - - if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then - call waccmx_phys_mspd_init () - ! Initialization of ionosphere module if mode set to ionosphere - if( waccmx_is('ionosphere') ) then - call waccmx_phys_ion_elec_temp_init(pbuf2d) - endif - endif - - call radiation_init(pbuf2d) - - call cloud_diagnostics_init() - - call radheat_init(pref_mid) - - call convect_shallow_init(pref_edge, pbuf2d) - - call cldfrc_init() - call cldfrc2m_init() - - call convect_deep_init(pref_edge) - - if( microp_scheme == 'RK' ) then - call rk_stratiform_init() - elseif( microp_scheme == 'MG' ) then - if (.not. do_clubb_sgs) call macrop_driver_init(pbuf2d) - call microp_aero_init(pbuf2d) - call microp_driver_init(pbuf2d) - call conv_water_init - elseif( microp_scheme == 'SPCAM_m2005') then - call conv_water_init - end if - - - ! initiate CLUBB within CAM - if (do_clubb_sgs) call clubb_ini_cam(pbuf2d) - - call spcam_init(pbuf2d) - - call qbo_init - - call lunar_tides_init() - - call iondrag_init(pref_mid) - ! Geomagnetic module -- after iondrag_init - if (epp_ionization_active) then - call epp_ionization_init() - endif - -#if ( defined OFFLINE_DYN ) - call metdata_phys_init() -#endif - call sslt_rebin_init() - call tropopause_init() - call dadadj_init() - - prec_dp_idx = pbuf_get_index('PREC_DP') - snow_dp_idx = pbuf_get_index('SNOW_DP') - prec_sh_idx = pbuf_get_index('PREC_SH') - snow_sh_idx = pbuf_get_index('SNOW_SH') - - dlfzm_idx = pbuf_get_index('DLFZM', ierr) - cmfmczm_idx = pbuf_get_index('CMFMCDZM',ierr) - - call phys_getopts(prog_modal_aero_out=prog_modal_aero) - - ! Initialize Nudging Parameters - !-------------------------------- - if(Nudge_Model) call nudging_init - - if (clim_modal_aero) then - - ! If climate calculations are affected by prescribed modal aerosols, the - ! the initialization routine for the dry mode radius calculation is called - ! here. For prognostic MAM the initialization is called from - ! modal_aero_initialize - if (.not. prog_modal_aero) then - call modal_aero_calcsize_init(pbuf2d) - endif - - call modal_aero_wateruptake_init(pbuf2d) - - end if - - ! Initialize qneg3 and qneg4 - call qneg_init() - - ! Initialize the snapshot capability - call cam_snapshot_init(cam_in, cam_out, pbuf2d, begchunk) - - ! 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') - call addfld ( 'VTEND_DCONV', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by deep convection') - call register_vector_field ( 'UTEND_DCONV', 'VTEND_DCONV') - call addfld ( 'UTEND_SHCONV', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by shallow convection') - call addfld ( 'VTEND_SHCONV', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by shallow convection') - call register_vector_field ( 'UTEND_SHCONV', 'VTEND_SHCONV') - call addfld ( 'UTEND_MACROP', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by macrophysics') - call addfld ( 'VTEND_MACROP', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by macrophysics') - call register_vector_field ( 'UTEND_MACROP', 'VTEND_MACROP') - call addfld ( 'UTEND_VDIFF', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by vert. diffus.') - call addfld ( 'VTEND_VDIFF', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by vert. diffus.') - call register_vector_field ( 'UTEND_VDIFF', 'VTEND_VDIFF') - call addfld ( 'UTEND_RAYLEIGH', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by Rayleigh Fric.') - call addfld ( 'VTEND_RAYLEIGH', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by Rayleigh Fric.') - call register_vector_field ( 'UTEND_RAYLEIGH', 'VTEND_RAYLEIGH') - call addfld ( 'UTEND_GWDTOT', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by all GWs') - call addfld ( 'VTEND_GWDTOT', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by all GWs') - call register_vector_field ( 'UTEND_GWDTOT', 'VTEND_GWDTOT') - call addfld ( 'UTEND_QBORLX', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by QBO relaxation') - call addfld ( 'VTEND_QBORLX', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by QBO relaxation') - call register_vector_field ( 'UTEND_QBORLX', 'VTEND_QBORLX') - call addfld ( 'UTEND_LUNART', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by lunar tides') - call addfld ( 'VTEND_LUNART', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by lunar tides') - call register_vector_field ( 'UTEND_LUNART', 'VTEND_LUNART') - call addfld ( 'UTEND_IONDRG', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by ion drag') - call addfld ( 'VTEND_IONDRG', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by ion drag') - call register_vector_field ( 'UTEND_IONDRG', 'VTEND_IONDRG') - call addfld ( 'UTEND_NDG', (/ 'lev' /), 'A', 'm/s2', 'Zonal wind tendency by nudging') - call addfld ( 'VTEND_NDG', (/ 'lev' /), 'A', 'm/s2', 'Meridional wind tendency by nudging') - call register_vector_field ( 'UTEND_NDG', 'VTEND_NDG') - call addfld('UTEND_CORE', (/ 'lev' /), 'A', 'm/s2' , 'Zonal wind tendency due to dynamical core') - call addfld('VTEND_CORE', (/ 'lev' /), 'A', 'm/s2' , 'Meridional wind tendency due to dynamical core') - call register_vector_field('UTEND_CORE','VTEND_CORE') - - - call phys_getopts(history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num) - - if ( history_budget ) then - call add_default ( 'UTEND_DCONV' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_DCONV' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_SHCONV' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_SHCONV' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_MACROP' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_MACROP' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_VDIFF' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_VDIFF' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_RAYLEIGH' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_RAYLEIGH' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_GWDTOT' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_GWDTOT' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_QBORLX' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_QBORLX' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_LUNART' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_LUNART' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_IONDRG' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_IONDRG' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_NDG' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_NDG' , history_budget_histfile_num, ' ') - call add_default ( 'UTEND_CORE' , history_budget_histfile_num, ' ') - call add_default ( 'VTEND_CORE' , history_budget_histfile_num, ' ') - end if - - ducore_idx = pbuf_get_index('DUCORE') - dvcore_idx = pbuf_get_index('DVCORE') - - end subroutine phys_init - - ! - !----------------------------------------------------------------------- - ! - - subroutine phys_run1(phys_state, ztodt, phys_tend, pbuf2d, cam_in, cam_out) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! First part of atmospheric physics package before updating of surface models - ! - !----------------------------------------------------------------------- - use time_manager, only: get_nstep - use cam_diagnostics,only: diag_allocate, diag_physvar_ic - use check_energy, only: check_energy_gmean - use phys_control, only: phys_getopts - use spcam_drivers, only: tphysbc_spcam - use spmd_utils, only: mpicom - use physics_buffer, only: physics_buffer_desc, pbuf_get_chunk, pbuf_allocate -#if (defined BFB_CAM_SCAM_IOP ) - use cam_history, only: outfld -#endif - use cam_abortutils, only: endrun -#if ( defined OFFLINE_DYN ) - use metdata, only: get_met_srf1 -#endif - ! - ! Input arguments - ! - real(r8), intent(in) :: ztodt ! physics time step unless nstep=0 - ! - ! Input/Output 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, dimension(:,:) :: pbuf2d - type(cam_in_t), dimension(begchunk:endchunk) :: cam_in - type(cam_out_t), dimension(begchunk:endchunk) :: cam_out - !----------------------------------------------------------------------- - ! - !---------------------------Local workspace----------------------------- - ! - integer :: c ! indices - integer :: ncol ! number of columns - integer :: nstep ! current timestep number - logical :: use_spcam - type(physics_buffer_desc), pointer :: phys_buffer_chunk(:) - - call t_startf ('physpkg_st1') - nstep = get_nstep() - -#if ( defined OFFLINE_DYN ) - ! - ! if offline mode set SNOWH and TS for micro-phys - ! - call get_met_srf1( cam_in ) -#endif - - ! The following initialization depends on the import state (cam_in) - ! being initialized. This isn't true when cam_init is called, so need - ! to postpone this initialization to here. - if (nstep == 0 .and. phys_do_flux_avg()) call flux_avg_init(cam_in, pbuf2d) - - ! Compute total energy of input state and previous output state - call t_startf ('chk_en_gmean') - call check_energy_gmean(phys_state, pbuf2d, ztodt, nstep) - call t_stopf ('chk_en_gmean') - - call t_stopf ('physpkg_st1') - - call t_startf ('physpkg_st1') - - call pbuf_allocate(pbuf2d, 'physpkg') - call diag_allocate() - - !----------------------------------------------------------------------- - ! Advance time information - !----------------------------------------------------------------------- - - call phys_timestep_init(phys_state, cam_in, cam_out, pbuf2d) - - call t_stopf ('physpkg_st1') - -#ifdef TRACER_CHECK - call gmean_mass ('before tphysbc DRY', phys_state) -#endif - - - !----------------------------------------------------------------------- - ! Tendency physics before flux coupler invocation - !----------------------------------------------------------------------- - ! - -#if (defined BFB_CAM_SCAM_IOP ) - do c=begchunk, endchunk - call outfld('Tg',cam_in(c)%ts,pcols ,c ) - end do -#endif - - call t_barrierf('sync_bc_physics', mpicom) - call t_startf ('bc_physics') - call t_adj_detailf(+1) - - call phys_getopts( use_spcam_out = use_spcam) - -!$OMP PARALLEL DO PRIVATE (C, phys_buffer_chunk) - do c=begchunk, endchunk - ! - ! Output physics terms to IC file - ! - phys_buffer_chunk => pbuf_get_chunk(pbuf2d, c) - - call t_startf ('diag_physvar_ic') - call diag_physvar_ic ( c, phys_buffer_chunk, cam_out(c), cam_in(c) ) - call t_stopf ('diag_physvar_ic') - - if (use_spcam) then - call tphysbc_spcam (ztodt, phys_state(c), & - phys_tend(c), phys_buffer_chunk, & - cam_out(c), cam_in(c) ) - else - call tphysbc (ztodt, phys_state(c), & - phys_tend(c), phys_buffer_chunk, & - cam_out(c), cam_in(c) ) - end if - - end do - - call t_adj_detailf(-1) - call t_stopf ('bc_physics') - - ! Don't call the rest in CRM mode - if(single_column.and.scm_crm_mode) return - -#ifdef TRACER_CHECK - call gmean_mass ('between DRY', phys_state) -#endif - - end subroutine phys_run1 - - ! - !----------------------------------------------------------------------- - ! - - subroutine phys_run2(phys_state, ztodt, phys_tend, pbuf2d, cam_out, & - cam_in ) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Second part of atmospheric physics package after updating of surface models - ! - !----------------------------------------------------------------------- - use physics_buffer, only: physics_buffer_desc, pbuf_get_chunk, pbuf_deallocate, pbuf_update_tim_idx - use mo_lightning, only: lightning_no_prod - use cam_diagnostics, only: diag_deallocate, diag_surf - use physconst, only: stebol, latvap - use carma_intr, only: carma_accumulate_stats - use spmd_utils, only: mpicom - use iop_forcing, only: scam_use_iop_srf -#if ( defined OFFLINE_DYN ) - use metdata, only: get_met_srf2 -#endif - ! - ! Input arguments - ! - real(r8), intent(in) :: ztodt ! physics time step unless nstep=0 - ! - ! Input/Output 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, dimension(:,:) :: pbuf2d - - type(cam_out_t), intent(inout), dimension(begchunk:endchunk) :: cam_out - type(cam_in_t), intent(inout), dimension(begchunk:endchunk) :: cam_in - ! - !----------------------------------------------------------------------- - !---------------------------Local workspace----------------------------- - ! - integer :: c ! chunk index - integer :: ncol ! number of columns - type(physics_buffer_desc),pointer, dimension(:) :: phys_buffer_chunk - ! - ! If exit condition just return - ! - - if(single_column.and.scm_crm_mode) return - !----------------------------------------------------------------------- - ! if using IOP values for surface fluxes overwrite here after surface components run - !----------------------------------------------------------------------- - if (single_column) call scam_use_iop_srf(cam_in) - - !----------------------------------------------------------------------- - ! Tendency physics after coupler - ! Not necessary at terminal timestep. - !----------------------------------------------------------------------- - ! -#if ( defined OFFLINE_DYN ) - ! - ! if offline mode set SHFLX QFLX TAUX TAUY for vert diffusion - ! - call get_met_srf2( cam_in ) -#endif - ! Set lightning production of NO - call t_startf ('lightning_no_prod') - call lightning_no_prod( phys_state, pbuf2d, cam_in ) - call t_stopf ('lightning_no_prod') - - call t_barrierf('sync_ac_physics', mpicom) - call t_startf ('ac_physics') - call t_adj_detailf(+1) - -!$OMP PARALLEL DO PRIVATE (C, NCOL, phys_buffer_chunk) - - do c=begchunk,endchunk - ncol = get_ncols_p(c) - phys_buffer_chunk => pbuf_get_chunk(pbuf2d, c) - ! - ! surface diagnostics for history files - ! - call t_startf('diag_surf') - call diag_surf(cam_in(c), cam_out(c), phys_state(c), phys_buffer_chunk) - call t_stopf('diag_surf') - - call tphysac(ztodt, cam_in(c), & - cam_out(c), & - phys_state(c), phys_tend(c), phys_buffer_chunk) - end do ! Chunk loop - - call t_adj_detailf(-1) - call t_stopf('ac_physics') - -#ifdef TRACER_CHECK - call gmean_mass ('after tphysac FV:WET)', phys_state) -#endif - - call t_startf ('carma_accumulate_stats') - call carma_accumulate_stats() - call t_stopf ('carma_accumulate_stats') - - call t_startf ('physpkg_st2') - call pbuf_deallocate(pbuf2d, 'physpkg') - - call pbuf_update_tim_idx() - call diag_deallocate() - call t_stopf ('physpkg_st2') - - end subroutine phys_run2 - - ! - !----------------------------------------------------------------------- - ! - - subroutine phys_final( phys_state, phys_tend, pbuf2d ) - use physics_buffer, only : physics_buffer_desc, pbuf_deallocate - use chemistry, only : chem_final - use carma_intr, only : carma_final - use wv_saturation, only : wv_sat_final - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Finalization of physics package - ! - !----------------------------------------------------------------------- - ! Input/output arguments - type(physics_state), pointer :: phys_state(:) - type(physics_tend ), pointer :: phys_tend(:) - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - if(associated(pbuf2d)) then - call pbuf_deallocate(pbuf2d,'global') - deallocate(pbuf2d) - end if - deallocate(phys_state) - deallocate(phys_tend) - call chem_final - call carma_final - call wv_sat_final - - end subroutine phys_final - - - subroutine tphysac (ztodt, cam_in, & - cam_out, state, tend, pbuf) - !----------------------------------------------------------------------- - ! - ! Tendency physics after coupling to land, sea, and ice models. - ! - ! Computes the following: - ! - ! o Aerosol Emission at Surface - ! o Stratiform Macro-Microphysics - ! o Wet Scavenging of Aerosol - ! o Radiation - ! o Source-Sink for Advected Tracers - ! o Symmetric Turbulence Scheme - Vertical Diffusion - ! o Rayleigh Friction - ! o Dry Deposition of Aerosol - ! o Enforce Charge Neutrality ( Only for WACCM ) - ! o Gravity Wave Drag - ! o QBO Relaxation ( Only for WACCM ) - ! o Ion Drag ( Only for WACCM ) - ! o Scale Dry Mass Energy - !----------------------------------------------------------------------- - use physics_buffer, only: physics_buffer_desc, pbuf_set_field, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx - use shr_kind_mod, only: r8 => shr_kind_r8 - use chemistry, only: chem_is_active, chem_timestep_tend, chem_emissions - use cam_diagnostics, only: diag_phys_tend_writeout - use gw_drag, only: gw_tend - use vertical_diffusion, only: vertical_diffusion_tend - use rayleigh_friction, only: rayleigh_friction_tend - use constituents, only: cnst_get_ind - use physics_types, only: physics_state, physics_tend, physics_ptend, physics_update, & - physics_dme_adjust, set_dry_to_wet, physics_state_check - use waccmx_phys_intr, only: waccmx_phys_mspd_tend ! WACCM-X major diffusion - use waccmx_phys_intr, only: waccmx_phys_ion_elec_temp_tend ! WACCM-X - use aoa_tracers, only: aoa_tracers_timestep_tend - use physconst, only: rhoh2o, latvap,latice - use aero_model, only: aero_model_drydep - use check_energy, only: check_energy_chng, calc_te_and_aam_budgets - use check_energy, only: check_tracers_data, check_tracers_init, check_tracers_chng - use time_manager, only: get_nstep - use cam_abortutils, only: endrun - use dycore, only: dycore_is - use cam_control_mod, only: aqua_planet - use mo_gas_phase_chemdr,only: map2chm - use clybry_fam, only: clybry_fam_set - use charge_neutrality, only: charge_balance - use qbo, only: qbo_relax - use iondrag, only: iondrag_calc, do_waccm_ions - use perf_mod - use flux_avg, only: flux_avg_run - use cam_history, only: hist_fld_active, outfld - use qneg_module, only: qneg4 - use co2_cycle, only: co2_cycle_set_ptend - use nudging, only: Nudge_Model,Nudge_ON,nudging_timestep_tend - use cam_snapshot, only: cam_snapshot_all_outfld_tphysac - use cam_snapshot, only: cam_snapshot_ptend_outfld - use lunar_tides, only: lunar_tides_tend -!+++ARH -! use ssatcontrail, only: ssatcontrail_d0 -!---ARH - use physics_types, only: physics_ptend_init, physics_ptend_sum, physics_ptend_scale - use cam_snapshot, only: cam_snapshot_all_outfld_tphysbc - use microp_driver, only: microp_driver_tend - use microp_aero, only: microp_aero_run - use macrop_driver, only: macrop_driver_tend - use clubb_intr, only: clubb_tend_cam - use subcol, only: subcol_gen, subcol_ptend_avg - use subcol_utils, only: subcol_ptend_copy, is_subcol_on - use subcol_SILHS, only: subcol_SILHS_var_covar_driver - use subcol_SILHS, only: subcol_SILHS_fill_holes_conserv - use subcol_SILHS, only: subcol_SILHS_hydromet_conc_tend_lim - use micro_mg_cam, only: massless_droplet_destroyer - use convect_deep, only: convect_deep_tend_2, deep_scheme_does_scav_trans - use cloud_diagnostics, only: cloud_diagnostics_calc - use radiation, only: radiation_tend - use tropopause, only: tropopause_output - use cam_diagnostics, only: diag_phys_writeout, diag_conv, diag_clip_tend_writeout - use aero_model, only: aero_model_wetdep - use physics_buffer, only: col_type_subcol - use check_energy, only: check_energy_timestep_init - ! - ! Arguments - ! - real(r8), intent(in) :: ztodt ! Two times model timestep (2 delta-t) - - type(cam_in_t), intent(inout) :: cam_in - type(cam_out_t), intent(inout) :: cam_out - type(physics_state), intent(inout) :: state - type(physics_tend ), intent(inout) :: tend - type(physics_buffer_desc), pointer :: pbuf(:) - - - type(check_tracers_data):: tracerint ! tracer mass integrals and cummulative boundary fluxes - - ! - !---------------------------Local workspace----------------------------- - ! - type(physics_ptend) :: ptend ! indivdual parameterization tendencies - type(physics_ptend) :: ptend_macp_all ! sum of macrophysics tendencies (e.g. CLUBB) over substeps - type(physics_state) :: state_sc ! state for sub-columns - type(physics_ptend) :: ptend_sc ! ptend for sub-columns - type(physics_ptend) :: ptend_aero ! ptend for microp_aero - type(physics_ptend) :: ptend_aero_sc ! ptend for microp_aero on sub-columns - type(physics_tend) :: tend_sc ! tend for sub-columns - - integer :: nstep ! current timestep number - real(r8) :: zero(pcols) ! array of zeros - - integer :: lchnk ! chunk identifier - integer :: ncol ! number of atmospheric columns - integer i,k,m ! Longitude, level indices - integer :: yr, mon, day, tod ! components of a date - integer :: ixq, ixcldice, ixcldliq ! constituent indices for vapor, cloud liquid and ice water. - - ! for macro/micro co-substepping - integer :: macmic_it ! iteration variables - real(r8) :: cld_macmic_ztodt ! modified timestep - - 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) pflx(pcols,pverp) ! Conv rain flux thru out btm of lev - real(r8) rtdt ! 1./ztodt - - 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) :: zero_sc(pcols*psubcols) ! array of zeros - real(r8) :: zero_tracers(pcols,pcnst) - - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: cmfmczm(:,:) ! ZM convective mass fluxes - - ! stratiform precipitation variables - real(r8),pointer :: prec_str(:) ! sfc flux of precip from stratiform (m/s) - real(r8),pointer :: snow_str(:) ! sfc flux of snow from stratiform (m/s) - real(r8),pointer :: prec_str_sc(:) ! sfc flux of precip from stratiform (m/s) -- for subcolumns - real(r8),pointer :: snow_str_sc(:) ! sfc flux of snow from stratiform (m/s) -- for subcolumns - real(r8),pointer :: prec_pcw(:) ! total precip from prognostic cloud scheme - real(r8),pointer :: snow_pcw(:) ! snow from prognostic cloud scheme - real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation - real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation - -!+++ARH - real(r8),pointer :: prec_sh(:) ! total precipitation from Hack convection - real(r8),pointer :: snow_sh(:) ! snow from Hack convection -!---ARH - - ! Local copies for substepping - real(r8) :: prec_pcw_macmic(pcols) - real(r8) :: snow_pcw_macmic(pcols) - real(r8) :: prec_sed_macmic(pcols) - real(r8) :: snow_sed_macmic(pcols) - -!+++ARH - real(r8) :: prec_sh_macmic(pcols) - real(r8) :: snow_sh_macmic(pcols) -!---ARH - - 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) :: tmp_q (pcols,pver) ! tmp space - real(r8) :: tmp_cldliq(pcols,pver) ! tmp space - real(r8) :: tmp_cldice(pcols,pver) ! tmp space - real(r8) :: tmp_trac (pcols,pver,pcnst) ! tmp space - real(r8) :: tmp_pdel (pcols,pver) ! tmp space - real(r8) :: tmp_ps (pcols) ! tmp space - - ! physics buffer fields for total energy and mass adjustment - integer itim_old, ifld - - real(r8), pointer, dimension(:,:) :: cld - real(r8), pointer, dimension(:,:) :: qini - real(r8), pointer, dimension(:,:) :: cldliqini - real(r8), pointer, dimension(:,:) :: cldiceini - real(r8), pointer, dimension(:,:) :: dtcore - real(r8), pointer, dimension(:,:) :: ducore - real(r8), pointer, dimension(:,:) :: dvcore - real(r8), pointer, dimension(:,:) :: ast ! relative humidity cloud fraction - - !----------------------------------------------------------------------- - lchnk = state%lchnk - ncol = state%ncol - - nstep = get_nstep() - rtdt = 1._r8/ztodt - - call cnst_get_ind('Q', ixq) - call cnst_get_ind('CLDLIQ', ixcldliq) - call cnst_get_ind('CLDICE', ixcldice) - - call pbuf_get_field(pbuf, prec_str_idx, prec_str ) - call pbuf_get_field(pbuf, snow_str_idx, snow_str ) - call pbuf_get_field(pbuf, prec_sed_idx, prec_sed ) - call pbuf_get_field(pbuf, snow_sed_idx, snow_sed ) - call pbuf_get_field(pbuf, prec_pcw_idx, prec_pcw ) - call pbuf_get_field(pbuf, snow_pcw_idx, snow_pcw ) - - if (is_subcol_on()) then - call pbuf_get_field(pbuf, prec_str_idx, prec_str_sc, col_type=col_type_subcol) - call pbuf_get_field(pbuf, snow_str_idx, snow_str_sc, col_type=col_type_subcol) - end if - - if (dlfzm_idx > 0) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - dlf(:ncol,:) = dlfzm(:ncol,:) - else - dlf(:,:) = 0._r8 - end if - - if (cmfmczm_idx > 0) then - call pbuf_get_field(pbuf, cmfmczm_idx, cmfmczm) - cmfmc(:ncol,:) = cmfmczm - else - cmfmc(:ncol,:) = 0._r8 - end if - - ! Adjust the surface fluxes to reduce instabilities in near sfc layer - if (phys_do_flux_avg()) then - call flux_avg_run(state, cam_in, pbuf, nstep, ztodt) - endif - - ! Validate the physics state. - if (state_debug_checks) & - call physics_state_check(state, name="before tphysac") - - call t_startf('tphysac_init') - ! Associate pointers with physics buffer fields - itim_old = pbuf_old_tim_idx() - - - ifld = pbuf_get_index('DTCORE') - call pbuf_get_field(pbuf, ifld, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - - call pbuf_get_field(pbuf, qini_idx, qini) - call pbuf_get_field(pbuf, cldliqini_idx, cldliqini) - call pbuf_get_field(pbuf, cldiceini_idx, cldiceini) - - ifld = pbuf_get_index('CLD') - call pbuf_get_field(pbuf, ifld, cld, start=(/1,1,itim_old/),kount=(/pcols,pver,1/)) - - ifld = pbuf_get_index('AST') - call pbuf_get_field(pbuf, ifld, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - -!+++ARH - call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) - call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) -!---ARH - ! - ! accumulate fluxes into net flux array for spectral dycores - ! jrm Include latent heat of fusion for snow - ! - do i=1,ncol - tend%flx_net(i) = tend%flx_net(i) + cam_in%shf(i) + (cam_out%precc(i) & - + cam_out%precl(i))*latvap*rhoh2o & - + (cam_out%precsc(i) + cam_out%precsl(i))*latice*rhoh2o - end do - - ! emissions of aerosols and gas-phase chemistry constituents at surface - - if (trim(cam_take_snapshot_before) == "chem_emissions") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - call chem_emissions( state, cam_in ) - if (trim(cam_take_snapshot_after) == "chem_emissions") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - ! get nstep and zero array for energy checker - zero = 0._r8 - zero_sc(:) = 0._r8 - zero_tracers(:,:) = 0._r8 - nstep = get_nstep() - call check_tracers_init(state, tracerint) - - ! Check if latent heat flux exceeds the total moisture content of the - ! lowest model layer, thereby creating negative moisture. - - call qneg4('TPHYSAC', lchnk, ncol, ztodt , & - state%q(1,pver,1), state%rpdel(1,pver), & - cam_in%shf, cam_in%lhf, cam_in%cflx) - - call t_stopf('tphysac_init') - - if( microp_scheme == 'MG' ) then - ! Start co-substepping of macrophysics and microphysics - cld_macmic_ztodt = ztodt/cld_macmic_num_steps - - ! Clear precip fields that should accumulate. - prec_sed_macmic = 0._r8 - snow_sed_macmic = 0._r8 - prec_pcw_macmic = 0._r8 - snow_pcw_macmic = 0._r8 -!+++ARH - prec_sh_macmic = 0._r8 - snow_sh_macmic = 0._r8 -!---ARH - -!+++ARH -! ! contrail parameterization -! ! see Chen et al., 2012: Global contrail coverage simulated -! ! by CAM5 with the inventory of 2006 global aircraft emissions, JAMES -! ! https://doi.org/10.1029/2011MS000105 -! call ssatcontrail_d0(state, pbuf, ztodt, ptend) -! call physics_update(state, ptend, ztodt, tend) -!---ARH - ! initialize ptend structures where macro and microphysics tendencies are - ! accumulated over macmic substeps - call physics_ptend_init(ptend_macp_all,state%psetcols,'macrophysics',lu=.true.,lv=.true.) - - do macmic_it = 1, cld_macmic_num_steps - - !=================================================== - ! Calculate macrophysical tendency (sedimentation, detrain, cloud fraction) - !=================================================== - - call t_startf('macrop_tend') - - ! ===================================================== - ! CLUBB call (PBL, shallow convection, macrophysics) - ! ===================================================== - - if (trim(cam_take_snapshot_before) == "clubb_tend_cam") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call clubb_tend_cam(state, ptend, pbuf, cld_macmic_ztodt,& - cmfmc, cam_in, macmic_it, cld_macmic_num_steps, & - dlf, det_s, det_ice) - - ! Since we "added" the reserved liquid back in this routine, we need - ! to account for it in the energy checker -!+++ARH - ! add MF precip to flx_cnd [m/s] - flx_cnd(:ncol) = -1._r8*rliq(:ncol) + prec_sh(:ncol) - !flx_cnd(:ncol) = -1._r8*rliq(:ncol) -!---ARH - flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) - - ! Unfortunately, physics_update does not know what time period - ! "tend" is supposed to cover, and therefore can't update it - ! with substeps correctly. For now, work around this by scaling - ! ptend down by the number of substeps, then applying it for - ! the full time (ztodt). - call physics_ptend_scale(ptend, 1._r8/cld_macmic_num_steps, ncol) - - ! Update physics tendencies and copy state to state_eq, because that is - ! input for microphysics - if ( (trim(cam_take_snapshot_after) == "clubb_tend_cam") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_ptend_sum(ptend,ptend_macp_all,ncol) - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "clubb_tend_cam") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - ! Use actual qflux (not lhf/latvap) for consistency with surface fluxes and revised code - call check_energy_chng(state, tend, "clubb_tend", nstep, ztodt, & - cam_in%cflx(:ncol,1)/cld_macmic_num_steps, & - flx_cnd(:ncol)/cld_macmic_num_steps, & - det_ice(:ncol)/cld_macmic_num_steps, & - flx_heat(:ncol)/cld_macmic_num_steps) - - call t_stopf('macrop_tend') -!+++ARH - prec_sh_macmic(:ncol) = prec_sh_macmic(:ncol) + prec_sh(:ncol) - snow_sh_macmic(:ncol) = snow_sh_macmic(:ncol) + snow_sh(:ncol) -!---ARH - !=================================================== - ! Calculate cloud microphysics - !=================================================== - - if (is_subcol_on()) then - ! Allocate sub-column structures. - call physics_state_alloc(state_sc, lchnk, psubcols*pcols) - call physics_tend_alloc(tend_sc, psubcols*pcols) - - ! Generate sub-columns using the requested scheme - call subcol_gen(state, tend, state_sc, tend_sc, pbuf) - - !Initialize check energy for subcolumns - call check_energy_timestep_init(state_sc, tend_sc, pbuf, col_type_subcol) - end if - - if (trim(cam_take_snapshot_before) == "microp_section") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call t_startf('microp_aero_run') - call microp_aero_run(state, ptend_aero, cld_macmic_ztodt, pbuf) - call t_stopf('microp_aero_run') - - call t_startf('microp_tend') - - if (use_subcol_microp) then - - if (trim(cam_take_snapshot_before) == "microp_driver_tend_subcol") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state_sc, tend_sc, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call microp_driver_tend(state_sc, ptend_sc, cld_macmic_ztodt, pbuf) - ! Parameterize subcolumn effects on covariances, if enabled - if (trim(subcol_scheme) == 'SILHS') & - call subcol_SILHS_var_covar_driver( cld_macmic_ztodt, state_sc, ptend_sc, pbuf ) - - ! Average the sub-column ptend for use in gridded update - will not contain ptend_aero - call subcol_ptend_avg(ptend_sc, state_sc%ngrdcol, lchnk, ptend) - - ! Call the conservative hole filler. - ! Hole filling is only necessary when using subcolumns. - ! Note: this needs to be called after subcol_ptend_avg but before - ! physics_ptend_scale. - if (trim(subcol_scheme) == 'SILHS') & - call subcol_SILHS_fill_holes_conserv( state, cld_macmic_ztodt, & - ptend, pbuf ) - - ! Destroy massless droplets - Note this routine returns with no change unless - ! micro_do_massless_droplet_destroyer has been set to true - call massless_droplet_destroyer( cld_macmic_ztodt, state, & ! Intent(in) - ptend ) ! Intent(inout) - - ! Limit the value of hydrometeor concentrations in order to place - ! reasonable limits on hydrometeor drop size and keep them from - ! becoming too large. - ! Note: this needs to be called after hydrometeor mixing ratio - ! tendencies are adjusted by subcol_SILHS_fill_holes_conserv - ! and after massless drop concentrations are removed by the - ! subcol_SILHS_massless_droplet_destroyer, but before the - ! call to physics_ptend_scale. - if (trim(subcol_scheme) == 'SILHS') & - call subcol_SILHS_hydromet_conc_tend_lim( state, cld_macmic_ztodt, ptend ) - - ! Copy ptend_aero field to one dimensioned by sub-columns before summing with ptend - call subcol_ptend_copy(ptend_aero, state_sc, ptend_aero_sc) - call physics_ptend_sum(ptend_aero_sc, ptend_sc, state_sc%ncol) - call physics_ptend_dealloc(ptend_aero_sc) - - ! Have to scale and apply for full timestep to get tend right - ! (see above note for macrophysics). - call physics_ptend_scale(ptend_sc, 1._r8/cld_macmic_num_steps, ncol) - - if ( (trim(cam_take_snapshot_after) == "microp_driver_tend_subcol") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update (state_sc, ptend_sc, ztodt, tend_sc) - - if (trim(cam_take_snapshot_after) == "microp_driver_tend_subcol") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state_sc, tend_sc, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call check_energy_chng(state_sc, tend_sc, "microp_tend_subcol", & - nstep, ztodt, zero_sc, & - prec_str_sc(:state_sc%ncol)/cld_macmic_num_steps, & - snow_str_sc(:state_sc%ncol)/cld_macmic_num_steps, zero_sc) - - call physics_state_dealloc(state_sc) - call physics_tend_dealloc(tend_sc) - call physics_ptend_dealloc(ptend_sc) - else - call microp_driver_tend(state, ptend, cld_macmic_ztodt, pbuf) - end if - ! combine aero and micro tendencies for the grid - call physics_ptend_sum(ptend_aero, ptend, ncol) - call physics_ptend_dealloc(ptend_aero) - - ! Have to scale and apply for full timestep to get tend right - ! (see above note for macrophysics). - call physics_ptend_scale(ptend, 1._r8/cld_macmic_num_steps, ncol) - - call diag_clip_tend_writeout(state, ptend, ncol, lchnk, ixcldliq, ixcldice, ixq, ztodt, rtdt) - - if ( (trim(cam_take_snapshot_after) == "microp_section") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update (state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "microp_section") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call check_energy_chng(state, tend, "microp_tend", nstep, ztodt, & - zero, prec_str(:ncol)/cld_macmic_num_steps, & - snow_str(:ncol)/cld_macmic_num_steps, zero) - - call t_stopf('microp_tend') - - prec_sed_macmic(:ncol) = prec_sed_macmic(:ncol) + prec_sed(:ncol) - snow_sed_macmic(:ncol) = snow_sed_macmic(:ncol) + snow_sed(:ncol) - prec_pcw_macmic(:ncol) = prec_pcw_macmic(:ncol) + prec_pcw(:ncol) - snow_pcw_macmic(:ncol) = snow_pcw_macmic(:ncol) + snow_pcw(:ncol) - - end do ! end substepping over macrophysics/microphysics - - call outfld( 'UTEND_MACROP', ptend_macp_all%u, pcols, lchnk) - call outfld( 'VTEND_MACROP', ptend_macp_all%v, pcols, lchnk) - call physics_ptend_dealloc(ptend_macp_all) - - prec_sed(:ncol) = prec_sed_macmic(:ncol)/cld_macmic_num_steps - snow_sed(:ncol) = snow_sed_macmic(:ncol)/cld_macmic_num_steps - prec_pcw(:ncol) = prec_pcw_macmic(:ncol)/cld_macmic_num_steps - snow_pcw(:ncol) = snow_pcw_macmic(:ncol)/cld_macmic_num_steps - prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) - snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) -!+++ARH - prec_sh(:ncol) = prec_sh_macmic(:ncol)/cld_macmic_num_steps - snow_sh(:ncol) = snow_sh_macmic(:ncol)/cld_macmic_num_steps -!---ARH - - endif - - if ( .not. deep_scheme_does_scav_trans() ) then - - ! ------------------------------------------------------------------------------- - ! 1. Wet Scavenging of Aerosols by Convective and Stratiform Precipitation. - ! 2. Convective Transport of Non-Water Aerosol Species. - ! - ! . Aerosol wet chemistry determines scavenging fractions, and transformations - ! . Then do convective transport of all trace species except qv,ql,qi. - ! . We needed to do the scavenging first to determine the interstitial fraction. - ! . When UNICON is used as unified convection, we should still perform - ! wet scavenging but not 'convect_deep_tend2'. - ! ------------------------------------------------------------------------------- - - call t_startf('bc_aerosols') - if (clim_modal_aero .and. .not. prog_modal_aero) then - call modal_aero_calcsize_diag(state, pbuf) - call modal_aero_wateruptake_dr(state, pbuf) - endif - - if (trim(cam_take_snapshot_before) == "aero_model_wetdep") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call aero_model_wetdep( state, ztodt, dlf, cam_out, ptend, pbuf) - if ( (trim(cam_take_snapshot_after) == "aero_model_wetdep") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "aero_model_wetdep") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call t_startf ('convect_deep_tend2') - call convect_deep_tend_2( state, ptend, ztodt, pbuf ) - call physics_update(state, ptend, ztodt, tend) - call t_stopf ('convect_deep_tend2') - - ! check tracer integrals - call check_tracers_chng(state, tracerint, "cmfmca", nstep, ztodt, zero_tracers) - - call t_stopf('bc_aerosols') - - endif - - !=================================================== - ! Moist physical parameteriztions complete: - ! send dynamical variables, and derived variables to history file - !=================================================== - - call t_startf('bc_history_write') - call diag_phys_writeout(state, pbuf) - call diag_conv(state, ztodt, pbuf) - - call t_stopf('bc_history_write') - - !=================================================== - ! Write cloud diagnostics on history file - !=================================================== - - call t_startf('bc_cld_diag_history_write') - - call cloud_diagnostics_calc(state, pbuf) - - call t_stopf('bc_cld_diag_history_write') - - !=================================================== - ! Radiation computations - !=================================================== - call t_startf('radiation') - - if (trim(cam_take_snapshot_before) == "radiation_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call radiation_tend( & - state, ptend, pbuf, cam_out, cam_in, net_flx) - - ! Set net flux used by spectral dycores - do i=1,ncol - tend%flx_net(i) = net_flx(i) - end do - - if ( (trim(cam_take_snapshot_after) == "radiation_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "radiation_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call check_energy_chng(state, tend, "radheat", nstep, ztodt, zero, zero, zero, net_flx) - - call t_stopf('radiation') - - ! Diagnose the location of the tropopause and its location to the history file(s). - call t_startf('tropopause') - call tropopause_output(state) - call t_stopf('tropopause') - - !=================================================== - ! Source/sink terms for advected tracers. - !=================================================== - call t_startf('adv_tracer_src_snk') - ! Test tracers - - if (trim(cam_take_snapshot_before) == "aoa_tracers_timestep_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - call aoa_tracers_timestep_tend(state, ptend, cam_in%cflx, cam_in%landfrac, ztodt) - if ( (trim(cam_take_snapshot_after) == "aoa_tracers_timestep_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - if (trim(cam_take_snapshot_after) == "aoa_tracers_timestep_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - call check_tracers_chng(state, tracerint, "aoa_tracers_timestep_tend", nstep, ztodt, & - cam_in%cflx) - - if (trim(cam_take_snapshot_before) == "co2_cycle_set_ptend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - call co2_cycle_set_ptend(state, pbuf, ptend) - if ( (trim(cam_take_snapshot_after) == "co2_cycle_set_ptend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - if (trim(cam_take_snapshot_after) == "co2_cycle_set_ptend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - !=================================================== - ! Chemistry and MAM calculation - ! MAM core aerosol conversion process is performed in the below 'chem_timestep_tend'. - ! In addition, surface flux of aerosol species other than 'dust' and 'sea salt', and - ! elevated emission of aerosol species are treated in 'chem_timestep_tend' before - ! Gas chemistry and MAM core aerosol conversion. - ! Note that surface flux is not added into the atmosphere, but elevated emission is - ! added into the atmosphere as tendency. - !=================================================== - if (chem_is_active()) then - - if (trim(cam_take_snapshot_before) == "chem_timestep_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call chem_timestep_tend(state, ptend, cam_in, cam_out, ztodt, & - pbuf, fh2o=fh2o) - - - if ( (trim(cam_take_snapshot_after) == "chem_timestep_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "chem_timestep_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - call check_energy_chng(state, tend, "chem", nstep, ztodt, fh2o, zero, zero, zero) - call check_tracers_chng(state, tracerint, "chem_timestep_tend", nstep, ztodt, & - cam_in%cflx) - end if - call t_stopf('adv_tracer_src_snk') - - !=================================================== - ! Vertical diffusion/pbl calculation - ! Call vertical diffusion code (pbl, free atmosphere and molecular) - !=================================================== - - call t_startf('vertical_diffusion_tend') - - if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call vertical_diffusion_tend (ztodt ,state , cam_in, & - surfric ,obklen ,ptend ,ast ,pbuf ) - - !------------------------------------------ - ! Call major diffusion for extended model - !------------------------------------------ - if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then - call waccmx_phys_mspd_tend (ztodt ,state ,ptend) - endif - - if ( (trim(cam_take_snapshot_after) == "vertical_diffusion_section") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - if ( ptend%lu ) then - call outfld( 'UTEND_VDIFF', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_VDIFF', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "vertical_diffusion_section") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call t_stopf ('vertical_diffusion_tend') - - !=================================================== - ! Rayleigh friction calculation - !=================================================== - call t_startf('rayleigh_friction') - call rayleigh_friction_tend( ztodt, state, ptend) - if ( ptend%lu ) then - call outfld( 'UTEND_RAYLEIGH', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_RAYLEIGH', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - call t_stopf('rayleigh_friction') - - if (do_clubb_sgs) then - call check_energy_chng(state, tend, "vdiff", nstep, ztodt, zero, zero, zero, zero) - else - call check_energy_chng(state, tend, "vdiff", nstep, ztodt, cam_in%cflx(:,1), zero, & - zero, cam_in%shf) - endif - - call check_tracers_chng(state, tracerint, "vdiff", nstep, ztodt, cam_in%cflx) - - ! aerosol dry deposition processes - call t_startf('aero_drydep') - - if (trim(cam_take_snapshot_before) == "aero_model_drydep") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call aero_model_drydep( state, pbuf, obklen, surfric, cam_in, ztodt, cam_out, ptend ) - if ( (trim(cam_take_snapshot_after) == "aero_model_drydep") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "aero_model_drydep") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call t_stopf('aero_drydep') - - !--------------------------------------------------------------------------------- - ! ... enforce charge neutrality - !--------------------------------------------------------------------------------- - call charge_balance(state, pbuf) - - !=================================================== - ! Gravity wave drag - !=================================================== - call t_startf('gw_tend') - - if (trim(cam_take_snapshot_before) == "gw_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call gw_tend(state, pbuf, ztodt, ptend, cam_in, flx_heat) - - if ( (trim(cam_take_snapshot_after) == "gw_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - if ( ptend%lu ) then - call outfld( 'UTEND_GWDTOT', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_GWDTOT', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "gw_tend") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - ! Check energy integrals - call check_energy_chng(state, tend, "gwdrag", nstep, ztodt, zero, & - zero, zero, flx_heat) - call t_stopf('gw_tend') - - ! QBO relaxation - - if (trim(cam_take_snapshot_before) == "qbo_relax") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call qbo_relax(state, pbuf, ptend) - if ( (trim(cam_take_snapshot_after) == "qbo_relax") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - if ( ptend%lu ) then - call outfld( 'UTEND_QBORLX', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_QBORLX', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "qbo_relax") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - ! Check energy integrals - call check_energy_chng(state, tend, "qborelax", nstep, ztodt, zero, zero, zero, zero) - - ! Lunar tides - call lunar_tides_tend( state, ptend ) - if ( ptend%lu ) then - call outfld( 'UTEND_LUNART', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_LUNART', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - ! Check energy integrals - call check_energy_chng(state, tend, "lunar_tides", nstep, ztodt, zero, zero, zero, zero) - - ! Ion drag calculation - call t_startf ( 'iondrag' ) - - if (trim(cam_take_snapshot_before) == "iondrag_calc_section") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - if ( do_waccm_ions ) then - call iondrag_calc( lchnk, ncol, state, ptend, pbuf, ztodt ) - else - call iondrag_calc( lchnk, ncol, state, ptend) - endif - !---------------------------------------------------------------------------- - ! Call ionosphere routines for extended model if mode is set to ionosphere - !---------------------------------------------------------------------------- - if( waccmx_is('ionosphere') ) then - call waccmx_phys_ion_elec_temp_tend(state, ptend, pbuf, ztodt) - endif - - if ( (trim(cam_take_snapshot_after) == "iondrag_calc_section") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - if ( ptend%lu ) then - call outfld( 'UTEND_IONDRG', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_IONDRG', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "iondrag_calc_section") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call calc_te_and_aam_budgets(state, 'pAP') - - !--------------------------------------------------------------------------------- - ! Enforce charge neutrality after O+ change from ionos_tend - !--------------------------------------------------------------------------------- - if( waccmx_is('ionosphere') ) then - call charge_balance(state, pbuf) - endif - - ! Check energy integrals - call check_energy_chng(state, tend, "iondrag", nstep, ztodt, zero, zero, zero, zero) - - call t_stopf ( 'iondrag' ) - - ! Update Nudging values, if needed - !---------------------------------- - if((Nudge_Model).and.(Nudge_ON)) then - call nudging_timestep_tend(state,ptend) - if ( ptend%lu ) then - call outfld( 'UTEND_NDG', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_NDG', ptend%v, pcols, lchnk) - end if - call physics_update(state,ptend,ztodt,tend) - call check_energy_chng(state, tend, "nudging", nstep, ztodt, zero, zero, zero, zero) - endif - - !-------------- Energy budget checks vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - - ! Save total energy for global fixer in next timestep (FV and SE dycores) - call pbuf_set_field(pbuf, teout_idx, state%te_cur, (/1,itim_old/),(/pcols,1/)) - ! - ! FV: convert dry-type mixing ratios to moist here because physics_dme_adjust - ! assumes moist. This is done in p_d_coupling for other dynamics. Bundy, Feb 2004. - if ( dycore_is('LR').or. dycore_is('FV3')) call set_dry_to_wet(state) ! Physics had dry, dynamics wants moist - - ! Scale dry mass and energy (does nothing if dycore is EUL or SLD) - tmp_q (:ncol,:pver) = state%q(:ncol,:pver,ixq) - tmp_cldliq(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) - tmp_cldice(:ncol,:pver) = state%q(:ncol,:pver,ixcldice) - - ! For not ('FV'|'FV3'), physics_dme_adjust is called for energy diagnostic purposes only. So, save off tracers - if (.not.(dycore_is('FV').or.dycore_is('FV3')).and.& - (hist_fld_active('SE_pAM').or.hist_fld_active('KE_pAM').or.hist_fld_active('WV_pAM').or.& - hist_fld_active('WL_pAM').or.hist_fld_active('WI_pAM'))) then - tmp_trac(:ncol,:pver,:pcnst) = state%q(:ncol,:pver,:pcnst) - tmp_pdel(:ncol,:pver) = state%pdel(:ncol,:pver) - tmp_ps(:ncol) = state%ps(:ncol) - ! - ! pint, lnpint,rpdel are altered by dme_adjust but not used for tendencies in dynamics of SE - ! we do not reset them to pre-dme_adjust values - ! - if (dycore_is('SE')) call set_dry_to_wet(state) - - if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call physics_dme_adjust(state, tend, qini, ztodt) - - if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call calc_te_and_aam_budgets(state, 'pAM') - ! Restore pre-"physics_dme_adjust" tracers - state%q(:ncol,:pver,:pcnst) = tmp_trac(:ncol,:pver,:pcnst) - state%pdel(:ncol,:pver) = tmp_pdel(:ncol,:pver) - state%ps(:ncol) = tmp_ps(:ncol) - end if - - if (dycore_is('LR') .or. dycore_is('FV3')) then - - if (trim(cam_take_snapshot_before) == "physics_dme_adjust") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call physics_dme_adjust(state, tend, qini, ztodt) - - if (trim(cam_take_snapshot_after) == "physics_dme_adjust") then - call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) - end if - - call calc_te_and_aam_budgets(state, 'pAM') - endif - -!!! REMOVE THIS CALL, SINCE ONLY Q IS BEING ADJUSTED. WON'T BALANCE ENERGY. TE IS SAVED BEFORE THIS -!!! call check_energy_chng(state, tend, "drymass", nstep, ztodt, zero, zero, zero, zero) - - ! store T, U, and V in buffer for use in computing dynamics T-tendency in next timestep - do k = 1,pver - dtcore(:ncol,k) = state%t(:ncol,k) - ducore(:ncol,k) = state%u(:ncol,k) - dvcore(:ncol,k) = state%v(:ncol,k) - end do - - !-------------- Energy budget checks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - if (aqua_planet) then - labort = .false. - do i=1,ncol - if (cam_in%ocnfrac(i) /= 1._r8) then - labort = .true. - if (masterproc) write(iulog,*) 'oceanfrac(',i,')=',cam_in%ocnfrac(i) - end if - end do - if (labort) then - call endrun ('TPHYSAC error: in aquaplanet mode, but grid contains non-ocean point') - endif - endif - - call diag_phys_tend_writeout (state, pbuf, tend, ztodt, tmp_q, tmp_cldliq, tmp_cldice, & - qini, cldliqini, cldiceini) - - call clybry_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) - - end subroutine tphysac - - subroutine tphysbc (ztodt, state, & - tend, pbuf, & - cam_out, cam_in ) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Evaluate and apply physical processes that are calculated BEFORE - ! coupling to land, sea, and ice models. - ! - ! Processes currently included are: - ! - ! o Resetting Negative Tracers to Positive - ! o Global Mean Total Energy Fixer - ! o Dry Adjustment - ! o Asymmetric Turbulence Scheme - Deep Convection & Shallow Convection - ! - ! Method: - ! - ! Each parameterization should be implemented with this sequence of calls: - ! 1) Call physics interface - ! 2) Check energy - ! 3) Call physics_update - ! See Interface to Column Physics and Chemistry Packages - ! http://www.ccsm.ucar.edu/models/atm-cam/docs/phys-interface/index.html - ! - !----------------------------------------------------------------------- - - use physics_buffer, only: physics_buffer_desc, pbuf_get_field - use physics_buffer, only: pbuf_get_index, pbuf_old_tim_idx - use physics_buffer, only: col_type_subcol, dyn_time_lvls - use shr_kind_mod, only: r8 => shr_kind_r8 - - use dadadj_cam, only: dadadj_tend - use physics_types, only: physics_state, physics_tend, physics_ptend, & - physics_update, physics_ptend_init, physics_ptend_sum, & - physics_state_check, physics_ptend_scale - use cam_diagnostics, only: diag_conv_tend_ini, diag_phys_writeout, diag_conv, diag_export, diag_state_b4_phys_write - use cam_diagnostics, only: diag_clip_tend_writeout - use cam_history, only: outfld - use physconst, only: cpair, latvap - use constituents, only: pcnst, qmin, cnst_get_ind - use convect_deep, only: convect_deep_tend, convect_deep_tend_2, deep_scheme_does_scav_trans - use time_manager, only: is_first_step, get_nstep - use convect_shallow, only: convect_shallow_tend - use check_energy, only: check_energy_chng, check_energy_fix, check_energy_timestep_init - use check_energy, only: check_tracers_data, check_tracers_init, check_tracers_chng - use check_energy, only: calc_te_and_aam_budgets - use dycore, only: dycore_is - use radiation, only: radiation_tend - use perf_mod - use mo_gas_phase_chemdr,only: map2chm - use clybry_fam, only: clybry_fam_adj - use cam_abortutils, only: endrun - use subcol_utils, only: is_subcol_on - use qneg_module, only: qneg3 - use cam_snapshot, only: cam_snapshot_all_outfld_tphysbc - use cam_snapshot, only: cam_snapshot_ptend_outfld - - ! Arguments - - real(r8), intent(in) :: ztodt ! 2 delta t (model time increment) - - type(physics_state), intent(inout) :: state - type(physics_tend ), intent(inout) :: tend - type(physics_buffer_desc), pointer :: pbuf(:) - - type(cam_out_t), intent(inout) :: cam_out - type(cam_in_t), intent(in) :: cam_in - - - ! - !---------------------------Local workspace----------------------------- - ! - - type(physics_ptend) :: ptend ! indivdual parameterization tendencies - - 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) pflx(pcols,pverp) ! Conv rain flux thru out btm of lev - 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. - - ! physics buffer fields to compute tendencies for stratiform package - integer itim_old, ifld - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction - - ! physics buffer fields for total energy and mass adjustment - real(r8), pointer, dimension(: ) :: teout - real(r8), pointer, dimension(:,:) :: qini - real(r8), pointer, dimension(:,:) :: cldliqini - real(r8), pointer, dimension(:,:) :: cldiceini - real(r8), pointer, dimension(:,:) :: dtcore - real(r8), pointer, dimension(:,:) :: ducore - real(r8), pointer, dimension(:,:) :: dvcore - - real(r8), pointer, dimension(:,:,:) :: fracis ! fraction of transported species that are insoluble - - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - - ! convective precipitation variables - real(r8),pointer :: prec_dp(:) ! total precipitation from ZM convection - real(r8),pointer :: snow_dp(:) ! snow from ZM convection - real(r8),pointer :: prec_sh(:) ! total precipitation from Hack convection - real(r8),pointer :: snow_sh(:) ! snow from Hack convection - - ! stratiform precipitation variables - real(r8),pointer :: prec_str(:) ! sfc flux of precip from stratiform (m/s) - real(r8),pointer :: snow_str(:) ! sfc flux of snow from stratiform (m/s) - real(r8),pointer :: prec_str_sc(:) ! sfc flux of precip from stratiform (m/s) -- for subcolumns - real(r8),pointer :: snow_str_sc(:) ! sfc flux of snow from stratiform (m/s) -- for subcolumns - real(r8),pointer :: prec_pcw(:) ! total precip from prognostic cloud scheme - real(r8),pointer :: snow_pcw(:) ! snow from prognostic cloud scheme - real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation - real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation - - ! 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) :: flx_cnd(pcols) - real(r8) :: flx_heat(pcols) - type(check_tracers_data):: tracerint ! energy integrals and cummulative boundary fluxes - real(r8) :: zero_tracers(pcols,pcnst) - - logical :: lq(pcnst) - - !----------------------------------------------------------------------- - - call t_startf('bc_init') - - zero = 0._r8 - zero_tracers(:,:) = 0._r8 - zero_sc(:) = 0._r8 - - lchnk = state%lchnk - ncol = state%ncol - - rtdt = 1._r8/ztodt - - nstep = get_nstep() - - ! Associate pointers with physics buffer fields - itim_old = pbuf_old_tim_idx() - ifld = pbuf_get_index('CLD') - call pbuf_get_field(pbuf, ifld, cld, (/1,1,itim_old/),(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, teout_idx, teout, (/1,itim_old/), (/pcols,1/)) - - call pbuf_get_field(pbuf, qini_idx, qini) - call pbuf_get_field(pbuf, cldliqini_idx, cldliqini) - call pbuf_get_field(pbuf, cldiceini_idx, cldiceini) - - ifld = pbuf_get_index('DTCORE') - call pbuf_get_field(pbuf, ifld, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) - - ifld = pbuf_get_index('FRACIS') - call pbuf_get_field(pbuf, ifld, fracis, start=(/1,1,1/), kount=(/pcols, pver, pcnst/) ) - fracis (:ncol,:,1:pcnst) = 1._r8 - - ! Set physics tendencies to 0 - tend %dTdt(:ncol,:pver) = 0._r8 - tend %dudt(:ncol,:pver) = 0._r8 - tend %dvdt(:ncol,:pver) = 0._r8 - - ! Verify state coming from the dynamics - if (state_debug_checks) & - call physics_state_check(state, name="before tphysbc (dycore?)") - - call clybry_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) - - ! Since clybry_fam_adj operates directly on the tracers, and has no - ! physics_update call, re-run qneg3. - call qneg3('TPHYSBCc',lchnk ,ncol ,pcols ,pver , & - 1, pcnst, qmin ,state%q ) - - ! Validate output of clybry_fam_adj. - if (state_debug_checks) & - call physics_state_check(state, name="clybry_fam_adj") - - ! - ! Dump out "before physics" state - ! - call diag_state_b4_phys_write (state) - - ! compute mass integrals of input tracers state - call check_tracers_init(state, tracerint) - - call t_stopf('bc_init') - - !=================================================== - ! Global mean total energy fixer - !=================================================== - call t_startf('energy_fixer') - - call calc_te_and_aam_budgets(state, 'pBF') - if (dycore_is('LR') .or. dycore_is('FV3') .or. dycore_is('SE')) then - call check_energy_fix(state, ptend, nstep, flx_heat) - call physics_update(state, ptend, ztodt, tend) - call check_energy_chng(state, tend, "chkengyfix", nstep, ztodt, zero, zero, zero, flx_heat) - call outfld( 'EFIX', flx_heat , pcols, lchnk ) - end if - call calc_te_and_aam_budgets(state, 'pBP') - ! Save state for convective tendency calculations. - call diag_conv_tend_ini(state, pbuf) - - call cnst_get_ind('Q', ixq) - call cnst_get_ind('CLDLIQ', ixcldliq) - call cnst_get_ind('CLDICE', ixcldice) - qini (:ncol,:pver) = state%q(:ncol,:pver, 1) - cldliqini(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) - cldiceini(:ncol,:pver) = state%q(:ncol,:pver,ixcldice) - - call outfld('TEOUT', teout , pcols, lchnk ) - call outfld('TEINP', state%te_ini, pcols, lchnk ) - call outfld('TEFIX', state%te_cur, pcols, lchnk ) - - ! T, U, V tendency due to dynamics - if( nstep > dyn_time_lvls-1 ) then - dtcore(:ncol,:pver) = (state%t(:ncol,:pver) - dtcore(:ncol,:pver))/ztodt - ducore(:ncol,:pver) = (state%u(:ncol,:pver) - ducore(:ncol,:pver))/ztodt - dvcore(:ncol,:pver) = (state%v(:ncol,:pver) - dvcore(:ncol,:pver))/ztodt - call outfld( 'DTCORE', dtcore, pcols, lchnk ) - call outfld( 'UTEND_CORE', ducore, pcols, lchnk ) - call outfld( 'VTEND_CORE', dvcore, pcols, lchnk ) - end if - - call t_stopf('energy_fixer') - ! - !=================================================== - ! Dry adjustment - !=================================================== - call t_startf('dry_adjustment') - - if (trim(cam_take_snapshot_before) == "dadadj_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call dadadj_tend(ztodt, state, ptend) - - if ( (trim(cam_take_snapshot_after) == "dadadj_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "dadadj_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call t_stopf('dry_adjustment') - - !=================================================== - ! Moist convection - !=================================================== - call t_startf('moist_convection') - - call t_startf ('convect_deep_tend') - - if (trim(cam_take_snapshot_before) == "convect_deep_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call convect_deep_tend( & - cmfmc, cmfcme, & - pflx, zdu, & - rliq, rice, & - ztodt, & - state, ptend, cam_in%landfrac, pbuf) - - if ( (trim(cam_take_snapshot_after) == "convect_deep_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - - if ( ptend%lu ) then - call outfld( 'UTEND_DCONV', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_DCONV', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "convect_deep_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call t_stopf('convect_deep_tend') - - call pbuf_get_field(pbuf, prec_dp_idx, prec_dp ) - call pbuf_get_field(pbuf, snow_dp_idx, snow_dp ) - call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) - call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) - - call pbuf_get_field(pbuf, prec_str_idx, prec_str ) - call pbuf_get_field(pbuf, snow_str_idx, snow_str ) - call pbuf_get_field(pbuf, prec_sed_idx, prec_sed ) - call pbuf_get_field(pbuf, snow_sed_idx, snow_sed ) - call pbuf_get_field(pbuf, prec_pcw_idx, prec_pcw ) - call pbuf_get_field(pbuf, snow_pcw_idx, snow_pcw ) - - if (use_subcol_microp) then - call pbuf_get_field(pbuf, prec_str_idx, prec_str_sc, col_type=col_type_subcol) - call pbuf_get_field(pbuf, snow_str_idx, snow_str_sc, col_type=col_type_subcol) - end if - - ! Check energy integrals, including "reserved liquid" - flx_cnd(:ncol) = prec_dp(:ncol) + rliq(:ncol) - snow_dp(:ncol) = snow_dp(:ncol) + rice(:ncol) - call check_energy_chng(state, tend, "convect_deep", nstep, ztodt, zero, flx_cnd, snow_dp, zero) - snow_dp(:ncol) = snow_dp(:ncol) - rice(:ncol) - -!+++ARH Begin code block targeting for removal - ! - ! Call Hack (1994) convection scheme to deal with shallow/mid-level convection - ! - call t_startf ('convect_shallow_tend') - - if (dlfzm_idx > 0) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - dlf(:ncol,:) = dlfzm(:ncol,:) - else - dlf(:,:) = 0._r8 - end if - - if (trim(cam_take_snapshot_before) == "convect_shallow_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - !+++ARH Begin only subroutine whose removal breaks bfb in code block - call convect_shallow_tend (ztodt , cmfmc, & - dlf , dlf2 , rliq , rliq2, & - state , ptend , pbuf, cam_in) - !---ARH End only subroutine whose removal breaks bfb in code block - - call t_stopf ('convect_shallow_tend') - - if ( (trim(cam_take_snapshot_after) == "convect_shallow_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - if ( ptend%lu ) then - call outfld( 'UTEND_SHCONV', ptend%u, pcols, lchnk) - end if - if ( ptend%lv ) then - call outfld( 'VTEND_SHCONV', ptend%v, pcols, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "convect_shallow_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - flx_cnd(:ncol) = prec_sh(:ncol) + rliq2(:ncol) - call check_energy_chng(state, tend, "convect_shallow", nstep, ztodt, zero, flx_cnd, snow_sh, zero) - - call check_tracers_chng(state, tracerint, "convect_shallow", nstep, ztodt, zero_tracers) -!+++ARH End code block targeting for removal - - call t_stopf('moist_convection') - - if (is_first_step()) then - - !initiailize sedimentation arrays - prec_pcw = 0._r8 - snow_pcw = 0._r8 - prec_sed = 0._r8 - snow_sed = 0._r8 - prec_str = 0._r8 - snow_str = 0._r8 - - if (is_subcol_on()) then - prec_str_sc = 0._r8 - snow_str_sc = 0._r8 - end if - - !=================================================== - ! Radiation computations - !=================================================== - call t_startf('radiation') - - if (trim(cam_take_snapshot_before) == "radiation_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call radiation_tend( & - state, ptend, pbuf, cam_out, cam_in, net_flx) - - ! Set net flux used by spectral dycores - do i=1,ncol - tend%flx_net(i) = net_flx(i) - end do - - if ( (trim(cam_take_snapshot_after) == "radiation_tend") .and. & - (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then - call cam_snapshot_ptend_outfld(ptend, lchnk) - end if - call physics_update(state, ptend, ztodt, tend) - - if (trim(cam_take_snapshot_after) == "radiation_tend") then - call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & - flx_heat, cmfmc, cmfcme, pflx, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) - end if - - call check_energy_chng(state, tend, "radheat", nstep, ztodt, zero, zero, zero, net_flx) - - call t_stopf('radiation') - - end if - - ! Save atmospheric fields to force surface models - call t_startf('cam_export') - call cam_export (state,cam_out,pbuf) - call t_stopf('cam_export') - - ! Write export state to history file - call t_startf('diag_export') - call diag_export(cam_out) - call t_stopf('diag_export') - - end subroutine tphysbc - -subroutine phys_timestep_init(phys_state, cam_in, cam_out, pbuf2d) -!----------------------------------------------------------------------------------- -! -! Purpose: The place for parameterizations to call per timestep initializations. -! Generally this is used to update time interpolated fields from boundary -! datasets. -! -!----------------------------------------------------------------------------------- - use shr_kind_mod, only: r8 => shr_kind_r8 - use chemistry, only: chem_timestep_init - use chem_surfvals, only: chem_surfvals_set - use physics_types, only: physics_state - use physics_buffer, only: physics_buffer_desc - use carma_intr, only: carma_timestep_init - use ghg_data, only: ghg_data_timestep_init - use cam3_aero_data, only: cam3_aero_data_on, cam3_aero_data_timestep_init - use cam3_ozone_data, only: cam3_ozone_data_on, cam3_ozone_data_timestep_init - use aoa_tracers, only: aoa_tracers_timestep_init - use vertical_diffusion, only: vertical_diffusion_ts_init - use radheat, only: radheat_timestep_init - use solar_data, only: solar_data_advance - use qbo, only: qbo_timestep_init - use iondrag, only: do_waccm_ions, iondrag_timestep_init - use perf_mod - - use prescribed_ozone, only: prescribed_ozone_adv - use prescribed_ghg, only: prescribed_ghg_adv - use prescribed_aero, only: prescribed_aero_adv - use aerodep_flx, only: aerodep_flx_adv - use aircraft_emit, only: aircraft_emit_adv - use prescribed_volcaero, only: prescribed_volcaero_adv - use prescribed_strataero,only: prescribed_strataero_adv - use mo_apex, only: mo_apex_init - use epp_ionization, only: epp_ionization_active - use iop_forcing, only: scam_use_iop_srf - use nudging, only: Nudge_Model, nudging_timestep_init - - implicit none - - type(physics_state), intent(inout), dimension(begchunk:endchunk) :: phys_state - type(cam_in_t), intent(inout), dimension(begchunk:endchunk) :: cam_in - type(cam_out_t), intent(inout), dimension(begchunk:endchunk) :: cam_out - - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - - !----------------------------------------------------------------------------- - - if (single_column) call scam_use_iop_srf(cam_in) - - ! update geomagnetic coordinates - if (epp_ionization_active .or. do_waccm_ions) then - call mo_apex_init(phys_state) - endif - - ! Chemistry surface values - call chem_surfvals_set() - - ! Solar irradiance - call solar_data_advance() - - ! Time interpolate for chemistry. - call chem_timestep_init(phys_state, pbuf2d) - - ! Prescribed tracers - call prescribed_ozone_adv(phys_state, pbuf2d) - call prescribed_ghg_adv(phys_state, pbuf2d) - call prescribed_aero_adv(phys_state, pbuf2d) - call aircraft_emit_adv(phys_state, pbuf2d) - call prescribed_volcaero_adv(phys_state, pbuf2d) - call prescribed_strataero_adv(phys_state, pbuf2d) - - ! prescribed aerosol deposition fluxes - call aerodep_flx_adv(phys_state, pbuf2d, cam_out) - - ! CAM3 prescribed aerosol masses - if (cam3_aero_data_on) call cam3_aero_data_timestep_init(pbuf2d, phys_state) - - ! CAM3 prescribed ozone data - if (cam3_ozone_data_on) call cam3_ozone_data_timestep_init(pbuf2d, phys_state) - - ! Time interpolate data models of gasses in pbuf2d - call ghg_data_timestep_init(pbuf2d, phys_state) - - ! Upper atmosphere radiative processes - call radheat_timestep_init(phys_state, pbuf2d) - - ! Time interpolate for vertical diffusion upper boundary condition - call vertical_diffusion_ts_init(pbuf2d, phys_state) - - !---------------------------------------------------------------------- - ! update QBO data for this time step - !---------------------------------------------------------------------- - call qbo_timestep_init - - call iondrag_timestep_init() - - call carma_timestep_init() - - ! age of air tracers - call aoa_tracers_timestep_init(phys_state) - - ! Update Nudging values, if needed - !---------------------------------- - if(Nudge_Model) call nudging_timestep_init(phys_state) - -end subroutine phys_timestep_init - -end module physpkg From b9a068a8cc42644bb6620eb3aeda6b2ee2c583f4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 14:20:42 -0700 Subject: [PATCH 067/466] merge cam/physpkg.F90 conflicts --- src/physics/cam/physpkg.F90 | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index b4a25f1b68..5a632ad1de 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -2108,10 +2108,9 @@ subroutine tphysbc (ztodt, state, & real(r8) :: prec_sed_macmic(pcols) real(r8) :: snow_sed_macmic(pcols) -!+++ARH + ! CLUBB+MF real(r8) :: prec_sh_macmic(pcols) real(r8) :: snow_sh_macmic(pcols) -!---ARH ! energy checking variables real(r8) :: zero(pcols) ! array of zeros @@ -2360,7 +2359,6 @@ subroutine tphysbc (ztodt, state, & end if flx_cnd(:ncol) = prec_sh(:ncol) + rliq2(:ncol) - call check_energy_chng(state, tend, "convect_shallow", nstep, ztodt, zero, flx_cnd, snow_sh, zero) call check_tracers_chng(state, tracerint, "convect_shallow", nstep, ztodt, zero_tracers) @@ -2430,12 +2428,10 @@ subroutine tphysbc (ztodt, state, & snow_sed_macmic = 0._r8 prec_pcw_macmic = 0._r8 snow_pcw_macmic = 0._r8 -<<<<<<< HEAD -!+++ARH + + ! CLUBB+MF prec_sh_macmic = 0._r8 snow_sh_macmic = 0._r8 -!---ARH -======= ! contrail parameterization ! see Chen et al., 2012: Global contrail coverage simulated @@ -2448,7 +2444,6 @@ subroutine tphysbc (ztodt, state, & ! accumulated over macmic substeps call physics_ptend_init(ptend_macp_all,state%psetcols,'macrophysics',lu=.true.,lv=.true.) ->>>>>>> upstream/cam_development do macmic_it = 1, cld_macmic_num_steps !=================================================== @@ -2518,11 +2513,9 @@ subroutine tphysbc (ztodt, state, & ! Since we "added" the reserved liquid back in this routine, we need ! to account for it in the energy checker -!+++ARH - ! add MF precip to flx_cnd [m/s] + + ! CLUBB+MF: add MF precip to flx_cnd [m/s] flx_cnd(:ncol) = -1._r8*rliq(:ncol) + prec_sh(:ncol) - !flx_cnd(:ncol) = -1._r8*rliq(:ncol) -!---ARH flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) ! Unfortunately, physics_update does not know what time period @@ -2556,10 +2549,10 @@ subroutine tphysbc (ztodt, state, & endif call t_stopf('macrop_tend') -!+++ARH + + ! CLUBB+MF prec_sh_macmic(:ncol) = prec_sh_macmic(:ncol) + prec_sh(:ncol) snow_sh_macmic(:ncol) = snow_sh_macmic(:ncol) + snow_sh(:ncol) -!---ARH !=================================================== ! Calculate cloud microphysics @@ -2701,10 +2694,11 @@ subroutine tphysbc (ztodt, state, & snow_pcw(:ncol) = snow_pcw_macmic(:ncol)/cld_macmic_num_steps prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) -!+++ARH + + ! CLUBB+MF prec_sh(:ncol) = prec_sh_macmic(:ncol)/cld_macmic_num_steps snow_sh(:ncol) = snow_sh_macmic(:ncol)/cld_macmic_num_steps -!---ARH + endif ! Add the precipitation from CARMA to the precipitation from stratiform. From b8a98282469bc2251ad067896d57a4bdf00a099d Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 14:29:45 -0700 Subject: [PATCH 068/466] remove trailing spaces from clubb_intr --- src/physics/cam/clubb_intr.F90 | 5633 +++----------------------------- 1 file changed, 482 insertions(+), 5151 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 2e03de5f7a..9cf35182e6 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1,32 +1,31 @@ -<<<<<<< HEAD module clubb_intr !----------------------------------------------------------------------------------------------------- ! ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! ! by the University of Wisconsin Milwaukee Group (UWM). ! ! ! - ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! - ! ! + ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! + ! ! ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! ! differencing the diffused and initial states. ! - ! ! + ! ! ! Calling sequence: ! ! ! !---------------------------Code history-------------------------------------------------------------- ! - ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! - ! Modified by: K Thayer-Calder ! - ! ! + ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! + ! Modified by: K Thayer-Calder ! + ! ! !----------------------------------------------------------------------------------------------------- ! - use shr_kind_mod, only: r8=>shr_kind_r8 + use shr_kind_mod, only: r8=>shr_kind_r8 use ppgrid, only: pver, pverp, pcols, begchunk, endchunk use phys_control, only: phys_getopts use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o - use spmd_utils, only: masterproc + use spmd_utils, only: masterproc use constituents, only: pcnst, cnst_add use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev + use ref_pres, only: top_lev => trop_cloud_top_lev use zm_conv_intr, only: zmconv_microp #ifdef CLUBB_SGS use clubb_api_module, only: pdf_parameter, implicit_coefs_terms @@ -49,7 +48,7 @@ module clubb_intr stats_init_clubb, & init_clubb_config_flags, & #endif - stats_end_timestep_clubb, & + stats_end_timestep_clubb, & clubb_readnl, & clubb_init_cnst, & clubb_implements_cnst @@ -73,7 +72,7 @@ module clubb_intr integer, parameter :: & grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements - + real(r8), parameter, dimension(0) :: & sclr_tol = 1.e-8_r8 ! Total water in kg/kg @@ -83,24 +82,24 @@ module clubb_intr theta0 = 300._r8, & ! Reference temperature [K] ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] p0_clubb = 100000._r8 - - integer, parameter :: & + + integer, parameter :: & sclr_dim = 0 ! Higher-order scalars, set to zero real(r8), parameter :: & wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected - - real(r8), parameter :: & + + real(r8), parameter :: & wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected - - real(r8), parameter :: & + + real(r8), parameter :: & wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected - - real(r8), parameter :: & + + real(r8), parameter :: & rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected - + real(r8), parameter :: unset_r8 = huge(1.0_r8) - + real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist real(r8) :: clubb_rnevap_effic = unset_r8 @@ -154,9 +153,9 @@ module clubb_intr logical, parameter, private :: & l_implemented = .true., & ! Implemented in a host model (always true) l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes - + logical, parameter, private :: & - apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) + apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) logical :: lq(pcnst) logical :: prog_modal_aero @@ -173,8 +172,8 @@ module clubb_intr integer :: history_budget_histfile_num integer :: edsclr_dim ! Number of scalars to transport in CLUBB integer :: offset - -! define physics buffer indicies here + +! define physics buffer indicies here integer :: & wp2_idx, & ! vertical velocity variances wp3_idx, & ! third moment of vertical velocity @@ -224,8 +223,8 @@ module clubb_intr naai_idx, & ! ice number concentration prer_evap_idx, & ! rain evaporation rate qrl_idx, & ! longwave cooling rate - radf_idx, & - qsatfac_idx, & ! subgrid cloud water saturation scaling factor + radf_idx, & + qsatfac_idx, & ! subgrid cloud water saturation scaling factor ice_supersat_idx, & ! ice cloud fraction for SILHS rcm_idx, & ! Cloud water mixing ratio for SILHS ztodt_idx ! physics timestep for SILHS @@ -238,7 +237,7 @@ module clubb_intr wpthlp_mc_zt_idx, & rtpthlp_mc_zt_idx - integer, public :: & + integer, public :: & ixthlp2 = 0, & ixwpthlp = 0, & ixwprtp = 0, & @@ -273,7 +272,7 @@ module clubb_intr prec_sh_idx, & snow_sh_idx - ! Output arrays for CLUBB statistics + ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc character(len=16) :: eddy_scheme ! Default set in phys_control.F90 @@ -292,7 +291,7 @@ module clubb_intr #endif contains - + ! =============================================================================== ! ! ! ! =============================================================================== ! @@ -311,14 +310,14 @@ subroutine clubb_register_cam( ) ! Register physics buffer fields and constituents ! !------------------------------------------------ ! - ! Add CLUBB fields to pbuf + ! Add CLUBB fields to pbuf use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls use subcol_utils, only: subcol_get_scheme integer :: cld_macmic_num_steps - + call phys_getopts( eddy_scheme_out = eddy_scheme, & - deep_scheme_out = deep_scheme, & + deep_scheme_out = deep_scheme, & history_budget_out = history_budget, & history_budget_histfile_num_out = history_budget_histfile_num, & cld_macmic_num_steps_out = cld_macmic_num_steps) @@ -335,7 +334,7 @@ subroutine clubb_register_cam( ) cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) do_cnst=.true. ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments - ! need a constant added to them before they are advected, thus this would corrupt the output. + ! need a constant added to them before they are advected, thus this would corrupt the output. ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) @@ -365,7 +364,7 @@ subroutine clubb_register_cam( ) call pbuf_add_field('CMELIQ', 'physpkg',dtype_r8, (/pcols,pver/), cmeliq_idx) call pbuf_add_field('QSATFAC', 'physpkg',dtype_r8, (/pcols,pver/), qsatfac_idx) - + call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) @@ -374,7 +373,7 @@ subroutine clubb_register_cam( ) call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) - call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) + call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) @@ -420,7 +419,7 @@ subroutine clubb_register_cam( ) call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) end if -#endif +#endif end subroutine clubb_register_cam ! =============================================================================== ! @@ -444,14 +443,14 @@ function clubb_implements_cnst(name) end function clubb_implements_cnst - + ! =============================================================================== ! ! ! ! =============================================================================== ! subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) #ifdef CLUBB_SGS - use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol + use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol #endif !----------------------------------------------------------------------- ! @@ -524,7 +523,7 @@ subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) end subroutine clubb_init_cnst - + ! =============================================================================== ! ! ! ! =============================================================================== ! @@ -547,7 +546,7 @@ subroutine clubb_readnl(nlfile) character(len=*), parameter :: sub = 'clubb_readnl' logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & - clubb_expldiff ! Stats enabled (T/F) + clubb_expldiff ! Stats enabled (T/F) integer :: iunit, read_status, ierr @@ -574,7 +573,7 @@ subroutine clubb_readnl(nlfile) !----- Begin Code ----- - ! Determine if we want clubb_history to be output + ! Determine if we want clubb_history to be output clubb_history = .false. ! Initialize to false l_stats = .false. ! Initialize to false l_output_rad_files = .false. ! Initialize to false @@ -660,7 +659,7 @@ subroutine clubb_readnl(nlfile) call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) @@ -746,11 +745,11 @@ subroutine clubb_readnl(nlfile) ! Overwrite defaults if they are true if (clubb_history) l_stats = .true. - if (clubb_rad_history) l_output_rad_files = .true. + if (clubb_rad_history) l_output_rad_files = .true. if (clubb_cloudtop_cooling) do_cldcool = .true. if (clubb_rainevap_turb) do_rainturb = .true. if (clubb_expldiff) do_expldiff = .true. - + ! Check that all namelists have been set if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") @@ -820,7 +819,7 @@ subroutine clubb_ini_cam(pbuf2d) iC1, iC1b, iC2rt, iC2thl, iC2rtthl, igamma_coef, igamma_coefb, & imult_coef, ic_K10, iskw_max_mag, & iC8, iC8b, iC11, iC11b, iC4, iC14, iup2_vp2_factor, params_list - + use clubb_api_module, only: & @@ -877,7 +876,7 @@ subroutine clubb_ini_cam(pbuf2d) #ifdef CLUBB_SGS real(kind=time_precision) :: dum1, dum2, dum3 - + real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) ! The similar name to clubb_history is unfortunate... @@ -929,10 +928,10 @@ subroutine clubb_ini_cam(pbuf2d) enddo ! l = begchunk, endchunk, 1 ! ----------------------------------------------------------------- ! - ! Determine how many constituents CLUBB will transport. Note that - ! CLUBB does not transport aerosol consituents. Therefore, need to + ! Determine how many constituents CLUBB will transport. Note that + ! CLUBB does not transport aerosol consituents. Therefore, need to ! determine how many aerosols constituents there are and subtract that - ! off of pcnst (the total consituents) + ! off of pcnst (the total consituents) ! ----------------------------------------------------------------- ! call phys_getopts(prog_modal_aero_out=prog_modal_aero, & @@ -941,7 +940,7 @@ subroutine clubb_ini_cam(pbuf2d) cld_macmic_num_steps_out = cld_macmic_num_steps) ! Select variables to apply tendencies back to CAM - + ! Initialize all consituents to true to start lq(1:pcnst) = .true. edsclr_dim = pcnst @@ -955,12 +954,12 @@ subroutine clubb_ini_cam(pbuf2d) if (prog_modal_aero) then ! Turn off modal aerosols and decrement edsclr_dim accordingly call rad_cnst_get_info(0, nmodes=nmodes) - + do m = 1, nmodes call rad_cnst_get_mode_num_idx(m, lptr) lq(lptr)=.false. edsclr_dim = edsclr_dim-1 - + call rad_cnst_get_info(0, m, nspec=nspec) do l = 1, nspec call rad_cnst_get_mam_mmr_idx(m, l, lptr) @@ -968,7 +967,7 @@ subroutine clubb_ini_cam(pbuf2d) edsclr_dim = edsclr_dim-1 end do end do - + ! In addition, if running with MAM, droplet number is transported ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport ! tendencies to avoid double counted. Else, we apply tendencies. @@ -992,7 +991,7 @@ subroutine clubb_ini_cam(pbuf2d) l_stats_samp = .false. l_grads = .false. - ! Overwrite defaults if needbe + ! Overwrite defaults if needbe if (l_stats) l_stats_samp = .true. ! Define physics buffers indexes @@ -1001,7 +1000,7 @@ subroutine clubb_ini_cam(pbuf2d) ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction - qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC + qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio @@ -1035,22 +1034,22 @@ subroutine clubb_ini_cam(pbuf2d) ! ----------------------------------------------------------------- ! ! Define number of tracers for CLUBB to diffuse - ! ----------------------------------------------------------------- ! - + ! ----------------------------------------------------------------- ! + if (do_expldiff) then offset = 2 ! diffuse temperature and moisture explicitly - edsclr_dim = edsclr_dim + offset + edsclr_dim = edsclr_dim + offset endif - + ! ----------------------------------------------------------------- ! ! Setup CLUBB core ! ----------------------------------------------------------------- ! - - ! Read in parameters for CLUBB. Just read in default values + + ! Read in parameters for CLUBB. Just read in default values call read_parameters_api( -99, "", clubb_params ) ! Fill in dummy arrays for height. Note that these are overwrote - ! at every CLUBB step to physical values. + ! at every CLUBB step to physical values. do k=1,nlev+1 zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage @@ -1108,7 +1107,7 @@ subroutine clubb_ini_cam(pbuf2d) clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em clubb_config_flags%l_update_pressure = l_update_pressure - + ! Set up CLUBB core. Note that some of these inputs are overwritten ! when clubb_tend_cam is called. The reason is that heights can change ! at each time step, which is why dummy arrays are read in here for heights @@ -1150,12 +1149,12 @@ subroutine clubb_ini_cam(pbuf2d) ! ----------------------------------------------------------------- ! ! Initialize eddy diffusivity module - + ntop_eddy = 1 ! if >1, must be <= nbot_molec nbot_eddy = pver ! currently always pver - + call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) - + ! ----------------------------------------------------------------- ! ! Add output fields for the history files ! ----------------------------------------------------------------- ! @@ -1181,7 +1180,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') + call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') @@ -1190,7 +1189,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') - call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') + call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') @@ -1211,8 +1210,8 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') - call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') - call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') + call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') + call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') @@ -1280,7 +1279,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) - end if + end if call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') @@ -1301,7 +1300,7 @@ subroutine clubb_ini_cam(pbuf2d) dum3 = 300._r8 if (l_stats) then - + call stats_init_clubb( .true., dum1, dum2, & nlev+1, nlev+1, nlev+1, dum3 ) @@ -1313,12 +1312,12 @@ subroutine clubb_ini_cam(pbuf2d) allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) endif - + ! ----------------------------------------------------------------- ! ! Make all of this output default, this is not CLUBB history ! ----------------------------------------------------------------- ! - - if (clubb_do_adv .or. history_clubb) then + + if (clubb_do_adv .or. history_clubb) then call add_default('RHO_CLUBB', 1, ' ') call add_default('UP2_CLUBB', 1, ' ') call add_default('VP2_CLUBB', 1, ' ') @@ -1348,7 +1347,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('UTEND_CLUBB', 1, ' ') call add_default('VTEND_CLUBB', 1, ' ') call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') call add_default('UM_CLUBB', 1, ' ') call add_default('VM_CLUBB', 1, ' ') call add_default('WM_ZT_CLUBB', 1, ' ') @@ -1361,7 +1360,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('ELEAK_CLUBB', 1, ' ') call add_default('TFIX_CLUBB', 1, ' ') end if - + if (history_amwg) then call add_default('PBLH', 1, ' ') end if @@ -1385,7 +1384,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('UTEND_CLUBB', 1, ' ') call add_default('VTEND_CLUBB', 1, ' ') call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') call add_default('UM_CLUBB', 1, ' ') call add_default('VM_CLUBB', 1, ' ') call add_default('SL', 1, ' ') @@ -1447,19 +1446,19 @@ subroutine clubb_ini_cam(pbuf2d) if (history_amwg) then call add_default('PBLH', 1, ' ') end if - - if (history_budget) then + + if (history_budget) then call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') call add_default('DPDLFICE', history_budget_histfile_num, ' ') - call add_default('DPDLFT', history_budget_histfile_num, ' ') + call add_default('DPDLFT', history_budget_histfile_num, ' ') call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') - endif - + endif + ! --------------- ! ! First step? ! @@ -1478,12 +1477,12 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) - + call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) - + call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) @@ -1503,10 +1502,10 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) endif - + ! The following is physpkg, so it needs to be initialized every time call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) - + ! --------------- ! ! End ! ! Initialization ! @@ -1514,21 +1513,21 @@ subroutine clubb_ini_cam(pbuf2d) #endif end subroutine clubb_ini_cam - - + + ! =============================================================================== ! ! ! ! =============================================================================== ! subroutine clubb_tend_cam( & state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & + cmfmc, cam_in, & macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) !------------------------------------------------------------------------------- -! Description: Provide tendencies of shallow convection, turbulence, and +! Description: Provide tendencies of shallow convection, turbulence, and ! macrophysics from CLUBB to CAM -! +! ! Author: Cheryl Craig, March 2011 ! Modifications: Pete Bogenschutz, March 2011 and onward ! Origin: Based heavily on UWM clubb_init.F90 @@ -1543,12 +1542,12 @@ subroutine clubb_tend_cam( & use constituents, only: cnst_get_ind, cnst_type use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step + use time_manager, only: is_first_step use cam_abortutils, only: endrun use cam_logfile, only: iulog use tropopause, only: tropopause_findChemTrop use time_manager, only: get_nstep - + #ifdef CLUBB_SGS use hb_diff, only: pblintd use scamMOD, only: single_column,scm_clubb_iop_name @@ -1590,7 +1589,7 @@ subroutine clubb_tend_cam( & #endif implicit none - + ! --------------- ! ! Input Auguments ! ! --------------- ! @@ -1602,11 +1601,11 @@ subroutine clubb_tend_cam( & real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations integer, intent(in) :: macmic_it ! number of mac-mic iterations - + ! ---------------------- ! ! Input-Output Auguments ! ! ---------------------- ! - + type(physics_buffer_desc), pointer :: pbuf(:) ! ---------------------- ! @@ -1615,11 +1614,11 @@ subroutine clubb_tend_cam( & type(physics_ptend), intent(out) :: ptend_all ! package tendencies - ! These two variables are needed for energy check + ! These two variables are needed for energy check real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check - + ! --------------- ! ! Local Variables ! ! --------------- ! @@ -1628,20 +1627,20 @@ subroutine clubb_tend_cam( & type(physics_state) :: state1 ! Local copy of state variable type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all - + integer :: i, j, k, t, ixind, nadv integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq integer :: itim_old integer :: ncol, lchnk ! # of columns, and chunk identifier integer :: err_code ! Diagnostic, for if some calculation goes amiss. - integer :: icnt, clubbtop + integer :: icnt, clubbtop logical :: lq2(pcnst) integer :: iter - + real(r8) :: frac_limit, ic_limit - real(r8) :: dtime ! CLUBB time step [s] + real(r8) :: dtime ! CLUBB time step [s] real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] @@ -1670,7 +1669,7 @@ subroutine clubb_tend_cam( & real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap + real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap real(r8) :: wprtp_mc_out(pverp+1-top_lev) real(r8) :: wpthlp_mc_out(pverp+1-top_lev) @@ -1698,15 +1697,15 @@ subroutine clubb_tend_cam( & real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] + real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] real(r8) :: fcor ! Coriolis forcing [s^-1] real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] + real(r8) :: ustar ! surface stress [m/s] real(r8) :: z0 ! roughness height [m] real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] + real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] @@ -1718,7 +1717,7 @@ subroutine clubb_tend_cam( & real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] + real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] @@ -1776,7 +1775,7 @@ subroutine clubb_tend_cam( & real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) + real(r8) :: wp2_zt_out(pcols, pverp) real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] @@ -1810,7 +1809,7 @@ subroutine clubb_tend_cam( & ! --------------- ! ! Pointers ! ! --------------- ! - + real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] @@ -1845,17 +1844,17 @@ subroutine clubb_tend_cam( & real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] + real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq + real(r8), pointer, dimension(:,:) :: cmeliq real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] real(r8), pointer, dimension(:,:) :: qsatfac @@ -1922,7 +1921,7 @@ subroutine clubb_tend_cam( & mf_thlflx_output, mf_qtflx_output, & mf_thvflx_output, & mf_rcm_output, & - mf_precc_output + mf_precc_output ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & mf_cape_output @@ -1932,7 +1931,7 @@ subroutine clubb_tend_cam( & mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid mf_qcforc_output, & ! thermodynamic grid mf_qc_output, mf_cloudfrac_output ! thermodynamic grid - + ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & @@ -1953,7 +1952,7 @@ subroutine clubb_tend_cam( & mf_upqc_output, & mf_upent_output ! MF plume level outputs to outfld - real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output + real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output ! MF Plume real(r8), pointer :: tpert(:) @@ -1976,7 +1975,7 @@ subroutine clubb_tend_cam( & mf_thvflx, mf_qcflx, & mf_thforc, mf_qvforc, & mf_qcforc, & - mf_rcm, mf_cloudfrac, & + mf_rcm, mf_cloudfrac, & mf_qc_zt, mf_cloudfrac_zt ! MF plume level @@ -1992,7 +1991,7 @@ subroutine clubb_tend_cam( & ! CFL limiter vars real(r8), dimension(pcols) :: max_cfl real(r8) :: cflval, cflfac - logical :: cfllim + logical :: cfllim ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid @@ -2038,7 +2037,7 @@ subroutine clubb_tend_cam( & frac_limit = 0.01_r8 ic_limit = 1.e-12_r8 - if (clubb_do_adv) then + if (clubb_do_adv) then apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected else apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected @@ -2077,7 +2076,7 @@ subroutine clubb_tend_cam( & ! Determine time step of physics buffer itim_old = pbuf_old_tim_idx() - ! Establish associations between pointers and physics buffer fields + ! Establish associations between pointers and physics buffer fields call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) @@ -2106,7 +2105,7 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - + call pbuf_get_field(pbuf, tke_idx, tke) call pbuf_get_field(pbuf, qrl_idx, qrl) call pbuf_get_field(pbuf, radf_idx, radf_clubb) @@ -2161,15 +2160,15 @@ subroutine clubb_tend_cam( & ! Initialize the apply_const variable (note special logic is due to eularian backstepping) if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then - apply_const = 0._r8 ! On first time through do not remove constant - ! from moments since it has not been added yet + apply_const = 0._r8 ! On first time through do not remove constant + ! from moments since it has not been added yet endif ! Set the ztodt timestep in pbuf for SILHS ztodtptr(:) = 1.0_r8*hdtime ! Define the grid box size. CLUBB needs this information to determine what - ! the maximum length scale should be. This depends on the column for + ! the maximum length scale should be. This depends on the column for ! variable mesh grids and lat-lon grids if (single_column) then ! If single column specify grid box size to be something @@ -2177,7 +2176,7 @@ subroutine clubb_tend_cam( & grid_dx(:) = 100000._r8 grid_dy(:) = 100000._r8 else - + call grid_size(state1, grid_dx, grid_dy) end if @@ -2192,11 +2191,11 @@ subroutine clubb_tend_cam( & lq2(1) = .TRUE. lq2(ixcldice) = .TRUE. lq2(ixnumice) = .TRUE. - + latsub = latvap + latice - + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - + stend(:ncol,:)=0._r8 qvtend(:ncol,:)=0._r8 qitend(:ncol,:)=0._r8 @@ -2210,9 +2209,9 @@ subroutine clubb_tend_cam( & ! update local copy of state with the tendencies ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) + ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) ! Add the ice tendency to the output tendency call physics_ptend_sum(ptend_loc, ptend_all, ncol) @@ -2226,61 +2225,61 @@ subroutine clubb_tend_cam( & call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) call outfld( 'QITENDICE', qitend, pcols, lchnk ) call outfld( 'NITENDICE', initend, pcols, lchnk ) - + endif ! Determine CLUBB time step and make it sub-step friendly - ! For now we want CLUBB time step to be 5 min since that is + ! For now we want CLUBB time step to be 5 min since that is ! what has been scientifically validated. However, there are certain - ! instances when a 5 min time step will not be possible (based on + ! instances when a 5 min time step will not be possible (based on ! host model time step or on macro-micro sub-stepping - dtime = clubb_timestep - - ! Now check to see if dtime is greater than the host model - ! (or sub stepped) time step. If it is, then simply - ! set it equal to the host (or sub step) time step. + dtime = clubb_timestep + + ! Now check to see if dtime is greater than the host model + ! (or sub stepped) time step. If it is, then simply + ! set it equal to the host (or sub step) time step. ! This section is mostly to deal with small host model ! time steps (or small sub-steps) - + if (dtime > hdtime) then dtime = hdtime endif - + ! Now check to see if CLUBB time step divides evenly into ! the host model time step. If not, force it to divide evenly. ! We also want it to be 5 minutes or less. This section is ! mainly for host model time steps that are not evenly divisible - ! by 5 minutes - + ! by 5 minutes + if (mod(hdtime,dtime) .ne. 0) then dtime = hdtime/2._r8 - do while (dtime > clubb_timestep) + do while (dtime > clubb_timestep) dtime = dtime/2._r8 end do - endif + endif ! If resulting host model time step and CLUBB time step do not divide evenly - ! into each other, have model throw a fit. + ! into each other, have model throw a fit. if (mod(hdtime,dtime) .ne. 0) then call endrun(subr//': CLUBB time step and HOST time step NOT compatible') endif - - ! determine number of timesteps CLUBB core should be advanced, - ! host time step divided by CLUBB time step + + ! determine number of timesteps CLUBB core should be advanced, + ! host time step divided by CLUBB time step nadv = max(hdtime/dtime,1._r8) - + ! Initialize forcings for transported scalars to zero - + sclrm_forcing(:,:) = 0._r8 edsclrm_forcing(:,:) = 0._r8 sclrm(:,:) = 0._r8 - + ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant - ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent - ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables + ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent + ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state do k=1,pver @@ -2288,9 +2287,9 @@ subroutine clubb_tend_cam( & inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) enddo enddo - - ! At each CLUBB call, initialize mean momentum and thermo CLUBB state - ! from the CAM state + + ! At each CLUBB call, initialize mean momentum and thermo CLUBB state + ! from the CAM state do k=1,pver ! loop over levels do i=1,ncol ! loop over columns @@ -2304,11 +2303,11 @@ subroutine clubb_tend_cam( & * inv_exner_clubb(i,k) if (clubb_do_adv) then - if (macmic_it == 1) then + if (macmic_it == 1) then - ! Note that some of the moments below can be positive or negative. - ! Remove a constant that was added to prevent dynamics from clipping - ! them to prevent dynamics from making them positive. + ! Note that some of the moments below can be positive or negative. + ! Remove a constant that was added to prevent dynamics from clipping + ! them to prevent dynamics from making them positive. thlp2(i,k) = state1%q(i,k,ixthlp2) rtp2(i,k) = state1%q(i,k,ixrtp2) rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) @@ -2323,23 +2322,23 @@ subroutine clubb_tend_cam( & enddo enddo - + if (clubb_do_adv) then - ! If not last step of macmic loop then set apply_const back to - ! zero to prevent output from being corrupted. - if (macmic_it == cld_macmic_num_steps) then - apply_const = 1._r8 + ! If not last step of macmic loop then set apply_const back to + ! zero to prevent output from being corrupted. + if (macmic_it == cld_macmic_num_steps) then + apply_const = 1._r8 else apply_const = 0._r8 endif - endif + endif rtm(1:ncol,pverp) = rtm(1:ncol,pver) um(1:ncol,pverp) = state1%u(1:ncol,pver) vm(1:ncol,pverp) = state1%v(1:ncol,pver) thlm(1:ncol,pverp) = thlm(1:ncol,pver) - - if (clubb_do_adv) then + + if (clubb_do_adv) then thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) @@ -2351,7 +2350,7 @@ subroutine clubb_tend_cam( & vp2(1:ncol,pverp)=vp2(1:ncol,pver) endif - ! Compute virtual potential temperature, which is needed for CLUBB + ! Compute virtual potential temperature, which is needed for CLUBB do k=1,pver do i=1,ncol thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& @@ -2429,12 +2428,12 @@ subroutine clubb_tend_cam( & ! Determine Coriolis force at given latitude. This is never used ! when CLUBB is implemented in a host model, therefore just set ! to zero. - fcor = 0._r8 + fcor = 0._r8 ! Define the CLUBB momentum grid (in height, units of m) do k=1,nlev+1 zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo + enddo ! Define the CLUBB thermodynamic grid (in units of m) do k=1,nlev @@ -2444,29 +2443,29 @@ subroutine clubb_tend_cam( & do k=1,pver dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness enddo - - ! Thermodynamic ghost point is below surface + + ! Thermodynamic ghost point is below surface zt_g(1) = -1._r8*zt_g(2) ! Set the elevation of the surface sfc_elevation = state1%zi(i,pver+1) - + ! Set the grid size host_dx = grid_dx(i) host_dy = grid_dy(i) - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. + ! Compute thermodynamic stuff needed for CLUBB on thermo levels. ! Inputs for the momentum levels are set below setup_clubb core do k=1,nlev p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo + rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) qv_zt(k+1) = state1%q(i,pver-k+1,ixq) - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) + rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) radf(k+1) = radf_clubb(i,pver-k+1) qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) enddo @@ -2486,12 +2485,12 @@ subroutine clubb_tend_cam( & th_zt(1) = th_zt(2) qv_zt(1) = qv_zt(2) - ! Compute mean w wind on thermo grid, convert from omega to w + ! Compute mean w wind on thermo grid, convert from omega to w wm_zt(1) = 0._r8 do k=1,nlev wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) enddo - + ! ------------------------------------------------- ! ! Begin case specific code for SCAM cases. ! ! This section of code block NOT called in ! @@ -2511,21 +2510,21 @@ subroutine clubb_tend_cam( & ! Compute surface wind (ubar) ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) if (ubar < 0.25_r8) ubar = 0.25_r8 - + ! Below denotes case specifics for surface momentum ! and thermodynamic fluxes, depending on the case - ! Define ustar (based on case, if not variable) + ! Define ustar (based on case, if not variable) ustar = 0.25_r8 ! Initialize ustar in case no case - + if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then ustar = 0.28_r8 endif - + if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then ustar = 0.30_r8 endif - + if(trim(scm_clubb_iop_name) == 'RICO_3day') then ustar = 0.28_r8 endif @@ -2533,33 +2532,33 @@ subroutine clubb_tend_cam( & if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & trim(scm_clubb_iop_name) == 'ARM_CC') then - + bflx22 = (gravit/theta0)*wpthlp_sfc - ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) + ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation + + ! Compute the surface momentum fluxes, if this is a SCAM simulation upwp_sfc = -um(i,pver)*ustar**2/ubar vpwp_sfc = -vm(i,pver)*ustar**2/ubar - + endif - ! Define surface sources for transported variables for diffusion, will + ! Define surface sources for transported variables for diffusion, will ! be zero as these tendencies are done in vertical_diffusion do ixind=1,edsclr_dim wpedsclrp_sfc(ixind) = 0._r8 - enddo + enddo ! Set stats output and increment equal to CLUBB and host dt stats_tsamp = dtime stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values + + ! Heights need to be set at each timestep. Therefore, recall + ! setup_grid and setup_parameters for this. + + ! Read in parameters for CLUBB. Just read in default values call read_parameters_api( -99, "", clubb_params ) - + ! Set-up CLUBB core at each CLUBB call because heights can change ! Important note: do not make any calls that use CLUBB grid-height ! operators (such as zt2zm_api, etc.) until AFTER the @@ -2578,7 +2577,7 @@ subroutine clubb_tend_cam( & rtm_forcing = 0._r8 um_forcing = 0._r8 vm_forcing = 0._r8 - + wprtp_forcing = 0._r8 wpthlp_forcing = 0._r8 rtp2_forcing = 0._r8 @@ -2608,13 +2607,13 @@ subroutine clubb_tend_cam( & invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) thv_ds_zm = zt2zm_api(thv_ds_zt) wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model + + ! Surface fluxes provided by host model wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - + vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux + ! Need to flip arrays around for CLUBB core do k=1,nlev+1 um_in(k) = um(i,pverp-k+1) @@ -2671,7 +2670,7 @@ subroutine clubb_tend_cam( & wp2hmp(k,:) = 0._r8 rtphmp_zt(k,:) = 0._r8 thlphmp_zt(k,:) = 0._r8 - + enddo pre_in(1) = pre_in(2) @@ -2685,17 +2684,17 @@ subroutine clubb_tend_cam( & kappa_zt(1) = kappa_zt(2) qc_zt(1) = qc_zt(2) invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) + + kappa_zm = zt2zm_api(kappa_zt) do k=1,pverp p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) enddo end if - + if (clubb_do_adv) then if (macmic_it == 1) then - wp2_in=zt2zm_api(wp2_in) + wp2_in=zt2zm_api(wp2_in) wpthlp_in=zt2zm_api(wpthlp_in) wprtp_in=zt2zm_api(wprtp_in) up2_in=zt2zm_api(up2_in) @@ -2703,7 +2702,7 @@ subroutine clubb_tend_cam( & thlp2_in=zt2zm_api(thlp2_in) rtp2_in=zt2zm_api(rtp2_in) rtpthlp_in=zt2zm_api(rtpthlp_in) - + do k=1,nlev+1 thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) @@ -2714,10 +2713,10 @@ subroutine clubb_tend_cam( & endif endif - ! Do the same for tracers + ! Do the same for tracers icnt=0 do ixind=1,pcnst - if (lq(ixind)) then + if (lq(ixind)) then icnt=icnt+1 do k=1,nlev edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) @@ -2725,22 +2724,22 @@ subroutine clubb_tend_cam( & edsclr_in(1,icnt) = edsclr_in(2,icnt) end if enddo - - if (do_expldiff) then + + if (do_expldiff) then do k=1,nlev edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) enddo - + edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) - edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) - endif + edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) + endif stats_nsamp = nint(stats_tsamp/dtime) stats_nout = nint(stats_tout/dtime) do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - + ! Increment the statistics then being stats timestep if (l_stats) then call stats_begin_timestep_api(t, stats_nsamp, stats_nout) @@ -2824,7 +2823,7 @@ subroutine clubb_tend_cam( & rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & + mf_sqt(k) - + thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & + mf_sthl(k) @@ -2833,7 +2832,7 @@ subroutine clubb_tend_cam( & ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) + ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) @@ -2890,7 +2889,7 @@ subroutine clubb_tend_cam( & if (do_rainturb) then - rvm_in = rtm_in - rcm_inout + rvm_in = rtm_in - rcm_inout call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & rtp2_mc_out, thlp2_mc_out, & @@ -2899,15 +2898,15 @@ subroutine clubb_tend_cam( & dum1 = (1._r8 - cam_in%landfrac(i)) - ! update turbulent moments based on rain evaporation + ! update turbulent moments based on rain evaporation rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime + thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif + endif if (do_cldcool) then - + rcm_out_zm = zt2zm_api(rcm_inout) qrl_zm = zt2zm_api(qrl_clubb) thlp2_rad_out(:) = 0._r8 @@ -2924,15 +2923,15 @@ subroutine clubb_tend_cam( & enddo ! end time loop if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) + if (macmic_it == cld_macmic_num_steps) then + wp2_in=zm2zt_api(wp2_in) wpthlp_in=zm2zt_api(wpthlp_in) wprtp_in=zm2zt_api(wprtp_in) up2_in=zm2zt_api(up2_in) vp2_in=zm2zt_api(vp2_in) thlp2_in=zm2zt_api(thlp2_in) rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) + rtpthlp_in=zm2zt_api(rtpthlp_in) do k=1,nlev+1 thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) @@ -2943,7 +2942,7 @@ subroutine clubb_tend_cam( & enddo endif endif - + ! Convert RTP2 and THLP2 to thermo grid for output rtp2_zt = zm2zt_api(rtp2_in) thl2_zt = zm2zt_api(thlp2_in) @@ -2952,10 +2951,10 @@ subroutine clubb_tend_cam( & mf_qc_zt = zm2zt_api(mf_moist_qc) mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) - ! Arrays need to be "flipped" to CAM grid + ! Arrays need to be "flipped" to CAM grid do k=1,nlev+1 - + um(i,pverp-k+1) = um_in(k) vm(i,pverp-k+1) = vm_in(k) upwp(i,pverp-k+1) = upwp_in(k) @@ -3103,7 +3102,7 @@ subroutine clubb_tend_cam( & ! enforce zero tracer tendencies above the top_lev level -- no change icnt=0 do ixind=1,pcnst - if (lq(ixind)) then + if (lq(ixind)) then icnt=icnt+1 edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) end if @@ -3111,29 +3110,29 @@ subroutine clubb_tend_cam( & ! Fill up arrays needed for McICA. Note we do not want the ghost point, ! thus why the second loop is needed. - + zi_out(i,1) = 0._r8 ! Section below is concentrated on energy fixing for conservation. ! There are two steps to this process. The first is to remove any tendencies - ! CLUBB may have produced above where it is active due to roundoff. + ! CLUBB may have produced above where it is active due to roundoff. ! The second is to provider a fixer because CLUBB and CAM's thermodynamic - ! variables are different. + ! variables are different. ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from - ! firing up in the stratosphere + ! firing up in the stratosphere clubbtop = troplev(i) do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) clubbtop = clubbtop + 1 - enddo - + enddo + ! Compute static energy using CLUBB's variables do k=1,pver clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & + latvap * rcm(i,k) & + gravit * state1%zm(i,k) + state1%phis(i) - enddo - + enddo + ! Compute integrals above layer where CLUBB is active se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called @@ -3147,13 +3146,13 @@ subroutine clubb_tend_cam( & tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit enddo - + ! Compute the disbalance of total energy and water in upper levels, - ! divide by the thickness in the lower atmosphere where we will + ! divide by the thickness in the lower atmosphere where we will ! evenly distribute this disbalance se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - + ! Perform a test to see if there will be any negative RTM errors ! in the column. If so, apply the disbalance to the surface apply_to_surface = .false. @@ -3165,7 +3164,7 @@ subroutine clubb_tend_cam( & endif enddo endif - + if (apply_to_surface) then tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) @@ -3177,14 +3176,14 @@ subroutine clubb_tend_cam( & rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit enddo - endif - + endif + ! Essentially "zero" out tendencies in the layers above where CLUBB is active do k=1,clubbtop if (apply_to_heat) clubb_s(k) = state1%s(i,k) rcm(i,k) = state1%q(i,k,ixcldliq) rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) - enddo + enddo ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water ! after CLUBB is called. This is for energy conservation purposes. @@ -3192,31 +3191,31 @@ subroutine clubb_tend_cam( & ke_a = 0._r8 wv_a = 0._r8 wl_a = 0._r8 - + ! Do the same as above, but for before CLUBB was called. se_b = 0._r8 ke_b = 0._r8 wv_b = 0._r8 - wl_b = 0._r8 + wl_b = 0._r8 do k=1,pver se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit - + se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit - wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit + wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit enddo - + ! Based on these integrals, compute the total energy before and after CLUBB call te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) - + ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously - te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime + te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime ! subtract enthalpy of falling precip from tb te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime @@ -3224,7 +3223,7 @@ subroutine clubb_tend_cam( & se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where + ! Apply this fixer throughout the column evenly, but only at layers where ! CLUBB is active. ! ! NOTE: The energy fixer seems to cause the climate to change significantly @@ -3234,8 +3233,8 @@ subroutine clubb_tend_cam( & do k=clubbtop+1,pver clubb_s(k) = clubb_s(k) - se_dis(i)*gravit enddo - endif - ! convert to units of +ve [K] + endif + ! convert to units of +ve [K] se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point @@ -3243,7 +3242,7 @@ subroutine clubb_tend_cam( & rtm_integral_vtend = 0._r8 rtm_integral_ltend = 0._r8 do k=1,pver - + ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor @@ -3256,9 +3255,9 @@ subroutine clubb_tend_cam( & if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then - ! Here add a constant to moments which can be either positive or + ! Here add a constant to moments which can be either positive or ! negative. This is to prevent clipping when dynamics tries to - ! make all constituents positive + ! make all constituents positive wp3(i,k) = wp3(i,k) + wp3_const rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const wpthlp(i,k) = wpthlp(i,k) + wpthlp_const @@ -3267,7 +3266,7 @@ subroutine clubb_tend_cam( & ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance - ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP + ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 @@ -3282,13 +3281,13 @@ subroutine clubb_tend_cam( & ptend_loc%q(i,k,ixwp2)=0._r8 ptend_loc%q(i,k,ixwp3)=0._r8 ptend_loc%q(i,k,ixup2)=0._r8 - ptend_loc%q(i,k,ixvp2)=0._r8 + ptend_loc%q(i,k,ixvp2)=0._r8 endif endif ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. - ! Loading up this array doesn't mean the tendencies are applied. + ! Loading up this array doesn't mean the tendencies are applied. ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed icnt=0 @@ -3300,13 +3299,13 @@ subroutine clubb_tend_cam( & (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then - ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents + ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents end if end if enddo enddo - + enddo ! end column loop @@ -3316,7 +3315,7 @@ subroutine clubb_tend_cam( & call outfld('KVH_CLUBB', khzm, pcols, lchnk) - ! Add constant to ghost point so that output is not corrupted + ! Add constant to ghost point so that output is not corrupted if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then wp3(:,pverp) = wp3(:,pverp) + wp3_const @@ -3324,7 +3323,7 @@ subroutine clubb_tend_cam( & wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const endif - endif + endif cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) @@ -3333,62 +3332,62 @@ subroutine clubb_tend_cam( & ! and compute output, etc ! ! ------------------------------------------------- ! - ! Output CLUBB tendencies + ! Output CLUBB tendencies call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) + call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) call outfld( 'CMELIQ', cmeliq, pcols, lchnk) call physics_ptend_sum(ptend_loc,ptend_all,ncol) call physics_update(state1,ptend_loc,hdtime) - - ! Due to the order of operation of CLUBB, which closes on liquid first, - ! then advances it's predictive equations second, this can lead to - ! RHliq > 1 directly before microphysics is called. Therefore, we use - ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. - + + ! Due to the order of operation of CLUBB, which closes on liquid first, + ! then advances it's predictive equations second, this can lead to + ! RHliq > 1 directly before microphysics is called. Therefore, we use + ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. + if (clubb_do_liqsupersat) then - + ! -------------------------------------- ! ! Ice Saturation Adjustment Computation ! ! -------------------------------------- ! - + latsub = latvap + latice lq2(:) = .FALSE. lq2(ixq) = .TRUE. lq2(ixcldliq) = .TRUE. lq2(ixnumliq) = .TRUE. - + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - + stend(:ncol,:)=0._r8 qvtend(:ncol,:)=0._r8 qctend(:ncol,:)=0._r8 inctend(:ncol,:)=0._r8 - + call liquid_macro_tend(npccn(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,ixq),state1%q(:ncol,top_lev:pver,ixcldliq),& state1%q(:ncol,top_lev:pver,ixnumliq),latvap,hdtime,& stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qctend(:ncol,top_lev:pver),& inctend(:ncol,top_lev:pver)) - + ! update local copy of state with the tendencies ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - + ! Add the ice tendency to the output tendency call physics_ptend_sum(ptend_loc, ptend_all, ncol) - + ! ptend_loc is reset to zero by this call call physics_update(state1, ptend_loc, hdtime) - + ! Write output for tendencies: ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) @@ -3396,18 +3395,18 @@ subroutine clubb_tend_cam( & call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) call outfld( 'QCTENDICE', qctend, pcols, lchnk ) call outfld( 'NCTENDICE', inctend, pcols, lchnk ) - + where(qctend .ne. 0._r8) fqtend = 1._r8 elsewhere fqtend = 0._r8 end where - + call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) end if - + + ! ------------------------------------------------------------ ! ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! ! ------------------------------------------------------------ ! ! The rest of the code deals with diagnosing variables ! ! for microphysics/radiation computation and macrophysics ! @@ -3415,11 +3414,11 @@ subroutine clubb_tend_cam( & ! ------------------------------------------------------------ ! ! ------------------------------------------------------------ ! - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! COMPUTE THE ICE CLOUD DETRAINMENT ! ! Detrainment of convective condensate into the environment or stratiform cloud ! - ! --------------------------------------------------------------------------------- ! + ! --------------------------------------------------------------------------------- ! ! Initialize the shallow convective detrainment rate, will always be zero dlf2(:,:) = 0.0_r8 @@ -3440,7 +3439,7 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) end if - + do k=1,pver do i=1,ncol if( state1%t(i,k) > 268.15_r8 ) then @@ -3448,7 +3447,7 @@ subroutine clubb_tend_cam( & elseif ( state1%t(i,k) < 238.15_r8 ) then dum1 = 1.0_r8 else - dum1 = ( 268.15_r8 - state1%t(i,k) ) / 30._r8 + dum1 = ( 268.15_r8 - state1%t(i,k) ) / 30._r8 endif if (zmconv_microp) then @@ -3460,21 +3459,21 @@ subroutine clubb_tend_cam( & ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice - else + else ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & / (4._r8*3.14_r8* 8.e-6_r8**3*997._r8) + & ! Deep Convection 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection + / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & / (4._r8*3.14_r8*25.e-6_r8**3*500._r8) + & ! Deep Convection 3._r8 * ( dlf2(i,k) * dum1 ) & / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice - dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) + dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) dlf_ice_out(i,k) = dlf(i,k) * dum1 end if @@ -3483,18 +3482,18 @@ subroutine clubb_tend_cam( & ! so that the energy checker doesn't complain. det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit - + enddo enddo - + det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - + temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) call outfld( 'DPDLFT', temp2d, pcols, lchnk) - + call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) call physics_ptend_sum(ptend_loc,ptend_all,ncol) @@ -3521,20 +3520,20 @@ subroutine clubb_tend_cam( & else relvarmax = 10.0_r8 endif - + relvar(:,:) = relvarmax ! default - if (deep_scheme .ne. 'CLUBB_SGS') then + if (deep_scheme .ne. 'CLUBB_SGS') then where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) endif - + ! ------------------------------------------------- ! ! Optional Accretion enhancement factor ! - ! ------------------------------------------------- ! + ! ------------------------------------------------- ! accre_enhan(:ncol,:pver) = 1._r8 - + ! ------------------------------------------------- ! ! Diagnose some output variables ! ! ------------------------------------------------- ! @@ -3560,7 +3559,7 @@ subroutine clubb_tend_cam( & sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) enddo enddo - + do k=1,pverp do i=1,ncol wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux @@ -3568,7 +3567,7 @@ subroutine clubb_tend_cam( & rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair + wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair if (do_clubb_mf) then mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair @@ -3594,44 +3593,44 @@ subroutine clubb_tend_cam( & end if enddo enddo - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! Diagnose some quantities that are computed in macrop_tend here. ! ! These are inputs required for the microphysics calculation. ! ! ! ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - ! initialize variables + ! --------------------------------------------------------------------------------- ! + + ! initialize variables alst(:,:) = 0.0_r8 - qlst(:,:) = 0.0_r8 - + qlst(:,:) = 0.0_r8 + do k=1,pver do i=1,ncol - alst(i,k) = cloud_frac(i,k) + alst(i,k) = cloud_frac(i,k) qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio enddo enddo - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - + ! --------------------------------------------------------------------------------- ! + deepcu = 0.0_r8 shalcu = 0.0_r8 do k=1,pver-1 do i=1,ncol - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never + ! diagnose the deep convective cloud fraction, as done in macrophysics based on the + ! deep convective mass flux, read in from pbuf. Since shallow convection is never ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. + ! fraction is purely from deep convection scheme. deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) if (do_clubb_mf_rad) then shalcu(i,k) = mf_cloudfrac_output(i,k) sh_icwmr(i,k) = mf_qc_output(i,k) - end if + end if if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then deepcu(i,k) = 0._r8 @@ -3640,15 +3639,15 @@ subroutine clubb_tend_cam( & if (shalcu(i,k) <= frac_limit .or. sh_icwmr(i,k) < ic_limit) then shalcu(i,k) = 0._r8 endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable + + ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud + ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud ! from CLUBB plus the deep convective cloud fraction concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) enddo enddo - + if (single_column) then if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & @@ -3656,20 +3655,20 @@ subroutine clubb_tend_cam( & trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & trim(scm_clubb_iop_name) == 'RICO_3day' .or. & trim(scm_clubb_iop_name) == 'ARM_CC') then - + deepcu(:,:) = 0.0_r8 concld(:,:) = 0.0_r8 - - endif + + endif endif - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! COMPUTE THE ICE CLOUD FRACTION PORTION ! ! use the aist_vector function to compute the ice cloud fraction ! - ! --------------------------------------------------------------------------------- ! + ! --------------------------------------------------------------------------------- ! aist(:,:top_lev-1) = 0._r8 - qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below + qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below do k = top_lev, pver @@ -3698,60 +3697,60 @@ subroutine clubb_tend_cam( & qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) endif enddo - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! ! ! ! For now leave the computation of ice stratus fraction from macrop_driver intact ! - ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! + ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! ! fraction that was coded in macrop_driver ! - ! --------------------------------------------------------------------------------- ! - + ! --------------------------------------------------------------------------------- ! + ! Recompute net stratus fraction using maximum over-lapping assumption, as done ! in macrophysics code, using alst computed above and aist read in from physics buffer - + do k=1,pver do i=1,ncol ast(i,k) = max(alst(i,k),aist(i,k)) - qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) + qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) enddo enddo - - ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just - ! be outputting the shallow convective cloud fraction + + ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just + ! be outputting the shallow convective cloud fraction do k=1,pver do i=1,ncol cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) enddo enddo - - ! --------------------------------------------------------------------------------- ! + + ! --------------------------------------------------------------------------------- ! ! DIAGNOSE THE PBL DEPTH ! ! this is needed for aerosol code ! - ! --------------------------------------------------------------------------------- ! - + ! --------------------------------------------------------------------------------- ! + do i=1,ncol do k=1,pver th(i,k) = state1%t(i,k)*state1%exner(i,k) thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) enddo enddo - + ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) - rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) + rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & rrho(1:ncol), ustar2(1:ncol)) ! use correct qflux from coupler call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & obklen(1:ncol)) - + dummy2(:) = 0._r8 dummy3(:) = 0._r8 - + where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 ! Compute PBL depth according to Holtslag-Boville Scheme @@ -3761,14 +3760,14 @@ subroutine clubb_tend_cam( & ! Output the PBL depth call outfld('PBLH', pblh, pcols, lchnk) - + ! Assign the first pver levels of cloud_frac back to cld cld(:,1:pver) = cloud_frac(:,1:pver) - ! --------------------------------------------------------------------------------- ! + ! --------------------------------------------------------------------------------- ! ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! - ! --------------------------------------------------------------------------------- ! - + ! --------------------------------------------------------------------------------- ! + ! Output calls of variables goes here call outfld( 'RELVAR', relvar, pcols, lchnk ) call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) @@ -3892,7 +3891,7 @@ subroutine clubb_tend_cam( & call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) + call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) if (do_clubb_mf) then @@ -3901,59 +3900,59 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) end if end if - + ! Output CLUBB history here - if (l_stats) then - + if (l_stats) then + do i=1,stats_zt%num_output_fields - + temp1 = trim(stats_zt%file%var(i)%name) sub = temp1 if (len(temp1) > 16) sub = temp1(1:16) - + call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) enddo - + do i=1,stats_zm%num_output_fields - + temp1 = trim(stats_zm%file%var(i)%name) sub = temp1 if (len(temp1) > 16) sub = temp1(1:16) - + call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) enddo - if (l_output_rad_files) then + if (l_output_rad_files) then do i=1,stats_rad_zt%num_output_fields call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) enddo - + do i=1,stats_rad_zm%num_output_fields call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) enddo endif - + do i=1,stats_sfc%num_output_fields call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) enddo - + endif - + return #endif end subroutine clubb_tend_cam - + ! =============================================================================== ! ! ! ! =============================================================================== ! ! Saturation adjustment for ice ! Add ice mass if supersaturated -elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend) +elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend) use wv_sat_methods, only: wv_sat_qsat_ice - real(r8), intent(in) :: naai !Activated number of ice nuclei + real(r8), intent(in) :: naai !Activated number of ice nuclei real(r8), intent(in) :: t !temperature (k) real(r8), intent(in) :: p !pressure (pa0 real(r8), intent(in) :: qv !water vapor mixing ratio @@ -3961,11 +3960,11 @@ elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,q real(r8), intent(in) :: ni !ice number concentration real(r8), intent(in) :: xxls !latent heat of freezing real(r8), intent(in) :: deltat !timestep - real(r8), intent(out) :: stend ! 'temperature' tendency + real(r8), intent(out) :: stend ! 'temperature' tendency real(r8), intent(out) :: qvtend !vapor tendency real(r8), intent(out) :: qitend !ice mass tendency - real(r8), intent(out) :: nitend !ice number tendency - + real(r8), intent(out) :: nitend !ice number tendency + real(r8) :: ESI real(r8) :: QSI real(r8) :: tau @@ -4019,7 +4018,7 @@ end subroutine ice_macro_tend ! Code writen March, 1999 by Bjorn Stevens ! -real(r8) function diag_ustar( z, bflx, wnd, z0 ) +real(r8) function diag_ustar( z, bflx, wnd, z0 ) use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g @@ -4086,64 +4085,64 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Description: Initializes the statistics saving functionality of ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here ! the traditional stats_init of CLUBB is not called, as it is not compatible - ! with CAM output. - + ! with CAM output. + !----------------------------------------------------------------------- use clubb_api_module, only: & stats_zt, & ! Variables - ztscr01, & - ztscr02, & - ztscr03, & - ztscr04, & - ztscr05, & - ztscr06, & - ztscr07, & - ztscr08, & - ztscr09, & - ztscr10, & - ztscr11, & - ztscr12, & - ztscr13, & - ztscr14, & - ztscr15, & - ztscr16, & - ztscr17, & - ztscr18, & - ztscr19, & - ztscr20, & + ztscr01, & + ztscr02, & + ztscr03, & + ztscr04, & + ztscr05, & + ztscr06, & + ztscr07, & + ztscr08, & + ztscr09, & + ztscr10, & + ztscr11, & + ztscr12, & + ztscr13, & + ztscr14, & + ztscr15, & + ztscr16, & + ztscr17, & + ztscr18, & + ztscr19, & + ztscr20, & ztscr21 use clubb_api_module, only: & - stats_zm, & - zmscr01, & - zmscr02, & - zmscr03, & - zmscr04, & - zmscr05, & - zmscr06, & - zmscr07, & - zmscr08, & - zmscr09, & - zmscr10, & - zmscr11, & - zmscr12, & - zmscr13, & - zmscr14, & + stats_zm, & + zmscr01, & + zmscr02, & + zmscr03, & + zmscr04, & + zmscr05, & + zmscr06, & + zmscr07, & + zmscr08, & + zmscr09, & + zmscr10, & + zmscr11, & + zmscr12, & + zmscr13, & + zmscr14, & zmscr15, & zmscr16, & zmscr17, & stats_rad_zt, & stats_rad_zm, & - stats_sfc, & + stats_sfc, & l_stats, & - l_output_rad_files, & - stats_tsamp, & - stats_tout, & - l_stats_samp, & - l_stats_last, & - l_netcdf, & + l_output_rad_files, & + stats_tsamp, & + stats_tout, & + l_stats_samp, & + l_stats_last, & + l_netcdf, & l_grads use clubb_api_module, only: time_precision, & ! @@ -4165,12 +4164,12 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & logical, intent(in) :: l_stats_in ! Stats on? T/F - real(kind=time_precision), intent(in) :: & + real(kind=time_precision), intent(in) :: & stats_tsamp_in, & ! Sampling interval [s] stats_tout_in ! Output interval [s] integer, intent(in) :: nnzp ! Grid points in the vertical [count] - integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] + integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] @@ -4188,11 +4187,11 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface - namelist /clubb_stats_nl/ & - clubb_vars_zt, & + namelist /clubb_stats_nl/ & + clubb_vars_zt, & clubb_vars_zm, & clubb_vars_rad_zt, & - clubb_vars_rad_zm, & + clubb_vars_rad_zm, & clubb_vars_sfc ! Local Variables @@ -4209,7 +4208,7 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Set stats_variables variables with inputs from calling subroutine l_stats = l_stats_in - + stats_tsamp = stats_tsamp_in stats_tout = stats_tout_in @@ -4227,7 +4226,7 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & clubb_vars_rad_zm = '' clubb_vars_sfc = '' - ! Read variables to compute from the namelist + ! Read variables to compute from the namelist if (masterproc) then iunit= getunit() open(unit=iunit,file="atm_in",status='old') @@ -4274,8 +4273,8 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Initialize zt (mass points) i = 1 - do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zt(i)) /= 0 .and. & + do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zt(i)) /= 0 .and. & i <= nvarmax_zt ) i = i + 1 enddo @@ -4356,8 +4355,8 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Initialize zm (momentum points) i = 1 - do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zm(i)) /= 0 .and. & + do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zm(i)) /= 0 .and. & i <= nvarmax_zm ) i = i + 1 end do @@ -4428,10 +4427,10 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Initialize rad_zt (radiation points) if (l_output_rad_files) then - + i = 1 - do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & + do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & i <= nvarmax_rad_zt ) i = i + 1 end do @@ -4463,10 +4462,10 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) ! Initialize rad_zm (radiation points) - + i = 1 - do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & + do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & i <= nvarmax_rad_zm ) i = i + 1 end do @@ -4494,7 +4493,7 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) - + call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) end if ! l_output_rad_files @@ -4502,8 +4501,8 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Initialize sfc (surface point) i = 1 - do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_sfc(i)) /= 0 .and. & + do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_sfc(i)) /= 0 .and. & i <= nvarmax_sfc ) i = i + 1 end do @@ -4542,40 +4541,40 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & ! Now call add fields do i = 1, stats_zt%num_output_fields - + temp1 = trim(stats_zt%file%var(i)%name) sub = temp1 if (len(temp1) > 16) sub = temp1(1:16) - + !!XXgoldyXX: Probably need a hist coord for nnzp for the vertical call addfld(trim(sub),(/ 'ilev' /),& 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) enddo - + do i = 1, stats_zm%num_output_fields - + temp1 = trim(stats_zm%file%var(i)%name) sub = temp1 if (len(temp1) > 16) sub = temp1(1:16) - + !!XXgoldyXX: Probably need a hist coord for nnzp for the vertical call addfld(trim(sub),(/ 'ilev' /),& 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) enddo - if (l_output_rad_files) then + if (l_output_rad_files) then !!XXgoldyXX: Probably need a hist coord for nnzp for the vertical do i = 1, stats_rad_zt%num_output_fields call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) enddo - + do i = 1, stats_rad_zm%num_output_fields call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) enddo - endif - + endif + do i = 1, stats_sfc%num_output_fields call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) @@ -4583,15 +4582,15 @@ subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & return - end subroutine stats_init_clubb - + end subroutine stats_init_clubb + #endif ! =============================================================================== ! ! ! ! =============================================================================== ! - + !----------------------------------------------------------------------- subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) @@ -4607,12 +4606,12 @@ subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out use clubb_api_module, only: & fstderr, & ! Constant(s) stats_zt, & ! Variable(s) - stats_zm, & + stats_zm, & stats_rad_zt, & stats_rad_zm, & - stats_sfc, & - l_stats_last, & - stats_tsamp, & + stats_sfc, & + l_stats_last, & + stats_tsamp, & stats_tout, & l_output_rad_files, & clubb_at_least_debug_level_api ! Procedure(s) @@ -4625,7 +4624,7 @@ subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out #endif integer :: thecol - + real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) @@ -4656,36 +4655,36 @@ subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out end if call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) - ! Here we are not outputting the data, rather reading the stats into + ! Here we are not outputting the data, rather reading the stats into ! arrays which are conformable to CAM output. Also, the data is "flipped" - ! in the vertical level to be the same as CAM output. + ! in the vertical level to be the same as CAM output. do i = 1, stats_zt%num_output_fields - do k = 1, stats_zt%kk + do k = 1, stats_zt%kk out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 - enddo + enddo enddo do i = 1, stats_zm%num_output_fields - do k = 1, stats_zt%kk + do k = 1, stats_zt%kk out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 - enddo + enddo enddo - if (l_output_rad_files) then + if (l_output_rad_files) then do i = 1, stats_rad_zt%num_output_fields - do k = 1, stats_rad_zt%kk + do k = 1, stats_rad_zt%kk out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 - enddo + enddo enddo - + do i = 1, stats_rad_zm%num_output_fields - do k = 1, stats_rad_zm%kk + do k = 1, stats_rad_zm%kk out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 - enddo + enddo enddo ! Fill in values above the CLUBB top. @@ -4695,9 +4694,9 @@ subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out out_radzm(thecol,:top_lev-1,:) = 0.0_r8 endif ! l_output_rad_files - + do i = 1, stats_sfc%num_output_fields - out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) + out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 enddo @@ -4720,14 +4719,14 @@ subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out #endif end subroutine stats_end_timestep_clubb - - + + ! =============================================================================== ! ! ! ! =============================================================================== ! #ifdef CLUBB_SGS - + !----------------------------------------------------------------------- subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) @@ -4761,14 +4760,14 @@ subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) return end subroutine stats_zero - + #endif ! =============================================================================== ! ! ! ! =============================================================================== ! - + #ifdef CLUBB_SGS !----------------------------------------------------------------------- subroutine stats_avg( kk, num_output_fields, x, n ) @@ -4816,7 +4815,7 @@ subroutine grid_size(state, grid_dx, grid_dy) use shr_const_mod, only: shr_const_pi use physics_types, only: physics_state - + type(physics_state), intent(in) :: state real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] @@ -4831,16 +4830,16 @@ subroutine grid_size(state, grid_dx, grid_dy) do i=1,state%ncol column_area = get_area_p(state%lchnk,i) degree = sqrt(column_area)*(180._r8/shr_const_pi) - + ! Now find meters per degree latitude ! Below equation finds distance between two points on an ellipsoid, derived from expansion - ! taking into account ellipsoid using World Geodetic System (WGS84) reference + ! taking into account ellipsoid using World Geodetic System (WGS84) reference mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) grid_dx(i) = mpdeglat * degree grid_dy(i) = grid_dx(i) ! Assume these are the same - enddo + enddo - end subroutine grid_size + end subroutine grid_size #endif @@ -5046,4673 +5045,5 @@ subroutine init_clubb_config_flags( clubb_config_flags_in ) end subroutine init_clubb_config_flags #endif - + end module clubb_intr -======= -module clubb_intr - - !----------------------------------------------------------------------------------------------------- ! - ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! - ! by the University of Wisconsin Milwaukee Group (UWM). ! - ! ! - ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! - ! ! - ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! - ! differencing the diffused and initial states. ! - ! ! - ! Calling sequence: ! - ! ! - !---------------------------Code history-------------------------------------------------------------- ! - ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! - ! Modified by: K Thayer-Calder ! - ! ! - !----------------------------------------------------------------------------------------------------- ! - - use shr_kind_mod, only: r8=>shr_kind_r8 - use ppgrid, only: pver, pverp, pcols, begchunk, endchunk - use phys_control, only: phys_getopts - use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman - - use spmd_utils, only: masterproc - use constituents, only: pcnst, cnst_add - use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev - use zm_conv_intr, only: zmconv_microp -#ifdef CLUBB_SGS - use clubb_api_module, only: pdf_parameter, implicit_coefs_terms - use clubb_api_module, only: clubb_config_flags_type - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag - use cloud_fraction, only: dp1, dp2 -#endif - - implicit none - private - save - - ! ----------------- ! - ! Public interfaces ! - ! ----------------- ! - - public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, & -#ifdef CLUBB_SGS - ! This utilizes CLUBB specific variables in its interface - stats_init_clubb, & - init_clubb_config_flags, & -#endif - stats_end_timestep_clubb, & - clubb_readnl, & - clubb_init_cnst, & - clubb_implements_cnst - -#ifdef CLUBB_SGS - ! Both of these utilize CLUBB specific variables in their interface - private :: stats_zero, stats_avg -#endif - - logical, public :: do_cldcool - logical :: clubb_do_icesuper - -#ifdef CLUBB_SGS - type(clubb_config_flags_type), public :: clubb_config_flags -#endif - - ! ------------ ! - ! Private data ! - ! ------------ ! - - integer, parameter :: & - grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels - hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements - - real(r8), parameter, dimension(0) :: & - sclr_tol = 1.e-8_r8 ! Total water in kg/kg - - character(len=6) :: saturation_equation - - real(r8), parameter :: & - theta0 = 300._r8, & ! Reference temperature [K] - ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] - p0_clubb = 100000._r8 - - integer, parameter :: & - sclr_dim = 0 ! Higher-order scalars, set to zero - - real(r8), parameter :: & - wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected - - real(r8), parameter :: & - wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected - - real(r8), parameter :: & - wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected - - real(r8), parameter :: & - rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected - - real(r8), parameter :: unset_r8 = huge(1.0_r8) - - ! Commonly used temperature for the melting temp of ice crystals [K] - real(r8), parameter :: meltpt_temp = 268.15_r8 - - real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist - real(r8) :: clubb_rnevap_effic = unset_r8 - - real(r8) :: clubb_c1 = unset_r8 - real(r8) :: clubb_c1b = unset_r8 - real(r8) :: clubb_C2rt = unset_r8 - real(r8) :: clubb_C2thl = unset_r8 - real(r8) :: clubb_C2rtthl = unset_r8 - real(r8) :: clubb_C4 = unset_r8 - real(r8) :: clubb_C6rt = unset_r8 - real(r8) :: clubb_c6rtb = unset_r8 - real(r8) :: clubb_c6rtc = unset_r8 - real(r8) :: clubb_c6thl = unset_r8 - real(r8) :: clubb_c6thlb = unset_r8 - real(r8) :: clubb_c6thlc = unset_r8 - real(r8) :: clubb_C8 = unset_r8 - real(r8) :: clubb_C8b = unset_r8 - real(r8) :: clubb_C7 = unset_r8 - real(r8) :: clubb_C7b = unset_r8 - real(r8) :: clubb_c11 = unset_r8 - real(r8) :: clubb_c11b = unset_r8 - real(r8) :: clubb_c14 = unset_r8 - real(r8) :: clubb_c_K9 = unset_r8 - real(r8) :: clubb_nu9 = unset_r8 - real(r8) :: clubb_c_K10 = unset_r8 - real(r8) :: clubb_c_K10h = unset_r8 - real(r8) :: clubb_gamma_coef = unset_r8 - real(r8) :: clubb_gamma_coefb = unset_r8 - real(r8) :: clubb_beta = unset_r8 - real(r8) :: clubb_lambda0_stability_coef = unset_r8 - real(r8) :: clubb_lmin_coef = unset_r8 - real(r8) :: clubb_mult_coef = unset_r8 - real(r8) :: clubb_Skw_denom_coef = unset_r8 - real(r8) :: clubb_skw_max_mag = unset_r8 - real(r8) :: clubb_up2_vp2_factor = unset_r8 - real(r8) :: clubb_C_wp2_splat = unset_r8 - real(r8) :: clubb_wpxp_L_thresh = unset_r8 - real(r8) :: clubb_detliq_rad = unset_r8 - real(r8) :: clubb_detice_rad = unset_r8 - real(r8) :: clubb_detphase_lowtemp = unset_r8 - logical :: clubb_l_brunt_vaisala_freq_moist = .false. - logical :: clubb_l_call_pdf_closure_twice = .false. - logical :: clubb_l_damp_wp3_Skw_squared = .false. - logical :: clubb_l_min_wp2_from_corr_wx = .false. - logical :: clubb_l_min_xp2_from_corr_wx = .false. - logical :: clubb_l_predict_upwp_vpwp = .false. - logical :: clubb_l_rcm_supersat_adj = .false. - logical :: clubb_l_stability_correct_tau_zm = .false. - logical :: clubb_l_trapezoidal_rule_zt = .false. - logical :: clubb_l_trapezoidal_rule_zm = .false. - logical :: clubb_l_upwind_xpyp_ta = .false. - logical :: clubb_l_use_C7_Richardson = .false. - logical :: clubb_l_use_C11_Richardson = .false. - logical :: clubb_l_use_cloud_cover = .false. - logical :: clubb_l_use_thvm_in_bv_freq = .false. - logical :: clubb_l_vert_avg_closure = .false. - logical :: clubb_l_diag_Lscale_from_tau = .false. - logical :: clubb_l_damp_wp2_using_em = .false. - -! Constant parameters - logical, parameter, private :: & - l_implemented = .true., & ! Implemented in a host model (always true) - l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes - - logical, parameter, private :: & - apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) - - logical :: lq(pcnst) - logical :: prog_modal_aero - logical :: do_rainturb - logical :: do_expldiff - logical :: clubb_do_adv - logical :: clubb_do_liqsupersat = .false. - logical :: clubb_do_energyfix = .true. - logical :: history_budget - - logical :: clubb_l_lscale_plume_centered - logical :: clubb_l_use_ice_latent - - integer :: history_budget_histfile_num - integer :: edsclr_dim ! Number of scalars to transport in CLUBB - integer :: offset - -! define physics buffer indicies here - integer :: & - wp2_idx, & ! vertical velocity variances - wp3_idx, & ! third moment of vertical velocity - wpthlp_idx, & ! turbulent flux of thetal - wprtp_idx, & ! turbulent flux of total water - rtpthlp_idx, & ! covariance of thetal and rt - rtp2_idx, & ! variance of total water - thlp2_idx, & ! variance of thetal - rtp3_idx, & ! total water 3rd order - thlp3_idx, & ! thetal 3rd order - up2_idx, & ! variance of east-west wind - vp2_idx, & ! variance of north-south wind - up3_idx, & ! east-west wind 3rd order - vp3_idx, & ! north-south wind 3rd order - upwp_idx, & ! east-west momentum flux - vpwp_idx, & ! north-south momentum flux - thlm_idx, & ! mean thetal - rtm_idx, & ! mean total water mixing ratio - um_idx, & ! mean of east-west wind - vm_idx, & ! mean of north-south wind - wpthvp_idx, & ! buoyancy flux - wp2thvp_idx, & ! second order buoyancy term - rtpthvp_idx, & ! moisture buoyancy correlation - thlpthvp_idx, & ! temperature buoyancy correlation - sclrpthvp_idx, & ! passive scalar buoyancy correlation - cloud_frac_idx, & ! CLUBB's cloud fraction - cld_idx, & ! Cloud fraction - concld_idx, & ! Convective cloud fraction - ast_idx, & ! Stratiform cloud fraction - alst_idx, & ! Liquid stratiform cloud fraction - aist_idx, & ! Ice stratiform cloud fraction - qlst_idx, & ! Physical in-cloud LWC - qist_idx, & ! Physical in-cloud IWC - dp_frac_idx, & ! deep convection cloud fraction - sh_frac_idx, & ! shallow convection cloud fraction - kvh_idx, & ! CLUBB eddy diffusivity on thermo levels - pblh_idx, & ! PBL pbuf - icwmrdp_idx, & ! In cloud mixing ratio for deep convection - tke_idx, & ! turbulent kinetic energy - tpert_idx, & ! temperature perturbation from PBL - fice_idx, & ! fice_idx index in physics buffer - cmeliq_idx, & ! cmeliq_idx index in physics buffer - relvar_idx, & ! relative cloud water variance - accre_enhan_idx, & ! optional accretion enhancement factor for MG - npccn_idx, & ! liquid ccn number concentration - naai_idx, & ! ice number concentration - prer_evap_idx, & ! rain evaporation rate - qrl_idx, & ! longwave cooling rate - radf_idx, & - qsatfac_idx, & ! subgrid cloud water saturation scaling factor - ice_supersat_idx, & ! ice cloud fraction for SILHS - rcm_idx, & ! Cloud water mixing ratio for SILHS - ztodt_idx ! physics timestep for SILHS - - ! Indices for microphysical covariance tendencies - integer :: & - rtp2_mc_zt_idx, & - thlp2_mc_zt_idx, & - wprtp_mc_zt_idx, & - wpthlp_mc_zt_idx, & - rtpthlp_mc_zt_idx - - integer, public :: & - ixthlp2 = 0, & - ixwpthlp = 0, & - ixwprtp = 0, & - ixwp2 = 0, & - ixwp3 = 0, & - ixrtpthlp = 0, & - ixrtp2 = 0, & - ixup2 = 0, & - ixvp2 = 0 - - integer :: cmfmc_sh_idx = 0 - - integer :: & - dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. - difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. - dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. - dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. - - ! Output arrays for CLUBB statistics - real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc - - character(len=16) :: eddy_scheme ! Default set in phys_control.F90 - character(len=16) :: deep_scheme ! Default set in phys_control.F90 - character(len=16) :: subcol_scheme - - integer, parameter :: ncnst=9 - character(len=8) :: cnst_names(ncnst) - logical :: do_cnst=.false. - -#ifdef CLUBB_SGS - type(pdf_parameter), target, allocatable, public, protected :: & - pdf_params_chnk(:,:) ! PDF parameters (thermo. levs.) [units vary] - type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:,:) ! PDF parameters on momentum levs. [units vary] - type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:,:) ! PDF impl. coefs. & expl. terms [units vary] -#endif - - contains - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_register_cam( ) -!------------------------------------------------------------------------------- -! Description: -! Register the constituents and fields in the physics buffer -! Author: P. Bogenschutz, C. Craig, A. Gettelman -! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns -! -!------------------------------------------------------------------------------- -#ifdef CLUBB_SGS - - !------------------------------------------------ ! - ! Register physics buffer fields and constituents ! - !------------------------------------------------ ! - - ! Add CLUBB fields to pbuf - use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls - use subcol_utils, only: subcol_get_scheme - - call phys_getopts( eddy_scheme_out = eddy_scheme, & - deep_scheme_out = deep_scheme, & - history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num ) - subcol_scheme = subcol_get_scheme() - - if (trim(subcol_scheme) == 'SILHS') then - saturation_equation = "flatau" - else - saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP - end if - - if (clubb_do_adv) then - cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) - do_cnst=.true. - ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments - ! need a constant added to them before they are advected, thus this would corrupt the output. - ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments - call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) - call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) - call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) - end if - - ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top - call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) - call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) - call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) - call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) - call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) - call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) - call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) - call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) - call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) - call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) - call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) - call pbuf_add_field('FICE', 'physpkg',dtype_r8, (/pcols,pver/), fice_idx) - call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) - call pbuf_add_field('CMELIQ', 'physpkg',dtype_r8, (/pcols,pver/), cmeliq_idx) - call pbuf_add_field('QSATFAC', 'physpkg',dtype_r8, (/pcols,pver/), qsatfac_idx) - - - call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) - call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) - call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) - call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) - call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) - call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) - call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) - call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) - call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) - - call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) - call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) - call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) - call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) - - call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) - call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) - call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) - call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) - call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) - call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) - - call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) - call pbuf_add_field('WP2THVP', 'physpkg', dtype_r8, (/pcols,pverp/), wp2thvp_idx) - call pbuf_add_field('RTPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), rtpthvp_idx) - call pbuf_add_field('THLPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), thlpthvp_idx) - call pbuf_add_field('CLOUD_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), cloud_frac_idx) - call pbuf_add_field('ISS_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), ice_supersat_idx) - call pbuf_add_field('RCM', 'physpkg', dtype_r8, (/pcols,pverp/), rcm_idx) - call pbuf_add_field('ZTODT', 'physpkg', dtype_r8, (/pcols/), ztodt_idx) - - ! For SILHS microphysical covariance contributions - call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) - call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) - call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) - call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) - call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - -#endif - - end subroutine clubb_register_cam - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -function clubb_implements_cnst(name) - - !----------------------------------------------------------------------------- ! - ! ! - ! Return true if specified constituent is implemented by this package ! - ! ! - !----------------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - logical :: clubb_implements_cnst ! return value - - !----------------------------------------------------------------------- - - clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) - -end function clubb_implements_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) -#ifdef CLUBB_SGS - use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol -#endif - - !----------------------------------------------------------------------- ! - ! ! - ! Initialize the state if clubb_do_adv ! - ! ! - !----------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) - real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) - logical, intent(in) :: mask(:) ! Only initialize where .true. - real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev - - !----------------------------------------------------------------------- - integer :: k, nlev - -#ifdef CLUBB_SGS - if (clubb_do_adv) then - nlev = size(q, 2) - do k = 1, nlev - if (trim(name) == trim(cnst_names(1))) then - where(mask) - q(:,k) = thl_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(2))) then - where(mask) - q(:,k) = rt_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(3))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(4))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(5))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(6))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(7))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(8))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(9))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - end do - end if -#endif - -end subroutine clubb_init_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_readnl(nlfile) - -#ifdef CLUBB_SGS - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use cam_abortutils, only: endrun - use clubb_api_module, only: l_stats, l_output_rad_files - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8 - use clubb_mf, only: clubb_mf_readnl -#endif - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - -#ifdef CLUBB_SGS - - character(len=*), parameter :: sub = 'clubb_readnl' - - logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & - clubb_expldiff ! Stats enabled (T/F) - - integer :: iunit, read_status, ierr - - namelist /clubb_his_nl/ clubb_history, clubb_rad_history - namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, clubb_expldiff, & - clubb_do_adv, clubb_timestep, & - clubb_rnevap_effic,clubb_do_icesuper - namelist /clubb_params_nl/ clubb_c1, clubb_c1b, clubb_c11, clubb_c11b, clubb_c14, clubb_mult_coef, clubb_gamma_coef, & - clubb_c_K10, clubb_c_K10h, clubb_beta, clubb_C2rt, clubb_C2thl, & - clubb_C2rtthl, clubb_C8, clubb_C8b, clubb_C7, clubb_C7b, clubb_Skw_denom_coef, & - clubb_c6rt, clubb_c6rtb, clubb_c6rtc, clubb_c6thl, clubb_c6thlb, clubb_c6thlc, & - clubb_C4, clubb_c_K9, clubb_nu9, clubb_C_wp2_splat, clubb_wpxp_L_thresh, & - clubb_lambda0_stability_coef, clubb_l_lscale_plume_centered, & - clubb_l_use_ice_latent, clubb_do_liqsupersat, clubb_do_energyfix,& - clubb_lmin_coef,clubb_skw_max_mag, clubb_l_stability_correct_tau_zm, & - clubb_gamma_coefb, clubb_up2_vp2_factor, clubb_detliq_rad, clubb_detice_rad, & - clubb_detphase_lowtemp, & - clubb_l_use_C7_Richardson, clubb_l_use_C11_Richardson, & - clubb_l_brunt_vaisala_freq_moist, clubb_l_use_thvm_in_bv_freq, & - clubb_l_rcm_supersat_adj, clubb_l_damp_wp3_Skw_squared, & - clubb_l_predict_upwp_vpwp, clubb_l_min_wp2_from_corr_wx, & - clubb_l_min_xp2_from_corr_wx, clubb_l_upwind_xpyp_ta, clubb_l_vert_avg_closure, & - clubb_l_trapezoidal_rule_zt, clubb_l_trapezoidal_rule_zm, & - clubb_l_call_pdf_closure_twice, clubb_l_use_cloud_cover, & - clubb_l_diag_Lscale_from_tau, clubb_l_damp_wp2_using_em - - !----- Begin Code ----- - - ! Determine if we want clubb_history to be output - clubb_history = .false. ! Initialize to false - l_stats = .false. ! Initialize to false - l_output_rad_files = .false. ! Initialize to false - do_cldcool = .false. ! Initialize to false - do_rainturb = .false. ! Initialize to false - do_expldiff = .false. ! Initialize to false - - clubb_l_lscale_plume_centered = .false. ! Initialize to false! - clubb_l_use_ice_latent = .false. ! Initialize to false! - - ! Call CLUBB+MF namelist - call clubb_mf_readnl(nlfile) - - ! Read namelist to determine if CLUBB history should be called - if (masterproc) then - iunit = getunit() - open( iunit, file=trim(nlfile), status='old' ) - - call find_group_name(iunit, 'clubb_his_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_his_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - call find_group_name(iunit, 'clubb_params_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_params_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - else - call endrun('clubb_readnl: error reading namelist') - end if - - call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") - call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") - call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") - call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") - call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") - call mpi_bcast(clubb_expldiff, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_expldiff") - call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") - call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") - call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") - - call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") - call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") - call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") - call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") - call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") - call mpi_bcast(clubb_c6rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rt") - call mpi_bcast(clubb_c6rtb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtb") - call mpi_bcast(clubb_c6rtc, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtc") - call mpi_bcast(clubb_c6thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thl") - call mpi_bcast(clubb_c6thlb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlb") - call mpi_bcast(clubb_c6thlc, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlc") - call mpi_bcast(clubb_wpxp_L_thresh, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_wpxp_L_thresh") - call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") - call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") - call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") - call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") - call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") - call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") - call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") - call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") - call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") - call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") - call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") - call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") - call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") - call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") - call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") - call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") - call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") - call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") - call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") - call mpi_bcast(clubb_l_use_ice_latent, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_ice_latent") - call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") - call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") - - call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") - call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") - call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") - call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") - call mpi_bcast(clubb_up2_vp2_factor, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_vp2_factor") - call mpi_bcast(clubb_detliq_rad, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detliq_rad") - call mpi_bcast(clubb_detice_rad, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detice_rad") - call mpi_bcast(clubb_detphase_lowtemp, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detphase_lowtemp") - - call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") - call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") - call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") - call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") - call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") - call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") - call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") - call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") - call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") - call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") - call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") - call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") - call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") - call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") - call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") - call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") - call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") - - ! Overwrite defaults if they are true - if (clubb_history) l_stats = .true. - if (clubb_rad_history) l_output_rad_files = .true. - if (clubb_cloudtop_cooling) do_cldcool = .true. - if (clubb_rainevap_turb) do_rainturb = .true. - if (clubb_expldiff) do_expldiff = .true. - -! Check that all namelists have been set - if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") - if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") - - if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") - if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") - if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") - if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") - if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") - if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") - if(clubb_c6rt == unset_r8) call endrun(sub//": FATAL: clubb_c6rt is not set") - if(clubb_c6rtb == unset_r8) call endrun(sub//": FATAL: clubb_c6rtb is not set") - if(clubb_c6rtc == unset_r8) call endrun(sub//": FATAL: clubb_c6rtc is not set") - if(clubb_c6thl == unset_r8) call endrun(sub//": FATAL: clubb_c6thl is not set") - if(clubb_c6thlb == unset_r8) call endrun(sub//": FATAL: clubb_c6thlb is not set") - if(clubb_c6thlc == unset_r8) call endrun(sub//": FATAL: clubb_c6thlc is not set") - if(clubb_wpxp_L_thresh == unset_r8) call endrun(sub//": FATAL: clubb_wpxp_L_thresh is not set") - if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") - if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") - if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") - if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") - if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") - if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") - if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") - if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") - if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") - if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") - if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") - if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") - if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") - if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") - if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") - if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") - if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") - if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") - if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") - if(clubb_up2_vp2_factor == unset_r8) call endrun(sub//": FATAL: clubb_up2_vp2_factor is not set") - if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") - if(clubb_detliq_rad == unset_r8) call endrun(sub//": FATAL: clubb_detliq_rad not set") - if(clubb_detice_rad == unset_r8) call endrun(sub//": FATAL: clubb_detice_rad not set") - if(clubb_detphase_lowtemp == unset_r8) call endrun(sub//": FATAL: clubb_detphase_lowtemp not set") - if(clubb_detphase_lowtemp >= meltpt_temp) & - call endrun(sub//": ERROR: clubb_detphase_lowtemp must be less than 268.15 K") - -#endif - end subroutine clubb_readnl - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_ini_cam(pbuf2d) -!------------------------------------------------------------------------------- -! Description: -! Initialize UWM CLUBB. -! Author: Cheryl Craig March 2011 -! Modifications: Pete Bogenschutz 2011 March and onward -! Modifications: K Thayer-Calder 2013 July and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - - -#ifdef CLUBB_SGS - - ! From CAM libraries - use cam_history, only: addfld, add_default, horiz_only - use ref_pres, only: pref_mid - use hb_diff, only: init_hb_diff - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx - use cam_abortutils, only: endrun - - ! These are needed to set parameters - use clubb_api_module, only: & - ilambda0_stability_coef, ic_K10, ic_K10h, iC7, iC7b, iC8, iC8b, iC11, iC11b, iC4, & - iC1, iC1b, iC6rt, iC6rtb, iC6rtc, iC6thl, iC6thlb, iC6thlc, iup2_vp2_factor, iwpxp_L_thresh, & - iC14, igamma_coef, igamma_coefb, imult_coef, ilmin_coef, iSkw_denom_coef, ibeta, iskw_max_mag, & - iC2rt, iC2thl, iC2rtthl, ic_K9, inu9, iC_wp2_splat, params_list - - use clubb_api_module, only: & - print_clubb_config_flags_api, & - setup_clubb_core_api, & - init_pdf_params_api, & - init_pdf_implicit_coefs_terms_api, & - time_precision, & - core_rknd, & - set_clubb_debug_level_api, & - clubb_fatal_error, & ! Error code value to indicate a fatal error - nparams, & - read_parameters_api, & - l_stats, & - l_stats_samp, & - l_grads, & - stats_zt, & - stats_zm, & - stats_sfc, & - stats_rad_zt, & - stats_rad_zm, & - w_tol_sqd, & - rt_tol, & - thl_tol - - ! These are only needed if we're using a passive scalar - use clubb_api_module, only: & - iisclr_rt, & - iisclr_thl, & - iisclr_CO2, & - iiedsclr_rt, & - iiedsclr_thl, & - iiedsclr_CO2 - - use time_manager, only: is_first_step - use clubb_api_module, only: hydromet_dim - use constituents, only: cnst_get_ind - use phys_control, only: phys_getopts - use spmd_utils, only: iam - use cam_logfile, only: iulog -#endif - - use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc - implicit none - ! Input Variables - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - -#ifdef CLUBB_SGS - - real(kind=time_precision) :: dum1, dum2, dum3 - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - - ! The similar name to clubb_history is unfortunate... - logical :: history_amwg, history_clubb - - integer :: err_code ! Code for when CLUBB fails - integer :: j, k, l ! Indices - integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) - integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) - integer :: nmodes, nspec, m - integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice - integer :: lptr - - logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. - logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. - - real(r8) :: zt_g(pverp+1-top_lev) ! Height dummy array - real(r8) :: zi_g(pverp+1-top_lev) ! Height dummy array - - ! CAM defines zi at the surface to be zero. - real(r8), parameter :: sfc_elevation = 0._r8 - - integer :: nlev - - !----- Begin Code ----- - - nlev = pver + 1 - top_lev - - if (core_rknd /= r8) then - call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') - end if - - ! Allocate PDF parameters across columns and chunks - allocate( & - pdf_params_chnk(pcols,begchunk:endchunk), & - pdf_params_zm_chnk(pcols,begchunk:endchunk), & - pdf_implicit_coefs_terms_chnk(pcols,begchunk:endchunk) ) - - ! Allocate (in the vertical) and zero PDF parameters - do l = begchunk, endchunk, 1 - do j = 1, pcols, 1 - call init_pdf_params_api( pverp+1-top_lev, pdf_params_chnk(j,l) ) - call init_pdf_params_api( pverp+1-top_lev, pdf_params_zm_chnk(j,l) ) - call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, sclr_dim, & - pdf_implicit_coefs_terms_chnk(j,l) ) - enddo ! j = 1, pcols, 1 - enddo ! l = begchunk, endchunk, 1 - - ! ----------------------------------------------------------------- ! - ! Determine how many constituents CLUBB will transport. Note that - ! CLUBB does not transport aerosol consituents. Therefore, need to - ! determine how many aerosols constituents there are and subtract that - ! off of pcnst (the total consituents) - ! ----------------------------------------------------------------- ! - - call phys_getopts(prog_modal_aero_out=prog_modal_aero, & - history_amwg_out=history_amwg, & - history_clubb_out=history_clubb) - - ! Select variables to apply tendencies back to CAM - - ! Initialize all consituents to true to start - lq(1:pcnst) = .true. - edsclr_dim = pcnst - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('NUMICE',ixnumice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - - if (prog_modal_aero) then - ! Turn off modal aerosols and decrement edsclr_dim accordingly - call rad_cnst_get_info(0, nmodes=nmodes) - - do m = 1, nmodes - call rad_cnst_get_mode_num_idx(m, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - - call rad_cnst_get_info(0, m, nspec=nspec) - do l = 1, nspec - call rad_cnst_get_mam_mmr_idx(m, l, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - end do - end do - - ! In addition, if running with MAM, droplet number is transported - ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport - ! tendencies to avoid double counted. Else, we apply tendencies. - lq(ixnumliq) = .false. - edsclr_dim = edsclr_dim-1 - endif - - ! ----------------------------------------------------------------- ! - ! Set the debug level. Level 2 has additional computational expense since - ! it checks the array variables in CLUBB for invalid values. - ! ----------------------------------------------------------------- ! - call set_clubb_debug_level_api( 0 ) - - ! ----------------------------------------------------------------- ! - ! use pbuf_get_fld_idx to get existing physics buffer fields from other - ! physics packages (e.g. tke) - ! ----------------------------------------------------------------- ! - - - ! Defaults - l_stats_samp = .false. - l_grads = .false. - - ! Overwrite defaults if needbe - if (l_stats) l_stats_samp = .true. - - ! Define physics buffers indexes - cld_idx = pbuf_get_index('CLD') ! Cloud fraction - concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover - ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction - alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction - aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction - qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC - qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC - dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction - icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio - sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction - relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance - accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG - prer_evap_idx = pbuf_get_index('PRER_EVAP') - qrl_idx = pbuf_get_index('QRL') - cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') - naai_idx = pbuf_get_index('NAAI') - npccn_idx = pbuf_get_index('NPCCN') - - - iisclr_rt = -1 - iisclr_thl = -1 - iisclr_CO2 = -1 - - iiedsclr_rt = -1 - iiedsclr_thl = -1 - iiedsclr_CO2 = -1 - - if (zmconv_microp) then - dlfzm_idx = pbuf_get_index('DLFZM') - difzm_idx = pbuf_get_index('DIFZM') - dnlfzm_idx = pbuf_get_index('DNLFZM') - dnifzm_idx = pbuf_get_index('DNIFZM') - end if - - ! ----------------------------------------------------------------- ! - ! Define number of tracers for CLUBB to diffuse - ! ----------------------------------------------------------------- ! - - if (do_expldiff) then - offset = 2 ! diffuse temperature and moisture explicitly - edsclr_dim = edsclr_dim + offset - endif - - ! ----------------------------------------------------------------- ! - ! Setup CLUBB core - ! ----------------------------------------------------------------- ! - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Fill in dummy arrays for height. Note that these are overwrote - ! at every CLUBB step to physical values. - do k=1,nlev+1 - zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage - zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage - enddo - - clubb_params(iC2rtthl) = clubb_C2rtthl - clubb_params(iC8) = clubb_C8 - clubb_params(iC11) = clubb_c11 - clubb_params(iC11b) = clubb_c11b - clubb_params(iC14) = clubb_c14 - clubb_params(ic_K10) = clubb_c_K10 - clubb_params(imult_coef) = clubb_mult_coef - clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef - clubb_params(iC2rt) = clubb_C2rt - clubb_params(iC2thl) = clubb_C2thl - clubb_params(ibeta) = clubb_beta - clubb_params(iC6rt) = clubb_c6rt - clubb_params(iC6rtb) = clubb_c6rtb - clubb_params(iC6rtc) = clubb_c6rtc - clubb_params(iC6thl) = clubb_c6thl - clubb_params(iC6thlb) = clubb_c6thlb - clubb_params(iC6thlc) = clubb_c6thlc - clubb_params(iwpxp_L_thresh) = clubb_wpxp_L_thresh - clubb_params(iC7) = clubb_C7 - clubb_params(iC7b) = clubb_C7b - clubb_params(igamma_coef) = clubb_gamma_coef - clubb_params(ic_K10h) = clubb_c_K10h - clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef - clubb_params(ilmin_coef) = clubb_lmin_coef - clubb_params(iC8b) = clubb_C8b - clubb_params(iskw_max_mag) = clubb_skw_max_mag - clubb_params(iC1) = clubb_C1 - clubb_params(iC1b) = clubb_C1b - clubb_params(igamma_coefb) = clubb_gamma_coefb - clubb_params(iup2_vp2_factor) = clubb_up2_vp2_factor - clubb_params(iC4) = clubb_C4 - clubb_params(ic_K9) = clubb_c_K9 - clubb_params(inu9) = clubb_nu9 - clubb_params(iC_wp2_splat) = clubb_C_wp2_splat - - call init_clubb_config_flags( clubb_config_flags ) ! In/Out - clubb_config_flags%l_use_C7_Richardson = clubb_l_use_C7_Richardson - clubb_config_flags%l_use_C11_Richardson = clubb_l_use_C11_Richardson - clubb_config_flags%l_brunt_vaisala_freq_moist = clubb_l_brunt_vaisala_freq_moist - clubb_config_flags%l_use_thvm_in_bv_freq = clubb_l_use_thvm_in_bv_freq - clubb_config_flags%l_rcm_supersat_adj = clubb_l_rcm_supersat_adj - clubb_config_flags%l_damp_wp3_Skw_squared = clubb_l_damp_wp3_Skw_squared - clubb_config_flags%l_predict_upwp_vpwp = clubb_l_predict_upwp_vpwp - clubb_config_flags%l_min_wp2_from_corr_wx = clubb_l_min_wp2_from_corr_wx - clubb_config_flags%l_min_xp2_from_corr_wx = clubb_l_min_xp2_from_corr_wx - clubb_config_flags%l_upwind_xpyp_ta = clubb_l_upwind_xpyp_ta - clubb_config_flags%l_vert_avg_closure = clubb_l_vert_avg_closure - clubb_config_flags%l_trapezoidal_rule_zt = clubb_l_trapezoidal_rule_zt - clubb_config_flags%l_trapezoidal_rule_zm = clubb_l_trapezoidal_rule_zm - clubb_config_flags%l_call_pdf_closure_twice = clubb_l_call_pdf_closure_twice - clubb_config_flags%l_use_cloud_cover = clubb_l_use_cloud_cover - clubb_config_flags%l_stability_correct_tau_zm = clubb_l_stability_correct_tau_zm - clubb_config_flags%l_do_expldiff_rtm_thlm = do_expldiff - clubb_config_flags%l_Lscale_plume_centered = clubb_l_lscale_plume_centered - clubb_config_flags%l_use_ice_latent = clubb_l_use_ice_latent - clubb_config_flags%l_diag_Lscale_from_tau = clubb_l_diag_Lscale_from_tau - clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em - clubb_config_flags%l_update_pressure = l_update_pressure - - - ! Set up CLUBB core. Note that some of these inputs are overwritten - ! when clubb_tend_cam is called. The reason is that heights can change - ! at each time step, which is why dummy arrays are read in here for heights - ! as they are immediately overwrote. -!$OMP PARALLEL - call setup_clubb_core_api & - ( nlev+1, theta0, ts_nudge, & ! In - hydromet_dim, sclr_dim, & ! In - sclr_tol, edsclr_dim, clubb_params, & ! In - l_host_applies_sfc_fluxes, & ! In - saturation_equation, & ! In - l_input_fields, & - l_implemented, grid_type, zi_g(2), zi_g(1), zi_g(nlev+1),& ! In - zi_g(1:nlev+1), zt_g(1:nlev+1), sfc_elevation, & ! In - clubb_config_flags%l_predict_upwp_vpwp, & ! In - clubb_config_flags%l_use_ice_latent, & ! In - clubb_config_flags%l_prescribed_avg_deltaz, & ! In - clubb_config_flags%l_damp_wp2_using_em, & ! In - clubb_config_flags%l_stability_correct_tau_zm, & ! In - err_code ) - - if ( err_code == clubb_fatal_error ) then - call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') - end if -!$OMP END PARALLEL - - ! Print the list of CLUBB parameters - if ( masterproc ) then - do j = 1, nparams, 1 - write(iulog,*) params_list(j), " = ", clubb_params(j) - enddo - endif - - ! Print configurable CLUBB flags - if ( masterproc ) then - call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) - end if - - ! ----------------------------------------------------------------- ! - ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! - ! ----------------------------------------------------------------- ! - - ! Initialize eddy diffusivity module - - ntop_eddy = 1 ! if >1, must be <= nbot_molec - nbot_eddy = pver ! currently always pver - - call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) - - ! ----------------------------------------------------------------- ! - ! Add output fields for the history files - ! ----------------------------------------------------------------- ! - - ! These are default CLUBB output. Not the higher order history budgets - call addfld ('RHO_CLUBB', (/ 'ilev' /), 'A', 'kg/m3', 'Air Density') - call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') - call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') - call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') - call addfld ('WP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') - call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') - call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') - call addfld ('WP3_CLUBB', (/ 'ilev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') - call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') - call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') - call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'g^2/kg^2', 'Moisture Variance') - call addfld ('RTP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') - call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') - call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') - call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') - call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') - call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') - call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') - call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') - call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'lev' /), 'A', 'W/m2', 'Buoyancy Flux') - call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') - call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') - call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') - call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Ice Tendency') - call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') - call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') - call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') - call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') - call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') - call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') - call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') - call addfld ('THETAL', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') - call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') - call addfld ('QT', (/ 'lev' /), 'A', 'kg/kg', 'Total water mixing ratio') - call addfld ('SL', (/ 'lev' /), 'A', 'J/kg', 'Liquid water static energy') - call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') - call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') - call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') - call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') - call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - - - call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') - - call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') - call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') - call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') - call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') - call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') - - - call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') - call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') - call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') - call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') - - call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') - call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') - - ! ---------------------------------------------------------------------------- ! - ! Below are for detailed analysis of EDMF Scheme ! - ! ---------------------------------------------------------------------------- ! - if (do_clubb_mf) then - call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) - call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) - call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) - call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) - call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) - call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) - call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) - call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) - end if - - ! Initialize statistics, below are dummy variables - dum1 = 300._r8 - dum2 = 1200._r8 - dum3 = 300._r8 - - if (l_stats) then - - call stats_init_clubb( .true., dum1, dum2, & - nlev+1, nlev+1, nlev+1, dum3 ) - - allocate(out_zt(pcols,pverp,stats_zt%num_output_fields)) - allocate(out_zm(pcols,pverp,stats_zm%num_output_fields)) - allocate(out_sfc(pcols,1,stats_sfc%num_output_fields)) - - allocate(out_radzt(pcols,pverp,stats_rad_zt%num_output_fields)) - allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) - - endif - - ! ----------------------------------------------------------------- ! - ! Make all of this output default, this is not CLUBB history - ! ----------------------------------------------------------------- ! - - if (clubb_do_adv .or. history_clubb) then - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UP2_CLUBB', 1, ' ') - call add_default('VP2_CLUBB', 1, ' ') - call add_default('WP2_CLUBB', 1, ' ') - call add_default('WP2_ZT_CLUBB', 1, ' ') - call add_default('WP3_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('WPTHLP_CLUBB', 1, ' ') - call add_default('WPRTP_CLUBB', 1, ' ') - call add_default('RTP2_CLUBB', 1, ' ') - call add_default('RTP2_ZT_CLUBB', 1, ' ') - call add_default('PDFP_RTP2_CLUBB', 1, ' ') - call add_default('THLP2_CLUBB', 1, ' ') - call add_default('THLP2_ZT_CLUBB', 1, ' ') - call add_default('RTPTHLP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('WM_ZT_CLUBB', 1, ' ') - call add_default('PBLH', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('THETAL', 1, ' ') - call add_default('CONCLD', 1, ' ') - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_clubb) then - - call add_default('RELVAR', 1, ' ') - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('CONCLD', 1, ' ') - - if (do_clubb_mf_diag) then - call add_default( 'edmf_DRY_A' , 1, ' ') - call add_default( 'edmf_MOIST_A' , 1, ' ') - call add_default( 'edmf_DRY_W' , 1, ' ') - call add_default( 'edmf_MOIST_W' , 1, ' ') - call add_default( 'edmf_DRY_QT' , 1, ' ') - call add_default( 'edmf_MOIST_QT' , 1, ' ') - call add_default( 'edmf_DRY_THL' , 1, ' ') - call add_default( 'edmf_MOIST_THL', 1, ' ') - call add_default( 'edmf_DRY_U' , 1, ' ') - call add_default( 'edmf_MOIST_U' , 1, ' ') - call add_default( 'edmf_DRY_V' , 1, ' ') - call add_default( 'edmf_MOIST_V' , 1, ' ') - call add_default( 'edmf_MOIST_QC' , 1, ' ') - call add_default( 'edmf_S_AE' , 1, ' ') - call add_default( 'edmf_S_AW' , 1, ' ') - call add_default( 'edmf_S_AWTHL' , 1, ' ') - call add_default( 'edmf_S_AWQT' , 1, ' ') - call add_default( 'edmf_S_AWU' , 1, ' ') - call add_default( 'edmf_S_AWV' , 1, ' ') - call add_default( 'edmf_thlflx' , 1, ' ') - call add_default( 'edmf_qtflx' , 1, ' ') - end if - - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_budget) then - call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') - call add_default('DPDLFICE', history_budget_histfile_num, ' ') - call add_default('DPDLFT', history_budget_histfile_num, ' ') - call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') - endif - - - ! --------------- ! - ! First step? ! - ! Initialization ! - ! --------------- ! - - ! Is this the first time step? If so then initialize CLUBB variables as follows - if (is_first_step()) then - - call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) - call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) - call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) - - call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) - - call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) - call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) - - ! Initialize SILHS covariance contributions - call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) - endif - - ! The following is physpkg, so it needs to be initialized every time - call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) - - ! --------------- ! - ! End ! - ! Initialization ! - ! --------------- ! - -#endif - end subroutine clubb_ini_cam - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_tend_cam( & - state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & - macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) - -!------------------------------------------------------------------------------- -! Description: Provide tendencies of shallow convection, turbulence, and -! macrophysics from CLUBB to CAM -! -! Author: Cheryl Craig, March 2011 -! Modifications: Pete Bogenschutz, March 2011 and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - use physics_types, only: physics_state, physics_ptend, & - physics_state_copy, physics_ptend_init, & - physics_ptend_sum, physics_update, set_dry_to_wet - - use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc - - use constituents, only: cnst_get_ind, cnst_type - use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use tropopause, only: tropopause_findChemTrop - use time_manager, only: get_nstep - -#ifdef CLUBB_SGS - use hb_diff, only: pblintd - use scamMOD, only: single_column,scm_clubb_iop_name - use clubb_api_module, only: & - nparams, & - read_parameters_api, & - setup_parameters_api, & - time_precision, & - advance_clubb_core_api, & - zt2zm_api, zm2zt_api, & - setup_grid_heights_api, & - em_min, & - w_tol_sqd, & - rt_tol, & - thl_tol, & - l_stats, & - stats_tsamp, & - stats_tout, & - stats_zt, & - stats_sfc, & - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - l_output_rad_files, & - stats_begin_timestep_api, & - hydromet_dim, calculate_thlp2_rad_api, mu, update_xp2_mc_api, & - sat_mixrat_liq_api, & - fstderr - - use clubb_api_module, only: & - clubb_fatal_error ! Error code value to indicate a fatal error - - use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const - use cam_history, only: outfld - - use macrop_driver, only: liquid_macro_tend - use clubb_mf, only: integrate_mf - -#endif - - implicit none - - ! --------------- ! - ! Input Auguments ! - ! --------------- ! - - type(physics_state), intent(in) :: state ! Physics state variables [vary] - type(cam_in_t), intent(in) :: cam_in - real(r8), intent(in) :: hdtime ! Host model timestep [s] - real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] - real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] - integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations - integer, intent(in) :: macmic_it ! number of mac-mic iterations - - ! ---------------------- ! - ! Input-Output Auguments ! - ! ---------------------- ! - - type(physics_buffer_desc), pointer :: pbuf(:) - - ! ---------------------- ! - ! Output Auguments ! - ! ---------------------- ! - - type(physics_ptend), intent(out) :: ptend_all ! package tendencies - - ! These two variables are needed for energy check - real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice - real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check - - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - -#ifdef CLUBB_SGS - - type(physics_state) :: state1 ! Local copy of state variable - type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all - - integer :: i, j, k, t, ixind, nadv - integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq - integer :: itim_old - integer :: ncol, lchnk ! # of columns, and chunk identifier - integer :: err_code ! Diagnostic, for if some calculation goes amiss. - integer :: icnt, clubbtop - logical :: lq2(pcnst) - - integer :: iter - - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] - real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] - real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] - real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] - real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] - real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] - real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] - real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] - real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] - real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] - real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] - real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] - real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] - real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] - real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] - real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] - real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] - real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] - real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] - real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] - real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] - real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] - real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] - real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap - real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap - real(r8) :: wprtp_mc_out(pverp+1-top_lev) - real(r8) :: wpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] - real(r8) :: rcm_out_zm(pverp+1-top_lev) - real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] - real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] - real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] - real(r8) :: thlprcp_out(pverp+1-top_lev) - real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] - real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] - real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] - real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] - real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] - real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] - real(r8) :: rfrzm(pverp+1-top_lev) - real(r8) :: radf(pverp+1-top_lev) - real(r8) :: wprtp_forcing(pverp+1-top_lev) - real(r8) :: wpthlp_forcing(pverp+1-top_lev) - real(r8) :: rtp2_forcing(pverp+1-top_lev) - real(r8) :: thlp2_forcing(pverp+1-top_lev) - real(r8) :: rtpthlp_forcing(pverp+1-top_lev) - real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) - real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] - real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: fcor ! Coriolis forcing [s^-1] - real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] - real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] - real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] - real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] - real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] - real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] - real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] - real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] - real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] - real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] - real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] - real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] - real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] - real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] - real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] - real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] - real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] - real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] - real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] - real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) - real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) - real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) - real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) - real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) - real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] - real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo ! roughness height [m] - real(r8) :: dz_g(pver) ! thickness of layer [m] - real(r8) :: relvarmax - real(r8) :: se_upper_a, se_upper_b, se_upper_diss - real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss - real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - real(r8) :: host_dx, host_dy ! CAM grid [m] - - ! Variables below are needed to compute energy integrals for conservation - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis, se_a(pcols), se_b(pcols), clubb_s(pver) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: qrl_clubb(pverp+1-top_lev) - real(r8) :: qrl_zm(pverp+1-top_lev) - real(r8) :: thlp2_rad_out(pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - real(r8) :: dl_rad, di_rad, dt_low - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend - - ! --------------- ! - ! Pointers ! - ! --------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface - - ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthl_output, s_awqt_output, & - s_awql_output, s_awqi_output, & - s_awu_output, s_awv_output, & - mf_thlflx_output, mf_qtflx_output - ! MF Plume - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - s_ae, s_aw, & - s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awu, s_awv, & - mf_thlflx, mf_qtflx - ! MF local vars - real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - - - integer :: nlev - - intrinsic :: max - - character(len=*), parameter :: subr='clubb_tend_cam' - -#endif - det_s(:) = 0.0_r8 - det_ice(:) = 0.0_r8 -#ifdef CLUBB_SGS - - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - ! MAIN COMPUTATION BEGINS HERE ! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - - nlev = pver + 1 - top_lev - - rtp2_zt_out = 0._r8 - thl2_zt_out = 0._r8 - wp2_zt_out = 0._r8 - pdfp_rtp2 = 0._r8 - wm_zt_out = 0._r8 - - dl_rad = clubb_detliq_rad - di_rad = clubb_detice_rad - dt_low = clubb_detphase_lowtemp - - frac_limit = 0.01_r8 - ic_limit = 1.e-12_r8 - - if (clubb_do_adv) then - apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected - else - apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected - endif - - ! Get indicees for cloud and ice mass and cloud and ice number - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('NUMICE',ixnumice) - - if (clubb_do_icesuper) then - call pbuf_get_field(pbuf, naai_idx, naai) - end if - - ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine - call physics_ptend_init(ptend_all, state%psetcols, 'clubb') - - ! Copy the state to state1 array to use in this routine - call physics_state_copy(state, state1) - - ! constituents are all treated as wet mmr by clubb - call set_dry_to_wet(state1) - - if (clubb_do_liqsupersat) then - call pbuf_get_field(pbuf, npccn_idx, npccn) - endif - - ! Determine number of columns and which chunk computation is to be performed on - - ncol = state%ncol - lchnk = state%lchnk - - ! Determine time step of physics buffer - itim_old = pbuf_old_tim_idx() - - ! Establish associations between pointers and physics buffer fields - - call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) - call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) - call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) - call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) - call pbuf_get_field(pbuf, rcm_idx, rcm) - call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) - call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then - apply_const = 0._r8 ! On first time through do not remove constant - ! from moments since it has not been added yet - endif - - ! Set the ztodt timestep in pbuf for SILHS - ztodtptr(:) = 1.0_r8*hdtime - - ! Define the grid box size. CLUBB needs this information to determine what - ! the maximum length scale should be. This depends on the column for - ! variable mesh grids and lat-lon grids - if (single_column) then - ! If single column specify grid box size to be something - ! similar to a GCM run - grid_dx(:) = 100000._r8 - grid_dy(:) = 100000._r8 - else - - call grid_size(state1, grid_dx, grid_dy) - - end if - - if (clubb_do_icesuper) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - lq2(:) = .FALSE. - lq2(1) = .TRUE. - lq2(ixcldice) = .TRUE. - lq2(ixnumice) = .TRUE. - - latsub = latvap + latice - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qitend(:ncol,:)=0._r8 - initend(:ncol,:)=0._r8 - - call ice_macro_tend(naai(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & - state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,1), & - state1%q(1:ncol,top_lev:pver,ixcldice), state1%q(1:ncol,top_lev:pver,ixnumice), & - latsub, hdtime, stend(1:ncol,top_lev:pver), qvtend(1:ncol,top_lev:pver), & - qitend(1:ncol,top_lev:pver), initend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - !Write output for tendencies: - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QITENDICE', qitend, pcols, lchnk ) - call outfld( 'NITENDICE', initend, pcols, lchnk ) - - endif - - - ! Determine CLUBB time step and make it sub-step friendly - ! For now we want CLUBB time step to be 5 min since that is - ! what has been scientifically validated. However, there are certain - ! instances when a 5 min time step will not be possible (based on - ! host model time step or on macro-micro sub-stepping - - dtime = clubb_timestep - - ! Now check to see if dtime is greater than the host model - ! (or sub stepped) time step. If it is, then simply - ! set it equal to the host (or sub step) time step. - ! This section is mostly to deal with small host model - ! time steps (or small sub-steps) - - if (dtime > hdtime) then - dtime = hdtime - endif - - ! Now check to see if CLUBB time step divides evenly into - ! the host model time step. If not, force it to divide evenly. - ! We also want it to be 5 minutes or less. This section is - ! mainly for host model time steps that are not evenly divisible - ! by 5 minutes - - if (mod(hdtime,dtime) .ne. 0) then - dtime = hdtime/2._r8 - do while (dtime > clubb_timestep) - dtime = dtime/2._r8 - end do - endif - - ! If resulting host model time step and CLUBB time step do not divide evenly - ! into each other, have model throw a fit. - - if (mod(hdtime,dtime) .ne. 0) then - call endrun(subr//': CLUBB time step and HOST time step NOT compatible') - endif - - ! determine number of timesteps CLUBB core should be advanced, - ! host time step divided by CLUBB time step - nadv = max(hdtime/dtime,1._r8) - - ! Initialize forcings for transported scalars to zero - - sclrm_forcing(:,:) = 0._r8 - edsclrm_forcing(:,:) = 0._r8 - sclrm(:,:) = 0._r8 - - ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant - ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent - ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables - ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state - - do k=1,pver - do i=1,ncol - inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) - enddo - enddo - - ! At each CLUBB call, initialize mean momentum and thermo CLUBB state - ! from the CAM state - - do k=1,pver ! loop over levels - do i=1,ncol ! loop over columns - - rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) - rvm(i,k) = state1%q(i,k,ixq) - um(i,k) = state1%u(i,k) - vm(i,k) = state1%v(i,k) - thlm(i,k) = ( state1%t(i,k) & - - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & - * inv_exner_clubb(i,k) - - if (clubb_do_adv) then - if (macmic_it == 1) then - - ! Note that some of the moments below can be positive or negative. - ! Remove a constant that was added to prevent dynamics from clipping - ! them to prevent dynamics from making them positive. - thlp2(i,k) = state1%q(i,k,ixthlp2) - rtp2(i,k) = state1%q(i,k,ixrtp2) - rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) - wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) - wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) - wp2(i,k) = state1%q(i,k,ixwp2) - wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) - up2(i,k) = state1%q(i,k,ixup2) - vp2(i,k) = state1%q(i,k,ixvp2) - endif - endif - - enddo - enddo - - if (clubb_do_adv) then - ! If not last step of macmic loop then set apply_const back to - ! zero to prevent output from being corrupted. - if (macmic_it == cld_macmic_num_steps) then - apply_const = 1._r8 - else - apply_const = 0._r8 - endif - endif - - rtm(1:ncol,pverp) = rtm(1:ncol,pver) - um(1:ncol,pverp) = state1%u(1:ncol,pver) - vm(1:ncol,pverp) = state1%v(1:ncol,pver) - thlm(1:ncol,pverp) = thlm(1:ncol,pver) - - if (clubb_do_adv) then - thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) - rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) - wp2(1:ncol,pverp)=wp2(1:ncol,pver) - wp3(1:ncol,pverp)=wp3(1:ncol,pver) - up2(1:ncol,pverp)=up2(1:ncol,pver) - vp2(1:ncol,pverp)=vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awql_output(:,:) = 0._r8 - s_awqi_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - - ! Loop over all columns in lchnk to advance CLUBB core - do i=1,ncol ! loop over columns - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1,nlev+1 - zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1,nlev - zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - - do k=1,pver - dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - enddo - - ! Thermodynamic ghost point is below surface - zt_g(1) = -1._r8*zt_g(2) - - ! Set the elevation of the surface - sfc_elevation = state1%zi(i,pver+1) - - ! Set the grid size - host_dx = grid_dx(i) - host_dy = grid_dy(i) - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile - exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) - invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo - thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) - radf(k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) - enddo - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - rho_ds_zt(1) = rho_ds_zt(2) - invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) - rho_in(1) = rho_ds_zt(2) - thv_ds_zt(1) = thv_ds_zt(2) - rho_zt(:) = rho_in(:) - p_in_Pa(1) = p_in_Pa(2) - exner(1) = exner(2) - rfrzm(1) = rfrzm(2) - radf(1) = radf(2) - qrl_clubb(1) = qrl_clubb(2) - - ! Compute mean w wind on thermo grid, convert from omega to w - wm_zt(1) = 0._r8 - do k=1,nlev - wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) - enddo - - ! ------------------------------------------------- ! - ! Begin case specific code for SCAM cases. ! - ! This section of code block NOT called in ! - ! global simulations ! - ! ------------------------------------------------- ! - - if (single_column) then - - ! Initialize zo if variable ustar is used - - if (cam_in%landfrac(i) >= 0.5_r8) then - zo = 0.035_r8 - else - zo = 0.0001_r8 - endif - - ! Compute surface wind (ubar) - ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - ! Below denotes case specifics for surface momentum - ! and thermodynamic fluxes, depending on the case - - ! Define ustar (based on case, if not variable) - ustar = 0.25_r8 ! Initialize ustar in case no case - - if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then - ustar = 0.30_r8 - endif - - if(trim(scm_clubb_iop_name) == 'RICO_3day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & - trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - bflx22 = (gravit/theta0)*wpthlp_sfc - ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) - endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation - upwp_sfc = -um(i,pver)*ustar**2/ubar - vpwp_sfc = -vm(i,pver)*ustar**2/ubar - - endif - - ! Define surface sources for transported variables for diffusion, will - ! be zero as these tendencies are done in vertical_diffusion - do ixind=1,edsclr_dim - wpedsclrp_sfc(ixind) = 0._r8 - enddo - - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & - zi_g(1), zi_g, zt_g) - - call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & - zi_g, zt_g, & - clubb_config_flags%l_prescribed_avg_deltaz, & - err_code ) - - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing = 0._r8 - rtm_forcing = 0._r8 - um_forcing = 0._r8 - vm_forcing = 0._r8 - - wprtp_forcing = 0._r8 - wpthlp_forcing = 0._r8 - rtp2_forcing = 0._r8 - thlp2_forcing = 0._r8 - rtpthlp_forcing = 0._r8 - - ice_supersat_frac_out = 0._r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) - thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) - wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) - wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) - rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(i,:) = 0.0_r8 - thlp2_mc_zt(i,:) = 0.0_r8 - wprtp_mc_zt(i,:) = 0.0_r8 - wpthlp_mc_zt(i,:) = 0.0_r8 - rtpthlp_mc_zt(i,:) = 0.0_r8 - - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api(rho_ds_zt) - rho_zm = zt2zm_api(rho_zt) - invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) - thv_ds_zm = zt2zm_api(thv_ds_zt) - wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model - wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux - wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) - upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - um_in(k) = um(i,pverp-k+1) - vm_in(k) = vm(i,pverp-k+1) - upwp_in(k) = upwp(i,pverp-k+1) - vpwp_in(k) = vpwp(i,pverp-k+1) - wpthvp_in(k) = wpthvp(i,pverp-k+1) - wp2thvp_in(k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(k)= thlpthvp(i,pverp-k+1) - up2_in(k) = up2(i,pverp-k+1) - vp2_in(k) = vp2(i,pverp-k+1) - up3_in(k) = up3(i,pverp-k+1) - vp3_in(k) = vp3(i,pverp-k+1) - wp2_in(k) = wp2(i,pverp-k+1) - wp3_in(k) = wp3(i,pverp-k+1) - rtp2_in(k) = rtp2(i,pverp-k+1) - thlp2_in(k) = thlp2(i,pverp-k+1) - rtp3_in(k) = rtp3(i,pverp-k+1) - thlp3_in(k) = thlp3(i,pverp-k+1) - thlm_in(k) = thlm(i,pverp-k+1) - rtm_in(k) = rtm(i,pverp-k+1) - rvm_in(k) = rvm(i,pverp-k+1) - wprtp_in(k) = wprtp(i,pverp-k+1) - wpthlp_in(k) = wpthlp(i,pverp-k+1) - rtpthlp_in(k) = rtpthlp(i,pverp-k+1) - rcm_inout(k) = rcm(i,pverp-k+1) - cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) - sclrpthvp_inout(k,:) = 0._r8 - - if (k .ne. 1) then - pre_in(k) = prer_evap(i,pverp-k+1) - endif - - ! Initialize these to prevent crashing behavior - wprcp_out(k) = 0._r8 - rcm_in_layer_out(k) = 0._r8 - cloud_cover_out(k) = 0._r8 - edsclr_in(k,:) = 0._r8 - khzm_out(k) = 0._r8 - khzt_out(k) = 0._r8 - - ! higher order scalar stuff, put to zero - sclrm(k,:) = 0._r8 - wpsclrp(k,:) = 0._r8 - sclrp2(k,:) = 0._r8 - sclrp3(k,:) = 0._r8 - sclrprtp(k,:) = 0._r8 - sclrpthlp(k,:) = 0._r8 - wpsclrp_sfc(:) = 0._r8 - hydromet(k,:) = 0._r8 - wphydrometp(k,:) = 0._r8 - wp2hmp(k,:) = 0._r8 - rtphmp_zt(k,:) = 0._r8 - thlphmp_zt(k,:) = 0._r8 - - enddo - pre_in(1) = pre_in(2) - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - do k=1,pver - kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) - enddo - kappa_zt(1) = kappa_zt(2) - qc_zt(1) = qc_zt(2) - invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) - do k=1,pverp - p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) - enddo - end if - - if (clubb_do_adv) then - if (macmic_it == 1) then - wp2_in=zt2zm_api(wp2_in) - wpthlp_in=zt2zm_api(wpthlp_in) - wprtp_in=zt2zm_api(wprtp_in) - up2_in=zt2zm_api(up2_in) - vp2_in=zt2zm_api(vp2_in) - thlp2_in=zt2zm_api(thlp2_in) - rtp2_in=zt2zm_api(rtp2_in) - rtpthlp_in=zt2zm_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Do the same for tracers - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - do k=1,nlev - edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) - enddo - edsclr_in(1,icnt) = edsclr_in(2,icnt) - end if - enddo - - if (do_expldiff) then - do k=1,nlev - edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) - edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) - enddo - - edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) - edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) - endif - - stats_nsamp = nint(stats_tsamp/dtime) - stats_nout = nint(stats_tout/dtime) - - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif - - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - dzt(k) = zi_g(k) - zi_g(k-1) - enddo - dzt(1) = dzt(2) - invrs_dzt = 1._r8/dzt - - rtm_zm_in = zt2zm_api( rtm_in ) - thlm_zm_in = zt2zm_api( thlm_in ) - - call integrate_mf( pverp, dzt, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - thlm_zm_in, rtm_zm_in, & ! input - wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - s_ae, s_aw, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awql, s_awqi, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thlflx, mf_qtflx ) ! output - variables needed for solver - - ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing(1) = 0._r8 - thlm_forcing(1)= 0._r8 - do k=2,pverp - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) - - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) - end do - - end if - - ! Advance CLUBB CORE one timestep in the future - call advance_clubb_core_api & - ( l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & - thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & - sclrm_forcing, edsclrm_forcing, wprtp_forcing, & - wpthlp_forcing, rtp2_forcing, thlp2_forcing, & - rtpthlp_forcing, wm_zm, wm_zt, & - wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & - wpsclrp_sfc, wpedsclrp_sfc, & - p_in_Pa, rho_zm, rho_in, exner, & - rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & - invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & - rfrzm, radf, & - wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & - host_dx, host_dy, & - clubb_config_flags, & - um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & - thlm_in, rtm_in, wprtp_in, wpthlp_in, & - wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & - sclrm, & - sclrp2, sclrp3, sclrprtp, sclrpthlp, & - wpsclrp, edsclr_in, err_code, & - rcm_inout, cloud_frac_inout, & - wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & - sclrpthvp_inout, & - pdf_params_chnk(i,lchnk), pdf_params_zm_chnk(i,lchnk), & - pdf_implicit_coefs_terms_chnk(i,lchnk), & - khzm_out, khzt_out, & - qclvar_out, thlprcp_out, & - wprcp_out, ice_supersat_frac_out, & - rcm_in_layer_out, cloud_cover_out) - - if ( err_code == clubb_fatal_error ) then - write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep(), "LAT: ", state1%lat(i), " LON: ", state1%lon(i) - call endrun(subr//': Fatal error in CLUBB library') - end if - - - if (do_rainturb) then - rvm_in = rtm_in - rcm_inout - call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & - rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & - rtp2_mc_out, thlp2_mc_out, & - wprtp_mc_out, wpthlp_mc_out, & - rtpthlp_mc_out) - - dum1 = (1._r8 - cam_in%landfrac(i)) - - ! update turbulent moments based on rain evaporation - rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime - wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime - wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(rcm_inout) - qrl_zm = zt2zm_api(qrl_clubb) - thlp2_rad_out(:) = 0._r8 - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) - thlp2_in = thlp2_in + thlp2_rad_out * dtime - thlp2_in = max(thl_tol**2,thlp2_in) - endif - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& - out_radzt,out_radzm,out_sfc) - - enddo ! end time loop - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) - wpthlp_in=zm2zt_api(wpthlp_in) - wprtp_in=zm2zt_api(wprtp_in) - up2_in=zm2zt_api(up2_in) - vp2_in=zm2zt_api(vp2_in) - thlp2_in=zm2zt_api(thlp2_in) - rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api(rtp2_in) - thl2_zt = zm2zt_api(thlp2_in) - wp2_zt = zm2zt_api(wp2_in) - - ! Arrays need to be "flipped" to CAM grid - - do k=1,nlev+1 - - um(i,pverp-k+1) = um_in(k) - vm(i,pverp-k+1) = vm_in(k) - upwp(i,pverp-k+1) = upwp_in(k) - vpwp(i,pverp-k+1) = vpwp_in(k) - wpthvp(i,pverp-k+1) = wpthvp_in(k) - wp2thvp(i,pverp-k+1) = wp2thvp_in(k) - rtpthvp(i,pverp-k+1) = rtpthvp_in(k) - thlpthvp(i,pverp-k+1) = thlpthvp_in(k) - up2(i,pverp-k+1) = up2_in(k) - vp2(i,pverp-k+1) = vp2_in(k) - up3(i,pverp-k+1) = up3_in(k) - vp3(i,pverp-k+1) = vp3_in(k) - thlm(i,pverp-k+1) = thlm_in(k) - rtm(i,pverp-k+1) = rtm_in(k) - wprtp(i,pverp-k+1) = wprtp_in(k) - wpthlp(i,pverp-k+1) = wpthlp_in(k) - wp2(i,pverp-k+1) = wp2_in(k) - wp3(i,pverp-k+1) = wp3_in(k) - rtp2(i,pverp-k+1) = rtp2_in(k) - thlp2(i,pverp-k+1) = thlp2_in(k) - rtp3(i,pverp-k+1) = rtp3_in(k) - thlp3(i,pverp-k+1) = thlp3_in(k) - rtpthlp(i,pverp-k+1) = rtpthlp_in(k) - rcm(i,pverp-k+1) = rcm_inout(k) - ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_out(k) - wprcp(i,pverp-k+1) = wprcp_out(k) - cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(k),1._r8) - rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(k) - cloud_cover(i,pverp-k+1) = min(cloud_cover_out(k),1._r8) - zt_out(i,pverp-k+1) = zt_g(k) - zi_out(i,pverp-k+1) = zi_g(k) - khzm(i,pverp-k+1) = khzm_out(k) - qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(k)) - wm_zt_out(i,pverp-k+1) = wm_zt(k) - - rtp2_zt_out(i,pverp-k+1) = rtp2_zt(k) - thl2_zt_out(i,pverp-k+1) = thl2_zt(k) - wp2_zt_out(i,pverp-k+1) = wp2_zt(k) - - mean_rt & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * pdf_params_chnk(i,lchnk)%rt_1(k) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * pdf_params_chnk(i,lchnk)%rt_2(k) - - pdfp_rtp2(i,pverp-k+1) & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * ( ( pdf_params_chnk(i,lchnk)%rt_1(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_1(k) ) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * ( ( pdf_params_chnk(i,lchnk)%rt_2(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_2(k) ) - - do ixind=1,edsclr_dim - edsclr_out(pverp-k+1,ixind) = edsclr_in(k,ixind) - enddo - - if (do_clubb_mf) then - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - s_awql_output(i,pverp-k+1) = s_awql(k) - s_awqi_output(i,pverp-k+1) = s_awqi(k) - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - end if - - enddo - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - upwp(i,:top_lev-1) = 0._r8 - vpwp(i,:top_lev-1) = 0._r8 - rcm(i,:top_lev-1) = 0._r8 - wprcp(i,:top_lev-1) = 0._r8 - cloud_frac(i,:top_lev-1) = 0._r8 - rcm_in_layer(i,:top_lev-1) = 0._r8 - zt_out(i,:top_lev-1) = 0._r8 - zi_out(i,:top_lev-1) = 0._r8 - khzm(i,:top_lev-1) = 0._r8 - qclvar(i,:top_lev-1) = 2._r8 - - - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end if - enddo - - ! Fill up arrays needed for McICA. Note we do not want the ghost point, - ! thus why the second loop is needed. - - zi_out(i,1) = 0._r8 - - ! Section below is concentrated on energy fixing for conservation. - ! There are two steps to this process. The first is to remove any tendencies - ! CLUBB may have produced above where it is active due to roundoff. - ! The second is to provider a fixer because CLUBB and CAM's thermodynamic - ! variables are different. - - ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from - ! firing up in the stratosphere - clubbtop = troplev(i) - do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) - clubbtop = clubbtop + 1 - enddo - - ! Compute static energy using CLUBB's variables - do k=1,pver - clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & - + latvap * rcm(i,k) & - + gravit * state1%zm(i,k) + state1%phis(i) - enddo - - ! Compute integrals above layer where CLUBB is active - se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called - se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called - tw_upper_a = 0._r8 ! total water in layers above where CLUBB is active AFTER CLUBB is called - tw_upper_b = 0._r8 ! total water in layers above where CLUBB is active BEFORE CLUBB is called - do k=1,clubbtop - se_upper_a = se_upper_a + (clubb_s(k)+0.5_r8*(um(i,k)**2+vm(i,k)**2)+(latvap+latice)* & - (rtm(i,k)-rcm(i,k))+(latice)*rcm(i,k))*state1%pdel(i,k)/gravit - se_upper_b = se_upper_b + (state1%s(i,k)+0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)+(latvap+latice)* & - state1%q(i,k,ixq)+(latice)*state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit - tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - enddo - - ! Compute the disbalance of total energy and water in upper levels, - ! divide by the thickness in the lower atmosphere where we will - ! evenly distribute this disbalance - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Perform a test to see if there will be any negative RTM errors - ! in the column. If so, apply the disbalance to the surface - apply_to_surface = .false. - if (tw_upper_diss < 0._r8) then - do k=clubbtop+1,pver - rtm_test = (rtm(i,k) + tw_upper_diss*gravit) - rcm(i,k) - if (rtm_test < 0._r8) then - apply_to_surface = .true. - endif - enddo - endif - - if (apply_to_surface) then - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - rtm(i,pver) = rtm(i,pver) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(pver) = clubb_s(pver) + se_upper_diss*gravit - else - ! Apply the disbalances above to layers where CLUBB is active - do k=clubbtop+1,pver - rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit - enddo - endif - - ! Essentially "zero" out tendencies in the layers above where CLUBB is active - do k=1,clubbtop - if (apply_to_heat) clubb_s(k) = state1%s(i,k) - rcm(i,k) = state1%q(i,k,ixcldliq) - rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) - enddo - - ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water - ! after CLUBB is called. This is for energy conservation purposes. - se_a = 0._r8 - ke_a = 0._r8 - wv_a = 0._r8 - wl_a = 0._r8 - - ! Do the same as above, but for before CLUBB was called. - se_b = 0._r8 - ke_b = 0._r8 - wv_b = 0._r8 - wl_b = 0._r8 - do k=1,pver - se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit - ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit - wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit - wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit - - se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit - ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit - wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit - wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - enddo - - ! Based on these integrals, compute the total energy before and after CLUBB call - te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) - te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) - - ! Take into account the surface fluxes of heat and moisture - ! Use correct qflux from cam_in, not lhf/latvap as was done previously - te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime - - ! Compute the disbalance of total energy, over depth where CLUBB is active - se_dis = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis*gravit - enddo - endif - - ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point - ! for all variables and therefore is never called in this loop - rtm_integral_vtend = 0._r8 - rtm_integral_ltend = 0._r8 - do k=1,pver - - ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind - ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind - ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor - ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water - ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy - - rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - rtm_integral_vtend = rtm_integral_vtend + ptend_loc%q(i,k,ixq)*state1%pdel(i,k)/gravit - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - - ! Here add a constant to moments which can be either positive or - ! negative. This is to prevent clipping when dynamics tries to - ! make all constituents positive - wp3(i,k) = wp3(i,k) + wp3_const - rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const - wpthlp(i,k) = wpthlp(i,k) + wpthlp_const - wprtp(i,k) = wprtp(i,k) + wprtp_const - - ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance - ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance - ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance - ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP - ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP - ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 - ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 - ptend_loc%q(i,k,ixup2)=(up2(i,k)-state1%q(i,k,ixup2))/hdtime ! UP2 - ptend_loc%q(i,k,ixvp2)=(vp2(i,k)-state1%q(i,k,ixvp2))/hdtime ! VP2 - else - ptend_loc%q(i,k,ixthlp2)=0._r8 - ptend_loc%q(i,k,ixrtp2)=0._r8 - ptend_loc%q(i,k,ixrtpthlp)=0._r8 - ptend_loc%q(i,k,ixwpthlp)=0._r8 - ptend_loc%q(i,k,ixwprtp)=0._r8 - ptend_loc%q(i,k,ixwp2)=0._r8 - ptend_loc%q(i,k,ixwp3)=0._r8 - ptend_loc%q(i,k,ixup2)=0._r8 - ptend_loc%q(i,k,ixvp2)=0._r8 - endif - - endif - - ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. - ! Loading up this array doesn't mean the tendencies are applied. - ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed - - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& - (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& - (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& - (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& - (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then - ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents - end if - end if - enddo - - enddo - - - enddo ! end column loop - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) - - ! Add constant to ghost point so that output is not corrupted - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp3(:,pverp) = wp3(:,pverp) + wp3_const - rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const - wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const - wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const - endif - endif - - cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) - - ! ------------------------------------------------- ! - ! End column computation of CLUBB, begin to apply ! - ! and compute output, etc ! - ! ------------------------------------------------- ! - - ! Output CLUBB tendencies - call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) - call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! Due to the order of operation of CLUBB, which closes on liquid first, - ! then advances it's predictive equations second, this can lead to - ! RHliq > 1 directly before microphysics is called. Therefore, we use - ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. - - if (clubb_do_liqsupersat) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - latsub = latvap + latice - - lq2(:) = .FALSE. - lq2(ixq) = .TRUE. - lq2(ixcldliq) = .TRUE. - lq2(ixnumliq) = .TRUE. - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qctend(:ncol,:)=0._r8 - inctend(:ncol,:)=0._r8 - - call liquid_macro_tend(npccn(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & - state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,ixq), & - state1%q(1:ncol,top_lev:pver,ixcldliq), state1%q(1:ncol,top_lev:pver,ixnumliq), & - latvap, hdtime, stend(1:ncol,top_lev:pver),qvtend(1:ncol,top_lev:pver), & - qctend(1:ncol,top_lev:pver), inctend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - ! Write output for tendencies: - ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QCTENDICE', qctend, pcols, lchnk ) - call outfld( 'NCTENDICE', inctend, pcols, lchnk ) - - where(qctend .ne. 0._r8) - fqtend = 1._r8 - elsewhere - fqtend = 0._r8 - end where - - call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) - end if - - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! The rest of the code deals with diagnosing variables ! - ! for microphysics/radiation computation and macrophysics ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD DETRAINMENT ! - ! Detrainment of convective condensate into the environment or stratiform cloud ! - ! --------------------------------------------------------------------------------- ! - - ! Initialize the shallow convective detrainment rate, will always be zero - dlf2(:,:) = 0.0_r8 - dlf_liq_out(:,:) = 0.0_r8 - dlf_ice_out(:,:) = 0.0_r8 - - lqice(:) = .false. - lqice(ixcldliq) = .true. - lqice(ixcldice) = .true. - lqice(ixnumliq) = .true. - lqice(ixnumice) = .true. - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) - - if (zmconv_microp) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - call pbuf_get_field(pbuf, difzm_idx, difzm) - call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) - call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) - end if - - do k=1,pver - do i=1,ncol - if( state1%t(i,k) > meltpt_temp ) then - dum1 = 0.0_r8 - elseif ( state1%t(i,k) < dt_low ) then - dum1 = 1.0_r8 - else - dum1 = ( meltpt_temp - state1%t(i,k) ) / ( meltpt_temp - dt_low ) - endif - - if (zmconv_microp) then - ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 - - ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*dl_rad**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*di_rad**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice - else - - ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 - ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*dl_rad**3*997._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & - / (4._r8*3.14_r8*di_rad**3*500._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice - - dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) - dlf_ice_out(i,k) = dlf(i,k) * dum1 - end if - - ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep - ! track of the integrals of ice and static energy that is effected from conversion to ice - ! so that the energy checker doesn't complain. - det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit - det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit - - enddo - enddo - - det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water - - call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - - temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) - call outfld( 'DPDLFT', temp2d, pcols, lchnk) - - call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! ptend_all now has all accumulated tendencies. Convert the tendencies for the - ! dry constituents to dry air basis. - do ixind = 1, pcnst - if (lq(ixind) .and. cnst_type(ixind) == 'dry') then - do k = 1, pver - do i = 1, ncol - ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdel(i,k)/state1%pdeldry(i,k) - end do - end do - end if - end do - - ! ------------------------------------------------- ! - ! Diagnose relative cloud water variance ! - ! ------------------------------------------------- ! - - if (deep_scheme == 'CLUBB_SGS') then - relvarmax = 2.0_r8 - else - relvarmax = 10.0_r8 - endif - - relvar(:,:) = relvarmax ! default - - if (deep_scheme .ne. 'CLUBB_SGS') then - where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & - relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) - endif - - ! ------------------------------------------------- ! - ! Optional Accretion enhancement factor ! - ! ------------------------------------------------- ! - - accre_enhan(:ncol,:pver) = 1._r8 - - ! ------------------------------------------------- ! - ! Diagnose some output variables ! - ! ------------------------------------------------- ! - - ! density - rho(:ncol,1:pver) = state1%pmid(:ncol,1:pver)/(rairv(:ncol,1:pver,lchnk)*state1%t(:ncol,1:pver)) - rho(:ncol,pverp) = state1%ps(:ncol)/(rairv(:ncol,pver,lchnk)*state1%t(:ncol,pver)) - - wpthvp_diag(:,:) = 0.0_r8 - do k=1,pver - do i=1,ncol - eps = rairv(i,k,lchnk)/rh2o - ! buoyancy flux - wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & - (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & - state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) - - ! total water mixing ratio - qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) - ! liquid water potential temperature - thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) - ! liquid water static energy - sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) - enddo - enddo - - do k=1,pverp - do i=1,ncol - wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - if (do_clubb_mf) then - mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - end if - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - ! initialize variables - alst(:,:) = 0.0_r8 - qlst(:,:) = 0.0_r8 - - do k=1,pver - do i=1,ncol - alst(i,k) = cloud_frac(i,k) - qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - deepcu(:,pver) = 0.0_r8 - shalcu(:,pver) = 0.0_r8 - - do k=1,pver-1 - do i=1,ncol - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(dp1*log(1.0_r8+dp2*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = 0._r8 - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) - enddo - enddo - - if (single_column) then - if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & - trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & - trim(scm_clubb_iop_name) == 'RICO_3day' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - deepcu(:,:) = 0.0_r8 - concld(:,:) = 0.0_r8 - - endif - endif - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD FRACTION PORTION ! - ! use the aist_vector function to compute the ice cloud fraction ! - ! --------------------------------------------------------------------------------- ! - - aist(:,:top_lev-1) = 0._r8 - qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below - - do k = top_lev, pver - - ! For Type II PSC and for thin cirrus, the clouds can be thin, but - ! extensive and they should start forming when the gridbox mean saturation - ! reaches 1.0. - ! - ! For now, use the tropopause diagnostic to determine where the Type II - ! PSC should be, but in the future wold like a better metric that can also - ! identify the level for thin cirrus. Include the tropopause level so that - ! the cold point tropopause will use the stratospheric values. - where (k <= troplev) - rhmini = rhminis_const - rhmaxi = rhmaxis_const - elsewhere - rhmini = rhmini_const - rhmaxi = rhmaxi_const - end where - - if ( trim(subcol_scheme) == 'SILHS' ) then - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) - else - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& - qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) - endif - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! - ! ! - ! For now leave the computation of ice stratus fraction from macrop_driver intact ! - ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! - ! fraction that was coded in macrop_driver ! - ! --------------------------------------------------------------------------------- ! - - ! Recompute net stratus fraction using maximum over-lapping assumption, as done - ! in macrophysics code, using alst computed above and aist read in from physics buffer - - do k=1,pver - do i=1,ncol - - ast(i,k) = max(alst(i,k),aist(i,k)) - - qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) - enddo - enddo - - ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just - ! be outputting the shallow convective cloud fraction - - do k=1,pver - do i=1,ncol - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! DIAGNOSE THE PBL DEPTH ! - ! this is needed for aerosol code ! - ! --------------------------------------------------------------------------------- ! - - do i=1,ncol - do k=1,pver - th(i,k) = state1%t(i,k)*state1%exner(i,k) - thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) - enddo - enddo - - ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) - rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) - call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & - rrho(1:ncol), ustar2(1:ncol)) - ! use correct qflux from coupler - call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & - rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & - obklen(1:ncol)) - - dummy2(:) = 0._r8 - dummy3(:) = 0._r8 - - where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 - - ! Compute PBL depth according to Holtslag-Boville Scheme - call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & - ustar2, obklen, kbfs, pblh, dummy2, & - state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) - - ! Output the PBL depth - call outfld('PBLH', pblh, pcols, lchnk) - - ! Assign the first pver levels of cloud_frac back to cld - cld(:,1:pver) = cloud_frac(:,1:pver) - - ! --------------------------------------------------------------------------------- ! - ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! - ! --------------------------------------------------------------------------------- ! - - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 - call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) - - rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 - call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 - call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:) * cpair - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - end if - - ! Output CLUBB history here - if (l_stats) then - - do i=1,stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) - enddo - - do i=1,stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) - enddo - - if (l_output_rad_files) then - do i=1,stats_rad_zt%num_output_fields - call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) - enddo - - do i=1,stats_rad_zm%num_output_fields - call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) - enddo - endif - - do i=1,stats_sfc%num_output_fields - call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) - enddo - - endif - - return -#endif - end subroutine clubb_tend_cam - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -! Saturation adjustment for ice -! Add ice mass if supersaturated -subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend,vlen) - - use wv_sat_methods, only: wv_sat_qsat_ice - - integer, intent(in) :: vlen - real(r8), dimension(vlen), intent(in) :: naai !Activated number of ice nuclei - real(r8), dimension(vlen), intent(in) :: t !temperature (k) - real(r8), dimension(vlen), intent(in) :: p !pressure (pa) - real(r8), dimension(vlen), intent(in) :: qv !water vapor mixing ratio - real(r8), dimension(vlen), intent(in) :: qi !ice mixing ratio - real(r8), dimension(vlen), intent(in) :: ni !ice number concentration - real(r8), intent(in) :: xxls !latent heat of freezing - real(r8), intent(in) :: deltat !timestep - real(r8), dimension(vlen), intent(out) :: stend ! 'temperature' tendency - real(r8), dimension(vlen), intent(out) :: qvtend !vapor tendency - real(r8), dimension(vlen), intent(out) :: qitend !ice mass tendency - real(r8), dimension(vlen), intent(out) :: nitend !ice number tendency - - real(r8) :: ESI(vlen) - real(r8) :: QSI(vlen) - integer :: i - - do i = 1, vlen - stend(i) = 0._r8 - qvtend(i) = 0._r8 - qitend(i) = 0._r8 - nitend(i) = 0._r8 - end do - -! calculate qsati from t,p,q - do i = 1, vlen - call wv_sat_qsat_ice(t(i), p(i), ESI(i), QSI(i)) - end do - - do i = 1, vlen - if (naai(i) > 1.e-18_r8 .and. qv(i) > QSI(i)) then - - qitend(i) = (qv(i)-QSI(i))/deltat - qvtend(i) = 0._r8 - qitend(i) - stend(i) = qitend(i) * xxls ! moist static energy tend...[J/kg/s] ! - - ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice - if (ni(i) < 1.e3_r8 .and. (qi(i)+qitend(i)*deltat) > 1.e-18_r8) then - nitend(i) = nitend(i) + 3._r8 * qitend(i)/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) - end if - - end if - end do - -end subroutine ice_macro_tend - -#ifdef CLUBB_SGS -! ---------------------------------------------------------------------- -! -! DISCLAIMER : this code appears to be correct but has not been -! very thouroughly tested. If you do notice any -! anomalous behaviour then please contact Andy and/or -! Bjorn -! -! Function diag_ustar: returns value of ustar using the below -! similarity functions and a specified buoyancy flux (bflx) given in -! kinematic units -! -! phi_m (zeta > 0) = (1 + am * zeta) -! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) -! -! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) -! -! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface -! Layer, in Workshop on Micormeteorology, pages 67-100. -! -! Code writen March, 1999 by Bjorn Stevens -! - -real(r8) function diag_ustar( z, bflx, wnd, z0 ) - -use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g - -implicit none - -real(r8), parameter :: am = 4.8_r8 ! " " " -real(r8), parameter :: bm = 19.3_r8 ! " " " - -real(r8), parameter :: grav = shr_const_g -real(r8), parameter :: vonk = shr_const_karman -real(r8), parameter :: pi = shr_const_pi - -real(r8), intent (in) :: z ! height where u locates -real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) -real(r8), intent (in) :: wnd ! wind speed at z -real(r8), intent (in) :: z0 ! momentum roughness height - - -integer :: iterate -real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar - -lnz = log( z / z0 ) -klnz = vonk/lnz -c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) - -ustar = wnd*klnz -if (abs(bflx) > 1.e-6_r8) then - do iterate=1,4 - - if (ustar > 1.e-6_r8) then - lmo = -ustar**3 / ( vonk * bflx ) - zeta = z/lmo - if (zeta > 0._r8) then - ustar = vonk*wnd /(lnz + am*zeta) - else - x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) - psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 - ustar = wnd*vonk/(lnz - psi1) - end if - - endif - - end do -end if - - -diag_ustar = ustar - -return - - -end function diag_ustar -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & - nnzp, nnrad_zt,nnrad_zm, delt ) - ! - ! Description: Initializes the statistics saving functionality of - ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here - ! the traditional stats_init of CLUBB is not called, as it is not compatible - ! with CAM output. - - !----------------------------------------------------------------------- - - - use clubb_api_module, only: & - stats_zt, & ! Variables - ztscr01, & - ztscr02, & - ztscr03, & - ztscr04, & - ztscr05, & - ztscr06, & - ztscr07, & - ztscr08, & - ztscr09, & - ztscr10, & - ztscr11, & - ztscr12, & - ztscr13, & - ztscr14, & - ztscr15, & - ztscr16, & - ztscr17, & - ztscr18, & - ztscr19, & - ztscr20, & - ztscr21 - - use clubb_api_module, only: & - stats_zm, & - zmscr01, & - zmscr02, & - zmscr03, & - zmscr04, & - zmscr05, & - zmscr06, & - zmscr07, & - zmscr08, & - zmscr09, & - zmscr10, & - zmscr11, & - zmscr12, & - zmscr13, & - zmscr14, & - zmscr15, & - zmscr16, & - zmscr17, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats, & - l_output_rad_files, & - stats_tsamp, & - stats_tout, & - l_stats_samp, & - l_stats_last, & - l_netcdf, & - l_grads - - use clubb_api_module, only: time_precision, & ! - nvarmax_zm, stats_init_zm_api, & ! - nvarmax_zt, stats_init_zt_api, & ! - nvarmax_rad_zt, stats_init_rad_zt_api, & ! - nvarmax_rad_zm, stats_init_rad_zm_api, & ! - nvarmax_sfc, stats_init_sfc_api, & ! - fstderr, var_length ! - use cam_abortutils, only: endrun - use cam_history, only: addfld, horiz_only - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character - - implicit none - - ! Input Variables - - logical, intent(in) :: l_stats_in ! Stats on? T/F - - real(kind=time_precision), intent(in) :: & - stats_tsamp_in, & ! Sampling interval [s] - stats_tout_in ! Output interval [s] - - integer, intent(in) :: nnzp ! Grid points in the vertical [count] - integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] - integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] - - real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] - - - ! Local Variables - - ! Namelist Variables - - character(len=*), parameter :: subr = 'stats_init_clubb' - - character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels - character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels - character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface - - namelist /clubb_stats_nl/ & - clubb_vars_zt, & - clubb_vars_zm, & - clubb_vars_rad_zt, & - clubb_vars_rad_zm, & - clubb_vars_sfc - - ! Local Variables - - logical :: l_error - - character(len=200) :: temp1, sub - - integer :: i, ntot, read_status - integer :: iunit, ierr - - ! Initialize - l_error = .false. - - ! Set stats_variables variables with inputs from calling subroutine - l_stats = l_stats_in - - stats_tsamp = stats_tsamp_in - stats_tout = stats_tout_in - - if ( .not. l_stats ) then - l_stats_samp = .false. - l_stats_last = .false. - return - end if - - ! Initialize namelist variables - - clubb_vars_zt = '' - clubb_vars_zm = '' - clubb_vars_rad_zt = '' - clubb_vars_rad_zm = '' - clubb_vars_sfc = '' - - ! Read variables to compute from the namelist - if (masterproc) then - iunit= getunit() - open(unit=iunit,file="atm_in",status='old') - call find_group_name(iunit, 'clubb_stats_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('stats_init_clubb: error reading namelist') - end if - end if - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") - call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") - call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") - call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") - call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") - - ! Hardcode these for use in CAM-CLUBB, don't want either - l_netcdf = .false. - l_grads = .false. - - ! Check sampling and output frequencies - - ! The model time step length, delt (which is dtmain), should multiply - ! evenly into the statistical sampling time step length, stats_tsamp. - if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then - l_error = .true. ! This will cause the run to stop. - write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & - 'delt (which is dtmain). Check the appropriate ', & - 'model.in file.' - write(fstderr,*) 'stats_tsamp = ', stats_tsamp - write(fstderr,*) 'delt = ', delt - endif - - ! Initialize zt (mass points) - - i = 1 - do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zt(i)) /= 0 .and. & - i <= nvarmax_zt ) - i = i + 1 - enddo - ntot = i - 1 - if ( ntot == nvarmax_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zt than allowed for by nvarmax_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & - "in the stats namelist, or change nvarmax_zt." - write(fstderr,*) "nvarmax_zt = ", nvarmax_zt - call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") - endif - - stats_zt%num_output_fields = ntot - stats_zt%kk = nnzp - - allocate( stats_zt%z( stats_zt%kk ) ) - - allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - - allocate( stats_zt%file%var( stats_zt%num_output_fields ) ) - allocate( stats_zt%file%z( stats_zt%kk ) ) - - ! Allocate scratch space - - allocate( ztscr01(stats_zt%kk) ) - allocate( ztscr02(stats_zt%kk) ) - allocate( ztscr03(stats_zt%kk) ) - allocate( ztscr04(stats_zt%kk) ) - allocate( ztscr05(stats_zt%kk) ) - allocate( ztscr06(stats_zt%kk) ) - allocate( ztscr07(stats_zt%kk) ) - allocate( ztscr08(stats_zt%kk) ) - allocate( ztscr09(stats_zt%kk) ) - allocate( ztscr10(stats_zt%kk) ) - allocate( ztscr11(stats_zt%kk) ) - allocate( ztscr12(stats_zt%kk) ) - allocate( ztscr13(stats_zt%kk) ) - allocate( ztscr14(stats_zt%kk) ) - allocate( ztscr15(stats_zt%kk) ) - allocate( ztscr16(stats_zt%kk) ) - allocate( ztscr17(stats_zt%kk) ) - allocate( ztscr18(stats_zt%kk) ) - allocate( ztscr19(stats_zt%kk) ) - allocate( ztscr20(stats_zt%kk) ) - allocate( ztscr21(stats_zt%kk) ) - - ztscr01 = 0.0_r8 - ztscr02 = 0.0_r8 - ztscr03 = 0.0_r8 - ztscr04 = 0.0_r8 - ztscr05 = 0.0_r8 - ztscr06 = 0.0_r8 - ztscr07 = 0.0_r8 - ztscr08 = 0.0_r8 - ztscr09 = 0.0_r8 - ztscr10 = 0.0_r8 - ztscr11 = 0.0_r8 - ztscr12 = 0.0_r8 - ztscr13 = 0.0_r8 - ztscr14 = 0.0_r8 - ztscr15 = 0.0_r8 - ztscr16 = 0.0_r8 - ztscr17 = 0.0_r8 - ztscr18 = 0.0_r8 - ztscr19 = 0.0_r8 - ztscr20 = 0.0_r8 - ztscr21 = 0.0_r8 - - ! Default initialization for array indices for zt - - call stats_init_zt_api( clubb_vars_zt, l_error ) - - ! Initialize zm (momentum points) - - i = 1 - do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zm(i)) /= 0 .and. & - i <= nvarmax_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zm than allowed for by nvarmax_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & - "in the stats namelist, or change nvarmax_zm." - write(fstderr,*) "nvarmax_zm = ", nvarmax_zm - call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") - endif - - stats_zm%num_output_fields = ntot - stats_zm%kk = nnzp - - allocate( stats_zm%z( stats_zm%kk ) ) - - allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - - allocate( stats_zm%file%var( stats_zm%num_output_fields ) ) - allocate( stats_zm%file%z( stats_zm%kk ) ) - - ! Allocate scratch space - - allocate( zmscr01(stats_zm%kk) ) - allocate( zmscr02(stats_zm%kk) ) - allocate( zmscr03(stats_zm%kk) ) - allocate( zmscr04(stats_zm%kk) ) - allocate( zmscr05(stats_zm%kk) ) - allocate( zmscr06(stats_zm%kk) ) - allocate( zmscr07(stats_zm%kk) ) - allocate( zmscr08(stats_zm%kk) ) - allocate( zmscr09(stats_zm%kk) ) - allocate( zmscr10(stats_zm%kk) ) - allocate( zmscr11(stats_zm%kk) ) - allocate( zmscr12(stats_zm%kk) ) - allocate( zmscr13(stats_zm%kk) ) - allocate( zmscr14(stats_zm%kk) ) - allocate( zmscr15(stats_zm%kk) ) - allocate( zmscr16(stats_zm%kk) ) - allocate( zmscr17(stats_zm%kk) ) - - zmscr01 = 0.0_r8 - zmscr02 = 0.0_r8 - zmscr03 = 0.0_r8 - zmscr04 = 0.0_r8 - zmscr05 = 0.0_r8 - zmscr06 = 0.0_r8 - zmscr07 = 0.0_r8 - zmscr08 = 0.0_r8 - zmscr09 = 0.0_r8 - zmscr10 = 0.0_r8 - zmscr11 = 0.0_r8 - zmscr12 = 0.0_r8 - zmscr13 = 0.0_r8 - zmscr14 = 0.0_r8 - zmscr15 = 0.0_r8 - zmscr16 = 0.0_r8 - zmscr17 = 0.0_r8 - - call stats_init_zm_api( clubb_vars_zm, l_error ) - - ! Initialize rad_zt (radiation points) - - if (l_output_rad_files) then - - i = 1 - do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & - i <= nvarmax_rad_zt ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & - "in the stats namelist, or change nvarmax_rad_zt." - write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt - call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") - endif - - stats_rad_zt%num_output_fields = ntot - stats_rad_zt%kk = nnrad_zt - - allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) - - allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - - allocate( stats_rad_zt%file%var( stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) - - call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) - - ! Initialize rad_zm (radiation points) - - i = 1 - do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & - i <= nvarmax_rad_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & - "in the stats namelist, or change nvarmax_rad_zm." - write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm - call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") - endif - - stats_rad_zm%num_output_fields = ntot - stats_rad_zm%kk = nnrad_zm - - allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) - - allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - - allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) - - call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) - end if ! l_output_rad_files - - - ! Initialize sfc (surface point) - - i = 1 - do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_sfc(i)) /= 0 .and. & - i <= nvarmax_sfc ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_sfc ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_sfc than allowed for by nvarmax_sfc." - write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & - "in the stats namelist, or change nvarmax_sfc." - write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc - call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") - endif - - stats_sfc%num_output_fields = ntot - stats_sfc%kk = 1 - - allocate( stats_sfc%z( stats_sfc%kk ) ) - - allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - allocate( stats_sfc%file%var( stats_sfc%num_output_fields ) ) - allocate( stats_sfc%file%z( stats_sfc%kk ) ) - - call stats_init_sfc_api( clubb_vars_sfc, l_error ) - - ! Check for errors - - if ( l_error ) then - call endrun ('stats_init: errors found') - endif - -! Now call add fields - do i = 1, stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) - enddo - - do i = 1, stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) - enddo - - if (l_output_rad_files) then -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - do i = 1, stats_rad_zt%num_output_fields - call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) - enddo - - do i = 1, stats_rad_zm%num_output_fields - call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) - enddo - endif - - do i = 1, stats_sfc%num_output_fields - call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& - 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) - enddo - - return - - end subroutine stats_init_clubb - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - - !----------------------------------------------------------------------- - subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) - - ! Description: Called when the stats timestep has ended. This subroutine - ! is responsible for calling statistics to be written to the output - ! format. - !----------------------------------------------------------------------- - -#ifdef CLUBB_SGS - - use shr_infnan_mod, only: is_nan => shr_infnan_isnan - - use clubb_api_module, only: & - fstderr, & ! Constant(s) - stats_zt, & ! Variable(s) - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats_last, & - stats_tsamp, & - stats_tout, & - l_output_rad_files, & - clubb_at_least_debug_level_api ! Procedure(s) - - use cam_abortutils, only: endrun - - implicit none - - -#endif - - integer :: thecol - - real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) - real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) - real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) - -#ifdef CLUBB_SGS - ! Local Variables - - integer :: i, k - logical :: l_error - - ! Check if it is time to write to file - - if ( .not. l_stats_last ) return - - ! Initialize - l_error = .false. - - ! Compute averages - call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) - call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) - if (l_output_rad_files) then - call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples ) - call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples ) - end if - call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) - - ! Here we are not outputting the data, rather reading the stats into - ! arrays which are conformable to CAM output. Also, the data is "flipped" - ! in the vertical level to be the same as CAM output. - do i = 1, stats_zt%num_output_fields - do k = 1, stats_zt%kk - out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) - if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_zm%num_output_fields - do k = 1, stats_zt%kk - out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) - if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 - enddo - enddo - - if (l_output_rad_files) then - do i = 1, stats_rad_zt%num_output_fields - do k = 1, stats_rad_zt%kk - out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) - if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_rad_zm%num_output_fields - do k = 1, stats_rad_zm%kk - out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) - if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 - enddo - enddo - - ! Fill in values above the CLUBB top. - out_zt(thecol,:top_lev-1,:) = 0.0_r8 - out_zm(thecol,:top_lev-1,:) = 0.0_r8 - out_radzt(thecol,:top_lev-1,:) = 0.0_r8 - out_radzm(thecol,:top_lev-1,:) = 0.0_r8 - - endif ! l_output_rad_files - - do i = 1, stats_sfc%num_output_fields - out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) - if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 - enddo - - ! Reset sample fields - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - if (l_output_rad_files) then - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - end if - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - return - -#endif - - end subroutine stats_end_timestep_clubb - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - !----------------------------------------------------------------------- - subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) - - ! Description: - ! Initialize stats to zero - !----------------------------------------------------------------------- - - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - - implicit none - - ! Input - integer, intent(in) :: kk, num_output_fields - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n - logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update - - ! Zero out arrays - - if ( num_output_fields > 0 ) then - x(:,:,:,:) = 0.0_r8 - n(:,:,:,:) = 0 - l_in_update(:,:,:,:) = .false. - end if - - return - - end subroutine stats_zero - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - -#ifdef CLUBB_SGS - !----------------------------------------------------------------------- - subroutine stats_avg( kk, num_output_fields, x, n ) - - ! Description: - ! Compute the average of stats fields - !----------------------------------------------------------------------- - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - implicit none - - ! Input - integer, intent(in) :: num_output_fields, kk - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x - - ! Internal - - integer k,m - - ! Compute averages - - do m=1,num_output_fields - do k=1,kk - - if ( n(1,1,k,m) > 0 ) then - x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) - end if - - end do - end do - - return - - end subroutine stats_avg - - subroutine grid_size(state, grid_dx, grid_dy) - ! Determine the size of the grid for each of the columns in state - - use phys_grid, only: get_area_p - use shr_const_mod, only: shr_const_pi - use physics_types, only: physics_state - - - type(physics_state), intent(in) :: state - real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - - real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator - real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid - real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid - - real(r8) :: mpdeglat, column_area, degree - integer :: i - - ! determine the column area in radians - do i=1,state%ncol - column_area = get_area_p(state%lchnk,i) - degree = sqrt(column_area)*(180._r8/shr_const_pi) - - ! Now find meters per degree latitude - ! Below equation finds distance between two points on an ellipsoid, derived from expansion - ! taking into account ellipsoid using World Geodetic System (WGS84) reference - mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) - grid_dx(i) = mpdeglat * degree - grid_dy(i) = grid_dx(i) ! Assume these are the same - enddo - - end subroutine grid_size - -#endif - -#ifdef CLUBB_SGS - subroutine init_clubb_config_flags( clubb_config_flags_in ) -!------------------------------------------------------------------------------- -! Description: -! Initializes the public module variable 'clubb_config_flags' of type -! 'clubb_config_flags_type' on first call and only on first call. -! References: -! None -!------------------------------------------------------------------------------- - use clubb_api_module, only: & - clubb_config_flags_type, & ! Type - set_default_clubb_config_flags_api, & ! Procedure(s) - initialize_clubb_config_flags_type_api - - implicit none - - ! Input/Output Variables - type(clubb_config_flags_type), intent(inout) :: clubb_config_flags_in - - ! Local Variables - logical :: & - l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The - ! precipitation fraction is automatically set to 1 when this - ! flag is turned off. - l_predict_upwp_vpwp, & ! Flag to predict and along with and - ! alongside the advancement of , , , - ! , , and in subroutine - ! advance_xm_wpxp. Otherwise, and are still - ! approximated by eddy diffusivity when and are - ! advanced in subroutine advance_windm_edsclrm. - l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping - ! the overall correlation of w and x (w and rt, as well as w - ! and theta-l) within the limits of -max_mag_correlation_flux - ! to max_mag_correlation_flux. - l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and - ! thlp2) on keeping the overall correlation of w and x within - ! the limits of -max_mag_correlation_flux to - ! max_mag_correlation_flux. - l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the - ! turbulent dissipation coefficient, C2. - l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm - l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor - l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 - l_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects wprtp, wpthlp, & wpsclrp. - l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & - ! sclrpthlp. - l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtm, thlm, sclrm, um and vm. - l_uv_nudge, & ! For wind speed nudging. - l_rtm_nudge, & ! For rtm nudging - l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. - ! TKE = 1/2 (u'^2 + v'^2 + w'^2) - l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to - ! compute the varibles that are output from high order - ! closure - l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the - ! thermodynamic-level variables output from pdf_closure. - l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three - ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - - ! output from pdf_closure. - l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call - ! subroutine pdf_closure twice. If true, pdf_closure is - ! called first on thermodynamic levels and then on momentum - ! levels so that each variable is computed on its native - ! level. If false, pdf_closure is only called on - ! thermodynamic levels, and variables which belong on - ! momentum levels are interpolated. - l_standard_term_ta, & ! Use the standard discretization for the turbulent advection - ! terms. Setting to .false. means that a_1 and a_3 are - ! pulled outside of the derivative in - ! advance_wp2_wp3_module.F90 and in - ! advance_xp2_xpyp_module.F90. - l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac - ! and rcm to help increase cloudiness at coarser grid - ! resolutions. - l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones - l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors - l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) - l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) - l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability - ! correction - l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of - ! -(2/3)*em/tau_zm, as in Bougeault (1981) - l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly - l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values - l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the - ! mixing length scale as Lscale = tau * tke - l_use_ice_latent, & ! Includes the effects of ice latent heating in turbulence - ! terms - l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number - l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number - l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in - ! saturated atmospheres (from Durran and Klemp, 1982) - l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency - l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water - l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and - ! rtpthlp - l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 - l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz - l_update_pressure ! Flag for having CLUBB update pressure and exner - - logical, save :: first_call = .true. - - if (first_call) then - - call set_default_clubb_config_flags_api( l_use_precip_frac, & ! Out - l_predict_upwp_vpwp, & ! Out - l_min_wp2_from_corr_wx, & ! Out - l_min_xp2_from_corr_wx, & ! Out - l_C2_cloud_frac, & ! Out - l_diffuse_rtm_and_thlm, & ! Out - l_stability_correct_Kh_N2_zm, & ! Out - l_calc_thlp2_rad, & ! Out - l_upwind_wpxp_ta, & ! Out - l_upwind_xpyp_ta, & ! Out - l_upwind_xm_ma, & ! Out - l_uv_nudge, & ! Out - l_rtm_nudge, & ! Out - l_tke_aniso, & ! Out - l_vert_avg_closure, & ! Out - l_trapezoidal_rule_zt, & ! Out - l_trapezoidal_rule_zm, & ! Out - l_call_pdf_closure_twice, & ! Out - l_standard_term_ta, & ! Out - l_use_cloud_cover, & ! Out - l_diagnose_correlations, & ! Out - l_calc_w_corr, & ! Out - l_const_Nc_in_cloud, & ! Out - l_fix_w_chi_eta_correlations, & ! Out - l_stability_correct_tau_zm, & ! Out - l_damp_wp2_using_em, & ! Out - l_do_expldiff_rtm_thlm, & ! Out - l_Lscale_plume_centered, & ! Out - l_diag_Lscale_from_tau, & ! Out - l_use_ice_latent, & ! Out - l_use_C7_Richardson, & ! Out - l_use_C11_Richardson, & ! Out - l_brunt_vaisala_freq_moist, & ! Out - l_use_thvm_in_bv_freq, & ! Out - l_rcm_supersat_adj, & ! Out - l_single_C2_Skw, & ! Out - l_damp_wp3_Skw_squared, & ! Out - l_prescribed_avg_deltaz, & ! Out - l_update_pressure ) ! Out - - call initialize_clubb_config_flags_type_api( l_use_precip_frac, & ! In - l_predict_upwp_vpwp, & ! In - l_min_wp2_from_corr_wx, & ! In - l_min_xp2_from_corr_wx, & ! In - l_C2_cloud_frac, & ! In - l_diffuse_rtm_and_thlm, & ! In - l_stability_correct_Kh_N2_zm, & ! In - l_calc_thlp2_rad, & ! In - l_upwind_wpxp_ta, & ! In - l_upwind_xpyp_ta, & ! In - l_upwind_xm_ma, & ! In - l_uv_nudge, & ! In - l_rtm_nudge, & ! In - l_tke_aniso, & ! In - l_vert_avg_closure, & ! In - l_trapezoidal_rule_zt, & ! In - l_trapezoidal_rule_zm, & ! In - l_call_pdf_closure_twice, & ! In - l_standard_term_ta, & ! In - l_use_cloud_cover, & ! In - l_diagnose_correlations, & ! In - l_calc_w_corr, & ! In - l_const_Nc_in_cloud, & ! In - l_fix_w_chi_eta_correlations, & ! In - l_stability_correct_tau_zm, & ! In - l_damp_wp2_using_em, & ! In - l_do_expldiff_rtm_thlm, & ! In - l_Lscale_plume_centered, & ! In - l_diag_Lscale_from_tau, & ! In - l_use_ice_latent, & ! In - l_use_C7_Richardson, & ! In - l_use_C11_Richardson, & ! In - l_brunt_vaisala_freq_moist, & ! In - l_use_thvm_in_bv_freq, & ! In - l_rcm_supersat_adj, & ! In - l_single_C2_Skw, & ! In - l_damp_wp3_Skw_squared, & ! In - l_prescribed_avg_deltaz, & ! In - l_update_pressure, & ! In - clubb_config_flags_in ) ! Out - - first_call = .false. - - end if - - return - - end subroutine init_clubb_config_flags -#endif - -end module clubb_intr ->>>>>>> upstream/cam_development From f6a5f81b667627d31d2dddcf774765ce20548916 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 15:53:07 -0700 Subject: [PATCH 069/466] merged clubb_intr upto head --- src/physics/cam/clubb_intr.F90 | 10153 ++++++++++++++++--------------- 1 file changed, 5104 insertions(+), 5049 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 9cf35182e6..17c2135b08 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1,5049 +1,5104 @@ -module clubb_intr - - !----------------------------------------------------------------------------------------------------- ! - ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! - ! by the University of Wisconsin Milwaukee Group (UWM). ! - ! ! - ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! - ! ! - ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! - ! differencing the diffused and initial states. ! - ! ! - ! Calling sequence: ! - ! ! - !---------------------------Code history-------------------------------------------------------------- ! - ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! - ! Modified by: K Thayer-Calder ! - ! ! - !----------------------------------------------------------------------------------------------------- ! - - use shr_kind_mod, only: r8=>shr_kind_r8 - use ppgrid, only: pver, pverp, pcols, begchunk, endchunk - use phys_control, only: phys_getopts - use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o - - use spmd_utils, only: masterproc - use constituents, only: pcnst, cnst_add - use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev - use zm_conv_intr, only: zmconv_microp -#ifdef CLUBB_SGS - use clubb_api_module, only: pdf_parameter, implicit_coefs_terms - use clubb_api_module, only: clubb_config_flags_type - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad - use cam_history_support, only: add_hist_coord -#endif - - implicit none - private - save - - ! ----------------- ! - ! Public interfaces ! - ! ----------------- ! - - public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, & -#ifdef CLUBB_SGS - ! This utilizes CLUBB specific variables in its interface - stats_init_clubb, & - init_clubb_config_flags, & -#endif - stats_end_timestep_clubb, & - clubb_readnl, & - clubb_init_cnst, & - clubb_implements_cnst - -#ifdef CLUBB_SGS - ! Both of these utilize CLUBB specific variables in their interface - private :: stats_zero, stats_avg -#endif - - logical, public :: do_cldcool - logical :: clubb_do_icesuper - -#ifdef CLUBB_SGS - type(clubb_config_flags_type), public :: clubb_config_flags -#endif - - ! ------------ ! - ! Private data ! - ! ------------ ! - - integer, parameter :: & - grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels - hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements - - real(r8), parameter, dimension(0) :: & - sclr_tol = 1.e-8_r8 ! Total water in kg/kg - - character(len=6) :: saturation_equation - - real(r8), parameter :: & - theta0 = 300._r8, & ! Reference temperature [K] - ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] - p0_clubb = 100000._r8 - - integer, parameter :: & - sclr_dim = 0 ! Higher-order scalars, set to zero - - real(r8), parameter :: & - wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected - - real(r8), parameter :: & - wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected - - real(r8), parameter :: & - wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected - - real(r8), parameter :: & - rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected - - real(r8), parameter :: unset_r8 = huge(1.0_r8) - - real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist - real(r8) :: clubb_rnevap_effic = unset_r8 - - real(r8) :: clubb_c1 = unset_r8 - real(r8) :: clubb_c1b = unset_r8 - real(r8) :: clubb_C2rt = unset_r8 - real(r8) :: clubb_C2thl = unset_r8 - real(r8) :: clubb_C2rtthl = unset_r8 - real(r8) :: clubb_C4 = unset_r8 - real(r8) :: clubb_C8 = unset_r8 - real(r8) :: clubb_C8b = unset_r8 - real(r8) :: clubb_C7 = unset_r8 - real(r8) :: clubb_C7b = unset_r8 - real(r8) :: clubb_c11 = unset_r8 - real(r8) :: clubb_c11b = unset_r8 - real(r8) :: clubb_c14 = unset_r8 - real(r8) :: clubb_c_K9 = unset_r8 - real(r8) :: clubb_nu9 = unset_r8 - real(r8) :: clubb_c_K10 = unset_r8 - real(r8) :: clubb_c_K10h = unset_r8 - real(r8) :: clubb_gamma_coef = unset_r8 - real(r8) :: clubb_gamma_coefb = unset_r8 - real(r8) :: clubb_beta = unset_r8 - real(r8) :: clubb_lambda0_stability_coef = unset_r8 - real(r8) :: clubb_lmin_coef = unset_r8 - real(r8) :: clubb_mult_coef = unset_r8 - real(r8) :: clubb_Skw_denom_coef = unset_r8 - real(r8) :: clubb_skw_max_mag = unset_r8 - real(r8) :: clubb_up2_vp2_factor = unset_r8 - real(r8) :: clubb_C_wp2_splat = unset_r8 - logical :: clubb_l_brunt_vaisala_freq_moist = .false. - logical :: clubb_l_call_pdf_closure_twice = .false. - logical :: clubb_l_damp_wp3_Skw_squared = .false. - logical :: clubb_l_min_wp2_from_corr_wx = .false. - logical :: clubb_l_min_xp2_from_corr_wx = .false. - logical :: clubb_l_predict_upwp_vpwp = .false. - logical :: clubb_l_rcm_supersat_adj = .false. - logical :: clubb_l_stability_correct_tau_zm = .false. - logical :: clubb_l_trapezoidal_rule_zt = .false. - logical :: clubb_l_trapezoidal_rule_zm = .false. - logical :: clubb_l_upwind_xpyp_ta = .false. - logical :: clubb_l_use_C7_Richardson = .false. - logical :: clubb_l_use_C11_Richardson = .false. - logical :: clubb_l_use_cloud_cover = .false. - logical :: clubb_l_use_thvm_in_bv_freq = .false. - logical :: clubb_l_vert_avg_closure = .false. - logical :: clubb_l_diag_Lscale_from_tau = .false. - logical :: clubb_l_damp_wp2_using_em = .false. - -! Constant parameters - logical, parameter, private :: & - l_implemented = .true., & ! Implemented in a host model (always true) - l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes - - logical, parameter, private :: & - apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) - - logical :: lq(pcnst) - logical :: prog_modal_aero - logical :: do_rainturb - logical :: do_expldiff - logical :: clubb_do_adv - logical :: clubb_do_liqsupersat = .false. - logical :: clubb_do_energyfix = .true. - logical :: history_budget - - logical :: clubb_l_lscale_plume_centered - logical :: clubb_l_use_ice_latent - - integer :: history_budget_histfile_num - integer :: edsclr_dim ! Number of scalars to transport in CLUBB - integer :: offset - -! define physics buffer indicies here - integer :: & - wp2_idx, & ! vertical velocity variances - wp3_idx, & ! third moment of vertical velocity - wpthlp_idx, & ! turbulent flux of thetal - wprtp_idx, & ! turbulent flux of total water - rtpthlp_idx, & ! covariance of thetal and rt - rtp2_idx, & ! variance of total water - thlp2_idx, & ! variance of thetal - rtp3_idx, & ! total water 3rd order - thlp3_idx, & ! thetal 3rd order - up2_idx, & ! variance of east-west wind - vp2_idx, & ! variance of north-south wind - up3_idx, & ! east-west wind 3rd order - vp3_idx, & ! north-south wind 3rd order - upwp_idx, & ! east-west momentum flux - vpwp_idx, & ! north-south momentum flux - thlm_idx, & ! mean thetal - rtm_idx, & ! mean total water mixing ratio - um_idx, & ! mean of east-west wind - vm_idx, & ! mean of north-south wind - wpthvp_idx, & ! buoyancy flux - wp2thvp_idx, & ! second order buoyancy term - rtpthvp_idx, & ! moisture buoyancy correlation - thlpthvp_idx, & ! temperature buoyancy correlation - sclrpthvp_idx, & ! passive scalar buoyancy correlation - cloud_frac_idx, & ! CLUBB's cloud fraction - cld_idx, & ! Cloud fraction - concld_idx, & ! Convective cloud fraction - ast_idx, & ! Stratiform cloud fraction - alst_idx, & ! Liquid stratiform cloud fraction - aist_idx, & ! Ice stratiform cloud fraction - qlst_idx, & ! Physical in-cloud LWC - qist_idx, & ! Physical in-cloud IWC - dp_frac_idx, & ! deep convection cloud fraction - sh_frac_idx, & ! shallow convection cloud fraction - kvh_idx, & ! CLUBB eddy diffusivity on thermo levels - pblh_idx, & ! PBL pbuf - icwmrdp_idx, & ! In cloud mixing ratio for deep convection - icwmrsh_idx, & ! In cloud mixing ratio for shallow convection (MF) - tke_idx, & ! turbulent kinetic energy - tpert_idx, & ! temperature perturbation from PBL - fice_idx, & ! fice_idx index in physics buffer - cmeliq_idx, & ! cmeliq_idx index in physics buffer - relvar_idx, & ! relative cloud water variance - accre_enhan_idx, & ! optional accretion enhancement factor for MG - npccn_idx, & ! liquid ccn number concentration - naai_idx, & ! ice number concentration - prer_evap_idx, & ! rain evaporation rate - qrl_idx, & ! longwave cooling rate - radf_idx, & - qsatfac_idx, & ! subgrid cloud water saturation scaling factor - ice_supersat_idx, & ! ice cloud fraction for SILHS - rcm_idx, & ! Cloud water mixing ratio for SILHS - ztodt_idx ! physics timestep for SILHS - - ! Indices for microphysical covariance tendencies - integer :: & - rtp2_mc_zt_idx, & - thlp2_mc_zt_idx, & - wprtp_mc_zt_idx, & - wpthlp_mc_zt_idx, & - rtpthlp_mc_zt_idx - - integer, public :: & - ixthlp2 = 0, & - ixwpthlp = 0, & - ixwprtp = 0, & - ixwp2 = 0, & - ixwp3 = 0, & - ixrtpthlp = 0, & - ixrtp2 = 0, & - ixup2 = 0, & - ixvp2 = 0 - - integer :: cmfmc_sh_idx = 0 - - integer :: & - dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. - difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. - dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. - dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. - - integer :: & - qt_macmic_idx, & - thl_macmic_idx, & - rcm_macmic_idx, & - cldfrac_macmic_idx, & - wpthlp_macmic_idx, & - wprtp_macmic_idx, & - wpthvp_macmic_idx, & - mf_wpthlp_macmic_idx, & - mf_wprtp_macmic_idx, & - mf_wpthvp_macmic_idx - - integer :: & - prec_sh_idx, & - snow_sh_idx - - ! Output arrays for CLUBB statistics - real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc - - character(len=16) :: eddy_scheme ! Default set in phys_control.F90 - character(len=16) :: deep_scheme ! Default set in phys_control.F90 - character(len=16) :: subcol_scheme - - integer, parameter :: ncnst=9 - character(len=8) :: cnst_names(ncnst) - logical :: do_cnst=.false. - -#ifdef CLUBB_SGS - type(pdf_parameter), target, allocatable, public, protected :: & - pdf_params_chnk(:,:) ! PDF parameters (thermo. levs.) [units vary] - type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:,:) ! PDF parameters on momentum levs. [units vary] - type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:,:) ! PDF impl. coefs. & expl. terms [units vary] -#endif - - contains - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_register_cam( ) -!------------------------------------------------------------------------------- -! Description: -! Register the constituents and fields in the physics buffer -! Author: P. Bogenschutz, C. Craig, A. Gettelman -! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns -! -!------------------------------------------------------------------------------- -#ifdef CLUBB_SGS - - !------------------------------------------------ ! - ! Register physics buffer fields and constituents ! - !------------------------------------------------ ! - - ! Add CLUBB fields to pbuf - use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls - use subcol_utils, only: subcol_get_scheme - - integer :: cld_macmic_num_steps - - call phys_getopts( eddy_scheme_out = eddy_scheme, & - deep_scheme_out = deep_scheme, & - history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num, & - cld_macmic_num_steps_out = cld_macmic_num_steps) - - subcol_scheme = subcol_get_scheme() - - if (trim(subcol_scheme) == 'SILHS') then - saturation_equation = "flatau" - else - saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP - end if - - if (clubb_do_adv) then - cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) - do_cnst=.true. - ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments - ! need a constant added to them before they are advected, thus this would corrupt the output. - ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments - call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) - call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) - call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) - end if - - ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top - call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) - call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) - call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) - call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) - call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) - call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) - call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) - call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) - call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) - call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) - call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) - call pbuf_add_field('FICE', 'physpkg',dtype_r8, (/pcols,pver/), fice_idx) - call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) - call pbuf_add_field('CMELIQ', 'physpkg',dtype_r8, (/pcols,pver/), cmeliq_idx) - call pbuf_add_field('QSATFAC', 'physpkg',dtype_r8, (/pcols,pver/), qsatfac_idx) - - - call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) - call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) - call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) - call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) - call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) - call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) - call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) - call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) - call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) - - call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) - call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) - call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) - call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) - - call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) - call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) - call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) - call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) - call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) - call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) - - call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) - call pbuf_add_field('WP2THVP', 'physpkg', dtype_r8, (/pcols,pverp/), wp2thvp_idx) - call pbuf_add_field('RTPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), rtpthvp_idx) - call pbuf_add_field('THLPTHVP', 'physpkg', dtype_r8, (/pcols,pverp/), thlpthvp_idx) - call pbuf_add_field('CLOUD_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), cloud_frac_idx) - call pbuf_add_field('ISS_FRAC', 'physpkg', dtype_r8, (/pcols,pverp/), ice_supersat_idx) - call pbuf_add_field('RCM', 'physpkg', dtype_r8, (/pcols,pverp/), rcm_idx) - call pbuf_add_field('ZTODT', 'physpkg', dtype_r8, (/pcols/), ztodt_idx) - - ! For SILHS microphysical covariance contributions - call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) - call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) - call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) - call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) - call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - - call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') - call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') - - call pbuf_add_field('QT_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) - call pbuf_add_field('THETAL_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) - call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) - call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) - call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) - call pbuf_add_field('WPRTP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) - call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) - if (do_clubb_mf) then - call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) - call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) - call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) - end if - -#endif - - end subroutine clubb_register_cam - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -function clubb_implements_cnst(name) - - !----------------------------------------------------------------------------- ! - ! ! - ! Return true if specified constituent is implemented by this package ! - ! ! - !----------------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - logical :: clubb_implements_cnst ! return value - - !----------------------------------------------------------------------- - - clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) - -end function clubb_implements_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) -#ifdef CLUBB_SGS - use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol -#endif - - !----------------------------------------------------------------------- ! - ! ! - ! Initialize the state if clubb_do_adv ! - ! ! - !----------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) - real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) - logical, intent(in) :: mask(:) ! Only initialize where .true. - real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev - - !----------------------------------------------------------------------- - integer :: k, nlev - -#ifdef CLUBB_SGS - if (clubb_do_adv) then - nlev = size(q, 2) - do k = 1, nlev - if (trim(name) == trim(cnst_names(1))) then - where(mask) - q(:,k) = thl_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(2))) then - where(mask) - q(:,k) = rt_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(3))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(4))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(5))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(6))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(7))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(8))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(9))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - end do - end if -#endif - -end subroutine clubb_init_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_readnl(nlfile) - -#ifdef CLUBB_SGS - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use cam_abortutils, only: endrun - use clubb_api_module, only: l_stats, l_output_rad_files - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8 - use clubb_mf, only: clubb_mf_readnl -#endif - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - -#ifdef CLUBB_SGS - - character(len=*), parameter :: sub = 'clubb_readnl' - - logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & - clubb_expldiff ! Stats enabled (T/F) - - integer :: iunit, read_status, ierr - - namelist /clubb_his_nl/ clubb_history, clubb_rad_history - namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, clubb_expldiff, & - clubb_do_adv, clubb_timestep, & - clubb_rnevap_effic,clubb_do_icesuper - namelist /clubb_params_nl/ clubb_c1, clubb_c1b, clubb_c11, clubb_c11b, clubb_c14, clubb_mult_coef, clubb_gamma_coef, & - clubb_c_K10, clubb_c_K10h, clubb_beta, clubb_C2rt, clubb_C2thl, & - clubb_C2rtthl, clubb_C8, clubb_C8b, clubb_C7, clubb_C7b, clubb_Skw_denom_coef, & - clubb_C4, clubb_c_K9, clubb_nu9, clubb_C_wp2_splat, & - clubb_lambda0_stability_coef, clubb_l_lscale_plume_centered, & - clubb_l_use_ice_latent, clubb_do_liqsupersat, clubb_do_energyfix,& - clubb_lmin_coef, clubb_skw_max_mag, clubb_l_stability_correct_tau_zm, & - clubb_gamma_coefb, clubb_up2_vp2_factor, & - clubb_l_use_C7_Richardson, clubb_l_use_C11_Richardson, & - clubb_l_brunt_vaisala_freq_moist, clubb_l_use_thvm_in_bv_freq, & - clubb_l_rcm_supersat_adj, clubb_l_damp_wp3_Skw_squared, & - clubb_l_predict_upwp_vpwp, clubb_l_min_wp2_from_corr_wx, & - clubb_l_min_xp2_from_corr_wx, clubb_l_upwind_xpyp_ta, clubb_l_vert_avg_closure, & - clubb_l_trapezoidal_rule_zt, clubb_l_trapezoidal_rule_zm, & - clubb_l_call_pdf_closure_twice, clubb_l_use_cloud_cover, & - clubb_l_diag_Lscale_from_tau, clubb_l_damp_wp2_using_em - - !----- Begin Code ----- - - ! Determine if we want clubb_history to be output - clubb_history = .false. ! Initialize to false - l_stats = .false. ! Initialize to false - l_output_rad_files = .false. ! Initialize to false - do_cldcool = .false. ! Initialize to false - do_rainturb = .false. ! Initialize to false - do_expldiff = .false. ! Initialize to false - - clubb_l_lscale_plume_centered = .false. ! Initialize to false! - clubb_l_use_ice_latent = .false. ! Initialize to false! - - ! Call CLUBB+MF namelist - call clubb_mf_readnl(nlfile) - - ! Read namelist to determine if CLUBB history should be called - if (masterproc) then - iunit = getunit() - open( iunit, file=trim(nlfile), status='old' ) - - call find_group_name(iunit, 'clubb_his_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_his_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - call find_group_name(iunit, 'clubb_params_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_params_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - else - call endrun('clubb_readnl: error reading namelist') - end if - - call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") - call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") - call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") - call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") - call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") - call mpi_bcast(clubb_expldiff, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_expldiff") - call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") - call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") - call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") - - call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") - call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") - call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") - call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") - call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") - call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") - call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") - call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") - call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") - call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") - call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") - call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") - call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") - call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") - call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") - call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") - call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") - call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") - call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") - call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") - call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") - call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") - call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") - call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") - call mpi_bcast(clubb_l_use_ice_latent, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_ice_latent") - call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") - call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") - - call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") - call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") - call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") - call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") - call mpi_bcast(clubb_up2_vp2_factor, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_vp2_factor") - - call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") - call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") - call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") - call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") - call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") - call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") - call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") - call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") - call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") - call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") - call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") - call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") - call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") - call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") - call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") - call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") - call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") - - ! Overwrite defaults if they are true - if (clubb_history) l_stats = .true. - if (clubb_rad_history) l_output_rad_files = .true. - if (clubb_cloudtop_cooling) do_cldcool = .true. - if (clubb_rainevap_turb) do_rainturb = .true. - if (clubb_expldiff) do_expldiff = .true. - -! Check that all namelists have been set - if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") - if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") - - if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") - if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") - if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") - if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") - if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") - if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") - if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") - if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") - if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") - if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") - if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") - if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") - if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") - if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") - if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") - if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") - if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") - if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") - if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") - if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") - if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") - if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") - if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") - if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") - if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") - if(clubb_up2_vp2_factor == unset_r8) call endrun(sub//": FATAL: clubb_up2_vp2_factor is not set") - if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") - -#endif - end subroutine clubb_readnl - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_ini_cam(pbuf2d) -!------------------------------------------------------------------------------- -! Description: -! Initialize UWM CLUBB. -! Author: Cheryl Craig March 2011 -! Modifications: Pete Bogenschutz 2011 March and onward -! Modifications: K Thayer-Calder 2013 July and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - - -#ifdef CLUBB_SGS - - ! From CAM libraries - use cam_history, only: addfld, add_default, horiz_only - use ref_pres, only: pref_mid - use hb_diff, only: init_hb_diff - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx - use cam_abortutils, only: endrun - - ! From the CLUBB libraries - use clubb_api_module, only: core_rknd, & - iC11, iC11b, ibeta, iSkw_denom_coef, & ! Constant(s) - em_min, & - iC1, iC1b, iC2rt, iC2thl, iC2rtthl, igamma_coef, igamma_coefb, & - imult_coef, ic_K10, iskw_max_mag, & - iC8, iC8b, iC11, iC11b, iC4, iC14, iup2_vp2_factor, params_list - - - - use clubb_api_module, only: & - print_clubb_config_flags_api, & - setup_clubb_core_api, & - init_pdf_params_api, & - init_pdf_implicit_coefs_terms_api, & - time_precision, & - core_rknd, & - set_clubb_debug_level_api, & - clubb_fatal_error, & ! Error code value to indicate a fatal error - nparams, & - read_parameters_api, & - l_stats, & - l_stats_samp, & - l_grads, & - stats_zt, & - stats_zm, & - stats_sfc, & - stats_rad_zt, & - stats_rad_zm, & - w_tol_sqd, & - rt_tol, & - thl_tol - - ! These are only needed if we're using a passive scalar - use clubb_api_module, only: & - iisclr_rt, & - iisclr_thl, & - iisclr_CO2, & - iiedsclr_rt, & - iiedsclr_thl, & - iiedsclr_CO2 - - ! These are needed to set parameters - use clubb_api_module, only: & - ilambda0_stability_coef, ic_K10, ic_K10h, iC2rtthl, iC7, iC7b, iC8, iC8b, iC11, iC11b, & - iC14, igamma_coef, imult_coef, ilmin_coef, iSkw_denom_coef, ibeta, iskw_max_mag, & - iC2rt, iC2thl, iC2rtthl, ic_K9, inu9, iC_wp2_splat - - use time_manager, only: is_first_step - use clubb_api_module, only: hydromet_dim - use constituents, only: cnst_get_ind - use phys_control, only: phys_getopts - use spmd_utils, only: iam - use cam_logfile, only: iulog -#endif - - use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc - implicit none - ! Input Variables - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - -#ifdef CLUBB_SGS - - real(kind=time_precision) :: dum1, dum2, dum3 - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - - ! The similar name to clubb_history is unfortunate... - logical :: history_amwg, history_clubb - - integer :: cld_macmic_num_steps - - integer :: err_code ! Code for when CLUBB fails - integer :: j, k, l ! Indices - integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) - integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) - integer :: nmodes, nspec, m - integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice - integer :: lptr - - logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. - logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. - - real(r8) :: zt_g(pverp+1-top_lev) ! Height dummy array - real(r8) :: zi_g(pverp+1-top_lev) ! Height dummy array - - ! CAM defines zi at the surface to be zero. - real(r8), parameter :: sfc_elevation = 0._r8 - - integer :: nlev - - !----- Begin Code ----- - - nlev = pver + 1 - top_lev - - if (core_rknd /= r8) then - call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') - end if - - ! Allocate PDF parameters across columns and chunks - allocate( & - pdf_params_chnk(pcols,begchunk:endchunk), & - pdf_params_zm_chnk(pcols,begchunk:endchunk), & - pdf_implicit_coefs_terms_chnk(pcols,begchunk:endchunk) ) - - ! Allocate (in the vertical) and zero PDF parameters - do l = begchunk, endchunk, 1 - do j = 1, pcols, 1 - call init_pdf_params_api( pverp+1-top_lev, pdf_params_chnk(j,l) ) - call init_pdf_params_api( pverp+1-top_lev, pdf_params_zm_chnk(j,l) ) - call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, sclr_dim, & - pdf_implicit_coefs_terms_chnk(j,l) ) - enddo ! j = 1, pcols, 1 - enddo ! l = begchunk, endchunk, 1 - - ! ----------------------------------------------------------------- ! - ! Determine how many constituents CLUBB will transport. Note that - ! CLUBB does not transport aerosol consituents. Therefore, need to - ! determine how many aerosols constituents there are and subtract that - ! off of pcnst (the total consituents) - ! ----------------------------------------------------------------- ! - - call phys_getopts(prog_modal_aero_out=prog_modal_aero, & - history_amwg_out=history_amwg, & - history_clubb_out=history_clubb, & - cld_macmic_num_steps_out = cld_macmic_num_steps) - - ! Select variables to apply tendencies back to CAM - - ! Initialize all consituents to true to start - lq(1:pcnst) = .true. - edsclr_dim = pcnst - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('NUMICE',ixnumice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - - if (prog_modal_aero) then - ! Turn off modal aerosols and decrement edsclr_dim accordingly - call rad_cnst_get_info(0, nmodes=nmodes) - - do m = 1, nmodes - call rad_cnst_get_mode_num_idx(m, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - - call rad_cnst_get_info(0, m, nspec=nspec) - do l = 1, nspec - call rad_cnst_get_mam_mmr_idx(m, l, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - end do - end do - - ! In addition, if running with MAM, droplet number is transported - ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport - ! tendencies to avoid double counted. Else, we apply tendencies. - lq(ixnumliq) = .false. - edsclr_dim = edsclr_dim-1 - endif - - ! ----------------------------------------------------------------- ! - ! Set the debug level. Level 2 has additional computational expense since - ! it checks the array variables in CLUBB for invalid values. - ! ----------------------------------------------------------------- ! - call set_clubb_debug_level_api( 0 ) - - ! ----------------------------------------------------------------- ! - ! use pbuf_get_fld_idx to get existing physics buffer fields from other - ! physics packages (e.g. tke) - ! ----------------------------------------------------------------- ! - - - ! Defaults - l_stats_samp = .false. - l_grads = .false. - - ! Overwrite defaults if needbe - if (l_stats) l_stats_samp = .true. - - ! Define physics buffers indexes - cld_idx = pbuf_get_index('CLD') ! Cloud fraction - concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover - ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction - alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction - aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction - qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC - qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC - dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction - icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio - icwmrsh_idx = pbuf_get_index('ICWMRSH') ! In-cloud shallow convective mixing ratio (EDMF) - sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction - relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance - accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG - prer_evap_idx = pbuf_get_index('PRER_EVAP') - qrl_idx = pbuf_get_index('QRL') - cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') - naai_idx = pbuf_get_index('NAAI') - npccn_idx = pbuf_get_index('NPCCN') - - prec_sh_idx = pbuf_get_index('PREC_SH') - snow_sh_idx = pbuf_get_index('SNOW_SH') - - iisclr_rt = -1 - iisclr_thl = -1 - iisclr_CO2 = -1 - - iiedsclr_rt = -1 - iiedsclr_thl = -1 - iiedsclr_CO2 = -1 - - if (zmconv_microp) then - dlfzm_idx = pbuf_get_index('DLFZM') - difzm_idx = pbuf_get_index('DIFZM') - dnlfzm_idx = pbuf_get_index('DNLFZM') - dnifzm_idx = pbuf_get_index('DNIFZM') - end if - - ! ----------------------------------------------------------------- ! - ! Define number of tracers for CLUBB to diffuse - ! ----------------------------------------------------------------- ! - - if (do_expldiff) then - offset = 2 ! diffuse temperature and moisture explicitly - edsclr_dim = edsclr_dim + offset - endif - - ! ----------------------------------------------------------------- ! - ! Setup CLUBB core - ! ----------------------------------------------------------------- ! - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Fill in dummy arrays for height. Note that these are overwrote - ! at every CLUBB step to physical values. - do k=1,nlev+1 - zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage - zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage - enddo - - clubb_params(iC2rtthl) = clubb_C2rtthl - clubb_params(iC8) = clubb_C8 - clubb_params(iC11) = clubb_c11 - clubb_params(iC11b) = clubb_c11b - clubb_params(iC14) = clubb_c14 - clubb_params(ic_K10) = clubb_c_K10 - clubb_params(imult_coef) = clubb_mult_coef - clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef - clubb_params(iC2rt) = clubb_C2rt - clubb_params(iC2thl) = clubb_C2thl - clubb_params(ibeta) = clubb_beta - clubb_params(iC7) = clubb_C7 - clubb_params(iC7b) = clubb_C7b - clubb_params(igamma_coef) = clubb_gamma_coef - clubb_params(ic_K10h) = clubb_c_K10h - clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef - clubb_params(ilmin_coef) = clubb_lmin_coef - clubb_params(iC8b) = clubb_C8b - clubb_params(iskw_max_mag) = clubb_skw_max_mag - clubb_params(iC1) = clubb_C1 - clubb_params(iC1b) = clubb_C1b - clubb_params(igamma_coefb) = clubb_gamma_coefb - clubb_params(iup2_vp2_factor) = clubb_up2_vp2_factor - clubb_params(iC4) = clubb_C4 - clubb_params(ic_K9) = clubb_c_K9 - clubb_params(inu9) = clubb_nu9 - clubb_params(iC_wp2_splat) = clubb_C_wp2_splat - - call init_clubb_config_flags( clubb_config_flags ) ! In/Out - clubb_config_flags%l_use_C7_Richardson = clubb_l_use_C7_Richardson - clubb_config_flags%l_use_C11_Richardson = clubb_l_use_C11_Richardson - clubb_config_flags%l_brunt_vaisala_freq_moist = clubb_l_brunt_vaisala_freq_moist - clubb_config_flags%l_use_thvm_in_bv_freq = clubb_l_use_thvm_in_bv_freq - clubb_config_flags%l_rcm_supersat_adj = clubb_l_rcm_supersat_adj - clubb_config_flags%l_damp_wp3_Skw_squared = clubb_l_damp_wp3_Skw_squared - clubb_config_flags%l_predict_upwp_vpwp = clubb_l_predict_upwp_vpwp - clubb_config_flags%l_min_wp2_from_corr_wx = clubb_l_min_wp2_from_corr_wx - clubb_config_flags%l_min_xp2_from_corr_wx = clubb_l_min_xp2_from_corr_wx - clubb_config_flags%l_upwind_xpyp_ta = clubb_l_upwind_xpyp_ta - clubb_config_flags%l_vert_avg_closure = clubb_l_vert_avg_closure - clubb_config_flags%l_trapezoidal_rule_zt = clubb_l_trapezoidal_rule_zt - clubb_config_flags%l_trapezoidal_rule_zm = clubb_l_trapezoidal_rule_zm - clubb_config_flags%l_call_pdf_closure_twice = clubb_l_call_pdf_closure_twice - clubb_config_flags%l_use_cloud_cover = clubb_l_use_cloud_cover - clubb_config_flags%l_stability_correct_tau_zm = clubb_l_stability_correct_tau_zm - clubb_config_flags%l_do_expldiff_rtm_thlm = do_expldiff - clubb_config_flags%l_Lscale_plume_centered = clubb_l_lscale_plume_centered - clubb_config_flags%l_use_ice_latent = clubb_l_use_ice_latent - clubb_config_flags%l_diag_Lscale_from_tau = clubb_l_diag_Lscale_from_tau - clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em - clubb_config_flags%l_update_pressure = l_update_pressure - - - ! Set up CLUBB core. Note that some of these inputs are overwritten - ! when clubb_tend_cam is called. The reason is that heights can change - ! at each time step, which is why dummy arrays are read in here for heights - ! as they are immediately overwrote. -!$OMP PARALLEL - call setup_clubb_core_api & - ( nlev+1, theta0, ts_nudge, & ! In - hydromet_dim, sclr_dim, & ! In - sclr_tol, edsclr_dim, clubb_params, & ! In - l_host_applies_sfc_fluxes, & ! In - saturation_equation, & ! In - l_input_fields, & - l_implemented, grid_type, zi_g(2), zi_g(1), zi_g(nlev+1),& ! In - zi_g(1:nlev+1), zt_g(1:nlev+1), sfc_elevation, & ! In - clubb_config_flags%l_predict_upwp_vpwp, & ! In - clubb_config_flags%l_use_ice_latent, & ! In - clubb_config_flags%l_prescribed_avg_deltaz, & ! In - clubb_config_flags%l_damp_wp2_using_em, & ! In - clubb_config_flags%l_stability_correct_tau_zm, & ! In - err_code ) - - if ( err_code == clubb_fatal_error ) then - call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') - end if -!$OMP END PARALLEL - - ! Print the list of CLUBB parameters - if ( masterproc ) then - do j = 1, nparams, 1 - write(iulog,*) params_list(j), " = ", clubb_params(j) - enddo - endif - - ! Print configurable CLUBB flags - call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) - - ! ----------------------------------------------------------------- ! - ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! - ! ----------------------------------------------------------------- ! - - ! Initialize eddy diffusivity module - - ntop_eddy = 1 ! if >1, must be <= nbot_molec - nbot_eddy = pver ! currently always pver - - call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) - - ! ----------------------------------------------------------------- ! - ! Add output fields for the history files - ! ----------------------------------------------------------------- ! - - ! These are default CLUBB output. Not the higher order history budgets - call addfld ('RHO_CLUBB', (/ 'ilev' /), 'A', 'kg/m3', 'Air Density') - call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') - call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') - call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') - call addfld ('WP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') - call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') - call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') - call addfld ('WP3_CLUBB', (/ 'ilev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') - call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') - call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') - call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'g^2/kg^2', 'Moisture Variance') - call addfld ('RTP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') - call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') - call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') - call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') - call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') - call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') - call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') - call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') - call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') - call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') - call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') - call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') - call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Ice Tendency') - call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') - call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') - call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') - call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') - call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') - call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') - call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') - call addfld ('THETAL', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') - call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') - call addfld ('QT', (/ 'lev' /), 'A', 'kg/kg', 'Total water mixing ratio') - call addfld ('SL', (/ 'lev' /), 'A', 'J/kg', 'Liquid water static energy') - call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') - call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') - call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') - call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') - call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - - - call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') - - call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') - call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') - call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') - call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') - call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') - - - call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') - call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') - call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') - call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') - - call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') - call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') - call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') - - call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') - call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') - - ! ---------------------------------------------------------------------------- ! - ! Below are for detailed analysis of EDMF Scheme ! - ! ---------------------------------------------------------------------------- ! - - if (do_clubb_mf) then - call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) - call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) - call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) - call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) - call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) - call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) - call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) - call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) - call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) - call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) - call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thv flux (EDMF)' ) - call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) - call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) - call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) - call addfld ( 'edmf_thflx' , (/ 'ilev' /), 'A', 'K m/s' , 'th flux (EDMF)' ) - call addfld ( 'edmf_qvflx' , (/ 'ilev' /), 'A', 'kg/kg m/s' , 'qv flux (EDMF)' ) - call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) - call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) - call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) - call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') - call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') - call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) - call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) - call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) - call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) - call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) - call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) - call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) - end if - - call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') - call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') - call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') - call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') - call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') - call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') - if (do_clubb_mf) then - call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) - end if - - ! Initialize statistics, below are dummy variables - dum1 = 300._r8 - dum2 = 1200._r8 - dum3 = 300._r8 - - if (l_stats) then - - call stats_init_clubb( .true., dum1, dum2, & - nlev+1, nlev+1, nlev+1, dum3 ) - - allocate(out_zt(pcols,pverp,stats_zt%num_output_fields)) - allocate(out_zm(pcols,pverp,stats_zm%num_output_fields)) - allocate(out_sfc(pcols,1,stats_sfc%num_output_fields)) - - allocate(out_radzt(pcols,pverp,stats_rad_zt%num_output_fields)) - allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) - - endif - - ! ----------------------------------------------------------------- ! - ! Make all of this output default, this is not CLUBB history - ! ----------------------------------------------------------------- ! - - if (clubb_do_adv .or. history_clubb) then - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UP2_CLUBB', 1, ' ') - call add_default('VP2_CLUBB', 1, ' ') - call add_default('WP2_CLUBB', 1, ' ') - call add_default('WP2_ZT_CLUBB', 1, ' ') - call add_default('WP3_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('WPTHLP_CLUBB', 1, ' ') - call add_default('WPRTP_CLUBB', 1, ' ') - call add_default('RTP2_CLUBB', 1, ' ') - call add_default('RTP2_ZT_CLUBB', 1, ' ') - call add_default('PDFP_RTP2_CLUBB', 1, ' ') - call add_default('THLP2_CLUBB', 1, ' ') - call add_default('THLP2_ZT_CLUBB', 1, ' ') - call add_default('RTPTHLP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('WM_ZT_CLUBB', 1, ' ') - call add_default('PBLH', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('THETAL', 1, ' ') - call add_default('CONCLD', 1, ' ') - call add_default('TKE_CLUBB', 1, ' ') - call add_default('ELEAK_CLUBB', 1, ' ') - call add_default('TFIX_CLUBB', 1, ' ') - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_clubb) then - - call add_default('RELVAR', 1, ' ') - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('CONCLD', 1, ' ') - - if (do_clubb_mf_diag) then - call add_default( 'edmf_DRY_A' , 1, ' ') - call add_default( 'edmf_MOIST_A' , 1, ' ') - call add_default( 'edmf_DRY_W' , 1, ' ') - call add_default( 'edmf_MOIST_W' , 1, ' ') - call add_default( 'edmf_DRY_QT' , 1, ' ') - call add_default( 'edmf_MOIST_QT' , 1, ' ') - call add_default( 'edmf_DRY_THL' , 1, ' ') - call add_default( 'edmf_MOIST_THL', 1, ' ') - call add_default( 'edmf_DRY_U' , 1, ' ') - call add_default( 'edmf_MOIST_U' , 1, ' ') - call add_default( 'edmf_DRY_V' , 1, ' ') - call add_default( 'edmf_MOIST_V' , 1, ' ') - call add_default( 'edmf_MOIST_QC' , 1, ' ') - call add_default( 'edmf_precc' , 1, ' ') - call add_default( 'edmf_S_AE' , 1, ' ') - call add_default( 'edmf_S_AW' , 1, ' ') - call add_default( 'edmf_S_AWTH' , 1, ' ') - call add_default( 'edmf_S_AWTHL' , 1, ' ') - call add_default( 'edmf_S_AWQT' , 1, ' ') - call add_default( 'edmf_S_AWU' , 1, ' ') - call add_default( 'edmf_S_AWV' , 1, ' ') - call add_default( 'edmf_thlflx' , 1, ' ') - call add_default( 'edmf_thvflx' , 1, ' ') - call add_default( 'edmf_qtflx' , 1, ' ') - call add_default( 'edmf_thlforc' , 1, ' ') - call add_default( 'edmf_qtforc' , 1, ' ') - call add_default( 'edmf_thflx' , 1, ' ') - call add_default( 'edmf_qvflx' , 1, ' ') - call add_default( 'edmf_thforc' , 1, ' ') - call add_default( 'edmf_qvforc' , 1, ' ') - call add_default( 'edmf_qcforc' , 1, ' ') - call add_default( 'edmf_rcm' , 1, ' ') - call add_default( 'edmf_cloudfrac', 1, ' ') - call add_default( 'edmf_ztop' , 1, ' ') - call add_default( 'edmf_L0' , 1, ' ') - call add_default( 'edmf_cape' , 1, ' ') - end if - call add_default( 'QT_macmic' , 1, ' ') - call add_default( 'THETAL_macmic' , 1, ' ') - call add_default( 'RCM_CLUBB_macmic' , 1, ' ') - call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') - call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') - if (do_clubb_mf_diag) then - call add_default( 'edmf_thlflx_macmic' , 1, ' ') - call add_default( 'edmf_qtflx_macmic' , 1, ' ') - call add_default( 'edmf_thvflx_macmic' , 1, ' ') - end if - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_budget) then - call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') - call add_default('DPDLFICE', history_budget_histfile_num, ' ') - call add_default('DPDLFT', history_budget_histfile_num, ' ') - call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') - endif - - - ! --------------- ! - ! First step? ! - ! Initialization ! - ! --------------- ! - - ! Is this the first time step? If so then initialize CLUBB variables as follows - if (is_first_step()) then - - call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) - call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) - call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) - - call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) - - call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) - call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) - - ! Initialize SILHS covariance contributions - call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) - endif - - ! The following is physpkg, so it needs to be initialized every time - call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) - - ! --------------- ! - ! End ! - ! Initialization ! - ! --------------- ! - -#endif - end subroutine clubb_ini_cam - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_tend_cam( & - state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & - macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) - -!------------------------------------------------------------------------------- -! Description: Provide tendencies of shallow convection, turbulence, and -! macrophysics from CLUBB to CAM -! -! Author: Cheryl Craig, March 2011 -! Modifications: Pete Bogenschutz, March 2011 and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - use physics_types, only: physics_state, physics_ptend, & - physics_state_copy, physics_ptend_init, & - physics_ptend_sum, physics_update, set_dry_to_wet - use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc - - use constituents, only: cnst_get_ind, cnst_type - use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use tropopause, only: tropopause_findChemTrop - use time_manager, only: get_nstep - -#ifdef CLUBB_SGS - use hb_diff, only: pblintd - use scamMOD, only: single_column,scm_clubb_iop_name - use clubb_api_module, only: & - nparams, & - read_parameters_api, & - setup_parameters_api, & - time_precision, & - advance_clubb_core_api, & - zt2zm_api, zm2zt_api, & - setup_grid_heights_api, & - em_min, & - w_tol_sqd, & - rt_tol, & - thl_tol, & - l_stats, & - stats_tsamp, & - stats_tout, & - stats_zt, & - stats_sfc, & - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - l_output_rad_files, & - stats_begin_timestep_api, & - hydromet_dim, calculate_thlp2_rad_api, mu, update_xp2_mc_api, & - sat_mixrat_liq_api, & - fstderr - - use clubb_api_module, only: & - clubb_fatal_error ! Error code value to indicate a fatal error - - use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const - use cam_history, only: outfld - - use macrop_driver, only: liquid_macro_tend - use clubb_mf, only: integrate_mf - -#endif - - implicit none - - ! --------------- ! - ! Input Auguments ! - ! --------------- ! - - type(physics_state), intent(in) :: state ! Physics state variables [vary] - type(cam_in_t), intent(in) :: cam_in - real(r8), intent(in) :: hdtime ! Host model timestep [s] - real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] - real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] - integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations - integer, intent(in) :: macmic_it ! number of mac-mic iterations - - ! ---------------------- ! - ! Input-Output Auguments ! - ! ---------------------- ! - - type(physics_buffer_desc), pointer :: pbuf(:) - - ! ---------------------- ! - ! Output Auguments ! - ! ---------------------- ! - - type(physics_ptend), intent(out) :: ptend_all ! package tendencies - - ! These two variables are needed for energy check - real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice - real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check - - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - -#ifdef CLUBB_SGS - - type(physics_state) :: state1 ! Local copy of state variable - type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all - - integer :: i, j, k, t, ixind, nadv - integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq - integer :: itim_old - integer :: ncol, lchnk ! # of columns, and chunk identifier - integer :: err_code ! Diagnostic, for if some calculation goes amiss. - integer :: icnt, clubbtop - logical :: lq2(pcnst) - - integer :: iter - - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] - real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] - real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] - real(r8) :: tke_in(pverp+1-top_lev) ! TKE - real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] - real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] - real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] - real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] - real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] - real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] - real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] - real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] - real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] - real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] - real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] - real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] - real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] - real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] - real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] - real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] - real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] - real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] - real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] - real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] - real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap - real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap - real(r8) :: wprtp_mc_out(pverp+1-top_lev) - real(r8) :: wpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] - real(r8) :: rcm_out_zm(pverp+1-top_lev) - real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] - real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] - real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] - real(r8) :: thlprcp_out(pverp+1-top_lev) - real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] - real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] - real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] - real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] - real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] - real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] - real(r8) :: rfrzm(pverp+1-top_lev) - real(r8) :: radf(pverp+1-top_lev) - real(r8) :: wprtp_forcing(pverp+1-top_lev) - real(r8) :: wpthlp_forcing(pverp+1-top_lev) - real(r8) :: rtp2_forcing(pverp+1-top_lev) - real(r8) :: thlp2_forcing(pverp+1-top_lev) - real(r8) :: rtpthlp_forcing(pverp+1-top_lev) - real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) - real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] - real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: fcor ! Coriolis forcing [s^-1] - real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] - real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] - real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] - real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] - real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] - real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] - real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] - real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] - real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] - real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] - real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] - real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] - real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] - real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] - real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] - real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] - real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] - real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] - real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] - real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) - real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) - real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) - real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) - real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) - real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] - real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo ! roughness height [m] - real(r8) :: dz_g(pver) ! thickness of layer [m] - real(r8) :: relvarmax - real(r8) :: se_upper_a, se_upper_b, se_upper_diss - real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss - real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - real(r8) :: host_dx, host_dy ! CAM grid [m] - - ! Variables below are needed to compute energy integrals for conservation - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: qrl_clubb(pverp+1-top_lev) - real(r8) :: qrl_zm(pverp+1-top_lev) - real(r8) :: thlp2_rad_out(pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend - - ! --------------- ! - ! Pointers ! - ! --------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - - real(r8),pointer :: prec_sh(:) ! total precipitation from MF - real(r8),pointer :: snow_sh(:) ! snow from MF - - real(r8), pointer :: qt_macmic(:,:) - real(r8), pointer :: thl_macmic(:,:) - real(r8), pointer :: rcm_macmic(:,:) - real(r8), pointer :: cldfrac_macmic(:,:) - real(r8), pointer :: wpthlp_macmic(:,:) - real(r8), pointer :: wprtp_macmic(:,:) - real(r8), pointer :: wpthvp_macmic(:,:) - real(r8), pointer :: mf_thlflx_macmic(:,:) - real(r8), pointer :: mf_qtflx_macmic(:,:) - real(r8), pointer :: mf_thvflx_macmic(:,:) - - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface - - ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthl_output, s_awqt_output, & - s_awql_output, s_awqi_output, & - s_awth_output, s_awqv_output, & - s_awu_output, s_awv_output, & - mf_thflx_output, mf_qvflx_output, & - mf_thlflx_output, mf_qtflx_output, & - mf_thvflx_output, & - mf_rcm_output, & - mf_precc_output - ! - real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & - mf_cape_output - ! - ! MF outputs to outfld - real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid - mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output, & ! thermodynamic grid - mf_qc_output, mf_cloudfrac_output ! thermodynamic grid - - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & - mf_upw_flip, & - mf_upqt_flip, & - mf_upthl_flip, & - mf_upthv_flip, & - mf_upth_flip, & - mf_upqc_flip, & - mf_upbuoy_flip, & - mf_upent_flip - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & - mf_upw_output, & - mf_upqt_output, & - mf_upthl_output, & - mf_upthv_output, & - mf_upth_output, & - mf_upqc_output, & - mf_upent_output - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output - - ! MF Plume - real(r8), pointer :: tpert(:) - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - mf_sqt, mf_sthl, & - mf_precc, & - s_ae, s_aw, & - s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awth, s_awqv, & - s_awu, s_awv, & - mf_thflx, mf_qvflx, & - mf_thlflx, mf_qtflx, & - mf_thvflx, mf_qcflx, & - mf_thforc, mf_qvforc, & - mf_qcforc, & - mf_rcm, mf_cloudfrac, & - mf_qc_zt, mf_cloudfrac_zt - - ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & - mf_upw, & - mf_upqt, & - mf_upthl, & - mf_upthv, & - mf_upth, & - mf_upqc, & - mf_upbuoy, & - mf_upent - ! CFL limiter vars - real(r8), dimension(pcols) :: max_cfl - real(r8) :: cflval, cflfac - logical :: cfllim - - ! MF local vars - real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - th_zt, qv_zt, & ! momentum grid - th_zm, qv_zm, & ! momentum grid - qc_zm, & ! momentum grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - dzm, invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - - - integer :: nlev - - intrinsic :: max - - character(len=*), parameter :: subr='clubb_tend_cam' - -#endif - det_s(:) = 0.0_r8 - det_ice(:) = 0.0_r8 -#ifdef CLUBB_SGS - - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - ! MAIN COMPUTATION BEGINS HERE ! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - !-----------------------------------------------------------------------------------------------! - - nlev = pver + 1 - top_lev - - rtp2_zt_out = 0._r8 - thl2_zt_out = 0._r8 - wp2_zt_out = 0._r8 - pdfp_rtp2 = 0._r8 - wm_zt_out = 0._r8 - - frac_limit = 0.01_r8 - ic_limit = 1.e-12_r8 - - if (clubb_do_adv) then - apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected - else - apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected - endif - - ! Get indicees for cloud and ice mass and cloud and ice number - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('NUMICE',ixnumice) - - if (clubb_do_icesuper) then - call pbuf_get_field(pbuf, naai_idx, naai) - end if - - ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine - call physics_ptend_init(ptend_all, state%psetcols, 'clubb') - - ! Copy the state to state1 array to use in this routine - call physics_state_copy(state, state1) - - ! constituents are all treated as wet mmr by clubb - call set_dry_to_wet(state1) - - if (clubb_do_liqsupersat) then - call pbuf_get_field(pbuf, npccn_idx, npccn) - endif - - ! Determine number of columns and which chunk computation is to be performed on - - ncol = state%ncol - lchnk = state%lchnk - - ! Determine time step of physics buffer - itim_old = pbuf_old_tim_idx() - - ! Establish associations between pointers and physics buffer fields - - call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) - call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) - call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) - call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) - call pbuf_get_field(pbuf, rcm_idx, rcm) - call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) - call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - - call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) - call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) - - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - - call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) - call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) - call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) - call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) - call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) - call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) - call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) - if (do_clubb_mf) then - call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) - call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) - call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) - call pbuf_get_field(pbuf, tpert_idx, tpert) - end if - - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then - apply_const = 0._r8 ! On first time through do not remove constant - ! from moments since it has not been added yet - endif - - ! Set the ztodt timestep in pbuf for SILHS - ztodtptr(:) = 1.0_r8*hdtime - - ! Define the grid box size. CLUBB needs this information to determine what - ! the maximum length scale should be. This depends on the column for - ! variable mesh grids and lat-lon grids - if (single_column) then - ! If single column specify grid box size to be something - ! similar to a GCM run - grid_dx(:) = 100000._r8 - grid_dy(:) = 100000._r8 - else - - call grid_size(state1, grid_dx, grid_dy) - - end if - - if (clubb_do_icesuper) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - lq2(:) = .FALSE. - lq2(1) = .TRUE. - lq2(ixcldice) = .TRUE. - lq2(ixnumice) = .TRUE. - - latsub = latvap + latice - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qitend(:ncol,:)=0._r8 - initend(:ncol,:)=0._r8 - - call ice_macro_tend(naai(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & - state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,1),state1%q(:ncol,top_lev:pver,ixcldice),& - state1%q(:ncol,top_lev:pver,ixnumice),latsub,hdtime,& - stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qitend(:ncol,top_lev:pver),& - initend(:ncol,top_lev:pver)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - !Write output for tendencies: - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QITENDICE', qitend, pcols, lchnk ) - call outfld( 'NITENDICE', initend, pcols, lchnk ) - - endif - - - ! Determine CLUBB time step and make it sub-step friendly - ! For now we want CLUBB time step to be 5 min since that is - ! what has been scientifically validated. However, there are certain - ! instances when a 5 min time step will not be possible (based on - ! host model time step or on macro-micro sub-stepping - - dtime = clubb_timestep - - ! Now check to see if dtime is greater than the host model - ! (or sub stepped) time step. If it is, then simply - ! set it equal to the host (or sub step) time step. - ! This section is mostly to deal with small host model - ! time steps (or small sub-steps) - - if (dtime > hdtime) then - dtime = hdtime - endif - - ! Now check to see if CLUBB time step divides evenly into - ! the host model time step. If not, force it to divide evenly. - ! We also want it to be 5 minutes or less. This section is - ! mainly for host model time steps that are not evenly divisible - ! by 5 minutes - - if (mod(hdtime,dtime) .ne. 0) then - dtime = hdtime/2._r8 - do while (dtime > clubb_timestep) - dtime = dtime/2._r8 - end do - endif - - ! If resulting host model time step and CLUBB time step do not divide evenly - ! into each other, have model throw a fit. - - if (mod(hdtime,dtime) .ne. 0) then - call endrun(subr//': CLUBB time step and HOST time step NOT compatible') - endif - - ! determine number of timesteps CLUBB core should be advanced, - ! host time step divided by CLUBB time step - nadv = max(hdtime/dtime,1._r8) - - ! Initialize forcings for transported scalars to zero - - sclrm_forcing(:,:) = 0._r8 - edsclrm_forcing(:,:) = 0._r8 - sclrm(:,:) = 0._r8 - - ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant - ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent - ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables - ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state - - do k=1,pver - do i=1,ncol - inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) - enddo - enddo - - ! At each CLUBB call, initialize mean momentum and thermo CLUBB state - ! from the CAM state - - do k=1,pver ! loop over levels - do i=1,ncol ! loop over columns - - rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) - rvm(i,k) = state1%q(i,k,ixq) - um(i,k) = state1%u(i,k) - vm(i,k) = state1%v(i,k) - thlm(i,k) = ( state1%t(i,k) & - - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & - * inv_exner_clubb(i,k) - - if (clubb_do_adv) then - if (macmic_it == 1) then - - ! Note that some of the moments below can be positive or negative. - ! Remove a constant that was added to prevent dynamics from clipping - ! them to prevent dynamics from making them positive. - thlp2(i,k) = state1%q(i,k,ixthlp2) - rtp2(i,k) = state1%q(i,k,ixrtp2) - rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) - wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) - wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) - wp2(i,k) = state1%q(i,k,ixwp2) - wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) - up2(i,k) = state1%q(i,k,ixup2) - vp2(i,k) = state1%q(i,k,ixvp2) - endif - endif - - enddo - enddo - - if (clubb_do_adv) then - ! If not last step of macmic loop then set apply_const back to - ! zero to prevent output from being corrupted. - if (macmic_it == cld_macmic_num_steps) then - apply_const = 1._r8 - else - apply_const = 0._r8 - endif - endif - - rtm(1:ncol,pverp) = rtm(1:ncol,pver) - um(1:ncol,pverp) = state1%u(1:ncol,pver) - vm(1:ncol,pverp) = state1%v(1:ncol,pver) - thlm(1:ncol,pverp) = thlm(1:ncol,pver) - - if (clubb_do_adv) then - thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) - rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) - wp2(1:ncol,pverp)=wp2(1:ncol,pver) - wp3(1:ncol,pverp)=wp3(1:ncol,pver) - up2(1:ncol,pverp)=up2(1:ncol,pver) - vp2(1:ncol,pverp)=vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - mf_precc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awql_output(:,:) = 0._r8 - s_awqi_output(:,:) = 0._r8 - s_awth_output(:,:) = 0._r8 - s_awqv_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - mf_upa_output(:,:) = 0._r8 - mf_upw_output(:,:) = 0._r8 - mf_upqt_output(:,:) = 0._r8 - mf_upthl_output(:,:) = 0._r8 - mf_upthv_output(:,:) = 0._r8 - mf_upth_output(:,:) = 0._r8 - mf_upqc_output(:,:) = 0._r8 - mf_upbuoy_output(:,:) = 0._r8 - mf_upent_output(:,:) = 0._r8 - mf_upa_flip(:,:,:) = 0._r8 - mf_upw_flip(:,:,:) = 0._r8 - mf_upqt_flip(:,:,:) = 0._r8 - mf_upthl_flip(:,:,:) = 0._r8 - mf_upthv_flip(:,:,:) = 0._r8 - mf_upth_flip(:,:,:) = 0._r8 - mf_upqc_flip(:,:,:) = 0._r8 - mf_upbuoy_flip(:,:,:) = 0._r8 - mf_upent_flip(:,:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_thvflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - mf_thflx_output(:,:) = 0._r8 - mf_qvflx_output(:,:) = 0._r8 - mf_thlforc_output(:,:) = 0._r8 - mf_qtforc_output(:,:) = 0._r8 - mf_thforc_output(:,:) = 0._r8 - mf_qvforc_output(:,:) = 0._r8 - mf_qcforc_output(:,:) = 0._r8 - mf_rcm_output(:,:) = 0._r8 - mf_cloudfrac_output(:,:) = 0._r8 - mf_qc_output(:,:) = 0._r8 - mf_ztop_output(:) = 0._r8 - mf_L0_output(:) = 0._r8 - mf_cape_output(:) = 0._r8 - - ! Loop over all columns in lchnk to advance CLUBB core - do i=1,ncol ! loop over columns - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1,nlev+1 - zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1,nlev - zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - - do k=1,pver - dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - enddo - - ! Thermodynamic ghost point is below surface - zt_g(1) = -1._r8*zt_g(2) - - ! Set the elevation of the surface - sfc_elevation = state1%zi(i,pver+1) - - ! Set the grid size - host_dx = grid_dx(i) - host_dy = grid_dy(i) - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile - exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) - invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo - thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo - th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) - qv_zt(k+1) = state1%q(i,pver-k+1,ixq) - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) - radf(k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) - enddo - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - rho_ds_zt(1) = rho_ds_zt(2) - invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) - rho_in(1) = rho_ds_zt(2) - thv_ds_zt(1) = thv_ds_zt(2) - rho_zt(:) = rho_in(:) - p_in_Pa(1) = p_in_Pa(2) - exner(1) = exner(2) - rfrzm(1) = rfrzm(2) - radf(1) = radf(2) - qrl_clubb(1) = qrl_clubb(2) - th_zt(1) = th_zt(2) - qv_zt(1) = qv_zt(2) - - ! Compute mean w wind on thermo grid, convert from omega to w - wm_zt(1) = 0._r8 - do k=1,nlev - wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) - enddo - - ! ------------------------------------------------- ! - ! Begin case specific code for SCAM cases. ! - ! This section of code block NOT called in ! - ! global simulations ! - ! ------------------------------------------------- ! - - if (single_column) then - - ! Initialize zo if variable ustar is used - - if (cam_in%landfrac(i) >= 0.5_r8) then - zo = 0.035_r8 - else - zo = 0.0001_r8 - endif - - ! Compute surface wind (ubar) - ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - ! Below denotes case specifics for surface momentum - ! and thermodynamic fluxes, depending on the case - - ! Define ustar (based on case, if not variable) - ustar = 0.25_r8 ! Initialize ustar in case no case - - if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then - ustar = 0.30_r8 - endif - - if(trim(scm_clubb_iop_name) == 'RICO_3day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & - trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - bflx22 = (gravit/theta0)*wpthlp_sfc - ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) - endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation - upwp_sfc = -um(i,pver)*ustar**2/ubar - vpwp_sfc = -vm(i,pver)*ustar**2/ubar - - endif - - ! Define surface sources for transported variables for diffusion, will - ! be zero as these tendencies are done in vertical_diffusion - do ixind=1,edsclr_dim - wpedsclrp_sfc(ixind) = 0._r8 - enddo - - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & - zi_g(1), zi_g, zt_g) - - call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & - zi_g, zt_g, & - clubb_config_flags%l_prescribed_avg_deltaz, & - err_code ) - - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing = 0._r8 - rtm_forcing = 0._r8 - um_forcing = 0._r8 - vm_forcing = 0._r8 - - wprtp_forcing = 0._r8 - wpthlp_forcing = 0._r8 - rtp2_forcing = 0._r8 - thlp2_forcing = 0._r8 - rtpthlp_forcing = 0._r8 - - ice_supersat_frac_out = 0._r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) - thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) - wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) - wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) - rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(i,:) = 0.0_r8 - thlp2_mc_zt(i,:) = 0.0_r8 - wprtp_mc_zt(i,:) = 0.0_r8 - wpthlp_mc_zt(i,:) = 0.0_r8 - rtpthlp_mc_zt(i,:) = 0.0_r8 - - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api(rho_ds_zt) - rho_zm = zt2zm_api(rho_zt) - invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) - thv_ds_zm = zt2zm_api(thv_ds_zt) - wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model - wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux - wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) - upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - um_in(k) = um(i,pverp-k+1) - vm_in(k) = vm(i,pverp-k+1) - upwp_in(k) = upwp(i,pverp-k+1) - vpwp_in(k) = vpwp(i,pverp-k+1) - wpthvp_in(k) = wpthvp(i,pverp-k+1) - wp2thvp_in(k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(k)= thlpthvp(i,pverp-k+1) - up2_in(k) = up2(i,pverp-k+1) - vp2_in(k) = vp2(i,pverp-k+1) - up3_in(k) = up3(i,pverp-k+1) - vp3_in(k) = vp3(i,pverp-k+1) - wp2_in(k) = wp2(i,pverp-k+1) - wp3_in(k) = wp3(i,pverp-k+1) - rtp2_in(k) = rtp2(i,pverp-k+1) - thlp2_in(k) = thlp2(i,pverp-k+1) - rtp3_in(k) = rtp3(i,pverp-k+1) - thlp3_in(k) = thlp3(i,pverp-k+1) - thlm_in(k) = thlm(i,pverp-k+1) - rtm_in(k) = rtm(i,pverp-k+1) - rvm_in(k) = rvm(i,pverp-k+1) - wprtp_in(k) = wprtp(i,pverp-k+1) - wpthlp_in(k) = wpthlp(i,pverp-k+1) - tke_in(k) = tke(i,pverp-k+1) - rtpthlp_in(k) = rtpthlp(i,pverp-k+1) - rcm_inout(k) = rcm(i,pverp-k+1) - cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) - sclrpthvp_inout(k,:) = 0._r8 - - if (k .ne. 1) then - pre_in(k) = prer_evap(i,pverp-k+1) - endif - - ! Initialize these to prevent crashing behavior - wprcp_out(k) = 0._r8 - rcm_in_layer_out(k) = 0._r8 - cloud_cover_out(k) = 0._r8 - edsclr_in(k,:) = 0._r8 - khzm_out(k) = 0._r8 - khzt_out(k) = 0._r8 - - ! higher order scalar stuff, put to zero - sclrm(k,:) = 0._r8 - wpsclrp(k,:) = 0._r8 - sclrp2(k,:) = 0._r8 - sclrp3(k,:) = 0._r8 - sclrprtp(k,:) = 0._r8 - sclrpthlp(k,:) = 0._r8 - wpsclrp_sfc(:) = 0._r8 - hydromet(k,:) = 0._r8 - wphydrometp(k,:) = 0._r8 - wp2hmp(k,:) = 0._r8 - rtphmp_zt(k,:) = 0._r8 - thlphmp_zt(k,:) = 0._r8 - - enddo - pre_in(1) = pre_in(2) - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - do k=1,pver - kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) - enddo - kappa_zt(1) = kappa_zt(2) - qc_zt(1) = qc_zt(2) - invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) - do k=1,pverp - p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) - enddo - end if - - if (clubb_do_adv) then - if (macmic_it == 1) then - wp2_in=zt2zm_api(wp2_in) - wpthlp_in=zt2zm_api(wpthlp_in) - wprtp_in=zt2zm_api(wprtp_in) - up2_in=zt2zm_api(up2_in) - vp2_in=zt2zm_api(vp2_in) - thlp2_in=zt2zm_api(thlp2_in) - rtp2_in=zt2zm_api(rtp2_in) - rtpthlp_in=zt2zm_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Do the same for tracers - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - do k=1,nlev - edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) - enddo - edsclr_in(1,icnt) = edsclr_in(2,icnt) - end if - enddo - - if (do_expldiff) then - do k=1,nlev - edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) - edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) - enddo - - edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) - edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) - endif - - stats_nsamp = nint(stats_tsamp/dtime) - stats_nout = nint(stats_tout/dtime) - - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif - - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - dzt(k) = zi_g(k) - zi_g(k-1) - dzm(k-1) = zt_g(k) - zt_g(k-1) - enddo - dzt(1) = dzt(2) - dzm(pverp) = dzm(pver) - invrs_dzt = 1._r8/dzt - - rtm_zm_in = zt2zm_api( rtm_in ) - thlm_zm_in = zt2zm_api( thlm_in ) - th_zm = zt2zm_api( th_zt ) - qv_zm = zt2zm_api( qv_zt ) - qc_zm = zt2zm_api( qc_zt ) - - call integrate_mf( pverp, & ! input - rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - wpthlp_in, tke_in, tpert(i), & ! input - mf_cape_output(i), & ! output - plume diagnostics - mf_upa, & ! output - plume diagnostics - mf_upw, & ! output - plume diagnostics - mf_upqt, & ! output - plume diagnostics - mf_upthl, & ! output - plume diagnostics - mf_upthv, & ! output - plume diagnostics - mf_upth, & ! output - plume diagnostics - mf_upqc, & ! output - plume diagnostics - mf_upbuoy, & ! output - plume diagnostics - mf_upent, & ! output - plume diagnostics - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - mf_sqt, mf_sthl, & ! output - plume diagnostics - mf_precc, & ! output - plume diagnostics - s_ae, s_aw, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awql, s_awqi, & ! output - plume diagnostics - s_awth, s_awqv, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thflx, mf_qvflx, & ! output - plume diagnostics - mf_thvflx, mf_qcflx, & ! output - plume diagnostics - mf_thlflx, mf_qtflx, & ! output - variables needed for solver - mf_ztop_output(i), mf_L0_output(i) ) - - ! CFL limiter - s_aw(1) = 0._r8 - max_cfl(i)= 0._r8 - do k=2,pverp - max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) - end do - cflval = 1._r8 - cflfac = 1._r8 - cfllim = .true. - if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) - - ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing = 0._r8 - thlm_forcing = 0._r8 - mf_thforc = 0._r8 - mf_qvforc = 0._r8 - mf_qcforc = 0._r8 - do k=2,pverp - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & - + mf_sqt(k) - - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & - + mf_sthl(k) - - mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) - - mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) - - mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) - - end do - ! compute ensemble cloud properties - mf_rcm = 0._r8 - mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= mf_moist_a(:pverp) - - ! [kg/m2/s]->[m/s] - prec_sh(i) = mf_precc(1)/1000._r8 - snow_sh(i) = 0._r8 - - end if - - ! Advance CLUBB CORE one timestep in the future - call advance_clubb_core_api & - ( l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & - thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & - sclrm_forcing, edsclrm_forcing, wprtp_forcing, & - wpthlp_forcing, rtp2_forcing, thlp2_forcing, & - rtpthlp_forcing, wm_zm, wm_zt, & - wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & - wpsclrp_sfc, wpedsclrp_sfc, & - p_in_Pa, rho_zm, rho_in, exner, & - rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & - invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & - rfrzm, radf, & - wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & - host_dx, host_dy, & - clubb_config_flags, & - um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & - thlm_in, rtm_in, wprtp_in, wpthlp_in, & - wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & - sclrm, & - sclrp2, sclrp3, sclrprtp, sclrpthlp, & - wpsclrp, edsclr_in, err_code, & - rcm_inout, cloud_frac_inout, & - wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & - sclrpthvp_inout, & - pdf_params_chnk(i,lchnk), pdf_params_zm_chnk(i,lchnk), & - pdf_implicit_coefs_terms_chnk(i,lchnk), & - khzm_out, khzt_out, & - qclvar_out, thlprcp_out, & - wprcp_out, ice_supersat_frac_out, & - rcm_in_layer_out, cloud_cover_out) - - if ( err_code == clubb_fatal_error ) then - write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep(), "LAT: ", state1%lat(i), " LON: ", state1%lon(i) - call endrun(subr//': Fatal error in CLUBB library') - end if - - - if (do_rainturb) then - rvm_in = rtm_in - rcm_inout - call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & - rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & - rtp2_mc_out, thlp2_mc_out, & - wprtp_mc_out, wpthlp_mc_out, & - rtpthlp_mc_out) - - dum1 = (1._r8 - cam_in%landfrac(i)) - - ! update turbulent moments based on rain evaporation - rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime - wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime - wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(rcm_inout) - qrl_zm = zt2zm_api(qrl_clubb) - thlp2_rad_out(:) = 0._r8 - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) - thlp2_in = thlp2_in + thlp2_rad_out * dtime - thlp2_in = max(thl_tol**2,thlp2_in) - endif - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& - out_radzt,out_radzm,out_sfc) - - enddo ! end time loop - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) - wpthlp_in=zm2zt_api(wpthlp_in) - wprtp_in=zm2zt_api(wprtp_in) - up2_in=zm2zt_api(up2_in) - vp2_in=zm2zt_api(vp2_in) - thlp2_in=zm2zt_api(thlp2_in) - rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api(rtp2_in) - thl2_zt = zm2zt_api(thlp2_in) - wp2_zt = zm2zt_api(wp2_in) - ! Need moist_qc and cloudfrac on thermo grid for output - mf_qc_zt = zm2zt_api(mf_moist_qc) - mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) - - ! Arrays need to be "flipped" to CAM grid - - do k=1,nlev+1 - - um(i,pverp-k+1) = um_in(k) - vm(i,pverp-k+1) = vm_in(k) - upwp(i,pverp-k+1) = upwp_in(k) - vpwp(i,pverp-k+1) = vpwp_in(k) - wpthvp(i,pverp-k+1) = wpthvp_in(k) - wp2thvp(i,pverp-k+1) = wp2thvp_in(k) - rtpthvp(i,pverp-k+1) = rtpthvp_in(k) - thlpthvp(i,pverp-k+1) = thlpthvp_in(k) - up2(i,pverp-k+1) = up2_in(k) - vp2(i,pverp-k+1) = vp2_in(k) - up3(i,pverp-k+1) = up3_in(k) - vp3(i,pverp-k+1) = vp3_in(k) - thlm(i,pverp-k+1) = thlm_in(k) - rtm(i,pverp-k+1) = rtm_in(k) - wprtp(i,pverp-k+1) = wprtp_in(k) - wpthlp(i,pverp-k+1) = wpthlp_in(k) - wp2(i,pverp-k+1) = wp2_in(k) - wp3(i,pverp-k+1) = wp3_in(k) - rtp2(i,pverp-k+1) = rtp2_in(k) - thlp2(i,pverp-k+1) = thlp2_in(k) - rtp3(i,pverp-k+1) = rtp3_in(k) - thlp3(i,pverp-k+1) = thlp3_in(k) - rtpthlp(i,pverp-k+1) = rtpthlp_in(k) - rcm(i,pverp-k+1) = rcm_inout(k) - ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_out(k) - wprcp(i,pverp-k+1) = wprcp_out(k) - cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(k),1._r8) - rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(k) - cloud_cover(i,pverp-k+1) = min(cloud_cover_out(k),1._r8) - zt_out(i,pverp-k+1) = zt_g(k) - zi_out(i,pverp-k+1) = zi_g(k) - khzm(i,pverp-k+1) = khzm_out(k) - qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(k)) - wm_zt_out(i,pverp-k+1) = wm_zt(k) - - rtp2_zt_out(i,pverp-k+1) = rtp2_zt(k) - thl2_zt_out(i,pverp-k+1) = thl2_zt(k) - wp2_zt_out(i,pverp-k+1) = wp2_zt(k) - - mean_rt & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * pdf_params_chnk(i,lchnk)%rt_1(k) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * pdf_params_chnk(i,lchnk)%rt_2(k) - - pdfp_rtp2(i,pverp-k+1) & - = pdf_params_chnk(i,lchnk)%mixt_frac(k) & - * ( ( pdf_params_chnk(i,lchnk)%rt_1(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_1(k) ) & - + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & - * ( ( pdf_params_chnk(i,lchnk)%rt_2(k) - mean_rt )**2 & - + pdf_params_chnk(i,lchnk)%varnce_rt_2(k) ) - - do ixind=1,edsclr_dim - edsclr_out(pverp-k+1,ixind) = edsclr_in(k,ixind) - enddo - - if (do_clubb_mf) then - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awth_output(i,pverp-k+1) = s_awth(k) - s_awqv_output(i,pverp-k+1) = s_awqv(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - s_awql_output(i,pverp-k+1) = s_awql(k) - s_awqi_output(i,pverp-k+1) = s_awqi(k) - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - mf_thflx_output(i,pverp-k+1) = mf_thflx(k) - mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) - if (k.ne.1) then - mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) - mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) - mf_thforc_output(i,pverp-k+1) = mf_thforc(k) - mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) - mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) - mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) - end if - - mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) - mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) - mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) - mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - - end if - - enddo - - if (do_clubb_mf) then - do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) - end do - end if - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - upwp(i,:top_lev-1) = 0._r8 - vpwp(i,:top_lev-1) = 0._r8 - rcm(i,:top_lev-1) = 0._r8 - wprcp(i,:top_lev-1) = 0._r8 - cloud_frac(i,:top_lev-1) = 0._r8 - rcm_in_layer(i,:top_lev-1) = 0._r8 - zt_out(i,:top_lev-1) = 0._r8 - zi_out(i,:top_lev-1) = 0._r8 - khzm(i,:top_lev-1) = 0._r8 - qclvar(i,:top_lev-1) = 2._r8 - - - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end if - enddo - - ! Fill up arrays needed for McICA. Note we do not want the ghost point, - ! thus why the second loop is needed. - - zi_out(i,1) = 0._r8 - - ! Section below is concentrated on energy fixing for conservation. - ! There are two steps to this process. The first is to remove any tendencies - ! CLUBB may have produced above where it is active due to roundoff. - ! The second is to provider a fixer because CLUBB and CAM's thermodynamic - ! variables are different. - - ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from - ! firing up in the stratosphere - clubbtop = troplev(i) - do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) - clubbtop = clubbtop + 1 - enddo - - ! Compute static energy using CLUBB's variables - do k=1,pver - clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & - + latvap * rcm(i,k) & - + gravit * state1%zm(i,k) + state1%phis(i) - enddo - - ! Compute integrals above layer where CLUBB is active - se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called - se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called - tw_upper_a = 0._r8 ! total water in layers above where CLUBB is active AFTER CLUBB is called - tw_upper_b = 0._r8 ! total water in layers above where CLUBB is active BEFORE CLUBB is called - do k=1,clubbtop - se_upper_a = se_upper_a + (clubb_s(k)+0.5_r8*(um(i,k)**2+vm(i,k)**2)+(latvap+latice)* & - (rtm(i,k)-rcm(i,k))+(latice)*rcm(i,k))*state1%pdel(i,k)/gravit - se_upper_b = se_upper_b + (state1%s(i,k)+0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)+(latvap+latice)* & - state1%q(i,k,ixq)+(latice)*state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit - tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit - enddo - - ! Compute the disbalance of total energy and water in upper levels, - ! divide by the thickness in the lower atmosphere where we will - ! evenly distribute this disbalance - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Perform a test to see if there will be any negative RTM errors - ! in the column. If so, apply the disbalance to the surface - apply_to_surface = .false. - if (tw_upper_diss < 0._r8) then - do k=clubbtop+1,pver - rtm_test = (rtm(i,k) + tw_upper_diss*gravit) - rcm(i,k) - if (rtm_test < 0._r8) then - apply_to_surface = .true. - endif - enddo - endif - - if (apply_to_surface) then - tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) - rtm(i,pver) = rtm(i,pver) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(pver) = clubb_s(pver) + se_upper_diss*gravit - else - ! Apply the disbalances above to layers where CLUBB is active - do k=clubbtop+1,pver - rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit - if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit - enddo - endif - - ! Essentially "zero" out tendencies in the layers above where CLUBB is active - do k=1,clubbtop - if (apply_to_heat) clubb_s(k) = state1%s(i,k) - rcm(i,k) = state1%q(i,k,ixcldliq) - rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) - enddo - - ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water - ! after CLUBB is called. This is for energy conservation purposes. - se_a = 0._r8 - ke_a = 0._r8 - wv_a = 0._r8 - wl_a = 0._r8 - - ! Do the same as above, but for before CLUBB was called. - se_b = 0._r8 - ke_b = 0._r8 - wv_b = 0._r8 - wl_b = 0._r8 - do k=1,pver - se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit - ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit - wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit - wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit - - se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit - ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit - wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit - wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - enddo - - ! Based on these integrals, compute the total energy before and after CLUBB call - te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) - te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) - - ! Take into account the surface fluxes of heat and moisture - ! Use correct qflux from cam_in, not lhf/latvap as was done previously - te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime - ! subtract enthalpy of falling precip from tb - te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime - - ! Compute the disbalance of total energy, over depth where CLUBB is active - se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis(i)*gravit - enddo - endif - ! convert to units of +ve [K] - se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) - - ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point - ! for all variables and therefore is never called in this loop - rtm_integral_vtend = 0._r8 - rtm_integral_ltend = 0._r8 - do k=1,pver - - ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind - ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind - ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor - ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water - ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy - - rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit - rtm_integral_vtend = rtm_integral_vtend + ptend_loc%q(i,k,ixq)*state1%pdel(i,k)/gravit - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - - ! Here add a constant to moments which can be either positive or - ! negative. This is to prevent clipping when dynamics tries to - ! make all constituents positive - wp3(i,k) = wp3(i,k) + wp3_const - rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const - wpthlp(i,k) = wpthlp(i,k) + wpthlp_const - wprtp(i,k) = wprtp(i,k) + wprtp_const - - ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance - ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance - ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance - ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP - ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP - ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 - ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 - ptend_loc%q(i,k,ixup2)=(up2(i,k)-state1%q(i,k,ixup2))/hdtime ! UP2 - ptend_loc%q(i,k,ixvp2)=(vp2(i,k)-state1%q(i,k,ixvp2))/hdtime ! VP2 - else - ptend_loc%q(i,k,ixthlp2)=0._r8 - ptend_loc%q(i,k,ixrtp2)=0._r8 - ptend_loc%q(i,k,ixrtpthlp)=0._r8 - ptend_loc%q(i,k,ixwpthlp)=0._r8 - ptend_loc%q(i,k,ixwprtp)=0._r8 - ptend_loc%q(i,k,ixwp2)=0._r8 - ptend_loc%q(i,k,ixwp3)=0._r8 - ptend_loc%q(i,k,ixup2)=0._r8 - ptend_loc%q(i,k,ixvp2)=0._r8 - endif - - endif - - ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. - ! Loading up this array doesn't mean the tendencies are applied. - ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed - - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& - (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& - (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& - (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& - (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then - ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents - end if - end if - enddo - - enddo - - - enddo ! end column loop - - ! dte / hdtime = [kg/s2]/[s] = W/m2 - call outfld('ELEAK_CLUBB', (te_a - te_b)/hdtime, pcols, lchnk) - call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) - - ! Add constant to ghost point so that output is not corrupted - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp3(:,pverp) = wp3(:,pverp) + wp3_const - rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const - wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const - wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const - endif - endif - - cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) - - ! ------------------------------------------------- ! - ! End column computation of CLUBB, begin to apply ! - ! and compute output, etc ! - ! ------------------------------------------------- ! - - ! Output CLUBB tendencies - call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) - call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! Due to the order of operation of CLUBB, which closes on liquid first, - ! then advances it's predictive equations second, this can lead to - ! RHliq > 1 directly before microphysics is called. Therefore, we use - ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. - - if (clubb_do_liqsupersat) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - latsub = latvap + latice - - lq2(:) = .FALSE. - lq2(ixq) = .TRUE. - lq2(ixcldliq) = .TRUE. - lq2(ixnumliq) = .TRUE. - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qctend(:ncol,:)=0._r8 - inctend(:ncol,:)=0._r8 - - call liquid_macro_tend(npccn(:ncol,top_lev:pver),state1%t(:ncol,top_lev:pver), & - state1%pmid(:ncol,top_lev:pver),state1%q(:ncol,top_lev:pver,ixq),state1%q(:ncol,top_lev:pver,ixcldliq),& - state1%q(:ncol,top_lev:pver,ixnumliq),latvap,hdtime,& - stend(:ncol,top_lev:pver),qvtend(:ncol,top_lev:pver),qctend(:ncol,top_lev:pver),& - inctend(:ncol,top_lev:pver)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - ! Write output for tendencies: - ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QCTENDICE', qctend, pcols, lchnk ) - call outfld( 'NCTENDICE', inctend, pcols, lchnk ) - - where(qctend .ne. 0._r8) - fqtend = 1._r8 - elsewhere - fqtend = 0._r8 - end where - - call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) - end if - - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! The rest of the code deals with diagnosing variables ! - ! for microphysics/radiation computation and macrophysics ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - ! ------------------------------------------------------------ ! - - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD DETRAINMENT ! - ! Detrainment of convective condensate into the environment or stratiform cloud ! - ! --------------------------------------------------------------------------------- ! - - ! Initialize the shallow convective detrainment rate, will always be zero - dlf2(:,:) = 0.0_r8 - dlf_liq_out(:,:) = 0.0_r8 - dlf_ice_out(:,:) = 0.0_r8 - - lqice(:) = .false. - lqice(ixcldliq) = .true. - lqice(ixcldice) = .true. - lqice(ixnumliq) = .true. - lqice(ixnumice) = .true. - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) - - if (zmconv_microp) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - call pbuf_get_field(pbuf, difzm_idx, difzm) - call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) - call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) - end if - - do k=1,pver - do i=1,ncol - if( state1%t(i,k) > 268.15_r8 ) then - dum1 = 0.0_r8 - elseif ( state1%t(i,k) < 238.15_r8 ) then - dum1 = 1.0_r8 - else - dum1 = ( 268.15_r8 - state1%t(i,k) ) / 30._r8 - endif - - if (zmconv_microp) then - ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 - - ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice - else - - ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 - ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8* 8.e-6_r8**3*997._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & - / (4._r8*3.14_r8*25.e-6_r8**3*500._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice - - dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) - dlf_ice_out(i,k) = dlf(i,k) * dum1 - end if - - ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep - ! track of the integrals of ice and static energy that is effected from conversion to ice - ! so that the energy checker doesn't complain. - det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit - det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit - - enddo - enddo - - det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water - - call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - - temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) - call outfld( 'DPDLFT', temp2d, pcols, lchnk) - - call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! ptend_all now has all accumulated tendencies. Convert the tendencies for the - ! dry constituents to dry air basis. - do ixind = 1, pcnst - if (lq(ixind) .and. cnst_type(ixind) == 'dry') then - do k = 1, pver - do i = 1, ncol - ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdel(i,k)/state1%pdeldry(i,k) - end do - end do - end if - end do - - ! ------------------------------------------------- ! - ! Diagnose relative cloud water variance ! - ! ------------------------------------------------- ! - - if (deep_scheme == 'CLUBB_SGS') then - relvarmax = 2.0_r8 - else - relvarmax = 10.0_r8 - endif - - relvar(:,:) = relvarmax ! default - - if (deep_scheme .ne. 'CLUBB_SGS') then - where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & - relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) - endif - - ! ------------------------------------------------- ! - ! Optional Accretion enhancement factor ! - ! ------------------------------------------------- ! - - accre_enhan(:ncol,:pver) = 1._r8 - - ! ------------------------------------------------- ! - ! Diagnose some output variables ! - ! ------------------------------------------------- ! - - ! density - rho(:ncol,1:pver) = state1%pmid(:ncol,1:pver)/(rairv(:ncol,1:pver,lchnk)*state1%t(:ncol,1:pver)) - rho(:ncol,pverp) = state1%ps(:ncol)/(rairv(:ncol,pver,lchnk)*state1%t(:ncol,pver)) - - wpthvp_diag(:,:) = 0.0_r8 - do k=1,pver - do i=1,ncol - eps = rairv(i,k,lchnk)/rh2o - ! buoyancy flux - wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & - (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & - state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) - - ! total water mixing ratio - qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) - ! liquid water potential temperature - thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) - ! liquid water static energy - sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) - enddo - enddo - - do k=1,pverp - do i=1,ncol - wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair - if (do_clubb_mf) then - mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair - mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o - end if - enddo - enddo - - do k=1,pverp - do i=1,ncol - qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) - thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) - rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) - cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) - wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) - wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) - wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) - if (do_clubb_mf) then - mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) - mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) - mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) - end if - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - ! initialize variables - alst(:,:) = 0.0_r8 - qlst(:,:) = 0.0_r8 - - do k=1,pver - do i=1,ncol - alst(i,k) = cloud_frac(i,k) - qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - - deepcu = 0.0_r8 - shalcu = 0.0_r8 - - do k=1,pver-1 - do i=1,ncol - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(0.1_r8*log(1.0_r8+500.0_r8*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - - if (do_clubb_mf_rad) then - shalcu(i,k) = mf_cloudfrac_output(i,k) - sh_icwmr(i,k) = mf_qc_output(i,k) - end if - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - if (shalcu(i,k) <= frac_limit .or. sh_icwmr(i,k) < ic_limit) then - shalcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) - enddo - enddo - - if (single_column) then - if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & - trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & - trim(scm_clubb_iop_name) == 'RICO_3day' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - deepcu(:,:) = 0.0_r8 - concld(:,:) = 0.0_r8 - - endif - endif - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD FRACTION PORTION ! - ! use the aist_vector function to compute the ice cloud fraction ! - ! --------------------------------------------------------------------------------- ! - - aist(:,:top_lev-1) = 0._r8 - qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below - - do k = top_lev, pver - - ! For Type II PSC and for thin cirrus, the clouds can be thin, but - ! extensive and they should start forming when the gridbox mean saturation - ! reaches 1.0. - ! - ! For now, use the tropopause diagnostic to determine where the Type II - ! PSC should be, but in the future wold like a better metric that can also - ! identify the level for thin cirrus. Include the tropopause level so that - ! the cold point tropopause will use the stratospheric values. - where (k <= troplev) - rhmini = rhminis_const - rhmaxi = rhmaxis_const - elsewhere - rhmini = rhmini_const - rhmaxi = rhmaxi_const - end where - - if ( trim(subcol_scheme) == 'SILHS' ) then - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) - else - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& - qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) - endif - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! - ! ! - ! For now leave the computation of ice stratus fraction from macrop_driver intact ! - ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! - ! fraction that was coded in macrop_driver ! - ! --------------------------------------------------------------------------------- ! - - ! Recompute net stratus fraction using maximum over-lapping assumption, as done - ! in macrophysics code, using alst computed above and aist read in from physics buffer - - do k=1,pver - do i=1,ncol - - ast(i,k) = max(alst(i,k),aist(i,k)) - - qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) - enddo - enddo - - ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just - ! be outputting the shallow convective cloud fraction - - do k=1,pver - do i=1,ncol - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! DIAGNOSE THE PBL DEPTH ! - ! this is needed for aerosol code ! - ! --------------------------------------------------------------------------------- ! - - do i=1,ncol - do k=1,pver - th(i,k) = state1%t(i,k)*state1%exner(i,k) - thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) - enddo - enddo - - ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) - rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) - call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & - rrho(1:ncol), ustar2(1:ncol)) - ! use correct qflux from coupler - call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & - rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & - obklen(1:ncol)) - - dummy2(:) = 0._r8 - dummy3(:) = 0._r8 - - where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 - - ! Compute PBL depth according to Holtslag-Boville Scheme - call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & - ustar2, obklen, kbfs, pblh, dummy2, & - state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) - - ! Output the PBL depth - call outfld('PBLH', pblh, pcols, lchnk) - - ! Assign the first pver levels of cloud_frac back to cld - cld(:,1:pver) = cloud_frac(:,1:pver) - - ! --------------------------------------------------------------------------------- ! - ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! - ! --------------------------------------------------------------------------------- ! - - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 - call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) - - rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 - call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 - call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:) - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) - - call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'SH_CLD', shalcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQV' , s_awqv_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) - call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) - call outfld( 'edmf_thflx' , mf_thflx_output, pcols, lchnk ) - call outfld( 'edmf_qvflx' , mf_qvflx_output, pcols, lchnk ) - call outfld( 'edmf_thforc' , mf_thforc_output, pcols, lchnk ) - call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) - call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) - call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) - call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) - call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) - call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) - call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) - call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) - call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) - call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) - call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) - call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) - call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) - call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) - call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) - call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) - call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) - end if - - if (macmic_it==cld_macmic_num_steps) then - call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) - call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) - call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) - call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) - - call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) - call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) - if (do_clubb_mf) then - call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) - call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) - call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) - end if - end if - - ! Output CLUBB history here - if (l_stats) then - - do i=1,stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) - enddo - - do i=1,stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - - call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) - enddo - - if (l_output_rad_files) then - do i=1,stats_rad_zt%num_output_fields - call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) - enddo - - do i=1,stats_rad_zm%num_output_fields - call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) - enddo - endif - - do i=1,stats_sfc%num_output_fields - call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) - enddo - - endif - - return -#endif - end subroutine clubb_tend_cam - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -! Saturation adjustment for ice -! Add ice mass if supersaturated -elemental subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend) - - use wv_sat_methods, only: wv_sat_qsat_ice - - real(r8), intent(in) :: naai !Activated number of ice nuclei - real(r8), intent(in) :: t !temperature (k) - real(r8), intent(in) :: p !pressure (pa0 - real(r8), intent(in) :: qv !water vapor mixing ratio - real(r8), intent(in) :: qi !ice mixing ratio - real(r8), intent(in) :: ni !ice number concentration - real(r8), intent(in) :: xxls !latent heat of freezing - real(r8), intent(in) :: deltat !timestep - real(r8), intent(out) :: stend ! 'temperature' tendency - real(r8), intent(out) :: qvtend !vapor tendency - real(r8), intent(out) :: qitend !ice mass tendency - real(r8), intent(out) :: nitend !ice number tendency - - real(r8) :: ESI - real(r8) :: QSI - real(r8) :: tau - - stend = 0._r8 - qvtend = 0._r8 - qitend = 0._r8 - nitend = 0._r8 - -! calculate qsati from t,p,q - - call wv_sat_qsat_ice(t, p, ESI, QSI) - - if (naai > 1.e-18_r8 .and. qv > QSI) then - - - qitend = (qv-QSI)/deltat !* exp(-tau/deltat) - qvtend = 0._r8 - qitend - stend = qitend * xxls ! moist static energy tend...[J/kg/s] ! - - - ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice - if (ni < 1.e3_r8 .and. (qi+qitend*deltat) > 1.e-18_r8) then - nitend = nitend + 3._r8 * qitend/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) - endif - - endif - -end subroutine ice_macro_tend - -#ifdef CLUBB_SGS -! ---------------------------------------------------------------------- -! -! DISCLAIMER : this code appears to be correct but has not been -! very thouroughly tested. If you do notice any -! anomalous behaviour then please contact Andy and/or -! Bjorn -! -! Function diag_ustar: returns value of ustar using the below -! similarity functions and a specified buoyancy flux (bflx) given in -! kinematic units -! -! phi_m (zeta > 0) = (1 + am * zeta) -! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) -! -! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) -! -! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface -! Layer, in Workshop on Micormeteorology, pages 67-100. -! -! Code writen March, 1999 by Bjorn Stevens -! - -real(r8) function diag_ustar( z, bflx, wnd, z0 ) - -use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g - -implicit none - -real(r8), parameter :: am = 4.8_r8 ! " " " -real(r8), parameter :: bm = 19.3_r8 ! " " " - -real(r8), parameter :: grav = shr_const_g -real(r8), parameter :: vonk = shr_const_karman -real(r8), parameter :: pi = shr_const_pi - -real(r8), intent (in) :: z ! height where u locates -real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) -real(r8), intent (in) :: wnd ! wind speed at z -real(r8), intent (in) :: z0 ! momentum roughness height - - -integer :: iterate -real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar - -lnz = log( z / z0 ) -klnz = vonk/lnz -c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) - -ustar = wnd*klnz -if (abs(bflx) > 1.e-6_r8) then - do iterate=1,4 - - if (ustar > 1.e-6_r8) then - lmo = -ustar**3 / ( vonk * bflx ) - zeta = z/lmo - if (zeta > 0._r8) then - ustar = vonk*wnd /(lnz + am*zeta) - else - x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) - psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 - ustar = wnd*vonk/(lnz - psi1) - end if - - endif - - end do -end if - - -diag_ustar = ustar - -return - - -end function diag_ustar -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & - nnzp, nnrad_zt,nnrad_zm, delt ) - ! - ! Description: Initializes the statistics saving functionality of - ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here - ! the traditional stats_init of CLUBB is not called, as it is not compatible - ! with CAM output. - - !----------------------------------------------------------------------- - - - use clubb_api_module, only: & - stats_zt, & ! Variables - ztscr01, & - ztscr02, & - ztscr03, & - ztscr04, & - ztscr05, & - ztscr06, & - ztscr07, & - ztscr08, & - ztscr09, & - ztscr10, & - ztscr11, & - ztscr12, & - ztscr13, & - ztscr14, & - ztscr15, & - ztscr16, & - ztscr17, & - ztscr18, & - ztscr19, & - ztscr20, & - ztscr21 - - use clubb_api_module, only: & - stats_zm, & - zmscr01, & - zmscr02, & - zmscr03, & - zmscr04, & - zmscr05, & - zmscr06, & - zmscr07, & - zmscr08, & - zmscr09, & - zmscr10, & - zmscr11, & - zmscr12, & - zmscr13, & - zmscr14, & - zmscr15, & - zmscr16, & - zmscr17, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats, & - l_output_rad_files, & - stats_tsamp, & - stats_tout, & - l_stats_samp, & - l_stats_last, & - l_netcdf, & - l_grads - - use clubb_api_module, only: time_precision, & ! - nvarmax_zm, stats_init_zm_api, & ! - nvarmax_zt, stats_init_zt_api, & ! - nvarmax_rad_zt, stats_init_rad_zt_api, & ! - nvarmax_rad_zm, stats_init_rad_zm_api, & ! - nvarmax_sfc, stats_init_sfc_api, & ! - fstderr, var_length ! - use cam_abortutils, only: endrun - use cam_history, only: addfld, horiz_only - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character - - implicit none - - ! Input Variables - - logical, intent(in) :: l_stats_in ! Stats on? T/F - - real(kind=time_precision), intent(in) :: & - stats_tsamp_in, & ! Sampling interval [s] - stats_tout_in ! Output interval [s] - - integer, intent(in) :: nnzp ! Grid points in the vertical [count] - integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] - integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] - - real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] - - - ! Local Variables - - ! Namelist Variables - - character(len=*), parameter :: subr = 'stats_init_clubb' - - character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels - character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels - character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface - - namelist /clubb_stats_nl/ & - clubb_vars_zt, & - clubb_vars_zm, & - clubb_vars_rad_zt, & - clubb_vars_rad_zm, & - clubb_vars_sfc - - ! Local Variables - - logical :: l_error - - character(len=200) :: temp1, sub - - integer :: i, ntot, read_status - integer :: iunit, ierr - - ! Initialize - l_error = .false. - - ! Set stats_variables variables with inputs from calling subroutine - l_stats = l_stats_in - - stats_tsamp = stats_tsamp_in - stats_tout = stats_tout_in - - if ( .not. l_stats ) then - l_stats_samp = .false. - l_stats_last = .false. - return - end if - - ! Initialize namelist variables - - clubb_vars_zt = '' - clubb_vars_zm = '' - clubb_vars_rad_zt = '' - clubb_vars_rad_zm = '' - clubb_vars_sfc = '' - - ! Read variables to compute from the namelist - if (masterproc) then - iunit= getunit() - open(unit=iunit,file="atm_in",status='old') - call find_group_name(iunit, 'clubb_stats_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('stats_init_clubb: error reading namelist') - end if - end if - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") - call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") - call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") - call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") - call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") - - ! Hardcode these for use in CAM-CLUBB, don't want either - l_netcdf = .false. - l_grads = .false. - - ! Check sampling and output frequencies - - ! The model time step length, delt (which is dtmain), should multiply - ! evenly into the statistical sampling time step length, stats_tsamp. - if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then - l_error = .true. ! This will cause the run to stop. - write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & - 'delt (which is dtmain). Check the appropriate ', & - 'model.in file.' - write(fstderr,*) 'stats_tsamp = ', stats_tsamp - write(fstderr,*) 'delt = ', delt - endif - - ! Initialize zt (mass points) - - i = 1 - do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zt(i)) /= 0 .and. & - i <= nvarmax_zt ) - i = i + 1 - enddo - ntot = i - 1 - if ( ntot == nvarmax_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zt than allowed for by nvarmax_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & - "in the stats namelist, or change nvarmax_zt." - write(fstderr,*) "nvarmax_zt = ", nvarmax_zt - call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") - endif - - stats_zt%num_output_fields = ntot - stats_zt%kk = nnzp - - allocate( stats_zt%z( stats_zt%kk ) ) - - allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - - allocate( stats_zt%file%var( stats_zt%num_output_fields ) ) - allocate( stats_zt%file%z( stats_zt%kk ) ) - - ! Allocate scratch space - - allocate( ztscr01(stats_zt%kk) ) - allocate( ztscr02(stats_zt%kk) ) - allocate( ztscr03(stats_zt%kk) ) - allocate( ztscr04(stats_zt%kk) ) - allocate( ztscr05(stats_zt%kk) ) - allocate( ztscr06(stats_zt%kk) ) - allocate( ztscr07(stats_zt%kk) ) - allocate( ztscr08(stats_zt%kk) ) - allocate( ztscr09(stats_zt%kk) ) - allocate( ztscr10(stats_zt%kk) ) - allocate( ztscr11(stats_zt%kk) ) - allocate( ztscr12(stats_zt%kk) ) - allocate( ztscr13(stats_zt%kk) ) - allocate( ztscr14(stats_zt%kk) ) - allocate( ztscr15(stats_zt%kk) ) - allocate( ztscr16(stats_zt%kk) ) - allocate( ztscr17(stats_zt%kk) ) - allocate( ztscr18(stats_zt%kk) ) - allocate( ztscr19(stats_zt%kk) ) - allocate( ztscr20(stats_zt%kk) ) - allocate( ztscr21(stats_zt%kk) ) - - ztscr01 = 0.0_r8 - ztscr02 = 0.0_r8 - ztscr03 = 0.0_r8 - ztscr04 = 0.0_r8 - ztscr05 = 0.0_r8 - ztscr06 = 0.0_r8 - ztscr07 = 0.0_r8 - ztscr08 = 0.0_r8 - ztscr09 = 0.0_r8 - ztscr10 = 0.0_r8 - ztscr11 = 0.0_r8 - ztscr12 = 0.0_r8 - ztscr13 = 0.0_r8 - ztscr14 = 0.0_r8 - ztscr15 = 0.0_r8 - ztscr16 = 0.0_r8 - ztscr17 = 0.0_r8 - ztscr18 = 0.0_r8 - ztscr19 = 0.0_r8 - ztscr20 = 0.0_r8 - ztscr21 = 0.0_r8 - - ! Default initialization for array indices for zt - - call stats_init_zt_api( clubb_vars_zt, l_error ) - - ! Initialize zm (momentum points) - - i = 1 - do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zm(i)) /= 0 .and. & - i <= nvarmax_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zm than allowed for by nvarmax_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & - "in the stats namelist, or change nvarmax_zm." - write(fstderr,*) "nvarmax_zm = ", nvarmax_zm - call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") - endif - - stats_zm%num_output_fields = ntot - stats_zm%kk = nnzp - - allocate( stats_zm%z( stats_zm%kk ) ) - - allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - - allocate( stats_zm%file%var( stats_zm%num_output_fields ) ) - allocate( stats_zm%file%z( stats_zm%kk ) ) - - ! Allocate scratch space - - allocate( zmscr01(stats_zm%kk) ) - allocate( zmscr02(stats_zm%kk) ) - allocate( zmscr03(stats_zm%kk) ) - allocate( zmscr04(stats_zm%kk) ) - allocate( zmscr05(stats_zm%kk) ) - allocate( zmscr06(stats_zm%kk) ) - allocate( zmscr07(stats_zm%kk) ) - allocate( zmscr08(stats_zm%kk) ) - allocate( zmscr09(stats_zm%kk) ) - allocate( zmscr10(stats_zm%kk) ) - allocate( zmscr11(stats_zm%kk) ) - allocate( zmscr12(stats_zm%kk) ) - allocate( zmscr13(stats_zm%kk) ) - allocate( zmscr14(stats_zm%kk) ) - allocate( zmscr15(stats_zm%kk) ) - allocate( zmscr16(stats_zm%kk) ) - allocate( zmscr17(stats_zm%kk) ) - - zmscr01 = 0.0_r8 - zmscr02 = 0.0_r8 - zmscr03 = 0.0_r8 - zmscr04 = 0.0_r8 - zmscr05 = 0.0_r8 - zmscr06 = 0.0_r8 - zmscr07 = 0.0_r8 - zmscr08 = 0.0_r8 - zmscr09 = 0.0_r8 - zmscr10 = 0.0_r8 - zmscr11 = 0.0_r8 - zmscr12 = 0.0_r8 - zmscr13 = 0.0_r8 - zmscr14 = 0.0_r8 - zmscr15 = 0.0_r8 - zmscr16 = 0.0_r8 - zmscr17 = 0.0_r8 - - call stats_init_zm_api( clubb_vars_zm, l_error ) - - ! Initialize rad_zt (radiation points) - - if (l_output_rad_files) then - - i = 1 - do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & - i <= nvarmax_rad_zt ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & - "in the stats namelist, or change nvarmax_rad_zt." - write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt - call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") - endif - - stats_rad_zt%num_output_fields = ntot - stats_rad_zt%kk = nnrad_zt - - allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) - - allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - - allocate( stats_rad_zt%file%var( stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) - - call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) - - ! Initialize rad_zm (radiation points) - - i = 1 - do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & - i <= nvarmax_rad_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & - "in the stats namelist, or change nvarmax_rad_zm." - write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm - call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") - endif - - stats_rad_zm%num_output_fields = ntot - stats_rad_zm%kk = nnrad_zm - - allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) - - allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - - allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) - - call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) - end if ! l_output_rad_files - - - ! Initialize sfc (surface point) - - i = 1 - do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_sfc(i)) /= 0 .and. & - i <= nvarmax_sfc ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_sfc ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_sfc than allowed for by nvarmax_sfc." - write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & - "in the stats namelist, or change nvarmax_sfc." - write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc - call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") - endif - - stats_sfc%num_output_fields = ntot - stats_sfc%kk = 1 - - allocate( stats_sfc%z( stats_sfc%kk ) ) - - allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - allocate( stats_sfc%file%var( stats_sfc%num_output_fields ) ) - allocate( stats_sfc%file%z( stats_sfc%kk ) ) - - call stats_init_sfc_api( clubb_vars_sfc, l_error ) - - ! Check for errors - - if ( l_error ) then - call endrun ('stats_init: errors found') - endif - -! Now call add fields - do i = 1, stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) - enddo - - do i = 1, stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%var(i)%name) - sub = temp1 - if (len(temp1) > 16) sub = temp1(1:16) - -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) - enddo - - if (l_output_rad_files) then -!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical - do i = 1, stats_rad_zt%num_output_fields - call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) - enddo - - do i = 1, stats_rad_zm%num_output_fields - call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) - enddo - endif - - do i = 1, stats_sfc%num_output_fields - call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& - 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) - enddo - - return - - end subroutine stats_init_clubb - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - - !----------------------------------------------------------------------- - subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) - - ! Description: Called when the stats timestep has ended. This subroutine - ! is responsible for calling statistics to be written to the output - ! format. - !----------------------------------------------------------------------- - -#ifdef CLUBB_SGS - - use shr_infnan_mod, only: is_nan => shr_infnan_isnan - - use clubb_api_module, only: & - fstderr, & ! Constant(s) - stats_zt, & ! Variable(s) - stats_zm, & - stats_rad_zt, & - stats_rad_zm, & - stats_sfc, & - l_stats_last, & - stats_tsamp, & - stats_tout, & - l_output_rad_files, & - clubb_at_least_debug_level_api ! Procedure(s) - - use cam_abortutils, only: endrun - - implicit none - - -#endif - - integer :: thecol - - real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) - real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) - real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) - -#ifdef CLUBB_SGS - ! Local Variables - - integer :: i, k - logical :: l_error - - ! Check if it is time to write to file - - if ( .not. l_stats_last ) return - - ! Initialize - l_error = .false. - - ! Compute averages - call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) - call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) - if (l_output_rad_files) then - call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples ) - call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples ) - end if - call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) - - ! Here we are not outputting the data, rather reading the stats into - ! arrays which are conformable to CAM output. Also, the data is "flipped" - ! in the vertical level to be the same as CAM output. - do i = 1, stats_zt%num_output_fields - do k = 1, stats_zt%kk - out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) - if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_zm%num_output_fields - do k = 1, stats_zt%kk - out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) - if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 - enddo - enddo - - if (l_output_rad_files) then - do i = 1, stats_rad_zt%num_output_fields - do k = 1, stats_rad_zt%kk - out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) - if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_rad_zm%num_output_fields - do k = 1, stats_rad_zm%kk - out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) - if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 - enddo - enddo - - ! Fill in values above the CLUBB top. - out_zt(thecol,:top_lev-1,:) = 0.0_r8 - out_zm(thecol,:top_lev-1,:) = 0.0_r8 - out_radzt(thecol,:top_lev-1,:) = 0.0_r8 - out_radzm(thecol,:top_lev-1,:) = 0.0_r8 - - endif ! l_output_rad_files - - do i = 1, stats_sfc%num_output_fields - out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) - if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 - enddo - - ! Reset sample fields - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - if (l_output_rad_files) then - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - end if - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - return - -#endif - - end subroutine stats_end_timestep_clubb - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - !----------------------------------------------------------------------- - subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) - - ! Description: - ! Initialize stats to zero - !----------------------------------------------------------------------- - - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - - implicit none - - ! Input - integer, intent(in) :: kk, num_output_fields - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n - logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update - - ! Zero out arrays - - if ( num_output_fields > 0 ) then - x(:,:,:,:) = 0.0_r8 - n(:,:,:,:) = 0 - l_in_update(:,:,:,:) = .false. - end if - - return - - end subroutine stats_zero - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - -#ifdef CLUBB_SGS - !----------------------------------------------------------------------- - subroutine stats_avg( kk, num_output_fields, x, n ) - - ! Description: - ! Compute the average of stats fields - !----------------------------------------------------------------------- - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - implicit none - - ! Input - integer, intent(in) :: num_output_fields, kk - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x - - ! Internal - - integer k,m - - ! Compute averages - - do m=1,num_output_fields - do k=1,kk - - if ( n(1,1,k,m) > 0 ) then - x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) - end if - - end do - end do - - return - - end subroutine stats_avg - - subroutine grid_size(state, grid_dx, grid_dy) - ! Determine the size of the grid for each of the columns in state - - use phys_grid, only: get_area_p - use shr_const_mod, only: shr_const_pi - use physics_types, only: physics_state - - - type(physics_state), intent(in) :: state - real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - - real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator - real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid - real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid - - real(r8) :: mpdeglat, column_area, degree - integer :: i - - ! determine the column area in radians - do i=1,state%ncol - column_area = get_area_p(state%lchnk,i) - degree = sqrt(column_area)*(180._r8/shr_const_pi) - - ! Now find meters per degree latitude - ! Below equation finds distance between two points on an ellipsoid, derived from expansion - ! taking into account ellipsoid using World Geodetic System (WGS84) reference - mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) - grid_dx(i) = mpdeglat * degree - grid_dy(i) = grid_dx(i) ! Assume these are the same - enddo - - end subroutine grid_size - -#endif - -#ifdef CLUBB_SGS - subroutine init_clubb_config_flags( clubb_config_flags_in ) -!------------------------------------------------------------------------------- -! Description: -! Initializes the public module variable 'clubb_config_flags' of type -! 'clubb_config_flags_type' on first call and only on first call. -! References: -! None -!------------------------------------------------------------------------------- - use clubb_api_module, only: & - clubb_config_flags_type, & ! Type - set_default_clubb_config_flags_api, & ! Procedure(s) - initialize_clubb_config_flags_type_api - - implicit none - - ! Input/Output Variables - type(clubb_config_flags_type), intent(inout) :: clubb_config_flags_in - - ! Local Variables - logical :: & - l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The - ! precipitation fraction is automatically set to 1 when this - ! flag is turned off. - l_predict_upwp_vpwp, & ! Flag to predict and along with and - ! alongside the advancement of , , , - ! , , and in subroutine - ! advance_xm_wpxp. Otherwise, and are still - ! approximated by eddy diffusivity when and are - ! advanced in subroutine advance_windm_edsclrm. - l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping - ! the overall correlation of w and x (w and rt, as well as w - ! and theta-l) within the limits of -max_mag_correlation_flux - ! to max_mag_correlation_flux. - l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and - ! thlp2) on keeping the overall correlation of w and x within - ! the limits of -max_mag_correlation_flux to - ! max_mag_correlation_flux. - l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the - ! turbulent dissipation coefficient, C2. - l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm - l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor - l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 - l_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects wprtp, wpthlp, & wpsclrp. - l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & - ! sclrpthlp. - l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtm, thlm, sclrm, um and vm. - l_uv_nudge, & ! For wind speed nudging. - l_rtm_nudge, & ! For rtm nudging - l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. - ! TKE = 1/2 (u'^2 + v'^2 + w'^2) - l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to - ! compute the varibles that are output from high order - ! closure - l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the - ! thermodynamic-level variables output from pdf_closure. - l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three - ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - - ! output from pdf_closure. - l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call - ! subroutine pdf_closure twice. If true, pdf_closure is - ! called first on thermodynamic levels and then on momentum - ! levels so that each variable is computed on its native - ! level. If false, pdf_closure is only called on - ! thermodynamic levels, and variables which belong on - ! momentum levels are interpolated. - l_standard_term_ta, & ! Use the standard discretization for the turbulent advection - ! terms. Setting to .false. means that a_1 and a_3 are - ! pulled outside of the derivative in - ! advance_wp2_wp3_module.F90 and in - ! advance_xp2_xpyp_module.F90. - l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac - ! and rcm to help increase cloudiness at coarser grid - ! resolutions. - l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones - l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors - l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) - l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) - l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability - ! correction - l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of - ! -(2/3)*em/tau_zm, as in Bougeault (1981) - l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly - l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values - l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the - ! mixing length scale as Lscale = tau * tke - l_use_ice_latent, & ! Includes the effects of ice latent heating in turbulence - ! terms - l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number - l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number - l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in - ! saturated atmospheres (from Durran and Klemp, 1982) - l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency - l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water - l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and - ! rtpthlp - l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 - l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz - l_update_pressure ! Flag for having CLUBB update pressure and exner - - logical, save :: first_call = .true. - - if (first_call) then - - call set_default_clubb_config_flags_api( l_use_precip_frac, & ! Out - l_predict_upwp_vpwp, & ! Out - l_min_wp2_from_corr_wx, & ! Out - l_min_xp2_from_corr_wx, & ! Out - l_C2_cloud_frac, & ! Out - l_diffuse_rtm_and_thlm, & ! Out - l_stability_correct_Kh_N2_zm, & ! Out - l_calc_thlp2_rad, & ! Out - l_upwind_wpxp_ta, & ! Out - l_upwind_xpyp_ta, & ! Out - l_upwind_xm_ma, & ! Out - l_uv_nudge, & ! Out - l_rtm_nudge, & ! Out - l_tke_aniso, & ! Out - l_vert_avg_closure, & ! Out - l_trapezoidal_rule_zt, & ! Out - l_trapezoidal_rule_zm, & ! Out - l_call_pdf_closure_twice, & ! Out - l_standard_term_ta, & ! Out - l_use_cloud_cover, & ! Out - l_diagnose_correlations, & ! Out - l_calc_w_corr, & ! Out - l_const_Nc_in_cloud, & ! Out - l_fix_w_chi_eta_correlations, & ! Out - l_stability_correct_tau_zm, & ! Out - l_damp_wp2_using_em, & ! Out - l_do_expldiff_rtm_thlm, & ! Out - l_Lscale_plume_centered, & ! Out - l_diag_Lscale_from_tau, & ! Out - l_use_ice_latent, & ! Out - l_use_C7_Richardson, & ! Out - l_use_C11_Richardson, & ! Out - l_brunt_vaisala_freq_moist, & ! Out - l_use_thvm_in_bv_freq, & ! Out - l_rcm_supersat_adj, & ! Out - l_single_C2_Skw, & ! Out - l_damp_wp3_Skw_squared, & ! Out - l_prescribed_avg_deltaz, & ! Out - l_update_pressure ) ! Out - - call initialize_clubb_config_flags_type_api( l_use_precip_frac, & ! In - l_predict_upwp_vpwp, & ! In - l_min_wp2_from_corr_wx, & ! In - l_min_xp2_from_corr_wx, & ! In - l_C2_cloud_frac, & ! In - l_diffuse_rtm_and_thlm, & ! In - l_stability_correct_Kh_N2_zm, & ! In - l_calc_thlp2_rad, & ! In - l_upwind_wpxp_ta, & ! In - l_upwind_xpyp_ta, & ! In - l_upwind_xm_ma, & ! In - l_uv_nudge, & ! In - l_rtm_nudge, & ! In - l_tke_aniso, & ! In - l_vert_avg_closure, & ! In - l_trapezoidal_rule_zt, & ! In - l_trapezoidal_rule_zm, & ! In - l_call_pdf_closure_twice, & ! In - l_standard_term_ta, & ! In - l_use_cloud_cover, & ! In - l_diagnose_correlations, & ! In - l_calc_w_corr, & ! In - l_const_Nc_in_cloud, & ! In - l_fix_w_chi_eta_correlations, & ! In - l_stability_correct_tau_zm, & ! In - l_damp_wp2_using_em, & ! In - l_do_expldiff_rtm_thlm, & ! In - l_Lscale_plume_centered, & ! In - l_diag_Lscale_from_tau, & ! In - l_use_ice_latent, & ! In - l_use_C7_Richardson, & ! In - l_use_C11_Richardson, & ! In - l_brunt_vaisala_freq_moist, & ! In - l_use_thvm_in_bv_freq, & ! In - l_rcm_supersat_adj, & ! In - l_single_C2_Skw, & ! In - l_damp_wp3_Skw_squared, & ! In - l_prescribed_avg_deltaz, & ! In - l_update_pressure, & ! In - clubb_config_flags_in ) ! Out - - first_call = .false. - - end if - - return - - end subroutine init_clubb_config_flags -#endif - -end module clubb_intr +module clubb_intr + + !----------------------------------------------------------------------------------------------------- ! + ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! + ! by the University of Wisconsin Milwaukee Group (UWM). ! + ! ! + ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! + ! ! + ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! + ! differencing the diffused and initial states. ! + ! ! + ! Calling sequence: ! + ! ! + !---------------------------Code history-------------------------------------------------------------- ! + ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! + ! Modified by: K Thayer-Calder ! + ! ! + !----------------------------------------------------------------------------------------------------- ! + + use shr_kind_mod, only: r8=>shr_kind_r8 + use ppgrid, only: pver, pverp, pcols, begchunk, endchunk + use phys_control, only: phys_getopts + use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o + + use spmd_utils, only: masterproc + use constituents, only: pcnst, cnst_add + use pbl_utils, only: calc_ustar, calc_obklen + use ref_pres, only: top_lev => trop_cloud_top_lev + use zm_conv_intr, only: zmconv_microp +#ifdef CLUBB_SGS + use clubb_api_module, only: pdf_parameter, implicit_coefs_terms + use clubb_api_module, only: clubb_config_flags_type + use cloud_fraction, only: dp1, dp2 + use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad + use cam_history_support, only: add_hist_coord +#endif + + implicit none + private + save + + ! ----------------- ! + ! Public interfaces ! + ! ----------------- ! + + public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, & +#ifdef CLUBB_SGS + ! This utilizes CLUBB specific variables in its interface + stats_init_clubb, & + init_clubb_config_flags, & +#endif + stats_end_timestep_clubb, & + clubb_readnl, & + clubb_init_cnst, & + clubb_implements_cnst + +#ifdef CLUBB_SGS + ! Both of these utilize CLUBB specific variables in their interface + private :: stats_zero, stats_avg +#endif + + logical, public :: do_cldcool + logical :: clubb_do_icesuper + +#ifdef CLUBB_SGS + type(clubb_config_flags_type), public :: clubb_config_flags +#endif + + ! ------------ ! + ! Private data ! + ! ------------ ! + + integer, parameter :: & + grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels + hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements + + real(r8), parameter, dimension(0) :: & + sclr_tol = 1.e-8_r8 ! Total water in kg/kg + + character(len=6) :: saturation_equation + + real(r8), parameter :: & + theta0 = 300._r8, & ! Reference temperature [K] + ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] + p0_clubb = 100000._r8 + + integer, parameter :: & + sclr_dim = 0 ! Higher-order scalars, set to zero + + real(r8), parameter :: & + wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected + + real(r8), parameter :: & + wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected + + real(r8), parameter :: & + wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected + + real(r8), parameter :: & + rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected + + real(r8), parameter :: unset_r8 = huge(1.0_r8) + + ! Commonly used temperature for the melting temp of ice crystals [K] + real(r8), parameter :: meltpt_temp = 268.15_r8 + + real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist + real(r8) :: clubb_rnevap_effic = unset_r8 + + real(r8) :: clubb_c1 = unset_r8 + real(r8) :: clubb_c1b = unset_r8 + real(r8) :: clubb_C2rt = unset_r8 + real(r8) :: clubb_C2thl = unset_r8 + real(r8) :: clubb_C2rtthl = unset_r8 + real(r8) :: clubb_C4 = unset_r8 + real(r8) :: clubb_C6rt = unset_r8 + real(r8) :: clubb_c6rtb = unset_r8 + real(r8) :: clubb_c6rtc = unset_r8 + real(r8) :: clubb_c6thl = unset_r8 + real(r8) :: clubb_c6thlb = unset_r8 + real(r8) :: clubb_c6thlc = unset_r8 + real(r8) :: clubb_C8 = unset_r8 + real(r8) :: clubb_C8b = unset_r8 + real(r8) :: clubb_C7 = unset_r8 + real(r8) :: clubb_C7b = unset_r8 + real(r8) :: clubb_c11 = unset_r8 + real(r8) :: clubb_c11b = unset_r8 + real(r8) :: clubb_c14 = unset_r8 + real(r8) :: clubb_c_K9 = unset_r8 + real(r8) :: clubb_nu9 = unset_r8 + real(r8) :: clubb_c_K10 = unset_r8 + real(r8) :: clubb_c_K10h = unset_r8 + real(r8) :: clubb_gamma_coef = unset_r8 + real(r8) :: clubb_gamma_coefb = unset_r8 + real(r8) :: clubb_beta = unset_r8 + real(r8) :: clubb_lambda0_stability_coef = unset_r8 + real(r8) :: clubb_lmin_coef = unset_r8 + real(r8) :: clubb_mult_coef = unset_r8 + real(r8) :: clubb_Skw_denom_coef = unset_r8 + real(r8) :: clubb_skw_max_mag = unset_r8 + real(r8) :: clubb_up2_vp2_factor = unset_r8 + real(r8) :: clubb_C_wp2_splat = unset_r8 + real(r8) :: clubb_wpxp_L_thresh = unset_r8 + real(r8) :: clubb_detliq_rad = unset_r8 + real(r8) :: clubb_detice_rad = unset_r8 + real(r8) :: clubb_detphase_lowtemp = unset_r8 + logical :: clubb_l_brunt_vaisala_freq_moist = .false. + logical :: clubb_l_call_pdf_closure_twice = .false. + logical :: clubb_l_damp_wp3_Skw_squared = .false. + logical :: clubb_l_min_wp2_from_corr_wx = .false. + logical :: clubb_l_min_xp2_from_corr_wx = .false. + logical :: clubb_l_predict_upwp_vpwp = .false. + logical :: clubb_l_rcm_supersat_adj = .false. + logical :: clubb_l_stability_correct_tau_zm = .false. + logical :: clubb_l_trapezoidal_rule_zt = .false. + logical :: clubb_l_trapezoidal_rule_zm = .false. + logical :: clubb_l_upwind_xpyp_ta = .false. + logical :: clubb_l_use_C7_Richardson = .false. + logical :: clubb_l_use_C11_Richardson = .false. + logical :: clubb_l_use_cloud_cover = .false. + logical :: clubb_l_use_thvm_in_bv_freq = .false. + logical :: clubb_l_vert_avg_closure = .false. + logical :: clubb_l_diag_Lscale_from_tau = .false. + logical :: clubb_l_damp_wp2_using_em = .false. + +! Constant parameters + logical, parameter, private :: & + l_implemented = .true., & ! Implemented in a host model (always true) + l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes + + logical, parameter, private :: & + apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) + + logical :: lq(pcnst) + logical :: prog_modal_aero + logical :: do_rainturb + logical :: do_expldiff + logical :: clubb_do_adv + logical :: clubb_do_liqsupersat = .false. + logical :: clubb_do_energyfix = .true. + logical :: history_budget + + logical :: clubb_l_lscale_plume_centered + logical :: clubb_l_use_ice_latent + + integer :: history_budget_histfile_num + integer :: edsclr_dim ! Number of scalars to transport in CLUBB + integer :: offset + +! define physics buffer indicies here + integer :: & + wp2_idx, & ! vertical velocity variances + wp3_idx, & ! third moment of vertical velocity + wpthlp_idx, & ! turbulent flux of thetal + wprtp_idx, & ! turbulent flux of total water + rtpthlp_idx, & ! covariance of thetal and rt + rtp2_idx, & ! variance of total water + thlp2_idx, & ! variance of thetal + rtp3_idx, & ! total water 3rd order + thlp3_idx, & ! thetal 3rd order + up2_idx, & ! variance of east-west wind + vp2_idx, & ! variance of north-south wind + up3_idx, & ! east-west wind 3rd order + vp3_idx, & ! north-south wind 3rd order + upwp_idx, & ! east-west momentum flux + vpwp_idx, & ! north-south momentum flux + thlm_idx, & ! mean thetal + rtm_idx, & ! mean total water mixing ratio + um_idx, & ! mean of east-west wind + vm_idx, & ! mean of north-south wind + wpthvp_idx, & ! buoyancy flux + wp2thvp_idx, & ! second order buoyancy term + rtpthvp_idx, & ! moisture buoyancy correlation + thlpthvp_idx, & ! temperature buoyancy correlation + sclrpthvp_idx, & ! passive scalar buoyancy correlation + cloud_frac_idx, & ! CLUBB's cloud fraction + cld_idx, & ! Cloud fraction + concld_idx, & ! Convective cloud fraction + ast_idx, & ! Stratiform cloud fraction + alst_idx, & ! Liquid stratiform cloud fraction + aist_idx, & ! Ice stratiform cloud fraction + qlst_idx, & ! Physical in-cloud LWC + qist_idx, & ! Physical in-cloud IWC + dp_frac_idx, & ! deep convection cloud fraction + sh_frac_idx, & ! shallow convection cloud fraction + kvh_idx, & ! CLUBB eddy diffusivity on thermo levels + pblh_idx, & ! PBL pbuf + icwmrdp_idx, & ! In cloud mixing ratio for deep convection + tke_idx, & ! turbulent kinetic energy + tpert_idx, & ! temperature perturbation from PBL + fice_idx, & ! fice_idx index in physics buffer + cmeliq_idx, & ! cmeliq_idx index in physics buffer + relvar_idx, & ! relative cloud water variance + accre_enhan_idx, & ! optional accretion enhancement factor for MG + npccn_idx, & ! liquid ccn number concentration + naai_idx, & ! ice number concentration + prer_evap_idx, & ! rain evaporation rate + qrl_idx, & ! longwave cooling rate + radf_idx, & + qsatfac_idx, & ! subgrid cloud water saturation scaling factor + ice_supersat_idx, & ! ice cloud fraction for SILHS + rcm_idx, & ! Cloud water mixing ratio for SILHS + ztodt_idx ! physics timestep for SILHS + + ! Indices for microphysical covariance tendencies + integer :: & + rtp2_mc_zt_idx, & + thlp2_mc_zt_idx, & + wprtp_mc_zt_idx, & + wpthlp_mc_zt_idx, & + rtpthlp_mc_zt_idx + + integer, public :: & + ixthlp2 = 0, & + ixwpthlp = 0, & + ixwprtp = 0, & + ixwp2 = 0, & + ixwp3 = 0, & + ixrtpthlp = 0, & + ixrtp2 = 0, & + ixup2 = 0, & + ixvp2 = 0 + + integer :: cmfmc_sh_idx = 0 + + integer :: & + dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. + difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. + dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. + dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. + + integer :: & + qt_macmic_idx, & + thl_macmic_idx, & + rcm_macmic_idx, & + cldfrac_macmic_idx, & + wpthlp_macmic_idx, & + wprtp_macmic_idx, & + wpthvp_macmic_idx, & + mf_wpthlp_macmic_idx, & + mf_wprtp_macmic_idx, & + mf_wpthvp_macmic_idx + + integer :: & + prec_sh_idx, & + snow_sh_idx + + ! Output arrays for CLUBB statistics + real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc + + character(len=16) :: eddy_scheme ! Default set in phys_control.F90 + character(len=16) :: deep_scheme ! Default set in phys_control.F90 + character(len=16) :: subcol_scheme + + integer, parameter :: ncnst=9 + character(len=8) :: cnst_names(ncnst) + logical :: do_cnst=.false. + +#ifdef CLUBB_SGS + type(pdf_parameter), target, allocatable, public, protected :: & + pdf_params_chnk(:,:) ! PDF parameters (thermo. levs.) [units vary] + type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:,:) ! PDF parameters on momentum levs. [units vary] + type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:,:) ! PDF impl. coefs. & expl. terms [units vary] +#endif + + contains + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_register_cam( ) +!------------------------------------------------------------------------------- +! Description: +! Register the constituents and fields in the physics buffer +! Author: P. Bogenschutz, C. Craig, A. Gettelman +! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns +! +!------------------------------------------------------------------------------- +#ifdef CLUBB_SGS + + !------------------------------------------------ ! + ! Register physics buffer fields and constituents ! + !------------------------------------------------ ! + + ! Add CLUBB fields to pbuf + use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls + use subcol_utils, only: subcol_get_scheme + + integer :: cld_macmic_num_steps + + call phys_getopts( eddy_scheme_out = eddy_scheme, & + deep_scheme_out = deep_scheme, & + history_budget_out = history_budget, & + history_budget_histfile_num_out = history_budget_histfile_num , & + cld_macmic_num_steps_out = cld_macmic_num_steps) + subcol_scheme = subcol_get_scheme() + + if (trim(subcol_scheme) == 'SILHS') then + saturation_equation = "flatau" + else + saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP + end if + + if (clubb_do_adv) then + cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) + do_cnst=.true. + ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments + ! need a constant added to them before they are advected, thus this would corrupt the output. + ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments + call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) + call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) + call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) + call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) + call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) + call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) + call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) + call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) + call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) + end if + + ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top + call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) + call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) + call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) + call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) + call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) + call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) + call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) + call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) + call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) + call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) + call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) + call pbuf_add_field('FICE', 'global',dtype_r8, (/pcols,pver/), fice_idx) + call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) + call pbuf_add_field('CMELIQ', 'global',dtype_r8, (/pcols,pver/), cmeliq_idx) + call pbuf_add_field('QSATFAC', 'global',dtype_r8, (/pcols,pver/), qsatfac_idx) + + call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) + call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) + call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) + call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) + call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) + call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) + call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) + call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) + call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) + + call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) + call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) + call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) + call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) + + call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) + call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) + call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) + call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) + call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) + call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) + + call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) + call pbuf_add_field('WP2THVP', 'global', dtype_r8, (/pcols,pverp/), wp2thvp_idx) + call pbuf_add_field('RTPTHVP', 'global', dtype_r8, (/pcols,pverp/), rtpthvp_idx) + call pbuf_add_field('THLPTHVP', 'global', dtype_r8, (/pcols,pverp/), thlpthvp_idx) + call pbuf_add_field('CLOUD_FRAC', 'global', dtype_r8, (/pcols,pverp/), cloud_frac_idx) + call pbuf_add_field('ISS_FRAC', 'global', dtype_r8, (/pcols,pverp/), ice_supersat_idx) + call pbuf_add_field('RCM', 'global', dtype_r8, (/pcols,pverp/), rcm_idx) + call pbuf_add_field('ZTODT', 'global', dtype_r8, (/pcols/), ztodt_idx) + + ! For SILHS microphysical covariance contributions + call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) + call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) + call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) + call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) + call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) + + call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') + call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') + + call pbuf_add_field('QT_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) + call pbuf_add_field('THETAL_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) + call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) + call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) + call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) + call pbuf_add_field('WPRTP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) + call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) + if (do_clubb_mf) then + call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) + call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) + call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) + end if + +#endif + + end subroutine clubb_register_cam + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +function clubb_implements_cnst(name) + + !----------------------------------------------------------------------------- ! + ! ! + ! Return true if specified constituent is implemented by this package ! + ! ! + !----------------------------------------------------------------------------- ! + + character(len=*), intent(in) :: name ! constituent name + logical :: clubb_implements_cnst ! return value + + !----------------------------------------------------------------------- + + clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) + +end function clubb_implements_cnst + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) +#ifdef CLUBB_SGS + use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol +#endif + + !----------------------------------------------------------------------- ! + ! ! + ! Initialize the state if clubb_do_adv ! + ! ! + !----------------------------------------------------------------------- ! + + character(len=*), intent(in) :: name ! constituent name + real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) + real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) + logical, intent(in) :: mask(:) ! Only initialize where .true. + real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev + + !----------------------------------------------------------------------- + integer :: k, nlev + +#ifdef CLUBB_SGS + if (clubb_do_adv) then + nlev = size(q, 2) + do k = 1, nlev + if (trim(name) == trim(cnst_names(1))) then + where(mask) + q(:,k) = thl_tol**2 + end where + end if + if (trim(name) == trim(cnst_names(2))) then + where(mask) + q(:,k) = rt_tol**2 + end where + end if + if (trim(name) == trim(cnst_names(3))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(4))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(5))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(6))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + if (trim(name) == trim(cnst_names(7))) then + where(mask) + q(:,k) = 0.0_r8 + end where + end if + if (trim(name) == trim(cnst_names(8))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + if (trim(name) == trim(cnst_names(9))) then + where(mask) + q(:,k) = w_tol_sqd + end where + end if + end do + end if +#endif + +end subroutine clubb_init_cnst + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_readnl(nlfile) + +#ifdef CLUBB_SGS + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use cam_abortutils, only: endrun + use clubb_api_module, only: l_stats, l_output_rad_files + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8 + use clubb_mf, only: clubb_mf_readnl +#endif + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + +#ifdef CLUBB_SGS + + character(len=*), parameter :: sub = 'clubb_readnl' + + logical :: clubb_history, clubb_rad_history, clubb_cloudtop_cooling, clubb_rainevap_turb, & + clubb_expldiff ! Stats enabled (T/F) + + integer :: iunit, read_status, ierr + + namelist /clubb_his_nl/ clubb_history, clubb_rad_history + namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, clubb_expldiff, & + clubb_do_adv, clubb_timestep, & + clubb_rnevap_effic,clubb_do_icesuper + namelist /clubb_params_nl/ clubb_c1, clubb_c1b, clubb_c11, clubb_c11b, clubb_c14, clubb_mult_coef, clubb_gamma_coef, & + clubb_c_K10, clubb_c_K10h, clubb_beta, clubb_C2rt, clubb_C2thl, & + clubb_C2rtthl, clubb_C8, clubb_C8b, clubb_C7, clubb_C7b, clubb_Skw_denom_coef, & + clubb_c6rt, clubb_c6rtb, clubb_c6rtc, clubb_c6thl, clubb_c6thlb, clubb_c6thlc, & + clubb_C4, clubb_c_K9, clubb_nu9, clubb_C_wp2_splat, clubb_wpxp_L_thresh, & + clubb_lambda0_stability_coef, clubb_l_lscale_plume_centered, & + clubb_l_use_ice_latent, clubb_do_liqsupersat, clubb_do_energyfix,& + clubb_lmin_coef,clubb_skw_max_mag, clubb_l_stability_correct_tau_zm, & + clubb_gamma_coefb, clubb_up2_vp2_factor, clubb_detliq_rad, clubb_detice_rad, & + clubb_detphase_lowtemp, & + clubb_l_use_C7_Richardson, clubb_l_use_C11_Richardson, & + clubb_l_brunt_vaisala_freq_moist, clubb_l_use_thvm_in_bv_freq, & + clubb_l_rcm_supersat_adj, clubb_l_damp_wp3_Skw_squared, & + clubb_l_predict_upwp_vpwp, clubb_l_min_wp2_from_corr_wx, & + clubb_l_min_xp2_from_corr_wx, clubb_l_upwind_xpyp_ta, clubb_l_vert_avg_closure, & + clubb_l_trapezoidal_rule_zt, clubb_l_trapezoidal_rule_zm, & + clubb_l_call_pdf_closure_twice, clubb_l_use_cloud_cover, & + clubb_l_diag_Lscale_from_tau, clubb_l_damp_wp2_using_em + + !----- Begin Code ----- + + ! Determine if we want clubb_history to be output + clubb_history = .false. ! Initialize to false + l_stats = .false. ! Initialize to false + l_output_rad_files = .false. ! Initialize to false + do_cldcool = .false. ! Initialize to false + do_rainturb = .false. ! Initialize to false + do_expldiff = .false. ! Initialize to false + + clubb_l_lscale_plume_centered = .false. ! Initialize to false! + clubb_l_use_ice_latent = .false. ! Initialize to false! + + ! Call CLUBB+MF namelist + call clubb_mf_readnl(nlfile) + + ! Read namelist to determine if CLUBB history should be called + if (masterproc) then + iunit = getunit() + open( iunit, file=trim(nlfile), status='old' ) + + call find_group_name(iunit, 'clubb_his_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_his_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + end if + + call find_group_name(iunit, 'clubb_params_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_params_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + else + call endrun('clubb_readnl: error reading namelist') + end if + + call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('clubb_readnl: error reading namelist') + end if + end if + + close(unit=iunit) + call freeunit(iunit) + end if + + ! Broadcast namelist variables + call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") + call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") + call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") + call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") + call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") + call mpi_bcast(clubb_expldiff, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_expldiff") + call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") + call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") + call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") + + call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") + call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") + call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") + call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") + call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") + call mpi_bcast(clubb_c6rt, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rt") + call mpi_bcast(clubb_c6rtb, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtb") + call mpi_bcast(clubb_c6rtc, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtc") + call mpi_bcast(clubb_c6thl, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thl") + call mpi_bcast(clubb_c6thlb, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlb") + call mpi_bcast(clubb_c6thlc, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlc") + call mpi_bcast(clubb_wpxp_L_thresh, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_wpxp_L_thresh") + call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") + call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") + call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") + call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") + call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") + call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") + call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") + call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") + call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") + call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") + call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") + call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") + call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") + call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") + call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") + call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") + call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") + call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") + call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") + call mpi_bcast(clubb_l_use_ice_latent, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_ice_latent") + call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") + call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") + + call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") + call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") + call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") + call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") + call mpi_bcast(clubb_up2_vp2_factor, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_vp2_factor") + call mpi_bcast(clubb_detliq_rad, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detliq_rad") + call mpi_bcast(clubb_detice_rad, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detice_rad") + call mpi_bcast(clubb_detphase_lowtemp, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detphase_lowtemp") + + call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") + call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") + call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") + call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") + call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") + call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") + call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") + call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") + call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") + call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") + call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") + call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") + call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") + call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") + call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") + call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") + call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") + + ! Overwrite defaults if they are true + if (clubb_history) l_stats = .true. + if (clubb_rad_history) l_output_rad_files = .true. + if (clubb_cloudtop_cooling) do_cldcool = .true. + if (clubb_rainevap_turb) do_rainturb = .true. + if (clubb_expldiff) do_expldiff = .true. + +! Check that all namelists have been set + if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") + if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") + + if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") + if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") + if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") + if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") + if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") + if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") + if(clubb_c6rt == unset_r8) call endrun(sub//": FATAL: clubb_c6rt is not set") + if(clubb_c6rtb == unset_r8) call endrun(sub//": FATAL: clubb_c6rtb is not set") + if(clubb_c6rtc == unset_r8) call endrun(sub//": FATAL: clubb_c6rtc is not set") + if(clubb_c6thl == unset_r8) call endrun(sub//": FATAL: clubb_c6thl is not set") + if(clubb_c6thlb == unset_r8) call endrun(sub//": FATAL: clubb_c6thlb is not set") + if(clubb_c6thlc == unset_r8) call endrun(sub//": FATAL: clubb_c6thlc is not set") + if(clubb_wpxp_L_thresh == unset_r8) call endrun(sub//": FATAL: clubb_wpxp_L_thresh is not set") + if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") + if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") + if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") + if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") + if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") + if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") + if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") + if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") + if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") + if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") + if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") + if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") + if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") + if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") + if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") + if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") + if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") + if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") + if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") + if(clubb_up2_vp2_factor == unset_r8) call endrun(sub//": FATAL: clubb_up2_vp2_factor is not set") + if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") + if(clubb_detliq_rad == unset_r8) call endrun(sub//": FATAL: clubb_detliq_rad not set") + if(clubb_detice_rad == unset_r8) call endrun(sub//": FATAL: clubb_detice_rad not set") + if(clubb_detphase_lowtemp == unset_r8) call endrun(sub//": FATAL: clubb_detphase_lowtemp not set") + if(clubb_detphase_lowtemp >= meltpt_temp) & + call endrun(sub//": ERROR: clubb_detphase_lowtemp must be less than 268.15 K") + +#endif + end subroutine clubb_readnl + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_ini_cam(pbuf2d) +!------------------------------------------------------------------------------- +! Description: +! Initialize UWM CLUBB. +! Author: Cheryl Craig March 2011 +! Modifications: Pete Bogenschutz 2011 March and onward +! Modifications: K Thayer-Calder 2013 July and onward +! Origin: Based heavily on UWM clubb_init.F90 +! References: +! None +!------------------------------------------------------------------------------- + + + +#ifdef CLUBB_SGS + + ! From CAM libraries + use cam_history, only: addfld, add_default, horiz_only + use ref_pres, only: pref_mid + use hb_diff, only: init_hb_diff + use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx + use cam_abortutils, only: endrun + + ! These are needed to set parameters + use clubb_api_module, only: & + ilambda0_stability_coef, ic_K10, ic_K10h, iC7, iC7b, iC8, iC8b, iC11, iC11b, iC4, & + iC1, iC1b, iC6rt, iC6rtb, iC6rtc, iC6thl, iC6thlb, iC6thlc, iup2_vp2_factor, iwpxp_L_thresh, & + iC14, igamma_coef, igamma_coefb, imult_coef, ilmin_coef, iSkw_denom_coef, ibeta, iskw_max_mag, & + iC2rt, iC2thl, iC2rtthl, ic_K9, inu9, iC_wp2_splat, params_list + + use clubb_api_module, only: & + print_clubb_config_flags_api, & + setup_clubb_core_api, & + init_pdf_params_api, & + init_pdf_implicit_coefs_terms_api, & + time_precision, & + core_rknd, & + set_clubb_debug_level_api, & + clubb_fatal_error, & ! Error code value to indicate a fatal error + nparams, & + read_parameters_api, & + l_stats, & + l_stats_samp, & + l_grads, & + stats_zt, & + stats_zm, & + stats_sfc, & + stats_rad_zt, & + stats_rad_zm, & + w_tol_sqd, & + rt_tol, & + thl_tol + + ! These are only needed if we're using a passive scalar + use clubb_api_module, only: & + iisclr_rt, & + iisclr_thl, & + iisclr_CO2, & + iiedsclr_rt, & + iiedsclr_thl, & + iiedsclr_CO2 + + use time_manager, only: is_first_step + use clubb_api_module, only: hydromet_dim + use constituents, only: cnst_get_ind + use phys_control, only: phys_getopts + use spmd_utils, only: iam + use cam_logfile, only: iulog +#endif + + use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc + implicit none + ! Input Variables + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + +#ifdef CLUBB_SGS + + real(kind=time_precision) :: dum1, dum2, dum3 + + real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) + + ! The similar name to clubb_history is unfortunate... + logical :: history_amwg, history_clubb + + integer :: cld_macmic_num_steps + + integer :: err_code ! Code for when CLUBB fails + integer :: j, k, l ! Indices + integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) + integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) + integer :: nmodes, nspec, m + integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice + integer :: lptr + + logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. + logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. + + real(r8) :: zt_g(pverp+1-top_lev) ! Height dummy array + real(r8) :: zi_g(pverp+1-top_lev) ! Height dummy array + + ! CAM defines zi at the surface to be zero. + real(r8), parameter :: sfc_elevation = 0._r8 + + integer :: nlev + + !----- Begin Code ----- + + nlev = pver + 1 - top_lev + + if (core_rknd /= r8) then + call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') + end if + + ! Allocate PDF parameters across columns and chunks + allocate( & + pdf_params_chnk(pcols,begchunk:endchunk), & + pdf_params_zm_chnk(pcols,begchunk:endchunk), & + pdf_implicit_coefs_terms_chnk(pcols,begchunk:endchunk) ) + + ! Allocate (in the vertical) and zero PDF parameters + do l = begchunk, endchunk, 1 + do j = 1, pcols, 1 + call init_pdf_params_api( pverp+1-top_lev, pdf_params_chnk(j,l) ) + call init_pdf_params_api( pverp+1-top_lev, pdf_params_zm_chnk(j,l) ) + call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, sclr_dim, & + pdf_implicit_coefs_terms_chnk(j,l) ) + enddo ! j = 1, pcols, 1 + enddo ! l = begchunk, endchunk, 1 + + ! ----------------------------------------------------------------- ! + ! Determine how many constituents CLUBB will transport. Note that + ! CLUBB does not transport aerosol consituents. Therefore, need to + ! determine how many aerosols constituents there are and subtract that + ! off of pcnst (the total consituents) + ! ----------------------------------------------------------------- ! + + call phys_getopts(prog_modal_aero_out=prog_modal_aero, & + history_amwg_out=history_amwg, & + history_clubb_out=history_clubb, & + cld_macmic_num_steps_out=cld_macmic_num_steps) + + ! Select variables to apply tendencies back to CAM + + ! Initialize all consituents to true to start + lq(1:pcnst) = .true. + edsclr_dim = pcnst + + call cnst_get_ind('Q',ixq) + call cnst_get_ind('NUMICE',ixnumice) + call cnst_get_ind('NUMLIQ',ixnumliq) + call cnst_get_ind('CLDLIQ',ixcldliq) + call cnst_get_ind('CLDICE',ixcldice) + + if (prog_modal_aero) then + ! Turn off modal aerosols and decrement edsclr_dim accordingly + call rad_cnst_get_info(0, nmodes=nmodes) + + do m = 1, nmodes + call rad_cnst_get_mode_num_idx(m, lptr) + lq(lptr)=.false. + edsclr_dim = edsclr_dim-1 + + call rad_cnst_get_info(0, m, nspec=nspec) + do l = 1, nspec + call rad_cnst_get_mam_mmr_idx(m, l, lptr) + lq(lptr)=.false. + edsclr_dim = edsclr_dim-1 + end do + end do + + ! In addition, if running with MAM, droplet number is transported + ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport + ! tendencies to avoid double counted. Else, we apply tendencies. + lq(ixnumliq) = .false. + edsclr_dim = edsclr_dim-1 + endif + + ! ----------------------------------------------------------------- ! + ! Set the debug level. Level 2 has additional computational expense since + ! it checks the array variables in CLUBB for invalid values. + ! ----------------------------------------------------------------- ! + call set_clubb_debug_level_api( 0 ) + + ! ----------------------------------------------------------------- ! + ! use pbuf_get_fld_idx to get existing physics buffer fields from other + ! physics packages (e.g. tke) + ! ----------------------------------------------------------------- ! + + + ! Defaults + l_stats_samp = .false. + l_grads = .false. + + ! Overwrite defaults if needbe + if (l_stats) l_stats_samp = .true. + + ! Define physics buffers indexes + cld_idx = pbuf_get_index('CLD') ! Cloud fraction + concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover + ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction + alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction + aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction + qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC + qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC + dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction + icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio + icwmrsh_idx = pbuf_get_index('ICWMRSH') ! In-cloud shallow convective mixing ratio (EDMF) + sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction + relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance + accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG + prer_evap_idx = pbuf_get_index('PRER_EVAP') + qrl_idx = pbuf_get_index('QRL') + cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') + naai_idx = pbuf_get_index('NAAI') + npccn_idx = pbuf_get_index('NPCCN') + + ! CLUBB+MF + prec_sh_idx = pbuf_get_index('PREC_SH') + snow_sh_idx = pbuf_get_index('SNOW_SH') + + iisclr_rt = -1 + iisclr_thl = -1 + iisclr_CO2 = -1 + + iiedsclr_rt = -1 + iiedsclr_thl = -1 + iiedsclr_CO2 = -1 + + if (zmconv_microp) then + dlfzm_idx = pbuf_get_index('DLFZM') + difzm_idx = pbuf_get_index('DIFZM') + dnlfzm_idx = pbuf_get_index('DNLFZM') + dnifzm_idx = pbuf_get_index('DNIFZM') + end if + + ! ----------------------------------------------------------------- ! + ! Define number of tracers for CLUBB to diffuse + ! ----------------------------------------------------------------- ! + + if (do_expldiff) then + offset = 2 ! diffuse temperature and moisture explicitly + edsclr_dim = edsclr_dim + offset + endif + + ! ----------------------------------------------------------------- ! + ! Setup CLUBB core + ! ----------------------------------------------------------------- ! + + ! Read in parameters for CLUBB. Just read in default values + call read_parameters_api( -99, "", clubb_params ) + + ! Fill in dummy arrays for height. Note that these are overwrote + ! at every CLUBB step to physical values. + do k=1,nlev+1 + zt_g(k) = ((k-1)*1000._r8)-500._r8 ! this is dummy garbage + zi_g(k) = (k-1)*1000._r8 ! this is dummy garbage + enddo + + clubb_params(iC2rtthl) = clubb_C2rtthl + clubb_params(iC8) = clubb_C8 + clubb_params(iC11) = clubb_c11 + clubb_params(iC11b) = clubb_c11b + clubb_params(iC14) = clubb_c14 + clubb_params(ic_K10) = clubb_c_K10 + clubb_params(imult_coef) = clubb_mult_coef + clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef + clubb_params(iC2rt) = clubb_C2rt + clubb_params(iC2thl) = clubb_C2thl + clubb_params(ibeta) = clubb_beta + clubb_params(iC6rt) = clubb_c6rt + clubb_params(iC6rtb) = clubb_c6rtb + clubb_params(iC6rtc) = clubb_c6rtc + clubb_params(iC6thl) = clubb_c6thl + clubb_params(iC6thlb) = clubb_c6thlb + clubb_params(iC6thlc) = clubb_c6thlc + clubb_params(iwpxp_L_thresh) = clubb_wpxp_L_thresh + clubb_params(iC7) = clubb_C7 + clubb_params(iC7b) = clubb_C7b + clubb_params(igamma_coef) = clubb_gamma_coef + clubb_params(ic_K10h) = clubb_c_K10h + clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef + clubb_params(ilmin_coef) = clubb_lmin_coef + clubb_params(iC8b) = clubb_C8b + clubb_params(iskw_max_mag) = clubb_skw_max_mag + clubb_params(iC1) = clubb_C1 + clubb_params(iC1b) = clubb_C1b + clubb_params(igamma_coefb) = clubb_gamma_coefb + clubb_params(iup2_vp2_factor) = clubb_up2_vp2_factor + clubb_params(iC4) = clubb_C4 + clubb_params(ic_K9) = clubb_c_K9 + clubb_params(inu9) = clubb_nu9 + clubb_params(iC_wp2_splat) = clubb_C_wp2_splat + + call init_clubb_config_flags( clubb_config_flags ) ! In/Out + clubb_config_flags%l_use_C7_Richardson = clubb_l_use_C7_Richardson + clubb_config_flags%l_use_C11_Richardson = clubb_l_use_C11_Richardson + clubb_config_flags%l_brunt_vaisala_freq_moist = clubb_l_brunt_vaisala_freq_moist + clubb_config_flags%l_use_thvm_in_bv_freq = clubb_l_use_thvm_in_bv_freq + clubb_config_flags%l_rcm_supersat_adj = clubb_l_rcm_supersat_adj + clubb_config_flags%l_damp_wp3_Skw_squared = clubb_l_damp_wp3_Skw_squared + clubb_config_flags%l_predict_upwp_vpwp = clubb_l_predict_upwp_vpwp + clubb_config_flags%l_min_wp2_from_corr_wx = clubb_l_min_wp2_from_corr_wx + clubb_config_flags%l_min_xp2_from_corr_wx = clubb_l_min_xp2_from_corr_wx + clubb_config_flags%l_upwind_xpyp_ta = clubb_l_upwind_xpyp_ta + clubb_config_flags%l_vert_avg_closure = clubb_l_vert_avg_closure + clubb_config_flags%l_trapezoidal_rule_zt = clubb_l_trapezoidal_rule_zt + clubb_config_flags%l_trapezoidal_rule_zm = clubb_l_trapezoidal_rule_zm + clubb_config_flags%l_call_pdf_closure_twice = clubb_l_call_pdf_closure_twice + clubb_config_flags%l_use_cloud_cover = clubb_l_use_cloud_cover + clubb_config_flags%l_stability_correct_tau_zm = clubb_l_stability_correct_tau_zm + clubb_config_flags%l_do_expldiff_rtm_thlm = do_expldiff + clubb_config_flags%l_Lscale_plume_centered = clubb_l_lscale_plume_centered + clubb_config_flags%l_use_ice_latent = clubb_l_use_ice_latent + clubb_config_flags%l_diag_Lscale_from_tau = clubb_l_diag_Lscale_from_tau + clubb_config_flags%l_damp_wp2_using_em = clubb_l_damp_wp2_using_em + clubb_config_flags%l_update_pressure = l_update_pressure + + + ! Set up CLUBB core. Note that some of these inputs are overwritten + ! when clubb_tend_cam is called. The reason is that heights can change + ! at each time step, which is why dummy arrays are read in here for heights + ! as they are immediately overwrote. +!$OMP PARALLEL + call setup_clubb_core_api & + ( nlev+1, theta0, ts_nudge, & ! In + hydromet_dim, sclr_dim, & ! In + sclr_tol, edsclr_dim, clubb_params, & ! In + l_host_applies_sfc_fluxes, & ! In + saturation_equation, & ! In + l_input_fields, & + l_implemented, grid_type, zi_g(2), zi_g(1), zi_g(nlev+1),& ! In + zi_g(1:nlev+1), zt_g(1:nlev+1), sfc_elevation, & ! In + clubb_config_flags%l_predict_upwp_vpwp, & ! In + clubb_config_flags%l_use_ice_latent, & ! In + clubb_config_flags%l_prescribed_avg_deltaz, & ! In + clubb_config_flags%l_damp_wp2_using_em, & ! In + clubb_config_flags%l_stability_correct_tau_zm, & ! In + err_code ) + + if ( err_code == clubb_fatal_error ) then + call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') + end if +!$OMP END PARALLEL + + ! Print the list of CLUBB parameters + if ( masterproc ) then + do j = 1, nparams, 1 + write(iulog,*) params_list(j), " = ", clubb_params(j) + enddo + endif + + ! Print configurable CLUBB flags + if ( masterproc ) then + call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) + end if + + ! ----------------------------------------------------------------- ! + ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! + ! ----------------------------------------------------------------- ! + + ! Initialize eddy diffusivity module + + ntop_eddy = 1 ! if >1, must be <= nbot_molec + nbot_eddy = pver ! currently always pver + + call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) + + ! ----------------------------------------------------------------- ! + ! Add output fields for the history files + ! ----------------------------------------------------------------- ! + + ! These are default CLUBB output. Not the higher order history budgets + call addfld ('RHO_CLUBB', (/ 'ilev' /), 'A', 'kg/m3', 'Air Density') + call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') + call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') + call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') + call addfld ('WP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') + call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') + call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') + call addfld ('WP3_CLUBB', (/ 'ilev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') + call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') + call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') + call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'g^2/kg^2', 'Moisture Variance') + call addfld ('RTP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') + call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') + call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') + call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') + call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') + call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') + call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') + call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') + call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') + call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') + call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') + call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') + call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') + call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Liquid Water Tendency') + call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Cloud Ice Tendency') + call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') + call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') + call addfld ('ZT_CLUBB', (/ 'ilev' /), 'A', 'm', 'Thermodynamic Heights') + call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') + call addfld ('UM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Zonal Wind') + call addfld ('VM_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Meridional Wind') + call addfld ('WM_ZT_CLUBB', (/ 'ilev' /), 'A', 'm/s', 'Vertical Velocity') + call addfld ('THETAL', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') + call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') + call addfld ('QT', (/ 'lev' /), 'A', 'kg/kg', 'Total water mixing ratio') + call addfld ('SL', (/ 'lev' /), 'A', 'J/kg', 'Liquid water static energy') + call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') + call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') + call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') + call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') + call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') + call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') + + + call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') + call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') + call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') + + call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') + call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') + call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') + call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') + call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') + + + call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') + call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') + call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') + call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') + + call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') + call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') + + call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') + call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') + call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') + ! ---------------------------------------------------------------------------- ! + ! Below are for detailed analysis of EDMF Scheme ! + ! ---------------------------------------------------------------------------- ! + if (do_clubb_mf) then + call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) + call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) + call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) + call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) + call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) + call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) + call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) + call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) + call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) + call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) + call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) + call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) + call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) + call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) + call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) + call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thl flux (EDMF)' ) + call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'W/m2' , 'thv flux (EDMF)' ) + call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'W/m2' , 'qt flux (EDMF)' ) + call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) + call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) + call addfld ( 'edmf_thflx' , (/ 'ilev' /), 'A', 'K m/s' , 'th flux (EDMF)' ) + call addfld ( 'edmf_qvflx' , (/ 'ilev' /), 'A', 'kg/kg m/s' , 'qv flux (EDMF)' ) + call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) + call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) + call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) + call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) + call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') + call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') + call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) + call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) + call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) + call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) + call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) + call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) + end if + + call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') + call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') + call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') + call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') + call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') + call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') + if (do_clubb_mf) then + call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) + end if + + ! Initialize statistics, below are dummy variables + dum1 = 300._r8 + dum2 = 1200._r8 + dum3 = 300._r8 + + if (l_stats) then + + call stats_init_clubb( .true., dum1, dum2, & + nlev+1, nlev+1, nlev+1, dum3 ) + + allocate(out_zt(pcols,pverp,stats_zt%num_output_fields)) + allocate(out_zm(pcols,pverp,stats_zm%num_output_fields)) + allocate(out_sfc(pcols,1,stats_sfc%num_output_fields)) + + allocate(out_radzt(pcols,pverp,stats_rad_zt%num_output_fields)) + allocate(out_radzm(pcols,pverp,stats_rad_zm%num_output_fields)) + + endif + + ! ----------------------------------------------------------------- ! + ! Make all of this output default, this is not CLUBB history + ! ----------------------------------------------------------------- ! + + if (clubb_do_adv .or. history_clubb) then + call add_default('RHO_CLUBB', 1, ' ') + call add_default('UP2_CLUBB', 1, ' ') + call add_default('VP2_CLUBB', 1, ' ') + call add_default('WP2_CLUBB', 1, ' ') + call add_default('WP2_ZT_CLUBB', 1, ' ') + call add_default('WP3_CLUBB', 1, ' ') + call add_default('UPWP_CLUBB', 1, ' ') + call add_default('VPWP_CLUBB', 1, ' ') + call add_default('WPTHLP_CLUBB', 1, ' ') + call add_default('WPRTP_CLUBB', 1, ' ') + call add_default('RTP2_CLUBB', 1, ' ') + call add_default('RTP2_ZT_CLUBB', 1, ' ') + call add_default('PDFP_RTP2_CLUBB', 1, ' ') + call add_default('THLP2_CLUBB', 1, ' ') + call add_default('THLP2_ZT_CLUBB', 1, ' ') + call add_default('RTPTHLP_CLUBB', 1, ' ') + call add_default('RCM_CLUBB', 1, ' ') + call add_default('WPRCP_CLUBB', 1, ' ') + call add_default('CLOUDFRAC_CLUBB', 1, ' ') + call add_default('RCMINLAYER_CLUBB', 1, ' ') + call add_default('CLOUDCOVER_CLUBB', 1, ' ') + call add_default('WPTHVP_CLUBB', 1, ' ') + call add_default('RVMTEND_CLUBB', 1, ' ') + call add_default('STEND_CLUBB', 1, ' ') + call add_default('RCMTEND_CLUBB', 1, ' ') + call add_default('RIMTEND_CLUBB', 1, ' ') + call add_default('UTEND_CLUBB', 1, ' ') + call add_default('VTEND_CLUBB', 1, ' ') + call add_default('ZT_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') + call add_default('UM_CLUBB', 1, ' ') + call add_default('VM_CLUBB', 1, ' ') + call add_default('WM_ZT_CLUBB', 1, ' ') + call add_default('PBLH', 1, ' ') + call add_default('SL', 1, ' ') + call add_default('QT', 1, ' ') + call add_default('THETAL', 1, ' ') + call add_default('CONCLD', 1, ' ') + call add_default('TKE_CLUBB', 1, ' ') + call add_default('ELEAK_CLUBB', 1, ' ') + call add_default('TFIX_CLUBB', 1, ' ') + end if + + if (history_amwg) then + call add_default('PBLH', 1, ' ') + end if + + if (history_clubb) then + + call add_default('RELVAR', 1, ' ') + call add_default('RHO_CLUBB', 1, ' ') + call add_default('UPWP_CLUBB', 1, ' ') + call add_default('VPWP_CLUBB', 1, ' ') + call add_default('RCM_CLUBB', 1, ' ') + call add_default('WPRCP_CLUBB', 1, ' ') + call add_default('CLOUDFRAC_CLUBB', 1, ' ') + call add_default('RCMINLAYER_CLUBB', 1, ' ') + call add_default('CLOUDCOVER_CLUBB', 1, ' ') + call add_default('WPTHVP_CLUBB', 1, ' ') + call add_default('RVMTEND_CLUBB', 1, ' ') + call add_default('STEND_CLUBB', 1, ' ') + call add_default('RCMTEND_CLUBB', 1, ' ') + call add_default('RIMTEND_CLUBB', 1, ' ') + call add_default('UTEND_CLUBB', 1, ' ') + call add_default('VTEND_CLUBB', 1, ' ') + call add_default('ZT_CLUBB', 1, ' ') + call add_default('ZM_CLUBB', 1, ' ') + call add_default('UM_CLUBB', 1, ' ') + call add_default('VM_CLUBB', 1, ' ') + call add_default('SL', 1, ' ') + call add_default('QT', 1, ' ') + call add_default('CONCLD', 1, ' ') + + if (do_clubb_mf_diag) then + call add_default( 'edmf_DRY_A' , 1, ' ') + call add_default( 'edmf_MOIST_A' , 1, ' ') + call add_default( 'edmf_DRY_W' , 1, ' ') + call add_default( 'edmf_MOIST_W' , 1, ' ') + call add_default( 'edmf_DRY_QT' , 1, ' ') + call add_default( 'edmf_MOIST_QT' , 1, ' ') + call add_default( 'edmf_DRY_THL' , 1, ' ') + call add_default( 'edmf_MOIST_THL', 1, ' ') + call add_default( 'edmf_DRY_U' , 1, ' ') + call add_default( 'edmf_MOIST_U' , 1, ' ') + call add_default( 'edmf_DRY_V' , 1, ' ') + call add_default( 'edmf_MOIST_V' , 1, ' ') + call add_default( 'edmf_MOIST_QC' , 1, ' ') + call add_default( 'edmf_precc' , 1, ' ') + call add_default( 'edmf_S_AE' , 1, ' ') + call add_default( 'edmf_S_AW' , 1, ' ') + call add_default( 'edmf_S_AWTH' , 1, ' ') + call add_default( 'edmf_S_AWTHL' , 1, ' ') + call add_default( 'edmf_S_AWQT' , 1, ' ') + call add_default( 'edmf_S_AWU' , 1, ' ') + call add_default( 'edmf_S_AWV' , 1, ' ') + call add_default( 'edmf_thlflx' , 1, ' ') + call add_default( 'edmf_thvflx' , 1, ' ') + call add_default( 'edmf_qtflx' , 1, ' ') + call add_default( 'edmf_thlforc' , 1, ' ') + call add_default( 'edmf_qtforc' , 1, ' ') + call add_default( 'edmf_thflx' , 1, ' ') + call add_default( 'edmf_qvflx' , 1, ' ') + call add_default( 'edmf_thforc' , 1, ' ') + call add_default( 'edmf_qvforc' , 1, ' ') + call add_default( 'edmf_qcforc' , 1, ' ') + call add_default( 'edmf_rcm' , 1, ' ') + call add_default( 'edmf_cloudfrac', 1, ' ') + call add_default( 'edmf_ztop' , 1, ' ') + call add_default( 'edmf_L0' , 1, ' ') + call add_default( 'edmf_cape' , 1, ' ') + end if + call add_default( 'QT_macmic' , 1, ' ') + call add_default( 'THETAL_macmic' , 1, ' ') + call add_default( 'RCM_CLUBB_macmic' , 1, ' ') + call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') + call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') + call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') + if (do_clubb_mf_diag) then + call add_default( 'edmf_thlflx_macmic' , 1, ' ') + call add_default( 'edmf_qtflx_macmic' , 1, ' ') + call add_default( 'edmf_thvflx_macmic' , 1, ' ') + end if + end if + + if (history_amwg) then + call add_default('PBLH', 1, ' ') + end if + + if (history_budget) then + call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') + call add_default('DPDLFICE', history_budget_histfile_num, ' ') + call add_default('DPDLFT', history_budget_histfile_num, ' ') + call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') + call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') + endif + + + ! --------------- ! + ! First step? ! + ! Initialization ! + ! --------------- ! + + ! Is this the first time step? If so then initialize CLUBB variables as follows + if (is_first_step()) then + + call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) + call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) + call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) + call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) + call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) + + call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) + + call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) + call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) + + ! Initialize SILHS covariance contributions + call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) + endif + + ! The following is physpkg, so it needs to be initialized every time + call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) + + ! --------------- ! + ! End ! + ! Initialization ! + ! --------------- ! + +#endif + end subroutine clubb_ini_cam + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + subroutine clubb_tend_cam( & + state, ptend_all, pbuf, hdtime, & + cmfmc, cam_in, & + macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) + +!------------------------------------------------------------------------------- +! Description: Provide tendencies of shallow convection, turbulence, and +! macrophysics from CLUBB to CAM +! +! Author: Cheryl Craig, March 2011 +! Modifications: Pete Bogenschutz, March 2011 and onward +! Origin: Based heavily on UWM clubb_init.F90 +! References: +! None +!------------------------------------------------------------------------------- + + use physics_types, only: physics_state, physics_ptend, & + physics_state_copy, physics_ptend_init, & + physics_ptend_sum, physics_update, set_dry_to_wet + + use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc + + use constituents, only: cnst_get_ind, cnst_type + use camsrfexch, only: cam_in_t + use time_manager, only: is_first_step + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + use tropopause, only: tropopause_findChemTrop + use time_manager, only: get_nstep + +#ifdef CLUBB_SGS + use hb_diff, only: pblintd + use scamMOD, only: single_column,scm_clubb_iop_name + use clubb_api_module, only: & + nparams, & + read_parameters_api, & + setup_parameters_api, & + time_precision, & + advance_clubb_core_api, & + zt2zm_api, zm2zt_api, & + setup_grid_heights_api, & + em_min, & + w_tol_sqd, & + rt_tol, & + thl_tol, & + l_stats, & + stats_tsamp, & + stats_tout, & + stats_zt, & + stats_sfc, & + stats_zm, & + stats_rad_zt, & + stats_rad_zm, & + l_output_rad_files, & + stats_begin_timestep_api, & + hydromet_dim, calculate_thlp2_rad_api, mu, update_xp2_mc_api, & + sat_mixrat_liq_api, & + fstderr + + use clubb_api_module, only: & + clubb_fatal_error ! Error code value to indicate a fatal error + + use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const + use cam_history, only: outfld + + use macrop_driver, only: liquid_macro_tend + use clubb_mf, only: integrate_mf + +#endif + + implicit none + + ! --------------- ! + ! Input Auguments ! + ! --------------- ! + + type(physics_state), intent(in) :: state ! Physics state variables [vary] + type(cam_in_t), intent(in) :: cam_in + real(r8), intent(in) :: hdtime ! Host model timestep [s] + real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] + real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] + integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations + integer, intent(in) :: macmic_it ! number of mac-mic iterations + + ! ---------------------- ! + ! Input-Output Auguments ! + ! ---------------------- ! + + type(physics_buffer_desc), pointer :: pbuf(:) + + ! ---------------------- ! + ! Output Auguments ! + ! ---------------------- ! + + type(physics_ptend), intent(out) :: ptend_all ! package tendencies + + ! These two variables are needed for energy check + real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice + real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check + + + ! --------------- ! + ! Local Variables ! + ! --------------- ! + +#ifdef CLUBB_SGS + + type(physics_state) :: state1 ! Local copy of state variable + type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all + + integer :: i, j, k, t, ixind, nadv + integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq + integer :: itim_old + integer :: ncol, lchnk ! # of columns, and chunk identifier + integer :: err_code ! Diagnostic, for if some calculation goes amiss. + integer :: icnt, clubbtop + logical :: lq2(pcnst) + + integer :: iter + + real(r8) :: frac_limit, ic_limit + + real(r8) :: dtime ! CLUBB time step [s] + real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] + real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] + real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] + real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] + real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] + real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] + real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] + real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] + real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] + real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] + real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] + real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] + real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] + real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] + real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] + real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] + real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] + real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] + real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] + real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] + real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] + real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] + real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] + real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] + real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] + real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] + real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation + real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap + real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap + real(r8) :: wprtp_mc_out(pverp+1-top_lev) + real(r8) :: wpthlp_mc_out(pverp+1-top_lev) + real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) + real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] + real(r8) :: rcm_out_zm(pverp+1-top_lev) + real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] + real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] + real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] + real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] + real(r8) :: thlprcp_out(pverp+1-top_lev) + real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] + real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] + real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] + real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] + real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] + real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] + real(r8) :: rfrzm(pverp+1-top_lev) + real(r8) :: radf(pverp+1-top_lev) + real(r8) :: wprtp_forcing(pverp+1-top_lev) + real(r8) :: wpthlp_forcing(pverp+1-top_lev) + real(r8) :: rtp2_forcing(pverp+1-top_lev) + real(r8) :: thlp2_forcing(pverp+1-top_lev) + real(r8) :: rtpthlp_forcing(pverp+1-top_lev) + real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) + real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] + real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] + real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] + real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] + real(r8) :: fcor ! Coriolis forcing [s^-1] + real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] + real(r8) :: ubar ! surface wind [m/s] + real(r8) :: ustar ! surface stress [m/s] + real(r8) :: z0 ! roughness height [m] + real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] + real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] + real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] + real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] + real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] + real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] + real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] + real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] + real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] + real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] + real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] + real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] + real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] + real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] + real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] + real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] + real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] + real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] + real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] + real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] + real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] + real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] + real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] + real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] + real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] + real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) + real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) + real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) + real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) + real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) + real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] + real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] + real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] + real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] + real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] + real(r8) :: zo ! roughness height [m] + real(r8) :: dz_g(pver) ! thickness of layer [m] + real(r8) :: relvarmax + real(r8) :: se_upper_a, se_upper_b, se_upper_diss + real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss + real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] + real(r8) :: host_dx, host_dy ! CAM grid [m] + + ! Variables below are needed to compute energy integrals for conservation + real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) + real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) + real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) + + real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] + real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] + real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] + real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] + real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] + real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] + real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] + real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] + real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] + real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] + real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] + real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] + real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] + real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] + real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] + real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] + real(r8) :: rvm(pcols,pverp) + real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] + real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs + real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] + real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] + real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs + real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] + real(r8) :: wp2_zt_out(pcols, pverp) + real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] + real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] + real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] + real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] + real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] + real(r8) :: eps ! Rv/Rd [-] + real(r8) :: dum1 ! dummy variable [units vary] + real(r8) :: obklen(pcols) ! Obukov length [m] + real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] + real(r8) :: th(pcols,pver) ! potential temperature [K] + real(r8) :: dummy2(pcols) ! dummy variable [units vary] + real(r8) :: dummy3(pcols) ! dummy variable [units vary] + real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] + real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] + real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] + real(r8) :: latsub + real(r8) :: qrl_clubb(pverp+1-top_lev) + real(r8) :: qrl_zm(pverp+1-top_lev) + real(r8) :: thlp2_rad_out(pverp+1-top_lev) + real(r8) :: apply_const, rtm_test + real(r8) :: dl_rad, di_rad, dt_low + + real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) + real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] + + character(len=200) :: temp1, sub ! Strings needed for CLUBB output + real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] + integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] + + real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend + + ! --------------- ! + ! Pointers ! + ! --------------- ! + + real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] + real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] + real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] + real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] + real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] + real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] + real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] + real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] + real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] + real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] + real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] + real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] + real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] + real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] + real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] + real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] + real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] + real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] + real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] + real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] + real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS + real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] + real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] + real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] + real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] + real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] + real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] + real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] + real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] + real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] + real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] + real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] + real(r8), pointer, dimension(:,:) :: naai + real(r8), pointer, dimension(:,:) :: cmeliq + real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] + + real(r8), pointer, dimension(:,:) :: qsatfac + real(r8), pointer, dimension(:,:) :: npccn + real(r8), pointer, dimension(:,:) :: prer_evap + real(r8), pointer, dimension(:,:) :: qrl + real(r8), pointer, dimension(:,:) :: radf_clubb + + ! SILHS covariance contributions + real(r8), pointer, dimension(:,:) :: rtp2_mc_zt + real(r8), pointer, dimension(:,:) :: thlp2_mc_zt + real(r8), pointer, dimension(:,:) :: wprtp_mc_zt + real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt + real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt + + real(r8) qitend(pcols,pver) + real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation + + ! ZM microphysics + real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. + real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. + real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. + real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. + + real(r8),pointer :: prec_sh(:) ! total precipitation from MF + real(r8),pointer :: snow_sh(:) ! snow from MF + + real(r8), pointer :: qt_macmic(:,:) + real(r8), pointer :: thl_macmic(:,:) + real(r8), pointer :: rcm_macmic(:,:) + real(r8), pointer :: cldfrac_macmic(:,:) + real(r8), pointer :: wpthlp_macmic(:,:) + real(r8), pointer :: wprtp_macmic(:,:) + real(r8), pointer :: wpthvp_macmic(:,:) + real(r8), pointer :: mf_thlflx_macmic(:,:) + real(r8), pointer :: mf_qtflx_macmic(:,:) + real(r8), pointer :: mf_thvflx_macmic(:,:) + + real(r8) :: stend(pcols,pver) + real(r8) :: qvtend(pcols,pver) + real(r8) :: qctend(pcols,pver) + real(r8) :: inctend(pcols,pver) + real(r8) :: fqtend(pcols,pver) + real(r8) :: rhmini(pcols) + real(r8) :: rhmaxi(pcols) + integer :: troplev(pcols) + logical :: lqice(pcnst) + logical :: apply_to_surface + + ! MF outputs to outfld + real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & + mf_dry_w_output, mf_moist_w_output, & + mf_dry_qt_output, mf_moist_qt_output, & + mf_dry_thl_output, mf_moist_thl_output, & + mf_dry_u_output, mf_moist_u_output, & + mf_dry_v_output, mf_moist_v_output, & + mf_moist_qc_output, & + s_ae_output, s_aw_output, & + s_awthl_output, s_awqt_output, & + s_awql_output, s_awqi_output, & + s_awth_output, s_awqv_output, & + s_awu_output, s_awv_output, & + mf_thflx_output, mf_qvflx_output, & + mf_thlflx_output, mf_qtflx_output, & + mf_thvflx_output, & + mf_rcm_output, & + mf_precc_output + ! + real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & + mf_cape_output + ! + ! MF outputs to outfld + real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid + mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid + mf_qcforc_output, & ! thermodynamic grid + mf_qc_output, mf_cloudfrac_output ! thermodynamic grid + + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & + mf_upw_flip, & + mf_upqt_flip, & + mf_upthl_flip, & + mf_upthv_flip, & + mf_upth_flip, & + mf_upqc_flip, & + mf_upbuoy_flip, & + mf_upent_flip + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & + mf_upw_output, & + mf_upqt_output, & + mf_upthl_output, & + mf_upthv_output, & + mf_upth_output, & + mf_upqc_output, & + mf_upent_output + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output + + ! MF Plume + real(r8), pointer :: tpert(:) + real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & + mf_dry_w, mf_moist_w, & + mf_dry_qt, mf_moist_qt, & + mf_dry_thl, mf_moist_thl, & + mf_dry_u, mf_moist_u, & + mf_dry_v, mf_moist_v, & + mf_moist_qc, & + mf_sqt, mf_sthl, & + mf_precc, & + s_ae, s_aw, & + s_awthl, s_awqt, & + s_awql, s_awqi, & + s_awth, s_awqv, & + s_awu, s_awv, & + mf_thflx, mf_qvflx, & + mf_thlflx, mf_qtflx, & + mf_thvflx, mf_qcflx, & + mf_thforc, mf_qvforc, & + mf_qcforc, & + mf_rcm, mf_cloudfrac, & + mf_qc_zt, mf_cloudfrac_zt + + ! MF plume level + real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & + mf_upw, & + mf_upqt, & + mf_upthl, & + mf_upthv, & + mf_upth, & + mf_upqc, & + mf_upbuoy, & + mf_upent + + ! CFL limiter vars + real(r8), dimension(pcols) :: max_cfl + real(r8) :: cflval, cflfac + logical :: cfllim + + ! MF local vars + real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid + dzt, invrs_dzt, & ! thermodynamic grid + invrs_exner_zt,& ! thermodynamic grid + kappa_zt, qc_zt, & ! thermodynamic grid + th_zt, qv_zt, & ! momentum grid + th_zm, qv_zm, & ! momentum grid + qc_zm, & ! momentum grid + kappa_zm, p_in_Pa_zm, & ! momentum grid + dzm, invrs_exner_zm ! momentum grid + + real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs + + + integer :: nlev + + intrinsic :: max + + character(len=*), parameter :: subr='clubb_tend_cam' + +#endif + det_s(:) = 0.0_r8 + det_ice(:) = 0.0_r8 +#ifdef CLUBB_SGS + + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + ! MAIN COMPUTATION BEGINS HERE ! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + !-----------------------------------------------------------------------------------------------! + + nlev = pver + 1 - top_lev + + rtp2_zt_out = 0._r8 + thl2_zt_out = 0._r8 + wp2_zt_out = 0._r8 + pdfp_rtp2 = 0._r8 + wm_zt_out = 0._r8 + + dl_rad = clubb_detliq_rad + di_rad = clubb_detice_rad + dt_low = clubb_detphase_lowtemp + + frac_limit = 0.01_r8 + ic_limit = 1.e-12_r8 + + if (clubb_do_adv) then + apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected + else + apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected + endif + + ! Get indicees for cloud and ice mass and cloud and ice number + + call cnst_get_ind('Q',ixq) + call cnst_get_ind('CLDLIQ',ixcldliq) + call cnst_get_ind('CLDICE',ixcldice) + call cnst_get_ind('NUMLIQ',ixnumliq) + call cnst_get_ind('NUMICE',ixnumice) + + if (clubb_do_icesuper) then + call pbuf_get_field(pbuf, naai_idx, naai) + end if + + ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine + call physics_ptend_init(ptend_all, state%psetcols, 'clubb') + + ! Copy the state to state1 array to use in this routine + call physics_state_copy(state, state1) + + ! constituents are all treated as wet mmr by clubb + call set_dry_to_wet(state1) + + if (clubb_do_liqsupersat) then + call pbuf_get_field(pbuf, npccn_idx, npccn) + endif + + ! Determine number of columns and which chunk computation is to be performed on + + ncol = state%ncol + lchnk = state%lchnk + + ! Determine time step of physics buffer + itim_old = pbuf_old_tim_idx() + + ! Establish associations between pointers and physics buffer fields + + call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) + call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) + call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) + call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) + call pbuf_get_field(pbuf, rcm_idx, rcm) + call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) + call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) + + call pbuf_get_field(pbuf, tke_idx, tke) + call pbuf_get_field(pbuf, qrl_idx, qrl) + call pbuf_get_field(pbuf, radf_idx, radf_clubb) + + call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) + + call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) + + call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) + call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) + call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) + call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) + call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) + call pbuf_get_field(pbuf, relvar_idx, relvar) + call pbuf_get_field(pbuf, dp_frac_idx, deepcu) + call pbuf_get_field(pbuf, sh_frac_idx, shalcu) + call pbuf_get_field(pbuf, kvh_idx, khzm) + call pbuf_get_field(pbuf, pblh_idx, pblh) + call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) + call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) + call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) + + call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) + call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) + + ! SILHS covariance contributions + call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) + call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) + call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) + call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) + call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) + + call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) + call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) + call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) + call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) + call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) + call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) + call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) + if (do_clubb_mf) then + call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) + call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) + call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) + call pbuf_get_field(pbuf, tpert_idx, tpert) + end if + + ! Initialize the apply_const variable (note special logic is due to eularian backstepping) + if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then + apply_const = 0._r8 ! On first time through do not remove constant + ! from moments since it has not been added yet + endif + + ! Set the ztodt timestep in pbuf for SILHS + ztodtptr(:) = 1.0_r8*hdtime + + ! Define the grid box size. CLUBB needs this information to determine what + ! the maximum length scale should be. This depends on the column for + ! variable mesh grids and lat-lon grids + if (single_column) then + ! If single column specify grid box size to be something + ! similar to a GCM run + grid_dx(:) = 100000._r8 + grid_dy(:) = 100000._r8 + else + + call grid_size(state1, grid_dx, grid_dy) + + end if + + if (clubb_do_icesuper) then + + ! -------------------------------------- ! + ! Ice Saturation Adjustment Computation ! + ! -------------------------------------- ! + + lq2(:) = .FALSE. + lq2(1) = .TRUE. + lq2(ixcldice) = .TRUE. + lq2(ixnumice) = .TRUE. + + latsub = latvap + latice + + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) + + stend(:ncol,:)=0._r8 + qvtend(:ncol,:)=0._r8 + qitend(:ncol,:)=0._r8 + initend(:ncol,:)=0._r8 + + call ice_macro_tend(naai(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & + state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,1), & + state1%q(1:ncol,top_lev:pver,ixcldice), state1%q(1:ncol,top_lev:pver,ixnumice), & + latsub, hdtime, stend(1:ncol,top_lev:pver), qvtend(1:ncol,top_lev:pver), & + qitend(1:ncol,top_lev:pver), initend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) + + ! update local copy of state with the tendencies + ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) + ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) + + ! Add the ice tendency to the output tendency + call physics_ptend_sum(ptend_loc, ptend_all, ncol) + + ! ptend_loc is reset to zero by this call + call physics_update(state1, ptend_loc, hdtime) + + !Write output for tendencies: + temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) + call outfld( 'TTENDICE', temp2d, pcols, lchnk ) + call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) + call outfld( 'QITENDICE', qitend, pcols, lchnk ) + call outfld( 'NITENDICE', initend, pcols, lchnk ) + + endif + + + ! Determine CLUBB time step and make it sub-step friendly + ! For now we want CLUBB time step to be 5 min since that is + ! what has been scientifically validated. However, there are certain + ! instances when a 5 min time step will not be possible (based on + ! host model time step or on macro-micro sub-stepping + + dtime = clubb_timestep + + ! Now check to see if dtime is greater than the host model + ! (or sub stepped) time step. If it is, then simply + ! set it equal to the host (or sub step) time step. + ! This section is mostly to deal with small host model + ! time steps (or small sub-steps) + + if (dtime > hdtime) then + dtime = hdtime + endif + + ! Now check to see if CLUBB time step divides evenly into + ! the host model time step. If not, force it to divide evenly. + ! We also want it to be 5 minutes or less. This section is + ! mainly for host model time steps that are not evenly divisible + ! by 5 minutes + + if (mod(hdtime,dtime) .ne. 0) then + dtime = hdtime/2._r8 + do while (dtime > clubb_timestep) + dtime = dtime/2._r8 + end do + endif + + ! If resulting host model time step and CLUBB time step do not divide evenly + ! into each other, have model throw a fit. + + if (mod(hdtime,dtime) .ne. 0) then + call endrun(subr//': CLUBB time step and HOST time step NOT compatible') + endif + + ! determine number of timesteps CLUBB core should be advanced, + ! host time step divided by CLUBB time step + nadv = max(hdtime/dtime,1._r8) + + ! Initialize forcings for transported scalars to zero + + sclrm_forcing(:,:) = 0._r8 + edsclrm_forcing(:,:) = 0._r8 + sclrm(:,:) = 0._r8 + + ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant + ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent + ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables + ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state + + do k=1,pver + do i=1,ncol + inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) + enddo + enddo + + ! At each CLUBB call, initialize mean momentum and thermo CLUBB state + ! from the CAM state + + do k=1,pver ! loop over levels + do i=1,ncol ! loop over columns + + rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) + rvm(i,k) = state1%q(i,k,ixq) + um(i,k) = state1%u(i,k) + vm(i,k) = state1%v(i,k) + thlm(i,k) = ( state1%t(i,k) & + - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & + * inv_exner_clubb(i,k) + + if (clubb_do_adv) then + if (macmic_it == 1) then + + ! Note that some of the moments below can be positive or negative. + ! Remove a constant that was added to prevent dynamics from clipping + ! them to prevent dynamics from making them positive. + thlp2(i,k) = state1%q(i,k,ixthlp2) + rtp2(i,k) = state1%q(i,k,ixrtp2) + rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) + wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) + wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) + wp2(i,k) = state1%q(i,k,ixwp2) + wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) + up2(i,k) = state1%q(i,k,ixup2) + vp2(i,k) = state1%q(i,k,ixvp2) + endif + endif + + enddo + enddo + + if (clubb_do_adv) then + ! If not last step of macmic loop then set apply_const back to + ! zero to prevent output from being corrupted. + if (macmic_it == cld_macmic_num_steps) then + apply_const = 1._r8 + else + apply_const = 0._r8 + endif + endif + + rtm(1:ncol,pverp) = rtm(1:ncol,pver) + um(1:ncol,pverp) = state1%u(1:ncol,pver) + vm(1:ncol,pverp) = state1%v(1:ncol,pver) + thlm(1:ncol,pverp) = thlm(1:ncol,pver) + + if (clubb_do_adv) then + thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) + rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) + rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) + wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) + wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) + wp2(1:ncol,pverp)=wp2(1:ncol,pver) + wp3(1:ncol,pverp)=wp3(1:ncol,pver) + up2(1:ncol,pverp)=up2(1:ncol,pver) + vp2(1:ncol,pverp)=vp2(1:ncol,pver) + endif + + ! Compute virtual potential temperature, which is needed for CLUBB + do k=1,pver + do i=1,ncol + thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& + -state1%q(i,k,ixcldliq)) + enddo + enddo + + call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) + + call tropopause_findChemTrop(state, troplev) + + ! Initialize EDMF outputs + mf_dry_a_output(:,:) = 0._r8 + mf_moist_a_output(:,:) = 0._r8 + mf_dry_w_output(:,:) = 0._r8 + mf_moist_w_output(:,:) = 0._r8 + mf_dry_qt_output(:,:) = 0._r8 + mf_moist_qt_output(:,:) = 0._r8 + mf_dry_thl_output(:,:) = 0._r8 + mf_moist_thl_output(:,:) = 0._r8 + mf_dry_u_output(:,:) = 0._r8 + mf_moist_u_output(:,:) = 0._r8 + mf_dry_v_output(:,:) = 0._r8 + mf_moist_v_output(:,:) = 0._r8 + mf_moist_qc_output(:,:) = 0._r8 + mf_precc_output(:,:) = 0._r8 + s_ae_output(:,:) = 0._r8 + s_aw_output(:,:) = 0._r8 + s_awthl_output(:,:) = 0._r8 + s_awqt_output(:,:) = 0._r8 + s_awql_output(:,:) = 0._r8 + s_awqi_output(:,:) = 0._r8 + s_awth_output(:,:) = 0._r8 + s_awqv_output(:,:) = 0._r8 + s_awu_output(:,:) = 0._r8 + s_awv_output(:,:) = 0._r8 + mf_upa_output(:,:) = 0._r8 + mf_upw_output(:,:) = 0._r8 + mf_upqt_output(:,:) = 0._r8 + mf_upthl_output(:,:) = 0._r8 + mf_upthv_output(:,:) = 0._r8 + mf_upth_output(:,:) = 0._r8 + mf_upqc_output(:,:) = 0._r8 + mf_upbuoy_output(:,:) = 0._r8 + mf_upent_output(:,:) = 0._r8 + mf_upa_flip(:,:,:) = 0._r8 + mf_upw_flip(:,:,:) = 0._r8 + mf_upqt_flip(:,:,:) = 0._r8 + mf_upthl_flip(:,:,:) = 0._r8 + mf_upthv_flip(:,:,:) = 0._r8 + mf_upth_flip(:,:,:) = 0._r8 + mf_upqc_flip(:,:,:) = 0._r8 + mf_upbuoy_flip(:,:,:) = 0._r8 + mf_upent_flip(:,:,:) = 0._r8 + mf_thlflx_output(:,:) = 0._r8 + mf_thvflx_output(:,:) = 0._r8 + mf_qtflx_output(:,:) = 0._r8 + mf_thflx_output(:,:) = 0._r8 + mf_qvflx_output(:,:) = 0._r8 + mf_thlforc_output(:,:) = 0._r8 + mf_qtforc_output(:,:) = 0._r8 + mf_thforc_output(:,:) = 0._r8 + mf_qvforc_output(:,:) = 0._r8 + mf_qcforc_output(:,:) = 0._r8 + mf_rcm_output(:,:) = 0._r8 + mf_cloudfrac_output(:,:) = 0._r8 + mf_qc_output(:,:) = 0._r8 + mf_ztop_output(:) = 0._r8 + mf_L0_output(:) = 0._r8 + mf_cape_output(:) = 0._r8 + + ! Loop over all columns in lchnk to advance CLUBB core + do i=1,ncol ! loop over columns + + ! Determine Coriolis force at given latitude. This is never used + ! when CLUBB is implemented in a host model, therefore just set + ! to zero. + fcor = 0._r8 + + ! Define the CLUBB momentum grid (in height, units of m) + do k=1,nlev+1 + zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) + enddo + + ! Define the CLUBB thermodynamic grid (in units of m) + do k=1,nlev + zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) + end do + + do k=1,pver + dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness + enddo + + ! Thermodynamic ghost point is below surface + zt_g(1) = -1._r8*zt_g(2) + + ! Set the elevation of the surface + sfc_elevation = state1%zi(i,pver+1) + + ! Set the grid size + host_dx = grid_dx(i) + host_dy = grid_dy(i) + + ! Compute thermodynamic stuff needed for CLUBB on thermo levels. + ! Inputs for the momentum levels are set below setup_clubb core + do k=1,nlev + p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile + exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) + rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) + invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo + rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo + thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo + th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) + qv_zt(k+1) = state1%q(i,pver-k+1,ixq) + rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) + radf(k+1) = radf_clubb(i,pver-k+1) + qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) + enddo + + ! Below computes the same stuff for the ghost point. May or may + ! not be needed, just to be safe to avoid NaN's + rho_ds_zt(1) = rho_ds_zt(2) + invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) + rho_in(1) = rho_ds_zt(2) + thv_ds_zt(1) = thv_ds_zt(2) + rho_zt(:) = rho_in(:) + p_in_Pa(1) = p_in_Pa(2) + exner(1) = exner(2) + rfrzm(1) = rfrzm(2) + radf(1) = radf(2) + qrl_clubb(1) = qrl_clubb(2) + th_zt(1) = th_zt(2) + qv_zt(1) = qv_zt(2) + + ! Compute mean w wind on thermo grid, convert from omega to w + wm_zt(1) = 0._r8 + do k=1,nlev + wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) + enddo + + ! ------------------------------------------------- ! + ! Begin case specific code for SCAM cases. ! + ! This section of code block NOT called in ! + ! global simulations ! + ! ------------------------------------------------- ! + + if (single_column) then + + ! Initialize zo if variable ustar is used + + if (cam_in%landfrac(i) >= 0.5_r8) then + zo = 0.035_r8 + else + zo = 0.0001_r8 + endif + + ! Compute surface wind (ubar) + ubar = sqrt(um(i,pver)**2+vm(i,pver)**2) + if (ubar < 0.25_r8) ubar = 0.25_r8 + + ! Below denotes case specifics for surface momentum + ! and thermodynamic fluxes, depending on the case + + ! Define ustar (based on case, if not variable) + ustar = 0.25_r8 ! Initialize ustar in case no case + + if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then + ustar = 0.30_r8 + endif + + if(trim(scm_clubb_iop_name) == 'RICO_3day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & + trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & + trim(scm_clubb_iop_name) == 'ARM_CC') then + + bflx22 = (gravit/theta0)*wpthlp_sfc + ustar = diag_ustar(zt_g(2),bflx22,ubar,zo) + endif + + ! Compute the surface momentum fluxes, if this is a SCAM simulation + upwp_sfc = -um(i,pver)*ustar**2/ubar + vpwp_sfc = -vm(i,pver)*ustar**2/ubar + + endif + + ! Define surface sources for transported variables for diffusion, will + ! be zero as these tendencies are done in vertical_diffusion + do ixind=1,edsclr_dim + wpedsclrp_sfc(ixind) = 0._r8 + enddo + + ! Set stats output and increment equal to CLUBB and host dt + stats_tsamp = dtime + stats_tout = hdtime + + ! Heights need to be set at each timestep. Therefore, recall + ! setup_grid and setup_parameters for this. + + ! Read in parameters for CLUBB. Just read in default values + call read_parameters_api( -99, "", clubb_params ) + + ! Set-up CLUBB core at each CLUBB call because heights can change + ! Important note: do not make any calls that use CLUBB grid-height + ! operators (such as zt2zm_api, etc.) until AFTER the + ! call to setup_grid_heights_api. + call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & + zi_g(1), zi_g, zt_g) + + call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & + zi_g, zt_g, & + clubb_config_flags%l_prescribed_avg_deltaz, & + err_code ) + + ! Define forcings from CAM to CLUBB as zero for momentum and thermo, + ! forcings already applied through CAM + thlm_forcing = 0._r8 + rtm_forcing = 0._r8 + um_forcing = 0._r8 + vm_forcing = 0._r8 + + wprtp_forcing = 0._r8 + wpthlp_forcing = 0._r8 + rtp2_forcing = 0._r8 + thlp2_forcing = 0._r8 + rtpthlp_forcing = 0._r8 + + ice_supersat_frac_out = 0._r8 + + ! Add forcings for SILHS covariance contributions + rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) + thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) + wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) + wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) + rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) + + ! Zero out SILHS covariance contribution terms + rtp2_mc_zt(i,:) = 0.0_r8 + thlp2_mc_zt(i,:) = 0.0_r8 + wprtp_mc_zt(i,:) = 0.0_r8 + wpthlp_mc_zt(i,:) = 0.0_r8 + rtpthlp_mc_zt(i,:) = 0.0_r8 + + ! Compute some inputs from the thermodynamic grid + ! to the momentum grid + rho_ds_zm = zt2zm_api(rho_ds_zt) + rho_zm = zt2zm_api(rho_zt) + invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) + thv_ds_zm = zt2zm_api(thv_ds_zt) + wm_zm = zt2zm_api(wm_zt) + + ! Surface fluxes provided by host model + wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux + wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) + upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux + vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux + + ! Need to flip arrays around for CLUBB core + do k=1,nlev+1 + um_in(k) = um(i,pverp-k+1) + vm_in(k) = vm(i,pverp-k+1) + upwp_in(k) = upwp(i,pverp-k+1) + vpwp_in(k) = vpwp(i,pverp-k+1) + wpthvp_in(k) = wpthvp(i,pverp-k+1) + wp2thvp_in(k) = wp2thvp(i,pverp-k+1) + rtpthvp_in(k) = rtpthvp(i,pverp-k+1) + thlpthvp_in(k)= thlpthvp(i,pverp-k+1) + up2_in(k) = up2(i,pverp-k+1) + vp2_in(k) = vp2(i,pverp-k+1) + up3_in(k) = up3(i,pverp-k+1) + vp3_in(k) = vp3(i,pverp-k+1) + wp2_in(k) = wp2(i,pverp-k+1) + wp3_in(k) = wp3(i,pverp-k+1) + rtp2_in(k) = rtp2(i,pverp-k+1) + thlp2_in(k) = thlp2(i,pverp-k+1) + rtp3_in(k) = rtp3(i,pverp-k+1) + thlp3_in(k) = thlp3(i,pverp-k+1) + thlm_in(k) = thlm(i,pverp-k+1) + rtm_in(k) = rtm(i,pverp-k+1) + rvm_in(k) = rvm(i,pverp-k+1) + wprtp_in(k) = wprtp(i,pverp-k+1) + wpthlp_in(k) = wpthlp(i,pverp-k+1) + tke_in(k) = tke(i,pverp-k+1) + rtpthlp_in(k) = rtpthlp(i,pverp-k+1) + rcm_inout(k) = rcm(i,pverp-k+1) + cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) + sclrpthvp_inout(k,:) = 0._r8 + + if (k .ne. 1) then + pre_in(k) = prer_evap(i,pverp-k+1) + endif + + ! Initialize these to prevent crashing behavior + wprcp_out(k) = 0._r8 + rcm_in_layer_out(k) = 0._r8 + cloud_cover_out(k) = 0._r8 + edsclr_in(k,:) = 0._r8 + khzm_out(k) = 0._r8 + khzt_out(k) = 0._r8 + + ! higher order scalar stuff, put to zero + sclrm(k,:) = 0._r8 + wpsclrp(k,:) = 0._r8 + sclrp2(k,:) = 0._r8 + sclrp3(k,:) = 0._r8 + sclrprtp(k,:) = 0._r8 + sclrpthlp(k,:) = 0._r8 + wpsclrp_sfc(:) = 0._r8 + hydromet(k,:) = 0._r8 + wphydrometp(k,:) = 0._r8 + wp2hmp(k,:) = 0._r8 + rtphmp_zt(k,:) = 0._r8 + thlphmp_zt(k,:) = 0._r8 + + enddo + pre_in(1) = pre_in(2) + + ! pressure,exner on momentum grid needed for mass flux calc. + if (do_clubb_mf) then + do k=1,pver + kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) + qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) + invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) + enddo + kappa_zt(1) = kappa_zt(2) + qc_zt(1) = qc_zt(2) + invrs_exner_zt(1) = invrs_exner_zt(2) + + kappa_zm = zt2zm_api(kappa_zt) + do k=1,pverp + p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) + invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) + enddo + end if + + if (clubb_do_adv) then + if (macmic_it == 1) then + wp2_in=zt2zm_api(wp2_in) + wpthlp_in=zt2zm_api(wpthlp_in) + wprtp_in=zt2zm_api(wprtp_in) + up2_in=zt2zm_api(up2_in) + vp2_in=zt2zm_api(vp2_in) + thlp2_in=zt2zm_api(thlp2_in) + rtp2_in=zt2zm_api(rtp2_in) + rtpthlp_in=zt2zm_api(rtpthlp_in) + + do k=1,nlev+1 + thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) + rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) + wp2_in(k)=max(w_tol_sqd,wp2_in(k)) + up2_in(k)=max(w_tol_sqd,up2_in(k)) + vp2_in(k)=max(w_tol_sqd,vp2_in(k)) + enddo + endif + endif + + ! Do the same for tracers + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + do k=1,nlev + edsclr_in(k+1,icnt) = state1%q(i,pver-k+1,ixind) + enddo + edsclr_in(1,icnt) = edsclr_in(2,icnt) + end if + enddo + + if (do_expldiff) then + do k=1,nlev + edsclr_in(k+1,icnt+1) = thlm(i,pver-k+1) + edsclr_in(k+1,icnt+2) = rtm(i,pver-k+1) + enddo + + edsclr_in(1,icnt+1) = edsclr_in(2,icnt+1) + edsclr_in(1,icnt+2) = edsclr_in(2,icnt+2) + endif + + stats_nsamp = nint(stats_tsamp/dtime) + stats_nout = nint(stats_tout/dtime) + + do t=1,nadv ! do needed number of "sub" timesteps for each CAM step + + ! Increment the statistics then being stats timestep + if (l_stats) then + call stats_begin_timestep_api(t, stats_nsamp, stats_nout) + endif + + !####################################################################### + !###################### CALL MF DIAGNOSTIC PLUMES ###################### + !####################################################################### + if (do_clubb_mf) then + + do k=2,pverp + dzt(k) = zi_g(k) - zi_g(k-1) + dzm(k-1) = zt_g(k) - zt_g(k-1) + enddo + dzt(1) = dzt(2) + dzm(pverp) = dzm(pver) + invrs_dzt = 1._r8/dzt + + rtm_zm_in = zt2zm_api( rtm_in ) + thlm_zm_in = zt2zm_api( thlm_in ) + th_zm = zt2zm_api( th_zt ) + qv_zm = zt2zm_api( qv_zt ) + qc_zm = zt2zm_api( qc_zt ) + + call integrate_mf( pverp, & ! input + rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input + rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input + um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input + th_zt, qv_zt, qc_zt, & ! input + thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input + th_zm, qv_zm, qc_zm, & ! input + wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + wpthlp_in, tke_in, tpert(i), & ! input + mf_cape_output(i), & ! output - plume diagnostics + mf_upa, & ! output - plume diagnostics + mf_upw, & ! output - plume diagnostics + mf_upqt, & ! output - plume diagnostics + mf_upthl, & ! output - plume diagnostics + mf_upthv, & ! output - plume diagnostics + mf_upth, & ! output - plume diagnostics + mf_upqc, & ! output - plume diagnostics + mf_upbuoy, & ! output - plume diagnostics + mf_upent, & ! output - plume diagnostics + mf_dry_a, mf_moist_a, & ! output - plume diagnostics + mf_dry_w, mf_moist_w, & ! output - plume diagnostics + mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics + mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics + mf_dry_u, mf_moist_u, & ! output - plume diagnostics + mf_dry_v, mf_moist_v, & ! output - plume diagnostics + mf_moist_qc, & ! output - plume diagnostics + mf_sqt, mf_sthl, & ! output - plume diagnostics + mf_precc, & ! output - plume diagnostics + s_ae, s_aw, & ! output - plume diagnostics + s_awthl, s_awqt, & ! output - plume diagnostics + s_awql, s_awqi, & ! output - plume diagnostics + s_awth, s_awqv, & ! output - plume diagnostics + s_awu, s_awv, & ! output - plume diagnostics + mf_thflx, mf_qvflx, & ! output - plume diagnostics + mf_thvflx, mf_qcflx, & ! output - plume diagnostics + mf_thlflx, mf_qtflx, & ! output - variables needed for solver + mf_ztop_output(i), mf_L0_output(i) ) + + ! CFL limiter + s_aw(1) = 0._r8 + max_cfl(i)= 0._r8 + do k=2,pverp + max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) + end do + cflval = 1._r8 + cflfac = 1._r8 + cfllim = .true. + if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) + + ! pass MF turbulent advection term as CLUBB explicit forcing term + rtm_forcing = 0._r8 + thlm_forcing = 0._r8 + mf_thforc = 0._r8 + mf_qvforc = 0._r8 + mf_qcforc = 0._r8 + do k=2,pverp + rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & + + mf_sqt(k) + + thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & + + mf_sthl(k) + + mf_thforc(k) = mf_thforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_thflx(k)) - (rho_ds_zm(k-1) * mf_thflx(k-1))) + + mf_qvforc(k) = mf_qvforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qvflx(k)) - (rho_ds_zm(k-1) * mf_qvflx(k-1))) + + mf_qcforc(k) = mf_qcforc(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) + + end do + ! compute ensemble cloud properties + mf_rcm = 0._r8 + mf_cloudfrac = 0._r8 + mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) + mf_cloudfrac(:pverp)= mf_moist_a(:pverp) + + ! [kg/m2/s]->[m/s] + prec_sh(i) = mf_precc(1)/1000._r8 + snow_sh(i) = 0._r8 + + end if + + ! Advance CLUBB CORE one timestep in the future + call advance_clubb_core_api & + ( l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & + thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & + sclrm_forcing, edsclrm_forcing, wprtp_forcing, & + wpthlp_forcing, rtp2_forcing, thlp2_forcing, & + rtpthlp_forcing, wm_zm, wm_zt, & + wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & + wpsclrp_sfc, wpedsclrp_sfc, & + p_in_Pa, rho_zm, rho_in, exner, & + rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & + invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & + rfrzm, radf, & + wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & + host_dx, host_dy, & + clubb_config_flags, & + um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & + thlm_in, rtm_in, wprtp_in, wpthlp_in, & + wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & + sclrm, & + sclrp2, sclrp3, sclrprtp, sclrpthlp, & + wpsclrp, edsclr_in, err_code, & + rcm_inout, cloud_frac_inout, & + wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & + sclrpthvp_inout, & + pdf_params_chnk(i,lchnk), pdf_params_zm_chnk(i,lchnk), & + pdf_implicit_coefs_terms_chnk(i,lchnk), & + khzm_out, khzt_out, & + qclvar_out, thlprcp_out, & + wprcp_out, ice_supersat_frac_out, & + rcm_in_layer_out, cloud_cover_out) + + if ( err_code == clubb_fatal_error ) then + write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep(), "LAT: ", state1%lat(i), " LON: ", state1%lon(i) + call endrun(subr//': Fatal error in CLUBB library') + end if + + + if (do_rainturb) then + rvm_in = rtm_in - rcm_inout + call update_xp2_mc_api(nlev+1, dtime, cloud_frac_inout, & + rcm_inout, rvm_in, thlm_in, wm_zt, exner, pre_in, pdf_params_chnk(i,lchnk), & + rtp2_mc_out, thlp2_mc_out, & + wprtp_mc_out, wpthlp_mc_out, & + rtpthlp_mc_out) + + dum1 = (1._r8 - cam_in%landfrac(i)) + + ! update turbulent moments based on rain evaporation + rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime + thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime + wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime + wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime + endif + + if (do_cldcool) then + + rcm_out_zm = zt2zm_api(rcm_inout) + qrl_zm = zt2zm_api(qrl_clubb) + thlp2_rad_out(:) = 0._r8 + call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) + thlp2_in = thlp2_in + thlp2_rad_out * dtime + thlp2_in = max(thl_tol**2,thlp2_in) + endif + + ! Check to see if stats should be output, here stats are read into + ! output arrays to make them conformable to CAM output + if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& + out_radzt,out_radzm,out_sfc) + + enddo ! end time loop + + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + wp2_in=zm2zt_api(wp2_in) + wpthlp_in=zm2zt_api(wpthlp_in) + wprtp_in=zm2zt_api(wprtp_in) + up2_in=zm2zt_api(up2_in) + vp2_in=zm2zt_api(vp2_in) + thlp2_in=zm2zt_api(thlp2_in) + rtp2_in=zm2zt_api(rtp2_in) + rtpthlp_in=zm2zt_api(rtpthlp_in) + + do k=1,nlev+1 + thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) + rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) + wp2_in(k)=max(w_tol_sqd,wp2_in(k)) + up2_in(k)=max(w_tol_sqd,up2_in(k)) + vp2_in(k)=max(w_tol_sqd,vp2_in(k)) + enddo + endif + endif + + ! Convert RTP2 and THLP2 to thermo grid for output + rtp2_zt = zm2zt_api(rtp2_in) + thl2_zt = zm2zt_api(thlp2_in) + wp2_zt = zm2zt_api(wp2_in) + ! Need moist_qc and cloudfrac on thermo grid for output + mf_qc_zt = zm2zt_api(mf_moist_qc) + mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) + + ! Arrays need to be "flipped" to CAM grid + + do k=1,nlev+1 + + um(i,pverp-k+1) = um_in(k) + vm(i,pverp-k+1) = vm_in(k) + upwp(i,pverp-k+1) = upwp_in(k) + vpwp(i,pverp-k+1) = vpwp_in(k) + wpthvp(i,pverp-k+1) = wpthvp_in(k) + wp2thvp(i,pverp-k+1) = wp2thvp_in(k) + rtpthvp(i,pverp-k+1) = rtpthvp_in(k) + thlpthvp(i,pverp-k+1) = thlpthvp_in(k) + up2(i,pverp-k+1) = up2_in(k) + vp2(i,pverp-k+1) = vp2_in(k) + up3(i,pverp-k+1) = up3_in(k) + vp3(i,pverp-k+1) = vp3_in(k) + thlm(i,pverp-k+1) = thlm_in(k) + rtm(i,pverp-k+1) = rtm_in(k) + wprtp(i,pverp-k+1) = wprtp_in(k) + wpthlp(i,pverp-k+1) = wpthlp_in(k) + wp2(i,pverp-k+1) = wp2_in(k) + wp3(i,pverp-k+1) = wp3_in(k) + rtp2(i,pverp-k+1) = rtp2_in(k) + thlp2(i,pverp-k+1) = thlp2_in(k) + rtp3(i,pverp-k+1) = rtp3_in(k) + thlp3(i,pverp-k+1) = thlp3_in(k) + rtpthlp(i,pverp-k+1) = rtpthlp_in(k) + rcm(i,pverp-k+1) = rcm_inout(k) + ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_out(k) + wprcp(i,pverp-k+1) = wprcp_out(k) + cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(k),1._r8) + rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(k) + cloud_cover(i,pverp-k+1) = min(cloud_cover_out(k),1._r8) + zt_out(i,pverp-k+1) = zt_g(k) + zi_out(i,pverp-k+1) = zi_g(k) + khzm(i,pverp-k+1) = khzm_out(k) + qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(k)) + wm_zt_out(i,pverp-k+1) = wm_zt(k) + + rtp2_zt_out(i,pverp-k+1) = rtp2_zt(k) + thl2_zt_out(i,pverp-k+1) = thl2_zt(k) + wp2_zt_out(i,pverp-k+1) = wp2_zt(k) + + mean_rt & + = pdf_params_chnk(i,lchnk)%mixt_frac(k) & + * pdf_params_chnk(i,lchnk)%rt_1(k) & + + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & + * pdf_params_chnk(i,lchnk)%rt_2(k) + + pdfp_rtp2(i,pverp-k+1) & + = pdf_params_chnk(i,lchnk)%mixt_frac(k) & + * ( ( pdf_params_chnk(i,lchnk)%rt_1(k) - mean_rt )**2 & + + pdf_params_chnk(i,lchnk)%varnce_rt_1(k) ) & + + ( 1.0_r8 - pdf_params_chnk(i,lchnk)%mixt_frac(k) ) & + * ( ( pdf_params_chnk(i,lchnk)%rt_2(k) - mean_rt )**2 & + + pdf_params_chnk(i,lchnk)%varnce_rt_2(k) ) + + do ixind=1,edsclr_dim + edsclr_out(pverp-k+1,ixind) = edsclr_in(k,ixind) + enddo + + if (do_clubb_mf) then + mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) + mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) + mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) + mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) + mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) + mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) + mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) + mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) + mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) + mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) + mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) + mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) + mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + s_ae_output(i,pverp-k+1) = s_ae(k) + s_aw_output(i,pverp-k+1) = s_aw(k) + s_awthl_output(i,pverp-k+1) = s_awthl(k) + s_awth_output(i,pverp-k+1) = s_awth(k) + s_awqv_output(i,pverp-k+1) = s_awqv(k) + s_awqt_output(i,pverp-k+1) = s_awqt(k) + s_awql_output(i,pverp-k+1) = s_awql(k) + s_awqi_output(i,pverp-k+1) = s_awqi(k) + s_awu_output(i,pverp-k+1) = s_awu(k) + s_awv_output(i,pverp-k+1) = s_awv(k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + mf_thflx_output(i,pverp-k+1) = mf_thflx(k) + mf_qvflx_output(i,pverp-k+1) = mf_qvflx(k) + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + mf_precc_output(i,pverp-k+1) = mf_precc(k) + + if (k.ne.1) then + mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) + mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) + mf_thforc_output(i,pverp-k+1) = mf_thforc(k) + mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) + mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) + mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) + end if + + mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) + mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) + mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) + mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) + + end if + + enddo + + if (do_clubb_mf) then + do k=1,clubb_mf_nup + mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) + mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) + mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) + mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) + mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) + mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) + mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) + end do + end if + + ! Values to use above top_lev, for variables that have not already been + ! set up there. These are mostly fill values that should not actually be + ! used in the run, but may end up in diagnostic output. + upwp(i,:top_lev-1) = 0._r8 + vpwp(i,:top_lev-1) = 0._r8 + rcm(i,:top_lev-1) = 0._r8 + wprcp(i,:top_lev-1) = 0._r8 + cloud_frac(i,:top_lev-1) = 0._r8 + rcm_in_layer(i,:top_lev-1) = 0._r8 + zt_out(i,:top_lev-1) = 0._r8 + zi_out(i,:top_lev-1) = 0._r8 + khzm(i,:top_lev-1) = 0._r8 + qclvar(i,:top_lev-1) = 2._r8 + + + + ! enforce zero tracer tendencies above the top_lev level -- no change + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) + end if + enddo + + ! Fill up arrays needed for McICA. Note we do not want the ghost point, + ! thus why the second loop is needed. + + zi_out(i,1) = 0._r8 + + ! Section below is concentrated on energy fixing for conservation. + ! There are two steps to this process. The first is to remove any tendencies + ! CLUBB may have produced above where it is active due to roundoff. + ! The second is to provider a fixer because CLUBB and CAM's thermodynamic + ! variables are different. + + ! Initialize clubbtop with the chemistry topopause top, to prevent CLUBB from + ! firing up in the stratosphere + clubbtop = troplev(i) + do while ((rtp2(i,clubbtop) <= 1.e-15_r8 .and. rcm(i,clubbtop) == 0._r8) .and. clubbtop < pver-1) + clubbtop = clubbtop + 1 + enddo + + ! Compute static energy using CLUBB's variables + do k=1,pver + clubb_s(k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & + + latvap * rcm(i,k) & + + gravit * state1%zm(i,k) + state1%phis(i) + enddo + + ! Compute integrals above layer where CLUBB is active + se_upper_a = 0._r8 ! energy in layers above where CLUBB is active AFTER CLUBB is called + se_upper_b = 0._r8 ! energy in layers above where CLUBB is active BEFORE CLUBB is called + tw_upper_a = 0._r8 ! total water in layers above where CLUBB is active AFTER CLUBB is called + tw_upper_b = 0._r8 ! total water in layers above where CLUBB is active BEFORE CLUBB is called + do k=1,clubbtop + se_upper_a = se_upper_a + (clubb_s(k)+0.5_r8*(um(i,k)**2+vm(i,k)**2)+(latvap+latice)* & + (rtm(i,k)-rcm(i,k))+(latice)*rcm(i,k))*state1%pdel(i,k)/gravit + se_upper_b = se_upper_b + (state1%s(i,k)+0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)+(latvap+latice)* & + state1%q(i,k,ixq)+(latice)*state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit + tw_upper_a = tw_upper_a + rtm(i,k)*state1%pdel(i,k)/gravit + tw_upper_b = tw_upper_b + (state1%q(i,k,ixq)+state1%q(i,k,ixcldliq))*state1%pdel(i,k)/gravit + enddo + + ! Compute the disbalance of total energy and water in upper levels, + ! divide by the thickness in the lower atmosphere where we will + ! evenly distribute this disbalance + se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + + ! Perform a test to see if there will be any negative RTM errors + ! in the column. If so, apply the disbalance to the surface + apply_to_surface = .false. + if (tw_upper_diss < 0._r8) then + do k=clubbtop+1,pver + rtm_test = (rtm(i,k) + tw_upper_diss*gravit) - rcm(i,k) + if (rtm_test < 0._r8) then + apply_to_surface = .true. + endif + enddo + endif + + if (apply_to_surface) then + tw_upper_diss = (tw_upper_a - tw_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) + se_upper_diss = (se_upper_a - se_upper_b)/(state1%pint(i,pverp)-state1%pint(i,pver)) + rtm(i,pver) = rtm(i,pver) + tw_upper_diss*gravit + if (apply_to_heat) clubb_s(pver) = clubb_s(pver) + se_upper_diss*gravit + else + ! Apply the disbalances above to layers where CLUBB is active + do k=clubbtop+1,pver + rtm(i,k) = rtm(i,k) + tw_upper_diss*gravit + if (apply_to_heat) clubb_s(k) = clubb_s(k) + se_upper_diss*gravit + enddo + endif + + ! Essentially "zero" out tendencies in the layers above where CLUBB is active + do k=1,clubbtop + if (apply_to_heat) clubb_s(k) = state1%s(i,k) + rcm(i,k) = state1%q(i,k,ixcldliq) + rtm(i,k) = state1%q(i,k,ixq) + rcm(i,k) + enddo + + ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water + ! after CLUBB is called. This is for energy conservation purposes. + se_a = 0._r8 + ke_a = 0._r8 + wv_a = 0._r8 + wl_a = 0._r8 + + ! Do the same as above, but for before CLUBB was called. + se_b = 0._r8 + ke_b = 0._r8 + wv_b = 0._r8 + wl_b = 0._r8 + do k=1,pver + se_a(i) = se_a(i) + clubb_s(k)*state1%pdel(i,k)/gravit + ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)/gravit + wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdel(i,k)/gravit + wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdel(i,k)/gravit + + se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)/gravit + ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)/gravit + wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdel(i,k)/gravit + wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit + enddo + + ! Based on these integrals, compute the total energy before and after CLUBB call + te_a(i) = se_a(i) + ke_a(i) + (latvap+latice)*wv_a(i)+latice*wl_a(i) + te_b(i) = se_b(i) + ke_b(i) + (latvap+latice)*wv_b(i)+latice*wl_b(i) + + ! Take into account the surface fluxes of heat and moisture + ! Use correct qflux from cam_in, not lhf/latvap as was done previously + te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime + ! subtract enthalpy of falling precip from tb + te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime + + ! Compute the disbalance of total energy, over depth where CLUBB is active + se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + + ! Fix the total energy coming out of CLUBB so it achieves enery conservation. + ! Apply this fixer throughout the column evenly, but only at layers where + ! CLUBB is active. + ! + ! NOTE: The energy fixer seems to cause the climate to change significantly + ! when using specified dynamics, so allow this to be turned off via a namelist + ! variable. + if (clubb_do_energyfix) then + do k=clubbtop+1,pver + clubb_s(k) = clubb_s(k) - se_dis*gravit + enddo + endif + ! convert to units of +ve [K] + se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) + + ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point + ! for all variables and therefore is never called in this loop + rtm_integral_vtend = 0._r8 + rtm_integral_ltend = 0._r8 + do k=1,pver + + ptend_loc%u(i,k) = (um(i,k)-state1%u(i,k))/hdtime ! east-west wind + ptend_loc%v(i,k) = (vm(i,k)-state1%v(i,k))/hdtime ! north-south wind + ptend_loc%q(i,k,ixq) = (rtm(i,k)-rcm(i,k)-state1%q(i,k,ixq))/hdtime ! water vapor + ptend_loc%q(i,k,ixcldliq) = (rcm(i,k)-state1%q(i,k,ixcldliq))/hdtime ! Tendency of liquid water + ptend_loc%s(i,k) = (clubb_s(k)-state1%s(i,k))/hdtime ! Tendency of static energy + + rtm_integral_ltend = rtm_integral_ltend + ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/gravit + rtm_integral_vtend = rtm_integral_vtend + ptend_loc%q(i,k,ixq)*state1%pdel(i,k)/gravit + + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + + ! Here add a constant to moments which can be either positive or + ! negative. This is to prevent clipping when dynamics tries to + ! make all constituents positive + wp3(i,k) = wp3(i,k) + wp3_const + rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const + wpthlp(i,k) = wpthlp(i,k) + wpthlp_const + wprtp(i,k) = wprtp(i,k) + wprtp_const + + ptend_loc%q(i,k,ixthlp2)=(thlp2(i,k)-state1%q(i,k,ixthlp2))/hdtime ! THLP Variance + ptend_loc%q(i,k,ixrtp2)=(rtp2(i,k)-state1%q(i,k,ixrtp2))/hdtime ! RTP Variance + ptend_loc%q(i,k,ixrtpthlp)=(rtpthlp(i,k)-state1%q(i,k,ixrtpthlp))/hdtime ! RTP THLP covariance + ptend_loc%q(i,k,ixwpthlp)=(wpthlp(i,k)-state1%q(i,k,ixwpthlp))/hdtime ! WPTHLP + ptend_loc%q(i,k,ixwprtp)=(wprtp(i,k)-state1%q(i,k,ixwprtp))/hdtime ! WPRTP + ptend_loc%q(i,k,ixwp2)=(wp2(i,k)-state1%q(i,k,ixwp2))/hdtime ! WP2 + ptend_loc%q(i,k,ixwp3)=(wp3(i,k)-state1%q(i,k,ixwp3))/hdtime ! WP3 + ptend_loc%q(i,k,ixup2)=(up2(i,k)-state1%q(i,k,ixup2))/hdtime ! UP2 + ptend_loc%q(i,k,ixvp2)=(vp2(i,k)-state1%q(i,k,ixvp2))/hdtime ! VP2 + else + ptend_loc%q(i,k,ixthlp2)=0._r8 + ptend_loc%q(i,k,ixrtp2)=0._r8 + ptend_loc%q(i,k,ixrtpthlp)=0._r8 + ptend_loc%q(i,k,ixwpthlp)=0._r8 + ptend_loc%q(i,k,ixwprtp)=0._r8 + ptend_loc%q(i,k,ixwp2)=0._r8 + ptend_loc%q(i,k,ixwp3)=0._r8 + ptend_loc%q(i,k,ixup2)=0._r8 + ptend_loc%q(i,k,ixvp2)=0._r8 + endif + + endif + + ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. + ! Loading up this array doesn't mean the tendencies are applied. + ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed + + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + icnt=icnt+1 + if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& + (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& + (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& + (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& + (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then + ptend_loc%q(i,k,ixind) = (edsclr_out(k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents + end if + end if + enddo + + enddo + + + enddo ! end column loop + + ! dte / hdtime = [kg/s2]/[s] = W/m2 + call outfld('ELEAK_CLUBB', (te_a - te_b)/hdtime, pcols, lchnk) + call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) + + call outfld('KVH_CLUBB', khzm, pcols, lchnk) + + ! Add constant to ghost point so that output is not corrupted + if (clubb_do_adv) then + if (macmic_it == cld_macmic_num_steps) then + wp3(:,pverp) = wp3(:,pverp) + wp3_const + rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const + wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const + wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const + endif + endif + + cmeliq(:,:) = ptend_loc%q(:,:,ixcldliq) + + ! ------------------------------------------------- ! + ! End column computation of CLUBB, begin to apply ! + ! and compute output, etc ! + ! ------------------------------------------------- ! + + ! Output CLUBB tendencies + call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) + call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) + call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) + call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) + call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) + call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) + + call outfld( 'CMELIQ', cmeliq, pcols, lchnk) + + call physics_ptend_sum(ptend_loc,ptend_all,ncol) + call physics_update(state1,ptend_loc,hdtime) + + ! Due to the order of operation of CLUBB, which closes on liquid first, + ! then advances it's predictive equations second, this can lead to + ! RHliq > 1 directly before microphysics is called. Therefore, we use + ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. + + if (clubb_do_liqsupersat) then + + ! -------------------------------------- ! + ! Ice Saturation Adjustment Computation ! + ! -------------------------------------- ! + + latsub = latvap + latice + + lq2(:) = .FALSE. + lq2(ixq) = .TRUE. + lq2(ixcldliq) = .TRUE. + lq2(ixnumliq) = .TRUE. + + call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) + + stend(:ncol,:)=0._r8 + qvtend(:ncol,:)=0._r8 + qctend(:ncol,:)=0._r8 + inctend(:ncol,:)=0._r8 + + call liquid_macro_tend(npccn(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & + state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,ixq), & + state1%q(1:ncol,top_lev:pver,ixcldliq), state1%q(1:ncol,top_lev:pver,ixnumliq), & + latvap, hdtime, stend(1:ncol,top_lev:pver),qvtend(1:ncol,top_lev:pver), & + qctend(1:ncol,top_lev:pver), inctend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) + + ! update local copy of state with the tendencies + ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) + ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) + ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) + + ! Add the ice tendency to the output tendency + call physics_ptend_sum(ptend_loc, ptend_all, ncol) + + ! ptend_loc is reset to zero by this call + call physics_update(state1, ptend_loc, hdtime) + + ! Write output for tendencies: + ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE + temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) + call outfld( 'TTENDICE', temp2d, pcols, lchnk ) + call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) + call outfld( 'QCTENDICE', qctend, pcols, lchnk ) + call outfld( 'NCTENDICE', inctend, pcols, lchnk ) + + where(qctend .ne. 0._r8) + fqtend = 1._r8 + elsewhere + fqtend = 0._r8 + end where + + call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) + end if + + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! The rest of the code deals with diagnosing variables ! + ! for microphysics/radiation computation and macrophysics ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + ! ------------------------------------------------------------ ! + + + ! --------------------------------------------------------------------------------- ! + ! COMPUTE THE ICE CLOUD DETRAINMENT ! + ! Detrainment of convective condensate into the environment or stratiform cloud ! + ! --------------------------------------------------------------------------------- ! + + ! Initialize the shallow convective detrainment rate, will always be zero + dlf2(:,:) = 0.0_r8 + dlf_liq_out(:,:) = 0.0_r8 + dlf_ice_out(:,:) = 0.0_r8 + + lqice(:) = .false. + lqice(ixcldliq) = .true. + lqice(ixcldice) = .true. + lqice(ixnumliq) = .true. + lqice(ixnumice) = .true. + + call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) + + if (zmconv_microp) then + call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) + call pbuf_get_field(pbuf, difzm_idx, difzm) + call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) + call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) + end if + + do k=1,pver + do i=1,ncol + if( state1%t(i,k) > meltpt_temp ) then + dum1 = 0.0_r8 + elseif ( state1%t(i,k) < dt_low ) then + dum1 = 1.0_r8 + else + dum1 = ( meltpt_temp - state1%t(i,k) ) / ( meltpt_temp - dt_low ) + endif + + if (zmconv_microp) then + ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) + ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 + + ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8*dl_rad**3*997._r8) ! Shallow Convection + ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & + / (4._r8*3.14_r8*di_rad**3*500._r8) ! Shallow Convection + ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice + else + + ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) + ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 + ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8*dl_rad**3*997._r8) + & ! Deep Convection + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & + / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection + ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & + / (4._r8*3.14_r8*di_rad**3*500._r8) + & ! Deep Convection + 3._r8 * ( dlf2(i,k) * dum1 ) & + / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection + ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice + + dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) + dlf_ice_out(i,k) = dlf(i,k) * dum1 + end if + + ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep + ! track of the integrals of ice and static energy that is effected from conversion to ice + ! so that the energy checker doesn't complain. + det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)/gravit + det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/gravit + + enddo + enddo + + det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water + + call outfld( 'DPDLFLIQ', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) + call outfld( 'DPDLFICE', ptend_loc%q(:,:,ixcldice), pcols, lchnk) + + temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) + call outfld( 'DPDLFT', temp2d, pcols, lchnk) + + call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) + + call physics_ptend_sum(ptend_loc,ptend_all,ncol) + call physics_update(state1,ptend_loc,hdtime) + + ! ptend_all now has all accumulated tendencies. Convert the tendencies for the + ! dry constituents to dry air basis. + do ixind = 1, pcnst + if (lq(ixind) .and. cnst_type(ixind) == 'dry') then + do k = 1, pver + do i = 1, ncol + ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdel(i,k)/state1%pdeldry(i,k) + end do + end do + end if + end do + + ! ------------------------------------------------- ! + ! Diagnose relative cloud water variance ! + ! ------------------------------------------------- ! + + if (deep_scheme == 'CLUBB_SGS') then + relvarmax = 2.0_r8 + else + relvarmax = 10.0_r8 + endif + + relvar(:,:) = relvarmax ! default + + if (deep_scheme .ne. 'CLUBB_SGS') then + where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & + relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) + endif + + ! ------------------------------------------------- ! + ! Optional Accretion enhancement factor ! + ! ------------------------------------------------- ! + + accre_enhan(:ncol,:pver) = 1._r8 + + ! ------------------------------------------------- ! + ! Diagnose some output variables ! + ! ------------------------------------------------- ! + + ! density + rho(:ncol,1:pver) = state1%pmid(:ncol,1:pver)/(rairv(:ncol,1:pver,lchnk)*state1%t(:ncol,1:pver)) + rho(:ncol,pverp) = state1%ps(:ncol)/(rairv(:ncol,pver,lchnk)*state1%t(:ncol,pver)) + + wpthvp_diag(:,:) = 0.0_r8 + do k=1,pver + do i=1,ncol + eps = rairv(i,k,lchnk)/rh2o + ! buoyancy flux + wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & + (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & + state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) + + ! total water mixing ratio + qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) + ! liquid water potential temperature + thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) + ! liquid water static energy + sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) + enddo + enddo + + do k=1,pverp + do i=1,ncol + wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux + wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux + rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output + wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output + tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy + wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair + if (do_clubb_mf) then + mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair + mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair + mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap + mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o + end if + enddo + enddo + + do k=1,pverp + do i=1,ncol + qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) + thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) + rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) + cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) + wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) + wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) + wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) + if (do_clubb_mf) then + mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) + mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) + mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) + end if + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! Diagnose some quantities that are computed in macrop_tend here. ! + ! These are inputs required for the microphysics calculation. ! + ! ! + ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! + ! --------------------------------------------------------------------------------- ! + + ! initialize variables + alst(:,:) = 0.0_r8 + qlst(:,:) = 0.0_r8 + + do k=1,pver + do i=1,ncol + alst(i,k) = cloud_frac(i,k) + qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! + ! --------------------------------------------------------------------------------- ! + + deepcu = 0.0_r8 + shalcu = 0.0_r8 + + do k=1,pver-1 + do i=1,ncol + ! diagnose the deep convective cloud fraction, as done in macrophysics based on the + ! deep convective mass flux, read in from pbuf. Since shallow convection is never + ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud + ! fraction is purely from deep convection scheme. + deepcu(i,k) = max(0.0_r8,min(dp1*log(1.0_r8+dp2*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) + + if (do_clubb_mf_rad) then + shalcu(i,k) = mf_cloudfrac_output(i,k) + sh_icwmr(i,k) = mf_qc_output(i,k) + end if + + if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then + deepcu(i,k) = 0._r8 + endif + + if (shalcu(i,k) <= frac_limit .or. sh_icwmr(i,k) < ic_limit) then + shalcu(i,k) = 0._r8 + endif + + ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable + ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation + ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud + ! from CLUBB plus the deep convective cloud fraction + concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) + enddo + enddo + + if (single_column) then + if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & + trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & + trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & + trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & + trim(scm_clubb_iop_name) == 'RICO_3day' .or. & + trim(scm_clubb_iop_name) == 'ARM_CC') then + + deepcu(:,:) = 0.0_r8 + concld(:,:) = 0.0_r8 + + endif + endif + + ! --------------------------------------------------------------------------------- ! + ! COMPUTE THE ICE CLOUD FRACTION PORTION ! + ! use the aist_vector function to compute the ice cloud fraction ! + ! --------------------------------------------------------------------------------- ! + + aist(:,:top_lev-1) = 0._r8 + qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below + + do k = top_lev, pver + + ! For Type II PSC and for thin cirrus, the clouds can be thin, but + ! extensive and they should start forming when the gridbox mean saturation + ! reaches 1.0. + ! + ! For now, use the tropopause diagnostic to determine where the Type II + ! PSC should be, but in the future wold like a better metric that can also + ! identify the level for thin cirrus. Include the tropopause level so that + ! the cold point tropopause will use the stratospheric values. + where (k <= troplev) + rhmini = rhminis_const + rhmaxi = rhmaxis_const + elsewhere + rhmini = rhmini_const + rhmaxi = rhmaxi_const + end where + + if ( trim(subcol_scheme) == 'SILHS' ) then + call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & + state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) + else + call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & + state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& + qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) + endif + enddo + + ! --------------------------------------------------------------------------------- ! + ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! + ! ! + ! For now leave the computation of ice stratus fraction from macrop_driver intact ! + ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! + ! fraction that was coded in macrop_driver ! + ! --------------------------------------------------------------------------------- ! + + ! Recompute net stratus fraction using maximum over-lapping assumption, as done + ! in macrophysics code, using alst computed above and aist read in from physics buffer + + do k=1,pver + do i=1,ncol + + ast(i,k) = max(alst(i,k),aist(i,k)) + + qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) + enddo + enddo + + ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just + ! be outputting the shallow convective cloud fraction + + do k=1,pver + do i=1,ncol + cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) + enddo + enddo + + ! --------------------------------------------------------------------------------- ! + ! DIAGNOSE THE PBL DEPTH ! + ! this is needed for aerosol code ! + ! --------------------------------------------------------------------------------- ! + + do i=1,ncol + do k=1,pver + th(i,k) = state1%t(i,k)*state1%exner(i,k) + thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq)) + enddo + enddo + + ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) + rrho(1:ncol) = (1._r8/gravit)*(state1%pdel(1:ncol,pver)/dz_g(pver)) + call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & + rrho(1:ncol), ustar2(1:ncol)) + ! use correct qflux from coupler + call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & + rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & + obklen(1:ncol)) + + dummy2(:) = 0._r8 + dummy3(:) = 0._r8 + + where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 + + ! Compute PBL depth according to Holtslag-Boville Scheme + call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & + ustar2, obklen, kbfs, pblh, dummy2, & + state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) + + ! Output the PBL depth + call outfld('PBLH', pblh, pcols, lchnk) + + ! Assign the first pver levels of cloud_frac back to cld + cld(:,1:pver) = cloud_frac(:,1:pver) + + ! --------------------------------------------------------------------------------- ! + ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! + ! --------------------------------------------------------------------------------- ! + + ! Output calls of variables goes here + call outfld( 'RELVAR', relvar, pcols, lchnk ) + call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) + call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) + call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) + call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) + call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) + call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) + call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) + call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) + + temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 + call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) + + rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 + call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) + + temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 + call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap + call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 + call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = wpthvp(:ncol,:) + call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) + + call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) + + call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) + call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) + call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) + call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) + call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) + call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) + call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) + call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) + call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) + call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) + call outfld( 'UM_CLUBB', um, pcols, lchnk ) + call outfld( 'VM_CLUBB', vm, pcols, lchnk ) + call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) + call outfld( 'THETAL', thetal_output, pcols, lchnk ) + call outfld( 'QT', qt_output, pcols, lchnk ) + call outfld( 'SL', sl_output, pcols, lchnk ) + call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) + call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) + call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) + call outfld( 'UM_CLUBB', um, pcols, lchnk ) + call outfld( 'VM_CLUBB', vm, pcols, lchnk ) + call outfld( 'THETAL', thetal_output, pcols, lchnk ) + call outfld( 'QT', qt_output, pcols, lchnk ) + call outfld( 'SL', sl_output, pcols, lchnk ) + call outfld( 'CONCLD', concld, pcols, lchnk ) + call outfld( 'DP_CLD', deepcu, pcols, lchnk ) + call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) + call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) + call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) + call outfld( 'QSATFAC', qsatfac, pcols, lchnk) + + + ! --------------------------------------------------------------- ! + ! Writing state variables after EDMF scheme for detailed analysis ! + ! --------------------------------------------------------------- ! + if (do_clubb_mf) then + call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) + call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) + call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) + call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) + call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) + call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) + call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) + call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) + call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTH' , s_awth_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQV' , s_awqv_output, pcols, lchnk ) + call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) + call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) + call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) + call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) + call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) + call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) + call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) + call outfld( 'edmf_thflx' , mf_thflx_output, pcols, lchnk ) + call outfld( 'edmf_qvflx' , mf_qvflx_output, pcols, lchnk ) + call outfld( 'edmf_thforc' , mf_thforc_output, pcols, lchnk ) + call outfld( 'edmf_qvforc' , mf_qvforc_output, pcols, lchnk ) + call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) + call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) + call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) + call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) + call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) + call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) + call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) + call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) + call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) + call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) + call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) + call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) + call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) + call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) + call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) + call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) + end if + + if (macmic_it==cld_macmic_num_steps) then + call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) + call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) + call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) + call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) + + call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) + call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) + if (do_clubb_mf) then + call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) + call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) + call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) + end if + end if + + ! Output CLUBB history here + if (l_stats) then + + do i=1,stats_zt%num_output_fields + + temp1 = trim(stats_zt%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + + call outfld(trim(sub), out_zt(:,:,i), pcols, lchnk ) + enddo + + do i=1,stats_zm%num_output_fields + + temp1 = trim(stats_zm%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + + call outfld(trim(sub),out_zm(:,:,i), pcols, lchnk) + enddo + + if (l_output_rad_files) then + do i=1,stats_rad_zt%num_output_fields + call outfld(trim(stats_rad_zt%file%var(i)%name), out_radzt(:,:,i), pcols, lchnk) + enddo + + do i=1,stats_rad_zm%num_output_fields + call outfld(trim(stats_rad_zm%file%var(i)%name), out_radzm(:,:,i), pcols, lchnk) + enddo + endif + + do i=1,stats_sfc%num_output_fields + call outfld(trim(stats_sfc%file%var(i)%name), out_sfc(:,:,i), pcols, lchnk) + enddo + + endif + + return +#endif + end subroutine clubb_tend_cam + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +! Saturation adjustment for ice +! Add ice mass if supersaturated +subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend,vlen) + + use wv_sat_methods, only: wv_sat_qsat_ice + + integer, intent(in) :: vlen + real(r8), dimension(vlen), intent(in) :: naai !Activated number of ice nuclei + real(r8), dimension(vlen), intent(in) :: t !temperature (k) + real(r8), dimension(vlen), intent(in) :: p !pressure (pa) + real(r8), dimension(vlen), intent(in) :: qv !water vapor mixing ratio + real(r8), dimension(vlen), intent(in) :: qi !ice mixing ratio + real(r8), dimension(vlen), intent(in) :: ni !ice number concentration + real(r8), intent(in) :: xxls !latent heat of freezing + real(r8), intent(in) :: deltat !timestep + real(r8), dimension(vlen), intent(out) :: stend ! 'temperature' tendency + real(r8), dimension(vlen), intent(out) :: qvtend !vapor tendency + real(r8), dimension(vlen), intent(out) :: qitend !ice mass tendency + real(r8), dimension(vlen), intent(out) :: nitend !ice number tendency + + real(r8) :: ESI(vlen) + real(r8) :: QSI(vlen) + integer :: i + + do i = 1, vlen + stend(i) = 0._r8 + qvtend(i) = 0._r8 + qitend(i) = 0._r8 + nitend(i) = 0._r8 + end do + +! calculate qsati from t,p,q + do i = 1, vlen + call wv_sat_qsat_ice(t(i), p(i), ESI(i), QSI(i)) + end do + + do i = 1, vlen + if (naai(i) > 1.e-18_r8 .and. qv(i) > QSI(i)) then + + qitend(i) = (qv(i)-QSI(i))/deltat + qvtend(i) = 0._r8 - qitend(i) + stend(i) = qitend(i) * xxls ! moist static energy tend...[J/kg/s] ! + + ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice + if (ni(i) < 1.e3_r8 .and. (qi(i)+qitend(i)*deltat) > 1.e-18_r8) then + nitend(i) = nitend(i) + 3._r8 * qitend(i)/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) + end if + + end if + end do + +end subroutine ice_macro_tend + +#ifdef CLUBB_SGS +! ---------------------------------------------------------------------- +! +! DISCLAIMER : this code appears to be correct but has not been +! very thouroughly tested. If you do notice any +! anomalous behaviour then please contact Andy and/or +! Bjorn +! +! Function diag_ustar: returns value of ustar using the below +! similarity functions and a specified buoyancy flux (bflx) given in +! kinematic units +! +! phi_m (zeta > 0) = (1 + am * zeta) +! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) +! +! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) +! +! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface +! Layer, in Workshop on Micormeteorology, pages 67-100. +! +! Code writen March, 1999 by Bjorn Stevens +! + +real(r8) function diag_ustar( z, bflx, wnd, z0 ) + +use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g + +implicit none + +real(r8), parameter :: am = 4.8_r8 ! " " " +real(r8), parameter :: bm = 19.3_r8 ! " " " + +real(r8), parameter :: grav = shr_const_g +real(r8), parameter :: vonk = shr_const_karman +real(r8), parameter :: pi = shr_const_pi + +real(r8), intent (in) :: z ! height where u locates +real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) +real(r8), intent (in) :: wnd ! wind speed at z +real(r8), intent (in) :: z0 ! momentum roughness height + + +integer :: iterate +real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar + +lnz = log( z / z0 ) +klnz = vonk/lnz +c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) + +ustar = wnd*klnz +if (abs(bflx) > 1.e-6_r8) then + do iterate=1,4 + + if (ustar > 1.e-6_r8) then + lmo = -ustar**3 / ( vonk * bflx ) + zeta = z/lmo + if (zeta > 0._r8) then + ustar = vonk*wnd /(lnz + am*zeta) + else + x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) + psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 + ustar = wnd*vonk/(lnz - psi1) + end if + + endif + + end do +end if + + +diag_ustar = ustar + +return + + +end function diag_ustar +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +#ifdef CLUBB_SGS + + subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & + nnzp, nnrad_zt,nnrad_zm, delt ) + ! + ! Description: Initializes the statistics saving functionality of + ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here + ! the traditional stats_init of CLUBB is not called, as it is not compatible + ! with CAM output. + + !----------------------------------------------------------------------- + + + use clubb_api_module, only: & + stats_zt, & ! Variables + ztscr01, & + ztscr02, & + ztscr03, & + ztscr04, & + ztscr05, & + ztscr06, & + ztscr07, & + ztscr08, & + ztscr09, & + ztscr10, & + ztscr11, & + ztscr12, & + ztscr13, & + ztscr14, & + ztscr15, & + ztscr16, & + ztscr17, & + ztscr18, & + ztscr19, & + ztscr20, & + ztscr21 + + use clubb_api_module, only: & + stats_zm, & + zmscr01, & + zmscr02, & + zmscr03, & + zmscr04, & + zmscr05, & + zmscr06, & + zmscr07, & + zmscr08, & + zmscr09, & + zmscr10, & + zmscr11, & + zmscr12, & + zmscr13, & + zmscr14, & + zmscr15, & + zmscr16, & + zmscr17, & + stats_rad_zt, & + stats_rad_zm, & + stats_sfc, & + l_stats, & + l_output_rad_files, & + stats_tsamp, & + stats_tout, & + l_stats_samp, & + l_stats_last, & + l_netcdf, & + l_grads + + use clubb_api_module, only: time_precision, & ! + nvarmax_zm, stats_init_zm_api, & ! + nvarmax_zt, stats_init_zt_api, & ! + nvarmax_rad_zt, stats_init_rad_zt_api, & ! + nvarmax_rad_zm, stats_init_rad_zm_api, & ! + nvarmax_sfc, stats_init_sfc_api, & ! + fstderr, var_length ! + use cam_abortutils, only: endrun + use cam_history, only: addfld, horiz_only + use namelist_utils, only: find_group_name + use units, only: getunit, freeunit + use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character + + implicit none + + ! Input Variables + + logical, intent(in) :: l_stats_in ! Stats on? T/F + + real(kind=time_precision), intent(in) :: & + stats_tsamp_in, & ! Sampling interval [s] + stats_tout_in ! Output interval [s] + + integer, intent(in) :: nnzp ! Grid points in the vertical [count] + integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] + integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] + + real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] + + + ! Local Variables + + ! Namelist Variables + + character(len=*), parameter :: subr = 'stats_init_clubb' + + character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels + character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels + character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels + character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels + character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface + + namelist /clubb_stats_nl/ & + clubb_vars_zt, & + clubb_vars_zm, & + clubb_vars_rad_zt, & + clubb_vars_rad_zm, & + clubb_vars_sfc + + ! Local Variables + + logical :: l_error + + character(len=200) :: temp1, sub + + integer :: i, ntot, read_status + integer :: iunit, ierr + + ! Initialize + l_error = .false. + + ! Set stats_variables variables with inputs from calling subroutine + l_stats = l_stats_in + + stats_tsamp = stats_tsamp_in + stats_tout = stats_tout_in + + if ( .not. l_stats ) then + l_stats_samp = .false. + l_stats_last = .false. + return + end if + + ! Initialize namelist variables + + clubb_vars_zt = '' + clubb_vars_zm = '' + clubb_vars_rad_zt = '' + clubb_vars_rad_zm = '' + clubb_vars_sfc = '' + + ! Read variables to compute from the namelist + if (masterproc) then + iunit= getunit() + open(unit=iunit,file="atm_in",status='old') + call find_group_name(iunit, 'clubb_stats_nl', status=read_status) + if (read_status == 0) then + read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) + if (read_status /= 0) then + call endrun('stats_init_clubb: error reading namelist') + end if + end if + close(unit=iunit) + call freeunit(iunit) + end if + + ! Broadcast namelist variables + call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") + call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") + call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") + call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") + call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") + + ! Hardcode these for use in CAM-CLUBB, don't want either + l_netcdf = .false. + l_grads = .false. + + ! Check sampling and output frequencies + + ! The model time step length, delt (which is dtmain), should multiply + ! evenly into the statistical sampling time step length, stats_tsamp. + if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then + l_error = .true. ! This will cause the run to stop. + write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & + 'delt (which is dtmain). Check the appropriate ', & + 'model.in file.' + write(fstderr,*) 'stats_tsamp = ', stats_tsamp + write(fstderr,*) 'delt = ', delt + endif + + ! Initialize zt (mass points) + + i = 1 + do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zt(i)) /= 0 .and. & + i <= nvarmax_zt ) + i = i + 1 + enddo + ntot = i - 1 + if ( ntot == nvarmax_zt ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_zt than allowed for by nvarmax_zt." + write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & + "in the stats namelist, or change nvarmax_zt." + write(fstderr,*) "nvarmax_zt = ", nvarmax_zt + call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") + endif + + stats_zt%num_output_fields = ntot + stats_zt%kk = nnzp + + allocate( stats_zt%z( stats_zt%kk ) ) + + allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) + call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & + stats_zt%accum_num_samples, stats_zt%l_in_update ) + + allocate( stats_zt%file%var( stats_zt%num_output_fields ) ) + allocate( stats_zt%file%z( stats_zt%kk ) ) + + ! Allocate scratch space + + allocate( ztscr01(stats_zt%kk) ) + allocate( ztscr02(stats_zt%kk) ) + allocate( ztscr03(stats_zt%kk) ) + allocate( ztscr04(stats_zt%kk) ) + allocate( ztscr05(stats_zt%kk) ) + allocate( ztscr06(stats_zt%kk) ) + allocate( ztscr07(stats_zt%kk) ) + allocate( ztscr08(stats_zt%kk) ) + allocate( ztscr09(stats_zt%kk) ) + allocate( ztscr10(stats_zt%kk) ) + allocate( ztscr11(stats_zt%kk) ) + allocate( ztscr12(stats_zt%kk) ) + allocate( ztscr13(stats_zt%kk) ) + allocate( ztscr14(stats_zt%kk) ) + allocate( ztscr15(stats_zt%kk) ) + allocate( ztscr16(stats_zt%kk) ) + allocate( ztscr17(stats_zt%kk) ) + allocate( ztscr18(stats_zt%kk) ) + allocate( ztscr19(stats_zt%kk) ) + allocate( ztscr20(stats_zt%kk) ) + allocate( ztscr21(stats_zt%kk) ) + + ztscr01 = 0.0_r8 + ztscr02 = 0.0_r8 + ztscr03 = 0.0_r8 + ztscr04 = 0.0_r8 + ztscr05 = 0.0_r8 + ztscr06 = 0.0_r8 + ztscr07 = 0.0_r8 + ztscr08 = 0.0_r8 + ztscr09 = 0.0_r8 + ztscr10 = 0.0_r8 + ztscr11 = 0.0_r8 + ztscr12 = 0.0_r8 + ztscr13 = 0.0_r8 + ztscr14 = 0.0_r8 + ztscr15 = 0.0_r8 + ztscr16 = 0.0_r8 + ztscr17 = 0.0_r8 + ztscr18 = 0.0_r8 + ztscr19 = 0.0_r8 + ztscr20 = 0.0_r8 + ztscr21 = 0.0_r8 + + ! Default initialization for array indices for zt + + call stats_init_zt_api( clubb_vars_zt, l_error ) + + ! Initialize zm (momentum points) + + i = 1 + do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_zm(i)) /= 0 .and. & + i <= nvarmax_zm ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_zm ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_zm than allowed for by nvarmax_zm." + write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & + "in the stats namelist, or change nvarmax_zm." + write(fstderr,*) "nvarmax_zm = ", nvarmax_zm + call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") + endif + + stats_zm%num_output_fields = ntot + stats_zm%kk = nnzp + + allocate( stats_zm%z( stats_zm%kk ) ) + + allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) + call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & + stats_zm%accum_num_samples, stats_zm%l_in_update ) + + allocate( stats_zm%file%var( stats_zm%num_output_fields ) ) + allocate( stats_zm%file%z( stats_zm%kk ) ) + + ! Allocate scratch space + + allocate( zmscr01(stats_zm%kk) ) + allocate( zmscr02(stats_zm%kk) ) + allocate( zmscr03(stats_zm%kk) ) + allocate( zmscr04(stats_zm%kk) ) + allocate( zmscr05(stats_zm%kk) ) + allocate( zmscr06(stats_zm%kk) ) + allocate( zmscr07(stats_zm%kk) ) + allocate( zmscr08(stats_zm%kk) ) + allocate( zmscr09(stats_zm%kk) ) + allocate( zmscr10(stats_zm%kk) ) + allocate( zmscr11(stats_zm%kk) ) + allocate( zmscr12(stats_zm%kk) ) + allocate( zmscr13(stats_zm%kk) ) + allocate( zmscr14(stats_zm%kk) ) + allocate( zmscr15(stats_zm%kk) ) + allocate( zmscr16(stats_zm%kk) ) + allocate( zmscr17(stats_zm%kk) ) + + zmscr01 = 0.0_r8 + zmscr02 = 0.0_r8 + zmscr03 = 0.0_r8 + zmscr04 = 0.0_r8 + zmscr05 = 0.0_r8 + zmscr06 = 0.0_r8 + zmscr07 = 0.0_r8 + zmscr08 = 0.0_r8 + zmscr09 = 0.0_r8 + zmscr10 = 0.0_r8 + zmscr11 = 0.0_r8 + zmscr12 = 0.0_r8 + zmscr13 = 0.0_r8 + zmscr14 = 0.0_r8 + zmscr15 = 0.0_r8 + zmscr16 = 0.0_r8 + zmscr17 = 0.0_r8 + + call stats_init_zm_api( clubb_vars_zm, l_error ) + + ! Initialize rad_zt (radiation points) + + if (l_output_rad_files) then + + i = 1 + do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & + i <= nvarmax_rad_zt ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_rad_zt ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." + write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & + "in the stats namelist, or change nvarmax_rad_zt." + write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt + call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") + endif + + stats_rad_zt%num_output_fields = ntot + stats_rad_zt%kk = nnrad_zt + + allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) + + allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) + + call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) + + allocate( stats_rad_zt%file%var( stats_rad_zt%num_output_fields ) ) + allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) + + call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error ) + + ! Initialize rad_zm (radiation points) + + i = 1 + do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & + i <= nvarmax_rad_zm ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_rad_zm ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." + write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & + "in the stats namelist, or change nvarmax_rad_zm." + write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm + call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") + endif + + stats_rad_zm%num_output_fields = ntot + stats_rad_zm%kk = nnrad_zm + + allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) + + allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) + + call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) + + allocate( stats_rad_zm%file%var( stats_rad_zm%num_output_fields ) ) + allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) + + call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error ) + end if ! l_output_rad_files + + + ! Initialize sfc (surface point) + + i = 1 + do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & + len_trim(clubb_vars_sfc(i)) /= 0 .and. & + i <= nvarmax_sfc ) + i = i + 1 + end do + ntot = i - 1 + if ( ntot == nvarmax_sfc ) then + write(fstderr,*) "There are more statistical variables listed in ", & + "clubb_vars_sfc than allowed for by nvarmax_sfc." + write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & + "in the stats namelist, or change nvarmax_sfc." + write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc + call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") + endif + + stats_sfc%num_output_fields = ntot + stats_sfc%kk = 1 + + allocate( stats_sfc%z( stats_sfc%kk ) ) + + allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) + + call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & + stats_sfc%accum_num_samples, stats_sfc%l_in_update ) + + allocate( stats_sfc%file%var( stats_sfc%num_output_fields ) ) + allocate( stats_sfc%file%z( stats_sfc%kk ) ) + + call stats_init_sfc_api( clubb_vars_sfc, l_error ) + + ! Check for errors + + if ( l_error ) then + call endrun ('stats_init: errors found') + endif + +! Now call add fields + do i = 1, stats_zt%num_output_fields + + temp1 = trim(stats_zt%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + call addfld(trim(sub),(/ 'ilev' /),& + 'A',trim(stats_zt%file%var(i)%units),trim(stats_zt%file%var(i)%description)) + enddo + + do i = 1, stats_zm%num_output_fields + + temp1 = trim(stats_zm%file%var(i)%name) + sub = temp1 + if (len(temp1) > 16) sub = temp1(1:16) + +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + call addfld(trim(sub),(/ 'ilev' /),& + 'A',trim(stats_zm%file%var(i)%units),trim(stats_zm%file%var(i)%description)) + enddo + + if (l_output_rad_files) then +!!XXgoldyXX: Probably need a hist coord for nnzp for the vertical + do i = 1, stats_rad_zt%num_output_fields + call addfld(trim(stats_rad_zt%file%var(i)%name),(/ 'ilev' /),& + 'A',trim(stats_rad_zt%file%var(i)%units),trim(stats_rad_zt%file%var(i)%description)) + enddo + + do i = 1, stats_rad_zm%num_output_fields + call addfld(trim(stats_rad_zm%file%var(i)%name),(/ 'ilev' /),& + 'A',trim(stats_rad_zm%file%var(i)%units),trim(stats_rad_zm%file%var(i)%description)) + enddo + endif + + do i = 1, stats_sfc%num_output_fields + call addfld(trim(stats_sfc%file%var(i)%name),horiz_only,& + 'A',trim(stats_sfc%file%var(i)%units),trim(stats_sfc%file%var(i)%description)) + enddo + + return + + end subroutine stats_init_clubb + +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + + !----------------------------------------------------------------------- + subroutine stats_end_timestep_clubb(thecol,out_zt,out_zm,out_radzt,out_radzm,out_sfc) + + ! Description: Called when the stats timestep has ended. This subroutine + ! is responsible for calling statistics to be written to the output + ! format. + !----------------------------------------------------------------------- + +#ifdef CLUBB_SGS + + use shr_infnan_mod, only: is_nan => shr_infnan_isnan + + use clubb_api_module, only: & + fstderr, & ! Constant(s) + stats_zt, & ! Variable(s) + stats_zm, & + stats_rad_zt, & + stats_rad_zm, & + stats_sfc, & + l_stats_last, & + stats_tsamp, & + stats_tout, & + l_output_rad_files, & + clubb_at_least_debug_level_api ! Procedure(s) + + use cam_abortutils, only: endrun + + implicit none + + +#endif + + integer :: thecol + + real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) + real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) + real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) + real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) + real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) + +#ifdef CLUBB_SGS + ! Local Variables + + integer :: i, k + logical :: l_error + + ! Check if it is time to write to file + + if ( .not. l_stats_last ) return + + ! Initialize + l_error = .false. + + ! Compute averages + call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) + call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) + if (l_output_rad_files) then + call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples ) + call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples ) + end if + call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) + + ! Here we are not outputting the data, rather reading the stats into + ! arrays which are conformable to CAM output. Also, the data is "flipped" + ! in the vertical level to be the same as CAM output. + do i = 1, stats_zt%num_output_fields + do k = 1, stats_zt%kk + out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) + if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 + enddo + enddo + + do i = 1, stats_zm%num_output_fields + do k = 1, stats_zt%kk + out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) + if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 + enddo + enddo + + if (l_output_rad_files) then + do i = 1, stats_rad_zt%num_output_fields + do k = 1, stats_rad_zt%kk + out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) + if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 + enddo + enddo + + do i = 1, stats_rad_zm%num_output_fields + do k = 1, stats_rad_zm%kk + out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) + if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 + enddo + enddo + + ! Fill in values above the CLUBB top. + out_zt(thecol,:top_lev-1,:) = 0.0_r8 + out_zm(thecol,:top_lev-1,:) = 0.0_r8 + out_radzt(thecol,:top_lev-1,:) = 0.0_r8 + out_radzm(thecol,:top_lev-1,:) = 0.0_r8 + + endif ! l_output_rad_files + + do i = 1, stats_sfc%num_output_fields + out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) + if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 + enddo + + ! Reset sample fields + call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & + stats_zt%accum_num_samples, stats_zt%l_in_update ) + call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & + stats_zm%accum_num_samples, stats_zm%l_in_update ) + if (l_output_rad_files) then + call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & + stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) + call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & + stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) + end if + call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & + stats_sfc%accum_num_samples, stats_sfc%l_in_update ) + + return + +#endif + + end subroutine stats_end_timestep_clubb + + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + +#ifdef CLUBB_SGS + + !----------------------------------------------------------------------- + subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) + + ! Description: + ! Initialize stats to zero + !----------------------------------------------------------------------- + + use clubb_api_module, only: & + stat_rknd, & ! Variable(s) + stat_nknd + + + implicit none + + ! Input + integer, intent(in) :: kk, num_output_fields + + ! Output + real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x + integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n + logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update + + ! Zero out arrays + + if ( num_output_fields > 0 ) then + x(:,:,:,:) = 0.0_r8 + n(:,:,:,:) = 0 + l_in_update(:,:,:,:) = .false. + end if + + return + + end subroutine stats_zero + +#endif + + ! =============================================================================== ! + ! ! + ! =============================================================================== ! + + +#ifdef CLUBB_SGS + !----------------------------------------------------------------------- + subroutine stats_avg( kk, num_output_fields, x, n ) + + ! Description: + ! Compute the average of stats fields + !----------------------------------------------------------------------- + use clubb_api_module, only: & + stat_rknd, & ! Variable(s) + stat_nknd + + implicit none + + ! Input + integer, intent(in) :: num_output_fields, kk + integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n + + ! Output + real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x + + ! Internal + + integer k,m + + ! Compute averages + + do m=1,num_output_fields + do k=1,kk + + if ( n(1,1,k,m) > 0 ) then + x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) + end if + + end do + end do + + return + + end subroutine stats_avg + + subroutine grid_size(state, grid_dx, grid_dy) + ! Determine the size of the grid for each of the columns in state + + use phys_grid, only: get_area_p + use shr_const_mod, only: shr_const_pi + use physics_types, only: physics_state + + + type(physics_state), intent(in) :: state + real(r8), intent(out) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] + + real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator + real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid + real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid + + real(r8) :: mpdeglat, column_area, degree + integer :: i + + ! determine the column area in radians + do i=1,state%ncol + column_area = get_area_p(state%lchnk,i) + degree = sqrt(column_area)*(180._r8/shr_const_pi) + + ! Now find meters per degree latitude + ! Below equation finds distance between two points on an ellipsoid, derived from expansion + ! taking into account ellipsoid using World Geodetic System (WGS84) reference + mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) + grid_dx(i) = mpdeglat * degree + grid_dy(i) = grid_dx(i) ! Assume these are the same + enddo + + end subroutine grid_size + +#endif + +#ifdef CLUBB_SGS + subroutine init_clubb_config_flags( clubb_config_flags_in ) +!------------------------------------------------------------------------------- +! Description: +! Initializes the public module variable 'clubb_config_flags' of type +! 'clubb_config_flags_type' on first call and only on first call. +! References: +! None +!------------------------------------------------------------------------------- + use clubb_api_module, only: & + clubb_config_flags_type, & ! Type + set_default_clubb_config_flags_api, & ! Procedure(s) + initialize_clubb_config_flags_type_api + + implicit none + + ! Input/Output Variables + type(clubb_config_flags_type), intent(inout) :: clubb_config_flags_in + + ! Local Variables + logical :: & + l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The + ! precipitation fraction is automatically set to 1 when this + ! flag is turned off. + l_predict_upwp_vpwp, & ! Flag to predict and along with and + ! alongside the advancement of , , , + ! , , and in subroutine + ! advance_xm_wpxp. Otherwise, and are still + ! approximated by eddy diffusivity when and are + ! advanced in subroutine advance_windm_edsclrm. + l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping + ! the overall correlation of w and x (w and rt, as well as w + ! and theta-l) within the limits of -max_mag_correlation_flux + ! to max_mag_correlation_flux. + l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and + ! thlp2) on keeping the overall correlation of w and x within + ! the limits of -max_mag_correlation_flux to + ! max_mag_correlation_flux. + l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the + ! turbulent dissipation coefficient, C2. + l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm + l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor + l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 + l_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects wprtp, wpthlp, & wpsclrp. + l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & + ! sclrpthlp. + l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind + ! differencing approximation rather than a centered + ! differencing for turbulent or mean advection terms. It + ! affects rtm, thlm, sclrm, um and vm. + l_uv_nudge, & ! For wind speed nudging. + l_rtm_nudge, & ! For rtm nudging + l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. + ! TKE = 1/2 (u'^2 + v'^2 + w'^2) + l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to + ! compute the varibles that are output from high order + ! closure + l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the + ! thermodynamic-level variables output from pdf_closure. + l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three + ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - + ! output from pdf_closure. + l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call + ! subroutine pdf_closure twice. If true, pdf_closure is + ! called first on thermodynamic levels and then on momentum + ! levels so that each variable is computed on its native + ! level. If false, pdf_closure is only called on + ! thermodynamic levels, and variables which belong on + ! momentum levels are interpolated. + l_standard_term_ta, & ! Use the standard discretization for the turbulent advection + ! terms. Setting to .false. means that a_1 and a_3 are + ! pulled outside of the derivative in + ! advance_wp2_wp3_module.F90 and in + ! advance_xp2_xpyp_module.F90. + l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac + ! and rcm to help increase cloudiness at coarser grid + ! resolutions. + l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones + l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors + l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) + l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) + l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability + ! correction + l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of + ! -(2/3)*em/tau_zm, as in Bougeault (1981) + l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly + l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values + l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the + ! mixing length scale as Lscale = tau * tke + l_use_ice_latent, & ! Includes the effects of ice latent heating in turbulence + ! terms + l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number + l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number + l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in + ! saturated atmospheres (from Durran and Klemp, 1982) + l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency + l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water + l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and + ! rtpthlp + l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 + l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz + l_update_pressure ! Flag for having CLUBB update pressure and exner + + logical, save :: first_call = .true. + + if (first_call) then + + call set_default_clubb_config_flags_api( l_use_precip_frac, & ! Out + l_predict_upwp_vpwp, & ! Out + l_min_wp2_from_corr_wx, & ! Out + l_min_xp2_from_corr_wx, & ! Out + l_C2_cloud_frac, & ! Out + l_diffuse_rtm_and_thlm, & ! Out + l_stability_correct_Kh_N2_zm, & ! Out + l_calc_thlp2_rad, & ! Out + l_upwind_wpxp_ta, & ! Out + l_upwind_xpyp_ta, & ! Out + l_upwind_xm_ma, & ! Out + l_uv_nudge, & ! Out + l_rtm_nudge, & ! Out + l_tke_aniso, & ! Out + l_vert_avg_closure, & ! Out + l_trapezoidal_rule_zt, & ! Out + l_trapezoidal_rule_zm, & ! Out + l_call_pdf_closure_twice, & ! Out + l_standard_term_ta, & ! Out + l_use_cloud_cover, & ! Out + l_diagnose_correlations, & ! Out + l_calc_w_corr, & ! Out + l_const_Nc_in_cloud, & ! Out + l_fix_w_chi_eta_correlations, & ! Out + l_stability_correct_tau_zm, & ! Out + l_damp_wp2_using_em, & ! Out + l_do_expldiff_rtm_thlm, & ! Out + l_Lscale_plume_centered, & ! Out + l_diag_Lscale_from_tau, & ! Out + l_use_ice_latent, & ! Out + l_use_C7_Richardson, & ! Out + l_use_C11_Richardson, & ! Out + l_brunt_vaisala_freq_moist, & ! Out + l_use_thvm_in_bv_freq, & ! Out + l_rcm_supersat_adj, & ! Out + l_single_C2_Skw, & ! Out + l_damp_wp3_Skw_squared, & ! Out + l_prescribed_avg_deltaz, & ! Out + l_update_pressure ) ! Out + + call initialize_clubb_config_flags_type_api( l_use_precip_frac, & ! In + l_predict_upwp_vpwp, & ! In + l_min_wp2_from_corr_wx, & ! In + l_min_xp2_from_corr_wx, & ! In + l_C2_cloud_frac, & ! In + l_diffuse_rtm_and_thlm, & ! In + l_stability_correct_Kh_N2_zm, & ! In + l_calc_thlp2_rad, & ! In + l_upwind_wpxp_ta, & ! In + l_upwind_xpyp_ta, & ! In + l_upwind_xm_ma, & ! In + l_uv_nudge, & ! In + l_rtm_nudge, & ! In + l_tke_aniso, & ! In + l_vert_avg_closure, & ! In + l_trapezoidal_rule_zt, & ! In + l_trapezoidal_rule_zm, & ! In + l_call_pdf_closure_twice, & ! In + l_standard_term_ta, & ! In + l_use_cloud_cover, & ! In + l_diagnose_correlations, & ! In + l_calc_w_corr, & ! In + l_const_Nc_in_cloud, & ! In + l_fix_w_chi_eta_correlations, & ! In + l_stability_correct_tau_zm, & ! In + l_damp_wp2_using_em, & ! In + l_do_expldiff_rtm_thlm, & ! In + l_Lscale_plume_centered, & ! In + l_diag_Lscale_from_tau, & ! In + l_use_ice_latent, & ! In + l_use_C7_Richardson, & ! In + l_use_C11_Richardson, & ! In + l_brunt_vaisala_freq_moist, & ! In + l_use_thvm_in_bv_freq, & ! In + l_rcm_supersat_adj, & ! In + l_single_C2_Skw, & ! In + l_damp_wp3_Skw_squared, & ! In + l_prescribed_avg_deltaz, & ! In + l_update_pressure, & ! In + clubb_config_flags_in ) ! Out + + first_call = .false. + + end if + + return + + end subroutine init_clubb_config_flags +#endif + +end module clubb_intr From a246cb9b4623f12f5d9b0839c9d0d3eadf3e7706 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 16:03:48 -0700 Subject: [PATCH 070/466] merge up config_compsets --- cime_config/config_compsets.xml | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index a626745e3c..69f1e4315e 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -267,34 +267,7 @@ FHIST_BDRD -<<<<<<< HEAD - HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV_BGC%BDRD - - - - F2000dev - 2000_CAM%DEV_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - FADIAB - 2000_CAM%ADIAB_SLND_SICE_SOCN_SROF_SGLC_SWAV - - - - - FHIST_DARTC6 - HIST_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_SROF_SGLC_SWAV - - - - FTJ16 - 2000_CAM%TJ16_SLND_SICE_SOCN_SROF_SGLC_SWAV -======= HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV_BGC%BDRD ->>>>>>> upstream/cam_development From af65e298262f41adbc04af289bd25cc13bdf2698 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 16:04:58 -0700 Subject: [PATCH 071/466] merge up config_component --- cime_config/config_component.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 51554c4a35..5cf95a6e4a 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -12,11 +12,7 @@ CAM cam5 physics: CAM cam4 physics: CAM cam3 physics: -<<<<<<< HEAD - CAM simplified and non-versioned physics : -======= CAM simplified and non-versioned physics : ->>>>>>> upstream/cam_development -<<<<<<< HEAD - -phys cam64 -======= -phys cam_dev ->>>>>>> upstream/cam_development -chem trop_strat_mam4_vbs -chem trop_mam7 From e894557d3cedf9c9174736a42773a4bfd0745861 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 16:14:58 -0700 Subject: [PATCH 072/466] merge configure and namelist_defaults to head --- bld/configure | 15 --------------- bld/namelist_files/namelist_defaults_cam.xml | 9 +++------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/bld/configure b/bld/configure index c02e3dfffb..8f9ed59785 100755 --- a/bld/configure +++ b/bld/configure @@ -96,11 +96,7 @@ OPTIONS -pbl Specify the PBL option [uw | hb | hbr]. -pcols Set maximum number of columns in a chunk to . -pergro Switch enables building CAM for perturbation growth tests. -<<<<<<< HEAD - -phys Physics option [cam3 | cam4 | cam5 | cam6 | cam64 | -======= -phys Physics option [cam3 | cam4 | cam5 | cam6 | cam_dev | ->>>>>>> upstream/cam_development held_suarez | adiabatic | kessler | tj2016 | spcam_sam1mom | spcam_m2005]. Default: cam6 -prog_species Comma-separate list of prognostic mozart species packages. @@ -569,13 +565,6 @@ if ($phys_pkg =~ m/^adiabatic$|^held_suarez$|^kessler$|^tj2016$/) { $simple_phys = 1; } -# Set flag to indicate a camdev physics option -my $camdev_phys = 0; -if ($phys_pkg eq 'cam64') { - $camdev_phys = 1; - $phys_pkg = 'cam6'; - } - #----------------------------------------------------------------------------------------------- # Chemistry package @@ -2114,11 +2103,7 @@ sub write_filepath print $fh "$camsrcdir/src/unit_drivers\n"; print $fh "$camsrcdir/src/unit_drivers/${offline_drv}\n"; -<<<<<<< HEAD - if ($camdev_phys) { -======= if ($phys_pkg eq 'cam_dev') { ->>>>>>> upstream/cam_development print $fh "$camsrcdir/src/physics/cam_dev\n"; } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index e0457de30b..9672cac5f2 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2045,17 +2045,14 @@ 1 1 3 -<<<<<<< HEAD - - 6 - 6 -======= 2 1 2 1 ->>>>>>> upstream/cam_development + + 6 + 6 1.0D0 From 42f55f9edf68317ad950aa2b1e7b4636a369f8ab Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 16:16:58 -0700 Subject: [PATCH 073/466] merge config_files/defintion up to head --- bld/config_files/definition.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bld/config_files/definition.xml b/bld/config_files/definition.xml index 47ce2ca894..4322d22985 100644 --- a/bld/config_files/definition.xml +++ b/bld/config_files/definition.xml @@ -52,13 +52,8 @@ Option to turn on waccmx thermosphere/ionosphere extension: 0 => no, 1 => yes Ionosphere model used in WACCMX. -<<<<<<< HEAD - -Physics package: cam3, cam4, cam5, cam6, cam64, held_suarez, adiabatic, kessler, tj2016, spcam_sam1mom, spcam_m2005. -======= Physics package: cam3, cam4, cam5, cam6, cam_dev, held_suarez, adiabatic, kessler, tj2016, spcam_sam1mom, spcam_m2005. ->>>>>>> upstream/cam_development Microphysics package: rk (Rasch and Kristjansson), mg1 (Morrison and From 50b019404aa8c9251d840942d24d4bfd5494d2e4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 16:17:42 -0700 Subject: [PATCH 074/466] merge external up to head --- Externals.cfg | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 1ab5e8eb31..a38d4918cf 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -57,11 +57,7 @@ local_path = libraries/parallelio required = True [cime] -<<<<<<< HEAD -tag = cime5.8.34.clubbmf -======= tag = cime6.0.12 ->>>>>>> upstream/cam_development protocol = git repo_url = https://github.com/adamrher/cime local_path = cime From bae3cc1dfbbbaacd6b711a13fe688f4051cf2dfe Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 4 Jan 2022 19:03:47 -0700 Subject: [PATCH 075/466] fixes for merging up to the head --- Externals.cfg | 2 +- src/physics/cam/clubb_intr.F90 | 4 +++- src/physics/cam/clubb_mf.F90 | 2 +- src/physics/cam_dev/convect_diagnostics.F90 | 2 ++ src/physics/cam_dev/physpkg.F90 | 25 ++++++++++++++++++++- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index a38d4918cf..11dbbda0d3 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -59,7 +59,7 @@ required = True [cime] tag = cime6.0.12 protocol = git -repo_url = https://github.com/adamrher/cime +repo_url = https://github.com/ESMCI/cime local_path = cime required = True diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 17c2135b08..cc80921d80 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -226,6 +226,7 @@ module clubb_intr kvh_idx, & ! CLUBB eddy diffusivity on thermo levels pblh_idx, & ! PBL pbuf icwmrdp_idx, & ! In cloud mixing ratio for deep convection + icwmrsh_idx, & ! In cloud mixing ratio for shallow convection (MF) tke_idx, & ! turbulent kinetic energy tpert_idx, & ! temperature perturbation from PBL fice_idx, & ! fice_idx index in physics buffer @@ -1687,6 +1688,7 @@ subroutine clubb_tend_cam( & real(r8) :: dtime ! CLUBB time step [s] real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] + real(r8) :: tke_in(pverp+1-top_lev) ! TKE real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] @@ -3282,7 +3284,7 @@ subroutine clubb_tend_cam( & ! variable. if (clubb_do_energyfix) then do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis*gravit + clubb_s(k) = clubb_s(k) - se_dis(k)*gravit enddo endif ! convert to units of +ve [K] diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index c40910392e..e290246ca8 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -2085,7 +2085,7 @@ end SUBROUTINE ientropy ! Wrapper for qsat_water that does translation between Pa and hPa ! qsat_water uses Pa internally, so get it right, need to pass in Pa. ! Afterward, set es back to hPa. -elemental subroutine qsat_hPa(t, p, es, qm) +subroutine qsat_hPa(t, p, es, qm) use wv_saturation, only: qsat_water ! Inputs diff --git a/src/physics/cam_dev/convect_diagnostics.F90 b/src/physics/cam_dev/convect_diagnostics.F90 index dff2141567..0b580e5cf3 100644 --- a/src/physics/cam_dev/convect_diagnostics.F90 +++ b/src/physics/cam_dev/convect_diagnostics.F90 @@ -81,6 +81,8 @@ subroutine convect_diagnostics_init use physics_buffer, only: pbuf_get_index call addfld( 'CMFMC', (/ 'ilev' /), 'A', 'kg/m2/s', 'Moist convection (deep+shallow) mass flux' ) + call addfld ('ICWMRSH', (/ 'lev' /), 'A', 'kg/kg', 'Shallow Convection in-cloud water mixing ratio ' ) + call addfld( 'PRECSH', horiz_only, 'A', 'm/s', 'Shallow Convection precipitation rate' ) call addfld( 'CLDTOP', horiz_only, 'I', '1', 'Vertical index of cloud top' ) call addfld( 'CLDBOT', horiz_only, 'I', '1', 'Vertical index of cloud base' ) call addfld( 'PCLDTOP', horiz_only, 'A', 'Pa', 'Pressure of cloud top' ) diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index 8802b4dd68..6afc0a00e6 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -1407,6 +1407,10 @@ subroutine tphysac (ztodt, cam_in, & real(r8),pointer :: prec_sed(:) ! total precip from cloud sedimentation real(r8),pointer :: snow_sed(:) ! snow from cloud ice sedimentation + ! CLUBB+MF + real(r8),pointer :: prec_sh(:) ! total precipitation from Hack convection + real(r8),pointer :: snow_sh(:) ! snow from Hack convection + ! Local copies for substepping real(r8) :: prec_pcw_macmic(pcols) real(r8) :: snow_pcw_macmic(pcols) @@ -1417,6 +1421,10 @@ subroutine tphysac (ztodt, cam_in, & real(r8) :: prec_sed_carma(pcols) ! total precip from cloud sedimentation (CARMA) real(r8) :: snow_sed_carma(pcols) ! snow from cloud ice sedimentation (CARMA) + ! CLUBB+MF + real(r8) :: prec_sh_macmic(pcols) + real(r8) :: snow_sh_macmic(pcols) + logical :: labort ! abort flag real(r8) tvm(pcols,pver) ! virtual temperature @@ -1468,6 +1476,9 @@ subroutine tphysac (ztodt, cam_in, & call pbuf_get_field(pbuf, snow_str_idx, snow_str_sc, col_type=col_type_subcol) end if + call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) + call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) + if (dlfzm_idx > 0) then call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) dlf(:ncol,:) = dlfzm(:ncol,:) @@ -1596,6 +1607,10 @@ subroutine tphysac (ztodt, cam_in, & prec_pcw_macmic = 0._r8 snow_pcw_macmic = 0._r8 + ! CLUBB+MF + prec_sh_macmic = 0._r8 + snow_sh_macmic = 0._r8 + ! contrail parameterization ! see Chen et al., 2012: Global contrail coverage simulated ! by CAM5 with the inventory of 2006 global aircraft emissions, JAMES @@ -1630,7 +1645,7 @@ subroutine tphysac (ztodt, cam_in, & ! Since we "added" the reserved liquid back in this routine, we need ! to account for it in the energy checker - flx_cnd(:ncol) = -1._r8*rliq(:ncol) + flx_cnd(:ncol) = -1._r8*rliq(:ncol) + prec_sh(:ncol) flx_heat(:ncol) = cam_in%shf(:ncol) + det_s(:ncol) ! Unfortunately, physics_update does not know what time period @@ -1663,6 +1678,10 @@ subroutine tphysac (ztodt, cam_in, & call t_stopf('macrop_tend') + ! CLUBB+MF + prec_sh_macmic(:ncol) = prec_sh_macmic(:ncol) + prec_sh(:ncol) + snow_sh_macmic(:ncol) = snow_sh_macmic(:ncol) + snow_sh(:ncol) + !=================================================== ! Calculate cloud microphysics !=================================================== @@ -1805,6 +1824,10 @@ subroutine tphysac (ztodt, cam_in, & prec_str(:ncol) = prec_pcw(:ncol) + prec_sed(:ncol) snow_str(:ncol) = snow_pcw(:ncol) + snow_sed(:ncol) + ! CLUBB+MF + prec_sh(:ncol) = prec_sh_macmic(:ncol)/cld_macmic_num_steps + snow_sh(:ncol) = snow_sh_macmic(:ncol)/cld_macmic_num_steps + endif ! Add the precipitation from CARMA to the precipitation from stratiform. From 602d3cd7275f5da5dc4fe5ac165adc2bb0413ccf Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 4 Jan 2022 19:53:19 -0700 Subject: [PATCH 076/466] out of the box settings for izumi fscam forcing --- .../scam_STUB/scripts/make_basecase.auto.csh | 6 +- .../scam_STUB/scripts/run_cases.csh | 88 +++++++++---------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index b486101c30..58707307c9 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -20,7 +20,7 @@ set case_lon = "$argv[$n]" set n = 3 set loc_string = "$argv[$n]" -set src=cam6_3_006.dev +set src=cam.clubbmf set srcpath=/home/$USER/src set scratchdir=/scratch/cluster/$USER set COMPSET=FSCAM @@ -41,7 +41,7 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_cam64_3Lopt_3alph_aspd" +set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_test0" # create new basecase ${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported @@ -56,7 +56,7 @@ sed -i 's/intel\/mvapich2-2.3rc2-intel-18.0.3/intel\/mvapich2-2.1-qlc/' ./env_ma ./xmlchange DOUT_S=FALSE ### Append to CAM configure options -./xmlchange --append CAM_CONFIG_OPTS='-phys cam64 -nlev 58' +./xmlchange --append CAM_CONFIG_OPTS='-phys cam_dev -nlev 58' # ATM_NCPL should be at least 192 to accomodate diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index 37b5a72471..d37799cb58 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -7,64 +7,64 @@ source make_basecase.auto.csh $lat $lon $casenam cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 24.03141361256544 -set lon = 207.5 -set casenam = st9 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 24.03141361256544 +#set lon = 207.5 +#set casenam = st9 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 24.9738219895288 -set lon = 210. -set casenam = st8 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 24.9738219895288 +#set lon = 210. +#set casenam = st8 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 25.91623036649214 -set lon = 212.5 -set casenam = st7 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 25.91623036649214 +#set lon = 212.5 +#set casenam = st7 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 27.80104712041884 -set lon = 217.5 -set casenam = st6 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 27.80104712041884 +#set lon = 217.5 +#set casenam = st6 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 29.68586387434554 -set lon = 222.5 -set casenam = st5 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 29.68586387434554 +#set lon = 222.5 +#set casenam = st5 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 31.57068062827226 -set lon = 228.75 -set casenam = st4 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 31.57068062827226 +#set lon = 228.75 +#set casenam = st4 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 32.5130890052356 -set lon = 231.25 -set casenam = st3 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 32.5130890052356 +#set lon = 231.25 +#set casenam = st3 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ -set lat = 33.45549738219896 -set lon = 233.75 -set casenam = st2 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 33.45549738219896 +#set lon = 233.75 +#set casenam = st2 +#source make_basecase.auto.csh $lat $lon $casenam -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts -set lat = 33.45549738219896 -set lon = 240. -set casenam = st1 -source make_basecase.auto.csh $lat $lon $casenam +#set lat = 33.45549738219896 +#set lon = 240. +#set casenam = st1 +#source make_basecase.auto.csh $lat $lon $casenam From 096d1d4295187a13466a6e0b620b2f3a6a9cdc8a Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 6 Jan 2022 16:32:24 -0700 Subject: [PATCH 077/466] bug in merging clubb energy fixer --- src/physics/cam/clubb_intr.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index cc80921d80..7a3f115909 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3284,7 +3284,7 @@ subroutine clubb_tend_cam( & ! variable. if (clubb_do_energyfix) then do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis(k)*gravit + clubb_s(k) = clubb_s(k) - se_dis(i)*gravit enddo endif ! convert to units of +ve [K] From dc70c997d09708e471aef77f4d004222f1a8c3fe Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 21 Jan 2022 19:32:36 -0700 Subject: [PATCH 078/466] fixed 2 bugs via intel compilers debug mode --- src/physics/cam/clubb_mf.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e290246ca8..64d69c1146 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -514,6 +514,9 @@ subroutine integrate_mf( nz, ! overide stochastic entrainment with fixent ent(:,:) = fixent else + ! "trigger" condition + if (dynamic_L0 <= 0.0_r8) return + ! get entrainment coefficient, dz/L0 do i=1,clubb_mf_nup do k=1,nz @@ -1193,6 +1196,8 @@ subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & ! use tke enhanced entrainment logical :: do_tptke = .false. + zcb = zcb_unset + upw(1) = 0.5_r8 * wmax upa(1) = 0.5_r8 * erf( wmax/(sqrt(2._r8)*sigmaw) ) From e1b625eadb2bc3cdf74f506b276b09660e95c627 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 22 Jan 2022 11:52:23 -0700 Subject: [PATCH 079/466] limiter on L0 to avoid division by zero --- src/physics/cam/clubb_mf.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 64d69c1146..afa693695f 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -321,6 +321,9 @@ subroutine integrate_mf( nz, ! Arakawa and Schubert detrainment limiter logical :: do_aspd = .false. ! + ! Lower limit on entrainment length scale + real(r8),parameter :: min_L0 = 10._r8 + ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) real(r8),parameter :: max_eturb = 10._r8 @@ -510,13 +513,14 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if + ! limiter to avoid division by zero + if (dynamic_L0 <= 0.0_r8) dynamic_L0 = min_L0 + if (debug) then ! overide stochastic entrainment with fixent ent(:,:) = fixent else - ! "trigger" condition - if (dynamic_L0 <= 0.0_r8) return - + ! get entrainment coefficient, dz/L0 do i=1,clubb_mf_nup do k=1,nz From 0984ef55af6d9ba747f1231f3bc29f33958b4cbc Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Sun, 23 Jan 2022 10:58:38 -0700 Subject: [PATCH 080/466] shook some bugs loose w/ nag --- src/physics/cam/clubb_intr.F90 | 59 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7a3f115909..e4388a5ce8 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -415,8 +415,8 @@ subroutine clubb_register_cam( ) call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - call add_hist_coord('macmic_num_steps', cld_macmic_num_steps, 'macro/micro cycle index') - call add_hist_coord('clubb_mf_nup', clubb_mf_nup, 'plume ensemble size') + call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') + call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') call pbuf_add_field('QT_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) call pbuf_add_field('THETAL_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) @@ -1315,28 +1315,28 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) - call addfld ( 'edmf_upa' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) - call addfld ( 'edmf_upw' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_upqt' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_upthl' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) - call addfld ( 'edmf_upthv' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) - call addfld ( 'edmf_upth' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) - call addfld ( 'edmf_upqc' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_upent' , (/ 'ilev', 'clubb_mf_nup' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) - call addfld ( 'edmf_upbuoy' , (/ 'lev', 'clubb_mf_nup' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) + call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) + call addfld ( 'edmf_upw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_upqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) + call addfld ( 'edmf_upthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) + call addfld ( 'edmf_upthv' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) + call addfld ( 'edmf_upth' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) + call addfld ( 'edmf_upqc' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) + call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if - call addfld ('QT_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('THETAL_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'K' , 'THETAL at macro/micro substep') - call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') - call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') - call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') - call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') - call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') + call addfld ('QT_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('THETAL_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') + call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') + call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'ncyc' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') + call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') + call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') + call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') if (do_clubb_mf) then - call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'macmic_num_steps' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'thl flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'thv flux (EDMF) at macro/micro substep' ) + call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'qt flux (EDMF) at macro/micro substep' ) end if ! Initialize statistics, below are dummy variables @@ -1797,6 +1797,7 @@ subroutine clubb_tend_cam( & real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) + real(r8) :: eleak(pcols) real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] @@ -1997,10 +1998,8 @@ subroutine clubb_tend_cam( & mf_upthv_output, & mf_upth_output, & mf_upqc_output, & - mf_upent_output - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pver*clubb_mf_nup) :: mf_upbuoy_output - + mf_upent_output, & + mf_upbuoy_output ! MF Plume real(r8), pointer :: tpert(:) real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & @@ -3104,7 +3103,6 @@ subroutine clubb_tend_cam( & mf_thforc_output(i,pverp-k+1) = mf_thforc(k) mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) end if @@ -3117,7 +3115,7 @@ subroutine clubb_tend_cam( & mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) end if enddo @@ -3132,7 +3130,7 @@ subroutine clubb_tend_cam( & mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_upbuoy_output(i,pver*(k-1)+1:pver*k) = mf_upbuoy_flip(i,:pver,k) + mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k) = mf_upbuoy_flip(i,:pverp,k) end do end if @@ -3269,6 +3267,7 @@ subroutine clubb_tend_cam( & ! Take into account the surface fluxes of heat and moisture ! Use correct qflux from cam_in, not lhf/latvap as was done previously te_b(i) = te_b(i)+(cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice))*hdtime + ! subtract enthalpy of falling precip from tb te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime @@ -3363,7 +3362,9 @@ subroutine clubb_tend_cam( & enddo ! end column loop ! dte / hdtime = [kg/s2]/[s] = W/m2 - call outfld('ELEAK_CLUBB', (te_a - te_b)/hdtime, pcols, lchnk) + eleak(:ncol) = (te_a(:ncol) - te_b(:ncol))/hdtime + call outfld('ELEAK_CLUBB', eleak, pcols, lchnk) + call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) call outfld('KVH_CLUBB', khzm, pcols, lchnk) From 92373433bd31849ec2ddd32f11e69bf533b2e900 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 23 Jan 2022 11:43:09 -0700 Subject: [PATCH 081/466] added missing nls to build-namelist --- bld/build-namelist | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bld/build-namelist b/bld/build-namelist index c93495909b..e1ffe1d7b2 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3140,8 +3140,11 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_l_damp_wp2_using_em'); add_default($nl, 'do_clubb_mf'); add_default($nl, 'do_clubb_mf_diag'); + add_default($nl, 'do_clubb_mf_rad'); + add_default($nl, 'do_clubb_mf_precip'); add_default($nl, 'clubb_mf_L0'); add_default($nl, 'clubb_mf_ent0'); + add_default($nl, 'clubb_mf_alphturb'); add_default($nl, 'clubb_mf_Lopt'); add_default($nl, 'clubb_mf_a0'); add_default($nl, 'clubb_mf_b0'); From 3165f96f9440a2fdcec172392b0e0ee4c610976d Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 23 Jan 2022 16:14:08 -0700 Subject: [PATCH 082/466] fixed bfb restarts --- .../testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam | 2 ++ src/physics/cam/clubb_mf.F90 | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index 9b1e051a77..ce0fa03df7 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -4,4 +4,6 @@ nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' do_clubb_mf=.true. do_clubb_mf_diag=.true. +do_clubb_mf_rad=.true. +do_clubb_mf_precip=.true. deep_scheme='off' diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index afa693695f..e03719198d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -380,7 +380,9 @@ subroutine integrate_mf( nz, qtflx = 0._r8 thflx = 0._r8 qvflx = 0._r8 - +!+++ARH + qcflx = 0._r8 + ent = 0._r8 entf = 0._r8 enti = 0 From e40ac98319931dd28044425a3680ec9c3dd4f153 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 23 Jan 2022 16:19:41 -0700 Subject: [PATCH 083/466] remove comment --- src/physics/cam/clubb_mf.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e03719198d..e8d1f652e6 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -380,7 +380,6 @@ subroutine integrate_mf( nz, qtflx = 0._r8 thflx = 0._r8 qvflx = 0._r8 -!+++ARH qcflx = 0._r8 ent = 0._r8 From 778e1d40467ff23be5cf933c10c090864d50eeb3 Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 24 Jan 2022 09:31:31 -0700 Subject: [PATCH 084/466] added exit condition if convection terminates at first level --- .../testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam | 1 + src/physics/cam/clubb_mf.F90 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index ce0fa03df7..660c8aa3e7 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -6,4 +6,5 @@ do_clubb_mf=.true. do_clubb_mf_diag=.true. do_clubb_mf_rad=.true. do_clubb_mf_precip=.true. +clubb_mf_Lopt=3 deep_scheme='off' diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e8d1f652e6..7d3379252b 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -820,6 +820,12 @@ subroutine integrate_mf( nz, sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) end if enddo + ! no convection if convection terminates at first level + if (k == 2 .and. ae(k) == 1._r8) then + sqt(k) = 0_r8 + sthl(k) = 0._r8 + return + end if enddo ! downward sweep to get ensemble mean precip From 3327da40b2cf2ffc77c403f1eff26f54495e2c9e Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 24 Jan 2022 09:36:50 -0700 Subject: [PATCH 085/466] big bug fix for multiple clubb subcycles --- src/physics/cam/clubb_intr.F90 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index e4388a5ce8..12ca60fe58 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2815,6 +2815,15 @@ subroutine clubb_tend_cam( & qv_zm = zt2zm_api( qv_zt ) qc_zm = zt2zm_api( qc_zt ) + if (t>1) then + ! update thv if clubb is subcycled + thv_ds_zt(:pverp) = thlm_in(:pverp) & + + latvap*rcm_inout(:pverp)*invrs_exner_zt(:pverp)/cpair + thv_ds_zt(:pverp) = thv_ds_zt(:pverp) & + * (1._r8+zvir*(rtm_in(:pverp)-rcm_inout(:pverp)) - rcm_inout(:pverp)) + thv_ds_zm = zt2zm_api( thv_ds_zt ) + end if + call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input From 2d926d0bf16f2609d0daed031eb2526a13c48c1e Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 24 Jan 2022 11:46:39 -0700 Subject: [PATCH 086/466] implemented ztopm1 option --- src/physics/cam/clubb_intr.F90 | 49 +++++++++++++++++++++++++++++++++- src/physics/cam/clubb_mf.F90 | 34 ++++++++++++++++++++--- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 12ca60fe58..a09e937815 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -23,6 +23,9 @@ module clubb_intr use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o use spmd_utils, only: masterproc +!+++ARH + use spmd_utils, only: iam +!---ARH use constituents, only: pcnst, cnst_add use pbl_utils, only: calc_ustar, calc_obklen use ref_pres, only: top_lev => trop_cloud_top_lev @@ -286,6 +289,10 @@ module clubb_intr prec_sh_idx, & snow_sh_idx +!+++ARH + integer :: ztopm1_idx +!---ARH + ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -429,6 +436,9 @@ subroutine clubb_register_cam( ) call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) +!+++ARH + call pbuf_add_field('ZTOPM1' ,'global' , dtype_r8, (/pcols/), ztopm1_idx) +!---ARH end if #endif @@ -1546,6 +1556,11 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) +!+++ARH + if (do_clubb_mf) then + call pbuf_set_field(pbuf2d, ztopm1_idx, 0.0_r8) + end if +!---ARH endif ! The following is physpkg, so it needs to be initialized every time @@ -1930,6 +1945,10 @@ subroutine clubb_tend_cam( & real(r8),pointer :: prec_sh(:) ! total precipitation from MF real(r8),pointer :: snow_sh(:) ! snow from MF +!+++ARH + real(r8), pointer :: ztopm1(:) +!---ARH + real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) real(r8), pointer :: rcm_macmic(:,:) @@ -2040,6 +2059,10 @@ subroutine clubb_tend_cam( & real(r8) :: cflval, cflfac logical :: cfllim +!+++ARH + real(r8) :: mf_ztopm1 +!---ARH + ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid @@ -2207,6 +2230,9 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) call pbuf_get_field(pbuf, tpert_idx, tpert) +!+++ARH + call pbuf_get_field(pbuf, ztopm1_idx, ztopm1) +!---ARH end if ! Initialize the apply_const variable (note special logic is due to eularian backstepping) @@ -2824,6 +2850,13 @@ subroutine clubb_tend_cam( & thv_ds_zm = zt2zm_api( thv_ds_zt ) end if +!+++ARH + !if (t==0) then + ! mf_ztopm1 = ztopm1(i) + !end if + ! fix ztop over clubb subcycles + mf_ztopm1 = ztopm1(i) +!---ARH call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input @@ -2832,7 +2865,10 @@ subroutine clubb_tend_cam( & thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - wpthlp_in, tke_in, tpert(i), & ! input +!+++ARH + !wpthlp_in, tke_in, tpert(i), & ! input + wpthlp_in, tke_in, tpert(i), mf_ztopm1, & ! input +!---ARH mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics mf_upw, & ! output - plume diagnostics @@ -2982,6 +3018,17 @@ subroutine clubb_tend_cam( & enddo ! end time loop +!+++ARH + if (do_clubb_mf) then + if (macmic_it == 1) then + ! update ztop after first mac/mic subcycle of a physics time-step + ztopm1(i) = mf_ztopm1 + !ztopm1(i) = 0.5_r8*ztopm1(i) + 0.5_r8*mf_ztopm1 + end if + write(100+iam,*) "i, ztopm1, ", i, ztopm1(i) + end if +!---ARH + if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then wp2_in=zm2zt_api(wp2_in) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7d3379252b..83eea3071e 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -9,6 +9,9 @@ module clubb_mf use spmd_utils, only: masterproc use cam_logfile, only: iulog use cam_abortutils,only: endrun +!+++ARH + use time_manager, only: is_first_step +!---ARH use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & cpwv, cpliq, rh2o, zvir, pi @@ -115,7 +118,10 @@ subroutine integrate_mf( nz, thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input - wpthlp_env, tke, tpert, & ! input +!+++ARH + !wpthlp_env, tke, tpert, & ! input + wpthlp_env, tke, tpert, ztopm1, & ! input +!---ARH mcape, & ! output upa, & ! output upw, & ! output @@ -189,7 +195,9 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert - +!+++ARH + real(r8), intent(inout) :: ztopm1 +!---ARH real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid upqt, & ! momentum grid @@ -342,7 +350,6 @@ subroutine integrate_mf( nz, ! ! to debug flag logical :: debug = .false. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -512,6 +519,19 @@ subroutine integrate_mf( nz, ztop = mcape end if dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) +!+++ARH + else if (clubb_mf_Lopt==6) then + ! grab ztop from max height of ensemble in prior time-step + if (is_first_step()) then + !Test plume + call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & + wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) + else + ztop = ztopm1 + end if + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) +!---ARH end if ! limiter to avoid division by zero @@ -828,6 +848,14 @@ subroutine integrate_mf( nz, end if enddo +!+++ARH + do k=1,nz + if (ae(k) < 1._r8) then + ztopm1 = zm(k) + end if + end do +!---ARH + ! downward sweep to get ensemble mean precip do k = nz,2,-1 precc(k-1) = precc(k) - rho_zt(k)*dzt(k)*sqt(k) From 6c9e8d686550b040e065d5691a06de7c5d7c10fd Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 28 Jan 2022 09:10:24 -0700 Subject: [PATCH 087/466] bugfix to L0 limiter --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7d3379252b..f963845a6e 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -515,7 +515,7 @@ subroutine integrate_mf( nz, end if ! limiter to avoid division by zero - if (dynamic_L0 <= 0.0_r8) dynamic_L0 = min_L0 + dynamic_L0 = max(min_L0,dynamic_L0) if (debug) then ! overide stochastic entrainment with fixent From afd120a3bbdb7e4a9094c91c27feedb1070ceaf3 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 29 Jan 2022 16:38:08 -0700 Subject: [PATCH 088/466] improved ztopm1 option, incl a ztopm2 option as well --- src/physics/cam/clubb_intr.F90 | 44 +++++++++++++++++++++++++--------- src/physics/cam/clubb_mf.F90 | 21 ++++++++-------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index a09e937815..42e1b0dcb1 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -25,6 +25,7 @@ module clubb_intr use spmd_utils, only: masterproc !+++ARH use spmd_utils, only: iam + use time_manager, only: get_nstep !---ARH use constituents, only: pcnst, cnst_add use pbl_utils, only: calc_ustar, calc_obklen @@ -291,6 +292,8 @@ module clubb_intr !+++ARH integer :: ztopm1_idx + integer :: ztopm2_idx + integer :: ztop_macmic_idx !---ARH ! Output arrays for CLUBB statistics @@ -438,6 +441,8 @@ subroutine clubb_register_cam( ) call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) !+++ARH call pbuf_add_field('ZTOPM1' ,'global' , dtype_r8, (/pcols/), ztopm1_idx) + call pbuf_add_field('ZTOPM2' ,'global' , dtype_r8, (/pcols/), ztopm2_idx) + call pbuf_add_field('ZTOP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ztop_macmic_idx) !---ARH end if @@ -1559,6 +1564,8 @@ subroutine clubb_ini_cam(pbuf2d) !+++ARH if (do_clubb_mf) then call pbuf_set_field(pbuf2d, ztopm1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztopm2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztop_macmic_idx, 0.0_r8) end if !---ARH endif @@ -1947,6 +1954,8 @@ subroutine clubb_tend_cam( & !+++ARH real(r8), pointer :: ztopm1(:) + real(r8), pointer :: ztopm2(:) + real(r8), pointer :: ztop_macmic(:) !---ARH real(r8), pointer :: qt_macmic(:,:) @@ -2060,7 +2069,7 @@ subroutine clubb_tend_cam( & logical :: cfllim !+++ARH - real(r8) :: mf_ztopm1 + real(r8) :: mf_ztopm1, mf_ztop_nadv !---ARH ! MF local vars @@ -2232,6 +2241,8 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, tpert_idx, tpert) !+++ARH call pbuf_get_field(pbuf, ztopm1_idx, ztopm1) + call pbuf_get_field(pbuf, ztopm2_idx, ztopm2) + call pbuf_get_field(pbuf, ztop_macmic_idx, ztop_macmic) !---ARH end if @@ -2815,6 +2826,14 @@ subroutine clubb_tend_cam( & stats_nsamp = nint(stats_tsamp/dtime) stats_nout = nint(stats_tout/dtime) +!+++ARH + if (do_clubb_mf) then + mf_ztopm1 = 0._r8 + mf_ztop_nadv = 0._r8 + if (macmic_it==1) ztop_macmic(i) = 0._r8 + end if +!---ARH + do t=1,nadv ! do needed number of "sub" timesteps for each CAM step ! Increment the statistics then being stats timestep @@ -2851,11 +2870,8 @@ subroutine clubb_tend_cam( & end if !+++ARH - !if (t==0) then - ! mf_ztopm1 = ztopm1(i) - !end if - ! fix ztop over clubb subcycles mf_ztopm1 = ztopm1(i) + !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) !---ARH call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input @@ -2943,7 +2959,9 @@ subroutine clubb_tend_cam( & ! [kg/m2/s]->[m/s] prec_sh(i) = mf_precc(1)/1000._r8 snow_sh(i) = 0._r8 - +!+++ARH + mf_ztop_nadv = mf_ztop_nadv + mf_ztopm1 +!---ARH end if ! Advance CLUBB CORE one timestep in the future @@ -3020,12 +3038,16 @@ subroutine clubb_tend_cam( & !+++ARH if (do_clubb_mf) then - if (macmic_it == 1) then - ! update ztop after first mac/mic subcycle of a physics time-step - ztopm1(i) = mf_ztopm1 - !ztopm1(i) = 0.5_r8*ztopm1(i) + 0.5_r8*mf_ztopm1 + mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) + ztop_macmic(i) = ztop_macmic(i) + mf_ztop_nadv + !if (masterproc) write(100+iam,*) "nstep, macmic_it, nadv, ", get_nstep(), macmic_it, nadv + !if (masterproc) write(100+iam,*) "ztopm1, ztop_macmic(i), mf_ztop_nadv, ", ztopm1(i), ztop_macmic(i), mf_ztop_nadv + + if (macmic_it == cld_macmic_num_steps) then + ztopm2(i) = ztopm1(i) + ztopm1(i) = ztop_macmic(i)/REAL(cld_macmic_num_steps) + if (masterproc) write(100+iam,*) "nstep, updated ztopm1, ztopm2, ", get_nstep(), ztopm1(i), ztopm2(i) end if - write(100+iam,*) "i, ztopm1, ", i, ztopm1(i) end if !---ARH diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 83eea3071e..9f52cad543 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -10,7 +10,8 @@ module clubb_mf use cam_logfile, only: iulog use cam_abortutils,only: endrun !+++ARH - use time_manager, only: is_first_step + use time_manager, only: is_first_step, get_nstep + use spmd_utils, only: iam !---ARH use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & cpwv, cpliq, rh2o, zvir, pi @@ -421,6 +422,10 @@ subroutine integrate_mf( nz, supqt = 0._r8 supthl= 0._r8 + dynamic_L0 = 0._r8 + ztop = 0._r8 + mcape = 0._r8 + ! unique identifier zcb_unset = 9999999._r8 zcb = zcb_unset @@ -521,21 +526,15 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) !+++ARH else if (clubb_mf_Lopt==6) then - ! grab ztop from max height of ensemble in prior time-step - if (is_first_step()) then - !Test plume - call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & - wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & - wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) - else - ztop = ztopm1 - end if + ! grab ztop from max height of ensemble in prior time-step(s) + ztop = ztopm1 dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + if (masterproc) write(iam+110,*) 'mf_ztop ', ztop !---ARH end if ! limiter to avoid division by zero - if (dynamic_L0 <= 0.0_r8) dynamic_L0 = min_L0 + dynamic_L0 = max(min_L0,dynamic_L0) if (debug) then ! overide stochastic entrainment with fixent From a27eda72b87255272ff52d22aaae16523c8b8fe8 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Tue, 1 Feb 2022 16:02:25 -0700 Subject: [PATCH 089/466] fixed SCAM forcing feature --- .../scam_STUB/scripts/make_basecase.auto.csh | 18 ++-- .../scam_STUB/scripts/run_cases.csh | 100 +++++++++--------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index 58707307c9..601a43a6db 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -20,7 +20,7 @@ set case_lon = "$argv[$n]" set n = 3 set loc_string = "$argv[$n]" -set src=cam.clubbmf +set src=cam.clubbmf.ztopm1 set srcpath=/home/$USER/src set scratchdir=/scratch/cluster/$USER set COMPSET=FSCAM @@ -41,10 +41,10 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_test0" +set CASE="${src}_${COMPSET}_L58dev_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_100nup_1a1b3alph_nozm" # create new basecase -${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --queue short --run-unsupported +${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --driver mct --queue short --run-unsupported cd ${scratchdir}/${CASE} @@ -71,11 +71,9 @@ sed -i 's/intel\/mvapich2-2.3rc2-intel-18.0.3/intel\/mvapich2-2.1-qlc/' ./env_ma echo "scm_use_ana_iop = .true.">>user_nl_cam -echo "cld_macmic_num_steps=6">>user_nl_cam -#echo "deep_scheme = 'off'">>user_nl_cam +echo "cld_macmic_num_steps=3">>user_nl_cam +echo "deep_scheme = 'off'">>user_nl_cam #echo "zmconv_num_cin = 1">>user_nl_cam -echo "use_gw_front = .false.">>user_nl_cam -echo "use_gw_convect_dp = .false.">>user_nl_cam #echo "clubb_timestep=150.D0">>user_nl_cam #echo "clubb_gamma_coef = 0.27D0">>user_nl_cam @@ -97,13 +95,13 @@ echo "use_gw_convect_dp = .false.">>user_nl_cam echo "do_clubb_mf = .true.">>user_nl_cam echo "do_clubb_mf_diag = .true.">>user_nl_cam echo "do_clubb_mf_precip = .true.">>user_nl_cam -echo "do_clubb_mf_rad = .false.">>user_nl_cam +echo "do_clubb_mf_rad = .true.">>user_nl_cam echo "clubb_mf_nup = 100">>user_nl_cam echo "clubb_mf_L0 = 50.D0">>user_nl_cam -echo "clubb_mf_Lopt = 3">>user_nl_cam +echo "clubb_mf_Lopt = 6">>user_nl_cam echo "clubb_mf_a0 = 1.D0">>user_nl_cam -echo "clubb_mf_b0 = 0.5D0">>user_nl_cam +echo "clubb_mf_b0 = 1.D0">>user_nl_cam echo "clubb_mf_alphturb = 3.D0">>user_nl_cam #Set case specific variables diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index d37799cb58..9e655cdb30 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -1,70 +1,72 @@ #!/bin/csh -f -set lat = 23.08900523560209 -set lon = 205 -set casenam = st10 -source make_basecase.auto.csh $lat $lon $casenam - -cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +set src = cam.clubbmf.ztopm1 -#set lat = 24.03141361256544 -#set lon = 207.5 -#set casenam = st9 +#set lat = 23.08900523560209 +#set lon = 205 +#set casenam = st10 #source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +#cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 24.9738219895288 -#set lon = 210. -#set casenam = st8 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 24.03141361256544 +set lon = 207.5 +set casenam = st9 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 25.91623036649214 -#set lon = 212.5 -#set casenam = st7 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 24.9738219895288 +set lon = 210. +set casenam = st8 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 27.80104712041884 -#set lon = 217.5 -#set casenam = st6 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 25.91623036649214 +set lon = 212.5 +set casenam = st7 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 29.68586387434554 -#set lon = 222.5 -#set casenam = st5 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 27.80104712041884 +set lon = 217.5 +set casenam = st6 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 31.57068062827226 -#set lon = 228.75 -#set casenam = st4 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 29.68586387434554 +set lon = 222.5 +set casenam = st5 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 32.5130890052356 -#set lon = 231.25 -#set casenam = st3 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 31.57068062827226 +set lon = 228.75 +set casenam = st4 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts/ +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts -#set lat = 33.45549738219896 -#set lon = 233.75 -#set casenam = st2 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 32.5130890052356 +set lon = 231.25 +set casenam = st3 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/cam6_3_006.dev/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts/ -#set lat = 33.45549738219896 -#set lon = 240. -#set casenam = st1 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 33.45549738219896 +set lon = 233.75 +set casenam = st2 +source make_basecase.auto.csh $lat $lon $casenam + +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts + +set lat = 33.45549738219896 +set lon = 240. +set casenam = st1 +source make_basecase.auto.csh $lat $lon $casenam From 9c0ebbbd2d9ae05d9f29353f18b121d07ed113fc Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 1 Feb 2022 16:58:01 -0700 Subject: [PATCH 090/466] added rh based dynamic_L0 option --- src/physics/cam/clubb_intr.F90 | 23 ++++++++++++++++++++++- src/physics/cam/clubb_mf.F90 | 8 +++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 42e1b0dcb1..64ed7dddd3 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1615,6 +1615,11 @@ subroutine clubb_tend_cam( & use cam_logfile, only: iulog use tropopause, only: tropopause_findChemTrop use time_manager, only: get_nstep + +!+++ARH + use wv_saturation, only: qsat + use interpolate_data,only: vertinterp +!---ARH #ifdef CLUBB_SGS use hb_diff, only: pblintd @@ -2070,6 +2075,10 @@ subroutine clubb_tend_cam( & !+++ARH real(r8) :: mf_ztopm1, mf_ztop_nadv + + real(r8), dimension(pcols,pver) :: esat, rh + real(r8), dimension(pcols) :: rh500 + real(r8) :: rhinv !---ARH ! MF local vars @@ -2243,6 +2252,15 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, ztopm1_idx, ztopm1) call pbuf_get_field(pbuf, ztopm2_idx, ztopm2) call pbuf_get_field(pbuf, ztop_macmic_idx, ztop_macmic) + + ! Relative humidity + do k = 1, pver + call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) + end do + rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) + ! Interpolate to 500 hPa + call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & + extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) !---ARH end if @@ -2872,6 +2890,9 @@ subroutine clubb_tend_cam( & !+++ARH mf_ztopm1 = ztopm1(i) !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) + + rhinv = 0._r8 + if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) !---ARH call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input @@ -2883,7 +2904,7 @@ subroutine clubb_tend_cam( & wpthlp_sfc, wprtp_sfc, pblh(i), & ! input !+++ARH !wpthlp_in, tke_in, tpert(i), & ! input - wpthlp_in, tke_in, tpert(i), mf_ztopm1, & ! input + wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input !---ARH mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 9f52cad543..97c1201f1a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -121,7 +121,7 @@ subroutine integrate_mf( nz, wthl, wqt, pblh, & ! input !+++ARH !wpthlp_env, tke, tpert, & ! input - wpthlp_env, tke, tpert, ztopm1, & ! input + wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input !---ARH mcape, & ! output upa, & ! output @@ -197,6 +197,7 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert !+++ARH + real(r8), intent(in) :: rhinv real(r8), intent(inout) :: ztopm1 !---ARH real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid @@ -530,6 +531,11 @@ subroutine integrate_mf( nz, ztop = ztopm1 dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) if (masterproc) write(iam+110,*) 'mf_ztop ', ztop + + else if (clubb_mf_Lopt==7) then + ztop = rhinv + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + if (masterproc) write(iam+110,*) 'rhinv, dynamic_L0 ', rhinv, dynamic_L0 !---ARH end if From 1e0f9b602227b16d2bafc3ab2477bb2140ad1e44 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 3 Feb 2022 12:38:06 -0700 Subject: [PATCH 091/466] added column rh ztop calc --- .../scam_STUB/scripts/make_basecase.auto.csh | 6 ++--- .../scam_STUB/scripts/run_cases.csh | 10 ++++---- src/physics/cam/clubb_intr.F90 | 24 +++++++++++++++---- src/physics/cam/clubb_mf.F90 | 6 +++-- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index 601a43a6db..7e50a3f143 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -41,7 +41,7 @@ set loo = `echo $case_lon | cut -d '.' -f 1` echo $loo # set basecase name -set CASE="${src}_${COMPSET}_L58dev_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_100nup_1a1b3alph_nozm" +set CASE="${src}_${COMPSET}_L58dev_CAMFORC_${loc_string}_${case_date}_c`date '+%y%m%d'`_100nup_100a3b3alph_nozm" # create new basecase ${srcpath}/${src}/cime/scripts/create_newcase --case ${scratchdir}/${CASE} --compset ${COMPSET} --res T42_T42 --user-mods-dir ${srcpath}/${src}/cime_config/usermods_dirs/scam_STUB --walltime 01:00:00 --mach izumi --pecount 1 --compiler intel --driver mct --queue short --run-unsupported @@ -99,8 +99,8 @@ echo "do_clubb_mf_rad = .true.">>user_nl_cam echo "clubb_mf_nup = 100">>user_nl_cam echo "clubb_mf_L0 = 50.D0">>user_nl_cam -echo "clubb_mf_Lopt = 6">>user_nl_cam -echo "clubb_mf_a0 = 1.D0">>user_nl_cam +echo "clubb_mf_Lopt = 7">>user_nl_cam +echo "clubb_mf_a0 = 100.D0">>user_nl_cam echo "clubb_mf_b0 = 1.D0">>user_nl_cam echo "clubb_mf_alphturb = 3.D0">>user_nl_cam diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index 9e655cdb30..6c0889f239 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -2,12 +2,12 @@ set src = cam.clubbmf.ztopm1 -#set lat = 23.08900523560209 -#set lon = 205 -#set casenam = st10 -#source make_basecase.auto.csh $lat $lon $casenam +set lat = 23.08900523560209 +set lon = 205 +set casenam = st10 +source make_basecase.auto.csh $lat $lon $casenam -#cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts +cd /home/aherring/src/$src/cime_config/usermods_dirs/scam_STUB/scripts set lat = 24.03141361256544 set lon = 207.5 diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 64ed7dddd3..12b45af6a4 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -21,7 +21,9 @@ module clubb_intr use ppgrid, only: pver, pverp, pcols, begchunk, endchunk use phys_control, only: phys_getopts use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o - +!+++ARH + use physconst, only: rga +!---ARH use spmd_utils, only: masterproc !+++ARH use spmd_utils, only: iam @@ -2077,6 +2079,7 @@ subroutine clubb_tend_cam( & real(r8) :: mf_ztopm1, mf_ztop_nadv real(r8), dimension(pcols,pver) :: esat, rh + real(r8), dimension(pcols,pver) :: mq, mqsat real(r8), dimension(pcols) :: rh500 real(r8) :: rhinv !---ARH @@ -2257,10 +2260,20 @@ subroutine clubb_tend_cam( & do k = 1, pver call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) end do - rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) - ! Interpolate to 500 hPa - call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & - extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) + + !rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) + !! Interpolate to 500 hPa + !call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & + ! extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) + + ! Mass of q, by layer and vertically integrated + mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga + mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga + do k=2,pver + mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) + mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) + end do + rh500(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) !---ARH end if @@ -2892,6 +2905,7 @@ subroutine clubb_tend_cam( & !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 + if (rh500(i) > 1._r8) rh500(i) = 1._r8 if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) !---ARH call integrate_mf( pverp, & ! input diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 97c1201f1a..963075902a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -487,7 +487,9 @@ subroutine integrate_mf( nz, !else ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) !end if - +!+++ARH + if (masterproc) write(iam+110,*) 'ztop, dynamic_L0 ', ztop, dynamic_L0 +!---ARH else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then !dilute cape calculation !dmpdz = -1._r8*ent_zt(2:nz,:) @@ -530,7 +532,7 @@ subroutine integrate_mf( nz, ! grab ztop from max height of ensemble in prior time-step(s) ztop = ztopm1 dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - if (masterproc) write(iam+110,*) 'mf_ztop ', ztop + if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 else if (clubb_mf_Lopt==7) then ztop = rhinv From 71a8de09d376e0423c6e82eab54901e8d060475c Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 5 Feb 2022 12:39:59 -0700 Subject: [PATCH 092/466] ent mods, write output for macmic==1 only --- src/physics/cam/clubb_intr.F90 | 46 +++++++++++++++++++++++----------- src/physics/cam/clubb_mf.F90 | 24 ++++++++++++++++-- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 12b45af6a4..15703513dd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2256,24 +2256,24 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, ztopm2_idx, ztopm2) call pbuf_get_field(pbuf, ztop_macmic_idx, ztop_macmic) - ! Relative humidity + ! SVP do k = 1, pver call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) end do - !rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) - !! Interpolate to 500 hPa - !call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & - ! extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) + ! Interpolate RH to 500 hPa + rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) + call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & + extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) ! Mass of q, by layer and vertically integrated - mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga - mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga - do k=2,pver - mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) - mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) - end do - rh500(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) + !mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga + !mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga + !do k=2,pver + ! mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) + ! mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) + !end do + !rh500(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) !---ARH end if @@ -2905,7 +2905,7 @@ subroutine clubb_tend_cam( & !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 - if (rh500(i) > 1._r8) rh500(i) = 1._r8 + if (rh500(i) >= 1._r8) rh500(i) = 0.999_r8 if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) !---ARH call integrate_mf( pverp, & ! input @@ -3500,13 +3500,18 @@ subroutine clubb_tend_cam( & ! ------------------------------------------------- ! ! Output CLUBB tendencies +!+++ARH +if (macmic_it==1) then +!---ARH call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - +!+++ARH +end if +!---ARH call outfld( 'CMELIQ', cmeliq, pcols, lchnk) call physics_ptend_sum(ptend_loc,ptend_all,ncol) @@ -3944,9 +3949,14 @@ subroutine clubb_tend_cam( & call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) +!+++ARH +if (macmic_it==1) then +!---ARH call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - +!+++ARH +end if +!---ARH temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) @@ -4003,6 +4013,9 @@ subroutine clubb_tend_cam( & ! Writing state variables after EDMF scheme for detailed analysis ! ! --------------------------------------------------------------- ! if (do_clubb_mf) then +!+++ARH + if (macmic_it == 1) then +!---ARH call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) @@ -4050,6 +4063,9 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) +!+++ARH + end if +!---ARH end if if (macmic_it==cld_macmic_num_steps) then diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 963075902a..bf474adc12 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -332,7 +332,10 @@ subroutine integrate_mf( nz, logical :: do_aspd = .false. ! ! Lower limit on entrainment length scale - real(r8),parameter :: min_L0 = 10._r8 + real(r8),parameter :: min_L0 = 1._r8 +!+++ARH + real(r8),parameter :: max_L0 = 10.e3_r8 +!---ARH ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) @@ -543,6 +546,9 @@ subroutine integrate_mf( nz, ! limiter to avoid division by zero dynamic_L0 = max(min_L0,dynamic_L0) +!+++ARH + dynamic_L0 = min(max_L0,dynamic_L0) +!---ARH if (debug) then ! overide stochastic entrainment with fixent @@ -710,6 +716,9 @@ subroutine integrate_mf( nz, upth(k+1,i) = thn upbuoy(k+1,i)= B else +!+++ARH + ent(k+2:nz,i) = 0._r8 +!---ARH exit end if enddo @@ -831,7 +840,8 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup ae (k) = ae (k) - upa(k,i) aw (k) = aw (k) + upa(k,i)*upw(k,i) - awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) +!+++ARH + !awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) @@ -845,8 +855,18 @@ subroutine integrate_mf( nz, ! scale autoconv by factor (1-fdd)? sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) +!+++ARH + awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*ent(k,i) +!---ARH end if enddo +!+++ARH + if (k > 1 .and. ae(k) < 1._r8) then + awu(k) = awu(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) + else + awu(k) = 0._r8 + end if +!---ARH ! no convection if convection terminates at first level if (k == 2 .and. ae(k) == 1._r8) then sqt(k) = 0_r8 From 737a73cc062036a060b5cb80cc04b5461e76ae42 Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 7 Feb 2022 18:26:24 -0700 Subject: [PATCH 093/466] comment out mods for saving output only during macmic==1 --- src/physics/cam/clubb_intr.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 15703513dd..ec458452cd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3501,7 +3501,7 @@ subroutine clubb_tend_cam( & ! Output CLUBB tendencies !+++ARH -if (macmic_it==1) then +!if (macmic_it==1) then !---ARH call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) @@ -3510,7 +3510,7 @@ subroutine clubb_tend_cam( & call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) !+++ARH -end if +!end if !---ARH call outfld( 'CMELIQ', cmeliq, pcols, lchnk) @@ -3950,12 +3950,12 @@ subroutine clubb_tend_cam( & call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) !+++ARH -if (macmic_it==1) then +!if (macmic_it==1) then !---ARH call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) !+++ARH -end if +!end if !---ARH temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) @@ -4014,7 +4014,7 @@ subroutine clubb_tend_cam( & ! --------------------------------------------------------------- ! if (do_clubb_mf) then !+++ARH - if (macmic_it == 1) then +! if (macmic_it == 1) then !---ARH call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) @@ -4064,7 +4064,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) !+++ARH - end if +! end if !---ARH end if From 02fc505ba920621226a183c02604bb96d8a75b41 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 16 Feb 2022 11:14:57 -0700 Subject: [PATCH 094/466] fixed bug for coupling precip and radiation for nadv>1 --- src/physics/cam/clubb_intr.F90 | 66 ++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index ec458452cd..d52a2d12a5 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1327,7 +1327,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) +!+++ARH + !call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) + call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'in-cloud cloud mixing ratio (EDMF)' ) +!---ARH call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') @@ -2057,6 +2060,7 @@ subroutine clubb_tend_cam( & mf_thforc, mf_qvforc, & mf_qcforc, & mf_rcm, mf_cloudfrac, & + mf_rcm_nadv,mf_cloudfrac_nadv, & mf_qc_zt, mf_cloudfrac_zt ! MF plume level @@ -2076,7 +2080,8 @@ subroutine clubb_tend_cam( & logical :: cfllim !+++ARH - real(r8) :: mf_ztopm1, mf_ztop_nadv + real(r8) :: mf_ztopm1, mf_ztop_nadv, & + mf_precc_nadv, mf_snow_nadv real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat @@ -2862,6 +2867,14 @@ subroutine clubb_tend_cam( & mf_ztopm1 = 0._r8 mf_ztop_nadv = 0._r8 if (macmic_it==1) ztop_macmic(i) = 0._r8 + + mf_precc_nadv = 0._r8 + mf_snow_nadv = 0._r8 + + mf_rcm(:pverp) = 0._r8 + mf_cloudfrac(:pverp) = 0._r8 + mf_rcm_nadv(:pverp) = 0._r8 + mf_cloudfrac_nadv(:pverp) = 0._r8 end if !---ARH @@ -2905,7 +2918,7 @@ subroutine clubb_tend_cam( & !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 - if (rh500(i) >= 1._r8) rh500(i) = 0.999_r8 + if (rh500(i) >= 1._r8) rh500(i) = 0.99999_r8 if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) !---ARH call integrate_mf( pverp, & ! input @@ -2986,15 +2999,16 @@ subroutine clubb_tend_cam( & end do ! compute ensemble cloud properties - mf_rcm = 0._r8 - mf_cloudfrac = 0._r8 - mf_rcm(:pverp) = mf_moist_a(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac(:pverp)= mf_moist_a(:pverp) +!+++ARH + !mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) + ! I am redefining rcm to be in-cloud qc to facilaite radiation calc. + mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_qc(:pverp) + mf_cloudfrac_nadv(:pverp) = mf_cloudfrac_nadv(:pverp) + mf_moist_a(:pverp) ! [kg/m2/s]->[m/s] - prec_sh(i) = mf_precc(1)/1000._r8 - snow_sh(i) = 0._r8 -!+++ARH + mf_precc_nadv = mf_precc_nadv + mf_precc(1)/1000._r8 + mf_snow_nadv = 0._r8 + mf_ztop_nadv = mf_ztop_nadv + mf_ztopm1 !---ARH end if @@ -3081,8 +3095,13 @@ subroutine clubb_tend_cam( & if (macmic_it == cld_macmic_num_steps) then ztopm2(i) = ztopm1(i) ztopm1(i) = ztop_macmic(i)/REAL(cld_macmic_num_steps) - if (masterproc) write(100+iam,*) "nstep, updated ztopm1, ztopm2, ", get_nstep(), ztopm1(i), ztopm2(i) + !if (masterproc) write(100+iam,*) "nstep, updated ztopm1, ztopm2, ", get_nstep(), ztopm1(i), ztopm2(i) end if + + mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) + mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) + prec_sh(i) = mf_precc_nadv/REAL(nadv) + snow_sh(i) = mf_snow_nadv/REAL(nadv) end if !---ARH @@ -3112,7 +3131,11 @@ subroutine clubb_tend_cam( & thl2_zt = zm2zt_api(thlp2_in) wp2_zt = zm2zt_api(wp2_in) ! Need moist_qc and cloudfrac on thermo grid for output - mf_qc_zt = zm2zt_api(mf_moist_qc) +!+++ARH + !mf_qc_zt = zm2zt_api(mf_moist_qc) + ! note I'm redefining rcm to be incloud qc + mf_qc_zt = zm2zt_api(mf_rcm) +!---ARH mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) ! Arrays need to be "flipped" to CAM grid @@ -3500,18 +3523,12 @@ subroutine clubb_tend_cam( & ! ------------------------------------------------- ! ! Output CLUBB tendencies -!+++ARH -!if (macmic_it==1) then -!---ARH call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) -!+++ARH -!end if -!---ARH call outfld( 'CMELIQ', cmeliq, pcols, lchnk) call physics_ptend_sum(ptend_loc,ptend_all,ncol) @@ -3949,14 +3966,9 @@ subroutine clubb_tend_cam( & call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) -!+++ARH -!if (macmic_it==1) then -!---ARH call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) -!+++ARH -!end if -!---ARH + temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) @@ -4013,9 +4025,6 @@ subroutine clubb_tend_cam( & ! Writing state variables after EDMF scheme for detailed analysis ! ! --------------------------------------------------------------- ! if (do_clubb_mf) then -!+++ARH -! if (macmic_it == 1) then -!---ARH call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) @@ -4063,9 +4072,6 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) -!+++ARH -! end if -!---ARH end if if (macmic_it==cld_macmic_num_steps) then From 07f2603d77b1334be1bfc8bc282afd30ea80cb21 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 19 Feb 2022 09:09:48 -0700 Subject: [PATCH 095/466] proper avg of ztop,L0,thlforc.qtforc over nadv cycles --- src/physics/cam/clubb_intr.F90 | 131 ++++++++++++++++----------------- 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d52a2d12a5..391aeafbbd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -21,14 +21,11 @@ module clubb_intr use ppgrid, only: pver, pverp, pcols, begchunk, endchunk use phys_control, only: phys_getopts use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o -!+++ARH use physconst, only: rga -!---ARH use spmd_utils, only: masterproc -!+++ARH use spmd_utils, only: iam use time_manager, only: get_nstep -!---ARH + use cam_history_support, only : fillvalue use constituents, only: pcnst, cnst_add use pbl_utils, only: calc_ustar, calc_obklen use ref_pres, only: top_lev => trop_cloud_top_lev @@ -292,11 +289,9 @@ module clubb_intr prec_sh_idx, & snow_sh_idx -!+++ARH integer :: ztopm1_idx integer :: ztopm2_idx - integer :: ztop_macmic_idx -!---ARH + integer :: ztopm1_macmic_idx ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -441,11 +436,9 @@ subroutine clubb_register_cam( ) call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) -!+++ARH call pbuf_add_field('ZTOPM1' ,'global' , dtype_r8, (/pcols/), ztopm1_idx) call pbuf_add_field('ZTOPM2' ,'global' , dtype_r8, (/pcols/), ztopm2_idx) - call pbuf_add_field('ZTOP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ztop_macmic_idx) -!---ARH + call pbuf_add_field('ZTOP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ztopm1_macmic_idx) end if #endif @@ -1327,13 +1320,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thforc' , (/ 'lev' /), 'A', 'K/s' , 'th forcing (EDMF)' ) call addfld ( 'edmf_qvforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qv forcing (EDMF)' ) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) -!+++ARH - !call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'in-cloud cloud mixing ratio (EDMF)' ) -!---ARH + call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) - call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop') - call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0') + call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) + call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) call addfld ( 'edmf_upw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) @@ -1566,13 +1556,13 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) -!+++ARH + if (do_clubb_mf) then call pbuf_set_field(pbuf2d, ztopm1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ztopm2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztop_macmic_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztopm1_macmic_idx, 0.0_r8) end if -!---ARH + endif ! The following is physpkg, so it needs to be initialized every time @@ -1621,10 +1611,8 @@ subroutine clubb_tend_cam( & use tropopause, only: tropopause_findChemTrop use time_manager, only: get_nstep -!+++ARH use wv_saturation, only: qsat use interpolate_data,only: vertinterp -!---ARH #ifdef CLUBB_SGS use hb_diff, only: pblintd @@ -1962,11 +1950,9 @@ subroutine clubb_tend_cam( & real(r8),pointer :: prec_sh(:) ! total precipitation from MF real(r8),pointer :: snow_sh(:) ! snow from MF -!+++ARH real(r8), pointer :: ztopm1(:) real(r8), pointer :: ztopm2(:) - real(r8), pointer :: ztop_macmic(:) -!---ARH + real(r8), pointer :: ztopm1_macmic(:) real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) @@ -2059,9 +2045,11 @@ subroutine clubb_tend_cam( & mf_thvflx, mf_qcflx, & mf_thforc, mf_qvforc, & mf_qcforc, & - mf_rcm, mf_cloudfrac, & - mf_rcm_nadv,mf_cloudfrac_nadv, & - mf_qc_zt, mf_cloudfrac_zt + mf_qc, mf_cloudfrac, & + mf_qc_nadv, mf_cloudfrac_nadv, & + mf_qc_zt, mf_cloudfrac_zt,& + mf_rcm, mf_rcm_nadv, & + mf_thlforc_nadv,mf_qtforc_nadv ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & @@ -2079,15 +2067,15 @@ subroutine clubb_tend_cam( & real(r8) :: cflval, cflfac logical :: cfllim -!+++ARH - real(r8) :: mf_ztopm1, mf_ztop_nadv, & - mf_precc_nadv, mf_snow_nadv + real(r8) :: mf_ztop, mf_ztop_nadv, & + mf_ztopm1, mf_ztopm1_nadv, & + mf_precc_nadv, mf_snow_nadv,& + mf_L0, mf_L0_nadv real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat real(r8), dimension(pcols) :: rh500 real(r8) :: rhinv -!---ARH ! MF local vars real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid @@ -2256,10 +2244,10 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) call pbuf_get_field(pbuf, tpert_idx, tpert) -!+++ARH + call pbuf_get_field(pbuf, ztopm1_idx, ztopm1) call pbuf_get_field(pbuf, ztopm2_idx, ztopm2) - call pbuf_get_field(pbuf, ztop_macmic_idx, ztop_macmic) + call pbuf_get_field(pbuf, ztopm1_macmic_idx, ztopm1_macmic) ! SVP do k = 1, pver @@ -2279,7 +2267,6 @@ subroutine clubb_tend_cam( & ! mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) !end do !rh500(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) -!---ARH end if ! Initialize the apply_const variable (note special logic is due to eularian backstepping) @@ -2862,21 +2849,29 @@ subroutine clubb_tend_cam( & stats_nsamp = nint(stats_tsamp/dtime) stats_nout = nint(stats_tout/dtime) -!+++ARH if (do_clubb_mf) then - mf_ztopm1 = 0._r8 - mf_ztop_nadv = 0._r8 - if (macmic_it==1) ztop_macmic(i) = 0._r8 + mf_L0 = 0._r8 + mf_L0_nadv = 0._r8 + mf_ztop = 0._r8 + mf_ztop_nadv = 0._r8 + mf_ztopm1 = 0._r8 + mf_ztopm1_nadv = 0._r8 + + if (macmic_it==1) ztopm1_macmic(i) = 0._r8 mf_precc_nadv = 0._r8 mf_snow_nadv = 0._r8 + mf_qc(:pverp) = 0._r8 mf_rcm(:pverp) = 0._r8 mf_cloudfrac(:pverp) = 0._r8 + mf_qc_nadv(:pverp) = 0._r8 mf_rcm_nadv(:pverp) = 0._r8 mf_cloudfrac_nadv(:pverp) = 0._r8 + + mf_thlforc_nadv(:pverp) = 0._r8 + mf_qtforc_nadv(:pverp) = 0._r8 end if -!---ARH do t=1,nadv ! do needed number of "sub" timesteps for each CAM step @@ -2913,14 +2908,13 @@ subroutine clubb_tend_cam( & thv_ds_zm = zt2zm_api( thv_ds_zt ) end if -!+++ARH mf_ztopm1 = ztopm1(i) !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 if (rh500(i) >= 1._r8) rh500(i) = 0.99999_r8 if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) -!---ARH + call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input @@ -2929,10 +2923,7 @@ subroutine clubb_tend_cam( & thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wpthlp_sfc, wprtp_sfc, pblh(i), & ! input -!+++ARH - !wpthlp_in, tke_in, tpert(i), & ! input wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input -!---ARH mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics mf_upw, & ! output - plume diagnostics @@ -2960,7 +2951,7 @@ subroutine clubb_tend_cam( & mf_thflx, mf_qvflx, & ! output - plume diagnostics mf_thvflx, mf_qcflx, & ! output - plume diagnostics mf_thlflx, mf_qtflx, & ! output - variables needed for solver - mf_ztop_output(i), mf_L0_output(i) ) + mf_ztop, mf_L0 ) ! CFL limiter s_aw(1) = 0._r8 @@ -2999,18 +2990,21 @@ subroutine clubb_tend_cam( & end do ! compute ensemble cloud properties -!+++ARH - !mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) - ! I am redefining rcm to be in-cloud qc to facilaite radiation calc. - mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_qc(:pverp) + mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) + mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) mf_cloudfrac_nadv(:pverp) = mf_cloudfrac_nadv(:pverp) + mf_moist_a(:pverp) ! [kg/m2/s]->[m/s] mf_precc_nadv = mf_precc_nadv + mf_precc(1)/1000._r8 mf_snow_nadv = 0._r8 - mf_ztop_nadv = mf_ztop_nadv + mf_ztopm1 -!---ARH + ! accumulate ztop over nadv subcycles + mf_L0_nadv = mf_L0_nadv + mf_L0 + mf_ztop_nadv = mf_ztop_nadv + mf_ztop + mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 + + mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp) + thlm_forcing(:pverp) + mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp) + rtm_forcing(:pverp) end if ! Advance CLUBB CORE one timestep in the future @@ -3085,25 +3079,27 @@ subroutine clubb_tend_cam( & enddo ! end time loop -!+++ARH if (do_clubb_mf) then + mf_L0_nadv = mf_L0_nadv/REAL(nadv) mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) - ztop_macmic(i) = ztop_macmic(i) + mf_ztop_nadv - !if (masterproc) write(100+iam,*) "nstep, macmic_it, nadv, ", get_nstep(), macmic_it, nadv - !if (masterproc) write(100+iam,*) "ztopm1, ztop_macmic(i), mf_ztop_nadv, ", ztopm1(i), ztop_macmic(i), mf_ztop_nadv + mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) + ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv if (macmic_it == cld_macmic_num_steps) then ztopm2(i) = ztopm1(i) - ztopm1(i) = ztop_macmic(i)/REAL(cld_macmic_num_steps) + ztopm1(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) !if (masterproc) write(100+iam,*) "nstep, updated ztopm1, ztopm2, ", get_nstep(), ztopm1(i), ztopm2(i) end if - mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) + mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) + mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) - prec_sh(i) = mf_precc_nadv/REAL(nadv) - snow_sh(i) = mf_snow_nadv/REAL(nadv) + prec_sh(i) = mf_precc_nadv/REAL(nadv) + snow_sh(i) = mf_snow_nadv/REAL(nadv) + + mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) + mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) end if -!---ARH if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then @@ -3130,12 +3126,9 @@ subroutine clubb_tend_cam( & rtp2_zt = zm2zt_api(rtp2_in) thl2_zt = zm2zt_api(thlp2_in) wp2_zt = zm2zt_api(wp2_in) + ! Need moist_qc and cloudfrac on thermo grid for output -!+++ARH - !mf_qc_zt = zm2zt_api(mf_moist_qc) - ! note I'm redefining rcm to be incloud qc - mf_qc_zt = zm2zt_api(mf_rcm) -!---ARH + mf_qc_zt = zm2zt_api(mf_qc) mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) ! Arrays need to be "flipped" to CAM grid @@ -3234,8 +3227,8 @@ subroutine clubb_tend_cam( & mf_precc_output(i,pverp-k+1) = mf_precc(k) if (k.ne.1) then - mf_thlforc_output(i,pverp-k+1) = thlm_forcing(k) - mf_qtforc_output(i,pverp-k+1) = rtm_forcing(k) + mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) + mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) mf_thforc_output(i,pverp-k+1) = mf_thforc(k) mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) @@ -3257,6 +3250,10 @@ subroutine clubb_tend_cam( & enddo if (do_clubb_mf) then + if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue + if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue + mf_ztop_output(i) = mf_ztop_nadv + mf_L0_output(i) = mf_L0_nadv do k=1,clubb_mf_nup mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) From 3fe61f30210c403bbc19be90ab0d134bd0ac233a Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 24 Feb 2022 10:42:27 -0700 Subject: [PATCH 096/466] scale qt tendency to not drive qt negative --- src/physics/cam/clubb_intr.F90 | 58 +++++++++++++++++++++++++++------- src/physics/cam/clubb_mf.F90 | 41 ++++++------------------ 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 391aeafbbd..7b2cc590aa 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1322,8 +1322,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_qcforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qc forcing (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) + call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) + call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) call addfld ( 'edmf_upw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) @@ -1332,7 +1334,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upthv' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) call addfld ( 'edmf_upth' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) call addfld ( 'edmf_upqc' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', 'k1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft entrainment rate (EDMF)' ) call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if @@ -1480,6 +1482,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_qcforc' , 1, ' ') call add_default( 'edmf_rcm' , 1, ' ') call add_default( 'edmf_cloudfrac', 1, ' ') + call add_default( 'edmf_ent' , 1, ' ') call add_default( 'edmf_ztop' , 1, ' ') call add_default( 'edmf_L0' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') @@ -1996,12 +1999,12 @@ subroutine clubb_tend_cam( & mf_precc_output ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & - mf_cape_output + mf_cape_output, mf_cfl_output ! ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_thforc_output, mf_qvforc_output, & ! thermodynamic grid - mf_qcforc_output, & ! thermodynamic grid + mf_qcforc_output, mf_ent_output, & ! thermodynamic grid mf_qc_output, mf_cloudfrac_output ! thermodynamic grid ! MF plume level outputs @@ -2049,7 +2052,8 @@ subroutine clubb_tend_cam( & mf_qc_nadv, mf_cloudfrac_nadv, & mf_qc_zt, mf_cloudfrac_zt,& mf_rcm, mf_rcm_nadv, & - mf_thlforc_nadv,mf_qtforc_nadv + mf_thlforc_nadv,mf_qtforc_nadv, & + mf_ent, mf_ent_nadv ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & @@ -2063,8 +2067,9 @@ subroutine clubb_tend_cam( & mf_upent ! CFL limiter vars - real(r8), dimension(pcols) :: max_cfl - real(r8) :: cflval, cflfac + real(r8), parameter :: cflval = 1._r8 + real(r8) :: cflfac, max_cfl, & + lambda, max_cfl_nadv logical :: cfllim real(r8) :: mf_ztop, mf_ztop_nadv, & @@ -2528,10 +2533,12 @@ subroutine clubb_tend_cam( & mf_qcforc_output(:,:) = 0._r8 mf_rcm_output(:,:) = 0._r8 mf_cloudfrac_output(:,:) = 0._r8 + mf_ent_output(:,:) = 0._r8 mf_qc_output(:,:) = 0._r8 mf_ztop_output(:) = 0._r8 mf_L0_output(:) = 0._r8 mf_cape_output(:) = 0._r8 + mf_cfl_output(:) = 0._r8 ! Loop over all columns in lchnk to advance CLUBB core do i=1,ncol ! loop over columns @@ -2871,6 +2878,11 @@ subroutine clubb_tend_cam( & mf_thlforc_nadv(:pverp) = 0._r8 mf_qtforc_nadv(:pverp) = 0._r8 + + max_cfl_nadv = 0._r8 + + mf_ent(:pverp) = 0._r8 + mf_ent_nadv(:pverp) = 0._r8 end if do t=1,nadv ! do needed number of "sub" timesteps for each CAM step @@ -2912,7 +2924,7 @@ subroutine clubb_tend_cam( & !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 - if (rh500(i) >= 1._r8) rh500(i) = 0.99999_r8 + if (rh500(i) >= 1._r8) rh500(i) = 0.990_r8 if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) call integrate_mf( pverp, & ! input @@ -2955,14 +2967,13 @@ subroutine clubb_tend_cam( & ! CFL limiter s_aw(1) = 0._r8 - max_cfl(i)= 0._r8 + max_cfl = 0._r8 do k=2,pverp - max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) + max_cfl = max(max_cfl,dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) end do - cflval = 1._r8 cflfac = 1._r8 cfllim = .true. - if (max_cfl(i).gt.cflval.and.cfllim) cflfac = cflval/max_cfl(i) + if (max_cfl.gt.cflval.and.cfllim) cflfac = cflval/max_cfl ! pass MF turbulent advection term as CLUBB explicit forcing term rtm_forcing = 0._r8 @@ -2989,6 +3000,20 @@ subroutine clubb_tend_cam( & ((rho_ds_zm(k) * mf_qcflx(k)) - (rho_ds_zm(k-1) * mf_qcflx(k-1))) end do + + ! Scale rtm_forcing so that rtm doesn't go negative + do k=2,pverp + if ((-1._r8*rtm_forcing(k)*dtime) > rtm_in(k)) then + lambda = -1._r8*rtm_in(k)/(rtm_forcing(k)*dtime) + rtm_forcing(k) = lambda*rtm_forcing(k) + end if + end do + ! Recalculate precip using new forcing + mf_precc(:pverp) = 0._r8 + do k=pverp,2,-1 + mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*rtm_forcing(k) + end do + ! compute ensemble cloud properties mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) @@ -3005,6 +3030,11 @@ subroutine clubb_tend_cam( & mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp) + thlm_forcing(:pverp) mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp) + rtm_forcing(:pverp) + + max_cfl_nadv = MAX(max_cfl,max_cfl_nadv) + + mf_ent(:pverp) = s_awu(:pverp) + mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + mf_ent(:pverp) end if ! Advance CLUBB CORE one timestep in the future @@ -3099,6 +3129,8 @@ subroutine clubb_tend_cam( & mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) + + mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp)/REAL(nadv) end if if (clubb_do_adv) then @@ -3233,6 +3265,7 @@ subroutine clubb_tend_cam( & mf_qvforc_output(i,pverp-k+1) = mf_qvforc(k) mf_qcforc_output(i,pverp-k+1) = mf_qcforc(k) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) + mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) end if @@ -3254,6 +3287,7 @@ subroutine clubb_tend_cam( & if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue mf_ztop_output(i) = mf_ztop_nadv mf_L0_output(i) = mf_L0_nadv + mf_cfl_output(i) = max_cfl_nadv do k=1,clubb_mf_nup mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) @@ -4056,6 +4090,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_qcforc' , mf_qcforc_output, pcols, lchnk ) call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) + call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) @@ -4068,6 +4103,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) + call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) end if diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index bf474adc12..c53a1f0c70 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -9,10 +9,8 @@ module clubb_mf use spmd_utils, only: masterproc use cam_logfile, only: iulog use cam_abortutils,only: endrun -!+++ARH use time_manager, only: is_first_step, get_nstep use spmd_utils, only: iam -!---ARH use physconst, only: cpair, epsilo, gravit, latice, latvap, tmelt, rair, & cpwv, cpliq, rh2o, zvir, pi @@ -119,10 +117,7 @@ subroutine integrate_mf( nz, thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input wthl, wqt, pblh, & ! input -!+++ARH - !wpthlp_env, tke, tpert, & ! input wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input -!---ARH mcape, & ! output upa, & ! output upw, & ! output @@ -196,10 +191,9 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert -!+++ARH real(r8), intent(in) :: rhinv real(r8), intent(inout) :: ztopm1 -!---ARH + real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid upqt, & ! momentum grid @@ -332,10 +326,8 @@ subroutine integrate_mf( nz, logical :: do_aspd = .false. ! ! Lower limit on entrainment length scale - real(r8),parameter :: min_L0 = 1._r8 -!+++ARH - real(r8),parameter :: max_L0 = 10.e3_r8 -!---ARH + real(r8),parameter :: min_L0 = 0.5_r8, & + max_L0 = 15.e3_r8 ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) @@ -490,9 +482,6 @@ subroutine integrate_mf( nz, !else ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) !end if -!+++ARH - if (masterproc) write(iam+110,*) 'ztop, dynamic_L0 ', ztop, dynamic_L0 -!---ARH else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then !dilute cape calculation !dmpdz = -1._r8*ent_zt(2:nz,:) @@ -530,25 +519,21 @@ subroutine integrate_mf( nz, ztop = mcape end if dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) -!+++ARH + else if (clubb_mf_Lopt==6) then ! grab ztop from max height of ensemble in prior time-step(s) ztop = ztopm1 dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 - + !if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 else if (clubb_mf_Lopt==7) then ztop = rhinv dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - if (masterproc) write(iam+110,*) 'rhinv, dynamic_L0 ', rhinv, dynamic_L0 -!---ARH + !if (masterproc) write(iam+110,*) 'rhinv, dynamic_L0 ', rhinv, dynamic_L0 end if ! limiter to avoid division by zero dynamic_L0 = max(min_L0,dynamic_L0) -!+++ARH dynamic_L0 = min(max_L0,dynamic_L0) -!---ARH if (debug) then ! overide stochastic entrainment with fixent @@ -716,9 +701,7 @@ subroutine integrate_mf( nz, upth(k+1,i) = thn upbuoy(k+1,i)= B else -!+++ARH ent(k+2:nz,i) = 0._r8 -!---ARH exit end if enddo @@ -840,7 +823,6 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup ae (k) = ae (k) - upa(k,i) aw (k) = aw (k) + upa(k,i)*upw(k,i) -!+++ARH !awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) @@ -855,18 +837,16 @@ subroutine integrate_mf( nz, ! scale autoconv by factor (1-fdd)? sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) -!+++ARH + ! hack awu to contain ensemble entrainment awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*ent(k,i) -!---ARH end if enddo -!+++ARH - if (k > 1 .and. ae(k) < 1._r8) then + ! hack awu to contain ensemble entrainment + if (k > 1 .and. 0.5_r8*(ae(k)+ae(k-1)) < 1._r8) then awu(k) = awu(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) else awu(k) = 0._r8 end if -!---ARH ! no convection if convection terminates at first level if (k == 2 .and. ae(k) == 1._r8) then sqt(k) = 0_r8 @@ -875,13 +855,12 @@ subroutine integrate_mf( nz, end if enddo -!+++ARH + ! ztopm1 calculation do k=1,nz if (ae(k) < 1._r8) then ztopm1 = zm(k) end if end do -!---ARH ! downward sweep to get ensemble mean precip do k = nz,2,-1 From 0599228e93b0fd21523b62730e880c6c9a5af4ba Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 25 Feb 2022 19:46:44 -0700 Subject: [PATCH 097/466] modify pos def limiter to micro-forcing of thl/qt, use th_sfc for wthv --- src/physics/cam/clubb_intr.F90 | 52 +++++++++++++++++++--------------- src/physics/cam/clubb_mf.F90 | 16 ++++++++--- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7b2cc590aa..475ab85673 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2053,7 +2053,7 @@ subroutine clubb_tend_cam( & mf_qc_zt, mf_cloudfrac_zt,& mf_rcm, mf_rcm_nadv, & mf_thlforc_nadv,mf_qtforc_nadv, & - mf_ent, mf_ent_nadv + mf_ent_nadv ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & @@ -2069,7 +2069,9 @@ subroutine clubb_tend_cam( & ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 real(r8) :: cflfac, max_cfl, & - lambda, max_cfl_nadv + lambda, max_cfl_nadv, & + th_sfc + logical :: cfllim real(r8) :: mf_ztop, mf_ztop_nadv, & @@ -2808,6 +2810,9 @@ subroutine clubb_tend_cam( & p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) enddo +!+++ARH + th_sfc = cam_in%ts(i)*invrs_exner_zm(1) +!---ARH end if if (clubb_do_adv) then @@ -2878,11 +2883,9 @@ subroutine clubb_tend_cam( & mf_thlforc_nadv(:pverp) = 0._r8 mf_qtforc_nadv(:pverp) = 0._r8 + mf_ent_nadv(:pverp) = 0._r8 max_cfl_nadv = 0._r8 - - mf_ent(:pverp) = 0._r8 - mf_ent_nadv(:pverp) = 0._r8 end if do t=1,nadv ! do needed number of "sub" timesteps for each CAM step @@ -2934,7 +2937,10 @@ subroutine clubb_tend_cam( & th_zt, qv_zt, qc_zt, & ! input thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input - wpthlp_sfc, wprtp_sfc, pblh(i), & ! input +!+++ARH + !wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input +!---ARH wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics @@ -2975,6 +2981,21 @@ subroutine clubb_tend_cam( & cfllim = .true. if (max_cfl.gt.cflval.and.cfllim) cflfac = cflval/max_cfl + ! Scale microphys so it can't drive qt negative + do k=2,pverp + if ((-1._r8*mf_sqt(k)*dtime) > rtm_in(k)) then + lambda = -1._r8*rtm_in(k)/(mf_sqt(k)*dtime) + mf_sqt(k) = lambda*mf_sqt(k) + mf_sthl(k) = lambda*mf_sthl(k) + end if + end do + + ! Recalculate precip using new microphys forcing + mf_precc(:pverp) = 0._r8 + do k=pverp,2,-1 + mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*mf_sqt(k) + end do + ! pass MF turbulent advection term as CLUBB explicit forcing term rtm_forcing = 0._r8 thlm_forcing = 0._r8 @@ -3001,19 +3022,6 @@ subroutine clubb_tend_cam( & end do - ! Scale rtm_forcing so that rtm doesn't go negative - do k=2,pverp - if ((-1._r8*rtm_forcing(k)*dtime) > rtm_in(k)) then - lambda = -1._r8*rtm_in(k)/(rtm_forcing(k)*dtime) - rtm_forcing(k) = lambda*rtm_forcing(k) - end if - end do - ! Recalculate precip using new forcing - mf_precc(:pverp) = 0._r8 - do k=pverp,2,-1 - mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*rtm_forcing(k) - end do - ! compute ensemble cloud properties mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) @@ -3023,18 +3031,16 @@ subroutine clubb_tend_cam( & mf_precc_nadv = mf_precc_nadv + mf_precc(1)/1000._r8 mf_snow_nadv = 0._r8 - ! accumulate ztop over nadv subcycles + ! accumulate over nadv subcycles mf_L0_nadv = mf_L0_nadv + mf_L0 mf_ztop_nadv = mf_ztop_nadv + mf_ztop mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp) + thlm_forcing(:pverp) mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp) + rtm_forcing(:pverp) + mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + s_awu(:pverp) max_cfl_nadv = MAX(max_cfl,max_cfl_nadv) - - mf_ent(:pverp) = s_awu(:pverp) - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + mf_ent(:pverp) end if ! Advance CLUBB CORE one timestep in the future diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index c53a1f0c70..5d46e962a8 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -116,7 +116,10 @@ subroutine integrate_mf( nz, th, qv, qc, & ! input thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input - wthl, wqt, pblh, & ! input +!+++ARH + !wthl, wqt, pblh, & ! input + ths, wthl, wqt, pblh, & ! input +!---ARH wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input mcape, & ! output upa, & ! output @@ -192,6 +195,9 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv +!+++ARH + real(r8), intent(in) :: ths +!---ARH real(r8), intent(inout) :: ztopm1 real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid @@ -327,7 +333,7 @@ subroutine integrate_mf( nz, ! ! Lower limit on entrainment length scale real(r8),parameter :: min_L0 = 0.5_r8, & - max_L0 = 15.e3_r8 + max_L0 = 10.e3_r8 ! ! limiter for tke enahnced fractional entrainment ! (only used when do_aspd = .true.) @@ -427,8 +433,10 @@ subroutine integrate_mf( nz, zcb = zcb_unset convh = max(pblh,pblhmin) - wthv = wthl+zvir*thv(1)*wqt - +!+++ARH + !wthv = wthl+zvir*thv(1)*wqt + wthv = wthl+zvir*ths*wqt +!---ARH ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then From 646652b4a727a25953c8bf4b3e62d30fcbd5308c Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 15 Mar 2022 08:56:26 -0600 Subject: [PATCH 098/466] implemented max_L0 --- src/physics/cam/clubb_mf.F90 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 5d46e962a8..da4d929aff 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -643,7 +643,15 @@ subroutine integrate_mf( nz, end if ! integrate updraft - eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) +!+++ARH + !eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + if (dynamic_L0 >= max_L0) then + eturb = 1._r8 + else + eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + end if +!---ARH + if (do_aspd) then eturb = min(eturb,max_eturb) end if From 0daf06c05da3730b1c4e4ae680ab425653671dbf Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 15 Mar 2022 10:30:05 -0600 Subject: [PATCH 099/466] added max_L0 namelist --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 ++++++ src/physics/cam/clubb_mf.F90 | 12 +++++++----- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index e1ffe1d7b2..25c939ff3d 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3149,6 +3149,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_a0'); add_default($nl, 'clubb_mf_b0'); add_default($nl, 'clubb_mf_nup'); + add_default($nl, 'clubb_mf_max_L0'); } # Force exit if running cam_dev and CLUBB is off diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 9672cac5f2..b0dceee84d 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1951,6 +1951,7 @@ 2.0 0.5 10 + 10.e3 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 7d75c378e5..76cf709f70 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3933,6 +3933,12 @@ Real: number of plumes in mass flux ensemble Default: 10 + +Real: limiter on entrainmnet length scale + threshold to diable TKE enhanced entrainmnet +Default: 10.e3 + + = max_L0) then + if (dynamic_L0 >= clubb_mf_max_L0) then eturb = 1._r8 else eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) From f6801d3c65bf6e6c45885c1d500ac9273e879d6e Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:12:15 -0600 Subject: [PATCH 100/466] cleaned up rh lopts --- src/physics/cam/clubb_intr.F90 | 44 +++++++++++++++++----------------- src/physics/cam/clubb_mf.F90 | 32 +++++++------------------ 2 files changed, 30 insertions(+), 46 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 475ab85673..8c5e7771f7 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -34,7 +34,7 @@ module clubb_intr use clubb_api_module, only: pdf_parameter, implicit_coefs_terms use clubb_api_module, only: clubb_config_flags_type use cloud_fraction, only: dp1, dp2 - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad + use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad, clubb_mf_Lopt use cam_history_support, only: add_hist_coord #endif @@ -2081,7 +2081,7 @@ subroutine clubb_tend_cam( & real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(pcols) :: rh500 + real(r8), dimension(pcols) :: rhlev real(r8) :: rhinv ! MF local vars @@ -2261,19 +2261,22 @@ subroutine clubb_tend_cam( & call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) end do - ! Interpolate RH to 500 hPa - rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) - call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rh500, & - extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) - - ! Mass of q, by layer and vertically integrated - !mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga - !mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga - !do k=2,pver - ! mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) - ! mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) - !end do - !rh500(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) + rhlev(:ncol) = 0._r8 + if (clubb_mf_Lopt==7) then + ! Interpolate RH to 500 hPa + rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) + call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rhlev, & + extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) + else if (clubb_mf_Lopt==8) then + ! Mass of q, by layer and vertically integrated + mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga + mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga + do k=2,pver + mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) + mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) + end do + rhlev(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) + end if end if ! Initialize the apply_const variable (note special logic is due to eularian backstepping) @@ -2810,9 +2813,9 @@ subroutine clubb_tend_cam( & p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) enddo -!+++ARH + th_sfc = cam_in%ts(i)*invrs_exner_zm(1) -!---ARH + end if if (clubb_do_adv) then @@ -2927,8 +2930,8 @@ subroutine clubb_tend_cam( & !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) rhinv = 0._r8 - if (rh500(i) >= 1._r8) rh500(i) = 0.990_r8 - if (rh500(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rh500(i)) - 1._r8 ) + if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 + if (rhlev(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input @@ -2937,10 +2940,7 @@ subroutine clubb_tend_cam( & th_zt, qv_zt, qc_zt, & ! input thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input -!+++ARH - !wpthlp_sfc, wprtp_sfc, pblh(i), & ! input th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input -!---ARH wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 2f19008e8f..abd6ac0a81 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -23,7 +23,8 @@ module clubb_mf do_clubb_mf, & do_clubb_mf_diag, & clubb_mf_nup, & - do_clubb_mf_rad + do_clubb_mf_rad, & + clubb_mf_Lopt ! ! Lopt 0 = fixed L0 @@ -31,7 +32,9 @@ module clubb_mf ! 2 = wpthlp_clubb L0 ! 3 = test plume L0 ! 4 = lel - ! 5 = cape + ! 5 = ztopm1 + ! 6 = rel.hum. at 500 hPa + ! 7 = column int. rel.hum. integer :: clubb_mf_Lopt = 0 real(r8) :: clubb_mf_a0 = 0._r8 real(r8) :: clubb_mf_b0 = 0._r8 @@ -119,10 +122,7 @@ subroutine integrate_mf( nz, th, qv, qc, & ! input thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input -!+++ARH - !wthl, wqt, pblh, & ! input ths, wthl, wqt, pblh, & ! input -!---ARH wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input mcape, & ! output upa, & ! output @@ -198,9 +198,7 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv -!+++ARH real(r8), intent(in) :: ths -!---ARH real(r8), intent(inout) :: ztopm1 real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid @@ -329,7 +327,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: fdd = 0._r8 ! ! fixed entrainment rate (debug only) - real(r8),parameter :: fixent = 1.e-3_r8 + real(r8),parameter :: fixent = 2.e-4_r8 ! ! Arakawa and Schubert detrainment limiter logical :: do_aspd = .false. @@ -435,10 +433,8 @@ subroutine integrate_mf( nz, zcb = zcb_unset convh = max(pblh,pblhmin) -!+++ARH - !wthv = wthl+zvir*thv(1)*wqt wthv = wthl+zvir*ths*wqt -!---ARH + ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then @@ -535,10 +531,9 @@ subroutine integrate_mf( nz, ztop = ztopm1 dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) !if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 - else if (clubb_mf_Lopt==7) then + else if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==8) then ztop = rhinv dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - !if (masterproc) write(iam+110,*) 'rhinv, dynamic_L0 ', rhinv, dynamic_L0 end if ! limiter to avoid division by zero @@ -680,11 +675,6 @@ subroutine integrate_mf( nz, ! get buoyancy B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) - if (debug) then - if ( masterproc ) then - write(iulog,*) "B(k,i), k, i ", B, k, i - end if - end if if (do_implicit) then wp = clubb_mf_alphturb*wb*ent(k+1,i)*sqrt(0.5_r8*(tke(k+1)+tke(k)))*dzt(k+1) @@ -767,12 +757,6 @@ subroutine integrate_mf( nz, uprr(k-1,i) = uprr(k,i) & - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) - if (debug) then - if ( masterproc ) then - write(iulog,*) "uprr(k,i), k, i ", uprr(k,i), k, i - end if - end if - ! update source terms lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) ! scale autoconv by factor (1-fdd)? From fb2ab32e8a6b626c6e8d403d68fe1ec1b212076e Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:32:54 -0600 Subject: [PATCH 101/466] changed min_L0 calc --- src/physics/cam/clubb_mf.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index f963845a6e..7388fd00c6 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -414,6 +414,12 @@ subroutine integrate_mf( nz, supqt = 0._r8 supthl= 0._r8 +!+++ARH + dynamic_L0 = 0._r8 + ztop = 0._r8 + mcape = 0._r8 +!---ARH + ! unique identifier zcb_unset = 9999999._r8 zcb = zcb_unset From 791ca4e74c3c7e5206f3d48a6d95ba87d063ce9b Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:35:39 -0600 Subject: [PATCH 102/466] remove comment --- src/physics/cam/clubb_mf.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7388fd00c6..b1b6f03e51 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -414,11 +414,9 @@ subroutine integrate_mf( nz, supqt = 0._r8 supthl= 0._r8 -!+++ARH dynamic_L0 = 0._r8 ztop = 0._r8 mcape = 0._r8 -!---ARH ! unique identifier zcb_unset = 9999999._r8 From 48155c5cf4ca84b7941a7873f9c11b3babd6bb72 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:46:19 -0600 Subject: [PATCH 103/466] alternative limiter form --- src/physics/cam/clubb_mf.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index abd6ac0a81..3a6c1b26c3 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -537,8 +537,7 @@ subroutine integrate_mf( nz, end if ! limiter to avoid division by zero - dynamic_L0 = max(min_L0,dynamic_L0) - dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) + dynamic_L0 = min(clubb_mf_max_L0,max(min_L0,dynamic_L0)) if (debug) then ! overide stochastic entrainment with fixent From ed3a29212c530ba632c06b5f3f6a22df6b3137de Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:51:38 -0600 Subject: [PATCH 104/466] hack for PR --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3a6c1b26c3..49517b25e0 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -537,7 +537,7 @@ subroutine integrate_mf( nz, end if ! limiter to avoid division by zero - dynamic_L0 = min(clubb_mf_max_L0,max(min_L0,dynamic_L0)) + dynamic_L0 = max(min_L0,dynamic_L0) if (debug) then ! overide stochastic entrainment with fixent From 32ea2062ccd0a4360ba1c91ead92bd9a217a25a7 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:55:56 -0600 Subject: [PATCH 105/466] mods --- .../usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh | 2 +- cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh index 7e50a3f143..be84f78e6e 100755 --- a/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/make_basecase.auto.csh @@ -20,7 +20,7 @@ set case_lon = "$argv[$n]" set n = 3 set loc_string = "$argv[$n]" -set src=cam.clubbmf.ztopm1 +set src=cam.clubbmf set srcpath=/home/$USER/src set scratchdir=/scratch/cluster/$USER set COMPSET=FSCAM diff --git a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh index 6c0889f239..ad4f31c7b8 100644 --- a/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh +++ b/cime_config/usermods_dirs/scam_STUB/scripts/run_cases.csh @@ -1,6 +1,6 @@ #!/bin/csh -f -set src = cam.clubbmf.ztopm1 +set src = cam.clubbmf set lat = 23.08900523560209 set lon = 205 From e5d52025ace4551b0ed25f93e01c73a1d512921f Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 7 Apr 2022 16:59:00 -0600 Subject: [PATCH 106/466] restored limiter --- src/physics/cam/clubb_mf.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 49517b25e0..abd6ac0a81 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -538,6 +538,7 @@ subroutine integrate_mf( nz, ! limiter to avoid division by zero dynamic_L0 = max(min_L0,dynamic_L0) + dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) if (debug) then ! overide stochastic entrainment with fixent From 3639bd75d0b243659f2880ad14bc86196fc0b5ff Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 12 Apr 2022 10:10:42 -0600 Subject: [PATCH 107/466] removed dead cam64 reference --- bld/build-namelist | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 25c939ff3d..9bf0bcb6e0 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -316,12 +316,6 @@ if ($print>=2) { print "Using namelist defaults file $nl_defaults_file$eol"; } my $defaults = Build::NamelistDefaults->new($nl_defaults_file, $cfg); -# CAMDEV -my $phys_check = $cfg->get('phys'); -if ($phys_check eq 'cam64') { - $cfg->set('phys', 'cam6'); - } - #----------------------------------------------------------------------------------------------- # Similarly to the namelist definition and defaults files, the use case file # may also come from the usr_src directories. Determine the location of the From dc54d3cc54ffa15373b0de7fb2a79f29dc17a652 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 19 Apr 2022 15:29:36 -0600 Subject: [PATCH 108/466] small bugfix for cam_dev --- bld/build-namelist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index 9bf0bcb6e0..763505be59 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -2782,7 +2782,8 @@ if (defined $cam_physpkg) { "This variable is set by build-namelist based on information\n". "from the configure cache file.\n"; } -$cam_physpkg = "'" . "$phys_check" . "'"; # add quotes to this string value + +$cam_physpkg = "'" . "$phys" . "'"; # add quotes to this string value $nl->set_variable_value('phys_ctl_nl', 'cam_physpkg', $cam_physpkg); my $use_simple_phys = $nl->get_value('use_simple_phys'); From df5b52edd22f350f592e38b375b3b1bd68405d32 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 20 Apr 2022 16:44:03 -0600 Subject: [PATCH 109/466] added GOAMAZON and MC3E scam cases --- .../usermods_dirs/scam_GOAMAZON/shell_commands | 16 ++++++++++++++++ .../usermods_dirs/scam_GOAMAZON/user_nl_cam | 16 ++++++++++++++++ .../usermods_dirs/scam_MC3E/shell_commands | 16 ++++++++++++++++ cime_config/usermods_dirs/scam_MC3E/user_nl_cam | 16 ++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100755 cime_config/usermods_dirs/scam_GOAMAZON/shell_commands create mode 100644 cime_config/usermods_dirs/scam_GOAMAZON/user_nl_cam create mode 100755 cime_config/usermods_dirs/scam_MC3E/shell_commands create mode 100644 cime_config/usermods_dirs/scam_MC3E/user_nl_cam diff --git a/cime_config/usermods_dirs/scam_GOAMAZON/shell_commands b/cime_config/usermods_dirs/scam_GOAMAZON/shell_commands new file mode 100755 index 0000000000..890b58c5da --- /dev/null +++ b/cime_config/usermods_dirs/scam_GOAMAZON/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +./xmlchange PTS_LON=300.01 +./xmlchange PTS_LAT=-3.15 + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +./xmlchange RUN_STARTDATE=2014-01-01 +./xmlchange START_TOD=0 +./xmlchange STOP_OPTION=nmonths +./xmlchange STOP_N=3 +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. +./xmlchange ATM_NCPL=72 diff --git a/cime_config/usermods_dirs/scam_GOAMAZON/user_nl_cam b/cime_config/usermods_dirs/scam_GOAMAZON/user_nl_cam new file mode 100644 index 0000000000..ea60e6ef5d --- /dev/null +++ b/cime_config/usermods_dirs/scam_GOAMAZON/user_nl_cam @@ -0,0 +1,16 @@ +iopfile="/glade/work/aherring/grids/vertical-res/SCAM_GOAMAZON/GOAMAZON_iopfile_4scam.nc" +ncdata="$DIN_LOC_ROOT/atm/cam/scam/iop/CESM2.F2000climo.IOP_SITES.cam.i.0003-06-01-00000.nc" +mfilt=2088 +nhtfrq=1 +co2vmr=368.9e-6 +scm_use_obs_uv = .true. +scm_relaxation = .true. +scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' +scm_relax_bot_p = 105000. +scm_relax_top_p = 200. +scm_relax_linear = .true. +scm_relax_tau_bot_sec = 864000. +scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. diff --git a/cime_config/usermods_dirs/scam_MC3E/shell_commands b/cime_config/usermods_dirs/scam_MC3E/shell_commands new file mode 100755 index 0000000000..1773c41e96 --- /dev/null +++ b/cime_config/usermods_dirs/scam_MC3E/shell_commands @@ -0,0 +1,16 @@ +# setup SCAM lon and lat for this iop +# this should correspond to the forcing IOP coordinates +./xmlchange PTS_LON=262.51 +./xmlchange PTS_LAT=36.61 + +# Specify the starting/ending time for the IOP +# The complete time slice of IOP file is specified below +# but you may simulate any within the IOP start and end times. +./xmlchange RUN_STARTDATE=2011-04-22 +./xmlchange START_TOD=0 +./xmlchange STOP_OPTION=ndays +./xmlchange STOP_N=45 +# usermods_dir/scam_mandatory will be included for all single column +# runs by default. This usermods directory contains mandatory settings +# for scam and shouldn't be modified by the user. +./xmlchange ATM_NCPL=72 diff --git a/cime_config/usermods_dirs/scam_MC3E/user_nl_cam b/cime_config/usermods_dirs/scam_MC3E/user_nl_cam new file mode 100644 index 0000000000..9c7de0c22e --- /dev/null +++ b/cime_config/usermods_dirs/scam_MC3E/user_nl_cam @@ -0,0 +1,16 @@ +iopfile="/glade/work/aherring/grids/vertical-res/SCAM_MC3E/MC3E_iopfile_4scam.nc" +ncdata="$DIN_LOC_ROOT/atm/cam/scam/iop/CESM2.F2000climo.IOP_SITES.cam.i.0003-06-01-00000.nc" +mfilt=2088 +nhtfrq=1 +co2vmr=368.9e-6 +scm_use_obs_uv = .true. +scm_relaxation = .true. +scm_relax_fincl = 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', + 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', + 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' +scm_relax_bot_p = 105000. +scm_relax_top_p = 200. +scm_relax_linear = .true. +scm_relax_tau_bot_sec = 864000. +scm_relax_tau_top_sec = 172800. +scm_iop_lhflxshflxtg = .true. From 168e94180149ba73958a6f9b177f3d6d96e31db9 Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 6 May 2022 12:13:13 -0600 Subject: [PATCH 110/466] first commit --- src/physics/cam/clubb_intr.F90 | 22 +- src/physics/cam/clubb_mf.F90 | 543 +++++++++++++++++++++++---------- 2 files changed, 395 insertions(+), 170 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 8c5e7771f7..6b01607a0e 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1329,12 +1329,14 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) call addfld ( 'edmf_upw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_upmf' , (/ 'ilev', 'nens' /), 'A', 'kg/m2/s' , 'Plume updraft mass flux (EDMF)' ) call addfld ( 'edmf_upqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) call addfld ( 'edmf_upthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) call addfld ( 'edmf_upthv' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) call addfld ( 'edmf_upth' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) call addfld ( 'edmf_upqc' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft entrainment rate (EDMF)' ) + call addfld ( 'edmf_updet' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft dettrainment rate (EDMF)' ) call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) end if @@ -2010,22 +2012,26 @@ subroutine clubb_tend_cam( & ! MF plume level outputs real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & mf_upw_flip, & + mf_upmf_flip, & mf_upqt_flip, & mf_upthl_flip, & mf_upthv_flip, & mf_upth_flip, & mf_upqc_flip, & mf_upbuoy_flip, & - mf_upent_flip + mf_upent_flip, & + mf_updet_flip ! MF plume level outputs to outfld real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & mf_upw_output, & + mf_upmf_output, & mf_upqt_output, & mf_upthl_output, & mf_upthv_output, & mf_upth_output, & mf_upqc_output, & mf_upent_output, & + mf_updet_output, & mf_upbuoy_output ! MF Plume real(r8), pointer :: tpert(:) @@ -2058,12 +2064,14 @@ subroutine clubb_tend_cam( & ! MF plume level real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & mf_upw, & + mf_upmf, & mf_upqt, & mf_upthl, & mf_upthv, & mf_upth, & mf_upqc, & mf_upbuoy, & + mf_updet, & mf_upent ! CFL limiter vars @@ -2510,6 +2518,7 @@ subroutine clubb_tend_cam( & s_awv_output(:,:) = 0._r8 mf_upa_output(:,:) = 0._r8 mf_upw_output(:,:) = 0._r8 + mf_upmf_output(:,:) = 0._r8 mf_upqt_output(:,:) = 0._r8 mf_upthl_output(:,:) = 0._r8 mf_upthv_output(:,:) = 0._r8 @@ -2517,8 +2526,10 @@ subroutine clubb_tend_cam( & mf_upqc_output(:,:) = 0._r8 mf_upbuoy_output(:,:) = 0._r8 mf_upent_output(:,:) = 0._r8 + mf_updet_output(:,:) = 0._r8 mf_upa_flip(:,:,:) = 0._r8 mf_upw_flip(:,:,:) = 0._r8 + mf_upmf_flip(:,:,:) = 0._r8 mf_upqt_flip(:,:,:) = 0._r8 mf_upthl_flip(:,:,:) = 0._r8 mf_upthv_flip(:,:,:) = 0._r8 @@ -2526,6 +2537,7 @@ subroutine clubb_tend_cam( & mf_upqc_flip(:,:,:) = 0._r8 mf_upbuoy_flip(:,:,:) = 0._r8 mf_upent_flip(:,:,:) = 0._r8 + mf_updet_flip(:,:,:) = 0._r8 mf_thlflx_output(:,:) = 0._r8 mf_thvflx_output(:,:) = 0._r8 mf_qtflx_output(:,:) = 0._r8 @@ -2945,6 +2957,7 @@ subroutine clubb_tend_cam( & mf_cape_output(i), & ! output - plume diagnostics mf_upa, & ! output - plume diagnostics mf_upw, & ! output - plume diagnostics + mf_upmf, & ! output - plume diagnostics mf_upqt, & ! output - plume diagnostics mf_upthl, & ! output - plume diagnostics mf_upthv, & ! output - plume diagnostics @@ -2952,6 +2965,7 @@ subroutine clubb_tend_cam( & mf_upqc, & ! output - plume diagnostics mf_upbuoy, & ! output - plume diagnostics mf_upent, & ! output - plume diagnostics + mf_updet, & ! output - plume diagnostics mf_dry_a, mf_moist_a, & ! output - plume diagnostics mf_dry_w, mf_moist_w, & ! output - plume diagnostics mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics @@ -3277,12 +3291,14 @@ subroutine clubb_tend_cam( & mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(k,:clubb_mf_nup) mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) + mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) end if @@ -3297,12 +3313,14 @@ subroutine clubb_tend_cam( & do k=1,clubb_mf_nup mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k) = mf_upbuoy_flip(i,:pverp,k) end do end if @@ -4099,6 +4117,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) + call outfld( 'edmf_upmf' , mf_upmf_output, pcols, lchnk ) call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) @@ -4106,6 +4125,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) + call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index abd6ac0a81..3338bb6067 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -32,9 +32,10 @@ module clubb_mf ! 2 = wpthlp_clubb L0 ! 3 = test plume L0 ! 4 = lel - ! 5 = ztopm1 - ! 6 = rel.hum. at 500 hPa - ! 7 = column int. rel.hum. + ! 4 = cape + ! 6 = ztopm1 + ! 7 = rel.hum. at 500 hPa + ! 8 = column int. rel.hum. integer :: clubb_mf_Lopt = 0 real(r8) :: clubb_mf_a0 = 0._r8 real(r8) :: clubb_mf_b0 = 0._r8 @@ -127,13 +128,15 @@ subroutine integrate_mf( nz, mcape, & ! output upa, & ! output upw, & ! output + upmf, & ! output upqt, & ! output upthl, & ! output upthv, & ! output upth, & ! output upqc, & ! output upbuoy, & ! output - ent, & ! output + upent, & ! output + updet, & ! output dry_a, moist_a, & ! output dry_w, moist_w, & ! output dry_qt, moist_qt, & ! output @@ -177,7 +180,7 @@ subroutine integrate_mf( nz, ! Additional modifications by Adam Herrington, NCAR ! ! ================================================================================= ! - use physconst, only: rair, cpair, gravit, latvap, latice, zvir + use wv_saturation, only : qsat integer, intent(in) :: nz real(r8), dimension(nz), intent(in) :: u, v, & ! thermodynamic grid @@ -203,13 +206,15 @@ subroutine integrate_mf( nz, real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid + upmf, & ! momentum grid upqt, & ! momentum grid upthl, & ! momentum grid upthv, & ! momentum grid upth, & ! momentum grid upqc, & ! momentum grid upbuoy, & ! momentum grid - ent + upent, & ! momentum grid + updet real(r8),dimension(nz), intent(out) :: dry_a, moist_a, & ! momentum grid dry_w, moist_w, & ! momentum grid @@ -254,7 +259,7 @@ subroutine integrate_mf( nz, uprr ! thermodynamic grid ! ! entrainment profiles - real(r8), dimension(nz,clubb_mf_nup) :: entf ! thermodynamic grid + real(r8), dimension(nz,clubb_mf_nup) :: entf, mix ! thermodynamic grid integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid ! ! other variables @@ -296,7 +301,22 @@ subroutine integrate_mf( nz, real(r8) :: landfrac integer :: kpbl, msg, & lon, mx - + ! + ! buoyancy sorting variables + real(r8) :: tlm, excessm, qsm, & + tln, excessn, es, & + xc, xsat, x_en, & + x_cu, xs1, xs2, & + aquad, bquad, cquad, & + thlxsat, thvxsat, qtxsat, & + thv_x0, thv_x1, cridis, & + thln0, qtn0, wn0, & + entn, detn, mfn, & + ee2, ud2 + integer :: kk, status, iter_xc + real(r8),parameter :: amax = 0.6_r8 + real(r8),parameter :: rle = 0.1_r8 + integer,parameter :: niter_xc = 3 ! ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & @@ -326,8 +346,11 @@ subroutine integrate_mf( nz, ! fraction of rain detrained into downdrafts real(r8),parameter :: fdd = 0._r8 ! - ! fixed entrainment rate (debug only) - real(r8),parameter :: fixent = 2.e-4_r8 + ! to fix entrainmnet rate + logical :: fixent = .true. + ! + ! fixed entrainment rate + real(r8),parameter :: fixent_ent = 2.e-4_r8 ! ! Arakawa and Schubert detrainment limiter logical :: do_aspd = .false. @@ -350,9 +373,6 @@ subroutine integrate_mf( nz, ! ! to scale surface fluxes logical :: scalesrf = .false. - ! - ! to debug flag - logical :: debug = .false. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -392,9 +412,10 @@ subroutine integrate_mf( nz, qvflx = 0._r8 qcflx = 0._r8 - ent = 0._r8 + mix = 0._r8 entf = 0._r8 enti = 0 + det = 0._r8 cape = 0._r8 mcape = 0._r8 dmpdz = 0._r8 @@ -410,6 +431,7 @@ subroutine integrate_mf( nz, upthv = 0._r8 upqt = 0._r8 upa = 0._r8 + upmf = 0._r8 upu = 0._r8 upv = 0._r8 upqc = 0._r8 @@ -423,6 +445,8 @@ subroutine integrate_mf( nz, uprr = 0._r8 supqt = 0._r8 supthl= 0._r8 + upent = 0._r8 + updet = 0._r8 dynamic_L0 = 0._r8 ztop = 0._r8 @@ -438,7 +462,11 @@ subroutine integrate_mf( nz, ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then - ! get surface conditions + ! --------------------------------------------------------- ! + ! Construct PDF at the surface from surface fluxes ! + ! and initialize plume thv, qt, w ! + ! --------------------------------------------------------- ! + wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) qstar = wqt / wstar thvstar = wthv / wstar @@ -450,10 +478,79 @@ subroutine integrate_mf( nz, wmin = sigmaw * pwmin wmax = sigmaw * pwmax + do i=1,clubb_mf_nup + wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) + wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) + + upw(1,i) = 0.5_r8 * (wlv+wtv) + upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & + - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) + + upmf(1,i)= rho_zm(1)*upa(1,i)*upw(1,i) + + upu(1,i) = u(1) + upv(1,i) = v(1) + + upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw + upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw + enddo + + facqtu=1._r8 + facthvu=1._r8 + if (scalesrf) then + ! scale surface fluxes + srfwqtu = 0._r8 + srfwthvu = 0._r8 + srfarea = 0._r8 + do i=1,clubb_mf_nup + srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) + srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) + srfarea = srfarea+upa(1,i) + end do + facqtu=srfarea*wqt/srfwqtu + facthvu=srfarea*wthv/srfwthvu + end if + + do i=1,clubb_mf_nup + + if (pupwind) then + betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) + upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + else + upqt(1,i)=qt(1)+facqtu*upqt(1,i) + upthv(1,i)=thv(1)+facthvu*upthv(1,i) + end if + upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) + upth(1,i) = upthl(1,i) + + ! get cloud, lowest momentum level + if (do_condensation) then + call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + upthv(1,i) = thvn + upqc(1,i) = qcn + upql(1,i) = qln + upqi(1,i) = qin + upqs(1,i) = qsn + upth(1,i) = thn + if (qcn > 0._r8) zcb(i) = zm(1) + else + ! assume no cldliq + upqc(1,i) = 0._r8 + end if + end do + + ! --------------------------------------------------------- ! + ! Calculate dynamic_L based on value of namelist ! + ! should probably make into a subroutine ! + ! --------------------------------------------------------- ! + if (clubb_mf_Lopt==0) then !Constant L0 dynamic_L0 = clubb_mf_L0 - ztop = 0._r8 + ztop = clubb_mf_L0 else if (clubb_mf_Lopt==1) then !TKE do k=nz-2,2,-1 @@ -540,157 +637,198 @@ subroutine integrate_mf( nz, dynamic_L0 = max(min_L0,dynamic_L0) dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) - if (debug) then - ! overide stochastic entrainment with fixent - ent(:,:) = fixent - else - - ! get entrainment coefficient, dz/L0 - do i=1,clubb_mf_nup - do k=1,nz - entf(k,i) = dzt(k) / dynamic_L0 - enddo - enddo - - ! get poisson, P(dz/L0) - call poisson( nz, clubb_mf_nup, entf, enti, u(2:5)) - - ! get entrainment, ent=ent0/dz*P(dz/L0) - do i=1,clubb_mf_nup - do k=1,nz - ent(k,i) = real( enti(k,i))*clubb_mf_ent0/dzt(k) - enddo - enddo - end if - + ! --------------------------------------------------------- ! + ! Main upward sweep to compute updraft properties ! + ! ! + ! --------------------------------------------------------- ! do i=1,clubb_mf_nup - wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) - wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) - - upw(1,i) = 0.5_r8 * (wlv+wtv) - upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & - - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) + do k=1,nz-1 - upu(1,i) = u(1) - upv(1,i) = v(1) + do iter_xc = 1, niter_xc - upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw - upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw - enddo + if (iter_xc==1) then + qtn = upqt(k,i) + thln = upthl(k,i) + wn = upw(k,i) + else + qtn = 0.5_r8*(qtn + qtn0) + thln = 0.5_r8*(thln + thln0) + wn = 0.5_r8*(wn + wn0) + end if - facqtu=1._r8 - facthvu=1._r8 - if (scalesrf) then - ! scale surface fluxes - srfwqtu = 0._r8 - srfwthvu = 0._r8 - srfarea = 0._r8 - do i=1,clubb_mf_nup - srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) - srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) - srfarea = srfarea+upa(1,i) - end do - facqtu=srfarea*wqt/srfwqtu - facthvu=srfarea*wthv/srfwthvu - end if + ! --------------------------------------------------------- ! + ! Compute excess water to derive neutral mixing fraction ! + ! after Bretherton et al 2014 ! + ! --------------------------------------------------------- ! - do i=1,clubb_mf_nup + ! qexcess of the envrionment + tlm = thl_zm(k+1)/iexner_zm(k+1) + call qsat(tlm,p_zm(k+1),es,qsm) + excessm = qt_zm(k+1) - qsm - if (pupwind) then - betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) - upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) - else - upqt(1,i)=qt(1)+facqtu*upqt(1,i) - upthv(1,i)=thv(1)+facthvu*upthv(1,i) - end if - upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) - upth(1,i) = upthl(1,i) + ! qexcess in plume + tln = thln/iexner_zm(k+1) + call qsat(tln,p_zm(k+1),es,qsn) + excessn = qtn - qsn - ! get cloud, lowest momentum level - if (do_condensation) then - call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - upthv(1,i) = thvn - upqc(1,i) = qcn - upql(1,i) = qln - upqi(1,i) = qin - upqs(1,i) = qsn - upth(1,i) = thn - if (qcn > 0._r8) zcb(i) = zm(1) - else - ! assume no cldliq - upqc(1,i) = 0._r8 - end if - end do + call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) - ! get updraft properties - do i=1,clubb_mf_nup - do k=1,nz-1 + ! critical stopping distance + cridis = rle*ztopm1 + + ! ----------------------------------------------------------------- ! + ! Case 1 : When both cumulus and env. are unsaturated or saturated. ! + ! ----------------------------------------------------------------- ! + if (excessm*excessn > 0._r8) then + xc = min(1._r8,max(0._r8,1._r8-2._r8*wa*gravit*cridis/wn**2._r8*(1._r8-thvn/thv_zm(k+1)))) + aquad = 0._r8 + bquad = 0._r8 + cquad = 0._r8 + else + ! -------------------------------------------------- ! + ! Case 2 : When either cumulus or env. is saturated. ! + ! -------------------------------------------------- ! + xsat = excessn / ( excessn - excessm ); + thlxsat = thln + xsat * ( thl_zm(k+1) - thln ); + qtxsat = qtn + xsat * ( qt_zm(k+1) - qtn ); + call condensation_mf(qtxsat, thlxsat, p_zm(k+1), iexner_zm(k+1), & + thvxsat, qcn, thn, qln, qin, qsn, lmixn) + ! -------------------------------------------------- ! + ! kk=1 : Cumulus Segment, kk=2 : Environment Segment ! + ! -------------------------------------------------- ! + do kk = 1, 2 + if( kk .eq. 1 ) then + thv_x0 = thvn + thv_x1 = ( 1._r8 - 1._r8/xsat ) * thvn + ( 1._r8/xsat ) * thvxsat + else + thv_x1 = thv_zm(k+1) + thv_x0 = ( xsat / ( xsat - 1._r8 ) ) * thv_zm(k+1) + ( 1._r8/( 1._r8 - xsat ) ) * thvxsat + endif + aquad = wn**2 + bquad = 2._r8*wa*gravit*cridis*(thv_x1 - thv_x0)/thv_zm(k+1) - 2._r8*wn**2 + cquad = 2._r8*wa*gravit*cridis*(thv_x0 - thv_zm(k+1))/thv_zm(k+1) + wn**2 + if( kk .eq. 1 ) then + if( ( bquad**2-4._r8*aquad*cquad ) .ge. 0._r8 ) then + call roots(aquad,bquad,cquad,xs1,xs2,status) + x_cu = min(1._r8,max(0._r8,min(xsat,min(xs1,xs2)))) + else + x_cu = xsat + endif + else + if( ( bquad**2-4._r8*aquad*cquad) .ge. 0._r8 ) then + call roots(aquad,bquad,cquad,xs1,xs2,status) + x_en = min(1._r8,max(0._r8,max(xsat,min(xs1,xs2)))) + else + x_en = 1._r8 + endif + endif + enddo + if( x_cu .eq. xsat ) then + xc = max(x_cu, x_en) + else + xc = x_cu + endif + endif + + if (iter_xc==1) then + if (fixent) then + !mix(k+1,i) = fixent_ent + mix(k+1,i) = 7._r8/zt(k+1) + else + ! --------------------------------------------------------- ! + ! Stochastic entrainmnet calculation ! + ! From Suselj et al 2019, after Romps and Kuang 2010 ! + ! --------------------------------------------------------- ! + + ! get entrainment coefficient, dz/L0 + entf(k+1,i) = dzt(k+1) / dynamic_L0 + + ! get poisson, P(dz/L0) + call poisson( 1, 1, entf(k+1,i), enti(k+1,i), u(2:5)) + + ! get entrainment, ent=ent0/dz*P(dz/L0) + mix(k+1,i) = real( enti(k+1,i))*clubb_mf_ent0/dzt(k+1) + end if + end if - ! get microphysics, autoconversion - if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then - call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) + ee2 = xc**2 + ud2 = 1._r8 - 2._r8*xc + xc**2 - supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair - else - supqt(k+1,i) = 0._r8 - supthl(k+1,i) = 0._r8 - end if + entn = mix(k+1,i) * ee2 + detn = mix(k+1,i) * ud2 + mfn = upmf(k,i)*exp( dzt(k+1)*( entn - detn )) - ! integrate updraft + ! --------------------------------------------------------- ! + ! TKE enhanced entrainment ! + ! switches off when dynamic_L0 > max_L0 ! + ! --------------------------------------------------------- ! !+++ARH - !eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) - if (dynamic_L0 >= clubb_mf_max_L0) then - eturb = 1._r8 - else - eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) - end if + !if (dynamic_L0 >= clubb_mf_max_L0) then + eturb = 1._r8 + !else + ! eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + !end if + !if (do_aspd) eturb = min(eturb,max_eturb) !---ARH - if (do_aspd) then - eturb = min(eturb,max_eturb) - end if - entexp = exp(-ent(k+1,i)*eturb*dzt(k+1)) - entexpu = exp(-ent(k+1,i)*dzt(k+1)/3._r8) + ! get microphysics, autoconversion + ! (pls double-check this routine) + if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then + call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) + supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair + else + supqt(k+1,i) = 0._r8 + supthl(k+1,i) = 0._r8 + end if - qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) - thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) - un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu - vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu + ! integrate updraft + entexp = exp(-entn*eturb*dzt(k+1)) + entexpu = exp(-entn*dzt(k+1)/3._r8) - ! convert source terms to a tendency - supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) - supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) + qtn0 = qtn + thln0 = thln - ! get cloud, momentum levels - if (do_condensation) then - call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - if (zcb(i).eq.zcb_unset .and. qcn > 0._r8) zcb(i) = zm(k+1) - else - thvn = thln*(1._r8+zvir*qtn) - end if + qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) + thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) + un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu + vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu - ! get buoyancy - B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) + ! convert source terms to a tendency + supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) + supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) - if (do_implicit) then - wp = clubb_mf_alphturb*wb*ent(k+1,i)*sqrt(0.5_r8*(tke(k+1)+tke(k)))*dzt(k+1) - wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1))* & - (upw(k,i)**2._r8 + 2._r8*wa*B*dzt(k+1))) )/(1._r8 + 2._r8*wb*ent(k+1,i)*dzt(k+1)) - else - ! get wn2 - wp = wb*ent(k+1,i)*eturb - if (wp==0._r8) then - wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) + ! get cloud, momentum levels + if (do_condensation) then + call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + if (zcb(i).eq.zcb_unset .and. qcn > 0._r8) zcb(i) = zm(k+1) else - entw = exp(-2._r8*wp*dzt(k+1)) - wn2 = entw*upw(k,i)**2._r8+(1._r8-entw)*wa*B/wp + thvn = thln*(1._r8+zvir*qtn) end if - wn = sqrt(max(wn2, 0._r8)) - end if + + ! get buoyancy + B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) + + wn0 = wn + + if (do_implicit) then + wp = clubb_mf_alphturb*wb*entn*sqrt(0.5_r8*(tke(k+1)+tke(k)))*dzt(k+1) + wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*entn*dzt(k+1))* & + (upw(k,i)**2._r8 + 2._r8*wa*B*dzt(k+1))) )/(1._r8 + 2._r8*wb*entn*dzt(k+1)) + else + ! get wn2 + wp = wb*entn*eturb + if (wp==0._r8) then + wn2 = upw(k,i)**2._r8+2._r8*wa*B*dzt(k+1) + else + entw = exp(-2._r8*wp*dzt(k+1)) + wn2 = entw*upw(k,i)**2._r8+(1._r8-entw)*wa*B/wp + end if + wn = sqrt(max(wn2, 0._r8)) + end if + + end do !iter_xc if (wn>0._r8) then upw(k+1,i) = wn @@ -701,7 +839,9 @@ subroutine integrate_mf( nz, upqs(k+1,i) = qsn upu(k+1,i) = un upv(k+1,i) = vn - upa(k+1,i) = upa(k,i) + upa(k+1,i) = upmf(k+1,i)/(wn*rho_zm(k+1)) + upent(k+1,i) = entn + updet(k+1,i) = detn upql(k+1,i) = qln upqi(k+1,i) = qin upqv(k+1,i) = qtn - qcn @@ -709,33 +849,53 @@ subroutine integrate_mf( nz, upth(k+1,i) = thn upbuoy(k+1,i)= B else - ent(k+2:nz,i) = 0._r8 exit end if enddo enddo - if (do_aspd) then - do k=1,nz-1 - do i=1,clubb_mf_nup - ! - if (upw(k+1,i)>0._r8) then - ! diagnose detrainment - Mn = rho_zm(k)*upa(k,i)*upw(k,i) - det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & - /(Mn*dzt(k+1)) - if (det < 0._r8) then - ! diagnose area to eliminate detrainment and conserve mass - Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) - upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) - end if - ! - end if - ac(k+1) = ac(k+1) + upa(k+1,i) - ! - end do + ! --------------------------------------------------------- ! + ! Limit total convective area ! + ! (in future compute a mass conserving detrainment rate) ! + ! --------------------------------------------------------- ! + do k=1,nz-1 + do i=1,clubb_mf_nup + ! + ac(k) = ac(k) + upa(k,i) + ! end do - end if + if (ac(k) > amax) then + upa(k,:) = upa(k,:)*amax/ac(k) + end if + end do + + ! --------------------------------------------------------- ! + ! AS.pd limiter ! + ! (likley incosistent with buoyancy sorting algorithm) ! + ! --------------------------------------------------------- ! +!+++ARH +! if (do_aspd) then +! do k=1,nz-1 +! do i=1,clubb_mf_nup +! ! +! if (upw(k+1,i)>0._r8) then +! ! diagnose detrainment +! Mn = rho_zm(k)*upa(k,i)*upw(k,i) +! det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & +! /(Mn*dzt(k+1)) +! if (det < 0._r8) then +! ! diagnose area to eliminate detrainment and conserve mass +! Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) +! upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) +! end if +! ! +! end if +! ac(k+1) = ac(k+1) + upa(k+1,i) +! ! +! end do +! end do +! end if +!---ARH ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then @@ -840,7 +1000,7 @@ subroutine integrate_mf( nz, sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) ! hack awu to contain ensemble entrainment - awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*ent(k,i) + awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*mix(k,i) end if enddo ! hack awu to contain ensemble entrainment @@ -1212,6 +1372,51 @@ subroutine hormann(kiss_gen,lambda,kout) end subroutine hormann + subroutine roots(a,b,c,r1,r2,status) + ! --------------------------------------------------------- ! + ! Subroutine to solve the second order polynomial equation. ! + ! after uwshcu.F90 ! + ! --------------------------------------------------------- ! + real(r8), intent(in) :: a + real(r8), intent(in) :: b + real(r8), intent(in) :: c + real(r8), intent(out) :: r1 + real(r8), intent(out) :: r2 + integer , intent(out) :: status + real(r8) :: q + + status = 0 + + if( a .eq. 0._r8 ) then ! Form b*x + c = 0 + if( b .eq. 0._r8 ) then ! Failure: c = 0 + status = 1 + else ! b*x + c = 0 + r1 = -c/b + endif + r2 = r1 + else + if( b .eq. 0._r8 ) then ! Form a*x**2 + c = 0 + if( a*c .gt. 0._r8 ) then ! Failure: x**2 = -c/a < 0 + status = 2 + else ! x**2 = -c/a + r1 = sqrt(-c/a) + endif + r2 = -r1 + else ! Form a*x**2 + b*x + c = 0 + if( (b**2 - 4._r8*a*c) .lt. 0._r8 ) then ! Failure, no real roots + status = 3 + else + q = -0.5_r8*(b + sign(1.0_r8,b)*sqrt(b**2 - 4._r8*a*c)) + r1 = q/a + r2 = c/q + endif + endif + endif + + return + + end subroutine roots + subroutine oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & wa, wb, tke, do_condensation, do_precip, plumeheight ) From 585365d3e6fc35cf691f43dc393e6d5249950e7a Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 21 Jul 2022 15:43:14 -0600 Subject: [PATCH 111/466] first commit --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3338bb6067..8500a5e464 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -344,7 +344,7 @@ subroutine integrate_mf( nz, real(r8),parameter :: ke = 2.5e-4_r8 ! ! fraction of rain detrained into downdrafts - real(r8),parameter :: fdd = 0._r8 + real(r8),parameter :: fdd = 0.5_r8 ! ! to fix entrainmnet rate logical :: fixent = .true. From 7af67dabd18664f52ed895c1c31f0a311acba542 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 21 Jul 2022 18:43:33 -0600 Subject: [PATCH 112/466] basic downdraft code implemented. It builds, but likely full of bugs --- src/physics/cam/clubb_intr.F90 | 36 ++++---- src/physics/cam/clubb_mf.F90 | 157 ++++++++++++++++++++++++++++++--- 2 files changed, 163 insertions(+), 30 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 6b01607a0e..204166ecdf 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2062,17 +2062,17 @@ subroutine clubb_tend_cam( & mf_ent_nadv ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, & - mf_upw, & - mf_upmf, & - mf_upqt, & - mf_upthl, & - mf_upthv, & - mf_upth, & - mf_upqc, & - mf_upbuoy, & - mf_updet, & - mf_upent + real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + mf_upw, mf_dnw, & + mf_upmf, & + mf_upqt, mf_dnqt, & + mf_upthl, mf_dnthl, & + mf_upthv, mf_dnthv, & + mf_upth, mf_dnth, & + mf_upqc, mf_dnqc, & + mf_upbuoy, & + mf_updet, & + mf_upent ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 @@ -2955,14 +2955,14 @@ subroutine clubb_tend_cam( & th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input mf_cape_output(i), & ! output - plume diagnostics - mf_upa, & ! output - plume diagnostics - mf_upw, & ! output - plume diagnostics + mf_upa, mf_dna, & ! output - plume diagnostics + mf_upw, mf_dnw, & ! output - plume diagnostics mf_upmf, & ! output - plume diagnostics - mf_upqt, & ! output - plume diagnostics - mf_upthl, & ! output - plume diagnostics - mf_upthv, & ! output - plume diagnostics - mf_upth, & ! output - plume diagnostics - mf_upqc, & ! output - plume diagnostics + mf_upqt, mf_dnqt, & ! output - plume diagnostics + mf_upthl, mf_dnthl, & ! output - plume diagnostics + mf_upthv, mf_dnthv, & ! output - plume diagnostics + mf_upth, mf_dnth, & ! output - plume diagnostics + mf_upqc, mf_dnqc, & ! output - plume diagnostics mf_upbuoy, & ! output - plume diagnostics mf_upent, & ! output - plume diagnostics mf_updet, & ! output - plume diagnostics diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 8500a5e464..08597f9479 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -126,14 +126,14 @@ subroutine integrate_mf( nz, ths, wthl, wqt, pblh, & ! input wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input mcape, & ! output - upa, & ! output - upw, & ! output + upa, dna, & ! output + upw, dnw, & ! output upmf, & ! output - upqt, & ! output - upthl, & ! output - upthv, & ! output - upth, & ! output - upqc, & ! output + upqt, dnqt, & ! output + upthl, dnthl, & ! output + upthv, dnthv, & ! output + upth, dnth, & ! output + upqc, dnqc, & ! output upbuoy, & ! output upent, & ! output updet, & ! output @@ -216,6 +216,14 @@ subroutine integrate_mf( nz, upent, & ! momentum grid updet + real(r8),dimension(nz,clubb_mf_nup), intent(out) :: dna, & ! momentum grid + dnw, & ! momentum grid + dnqt, & ! momentum grid + dnthl, & ! momentum grid + dnthv, & ! momentum grid + dnth, & ! momentum grid + dnqc + real(r8),dimension(nz), intent(out) :: dry_a, moist_a, & ! momentum grid dry_w, moist_w, & ! momentum grid dry_qt, moist_qt, & ! momentum grid @@ -252,18 +260,25 @@ subroutine integrate_mf( nz, real(r8), dimension(nz,clubb_mf_nup) :: upqv, upqs, & ! momentum grid upql, upqi, & ! momentum grid upu, upv, & ! momentum grid - uplmix ! momentum grid + uplmix, upauto ! momentum grid + ! + ! downdraft properties + real(r8), dimension(nz,clubb_mf_nup) :: dnqs, & ! momentum grid + dnql, dnqi, & ! momentum grid + dnu, dnv, & ! momentum grid + dnlmix ! momentum grid ! ! microphyiscs terms real(r8), dimension(nz,clubb_mf_nup) :: supqt, supthl, & ! thermodynamic grid - uprr ! thermodynamic grid + sdnqt, sdnthl, & ! thermodynamic grid + uprr, dnrr ! ! entrainment profiles real(r8), dimension(nz,clubb_mf_nup) :: entf, mix ! thermodynamic grid integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid ! ! other variables - integer :: k,i,kstart + integer :: k,i,kstart,ddtop real(r8), dimension(clubb_mf_nup) :: zcb real(r8) :: zcb_unset, & wthv, & @@ -373,6 +388,10 @@ subroutine integrate_mf( nz, ! ! to scale surface fluxes logical :: scalesrf = .false. + ! + ! minimum downdraft speed + real(r8),parameter :: mindnw = 1.E-2_r8 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -447,6 +466,25 @@ subroutine integrate_mf( nz, supthl= 0._r8 upent = 0._r8 updet = 0._r8 + upauto= 0._r8 + + dnw = 0._r8 + dna = 0._r8 + dnu = 0._r8 + dnv = 0._r8 + dnqt = 0._r8 + dnthl = 0._r8 + dnthv = 0._r8 + dnrr = 0._r8 + dnth = 0._r8 + dnqc = 0._r8 + dnql = 0._r8 + dnqi = 0._r8 + dnqs = 0._r8 + dnlmix= 0._r8 + sdnqt = 0._r8 + sdnthl= 0._r8 + dnw = 0._r8 dynamic_L0 = 0._r8 ztop = 0._r8 @@ -733,8 +771,7 @@ subroutine integrate_mf( nz, if (iter_xc==1) then if (fixent) then - !mix(k+1,i) = fixent_ent - mix(k+1,i) = 7._r8/zt(k+1) + mix(k+1,i) = fixent_ent else ! --------------------------------------------------------- ! ! Stochastic entrainmnet calculation ! @@ -777,9 +814,12 @@ subroutine integrate_mf( nz, if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair + ! save autoconversion for use in downdrafts + upauto(k+1,i) = supqt(k+1,i) else supqt(k+1,i) = 0._r8 supthl(k+1,i) = 0._r8 + upauto(k+1,i) = 0._r8 end if ! integrate updraft @@ -926,6 +966,99 @@ subroutine integrate_mf( nz, end do end if + ! begin computing downdrafts + if (do_clubb_mf_precip .and. fdd > 0._r8) then + + do i=1,clubb_mf_nup + + ddtop = 0 + do k = 1,nz + if (uprr(k,i) > 0._r8) ddtop = k + end do + + if (ddtop /= 0) then + ! initilaize downdrafts + dnw(ddtop,i) = -1._r8*upw(ddtop,i) + dna(ddtop,i) = upa(ddtop,i) + dnu(ddtop,i) = 0.5_r8*(u(ddtop)+u(ddtop+1)) + dnv(ddtop,i) = 0.5_r8*(v(ddtop)+v(ddtop+1)) + dnqt(ddtop,i) = qt_zm(ddtop) + dnthl(ddtop,i) = thl_zm(ddtop) + dnthv(ddtop,i) = thv_zm(ddtop) + dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*supqt(ddtop,i)*fdd + + call condensation_mf(dnqt(ddtop,i), dnthl(ddtop,i), p_zm(ddtop), iexner_zm(ddtop), & + dnthv(ddtop,i), dnqc(ddtop,i), dnth(ddtop,i), dnql(ddtop,i), dnqi(ddtop,i), & + dnqs(ddtop,i), dnlmix(ddtop,i)) + + do k = ddtop-1,1,-1 + + ! assume fixed area + dna(k,i) = dna(k+1,i) + + ! get rain evaporation + qtovqs = min(1._r8,dnqt(k+1,i)/dnqs(k+1,i)) + sevap = ke*(1._r8 - qtovqs)*sqrt(max(dnrr(k+1,i),0._r8)) + + ! limit evaporation to available precip + sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k)*dzt(k)) - upauto(k+1,i)*(1._r8-fdd) )) + + ! compute rain rate + dnrr(k,i) = dnrr(k+1,i) & + - rho_zt(k)*dzt(k)*(sevap + upauto(k+1,i)*fdd) + dnrr(i,k) = max(dnrr(i,k),0.) + + ! save microphysics tendenices + sdnqt(k,i) = sevap + sdnthl(k,i) = -1._r8*lmixt*sevap*iexner_zt(k)/cpair + + if (fixent) then + entn = fixent_ent + else + ! use deterministic mean entrainment + entn = clubb_mf_ent0/dynamic_L0 + end if + + ! include eturb? + entexp = exp(-entn*eturb*dzt(k)) + entexpu = exp(-entn*dzt(k)/3._r8) + + ! integrate downward + dnu(k,i) = u(k) *(1._r8-entexpu) + dnu (k+1,i)*entexpu + dnv(k,i) = v(k) *(1._r8-entexpu) + dnv (k+1,i)*entexpu + dnqt(k,i) = qt(k) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sdnqt(k,i) + dnthl(k,i) = thl(k)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sdnthl(k,i) + + call condensation_mf(dnqt(k,i), dnthl(k,i), p_zm(k), iexner_zm(k), & + dnthv(k,i), dnqc(k,i), dnth(k,i), dnql(k,i), dnqi(k,i), & + dnqs(k,i), dnlmix(k,i)) + + ! get buoyancy + B = gravit*(0.5_r8*(dnthv(k,i) + dnthv(k+1,i))/thv(k)-1._r8) + + ! compute betad - revised entrainment to reduce donwdraft velocity at surface + !betad = wwb*entn+5._r8/((zm(k)+small))*max(1.-exp( zm(k)/z00dn-1. ),0.) + + ! get wn2 + wp = wb*entn*eturb + if (wp==0._r8) then + wn2 = upw(k+1,i)**2._r8+2._r8*wa*B*dzt(k) + else + entw = exp(-2._r8*wp*dzt(k)) + wn2 = entw*upw(k+1,i)**2._r8+(1._r8-entw)*wa*B/wp + end if + wn2 = max(wn2,mindnw**2._r8) + dnw(k,i) = -1._r8*sqrt(wn2) + + end do!k + + end if + + end do!i + + end if + ! end computing downdrafts + ! writing updraft properties for output do k=1,nz From eddae6887b6fc8c18b5da31ff131baa28411ba66 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 21 Jul 2022 18:56:31 -0600 Subject: [PATCH 113/466] bug fix (it begins!) --- src/physics/cam/clubb_mf.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 08597f9479..80f4dc670a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1001,12 +1001,11 @@ subroutine integrate_mf( nz, sevap = ke*(1._r8 - qtovqs)*sqrt(max(dnrr(k+1,i),0._r8)) ! limit evaporation to available precip - sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k)*dzt(k)) - upauto(k+1,i)*(1._r8-fdd) )) + sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k)*dzt(k)) - upauto(k+1,i)*fdd )) ! compute rain rate dnrr(k,i) = dnrr(k+1,i) & - rho_zt(k)*dzt(k)*(sevap + upauto(k+1,i)*fdd) - dnrr(i,k) = max(dnrr(i,k),0.) ! save microphysics tendenices sdnqt(k,i) = sevap From 85392592902d5e843eb0b694cb83b06312d0cc3e Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 21 Jul 2022 19:03:01 -0600 Subject: [PATCH 114/466] storming the code! --- src/physics/cam/clubb_mf.F90 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 80f4dc670a..26f3c843a7 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -800,14 +800,11 @@ subroutine integrate_mf( nz, ! TKE enhanced entrainment ! ! switches off when dynamic_L0 > max_L0 ! ! --------------------------------------------------------- ! -!+++ARH - !if (dynamic_L0 >= clubb_mf_max_L0) then + if (dynamic_L0 >= clubb_mf_max_L0) then eturb = 1._r8 - !else - ! eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) - !end if - !if (do_aspd) eturb = min(eturb,max_eturb) -!---ARH + else + eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + end if ! get microphysics, autoconversion ! (pls double-check this routine) From 30bd3a730f0244ab1f632bee641e0def578177ca Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 21 Jul 2022 19:13:52 -0600 Subject: [PATCH 115/466] bug doesn't have the courage ... --- src/physics/cam/clubb_mf.F90 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 26f3c843a7..44bce6d31d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -891,21 +891,6 @@ subroutine integrate_mf( nz, enddo enddo - ! --------------------------------------------------------- ! - ! Limit total convective area ! - ! (in future compute a mass conserving detrainment rate) ! - ! --------------------------------------------------------- ! - do k=1,nz-1 - do i=1,clubb_mf_nup - ! - ac(k) = ac(k) + upa(k,i) - ! - end do - if (ac(k) > amax) then - upa(k,:) = upa(k,:)*amax/ac(k) - end if - end do - ! --------------------------------------------------------- ! ! AS.pd limiter ! ! (likley incosistent with buoyancy sorting algorithm) ! @@ -934,6 +919,21 @@ subroutine integrate_mf( nz, ! end if !---ARH + ! --------------------------------------------------------- ! + ! Limit total convective area ! + ! (in future compute a mass conserving detrainment rate) ! + ! --------------------------------------------------------- ! + do k=1,nz-1 + do i=1,clubb_mf_nup + ! + ac(k) = ac(k) + upa(k,i) + ! + end do + if (ac(k) > amax) then + upa(k,:) = upa(k,:)*amax/ac(k) + end if + end do + ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then do i=1,clubb_mf_nup From c1d2825ae2f8a6b0495be38d48c4452e0d428fc8 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 10 Aug 2022 19:54:58 -0600 Subject: [PATCH 116/466] vetted downdraft code, reglect ddtop fluxes, fixed lots of indices --- .../usermods_dirs/scam_LBA/shell_commands | 2 +- .../usermods_dirs/scam_LBA/user_nl_cam | 7 +- src/physics/cam/clubb_intr.F90 | 11 + src/physics/cam/clubb_mf.F90 | 415 ++++++++++-------- 4 files changed, 240 insertions(+), 195 deletions(-) diff --git a/cime_config/usermods_dirs/scam_LBA/shell_commands b/cime_config/usermods_dirs/scam_LBA/shell_commands index 3defb4be66..64bdbe5dbc 100755 --- a/cime_config/usermods_dirs/scam_LBA/shell_commands +++ b/cime_config/usermods_dirs/scam_LBA/shell_commands @@ -9,7 +9,7 @@ ./xmlchange RUN_STARTDATE=1999-02-23 ./xmlchange START_TOD=0 ./xmlchange STOP_OPTION=nminutes -./xmlchange STOP_N=590 +./xmlchange STOP_N=570 # usermods_dir/scam_mandatory will be included for all single column # runs by default. This usermods directory contains mandatory settings diff --git a/cime_config/usermods_dirs/scam_LBA/user_nl_cam b/cime_config/usermods_dirs/scam_LBA/user_nl_cam index b204788727..fdd7c895f9 100644 --- a/cime_config/usermods_dirs/scam_LBA/user_nl_cam +++ b/cime_config/usermods_dirs/scam_LBA/user_nl_cam @@ -1,5 +1,6 @@ !iopfile='/home/aherring/scam/iopfiles/iop_LBA.nc' - iopfile='/glade/work/aherring/grids/vertical-res/SCAM_LBA' + !iopfile='/glade/work/aherring/grids/vertical-res/SCAM_LBA/iop_LBA.nc' + iopfile='/glade/u/home/storer/scam_iop_nc/iop_LBA_precip_halfhour.nc' !ncdata='$DIN_LOC_ROOT/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' ncdata='/glade/work/aherring/grids/vertical-res/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' @@ -16,9 +17,7 @@ scm_relax_linear = .true. scm_relax_tau_bot_sec = 864000. scm_relax_tau_top_sec = 172800. - fincl1= 'CDNUMC', 'AQSNOW','ANSNOW','FREQSL','LS_FLXPRC','THETAL','CLDST', - 'DP_CLD','EFFCLD','FRECU','FREDP','FREQSH','FRETOT','OMEGAQ','SST', 'PRECSH', - 'edmf_upa' , 'edmf_upw' , 'edmf_upqt' , 'edmf_upthl' , 'edmf_upthv', + fincl1= 'edmf_upa' , 'edmf_upw' , 'edmf_upqt' , 'edmf_upthl' , 'edmf_upthv', 'edmf_upth' , 'edmf_upqc' , 'edmf_upbuoy', 'edmf_upent' use_gw_front = .false. use_gw_convect_dp = .false. diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 204166ecdf..8bf38eaa48 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1338,6 +1338,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft entrainment rate (EDMF)' ) call addfld ( 'edmf_updet' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft dettrainment rate (EDMF)' ) call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) + call addfld ( 'edmf_dnw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume downdraft vertical velocity (EDMF)' ) end if call addfld ('QT_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') @@ -2033,6 +2034,11 @@ subroutine clubb_tend_cam( & mf_upent_output, & mf_updet_output, & mf_upbuoy_output + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output + ! MF Plume real(r8), pointer :: tpert(:) real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & @@ -2556,6 +2562,8 @@ subroutine clubb_tend_cam( & mf_L0_output(:) = 0._r8 mf_cape_output(:) = 0._r8 mf_cfl_output(:) = 0._r8 + mf_dnw_output(:,:) = 0._r8 + mf_dnw_flip(:,:,:) = 0._r8 ! Loop over all columns in lchnk to advance CLUBB core do i=1,ncol ! loop over columns @@ -3300,6 +3308,7 @@ subroutine clubb_tend_cam( & mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) + mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) end if enddo @@ -3322,6 +3331,7 @@ subroutine clubb_tend_cam( & mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k) = mf_upbuoy_flip(i,:pverp,k) + mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) end do end if @@ -4126,6 +4136,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) + call outfld( 'edmf_dnw' , mf_dnw_output, pcols, lchnk ) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 44bce6d31d..c2d875bd8d 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -318,6 +318,11 @@ subroutine integrate_mf( nz, lon, mx ! ! buoyancy sorting variables + logical :: bsort = .false. + real(r8),parameter :: amax = 0.6_r8 + real(r8),parameter :: rle = 0.1_r8 + integer :: niter_xc = 1 + integer :: kk, status, iter_xc real(r8) :: tlm, excessm, qsm, & tln, excessn, es, & xc, xsat, x_en, & @@ -328,10 +333,6 @@ subroutine integrate_mf( nz, thln0, qtn0, wn0, & entn, detn, mfn, & ee2, ud2 - integer :: kk, status, iter_xc - real(r8),parameter :: amax = 0.6_r8 - real(r8),parameter :: rle = 0.1_r8 - integer,parameter :: niter_xc = 3 ! ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & @@ -361,8 +362,11 @@ subroutine integrate_mf( nz, ! fraction of rain detrained into downdrafts real(r8),parameter :: fdd = 0.5_r8 ! + ! height here downdrafts feel the surface + real(r8),parameter :: z00dn = 1.e3_r8 + ! ! to fix entrainmnet rate - logical :: fixent = .true. + logical :: fixent = .false. ! ! fixed entrainment rate real(r8),parameter :: fixent_ent = 2.e-4_r8 @@ -488,7 +492,10 @@ subroutine integrate_mf( nz, dynamic_L0 = 0._r8 ztop = 0._r8 - mcape = 0._r8 + + if (bsort) then + niter_xc = 3 + end if ! unique identifier zcb_unset = 9999999._r8 @@ -675,6 +682,21 @@ subroutine integrate_mf( nz, dynamic_L0 = max(min_L0,dynamic_L0) dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) + ! --------------------------------------------------------- ! + ! Stochastic entrainmnet calculation ! + ! From Suselj et al 2019, after Romps and Kuang 2010 ! + ! (ideally we wouldn't fill the entire arrray w/ the RNG, ! + ! but the RNG doesn't work properly when it operates on ! + ! the entire array. I'm not sure why this is happening.) ! + ! --------------------------------------------------------- ! + do k=1,nz-1 + ! get entrainment coefficient, dz/L0 + entf(k,:) = dzt(k) / dynamic_L0 + end do + + ! get poisson, P(dz/L0) + call poisson( nz, clubb_mf_nup, entf, enti, u(2:5)) + ! --------------------------------------------------------- ! ! Main upward sweep to compute updraft properties ! ! ! @@ -682,119 +704,124 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup do k=1,nz-1 + ! get microphysics, autoconversion + if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then + call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) + supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair + else + supqt(k+1,i) = 0._r8 + supthl(k+1,i) = 0._r8 + end if + + ! compute mixing rate + if (fixent) then + mix(k+1,i) = fixent_ent + else + ! get entrainment, ent=ent0/dz*P(dz/L0) + mix(k+1,i) = real( enti(k+1,i))*clubb_mf_ent0/dzt(k+1) + end if + do iter_xc = 1, niter_xc - if (iter_xc==1) then - qtn = upqt(k,i) - thln = upthl(k,i) - wn = upw(k,i) - else - qtn = 0.5_r8*(qtn + qtn0) - thln = 0.5_r8*(thln + thln0) - wn = 0.5_r8*(wn + wn0) - end if + if (bsort) then + if (iter_xc==1) then + qtn = upqt(k,i) + thln = upthl(k,i) + wn = upw(k,i) + else + qtn = 0.5_r8*(qtn + qtn0) + thln = 0.5_r8*(thln + thln0) + wn = 0.5_r8*(wn + wn0) + end if - ! --------------------------------------------------------- ! - ! Compute excess water to derive neutral mixing fraction ! - ! after Bretherton et al 2014 ! - ! --------------------------------------------------------- ! + ! --------------------------------------------------------- ! + ! Compute excess water to derive neutral mixing fraction ! + ! after Bretherton et al 2014 ! + ! --------------------------------------------------------- ! - ! qexcess of the envrionment - tlm = thl_zm(k+1)/iexner_zm(k+1) - call qsat(tlm,p_zm(k+1),es,qsm) - excessm = qt_zm(k+1) - qsm - - ! qexcess in plume - tln = thln/iexner_zm(k+1) - call qsat(tln,p_zm(k+1),es,qsn) - excessn = qtn - qsn - - call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - - ! critical stopping distance - cridis = rle*ztopm1 - - ! ----------------------------------------------------------------- ! - ! Case 1 : When both cumulus and env. are unsaturated or saturated. ! - ! ----------------------------------------------------------------- ! - if (excessm*excessn > 0._r8) then - xc = min(1._r8,max(0._r8,1._r8-2._r8*wa*gravit*cridis/wn**2._r8*(1._r8-thvn/thv_zm(k+1)))) - aquad = 0._r8 - bquad = 0._r8 - cquad = 0._r8 - else - ! -------------------------------------------------- ! - ! Case 2 : When either cumulus or env. is saturated. ! - ! -------------------------------------------------- ! - xsat = excessn / ( excessn - excessm ); - thlxsat = thln + xsat * ( thl_zm(k+1) - thln ); - qtxsat = qtn + xsat * ( qt_zm(k+1) - qtn ); - call condensation_mf(qtxsat, thlxsat, p_zm(k+1), iexner_zm(k+1), & - thvxsat, qcn, thn, qln, qin, qsn, lmixn) + ! qexcess of the envrionment + tlm = thl_zm(k+1)/iexner_zm(k+1) + call qsat(tlm,p_zm(k+1),es,qsm) + excessm = qt_zm(k+1) - qsm + + ! qexcess in plume + tln = thln/iexner_zm(k+1) + call qsat(tln,p_zm(k+1),es,qsn) + excessn = qtn - qsn + + call condensation_mf(qtn, thln, p_zm(k+1), iexner_zm(k+1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + + ! critical stopping distance + cridis = rle*ztopm1 + + ! ----------------------------------------------------------------- ! + ! Case 1 : When both cumulus and env. are unsaturated or saturated. ! + ! ----------------------------------------------------------------- ! + if (excessm*excessn > 0._r8) then + xc = min(1._r8,max(0._r8,1._r8-2._r8*wa*gravit*cridis/wn**2._r8*(1._r8-thvn/thv_zm(k+1)))) + aquad = 0._r8 + bquad = 0._r8 + cquad = 0._r8 + else ! -------------------------------------------------- ! - ! kk=1 : Cumulus Segment, kk=2 : Environment Segment ! - ! -------------------------------------------------- ! - do kk = 1, 2 - if( kk .eq. 1 ) then - thv_x0 = thvn - thv_x1 = ( 1._r8 - 1._r8/xsat ) * thvn + ( 1._r8/xsat ) * thvxsat - else - thv_x1 = thv_zm(k+1) - thv_x0 = ( xsat / ( xsat - 1._r8 ) ) * thv_zm(k+1) + ( 1._r8/( 1._r8 - xsat ) ) * thvxsat - endif - aquad = wn**2 - bquad = 2._r8*wa*gravit*cridis*(thv_x1 - thv_x0)/thv_zm(k+1) - 2._r8*wn**2 - cquad = 2._r8*wa*gravit*cridis*(thv_x0 - thv_zm(k+1))/thv_zm(k+1) + wn**2 - if( kk .eq. 1 ) then - if( ( bquad**2-4._r8*aquad*cquad ) .ge. 0._r8 ) then - call roots(aquad,bquad,cquad,xs1,xs2,status) - x_cu = min(1._r8,max(0._r8,min(xsat,min(xs1,xs2)))) + ! Case 2 : When either cumulus or env. is saturated. ! + ! -------------------------------------------------- ! + xsat = excessn / ( excessn - excessm ); + thlxsat = thln + xsat * ( thl_zm(k+1) - thln ); + qtxsat = qtn + xsat * ( qt_zm(k+1) - qtn ); + call condensation_mf(qtxsat, thlxsat, p_zm(k+1), iexner_zm(k+1), & + thvxsat, qcn, thn, qln, qin, qsn, lmixn) + ! -------------------------------------------------- ! + ! kk=1 : Cumulus Segment, kk=2 : Environment Segment ! + ! -------------------------------------------------- ! + do kk = 1, 2 + if( kk .eq. 1 ) then + thv_x0 = thvn + thv_x1 = ( 1._r8 - 1._r8/xsat ) * thvn + ( 1._r8/xsat ) * thvxsat else - x_cu = xsat + thv_x1 = thv_zm(k+1) + thv_x0 = ( xsat / ( xsat - 1._r8 ) ) * thv_zm(k+1) + ( 1._r8/( 1._r8 - xsat ) ) * thvxsat endif - else - if( ( bquad**2-4._r8*aquad*cquad) .ge. 0._r8 ) then - call roots(aquad,bquad,cquad,xs1,xs2,status) - x_en = min(1._r8,max(0._r8,max(xsat,min(xs1,xs2)))) + aquad = wn**2 + bquad = 2._r8*wa*gravit*cridis*(thv_x1 - thv_x0)/thv_zm(k+1) - 2._r8*wn**2 + cquad = 2._r8*wa*gravit*cridis*(thv_x0 - thv_zm(k+1))/thv_zm(k+1) + wn**2 + if( kk .eq. 1 ) then + if( ( bquad**2-4._r8*aquad*cquad ) .ge. 0._r8 ) then + call roots(aquad,bquad,cquad,xs1,xs2,status) + x_cu = min(1._r8,max(0._r8,min(xsat,min(xs1,xs2)))) + else + x_cu = xsat + endif else - x_en = 1._r8 + if( ( bquad**2-4._r8*aquad*cquad) .ge. 0._r8 ) then + call roots(aquad,bquad,cquad,xs1,xs2,status) + x_en = min(1._r8,max(0._r8,max(xsat,min(xs1,xs2)))) + else + x_en = 1._r8 + endif endif + enddo + if( x_cu .eq. xsat ) then + xc = max(x_cu, x_en) + else + xc = x_cu endif - enddo - if( x_cu .eq. xsat ) then - xc = max(x_cu, x_en) - else - xc = x_cu endif - endif - - if (iter_xc==1) then - if (fixent) then - mix(k+1,i) = fixent_ent - else - ! --------------------------------------------------------- ! - ! Stochastic entrainmnet calculation ! - ! From Suselj et al 2019, after Romps and Kuang 2010 ! - ! --------------------------------------------------------- ! - ! get entrainment coefficient, dz/L0 - entf(k+1,i) = dzt(k+1) / dynamic_L0 + ee2 = xc**2 + ud2 = 1._r8 - 2._r8*xc + xc**2 - ! get poisson, P(dz/L0) - call poisson( 1, 1, entf(k+1,i), enti(k+1,i), u(2:5)) + ! detrainment rate + detn = mix(k+1,i) * ud2 - ! get entrainment, ent=ent0/dz*P(dz/L0) - mix(k+1,i) = real( enti(k+1,i))*clubb_mf_ent0/dzt(k+1) - end if + else !no bsort + ee2 = 1._r8 + ud2 = 1._r8 end if - ee2 = xc**2 - ud2 = 1._r8 - 2._r8*xc + xc**2 - - entn = mix(k+1,i) * ee2 - detn = mix(k+1,i) * ud2 - mfn = upmf(k,i)*exp( dzt(k+1)*( entn - detn )) + ! entrainment rate + entn = mix(k+1,i) * ee2 ! --------------------------------------------------------- ! ! TKE enhanced entrainment ! @@ -805,27 +832,17 @@ subroutine integrate_mf( nz, else eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) end if + entn = entn * eturb - ! get microphysics, autoconversion - ! (pls double-check this routine) - if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then - call precip_mf(upqs(k,i),upqt(k,i),upw(k,i),dzt(k+1),zm(k+1)-zcb(i),supqt(k+1,i)) - supthl(k+1,i) = -1._r8*lmixn*supqt(k+1,i)*iexner_zt(k+1)/cpair - ! save autoconversion for use in downdrafts - upauto(k+1,i) = supqt(k+1,i) - else - supqt(k+1,i) = 0._r8 - supthl(k+1,i) = 0._r8 - upauto(k+1,i) = 0._r8 - end if + ! save this iteration + qtn0 = qtn + thln0 = thln + wn0 = wn ! integrate updraft entexp = exp(-entn*eturb*dzt(k+1)) entexpu = exp(-entn*dzt(k+1)/3._r8) - qtn0 = qtn - thln0 = thln - qtn = qt(k+1) *(1._r8-entexp ) + upqt (k,i)*entexp + supqt(k+1,i) thln = thl(k+1)*(1._r8-entexp ) + upthl(k,i)*entexp + supthl(k+1,i) un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu @@ -833,6 +850,7 @@ subroutine integrate_mf( nz, ! convert source terms to a tendency supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) + upauto(k+1,i) = supqt(k+1,i) supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) ! get cloud, momentum levels @@ -847,8 +865,6 @@ subroutine integrate_mf( nz, ! get buoyancy B=gravit*(0.5_r8*(thvn + upthv(k,i))/thv(k+1)-1._r8) - wn0 = wn - if (do_implicit) then wp = clubb_mf_alphturb*wb*entn*sqrt(0.5_r8*(tke(k+1)+tke(k)))*dzt(k+1) wn = (-wp + sqrt(wp**2._r8 + (1._r8 + 2._r8*wb*entn*dzt(k+1))* & @@ -868,23 +884,39 @@ subroutine integrate_mf( nz, end do !iter_xc if (wn>0._r8) then - upw(k+1,i) = wn + upthv(k+1,i) = thvn upthl(k+1,i) = thln upqt(k+1,i) = qtn upqc(k+1,i) = qcn upqs(k+1,i) = qsn upu(k+1,i) = un - upv(k+1,i) = vn - upa(k+1,i) = upmf(k+1,i)/(wn*rho_zm(k+1)) - upent(k+1,i) = entn - updet(k+1,i) = detn +!+++ARH + !upv(k+1,i) = vn + upv(k+1,i) = xc +!---ARH upql(k+1,i) = qln upqi(k+1,i) = qin upqv(k+1,i) = qtn - qcn uplmix(k+1,i)= lmixn upth(k+1,i) = thn + + if (bsort) then + mfn = upmf(k,i)*exp( dzt(k+1)*( entn - detn )) + upa(k+1,i) = mfn/(wn*rho_zm(k+1)) + else + upa(k+1,i) = upa(k,i) + mfn = rho_zm(k+1)*upa(k+1,i)*wn + detn = entn - (mfn - rho_zm(k)*upa(k,i)*upw(k,i)) & + /(rho_zm(k)*upa(k,i)*upw(k,i)*dzt(k+1)) + end if + upbuoy(k+1,i)= B + upw(k+1,i) = wn + upmf(k+1,i) = mfn + upent(k+1,i) = entn + updet(k+1,i) = detn + else exit end if @@ -895,44 +927,44 @@ subroutine integrate_mf( nz, ! AS.pd limiter ! ! (likley incosistent with buoyancy sorting algorithm) ! ! --------------------------------------------------------- ! -!+++ARH -! if (do_aspd) then -! do k=1,nz-1 -! do i=1,clubb_mf_nup -! ! -! if (upw(k+1,i)>0._r8) then -! ! diagnose detrainment -! Mn = rho_zm(k)*upa(k,i)*upw(k,i) -! det = ent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & -! /(Mn*dzt(k+1)) -! if (det < 0._r8) then -! ! diagnose area to eliminate detrainment and conserve mass -! Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(ent(k+1,i)*eturb*dzt(k+1)) -! upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) -! end if -! ! -! end if -! ac(k+1) = ac(k+1) + upa(k+1,i) -! ! -! end do -! end do -! end if -!---ARH + if (do_aspd) then + do k=1,nz-1 + do i=1,clubb_mf_nup + ! + if (upw(k+1,i)>0._r8) then + ! diagnose detrainment + Mn = rho_zm(k)*upa(k,i)*upw(k,i) + det = upent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & + /(Mn*dzt(k+1)) + if (det < 0._r8) then + ! diagnose area to eliminate detrainment and conserve mass + Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(upent(k+1,i)*eturb*dzt(k+1)) + upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) + end if + ! + end if + ac(k+1) = ac(k+1) + upa(k+1,i) + ! + end do + end do + end if ! --------------------------------------------------------- ! ! Limit total convective area ! ! (in future compute a mass conserving detrainment rate) ! ! --------------------------------------------------------- ! - do k=1,nz-1 - do i=1,clubb_mf_nup - ! - ac(k) = ac(k) + upa(k,i) - ! + if (do_aspd .or. bsort) then + do k=1,nz-1 + do i=1,clubb_mf_nup + ! + ac(k) = ac(k) + upa(k,i) + ! + end do + if (ac(k) > amax) then + upa(k,:) = upa(k,:)*amax/ac(k) + end if end do - if (ac(k) > amax) then - upa(k,:) = upa(k,:)*amax/ac(k) - end if - end do + end if ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then @@ -956,7 +988,6 @@ subroutine integrate_mf( nz, ! update source terms lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) - ! scale autoconv by factor (1-fdd)? supqt(k,i) = supqt(k,i) + sevap supthl(k,i) = supthl(k,i) - lmixt*sevap*iexner_zt(k)/cpair end do @@ -982,7 +1013,7 @@ subroutine integrate_mf( nz, dnqt(ddtop,i) = qt_zm(ddtop) dnthl(ddtop,i) = thl_zm(ddtop) dnthv(ddtop,i) = thv_zm(ddtop) - dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*supqt(ddtop,i)*fdd + dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*upauto(ddtop,i)*fdd call condensation_mf(dnqt(ddtop,i), dnthl(ddtop,i), p_zm(ddtop), iexner_zm(ddtop), & dnthv(ddtop,i), dnqc(ddtop,i), dnth(ddtop,i), dnql(ddtop,i), dnqi(ddtop,i), & @@ -998,15 +1029,15 @@ subroutine integrate_mf( nz, sevap = ke*(1._r8 - qtovqs)*sqrt(max(dnrr(k+1,i),0._r8)) ! limit evaporation to available precip - sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k)*dzt(k)) - upauto(k+1,i)*fdd )) + sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k+1)*dzt(k+1)) - upauto(k+1,i)*fdd )) ! compute rain rate dnrr(k,i) = dnrr(k+1,i) & - - rho_zt(k)*dzt(k)*(sevap + upauto(k+1,i)*fdd) + - rho_zt(k+1)*dzt(k+1)*(sevap + upauto(k+1,i)*fdd) ! save microphysics tendenices sdnqt(k,i) = sevap - sdnthl(k,i) = -1._r8*lmixt*sevap*iexner_zt(k)/cpair + sdnthl(k,i) = -1._r8*dnlmix(k+1,i)*sevap*iexner_zt(k+1)/cpair if (fixent) then entn = fixent_ent @@ -1016,36 +1047,43 @@ subroutine integrate_mf( nz, end if ! include eturb? - entexp = exp(-entn*eturb*dzt(k)) - entexpu = exp(-entn*dzt(k)/3._r8) + entexp = exp(-entn*eturb*dzt(k+1)) + entexpu = exp(-entn*dzt(k+1)/3._r8) ! integrate downward - dnu(k,i) = u(k) *(1._r8-entexpu) + dnu (k+1,i)*entexpu - dnv(k,i) = v(k) *(1._r8-entexpu) + dnv (k+1,i)*entexpu - dnqt(k,i) = qt(k) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sdnqt(k,i) - dnthl(k,i) = thl(k)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sdnthl(k,i) + dnu(k,i) = u(k+1) *(1._r8-entexpu) + dnu (k+1,i)*entexpu + dnv(k,i) = v(k+1) *(1._r8-entexpu) + dnv (k+1,i)*entexpu + dnqt(k,i) = qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sdnqt(k,i) + dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sdnthl(k,i) call condensation_mf(dnqt(k,i), dnthl(k,i), p_zm(k), iexner_zm(k), & dnthv(k,i), dnqc(k,i), dnth(k,i), dnql(k,i), dnqi(k,i), & dnqs(k,i), dnlmix(k,i)) ! get buoyancy - B = gravit*(0.5_r8*(dnthv(k,i) + dnthv(k+1,i))/thv(k)-1._r8) - - ! compute betad - revised entrainment to reduce donwdraft velocity at surface - !betad = wwb*entn+5._r8/((zm(k)+small))*max(1.-exp( zm(k)/z00dn-1. ),0.) + ! (midpoint k is surrounded by interface k and k-1, + ! and therefore we can't compute B at the midpoint properly) + B = gravit*(dnthv(k,i)/thv(k)-1._r8) ! get wn2 wp = wb*entn*eturb + !wp = wb*entn+5._r8/(zm(k)+1.e-7_r8)*max(1._r8-exp( zm(k)/z00dn-1._r8 ),0._r8) if (wp==0._r8) then - wn2 = upw(k+1,i)**2._r8+2._r8*wa*B*dzt(k) + wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) else - entw = exp(-2._r8*wp*dzt(k)) - wn2 = entw*upw(k+1,i)**2._r8+(1._r8-entw)*wa*B/wp + entw = exp(-2._r8*wp*dzt(k+1)) + wn2 = entw*dnw(k+1,i)**2._r8-(1._r8-entw)*wa*B/wp end if wn2 = max(wn2,mindnw**2._r8) dnw(k,i) = -1._r8*sqrt(wn2) - + + ! zero out initialized downdraft level ddtop + ! (including the ddtop values leads to unrealistic + ! ensemble mean fluxes due to dnw(ddtop,:) = -upw(ddtop,:)) + if (k.eq.(ddtop-1)) then + dnw(ddtop,i) = 0._r8 + end if + end do!k end if @@ -1115,33 +1153,30 @@ subroutine integrate_mf( nz, ae (k) = ae (k) - upa(k,i) aw (k) = aw (k) + upa(k,i)*upw(k,i) !awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) - awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) - awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + !awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) + awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + dna(k,i)*dnw(k,i)*dnthl(k,i) awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) - awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) + awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) + dna(k,i)*dnw(k,i)*dnqt(k,i) awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) if (k > 1) then - ! scale autoconv by factor (1-fdd)? - sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) - sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) - ! hack awu to contain ensemble entrainment - awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*mix(k,i) + sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnqt(k,i) + sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnthl(k,i) + awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*upent(k,i) + awv(k) = awv (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*upv(k,i) end if enddo - ! hack awu to contain ensemble entrainment - if (k > 1 .and. 0.5_r8*(ae(k)+ae(k-1)) < 1._r8) then - awu(k) = awu(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) - else - awu(k) = 0._r8 - end if + ! hack awu to contain ensemble mean entrainment + if (k > 1 .and. ae(k) < 1._r8) awu(k) = awu(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) + if (k > 1 .and. ae(k) < 1._r8) awv(k) = awv(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) ! no convection if convection terminates at first level if (k == 2 .and. ae(k) == 1._r8) then sqt(k) = 0_r8 sthl(k) = 0._r8 + ztopm1 = 0._r8 return end if enddo From f5897509de29c7eb1a85d1ac9f0d617c347dbe65 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 25 Aug 2022 18:58:32 -0600 Subject: [PATCH 117/466] downdrafts v0 fully implemented --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 5 + src/physics/cam/clubb_intr.F90 | 266 +++++++----- src/physics/cam/clubb_mf.F90 | 432 +++++++++---------- 5 files changed, 386 insertions(+), 319 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 763505be59..8c0542255a 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3145,6 +3145,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_b0'); add_default($nl, 'clubb_mf_nup'); add_default($nl, 'clubb_mf_max_L0'); + add_default($nl, 'clubb_mf_fdd'); } # Force exit if running cam_dev and CLUBB is off diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index b0dceee84d..40ad9757ef 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1952,6 +1952,7 @@ 0.5 10 10.e3 + 0.0 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 76cf709f70..727a27a490 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3939,6 +3939,11 @@ Real: limiter on entrainmnet length scale + threshold to diable TKE enhanced ent Default: 10.e3 + +Fraction of autoconversion partitioned to downdrafts (zero means no downdrafts) +Default: 0.0 + 0._r8) then - ! diagnose detrainment - Mn = rho_zm(k)*upa(k,i)*upw(k,i) - det = upent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & - /(Mn*dzt(k+1)) - if (det < 0._r8) then - ! diagnose area to eliminate detrainment and conserve mass - Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(upent(k+1,i)*eturb*dzt(k+1)) - upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) - end if - ! - end if - ac(k+1) = ac(k+1) + upa(k+1,i) - ! - end do - end do - end if - - ! --------------------------------------------------------- ! - ! Limit total convective area ! - ! (in future compute a mass conserving detrainment rate) ! - ! --------------------------------------------------------- ! - if (do_aspd .or. bsort) then - do k=1,nz-1 - do i=1,clubb_mf_nup - ! - ac(k) = ac(k) + upa(k,i) - ! - end do - if (ac(k) > amax) then - upa(k,:) = upa(k,:)*amax/ac(k) - end if - end do - end if - - ! downward sweep for rain evaporation, snow melting if (do_clubb_mf_precip) then do i=1,clubb_mf_nup do k=nz,2,-1 @@ -980,11 +955,11 @@ subroutine integrate_mf( nz, sevap = ke*(1._r8 - qtovqs)*sqrt(max(uprr(k,i),0._r8)) ! limit evaporation to available precip - sevap = min(sevap,( uprr(k,i)/(rho_zt(k)*dzt(k)) - supqt(k,i)*(1._r8-fdd) )) + sevap = min(sevap,( uprr(k,i)/(rho_zt(k)*dzt(k)) - supqt(k,i)*(1._r8-clubb_mf_fdd) )) ! get rain rate uprr(k-1,i) = uprr(k,i) & - - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-fdd) + sevap ) + - rho_zt(k)*dzt(k)*( supqt(k,i)*(1._r8-clubb_mf_fdd) + sevap ) ! update source terms lmixt = 0.5_r8*(uplmix(k,i)+uplmix(k-1,i)) @@ -994,8 +969,10 @@ subroutine integrate_mf( nz, end do end if - ! begin computing downdrafts - if (do_clubb_mf_precip .and. fdd > 0._r8) then + ! --------------------------------------------------------- ! + ! begin computing downdrafts ! + ! --------------------------------------------------------- ! + if (do_clubb_mf_precip .and. clubb_mf_fdd > 0._r8) then do i=1,clubb_mf_nup @@ -1006,14 +983,18 @@ subroutine integrate_mf( nz, if (ddtop /= 0) then ! initilaize downdrafts - dnw(ddtop,i) = -1._r8*upw(ddtop,i) + + ! Kay initializes using negative of the updraft velocity + ! this causes anomalouly large downdrafts at the initializaiton level + ! I am intializing with zero velocity as that is more physically defensible + dnw(ddtop,i) = 0._r8 dna(ddtop,i) = upa(ddtop,i) dnu(ddtop,i) = 0.5_r8*(u(ddtop)+u(ddtop+1)) dnv(ddtop,i) = 0.5_r8*(v(ddtop)+v(ddtop+1)) dnqt(ddtop,i) = qt_zm(ddtop) dnthl(ddtop,i) = thl_zm(ddtop) dnthv(ddtop,i) = thv_zm(ddtop) - dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*upauto(ddtop,i)*fdd + dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*upauto(ddtop,i)*clubb_mf_fdd call condensation_mf(dnqt(ddtop,i), dnthl(ddtop,i), p_zm(ddtop), iexner_zm(ddtop), & dnthv(ddtop,i), dnqc(ddtop,i), dnth(ddtop,i), dnql(ddtop,i), dnqi(ddtop,i), & @@ -1029,11 +1010,11 @@ subroutine integrate_mf( nz, sevap = ke*(1._r8 - qtovqs)*sqrt(max(dnrr(k+1,i),0._r8)) ! limit evaporation to available precip - sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k+1)*dzt(k+1)) - upauto(k+1,i)*fdd )) + sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k+1)*dzt(k+1)) - upauto(k+1,i)*clubb_mf_fdd )) ! compute rain rate dnrr(k,i) = dnrr(k+1,i) & - - rho_zt(k+1)*dzt(k+1)*(sevap + upauto(k+1,i)*fdd) + - rho_zt(k+1)*dzt(k+1)*(sevap + upauto(k+1,i)*clubb_mf_fdd) ! save microphysics tendenices sdnqt(k,i) = sevap @@ -1066,8 +1047,9 @@ subroutine integrate_mf( nz, B = gravit*(dnthv(k,i)/thv(k)-1._r8) ! get wn2 - wp = wb*entn*eturb + ! Kay uses the following eqn for wp, but I don't undestand it !wp = wb*entn+5._r8/(zm(k)+1.e-7_r8)*max(1._r8-exp( zm(k)/z00dn-1._r8 ),0._r8) + wp = wb*entn*eturb if (wp==0._r8) then wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) else @@ -1080,9 +1062,9 @@ subroutine integrate_mf( nz, ! zero out initialized downdraft level ddtop ! (including the ddtop values leads to unrealistic ! ensemble mean fluxes due to dnw(ddtop,:) = -upw(ddtop,:)) - if (k.eq.(ddtop-1)) then - dnw(ddtop,i) = 0._r8 - end if + !if (k.eq.(ddtop-1)) then + ! dnw(ddtop,i) = 0._r8 + !end if end do!k @@ -1093,7 +1075,50 @@ subroutine integrate_mf( nz, end if ! end computing downdrafts - ! writing updraft properties for output + ! --------------------------------------------------------- ! + ! AS.pd limiter ! + ! --------------------------------------------------------- ! + if (do_aspd) then + do k=1,nz-1 + do i=1,clubb_mf_nup + if (upw(k+1,i)>0._r8) then + ! diagnose detrainment + Mn = rho_zm(k)*upa(k,i)*upw(k,i) + det = upent(k+1,i)*eturb - (rho_zm(k+1)*upa(k+1,i)*upw(k+1,i) - Mn) & + /(Mn*dzt(k+1)) + if (det < 0._r8) then + ! diagnose area to eliminate detrainment and conserve mass + Mn = rho_zm(k)*upa(k,i)*upw(k,i)*exp(upent(k+1,i)*eturb*dzt(k+1)) + upa(k+1,i) = Mn/(rho_zm(k+1)*upw(k+1,i)) + end if + ! + end if + end do + end do + end if + + ! --------------------------------------------------------- ! + ! integrate for total convective area ! + ! --------------------------------------------------------- ! + do k=1,nz-1 + ! + do i=1,clubb_mf_nup + aup(k) = aup(k) + upa(k,i) + adn(k) = adn(k) + dna(k,i) + end do + ac(k) = aup(k) + adn(k) + ! + if (limarea .and. ac(k) > amax) then + upa(k,:) = upa(k,:)*amax/ac(k) + ac(k) = amax + end if + ae(k) = ae(k) - ac(k) + ! + end do + + ! --------------------------------------------------------- ! + ! updraft properties for output ! + ! --------------------------------------------------------- ! do k=1,nz ! first sum over all i-updrafts @@ -1148,128 +1173,97 @@ subroutine integrate_mf( nz, enddo + ! --------------------------------------------------------- ! + ! get ensemble mean ! + ! --------------------------------------------------------- ! do k=1,nz do i=1,clubb_mf_nup - ae (k) = ae (k) - upa(k,i) - aw (k) = aw (k) + upa(k,i)*upw(k,i) - !awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) - !awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) - awthl(k)= awthl(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + dna(k,i)*dnw(k,i)*dnthl(k,i) - awthv(k)= awthv(k)+ upa(k,i)*upw(k,i)*upthv(k,i) - awth(k) = awth(k) + upa(k,i)*upw(k,i)*upth(k,i) - awqt(k) = awqt(k) + upa(k,i)*upw(k,i)*upqt(k,i) + dna(k,i)*dnw(k,i)*dnqt(k,i) - awqv(k) = awqv(k) + upa(k,i)*upw(k,i)*upqv(k,i) - awql(k) = awql(k) + upa(k,i)*upw(k,i)*upql(k,i) - awqi(k) = awqi(k) + upa(k,i)*upw(k,i)*upqi(k,i) - awqc(k) = awqc(k) + upa(k,i)*upw(k,i)*upqc(k,i) + + awup(k) = awup(k) + upa(k,i)*upw(k,i) + awdn(k) = awdn(k) + dna(k,i)*dnw(k,i) + + awthvdn(k)= awthvdn(k)+ dna(k,i)*dnw(k,i)*dnthv(k,i) + awthldn(k)= awthldn(k)+ dna(k,i)*dnw(k,i)*dnthl(k,i) + awqtdn(k) = awqtdn(k) + dna(k,i)*dnw(k,i)*dnqt(k,i) + + awthvup(k)= awthvup(k)+ upa(k,i)*upw(k,i)*upthv(k,i) + awthlup(k)= awthlup(k)+ upa(k,i)*upw(k,i)*upthl(k,i) + awqtup(k) = awqtup(k) + upa(k,i)*upw(k,i)*upqt(k,i) + + awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) + awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) + if (k > 1) then - sqt(k) = sqt(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnqt(k,i) - sthl(k) = sthl(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnthl(k,i) - awu (k) = awu (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*upent(k,i) - awv(k) = awv (k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*upv(k,i) + sqtup(k) = sqtup(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) + sthlup(k) = sthlup(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) + + sqtdn(k) = sqtdn(k) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnqt(k,i) + sthldn(k) = sthldn(k) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnthl(k,i) end if + enddo - ! hack awu to contain ensemble mean entrainment - if (k > 1 .and. ae(k) < 1._r8) awu(k) = awu(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) - if (k > 1 .and. ae(k) < 1._r8) awv(k) = awv(k)/(1._r8-0.5_r8*(ae(k)+ae(k-1))) - ! no convection if convection terminates at first level - if (k == 2 .and. ae(k) == 1._r8) then - sqt(k) = 0_r8 - sthl(k) = 0._r8 - ztopm1 = 0._r8 - return - end if + + aw (k) = awup(k) + awdn(k) + sqt(k) = sqtup(k) + sqtdn(k) + sthl(k)= sthlup(k) + sthldn(k) + enddo - ! ztopm1 calculation + ! --------------------------------------------------------- ! + ! ztopm1 calculation ! + ! --------------------------------------------------------- ! do k=1,nz - if (ae(k) < 1._r8) then - ztopm1 = zm(k) + ! retrun if no convection at k=2 + if (k == 2 .and. ac(k) == 0._r8) then + sqt(k) = 0_r8 + sthl(k) = 0._r8 + ztopm1 = zm(1) + return end if + ! height of the plume ensemble + if (ac(k) > 0._r8) ztopm1 = zm(k) end do - ! downward sweep to get ensemble mean precip + ! --------------------------------------------------------- ! + ! downward sweep to get ensemble mean precip ! + ! --------------------------------------------------------- ! do k = nz,2,-1 precc(k-1) = precc(k) - rho_zt(k)*dzt(k)*sqt(k) end do - awthl_conv = awthl - awqt_conv = awqt - awthv_conv = awthv - thl_env = thl - thl_env_zm = thl_zm - qt_env = qt - qt_env_zm = qt_zm + ! --------------------------------------------------------- ! + ! get turbulent fluxes ! + ! --------------------------------------------------------- ! thv_env = thv - thv_env_zm = thv_zm + thl_env = thl + qt_env = qt + + betathl = (thl_env(4)-thl_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qt_env(4)-qt_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + + thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) + qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) + if (qt_env(1) < 0._r8) qt_env(1) = 0._r8 kstart = 2 if (scalesrf) then kstart = 1 end if - if (pupwind) then - ! staggered environment values - - ! get thl & qt fluxes - betathl = (thl_env(4)-thl_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betaqt = (qt_env(4)-qt_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - thlflx(k)= awthl_conv(k) - aw(k)*thl_env(k+1) - qtflx(k)= awqt_conv(k) - aw(k)*qt_env(k+1) - enddo - - ! get thv fluxes - betathl = (thv_env(4)-thv_env(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thv_env(1) = thv_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - do k=kstart,nz-1 - thvflx(k)= awthv_conv(k) - aw(k)*thv_env(k+1) - enddo - - ! get th & qv fluxes - thl_env = th - qt_env = qv - betathl = (th(4)-th(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betaqt = (qv(4)-qv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - thl_env(1) = thl_env(2)-betathl*0.5_r8*(dzt(2)+dzt(1)) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - thflx(k)= awth(k) - aw(k)*thl_env(k+1) - qvflx(k)= awqv(k) - aw(k)*qt_env(k+1) - enddo - - ! get qc fluxes - qt_env = qc - betaqt = (qc(4)-qc(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - qt_env(1) = qt_env(2)-betaqt*0.5_r8*(dzt(2)+dzt(1)) - if (qt_env(1).lt.0._r8) qt_env(1) = 0._r8 - do k=kstart,nz-1 - qcflx(k)= awqc(k) - aw(k)*qt_env(k+1) - enddo - - else - ! collocated environment values - do k=kstart,nz-1 - ! get thl & qt fluxes - thlflx(k)= awthl_conv(k) - aw(k)*thl_env_zm(k) - qtflx(k) = awqt_conv(k) - aw(k)*qt_env_zm(k) - - ! get thv flux - thvflx(k)= awthv_conv(k) - aw(k)*thv_env_zm(k) + do k=kstart,nz-1 + thvflxup(k)= awthvup(k) - awup(k)*thv_env(k+1) + thlflxup(k)= awthlup(k) - awup(k)*thl_env(k+1) + qtflxup (k)= awqtup (k) - awup(k)*qt_env (k+1) - ! get th & qv fluxes - thflx(k) = awth(k) - aw(k)*th_zm(k) - qvflx(k) = awqv(k) - aw(k)*qv_zm(k) + ! if no downdrafts, should be zero since awdn should be zero + thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k-1) + thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k-1) + qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k-1) - ! get qc fluxes - qcflx(k) = awqc(k) - aw(k)*qc_zm(k) - end do - endif + thvflx(k) = thvflxup(k) + thvflxdn(k) + thlflx(k) = thlflxup(k) + thlflxdn(k) + qtflx (k) = qtflxup (k) + qtflxdn (k) + enddo end if ! ( wthv > 0.0 ) From 79a65ca81898c90c858e525a64542bdaa67dc938 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 28 Sep 2022 18:56:06 -0600 Subject: [PATCH 118/466] addressed maria's partial review --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index fb003bac1a..659b0a7a33 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -509,7 +509,6 @@ subroutine integrate_mf( nz, dnlmix= 0._r8 sdnqt = 0._r8 sdnthl= 0._r8 - dnw = 0._r8 dynamic_L0 = 0._r8 ztop = 0._r8 @@ -566,6 +565,7 @@ subroutine integrate_mf( nz, facthvu=1._r8 if (scalesrf) then ! scale surface fluxes + ! (req'd for conservation if not running with zero-flux b.c.'s) srfwqtu = 0._r8 srfwthvu = 0._r8 srfarea = 0._r8 From 8598110aa8d49a2bceb980906a5afa1329455daf Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 30 Sep 2022 13:24:20 -0600 Subject: [PATCH 119/466] pull ztopm1 into wstar calc. bfb restarts bug fix. --- src/physics/cam/clubb_mf.F90 | 3 +++ src/physics/camrt/radiation.F90 | 2 +- src/physics/rrtmg/radiation.F90 | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 659b0a7a33..7508789640 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -523,6 +523,9 @@ subroutine integrate_mf( nz, zcb = zcb_unset convh = max(pblh,pblhmin) +!+++ARH + convh = max(pblh,ztopm1) +!---ARH wthv = wthl+zvir*ths*wqt ! if surface buoyancy is positive then do mass-flux diff --git a/src/physics/camrt/radiation.F90 b/src/physics/camrt/radiation.F90 index 8de9777281..5dc899a522 100644 --- a/src/physics/camrt/radiation.F90 +++ b/src/physics/camrt/radiation.F90 @@ -582,7 +582,7 @@ subroutine radiation_define_restart(file) call pio_seterrorhandling(File, PIO_BCAST_ERROR) - ierr = pio_def_var(File, 'nextsw_cday', pio_int, nextsw_cday_desc) + ierr = pio_def_var(File, 'nextsw_cday', pio_double, nextsw_cday_desc) ierr = pio_put_att(File, nextsw_cday_desc, 'long_name', 'future radiation calday for surface models') if (radiation_do('aeres')) then diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index ba438ea8dc..b6bb57647e 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -33,7 +33,7 @@ module radiation use cam_history_support, only: fillvalue use pio, only: file_desc_t, var_desc_t, & - pio_int, pio_noerr, & + pio_int, pio_double, pio_noerr, & pio_seterrorhandling, pio_bcast_error, & pio_inq_varid, pio_def_var, & pio_put_var, pio_get_var, pio_put_att @@ -647,7 +647,7 @@ subroutine radiation_define_restart(file) call pio_seterrorhandling(File, PIO_BCAST_ERROR) - ierr = pio_def_var(File, 'nextsw_cday', pio_int, nextsw_cday_desc) + ierr = pio_def_var(File, 'nextsw_cday', pio_double, nextsw_cday_desc) ierr = pio_put_att(File, nextsw_cday_desc, 'long_name', 'future radiation calday for surface models') if (docosp) then ierr = pio_def_var(File, 'cosp_cnt_init', pio_int, cospcnt_desc) From 4b58c4e1458f4d401edbce9e94a30681c57b6303 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 8 Oct 2022 18:56:44 -0600 Subject: [PATCH 120/466] overhaul downdrafts to resolve various bugs --- src/physics/cam/clubb_intr.F90 | 143 ++++++++++++--- src/physics/cam/clubb_mf.F90 | 319 ++++++++++++++++++++------------- 2 files changed, 316 insertions(+), 146 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index a8fc7a5635..55fa1013dd 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -289,9 +289,17 @@ module clubb_intr prec_sh_idx, & snow_sh_idx - integer :: ztopm1_idx - integer :: ztopm2_idx + integer :: ztopmn_idx + integer :: ztopma_idx integer :: ztopm1_macmic_idx + integer :: ddcp_idx + integer :: ddcp_macmic_idx + integer :: ddcpmn_idx + +!+++ARH + integer, parameter :: ndd=8 + integer, parameter :: nud=8 +!---ARH ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -436,9 +444,12 @@ subroutine clubb_register_cam( ) call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) - call pbuf_add_field('ZTOPM1' ,'global' , dtype_r8, (/pcols/), ztopm1_idx) - call pbuf_add_field('ZTOPM2' ,'global' , dtype_r8, (/pcols/), ztopm2_idx) + call pbuf_add_field('ZTOPMN' ,'global' , dtype_r8, (/nud,pcols/), ztopmn_idx) + call pbuf_add_field('ZTOPMA' ,'global' , dtype_r8, (/pcols/), ztopma_idx) call pbuf_add_field('ZTOP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ztopm1_macmic_idx) + call pbuf_add_field('DDCP' ,'global' , dtype_r8, (/pcols/), ddcp_idx) + call pbuf_add_field('DDCP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ddcp_macmic_idx) + call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/ndd,pcols/), ddcpmn_idx) end if #endif @@ -1234,6 +1245,8 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') + call addfld ('RTM_CLUBB', (/ 'lev' /), 'A', 'kg/kg', 'Total Water Mixing Ratio') + call addfld ('THLM_CLUBB', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') @@ -1323,10 +1336,13 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thl flux (EDMF)' ) call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt flux (EDMF)' ) call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thv flux (EDMF)' ) + call addfld ( 'edmf_sqtup' , (/ 'ilev' /), 'A', 'kg/kg/s' , 'Plume updraft microphysics tendency (EDMF)' ) + call addfld ( 'edmf_sqtdn' , (/ 'ilev' /), 'A', 'kg/kg/s' , 'Plume downdraft microphysics tendency (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) + call addfld ( 'edmf_ddcp' , horiz_only, 'A', 'm/s' , 'edmf ddcp', flag_xyfill=.True.) call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) @@ -1340,8 +1356,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_upqc' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft entrainment rate (EDMF)' ) call addfld ( 'edmf_updet' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft dettrainment rate (EDMF)' ) - call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) + call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) call addfld ( 'edmf_dnw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume downdraft vertical velocity (EDMF)' ) + call addfld ( 'edmf_dnthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume downdraft liquid potential temperature (EDMF)' ) + call addfld ( 'edmf_dnqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume downdraft total water mixing ratio (EDMF)' ) end if call addfld ('QT_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') @@ -1398,6 +1416,8 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('THLP2_ZT_CLUBB', 1, ' ') call add_default('RTPTHLP_CLUBB', 1, ' ') call add_default('RCM_CLUBB', 1, ' ') + call add_default('RTM_CLUBB', 1, ' ') + call add_default('THLM_CLUBB', 1, ' ') call add_default('WPRCP_CLUBB', 1, ' ') call add_default('CLOUDFRAC_CLUBB', 1, ' ') call add_default('RCMINLAYER_CLUBB', 1, ' ') @@ -1489,10 +1509,13 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_qtforcdn' , 1, ' ') call add_default( 'edmf_thlforc' , 1, ' ') call add_default( 'edmf_qtforc' , 1, ' ') + call add_default( 'edmf_sqtup' , 1, ' ') + call add_default( 'edmf_sqtdn' , 1, ' ') call add_default( 'edmf_rcm' , 1, ' ') call add_default( 'edmf_cloudfrac', 1, ' ') call add_default( 'edmf_ent' , 1, ' ') call add_default( 'edmf_ztop' , 1, ' ') + call add_default( 'edmf_ddcp' , 1, ' ') call add_default( 'edmf_L0' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') end if @@ -1570,9 +1593,12 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) if (do_clubb_mf) then - call pbuf_set_field(pbuf2d, ztopm1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztopm2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztopmn_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztopma_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ztopm1_macmic_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ddcp_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ddcp_macmic_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ddcpmn_idx, 0.0_r8) end if endif @@ -1962,10 +1988,14 @@ subroutine clubb_tend_cam( & real(r8),pointer :: prec_sh(:) ! total precipitation from MF real(r8),pointer :: snow_sh(:) ! snow from MF - real(r8), pointer :: ztopm1(:) - real(r8), pointer :: ztopm2(:) + real(r8), pointer :: ztopmn(:,:) + real(r8), pointer :: ztopma(:) real(r8), pointer :: ztopm1_macmic(:) + real(r8), pointer :: ddcp(:) + real(r8), pointer :: ddcp_macmic(:) + real(r8), pointer :: ddcpmn(:,:) + real(r8), pointer :: qt_macmic(:,:) real(r8), pointer :: thl_macmic(:,:) real(r8), pointer :: rcm_macmic(:,:) @@ -2008,13 +2038,15 @@ subroutine clubb_tend_cam( & mf_rcm_output, mf_precc_output ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & - mf_cape_output, mf_cfl_output + mf_cape_output, mf_cfl_output, & + mf_ddcp_output ! ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforcup_output, mf_qtforcup_output, & ! thermodynamic grid mf_thlforcdn_output, mf_qtforcdn_output, & ! thermodynamic grid mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid mf_ent_output, & ! thermodynamic grid + mf_sqtup_output, mf_sqtdn_output, & ! thermodynamic grid mf_qc_output, mf_cloudfrac_output ! thermodynamic grid ! MF plume level outputs @@ -2042,9 +2074,14 @@ subroutine clubb_tend_cam( & mf_updet_output, & mf_upbuoy_output ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip, & + mf_dnthl_flip, & + mf_dnqt_flip + ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output, & + mf_dnthl_output, & + mf_dnqt_output ! MF Plume real(r8), pointer :: tpert(:) @@ -2107,7 +2144,10 @@ subroutine clubb_tend_cam( & real(r8) :: mf_ztop, mf_ztop_nadv, & mf_ztopm1, mf_ztopm1_nadv, & mf_precc_nadv, mf_snow_nadv,& - mf_L0, mf_L0_nadv + mf_L0, mf_L0_nadv, & + mf_ddcp, mf_ddcp_nadv + real(r8), parameter :: ddalph = 1.4E3_r8 + real(r8), parameter :: ddtau = 14400._r8 real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat @@ -2282,10 +2322,14 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) call pbuf_get_field(pbuf, tpert_idx, tpert) - call pbuf_get_field(pbuf, ztopm1_idx, ztopm1) - call pbuf_get_field(pbuf, ztopm2_idx, ztopm2) + call pbuf_get_field(pbuf, ztopmn_idx, ztopmn) + call pbuf_get_field(pbuf, ztopma_idx, ztopma) call pbuf_get_field(pbuf, ztopm1_macmic_idx, ztopm1_macmic) + call pbuf_get_field(pbuf, ddcp_idx, ddcp) + call pbuf_get_field(pbuf, ddcp_macmic_idx, ddcp_macmic) + call pbuf_get_field(pbuf, ddcpmn_idx, ddcpmn) + ! SVP do k = 1, pver call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) @@ -2573,16 +2617,23 @@ subroutine clubb_tend_cam( & mf_qtforcdn_output(:,:) = 0._r8 mf_thlforc_output(:,:) = 0._r8 mf_qtforc_output(:,:) = 0._r8 + mf_sqtup_output(:,:) = 0._r8 + mf_sqtdn_output(:,:) = 0._r8 mf_rcm_output(:,:) = 0._r8 mf_cloudfrac_output(:,:) = 0._r8 mf_ent_output(:,:) = 0._r8 mf_qc_output(:,:) = 0._r8 mf_ztop_output(:) = 0._r8 + mf_ddcp_output(:) = 0._r8 mf_L0_output(:) = 0._r8 mf_cape_output(:) = 0._r8 mf_cfl_output(:) = 0._r8 mf_dnw_output(:,:) = 0._r8 + mf_dnthl_output(:,:) = 0._r8 + mf_dnqt_output(:,:) = 0._r8 mf_dnw_flip(:,:,:) = 0._r8 + mf_dnthl_flip(:,:,:) = 0._r8 + mf_dnqt_flip(:,:,:) = 0._r8 ! Loop over all columns in lchnk to advance CLUBB core do i=1,ncol ! loop over columns @@ -2910,8 +2961,10 @@ subroutine clubb_tend_cam( & mf_ztop_nadv = 0._r8 mf_ztopm1 = 0._r8 mf_ztopm1_nadv = 0._r8 + mf_ddcp_nadv = 0._r8 if (macmic_it==1) ztopm1_macmic(i) = 0._r8 + if (macmic_it==1) ddcp_macmic(i) = 0._r8 mf_precc_nadv = 0._r8 mf_snow_nadv = 0._r8 @@ -2969,8 +3022,10 @@ subroutine clubb_tend_cam( & thv_ds_zm = zt2zm_api( thv_ds_zt ) end if - mf_ztopm1 = ztopm1(i) + !mf_ztopm1 = ztopm1(i) !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) + mf_ztopm1 = ztopma(i) + mf_ddcp = ddcp(i) rhinv = 0._r8 if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 @@ -2985,7 +3040,7 @@ subroutine clubb_tend_cam( & th_zm, qv_zm, qc_zm, & ! input th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input - mf_cape_output(i), & ! output - plume diagnostics + mf_cape_output(i), mf_ddcp, & ! output - plume diagnostics mf_upa, mf_dna, & ! output - plume diagnostics mf_upw, mf_dnw, & ! output - plume diagnostics mf_upmf, & ! output - plume diagnostics @@ -3099,6 +3154,7 @@ subroutine clubb_tend_cam( & mf_L0_nadv = mf_L0_nadv + mf_L0 mf_ztop_nadv = mf_ztop_nadv + mf_ztop mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 + mf_ddcp_nadv = mf_ddcp_nadv + mf_ddcp mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp) + mf_thlforcup(:pverp) mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp) + mf_qtforcup(:pverp) @@ -3185,15 +3241,43 @@ subroutine clubb_tend_cam( & enddo ! end time loop if (do_clubb_mf) then + ! average over nadv mf_L0_nadv = mf_L0_nadv/REAL(nadv) mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) - mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) + mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) + + ! accumulate in buffer ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv + ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv + if (macmic_it == cld_macmic_num_steps) then - ztopm2(i) = ztopm1(i) - ztopm1(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - !if (masterproc) write(100+iam,*) "nstep, updated ztopm1, ztopm2, ", get_nstep(), ztopm1(i), ztopm2(i) + + if (nud == 1) then + ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) + else + ztopmn(2:nud,i) = ztopmn(1:nud-1,i) + ztopmn(1,i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) + ztopma(i) = 0._r8 + do t=1,nud + ztopma(i) = ztopma(i) + ztopmn(t,i) + end do + ztopma(i) = ztopma(i)/REAL(nud) + end if + + if (ndd == 1) then + ddcp(i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) + else + ddcpmn(2:ndd,i) = ddcpmn(1:ndd-1,i) + ddcpmn(1,i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) + ddcp(i) = 0._r8 + do t=1,ndd + ddcp(i) = ddcp(i) + ddcpmn(t,i) + end do + ddcp(i) = ddcp(i)/REAL(ndd) + end if + ddcp(i) = ddalph*ddcp(i) + end if mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) @@ -3331,6 +3415,8 @@ subroutine clubb_tend_cam( & s_awu_output(i,pverp-k+1) = s_awu(k) s_awv_output(i,pverp-k+1) = s_awv(k) + mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) + mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) @@ -3367,6 +3453,8 @@ subroutine clubb_tend_cam( & mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) end if enddo @@ -3377,6 +3465,7 @@ subroutine clubb_tend_cam( & mf_ztop_output(i) = mf_ztop_nadv mf_L0_output(i) = mf_L0_nadv mf_cfl_output(i) = max_cfl_nadv + mf_ddcp_output(i) = ddcp(i) do k=1,clubb_mf_nup mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) @@ -3388,8 +3477,10 @@ subroutine clubb_tend_cam( & mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) - mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k) = mf_upbuoy_flip(i,:pverp,k) + mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) + mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) + mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) end do end if @@ -4108,6 +4199,9 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) + call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) + call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) + temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) @@ -4203,7 +4297,12 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) call outfld( 'edmf_dnw' , mf_dnw_output, pcols, lchnk ) + call outfld( 'edmf_dnthl' , mf_dnthl_output, pcols, lchnk ) + call outfld( 'edmf_dnqt' , mf_dnqt_output, pcols, lchnk ) + call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) + call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) + call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7508789640..d8a6365c49 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -129,7 +129,7 @@ subroutine integrate_mf( nz, th_zm, qv_zm, qc_zm, & ! input ths, wthl, wqt, pblh, & ! input wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input - mcape, & ! output + mcape, ddcp, & ! output upa, dna, & ! output upw, dnw, & ! output upmf, & ! output @@ -211,7 +211,7 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv real(r8), intent(in) :: ths - real(r8), intent(inout) :: ztopm1 + real(r8), intent(inout) :: ztopm1,ddcp real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid @@ -258,7 +258,7 @@ subroutine integrate_mf( nz, precc real(r8), intent(out) :: ztop, dynamic_L0, & - mcape + mcape ! =============================================================================== ! ! INTERNAL VARIABLES ! @@ -291,9 +291,9 @@ subroutine integrate_mf( nz, integer, dimension(nz,clubb_mf_nup) :: enti ! thermodynamic grid ! ! other variables - integer :: k,i,kstart,ddtop + integer :: k,i,kstart,ddtop,kcb real(r8), dimension(clubb_mf_nup) :: zcb - real(r8) :: zcb_unset, & + real(r8) :: zcb_unset, ddint,iddcp, & wthv, & wstar, qstar, thvstar, & sigmaw, sigmaqt, sigmathv,& @@ -303,7 +303,8 @@ subroutine integrate_mf( nz, entexp, entexpu, entw, & ! thermodynamic grid Mn, & ! momentum grid eturb, det, lmixt, & ! thermodynamic grid - qtovqs, sevap, & ! thermodynamic grid + qtovqs, sevap, taum1, & ! thermodynamic grid + sqtint, sthlint, alphint, & betathl,betaqt, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid qtn, qsn, & ! momentum grid @@ -376,7 +377,8 @@ subroutine integrate_mf( nz, real(r8),parameter :: ke = 2.5e-4_r8 ! ! height here downdrafts feel the surface - real(r8),parameter :: z00dn = 1.e3_r8 + real(r8),parameter :: z00dn = 1.e3_r8, & + tinynum = 1.e-7_r8 ! ! to fix entrainmnet rate logical :: fixent = .false. @@ -522,95 +524,14 @@ subroutine integrate_mf( nz, zcb_unset = 9999999._r8 zcb = zcb_unset - convh = max(pblh,pblhmin) -!+++ARH - convh = max(pblh,ztopm1) -!---ARH + ! surface buoyancy flux wthv = wthl+zvir*ths*wqt ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then ! --------------------------------------------------------- ! - ! Construct PDF at the surface from surface fluxes ! - ! and initialize plume thv, qt, w ! - ! --------------------------------------------------------- ! - - wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) - qstar = wqt / wstar - thvstar = wthv / wstar - - sigmaw = alphw * wstar - sigmaqt = alphqt * abs(qstar) - sigmathv = alphthv * abs(thvstar) - - wmin = sigmaw * pwmin - wmax = sigmaw * pwmax - - do i=1,clubb_mf_nup - wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) - wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) - - upw(1,i) = 0.5_r8 * (wlv+wtv) - upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & - - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) - - upmf(1,i)= rho_zm(1)*upa(1,i)*upw(1,i) - - upu(1,i) = u(1) - upv(1,i) = v(1) - - upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw - upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw - enddo - - facqtu=1._r8 - facthvu=1._r8 - if (scalesrf) then - ! scale surface fluxes - ! (req'd for conservation if not running with zero-flux b.c.'s) - srfwqtu = 0._r8 - srfwthvu = 0._r8 - srfarea = 0._r8 - do i=1,clubb_mf_nup - srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) - srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) - srfarea = srfarea+upa(1,i) - end do - facqtu=srfarea*wqt/srfwqtu - facthvu=srfarea*wthv/srfwthvu - end if - - do i=1,clubb_mf_nup - - betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - - upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) - upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) - - upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) - upth(1,i) = upthl(1,i) - - ! get cloud, lowest momentum level - if (do_condensation) then - call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & - thvn, qcn, thn, qln, qin, qsn, lmixn) - upthv(1,i) = thvn - upqc(1,i) = qcn - upql(1,i) = qln - upqi(1,i) = qin - upqs(1,i) = qsn - upth(1,i) = thn - if (qcn > 0._r8) zcb(i) = zm(1) - else - ! assume no cldliq - upqc(1,i) = 0._r8 - end if - end do - - ! --------------------------------------------------------- ! - ! Calculate dynamic_L based on value of namelist ! + ! Calculate ztop and dynamic_L based on value of namelist ! ! should probably make into a subroutine ! ! --------------------------------------------------------- ! @@ -682,7 +603,7 @@ subroutine integrate_mf( nz, !end do !mcape = mcape/REAL(clubb_mf_nup) mcape = max(cape(1),25._r8) - + if (clubb_mf_Lopt==4) then ztop = max(zt(lel(1)+1),convh) else if (clubb_mf_Lopt==5) then @@ -704,6 +625,91 @@ subroutine integrate_mf( nz, dynamic_L0 = max(min_L0,dynamic_L0) dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) + ! --------------------------------------------------------- ! + ! Initialize using Deardorff convective velocity scale ! + ! --------------------------------------------------------- ! + + convh = max(pblh,pblhmin) + !convh = max(pblh,ztop) + wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) + + ! --------------------------------------------------------- ! + ! Construct tri-variate PDF at the surface from wstar ! + ! and initialize plume thv, qt, w ! + ! --------------------------------------------------------- ! + + qstar = wqt / wstar + thvstar = wthv / wstar + + sigmaw = alphw * wstar + sigmaqt = alphqt * abs(qstar) + sigmathv = alphthv * abs(thvstar) + + wmin = sigmaw * pwmin + wmax = sigmaw * pwmax + + do i=1,clubb_mf_nup + wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) + wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) + + upw(1,i) = 0.5_r8 * (wlv+wtv) + upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & + - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) + + upmf(1,i)= rho_zm(1)*upa(1,i)*upw(1,i) + + upu(1,i) = u(1) + upv(1,i) = v(1) + + upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw + upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw + enddo + + facqtu=1._r8 + facthvu=1._r8 + if (scalesrf) then + ! scale surface fluxes + ! (req'd for conservation if not running with zero-flux b.c.'s) + srfwqtu = 0._r8 + srfwthvu = 0._r8 + srfarea = 0._r8 + do i=1,clubb_mf_nup + srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) + srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) + srfarea = srfarea+upa(1,i) + end do + facqtu=srfarea*wqt/srfwqtu + facthvu=srfarea*wthv/srfwthvu + end if + + do i=1,clubb_mf_nup + + betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + + upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) + upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + + upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) + upth(1,i) = upthl(1,i) + + ! get cloud, lowest momentum level + if (do_condensation) then + call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & + thvn, qcn, thn, qln, qin, qsn, lmixn) + upthv(1,i) = thvn + upqc(1,i) = qcn + upql(1,i) = qln + upqi(1,i) = qin + upqs(1,i) = qsn + upth(1,i) = thn + if (qcn > 0._r8) zcb(i) = zm(1) + else + ! assume no cldliq + upqc(1,i) = 0._r8 + end if + end do + ! --------------------------------------------------------- ! ! Stochastic entrainmnet calculation ! ! From Suselj et al 2019, after Romps and Kuang 2010 ! @@ -870,7 +876,7 @@ subroutine integrate_mf( nz, un = u(k+1) *(1._r8-entexpu) + upu (k,i)*entexpu vn = v(k+1) *(1._r8-entexpu) + upv (k,i)*entexpu - ! convert source terms to a tendency + ! convert source terms to a tendency (convert from S*dz/w to S) supqt(k+1,i) = supqt(k+1,i)*upw(k,i)/dzt(k+1) upauto(k+1,i) = supqt(k+1,i) supthl(k+1,i) = supthl(k+1,i)*upw(k,i)/dzt(k+1) @@ -990,38 +996,41 @@ subroutine integrate_mf( nz, ! Kay initializes using negative of the updraft velocity ! this causes anomalouly large downdrafts at the initializaiton level ! I am intializing with zero velocity as that is more physically defensible - dnw(ddtop,i) = 0._r8 + dnw(ddtop,i) = -1._r8*mindnw !upw(ddtop,i) ! 0._r8 dna(ddtop,i) = upa(ddtop,i) dnu(ddtop,i) = 0.5_r8*(u(ddtop)+u(ddtop+1)) dnv(ddtop,i) = 0.5_r8*(v(ddtop)+v(ddtop+1)) dnqt(ddtop,i) = qt_zm(ddtop) dnthl(ddtop,i) = thl_zm(ddtop) dnthv(ddtop,i) = thv_zm(ddtop) + + ! get rain generated in the updraft, appropriate it to the downdraft dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*upauto(ddtop,i)*clubb_mf_fdd - call condensation_mf(dnqt(ddtop,i), dnthl(ddtop,i), p_zm(ddtop), iexner_zm(ddtop), & - dnthv(ddtop,i), dnqc(ddtop,i), dnth(ddtop,i), dnql(ddtop,i), dnqi(ddtop,i), & - dnqs(ddtop,i), dnlmix(ddtop,i)) - + ! downdraft qsat + call qsat(dnthl(ddtop,i)/iexner_zm(ddtop),p_zm(ddtop),es,dnqs(ddtop,i)) + do k = ddtop-1,1,-1 - ! assume fixed area + ! assume fixed area with height dna(k,i) = dna(k+1,i) - ! get rain evaporation - qtovqs = min(1._r8,dnqt(k+1,i)/dnqs(k+1,i)) - sevap = ke*(1._r8 - qtovqs)*sqrt(max(dnrr(k+1,i),0._r8)) + ! get rain evaporation in integrated form + taum1 = ke*sqrt(dnrr(k+1,i))/dnqs(k+1,i) + alphint = exp(dzt(k+1)*taum1/dnw(k+1,i)) + sqtint = max( (dnqs(k+1,i) - dnqt(k+1,i))*(1._r8 - alphint) ,0._r8) - ! limit evaporation to available precip - sevap = min(sevap,( dnrr(k+1,i)/(rho_zt(k+1)*dzt(k+1)) - upauto(k+1,i)*clubb_mf_fdd )) + ! limit to available rain + sqtint = min( sqtint, -1._r8*dnrr(k+1,i) / (rho_zt(k+1)*dzt(k+1)*dnw(k+1,i)) ) + sthlint = -1._r8*latvap*sqtint*iexner_zt(k+1)/cpair - ! compute rain rate - dnrr(k,i) = dnrr(k+1,i) & - - rho_zt(k+1)*dzt(k+1)*(sevap + upauto(k+1,i)*clubb_mf_fdd) + ! get rain evaporation in tendency form + sdnqt(k,i) = max( (dnqs(k+1,i) - dnqt(k+1,i))*taum1, 0._r8 ) + sdnthl(k,i) = -1._r8*latvap*sevap*iexner_zt(k+1)/cpair - ! save microphysics tendenices - sdnqt(k,i) = sevap - sdnthl(k,i) = -1._r8*dnlmix(k+1,i)*sevap*iexner_zt(k+1)/cpair + ! compute rain rate (rain above - evaporation + appropriate updraft rain) + dnrr(k,i) = max( dnrr(k+1,i) & + - rho_zt(k+1)*dzt(k+1)*(sdnqt(k,i) + upauto(k+1,i)*clubb_mf_fdd) , 0._r8 ) if (fixent) then entn = fixent_ent @@ -1031,18 +1040,24 @@ subroutine integrate_mf( nz, end if ! include eturb? - entexp = exp(-entn*eturb*dzt(k+1)) - entexpu = exp(-entn*dzt(k+1)/3._r8) + entexp = exp(-1._r8*entn*eturb*dzt(k+1)) + entexpu = exp(-1._r8*entn*dzt(k+1)/3._r8) ! integrate downward dnu(k,i) = u(k+1) *(1._r8-entexpu) + dnu (k+1,i)*entexpu dnv(k,i) = v(k+1) *(1._r8-entexpu) + dnv (k+1,i)*entexpu - dnqt(k,i) = qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sdnqt(k,i) - dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sdnthl(k,i) + dnqt(k,i) = qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sqtint + dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sthlint + !dnu(k,i) = dnu (k+1,i) + (dnu (k+1,i)- u(k+1))*(1._r8-entexpu) + !dnv(k,i) = dnv (k+1,i) + (dnv (k+1,i)- v(k+1))*(1._r8-entexpu) + !dnqt(k,i) = dnqt (k+1,i) + (dnqt (k+1,i)- qt(k+1))*(1._r8-entexp ) + sqtint + !dnthl(k,i) = dnthl(k+1,i) + (dnthl(k+1,i)-thl(k+1))*(1._r8-entexp ) + sthlint - call condensation_mf(dnqt(k,i), dnthl(k,i), p_zm(k), iexner_zm(k), & - dnthv(k,i), dnqc(k,i), dnth(k,i), dnql(k,i), dnqi(k,i), & - dnqs(k,i), dnlmix(k,i)) + ! get qsat + call qsat(dnthl(k,i)/iexner_zm(k),p_zm(k),es,dnqs(k,i)) + + ! get virtual temperature + dnthv(k,i) = dnthl(k,i)*(1._r8+zvir*dnqt(k,i)) ! get buoyancy ! (midpoint k is surrounded by interface k and k-1, @@ -1052,7 +1067,8 @@ subroutine integrate_mf( nz, ! get wn2 ! Kay uses the following eqn for wp, but I don't undestand it !wp = wb*entn+5._r8/(zm(k)+1.e-7_r8)*max(1._r8-exp( zm(k)/z00dn-1._r8 ),0._r8) - wp = wb*entn*eturb + wp = wb*entn*eturb & + + 1._r8/( 2._r8*zm(k)+tinynum ) * max( 1._r8 - exp( zm(k)/z00dn-1._r8), 0._r8 ) if (wp==0._r8) then wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) else @@ -1062,13 +1078,6 @@ subroutine integrate_mf( nz, wn2 = max(wn2,mindnw**2._r8) dnw(k,i) = -1._r8*sqrt(wn2) - ! zero out initialized downdraft level ddtop - ! (including the ddtop values leads to unrealistic - ! ensemble mean fluxes due to dnw(ddtop,:) = -upw(ddtop,:)) - !if (k.eq.(ddtop-1)) then - ! dnw(ddtop,i) = 0._r8 - !end if - end do!k end if @@ -1227,6 +1236,68 @@ subroutine integrate_mf( nz, if (ac(k) > 0._r8) ztopm1 = zm(k) end do + ! --------------------------------------------------------- ! + ! bulk downdraft velocity for coldpool parameterization ! + ! --------------------------------------------------------- ! + +! ! find cloud base +! kcb = 0 +! do k=1,nz +! if (moist_qc(k) > 0._r8) then +! kcb = k +! exit +! end if +! end do +! +! ! reset ddcp +! ddcp = 0._r8 +! if (kcb == 0) then +! continue +! else if (kcb == 1) then +! ddcp = ddcp + awdn(k) +! continue +! else +! ddint = 0._r8 +! do k=1,kcb-1 +! ddint = ddint + awdn(k)*dzt(k+1) +! end do +! ddcp = ddcp + -1._r8*ddint/zm(kcb) +! end if + + ! reset ddcp + ddcp = 0._r8 + do i=1,clubb_mf_nup + ! find cloud base + kcb = 0 + do k=1,nz + if (upqc(k,i) > 0._r8) then + kcb = k + exit + end if + end do + + ! reset iddcp + iddcp = 0._r8 + if (kcb == 0) then + continue + else if (kcb == 1) then + iddcp = iddcp + dna(k,i)*dnw(k,i) + continue + else + ddint = 0._r8 + do k=1,kcb-1 + ddint = ddint + dna(k,i)*dnw(k,i)*dzt(k+1) + end do + iddcp = iddcp + -1._r8*ddint/zm(kcb) + end if + ddcp = ddcp + iddcp + + end do +!+++ARH + if (masterproc) write(iulog,*) 'ddcp=',ddcp,' wstar=',wstar + ddcp = ddcp/wstar +!---ARH + ! --------------------------------------------------------- ! ! downward sweep to get ensemble mean precip ! ! --------------------------------------------------------- ! From 81589d458c3e6539bcdf037a5a0a55e281754694 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 9 Oct 2022 09:31:56 -0600 Subject: [PATCH 121/466] cold pool param implemented --- src/physics/cam/clubb_intr.F90 | 4 +-- src/physics/cam/clubb_mf.F90 | 64 +++++++++++++--------------------- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 55fa1013dd..a6776a6faa 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2146,7 +2146,7 @@ subroutine clubb_tend_cam( & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & mf_ddcp, mf_ddcp_nadv - real(r8), parameter :: ddalph = 1.4E3_r8 + real(r8), parameter :: ddalph = 1.2e3 !1.4E3_r8 real(r8), parameter :: ddtau = 14400._r8 real(r8), dimension(pcols,pver) :: esat, rh @@ -3022,8 +3022,6 @@ subroutine clubb_tend_cam( & thv_ds_zm = zt2zm_api( thv_ds_zt ) end if - !mf_ztopm1 = ztopm1(i) - !mf_ztopm1 = 0.5_r8*(ztopm1(i) + ztopm2(i)) mf_ztopm1 = ztopma(i) mf_ddcp = ddcp(i) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index d8a6365c49..a356768c9b 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -293,8 +293,8 @@ subroutine integrate_mf( nz, ! other variables integer :: k,i,kstart,ddtop,kcb real(r8), dimension(clubb_mf_nup) :: zcb - real(r8) :: zcb_unset, ddint,iddcp, & - wthv, & + real(r8) :: zcb_unset, cpfac, & + wthv, ddint, iddcp, & wstar, qstar, thvstar, & sigmaw, sigmaqt, sigmathv,& convh, wmin, wmax, & @@ -356,7 +356,7 @@ subroutine integrate_mf( nz, pwmax = 3._r8 ! - ! alpha, z-scores after Suselj etal 2019 + ! alpha relates star qunataties to stddev after Suselj etal 2019 real(r8),parameter :: alphw = 0.572_r8, & alphqt = 2.890_r8, & alphthv = 2.890_r8 @@ -407,6 +407,9 @@ subroutine integrate_mf( nz, ! ! minimum downdraft speed real(r8),parameter :: mindnw = 1.E-2_r8 + ! + ! turn on cold-pool feedbacks + logical :: coldpool = .false. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! @@ -621,18 +624,27 @@ subroutine integrate_mf( nz, dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) end if - ! limiter to avoid division by zero - dynamic_L0 = max(min_L0,dynamic_L0) - dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) - ! --------------------------------------------------------- ! ! Initialize using Deardorff convective velocity scale ! ! --------------------------------------------------------- ! convh = max(pblh,pblhmin) - !convh = max(pblh,ztop) wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) + ! --------------------------------------------------------- ! + ! Compute cold pool feedback parameter ! + ! --------------------------------------------------------- ! + + cpfac = 1._r8 + if (coldpool) cpfac = max(ddcp/wstar,1._r8) + + ! affect the entrainmnet length scale + dynamic_L0 = dynamic_L0 * cpfac + + ! limit max/min + dynamic_L0 = max(min_L0,dynamic_L0) + dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) + ! --------------------------------------------------------- ! ! Construct tri-variate PDF at the surface from wstar ! ! and initialize plume thv, qt, w ! @@ -641,9 +653,9 @@ subroutine integrate_mf( nz, qstar = wqt / wstar thvstar = wthv / wstar - sigmaw = alphw * wstar - sigmaqt = alphqt * abs(qstar) - sigmathv = alphthv * abs(thvstar) + sigmaw = alphw * wstar * cpfac + sigmaqt = alphqt * abs(qstar) * cpfac + sigmathv = alphthv * abs(thvstar) * cpfac wmin = sigmaw * pwmin wmax = sigmaw * pwmax @@ -1240,30 +1252,6 @@ subroutine integrate_mf( nz, ! bulk downdraft velocity for coldpool parameterization ! ! --------------------------------------------------------- ! -! ! find cloud base -! kcb = 0 -! do k=1,nz -! if (moist_qc(k) > 0._r8) then -! kcb = k -! exit -! end if -! end do -! -! ! reset ddcp -! ddcp = 0._r8 -! if (kcb == 0) then -! continue -! else if (kcb == 1) then -! ddcp = ddcp + awdn(k) -! continue -! else -! ddint = 0._r8 -! do k=1,kcb-1 -! ddint = ddint + awdn(k)*dzt(k+1) -! end do -! ddcp = ddcp + -1._r8*ddint/zm(kcb) -! end if - ! reset ddcp ddcp = 0._r8 do i=1,clubb_mf_nup @@ -1291,12 +1279,8 @@ subroutine integrate_mf( nz, iddcp = iddcp + -1._r8*ddint/zm(kcb) end if ddcp = ddcp + iddcp - + ! end do -!+++ARH - if (masterproc) write(iulog,*) 'ddcp=',ddcp,' wstar=',wstar - ddcp = ddcp/wstar -!---ARH ! --------------------------------------------------------- ! ! downward sweep to get ensemble mean precip ! From ed12f8968f350d47476a63a0fcef18f60c4953d4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 9 Oct 2022 09:33:03 -0600 Subject: [PATCH 122/466] use default parameters --- src/physics/cam/clubb_intr.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index a6776a6faa..dcedfa9366 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2146,7 +2146,7 @@ subroutine clubb_tend_cam( & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & mf_ddcp, mf_ddcp_nadv - real(r8), parameter :: ddalph = 1.2e3 !1.4E3_r8 + real(r8), parameter :: ddalph = 1.4E3_r8 real(r8), parameter :: ddtau = 14400._r8 real(r8), dimension(pcols,pver) :: esat, rh From 8200a978043480e5e80edea788c08b9becbf24e1 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 13 Oct 2022 14:26:09 -0600 Subject: [PATCH 123/466] omit turublent fluxes where dd velocity equals ddmin --- src/physics/cam/clubb_mf.F90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index a356768c9b..04f57b7380 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1096,6 +1096,13 @@ subroutine integrate_mf( nz, end do!i + ! zero out downdraft fluxes for dnw == -mindnw + do i=1,clubb_mf_nup + do k=1,nz + if ( dnw(k,i) == -1._r8*mindnw ) dnw(k,i) = 0._r8 + end do + end do + end if ! end computing downdrafts From 19f2dc0135fc4ae7c5335ed6b65902537b751798 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 20 Oct 2022 17:33:48 -0600 Subject: [PATCH 124/466] update coldpool feedbacks --- bld/build-namelist | 5 +++ bld/namelist_files/namelist_defaults_cam.xml | 3 ++ bld/namelist_files/namelist_definition.xml | 28 ++++++++++++++++ src/physics/cam/clubb_intr.F90 | 34 ++++++++------------ src/physics/cam/clubb_mf.F90 | 28 +++++++++++++--- 5 files changed, 73 insertions(+), 25 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 8c0542255a..902ae679a2 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3146,6 +3146,11 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_nup'); add_default($nl, 'clubb_mf_max_L0'); add_default($nl, 'clubb_mf_fdd'); + add_default($nl, 'do_clubb_mf_coldpool'); + add_default($nl, 'clubb_mf_ddalph'); + add_default($nl, 'clubb_mf_ddbeta'); + add_default($nl, 'clubb_mf_up_ndt'); + add_default($nl, 'clubb_mf_cp_ndt'); } # Force exit if running cam_dev and CLUBB is off diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 40ad9757ef..f649226ad1 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1953,6 +1953,9 @@ 10 10.e3 0.0 + .false + 2.e2 + 0.3 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 727a27a490..705e421a3e 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3944,6 +3944,34 @@ Default: 10.e3 Fraction of autoconversion partitioned to downdrafts (zero means no downdrafts) Default: 0.0 + +If .true. turn on cold pool feedback parameterizations +Default: .false. + + + +Linear enhancement factor to the downdrafts used for the cold pool calculations +Default: 200.0 + + +Exponent enhancement factor to the downdrafts used for the cold pool calculations +Default: 0.3 + + +Real: number of time-steps for running average of the convective height scale +Default: 1 + + + +Real: number of time-steps for running average of cold pool effects +Default: 1 + + Date: Thu, 20 Oct 2022 17:35:30 -0600 Subject: [PATCH 125/466] change namelist defaults for beta and ent0 --- bld/namelist_files/namelist_defaults_cam.xml | 4 ++-- bld/namelist_files/namelist_definition.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index f649226ad1..86334e30a4 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1945,7 +1945,7 @@ .false. .false. 50.0 - 0.22 + 0.2 0.0 0 2.0 @@ -1955,7 +1955,7 @@ 0.0 .false 2.e2 - 0.3 + 1.0 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 705e421a3e..ee340ab4f0 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3958,7 +3958,7 @@ Default: 200.0 Exponent enhancement factor to the downdrafts used for the cold pool calculations -Default: 0.3 +Default: 1.0 From b7167c1fb3e8a76415e7a3246bd5405a9bb4f693 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 20 Oct 2022 18:48:03 -0600 Subject: [PATCH 126/466] fix limiter on cpfac --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 14623c4556..585cd49096 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -654,7 +654,7 @@ subroutine integrate_mf( nz, ! --------------------------------------------------------- ! cpfac = 1._r8 - if (do_clubb_mf_coldpool) cpfac = ( min(max(ddcp/wstar,1._r8),max_cpfac) )**clubb_mf_ddbeta + if (do_clubb_mf_coldpool) cpfac = min( (max(ddcp/wstar,1._r8))**clubb_mf_ddbeta, max_cpfac ) ! affect the entrainmnet length scale dynamic_L0 = dynamic_L0 * cpfac From d58c2be55a36364700d694f90b2c315f24b528a9 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 9 Nov 2022 13:41:50 -0700 Subject: [PATCH 127/466] fixed bug with downdrafts code --- src/chemistry/utils/aircraft_emit.F90 | 5 ++++- src/physics/cam/clubb_intr.F90 | 8 ++++---- src/physics/cam/clubb_mf.F90 | 11 +++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/chemistry/utils/aircraft_emit.F90 b/src/chemistry/utils/aircraft_emit.F90 index f2a242aa63..a87d8608fb 100644 --- a/src/chemistry/utils/aircraft_emit.F90 +++ b/src/chemistry/utils/aircraft_emit.F90 @@ -208,7 +208,10 @@ subroutine aircraft_emit_init() !----------------------------------------------------------------------- forcings_air(m)%file%stepTime = .true. ! Aircraft data is not to be interpolated in time forcings_air(m)%file%cyclical_list = .true. ! Aircraft data cycles over the filename list - forcings_air(m)%file%weight_by_lat = .true. ! Aircraft data - interpolated with latitude weighting +!+++ARH + !forcings_air(m)%file%weight_by_lat = .true. ! Aircraft data - interpolated with latitude weighting + forcings_air(m)%file%weight_by_lat = .false. +!---ARH forcings_air(m)%file%conserve_column = .true. ! Aircraft data - vertically interpolated to conserve the total column forcings_air(m)%file%dist = dist(m) forcings_air(m)%species = spc_name diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index db14e1296f..b816aee441 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1332,8 +1332,8 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thl flux (EDMF)' ) call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt flux (EDMF)' ) call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thv flux (EDMF)' ) - call addfld ( 'edmf_sqtup' , (/ 'ilev' /), 'A', 'kg/kg/s' , 'Plume updraft microphysics tendency (EDMF)' ) - call addfld ( 'edmf_sqtdn' , (/ 'ilev' /), 'A', 'kg/kg/s' , 'Plume downdraft microphysics tendency (EDMF)' ) + call addfld ( 'edmf_sqtup' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume updraft microphysics tendency (EDMF)' ) + call addfld ( 'edmf_sqtdn' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume downdraft microphysics tendency (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) @@ -3407,8 +3407,6 @@ subroutine clubb_tend_cam( & s_awu_output(i,pverp-k+1) = s_awu(k) s_awv_output(i,pverp-k+1) = s_awv(k) - mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) - mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) @@ -3427,6 +3425,8 @@ subroutine clubb_tend_cam( & mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(k) mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) + mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) + mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 585cd49096..9648566ad9 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -645,7 +645,6 @@ subroutine integrate_mf( nz, ! --------------------------------------------------------- ! ! Initialize using Deardorff convective velocity scale ! ! --------------------------------------------------------- ! - convh = max(pblh,pblhmin) wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) @@ -792,6 +791,11 @@ subroutine integrate_mf( nz, wn = 0.5_r8*(wn + wn0) end if + ! save this iteration + qtn0 = qtn + thln0 = thln + wn0 = wn + ! --------------------------------------------------------- ! ! Compute excess water to derive neutral mixing fraction ! ! after Bretherton et al 2014 ! @@ -892,11 +896,6 @@ subroutine integrate_mf( nz, end if entn = entn * eturb - ! save this iteration - qtn0 = qtn - thln0 = thln - wn0 = wn - ! integrate updraft entexp = exp(-entn*eturb*dzt(k+1)) entexpu = exp(-entn*dzt(k+1)/3._r8) From de46949384bb4c31d12623607794b2d4bf6c390a Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 20 Nov 2022 08:54:38 -0700 Subject: [PATCH 128/466] bug fixes for amip --- src/physics/cam/clubb_intr.F90 | 6 ++++++ src/physics/cam/clubb_mf.F90 | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index b816aee441..1ba88fd014 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2960,6 +2960,12 @@ subroutine clubb_tend_cam( & if (macmic_it==1) ztopm1_macmic(i) = 0._r8 if (macmic_it==1) ddcp_macmic(i) = 0._r8 +!+++ARH - Temporary hack - pbuf_set_field is apparently not taking? + if (is_first_step()) then + ddcp(i) = 0._r8 + end if +!---ARH + mf_precc_nadv = 0._r8 mf_snow_nadv = 0._r8 diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 9648566ad9..f909a4b7d3 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1266,6 +1266,7 @@ subroutine integrate_mf( nz, sqt(k) = 0_r8 sthl(k) = 0._r8 ztopm1 = zm(1) + ddcp = 0._r8 return end if ! height of the plume ensemble @@ -1347,6 +1348,9 @@ subroutine integrate_mf( nz, qtflx (k) = qtflxup (k) + qtflxdn (k) enddo + else + ddcp = 0._r8 + ztopm1 = zm(1) end if ! ( wthv > 0.0 ) end subroutine integrate_mf From b817bd115a9dda1bf09fee1bb97b1a0c502fccb6 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 26 Nov 2022 16:47:19 -0700 Subject: [PATCH 129/466] hard clipping of clubb rtm; modify cfl limiter for case of M < 0 --- src/physics/cam/clubb_intr.F90 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 1ba88fd014..40194142ad 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1514,6 +1514,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_ddcp' , 1, ' ') call add_default( 'edmf_L0' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') + call add_default( 'edmf_cfl' , 1, ' ') end if call add_default( 'QT_macmic' , 1, ' ') call add_default( 'THETAL_macmic' , 1, ' ') @@ -2961,7 +2962,7 @@ subroutine clubb_tend_cam( & if (macmic_it==1) ddcp_macmic(i) = 0._r8 !+++ARH - Temporary hack - pbuf_set_field is apparently not taking? - if (is_first_step()) then + if (is_first_step() .and. macmic_it==1) then ddcp(i) = 0._r8 end if !---ARH @@ -3078,7 +3079,7 @@ subroutine clubb_tend_cam( & s_aw(1) = 0._r8 max_cfl = 0._r8 do k=2,pverp - max_cfl = max(max_cfl,dtime*invrs_dzt(k)*max(s_aw(k-1),s_aw(k))) + max_cfl = max(max_cfl,dtime*invrs_dzt(k)*max(abs(s_aw(k-1)),abs(s_aw(k)))) end do cflfac = 1._r8 cfllim = .true. @@ -3236,6 +3237,12 @@ subroutine clubb_tend_cam( & if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& out_radzt,out_radzm,out_sfc) + + ! Hard clipping of rtm. Note this will violate mass/energy conservation + do k=1,pverp + if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) + end do + enddo ! end time loop if (do_clubb_mf) then From f4f127c7927b07523c7ebd9b1b4f952c8a127c82 Mon Sep 17 00:00:00 2001 From: adamrher Date: Sun, 27 Nov 2022 09:23:44 -0700 Subject: [PATCH 130/466] added cam_dev bug fix https://github.com/ESCOMP/CAM/pull/703 --- src/physics/rrtmg/cloud_rad_props.F90 | 13 +++++++++++-- src/physics/rrtmg/radiation.F90 | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/physics/rrtmg/cloud_rad_props.F90 b/src/physics/rrtmg/cloud_rad_props.F90 index 5fa8440fb5..56b837a874 100644 --- a/src/physics/rrtmg/cloud_rad_props.F90 +++ b/src/physics/rrtmg/cloud_rad_props.F90 @@ -6,7 +6,8 @@ module cloud_rad_props use shr_kind_mod, only: r8 => shr_kind_r8 use ppgrid, only: pcols, pver, pverp use physics_types, only: physics_state -use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx +use physics_buffer, only: physics_buffer_desc, pbuf_set_field, pbuf_get_index, pbuf_get_field, & + pbuf_old_tim_idx use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag use cam_abortutils, only: endrun use rad_constituents, only: iceopticsfile, liqopticsfile @@ -67,7 +68,7 @@ module cloud_rad_props contains !============================================================================== -subroutine cloud_rad_props_init() +subroutine cloud_rad_props_init(pbuf2d) use netcdf use spmd_utils, only: masterproc @@ -80,6 +81,8 @@ subroutine cloud_rad_props_init() use slingo, only: slingo_rad_props_init use ebert_curry, only: ec_rad_props_init, scalefactor + type(physics_buffer_desc), pointer :: pbuf2d(:,:) + character(len=256) :: liquidfile character(len=256) :: icefile character(len=256) :: locfn @@ -113,6 +116,12 @@ subroutine cloud_rad_props_init() i_icgrauwp = pbuf_get_index('ICGRAUWP',errcode=err) ! Available when using MG3 i_degrau = pbuf_get_index('DEGRAU',errcode=err) ! Available when using MG3 + call pbuf_set_field(pbuf2d, i_dei, 0.0_r8) + call pbuf_set_field(pbuf2d, i_des, 0.0_r8) + if (i_degrau > 0) then + call pbuf_set_field(pbuf2d, i_degrau, 0.0_r8) + end if + ! old optics call cnst_get_ind('CLDICE', ixcldice) call cnst_get_ind('CLDLIQ', ixcldliq) diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index b6bb57647e..02093028b4 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -391,7 +391,7 @@ subroutine radiation_init(pbuf2d) call rad_data_init(pbuf2d) ! initialize output fields for offline driver call radsw_init() call radlw_init() - call cloud_rad_props_init() + call cloud_rad_props_init(pbuf2d) cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err) From 2e97805fce80dec667fd1be35218fcf2fe1c7898 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 22 Feb 2023 17:11:02 -0700 Subject: [PATCH 131/466] big downdraft commit --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 3 + bld/namelist_files/namelist_definition.xml | 5 + .../cam/outfrq9s_clubbmf/user_nl_cam | 16 +- src/physics/cam/clubb_intr.F90 | 591 ++++++++++++++++-- src/physics/cam/clubb_mf.F90 | 71 ++- src/physics/cam/convect_shallow.F90 | 3 +- src/physics/cam_dev/convect_diagnostics.F90 | 3 +- 8 files changed, 632 insertions(+), 61 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 902ae679a2..6cda87405d 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3149,6 +3149,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'do_clubb_mf_coldpool'); add_default($nl, 'clubb_mf_ddalph'); add_default($nl, 'clubb_mf_ddbeta'); + add_default($nl, 'clubb_mf_pwfac'); add_default($nl, 'clubb_mf_up_ndt'); add_default($nl, 'clubb_mf_cp_ndt'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 86334e30a4..2cd445db2b 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1956,6 +1956,9 @@ .false 2.e2 1.0 + 1.0 + 1 + 1 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index ee340ab4f0..2d06e5ea3d 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3960,6 +3960,11 @@ Default: 200.0 Exponent enhancement factor to the downdrafts used for the cold pool calculations Default: 1.0 + +Enhancement factor for the near surface pressure drag term in downdraft equation +Default: 1.0 + Real: number of time-steps for running average of the convective height scale diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index 660c8aa3e7..e93e310f68 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -6,5 +6,19 @@ do_clubb_mf=.true. do_clubb_mf_diag=.true. do_clubb_mf_rad=.true. do_clubb_mf_precip=.true. -clubb_mf_Lopt=3 deep_scheme='off' + +clubb_mf_nup = 25 + +clubb_mf_Lopt = 6 +clubb_mf_up_ndt = 1 +clubb_mf_a0 = 2.0D0 +clubb_mf_b0 = 0.5D0 +clubb_mf_alphturb = 0.0D0 +clubb_mf_max_L0 = 733.34D0 + +clubb_mf_fdd = 0.5 +do_clubb_mf_coldpool = .true. +clubb_mf_cp_ndt = 1 +clubb_mf_ddalph = 250. +clubb_mf_ddbeta = 1.0 diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 40194142ad..c1c00f337e 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -22,6 +22,9 @@ module clubb_intr use phys_control, only: phys_getopts use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o use physconst, only: rga +!+++ARH + use shr_const_mod, only: shr_const_pi +!---ARH use spmd_utils, only: masterproc use spmd_utils, only: iam use time_manager, only: get_nstep @@ -275,8 +278,11 @@ module clubb_intr dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. integer :: & - qt_macmic_idx, & - thl_macmic_idx, & +!+++ARH + qtm_macmic1_idx, & + qtm_macmic2_idx, & + thlm_macmic1_idx, & + thlm_macmic2_idx, & rcm_macmic_idx, & cldfrac_macmic_idx, & wpthlp_macmic_idx, & @@ -284,7 +290,36 @@ module clubb_intr wpthvp_macmic_idx, & mf_wpthlp_macmic_idx, & mf_wprtp_macmic_idx, & - mf_wpthvp_macmic_idx + mf_wpthvp_macmic_idx, & + up_macmic1_idx, & + up_macmic2_idx, & + dn_macmic1_idx, & + dn_macmic2_idx, & + thlu_macmic1_idx, & + thlu_macmic2_idx, & + qtu_macmic1_idx, & + qtu_macmic2_idx, & + thld_macmic1_idx, & + thld_macmic2_idx, & + qtd_macmic1_idx, & + qtd_macmic2_idx, & + dthl_macmic1_idx, & + dthl_macmic2_idx, & + dqt_macmic1_idx, & + dqt_macmic2_idx, & + dthlu_macmic1_idx, & + dthlu_macmic2_idx, & + dqtu_macmic1_idx, & + dqtu_macmic2_idx, & + dthld_macmic1_idx, & + dthld_macmic2_idx, & + dqtd_macmic1_idx, & + dqtd_macmic2_idx, & + ztop_macmic1_idx, & + ztop_macmic2_idx, & + ddcp_macmic1_idx, & + ddcp_macmic2_idx +!---ARH integer :: & prec_sh_idx, & @@ -429,8 +464,12 @@ subroutine clubb_register_cam( ) call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') - call pbuf_add_field('QT_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qt_macmic_idx) - call pbuf_add_field('THETAL_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thl_macmic_idx) +!+++ARH + call pbuf_add_field('qtm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic1_idx) + call pbuf_add_field('qtm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic2_idx) + call pbuf_add_field('thlm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic1_idx) + call pbuf_add_field('thlm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic2_idx) +!---ARH call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) @@ -446,6 +485,34 @@ subroutine clubb_register_cam( ) call pbuf_add_field('DDCP' ,'global' , dtype_r8, (/pcols/), ddcp_idx) call pbuf_add_field('DDCP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ddcp_macmic_idx) call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols/), ddcpmn_idx) + call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) + call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) + call pbuf_add_field('dn_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) + call pbuf_add_field('dn_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic2_idx) + call pbuf_add_field('thlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic1_idx) + call pbuf_add_field('thlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic2_idx) + call pbuf_add_field('qtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic1_idx) + call pbuf_add_field('qtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic2_idx) + call pbuf_add_field('thld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic1_idx) + call pbuf_add_field('thld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic2_idx) + call pbuf_add_field('qtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic1_idx) + call pbuf_add_field('qtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic2_idx) + call pbuf_add_field('dthl_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic1_idx) + call pbuf_add_field('dthl_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic2_idx) + call pbuf_add_field('dqt_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic1_idx) + call pbuf_add_field('dqt_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic2_idx) + call pbuf_add_field('dthlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic1_idx) + call pbuf_add_field('dthlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic2_idx) + call pbuf_add_field('dqtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic1_idx) + call pbuf_add_field('dqtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic2_idx) + call pbuf_add_field('dthld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic1_idx) + call pbuf_add_field('dthld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic2_idx) + call pbuf_add_field('dqtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic1_idx) + call pbuf_add_field('dqtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic2_idx) + call pbuf_add_field('ztop_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic1_idx) + call pbuf_add_field('ztop_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) + call pbuf_add_field('ddcp_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) + call pbuf_add_field('ddcp_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) end if #endif @@ -1337,9 +1404,11 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) +!+++ARH call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) call addfld ( 'edmf_ddcp' , horiz_only, 'A', 'm/s' , 'edmf ddcp', flag_xyfill=.True.) call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) +!---ARH call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) @@ -1357,9 +1426,12 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_dnthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume downdraft liquid potential temperature (EDMF)' ) call addfld ( 'edmf_dnqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume downdraft total water mixing ratio (EDMF)' ) end if - - call addfld ('QT_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('THETAL_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') +!+++ARH + call addfld ('qtm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('qtm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') + call addfld ('thlm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') + call addfld ('thlm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') +!---ARH call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'ncyc' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') @@ -1369,6 +1441,36 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thl flux (EDMF) at macro/micro substep' ) call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thv flux (EDMF) at macro/micro substep' ) call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg m/s' , 'qt flux (EDMF) at macro/micro substep' ) +!+++ARH + call addfld ( 'up_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) + call addfld ( 'up_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) + call addfld ( 'dn_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) + call addfld ( 'dn_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) + call addfld ( 'thlu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) + call addfld ( 'thlu_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) + call addfld ( 'qtu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt up' ) + call addfld ( 'qtu_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt up' ) + call addfld ( 'thld_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl dn' ) + call addfld ( 'thld_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl dn' ) + call addfld ( 'qtd_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt dn' ) + call addfld ( 'qtd_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt dn' ) + call addfld ( 'dthl_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl tend' ) + call addfld ( 'dthl_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl tend' ) + call addfld ( 'dqt_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt tend' ) + call addfld ( 'dqt_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt tend' ) + call addfld ( 'dthlu_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl up tend' ) + call addfld ( 'dthlu_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl up tend' ) + call addfld ( 'dqtu_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt up tend' ) + call addfld ( 'dqtu_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt up tend' ) + call addfld ( 'dthld_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl dn tend' ) + call addfld ( 'dthld_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl dn tend' ) + call addfld ( 'dqtd_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt dn tend' ) + call addfld ( 'dqtd_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt dn tend' ) + call addfld ( 'ztop_macmic1', (/ 'ncyc' /), 'I', 'm/s' , 'ztop' ) + call addfld ( 'ztop_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ztop' ) + call addfld ( 'ddcp_macmic1', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) + call addfld ( 'ddcp_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) +!---ARH end if ! Initialize statistics, below are dummy variables @@ -1514,10 +1616,14 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_ddcp' , 1, ' ') call add_default( 'edmf_L0' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') - call add_default( 'edmf_cfl' , 1, ' ') + call add_default( 'edmf_cfl' , 1, ' ') end if - call add_default( 'QT_macmic' , 1, ' ') - call add_default( 'THETAL_macmic' , 1, ' ') +!+++ARH + !call add_default( 'qtm_macmic1' , 1, ' ') + !call add_default( 'qtm_macmic2' , 1, ' ') + !call add_default( 'thlm_macmic1' , 1, ' ') + !call add_default( 'thlm_macmic2' , 1, ' ') +!---ARH call add_default( 'RCM_CLUBB_macmic' , 1, ' ') call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') @@ -1527,6 +1633,36 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_thlflx_macmic' , 1, ' ') call add_default( 'edmf_qtflx_macmic' , 1, ' ') call add_default( 'edmf_thvflx_macmic' , 1, ' ') +!+++ARH + !call add_default( 'up_macmic1' , 1, ' ') + !call add_default( 'up_macmic2' , 1, ' ') + !call add_default( 'dn_macmic1' , 1, ' ') + !call add_default( 'dn_macmic2' , 1, ' ') + !call add_default( 'thlu_macmic1' , 1, ' ') + !call add_default( 'thlu_macmic2' , 1, ' ') + !call add_default( 'qtu_macmic1' , 1, ' ') + !call add_default( 'qtu_macmic2' , 1, ' ') + !call add_default( 'thld_macmic1' , 1, ' ') + !call add_default( 'thld_macmic2' , 1, ' ') + !call add_default( 'qtd_macmic1' , 1, ' ') + !call add_default( 'qtd_macmic2' , 1, ' ') + !call add_default( 'dthl_macmic1' , 1, ' ') + !call add_default( 'dthl_macmic2' , 1, ' ') + !call add_default( 'dqt_macmic1' , 1, ' ') + !call add_default( 'dqt_macmic2' , 1, ' ') + !call add_default( 'dthlu_macmic1' , 1, ' ') + !call add_default( 'dthlu_macmic2' , 1, ' ') + !call add_default( 'dqtu_macmic1' , 1, ' ') + !call add_default( 'dqtu_macmic2' , 1, ' ') + !call add_default( 'dthld_macmic1' , 1, ' ') + !call add_default( 'dthld_macmic2' , 1, ' ') + !call add_default( 'dqtd_macmic1' , 1, ' ') + !call add_default( 'dqtd_macmic2' , 1, ' ') + !call add_default( 'ztop_macmic1' , 1, ' ') + !call add_default( 'ztop_macmic2' , 1, ' ') + !call add_default( 'ddcp_macmic1' , 1, ' ') + !call add_default( 'ddcp_macmic2' , 1, ' ') +!---ARH end if end if @@ -1582,6 +1718,12 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) +!+++ARH + call pbuf_set_field(pbuf2d, thlm_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlm_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtm_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtm_macmic2_idx, 0.0_r8) +!---ARH ! Initialize SILHS covariance contributions call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) @@ -1596,6 +1738,36 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, ddcp_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcp_macmic_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcpmn_idx, 0.0_r8) +!+++ARH + call pbuf_set_field(pbuf2d, up_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, up_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dn_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dn_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlu_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thlu_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtu_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtu_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thld_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, thld_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtd_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, qtd_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthl_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthl_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqt_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqt_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthlu_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthlu_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqtu_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqtu_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthld_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dthld_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqtd_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dqtd_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztop_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ztop_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ddcp_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, ddcp_macmic2_idx, 0.0_r8) +!---ARH end if endif @@ -1993,8 +2165,12 @@ subroutine clubb_tend_cam( & real(r8), pointer :: ddcp_macmic(:) real(r8), pointer :: ddcpmn(:,:) - real(r8), pointer :: qt_macmic(:,:) - real(r8), pointer :: thl_macmic(:,:) +!+++ARH + real(r8), pointer :: qtm_macmic1(:,:) + real(r8), pointer :: qtm_macmic2(:,:) + real(r8), pointer :: thlm_macmic1(:,:) + real(r8), pointer :: thlm_macmic2(:,:) +!---ARH real(r8), pointer :: rcm_macmic(:,:) real(r8), pointer :: cldfrac_macmic(:,:) real(r8), pointer :: wpthlp_macmic(:,:) @@ -2003,6 +2179,36 @@ subroutine clubb_tend_cam( & real(r8), pointer :: mf_thlflx_macmic(:,:) real(r8), pointer :: mf_qtflx_macmic(:,:) real(r8), pointer :: mf_thvflx_macmic(:,:) +!+++ARH + real(r8), pointer :: up_macmic1(:,:) + real(r8), pointer :: up_macmic2(:,:) + real(r8), pointer :: dn_macmic1(:,:) + real(r8), pointer :: dn_macmic2(:,:) + real(r8), pointer :: thlu_macmic1(:,:) + real(r8), pointer :: thlu_macmic2(:,:) + real(r8), pointer :: qtu_macmic1(:,:) + real(r8), pointer :: qtu_macmic2(:,:) + real(r8), pointer :: thld_macmic1(:,:) + real(r8), pointer :: thld_macmic2(:,:) + real(r8), pointer :: qtd_macmic1(:,:) + real(r8), pointer :: qtd_macmic2(:,:) + real(r8), pointer :: dthl_macmic1(:,:) + real(r8), pointer :: dthl_macmic2(:,:) + real(r8), pointer :: dqt_macmic1(:,:) + real(r8), pointer :: dqt_macmic2(:,:) + real(r8), pointer :: dthlu_macmic1(:,:) + real(r8), pointer :: dthlu_macmic2(:,:) + real(r8), pointer :: dqtu_macmic1(:,:) + real(r8), pointer :: dqtu_macmic2(:,:) + real(r8), pointer :: dthld_macmic1(:,:) + real(r8), pointer :: dthld_macmic2(:,:) + real(r8), pointer :: dqtd_macmic1(:,:) + real(r8), pointer :: dqtd_macmic2(:,:) + real(r8), pointer :: ztop_macmic1(:,:) + real(r8), pointer :: ztop_macmic2(:,:) + real(r8), pointer :: ddcp_macmic1(:,:) + real(r8), pointer :: ddcp_macmic2(:,:) +!---ARH real(r8) :: stend(pcols,pver) real(r8) :: qvtend(pcols,pver) @@ -2130,6 +2336,9 @@ subroutine clubb_tend_cam( & mf_updet, & mf_upent + real(r8), dimension(pverp,clubb_mf_nup) :: flip + real(r8), dimension(pverp) :: lilflip + ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 real(r8) :: cflfac, max_cfl, & @@ -2161,7 +2370,7 @@ subroutine clubb_tend_cam( & dzm, invrs_exner_zm ! momentum grid real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - + real(r8) :: valmax integer :: nlev @@ -2304,8 +2513,12 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - call pbuf_get_field(pbuf, qt_macmic_idx, qt_macmic) - call pbuf_get_field(pbuf, thl_macmic_idx, thl_macmic) +!+++ARH + call pbuf_get_field(pbuf, qtm_macmic1_idx, qtm_macmic1) + call pbuf_get_field(pbuf, qtm_macmic2_idx, qtm_macmic2) + call pbuf_get_field(pbuf, thlm_macmic1_idx, thlm_macmic1) + call pbuf_get_field(pbuf, thlm_macmic2_idx, thlm_macmic2) +!---ARH call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) @@ -2324,6 +2537,36 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, ddcp_idx, ddcp) call pbuf_get_field(pbuf, ddcp_macmic_idx, ddcp_macmic) call pbuf_get_field(pbuf, ddcpmn_idx, ddcpmn) +!+++ARH + call pbuf_get_field(pbuf, up_macmic1_idx, up_macmic1) + call pbuf_get_field(pbuf, up_macmic2_idx, up_macmic2) + call pbuf_get_field(pbuf, dn_macmic1_idx, dn_macmic1) + call pbuf_get_field(pbuf, dn_macmic2_idx, dn_macmic2) + call pbuf_get_field(pbuf, thlu_macmic1_idx, thlu_macmic1) + call pbuf_get_field(pbuf, thlu_macmic2_idx, thlu_macmic2) + call pbuf_get_field(pbuf, qtu_macmic1_idx, qtu_macmic1) + call pbuf_get_field(pbuf, qtu_macmic2_idx, qtu_macmic2) + call pbuf_get_field(pbuf, thld_macmic1_idx, thld_macmic1) + call pbuf_get_field(pbuf, thld_macmic2_idx, thld_macmic2) + call pbuf_get_field(pbuf, qtd_macmic1_idx, qtd_macmic1) + call pbuf_get_field(pbuf, qtd_macmic2_idx, qtd_macmic2) + call pbuf_get_field(pbuf, dthl_macmic1_idx, dthl_macmic1) + call pbuf_get_field(pbuf, dthl_macmic2_idx, dthl_macmic2) + call pbuf_get_field(pbuf, dqt_macmic1_idx, dqt_macmic1) + call pbuf_get_field(pbuf, dqt_macmic2_idx, dqt_macmic2) + call pbuf_get_field(pbuf, dthlu_macmic1_idx, dthlu_macmic1) + call pbuf_get_field(pbuf, dthlu_macmic2_idx, dthlu_macmic2) + call pbuf_get_field(pbuf, dqtu_macmic1_idx, dqtu_macmic1) + call pbuf_get_field(pbuf, dqtu_macmic2_idx, dqtu_macmic2) + call pbuf_get_field(pbuf, dthld_macmic1_idx, dthld_macmic1) + call pbuf_get_field(pbuf, dthld_macmic2_idx, dthld_macmic2) + call pbuf_get_field(pbuf, dqtd_macmic1_idx, dqtd_macmic1) + call pbuf_get_field(pbuf, dqtd_macmic2_idx, dqtd_macmic2) + call pbuf_get_field(pbuf, ztop_macmic1_idx, ztop_macmic1) + call pbuf_get_field(pbuf, ztop_macmic2_idx, ztop_macmic2) + call pbuf_get_field(pbuf, ddcp_macmic1_idx, ddcp_macmic1) + call pbuf_get_field(pbuf, ddcp_macmic2_idx, ddcp_macmic2) +!---ARH ! SVP do k = 1, pver @@ -2949,6 +3192,13 @@ subroutine clubb_tend_cam( & stats_nsamp = nint(stats_tsamp/dtime) stats_nout = nint(stats_tout/dtime) +!+++ARH + if (macmic_it==1) thlm_macmic1(i,:) = 0._r8 + if (macmic_it==1) thlm_macmic2(i,:) = 0._r8 + if (macmic_it==1) qtm_macmic1(i,:) = 0._r8 + if (macmic_it==1) qtm_macmic2(i,:) = 0._r8 +!---ARH + if (do_clubb_mf) then mf_L0 = 0._r8 mf_L0_nadv = 0._r8 @@ -2961,6 +3211,37 @@ subroutine clubb_tend_cam( & if (macmic_it==1) ztopm1_macmic(i) = 0._r8 if (macmic_it==1) ddcp_macmic(i) = 0._r8 +!+++ARH + if (macmic_it==1) up_macmic1(i,:) = 0._r8 + if (macmic_it==1) up_macmic2(i,:) = 0._r8 + if (macmic_it==1) dn_macmic1(i,:) = 0._r8 + if (macmic_it==1) dn_macmic2(i,:) = 0._r8 + if (macmic_it==1) thlu_macmic1(i,:) = 0._r8 + if (macmic_it==1) thlu_macmic2(i,:) = 0._r8 + if (macmic_it==1) qtu_macmic1(i,:) = 0._r8 + if (macmic_it==1) qtu_macmic2(i,:) = 0._r8 + if (macmic_it==1) thld_macmic1(i,:) = 0._r8 + if (macmic_it==1) thld_macmic2(i,:) = 0._r8 + if (macmic_it==1) qtd_macmic1(i,:) = 0._r8 + if (macmic_it==1) qtd_macmic2(i,:) = 0._r8 + if (macmic_it==1) dthl_macmic1(i,:) = 0._r8 + if (macmic_it==1) dthl_macmic2(i,:) = 0._r8 + if (macmic_it==1) dqt_macmic1(i,:) = 0._r8 + if (macmic_it==1) dqt_macmic2(i,:) = 0._r8 + if (macmic_it==1) dthlu_macmic1(i,:) = 0._r8 + if (macmic_it==1) dthlu_macmic2(i,:) = 0._r8 + if (macmic_it==1) dqtu_macmic1(i,:) = 0._r8 + if (macmic_it==1) dqtu_macmic2(i,:) = 0._r8 + if (macmic_it==1) dthld_macmic1(i,:) = 0._r8 + if (macmic_it==1) dthld_macmic2(i,:) = 0._r8 + if (macmic_it==1) dqtd_macmic1(i,:) = 0._r8 + if (macmic_it==1) dqtd_macmic2(i,:) = 0._r8 + if (macmic_it==1) ztop_macmic1(i,:) = 0._r8 + if (macmic_it==1) ztop_macmic2(i,:) = 0._r8 + if (macmic_it==1) ddcp_macmic1(i,:) = 0._r8 + if (macmic_it==1) ddcp_macmic2(i,:) = 0._r8 +!---ARH + !+++ARH - Temporary hack - pbuf_set_field is apparently not taking? if (is_first_step() .and. macmic_it==1) then ddcp(i) = 0._r8 @@ -3165,7 +3446,205 @@ subroutine clubb_tend_cam( & mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + s_awu(:pverp) max_cfl_nadv = MAX(max_cfl,max_cfl_nadv) +!+++ARH + if (t==1) then + + ztop_macmic1(i,macmic_it) = mf_ztopm1 + ddcp_macmic1(i,macmic_it) = mf_ddcp + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + up_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + dn_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + thlu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + qtu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + thld_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + qtd_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_forcing(k) + end do + dthl_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_forcing(k) + end do + dqt_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_thlforcup(k) + end do + dthlu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcup(k) + end do + dqtu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_thlforcdn(k) + end do + dthld_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcdn(k) + end do + dqtd_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + else if (t==2) then + + ztop_macmic2(i,macmic_it) = mf_ztopm1 + ddcp_macmic2(i,macmic_it) = mf_ddcp + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + up_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + dn_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + thlu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + qtu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + thld_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + qtd_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_forcing(k) + end do + dthl_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_forcing(k) + end do + dqt_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_thlforcup(k) + end do + dthlu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcup(k) + end do + dqtu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_thlforcdn(k) + end do + dthld_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcdn(k) + end do + dqtd_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + end if +!---ARH + + end if !clubbmf + +!+++ARH + if (t==1) then + + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_in(k) + end do + thlm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_in(k) + end do + qtm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + else if (t==2) then + + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_in(k) + end do + thlm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_in(k) + end do + qtm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + end if +!---ARH ! Advance CLUBB CORE one timestep in the future call advance_clubb_core_api & @@ -3204,6 +3683,11 @@ subroutine clubb_tend_cam( & call endrun(subr//': Fatal error in CLUBB library') end if +!+++ARH ! clip negative water + do k=1,pverp + if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) + end do +!---ARH if (do_rainturb) then rvm_in = rtm_in - rcm_inout @@ -3237,12 +3721,6 @@ subroutine clubb_tend_cam( & if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& out_radzt,out_radzm,out_sfc) - - ! Hard clipping of rtm. Note this will violate mass/energy conservation - do k=1,pverp - if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) - end do - enddo ! end time loop if (do_clubb_mf) then @@ -3992,22 +4470,16 @@ subroutine clubb_tend_cam( & enddo enddo - do k=1,pverp - do i=1,ncol - qt_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rtm(:ncol,:pverp) - thl_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = thlm(:ncol,:pverp) - rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) - cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) - wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) - wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) - wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) - if (do_clubb_mf) then - mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) - mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) - mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) - end if - enddo - enddo + rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) + cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) + wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) + wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) + wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) + if (do_clubb_mf) then + mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) + mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) + mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) + end if ! --------------------------------------------------------------------------------- ! ! Diagnose some quantities that are computed in macrop_tend here. ! @@ -4307,7 +4779,10 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) - call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) +!+++ARH + ! macmic_it==1 ensures that this is ddcp aeraged over the prior time-steps + if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) +!---ARH call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) @@ -4315,8 +4790,12 @@ subroutine clubb_tend_cam( & end if if (macmic_it==cld_macmic_num_steps) then - call outfld( 'QT_macmic' , qt_macmic, pcols, lchnk ) - call outfld( 'THETAL_macmic' , thl_macmic, pcols, lchnk ) +!+++ARH + call outfld( 'qtm_macmic1' , qtm_macmic1, pcols, lchnk ) + call outfld( 'qtm_macmic2' , qtm_macmic2, pcols, lchnk ) + call outfld( 'thlm_macmic1' , thlm_macmic1, pcols, lchnk ) + call outfld( 'thlm_macmic2' , thlm_macmic2, pcols, lchnk ) +!---ARH call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) @@ -4327,6 +4806,36 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) +!+++ARH + call outfld( 'up_macmic1' , up_macmic1, pcols, lchnk ) + call outfld( 'up_macmic2' , up_macmic2, pcols, lchnk ) + call outfld( 'dn_macmic1' , dn_macmic1, pcols, lchnk ) + call outfld( 'dn_macmic2' , dn_macmic2, pcols, lchnk ) + call outfld( 'thlu_macmic1' , thlu_macmic1, pcols, lchnk ) + call outfld( 'thlu_macmic2' , thlu_macmic2, pcols, lchnk ) + call outfld( 'qtu_macmic1' , qtu_macmic1, pcols, lchnk ) + call outfld( 'qtu_macmic2' , qtu_macmic2, pcols, lchnk ) + call outfld( 'thld_macmic1' , thld_macmic1, pcols, lchnk ) + call outfld( 'thld_macmic2' , thld_macmic2, pcols, lchnk ) + call outfld( 'qtd_macmic1' , qtd_macmic1, pcols, lchnk ) + call outfld( 'qtd_macmic2' , qtd_macmic2, pcols, lchnk ) + call outfld( 'dthl_macmic1' , dthl_macmic1, pcols, lchnk ) + call outfld( 'dthl_macmic2' , dthl_macmic2, pcols, lchnk ) + call outfld( 'dqt_macmic1' , dqt_macmic1, pcols, lchnk ) + call outfld( 'dqt_macmic2' , dqt_macmic2, pcols, lchnk ) + call outfld( 'dthlu_macmic1' , dthlu_macmic1, pcols, lchnk ) + call outfld( 'dthlu_macmic2' , dthlu_macmic2, pcols, lchnk ) + call outfld( 'dqtu_macmic1' , dqtu_macmic1, pcols, lchnk ) + call outfld( 'dqtu_macmic2' , dqtu_macmic2, pcols, lchnk ) + call outfld( 'dthld_macmic1' , dthld_macmic1, pcols, lchnk ) + call outfld( 'dthld_macmic2' , dthld_macmic2, pcols, lchnk ) + call outfld( 'dqtd_macmic1' , dqtd_macmic1, pcols, lchnk ) + call outfld( 'dqtd_macmic2' , dqtd_macmic2, pcols, lchnk ) + call outfld( 'ztop_macmic1' , ztop_macmic1, pcols, lchnk ) + call outfld( 'ztop_macmic2' , ztop_macmic2, pcols, lchnk ) + call outfld( 'ddcp_macmic1' , ddcp_macmic1, pcols, lchnk ) + call outfld( 'ddcp_macmic2' , ddcp_macmic2, pcols, lchnk ) +!---ARH end if end if diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index f909a4b7d3..adae4c6835 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -49,6 +49,7 @@ module clubb_mf real(r8) :: clubb_mf_fdd = 0._r8 real(r8) :: clubb_mf_ddalph = 0._r8 real(r8) :: clubb_mf_ddbeta = 0._r8 + real(r8) :: clubb_mf_pwfac = 0._r8 integer :: clubb_mf_up_ndt = 1 integer :: clubb_mf_cp_ndt = 1 integer, protected :: clubb_mf_nup = 0 @@ -80,7 +81,8 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & - clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_up_ndt, clubb_mf_cp_ndt + clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, & + clubb_mf_up_ndt, clubb_mf_cp_ndt if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -126,6 +128,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ddalph") call mpi_bcast(clubb_mf_ddbeta, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ddbeta") + call mpi_bcast(clubb_mf_pwfac, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_pwfac") call mpi_bcast(clubb_mf_up_ndt, 1, mpi_integer, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_up_ndt") call mpi_bcast(clubb_mf_cp_ndt, 1, mpi_integer, mstrid, mpicom, ierr) @@ -323,7 +327,7 @@ subroutine integrate_mf( nz, eturb, det, lmixt, & ! thermodynamic grid qtovqs, sevap, taum1, & ! thermodynamic grid sqtint, sthlint, alphint, & - betathl,betaqt, & ! thermodynamic grid + qtmp, betathl, betaqt, & ! thermodynamic grid thln, thvn, thn, & ! momentum grid qtn, qsn, & ! momentum grid qcn, qln, qin, & ! momentum grid @@ -1030,12 +1034,21 @@ subroutine integrate_mf( nz, dnu(ddtop,i) = 0.5_r8*(u(ddtop)+u(ddtop+1)) dnv(ddtop,i) = 0.5_r8*(v(ddtop)+v(ddtop+1)) dnqt(ddtop,i) = qt_zm(ddtop) + + ! no cloud in downdrafts, set to cloud free thl dnthl(ddtop,i) = thl_zm(ddtop) - dnthv(ddtop,i) = thv_zm(ddtop) + dnthv(ddtop,i) = thv_zm(ddtop) ! includes condensate loading (!) ! get rain generated in the updraft, appropriate it to the downdraft dnrr(ddtop,i) = -1._r8*dzt(ddtop)*rho_zt(ddtop)*upauto(ddtop,i)*clubb_mf_fdd + if (fixent) then + entn = fixent_ent + else + ! use deterministic mean entrainment + entn = clubb_mf_ent0/dynamic_L0 + end if + ! downdraft qsat call qsat(dnthl(ddtop,i)/iexner_zm(ddtop),p_zm(ddtop),es,dnqs(ddtop,i)) @@ -1055,19 +1068,12 @@ subroutine integrate_mf( nz, ! get rain evaporation in tendency form sdnqt(k,i) = max( (dnqs(k+1,i) - dnqt(k+1,i))*taum1, 0._r8 ) - sdnthl(k,i) = -1._r8*latvap*sevap*iexner_zt(k+1)/cpair + sdnthl(k,i) = -1._r8*latvap*sdnqt(k,i)*iexner_zt(k+1)/cpair ! compute rain rate (rain above - evaporation + appropriate updraft rain) dnrr(k,i) = max( dnrr(k+1,i) & - rho_zt(k+1)*dzt(k+1)*(sdnqt(k,i) + upauto(k+1,i)*clubb_mf_fdd) , 0._r8 ) - if (fixent) then - entn = fixent_ent - else - ! use deterministic mean entrainment - entn = clubb_mf_ent0/dynamic_L0 - end if - ! include eturb? entexp = exp(-1._r8*entn*eturb*dzt(k+1)) entexpu = exp(-1._r8*entn*dzt(k+1)/3._r8) @@ -1077,6 +1083,7 @@ subroutine integrate_mf( nz, dnv(k,i) = v(k+1) *(1._r8-entexpu) + dnv (k+1,i)*entexpu dnqt(k,i) = qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sqtint dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sthlint + !dnu(k,i) = dnu (k+1,i) + (dnu (k+1,i)- u(k+1))*(1._r8-entexpu) !dnv(k,i) = dnv (k+1,i) + (dnv (k+1,i)- v(k+1))*(1._r8-entexpu) !dnqt(k,i) = dnqt (k+1,i) + (dnqt (k+1,i)- qt(k+1))*(1._r8-entexp ) + sqtint @@ -1085,6 +1092,36 @@ subroutine integrate_mf( nz, ! get qsat call qsat(dnthl(k,i)/iexner_zm(k),p_zm(k),es,dnqs(k,i)) + ! no supersaturation in downdrafts + if (dnqt(k,i) > dnqs(k,i)) then + ! set qt to saturation vapor pressure + dnqt(k,i) = dnqs(k,i) + + ! find evaporation that gives saturation vapor pressure + sqtint = dnqt(k,i) - (qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp) + + ! limit to available rain + sqtint = min( sqtint, -1._r8*dnrr(k+1,i) / (rho_zt(k+1)*dzt(k+1)*dnw(k+1,i)) ) + sthlint = -1._r8*latvap*sqtint*iexner_zt(k+1)/cpair + + ! find new evap tendency + if ((alphint - 1._r8) /= 0._r8) then + qtmp = dnqs(k+1,i) + sqtint/(alphint - 1._r8) + sdnqt(k,i) = max( (dnqs(k+1,i) - qtmp)*taum1, 0._r8 ) + else + sdnqt(k,i) = 0._r8 + end if + sdnthl(k,i) = -1._r8*latvap*sdnqt(k,i)*iexner_zt(k+1)/cpair + + ! re-compute thl with new evaporation rate + dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sthlint + + ! adjust rain + dnrr(k,i) = max( dnrr(k+1,i) & + - rho_zt(k+1)*dzt(k+1)*(sdnqt(k,i) + upauto(k+1,i)*clubb_mf_fdd) , 0._r8 ) + end if + + ! get virtual temperature dnthv(k,i) = dnthl(k,i)*(1._r8+zvir*dnqt(k,i)) @@ -1094,10 +1131,8 @@ subroutine integrate_mf( nz, B = gravit*(dnthv(k,i)/thv(k)-1._r8) ! get wn2 - ! Kay uses the following eqn for wp, but I don't undestand it - !wp = wb*entn+5._r8/(zm(k)+1.e-7_r8)*max(1._r8-exp( zm(k)/z00dn-1._r8 ),0._r8) wp = wb*entn*eturb & - + 1._r8/( 2._r8*zm(k)+tinynum ) * max( 1._r8 - exp( zm(k)/z00dn-1._r8), 0._r8 ) + + clubb_mf_pwfac/( 2._r8*zm(k)+tinynum ) * max( 1._r8 - exp( zm(k)/z00dn-1._r8), 0._r8 ) if (wp==0._r8) then wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) else @@ -1113,6 +1148,8 @@ subroutine integrate_mf( nz, end do!i +!+++ARH this should be changed to only zero out above the downdraft (dnw<-mindw) +!+++ARH also this should zero out dna as well ! zero out downdraft fluxes for dnw == -mindnw do i=1,clubb_mf_nup do k=1,nz @@ -1339,9 +1376,9 @@ subroutine integrate_mf( nz, qtflxup (k)= awqtup (k) - awup(k)*qt_env (k+1) ! if no downdrafts, should be zero since awdn should be zero - thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k-1) - thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k-1) - qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k-1) + thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k) + thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k) + qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k) thvflx(k) = thvflxup(k) + thvflxdn(k) thlflx(k) = thlflxup(k) + thlflxdn(k) diff --git a/src/physics/cam/convect_shallow.F90 b/src/physics/cam/convect_shallow.F90 index ac628359dd..60e9b3b910 100644 --- a/src/physics/cam/convect_shallow.F90 +++ b/src/physics/cam/convect_shallow.F90 @@ -706,8 +706,9 @@ subroutine convect_shallow_tend( ztodt , cmfmc , & do i = 1, ncol if( cnt2(i) < cnt(i)) cnt(i) = cnt2(i) if( cnb2(i) > cnb(i)) cnb(i) = cnb2(i) + if( cnb(i) == 1._r8 ) cnb(i) = cnt(i) pcnt(i) = state%pmid(i,int(cnt(i))) - pcnb(i) = state%pmid(i,int(cnb(i))) + pcnb(i) = state%pmid(i,int(cnb(i))) end do ! ----------------------------------------------- ! diff --git a/src/physics/cam_dev/convect_diagnostics.F90 b/src/physics/cam_dev/convect_diagnostics.F90 index 0b580e5cf3..3f2054f45d 100644 --- a/src/physics/cam_dev/convect_diagnostics.F90 +++ b/src/physics/cam_dev/convect_diagnostics.F90 @@ -200,8 +200,9 @@ subroutine convect_diagnostics_calc( ztodt , cmfmc , & do i = 1, ncol if( cnt2(i) < cnt(i)) cnt(i) = cnt2(i) if( cnb2(i) > cnb(i)) cnb(i) = cnb2(i) + if( cnb(i) == 1._r8 ) cnb(i) = cnt(i) pcnt(i) = state%pmid(i,int(cnt(i))) - pcnb(i) = state%pmid(i,int(cnb(i))) + pcnb(i) = state%pmid(i,int(cnb(i))) end do ! ----------------------------------------------- ! From 0160d77552b86cf9c98dd53e68f9cdd0bc5b93e5 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 22 Feb 2023 20:13:17 -0700 Subject: [PATCH 132/466] refactor lscale algorithm into its own subroutine --- src/physics/cam/clubb_mf.F90 | 282 ++++++++++++++++++++--------------- 1 file changed, 164 insertions(+), 118 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index adae4c6835..3799358c06 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -337,21 +337,21 @@ subroutine integrate_mf( nz, srfwqtu, srfwthvu, & facqtu, facthvu - ! - ! cape variables - real(r8), dimension(nz) :: t_zt - real(r8), dimension(nz-1) :: tp, qstp - !real(r8), dimension(nz-1,clubb_mf_nup) :: dmpdz - !real(r8), dimension(clubb_mf_nup) :: tl, & - ! cape, cin - !integer, dimension(clubb_mf_nup) :: lcl, lel - real(r8), dimension(nz-1,1) :: dmpdz - real(r8), dimension(1) :: tl, & - cape, cin - integer, dimension(1) :: lcl, lel - real(r8) :: landfrac - integer :: kpbl, msg, & - lon, mx +! ! +! ! cape variables +! real(r8), dimension(nz) :: t_zt +! real(r8), dimension(nz-1) :: tp, qstp +! !real(r8), dimension(nz-1,clubb_mf_nup) :: dmpdz +! !real(r8), dimension(clubb_mf_nup) :: tl, & +! ! cape, cin +! !integer, dimension(clubb_mf_nup) :: lcl, lel +! real(r8), dimension(nz-1,1) :: dmpdz +! real(r8), dimension(1) :: tl, & +! cape, cin +! integer, dimension(1) :: lcl, lel +! real(r8) :: landfrac +! integer :: kpbl, msg, & +! lon, mx ! ! limit convective area logical :: limarea = .false. @@ -491,9 +491,6 @@ subroutine integrate_mf( nz, entf = 0._r8 enti = 0 det = 0._r8 - cape = 0._r8 - mcape = 0._r8 - dmpdz = 0._r8 ! START MAIN COMPUTATION upw = 0._r8 @@ -555,97 +552,6 @@ subroutine integrate_mf( nz, ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then - ! --------------------------------------------------------- ! - ! Calculate ztop and dynamic_L based on value of namelist ! - ! should probably make into a subroutine ! - ! --------------------------------------------------------- ! - - if (clubb_mf_Lopt==0) then - !Constant L0 - dynamic_L0 = clubb_mf_L0 - ztop = clubb_mf_L0 - else if (clubb_mf_Lopt==1) then - !TKE - do k=nz-2,2,-1 - if (zm(k) < 20000 .and. tke(k) - tke(k+1) > 1e-5) then - ztop = zm(k) - exit - endif - enddo - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - - else if (clubb_mf_Lopt==2) then - !Heat flux - do k=nz-2,2,-1 - !if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-3) then - if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-4) then - ztop = zm(k) - exit - endif - enddo - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - - else if (clubb_mf_Lopt==3) then - !Test plume - call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & - wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & - wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) - - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - !ztop = ztop - 1600._r8 - !if (ztop < 1._r8) then - ! dynamic_L0 = clubb_mf_a0 - !else - ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) - !end if - else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then - !dilute cape calculation - !dmpdz = -1._r8*ent_zt(2:nz,:) - dmpdz(:,:) = -1.E-3_r8 - t_zt = th/iexner_zt - landfrac = 1._r8 - - do k=2,nz - if (zt(k-1) <= pblh) then - kpbl = k - end if - end do - - do k=1,nz - if (p_zt(k) > 40.e2_r8) then - msg = k - end if - end do - !call buoyan_dilute(nz-1 ,clubb_mf_nup ,dmpdz , & - call buoyan_dilute(nz-1 ,1 ,dmpdz , & - qv(2:nz) ,t_zt(2:nz) ,p_zt(2:nz)*0.01_r8 ,zt(2:nz) ,p_zm*0.01_r8 , & - tp ,qstp ,tl ,cape ,cin , & - kpbl-1 ,lcl ,lel ,lon ,mx , & - msg-1 ,tpert ,landfrac ) - - !do i=1,clubb_mf_nup - ! mcape = mcape + cape(i) - !end do - !mcape = mcape/REAL(clubb_mf_nup) - mcape = max(cape(1),25._r8) - - if (clubb_mf_Lopt==4) then - ztop = max(zt(lel(1)+1),convh) - else if (clubb_mf_Lopt==5) then - ztop = mcape - end if - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - - else if (clubb_mf_Lopt==6) then - ! grab ztop from max height of ensemble in prior time-step(s) - ztop = ztopm1 - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - !if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 - else if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==8) then - ztop = rhinv - dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) - end if - ! --------------------------------------------------------- ! ! Initialize using Deardorff convective velocity scale ! ! --------------------------------------------------------- ! @@ -655,22 +561,13 @@ subroutine integrate_mf( nz, ! --------------------------------------------------------- ! ! Compute cold pool feedback parameter ! ! --------------------------------------------------------- ! - cpfac = 1._r8 if (do_clubb_mf_coldpool) cpfac = min( (max(ddcp/wstar,1._r8))**clubb_mf_ddbeta, max_cpfac ) - ! affect the entrainmnet length scale - dynamic_L0 = dynamic_L0 * cpfac - - ! limit max/min - dynamic_L0 = max(min_L0,dynamic_L0) - dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) - ! --------------------------------------------------------- ! ! Construct tri-variate PDF at the surface from wstar ! ! and initialize plume thv, qt, w ! ! --------------------------------------------------------- ! - qstar = wqt / wstar thvstar = wthv / wstar @@ -743,6 +640,20 @@ subroutine integrate_mf( nz, end if end do + ! --------------------------------------------------------- ! + ! Calculate ztop and dynamic_L based on value of namelist ! + ! --------------------------------------------------------- ! + call get_Lscale (nz, zm, tke, wpthlp_env, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, th, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, wa, wb, & + do_condensation, qv, p_zt, zt, tpert, pblh, convh, rhinv, ztopm1, dynamic_L0, ztop, mcape) + + ! cold pool feedback on the entrainmnet length scale + dynamic_L0 = dynamic_L0 * cpfac + + ! limit max/min + dynamic_L0 = max(min_L0,dynamic_L0) + dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) + ! --------------------------------------------------------- ! ! Stochastic entrainmnet calculation ! ! From Suselj et al 2019, after Romps and Kuang 2010 ! @@ -1392,6 +1303,141 @@ subroutine integrate_mf( nz, end subroutine integrate_mf + subroutine get_Lscale(nz, zm, tke, wpthlp_env, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, th, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, wa, wb, & + do_condensation, qv, p_zt, zt, tpert, pblh, convh, rhinv, ztopm1, dynamic_L0, ztop, mcape) + ! --------------------------------------------------------- ! + ! Calculate ztop and dynamic_L based on value of namelist ! + ! --------------------------------------------------------- ! + integer, intent(in) :: nz + real(r8), dimension(nz), intent(in) :: thl, thv, & + th, & + qt, qv, & + p_zt, iexner_zt, & + dzt, zt, & + p_zm, iexner_zm, & + zm, & + tke, wpthlp_env + ! + real(r8), intent(in) :: wmax, wmin, tpert, & + sigmaw, sigmaqt, sigmathv, & + cwqt, cwthv, zcb_unset, & + wa, wb, ztopm1, & + pblh, convh, rhinv + ! + logical, intent(in) :: do_condensation + ! + real(r8), intent(out) :: dynamic_L0, ztop, mcape + ! + ! local variables + real(r8), dimension(nz) :: t_zt + real(r8), dimension(nz-1) :: tp, qstp + !real(r8), dimension(nz-1,clubb_mf_nup) :: dmpdz + !real(r8), dimension(clubb_mf_nup) :: tl, & + ! cape, cin + !integer, dimension(clubb_mf_nup) :: lcl, lel + real(r8), dimension(nz-1,1) :: dmpdz + real(r8), dimension(1) :: tl, & + cape, cin + integer, dimension(1) :: lcl, lel + real(r8) :: landfrac + integer :: kpbl, msg, & + lon, mx, & + k + + ! intialize local variables + cape = 0._r8 + mcape = 0._r8 + dmpdz = 0._r8 + + if (clubb_mf_Lopt==0) then + !Constant L0 + dynamic_L0 = clubb_mf_L0 + ztop = clubb_mf_L0 + else if (clubb_mf_Lopt==1) then + !TKE + do k=nz-2,2,-1 + if (zm(k) < 20000 .and. tke(k) - tke(k+1) > 1e-5) then + ztop = zm(k) + exit + endif + enddo + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==2) then + !Heat flux + do k=nz-2,2,-1 + !if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-3) then + if (zm(k) < 20000 .and. abs(abs(wpthlp_env(k))-abs(wpthlp_env(k-1))) > 1e-4) then + ztop = zm(k) + exit + endif + enddo + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==3) then + !Test plume + call oneplume( nz, zm, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, & + wa, wb, tke, do_condensation, do_clubb_mf_precip, ztop ) + + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + !ztop = ztop - 1600._r8 + !if (ztop < 1._r8) then + ! dynamic_L0 = clubb_mf_a0 + !else + ! dynamic_L0 = min(35._r8,clubb_mf_a0*(ztop**clubb_mf_b0)) + !end if + else if (clubb_mf_Lopt==4 .or. clubb_mf_Lopt==5) then + !dilute cape calculation + !dmpdz = -1._r8*ent_zt(2:nz,:) + dmpdz(:,:) = -1.E-3_r8 + t_zt = th/iexner_zt + landfrac = 1._r8 + + do k=2,nz + if (zt(k-1) <= pblh) then + kpbl = k + end if + end do + + do k=1,nz + if (p_zt(k) > 40.e2_r8) then + msg = k + end if + end do + !call buoyan_dilute(nz-1 ,clubb_mf_nup ,dmpdz , & + call buoyan_dilute(nz-1 ,1 ,dmpdz , & + qv(2:nz) ,t_zt(2:nz) ,p_zt(2:nz)*0.01_r8 ,zt(2:nz) ,p_zm*0.01_r8 , & + tp ,qstp ,tl ,cape ,cin , & + kpbl-1 ,lcl ,lel ,lon ,mx , & + msg-1 ,tpert ,landfrac ) + + !do i=1,clubb_mf_nup + ! mcape = mcape + cape(i) + !end do + !mcape = mcape/REAL(clubb_mf_nup) + mcape = max(cape(1),25._r8) + + if (clubb_mf_Lopt==4) then + ztop = max(zt(lel(1)+1),convh) + else if (clubb_mf_Lopt==5) then + ztop = mcape + end if + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + + else if (clubb_mf_Lopt==6) then + ! grab ztop from max height of ensemble in prior time-step(s) + ztop = ztopm1 + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + !if (masterproc) write(iam+110,*) 'mf_ztop, dynamic_L0 ', ztop, dynamic_L0 + else if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==8) then + ztop = rhinv + dynamic_L0 = clubb_mf_a0*(ztop**clubb_mf_b0) + end if + + end subroutine get_Lscale + subroutine condensation_mf( qt, thl, p, iex, thv, qc, th, ql, qi, qs, lmix ) ! =============================================================================== ! ! zero or one condensation for edmf: calculates thv and qc ! From e9b612816374d935592623b16cb4a710fb501367 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 23 Feb 2023 16:55:14 -0700 Subject: [PATCH 133/466] use ustar as a namelist option --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 +++++ src/physics/cam/clubb_intr.F90 | 4 ++- src/physics/cam/clubb_mf.F90 | 26 +++++++++++--------- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 6cda87405d..3abe817860 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3150,6 +3150,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_ddalph'); add_default($nl, 'clubb_mf_ddbeta'); add_default($nl, 'clubb_mf_pwfac'); + add_default($nl, 'do_clubb_mf_ustar'); add_default($nl, 'clubb_mf_up_ndt'); add_default($nl, 'clubb_mf_cp_ndt'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 2cd445db2b..85df0ca02f 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1957,6 +1957,7 @@ 2.e2 1.0 1.0 + .false. 1 1 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 2d06e5ea3d..4f5d4eb6f6 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3965,6 +3965,12 @@ Default: 1.0 Enhancement factor for the near surface pressure drag term in downdraft equation Default: 1.0 + +If .true. use ustar for initializing the plume ensemble +Default: .false. + + Real: number of time-steps for running average of the convective height scale diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index c1c00f337e..693b7835f5 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3144,6 +3144,8 @@ subroutine clubb_tend_cam( & th_sfc = cam_in%ts(i)*invrs_exner_zm(1) + call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & + rrho(i), ustar ) end if if (clubb_do_adv) then @@ -3318,7 +3320,7 @@ subroutine clubb_tend_cam( & th_zt, qv_zt, qc_zt, & ! input thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input th_zm, qv_zm, qc_zm, & ! input - th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input mf_cape_output(i), mf_ddcp, & ! output - plume diagnostics mf_upa, mf_dna, & ! output - plume diagnostics diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3799358c06..185cfd0de7 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -57,7 +57,8 @@ module clubb_mf logical, protected :: do_clubb_mf_diag = .false. logical, protected :: do_clubb_mf_rad = .false. logical, protected :: do_clubb_mf_coldpool = .false. - logical :: do_clubb_mf_precip = .false. + logical, protected :: do_clubb_mf_ustar = .false. + logical, protected :: do_clubb_mf_precip = .false. logical :: tht_tweaks = .true. integer :: mf_num_cin = 5 @@ -81,7 +82,7 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & - clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, & + clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & clubb_mf_up_ndt, clubb_mf_cp_ndt if (masterproc) then @@ -134,6 +135,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_up_ndt") call mpi_bcast(clubb_mf_cp_ndt, 1, mpi_integer, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_cp_ndt") + call mpi_bcast(do_clubb_mf_ustar, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_ustar") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -149,7 +152,7 @@ subroutine integrate_mf( nz, th, qv, qc, & ! input thl_zm, qt_zm, thv_zm, & ! input th_zm, qv_zm, qc_zm, & ! input - ths, wthl, wqt, pblh, & ! input + ustar, ths, wthl, wqt, pblh, & ! input wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input mcape, ddcp, & ! output upa, dna, & ! output @@ -232,7 +235,7 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: wthl,wqt real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv - real(r8), intent(in) :: ths + real(r8), intent(in) :: ths,ustar real(r8), intent(inout) :: ztopm1,ddcp real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid @@ -568,8 +571,14 @@ subroutine integrate_mf( nz, ! Construct tri-variate PDF at the surface from wstar ! ! and initialize plume thv, qt, w ! ! --------------------------------------------------------- ! - qstar = wqt / wstar - thvstar = wthv / wstar + + if (do_clubb_mf_ustar) then + qstar = wqt / max(wstarmin,ustar) + thvstar = wthv / max(wstarmin,ustar) + else + qstar = wqt / wstar + thvstar = wthv / wstar + end if sigmaw = alphw * wstar * cpfac sigmaqt = alphqt * abs(qstar) * cpfac @@ -995,11 +1004,6 @@ subroutine integrate_mf( nz, dnqt(k,i) = qt(k+1) *(1._r8-entexp ) + dnqt (k+1,i)*entexp + sqtint dnthl(k,i) = thl(k+1)*(1._r8-entexp ) + dnthl(k+1,i)*entexp + sthlint - !dnu(k,i) = dnu (k+1,i) + (dnu (k+1,i)- u(k+1))*(1._r8-entexpu) - !dnv(k,i) = dnv (k+1,i) + (dnv (k+1,i)- v(k+1))*(1._r8-entexpu) - !dnqt(k,i) = dnqt (k+1,i) + (dnqt (k+1,i)- qt(k+1))*(1._r8-entexp ) + sqtint - !dnthl(k,i) = dnthl(k+1,i) + (dnthl(k+1,i)-thl(k+1))*(1._r8-entexp ) + sthlint - ! get qsat call qsat(dnthl(k,i)/iexner_zm(k),p_zm(k),es,dnqs(k,i)) From e9f4f1e36ece35f0d28aa667d369c155be1c64e9 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 28 Feb 2023 19:23:49 -0700 Subject: [PATCH 134/466] added subcycle level plume areas to history --- src/physics/cam/clubb_intr.F90 | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 693b7835f5..f39717a746 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -295,6 +295,10 @@ module clubb_intr up_macmic2_idx, & dn_macmic1_idx, & dn_macmic2_idx, & + upa_macmic1_idx, & + upa_macmic2_idx, & + dna_macmic1_idx, & + dna_macmic2_idx, & thlu_macmic1_idx, & thlu_macmic2_idx, & qtu_macmic1_idx, & @@ -485,10 +489,15 @@ subroutine clubb_register_cam( ) call pbuf_add_field('DDCP' ,'global' , dtype_r8, (/pcols/), ddcp_idx) call pbuf_add_field('DDCP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ddcp_macmic_idx) call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols/), ddcpmn_idx) +!+++ARH call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) call pbuf_add_field('dn_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) call pbuf_add_field('dn_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic2_idx) + call pbuf_add_field('upa_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic1_idx) + call pbuf_add_field('upa_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic2_idx) + call pbuf_add_field('dna_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic1_idx) + call pbuf_add_field('dna_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic2_idx) call pbuf_add_field('thlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic1_idx) call pbuf_add_field('thlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic2_idx) call pbuf_add_field('qtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic1_idx) @@ -513,6 +522,7 @@ subroutine clubb_register_cam( ) call pbuf_add_field('ztop_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) call pbuf_add_field('ddcp_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) call pbuf_add_field('ddcp_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) +!---ARH end if #endif @@ -1446,6 +1456,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'up_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) call addfld ( 'dn_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) call addfld ( 'dn_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) + call addfld ( 'upa_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'upa' ) + call addfld ( 'upa_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'upa' ) + call addfld ( 'dna_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'dna' ) + call addfld ( 'dna_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'dna' ) call addfld ( 'thlu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) call addfld ( 'thlu_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) call addfld ( 'qtu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt up' ) @@ -1638,6 +1652,10 @@ subroutine clubb_ini_cam(pbuf2d) !call add_default( 'up_macmic2' , 1, ' ') !call add_default( 'dn_macmic1' , 1, ' ') !call add_default( 'dn_macmic2' , 1, ' ') + !call add_default( 'upa_macmic1' , 1, ' ') + !call add_default( 'upa_macmic2' , 1, ' ') + !call add_default( 'dna_macmic1' , 1, ' ') + !call add_default( 'dna_macmic2' , 1, ' ') !call add_default( 'thlu_macmic1' , 1, ' ') !call add_default( 'thlu_macmic2' , 1, ' ') !call add_default( 'qtu_macmic1' , 1, ' ') @@ -1743,6 +1761,10 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, up_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, dn_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, dn_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, upa_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, upa_macmic2_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dna_macmic1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, dna_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlu_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlu_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, qtu_macmic1_idx, 0.0_r8) @@ -2184,6 +2206,10 @@ subroutine clubb_tend_cam( & real(r8), pointer :: up_macmic2(:,:) real(r8), pointer :: dn_macmic1(:,:) real(r8), pointer :: dn_macmic2(:,:) + real(r8), pointer :: upa_macmic1(:,:) + real(r8), pointer :: upa_macmic2(:,:) + real(r8), pointer :: dna_macmic1(:,:) + real(r8), pointer :: dna_macmic2(:,:) real(r8), pointer :: thlu_macmic1(:,:) real(r8), pointer :: thlu_macmic2(:,:) real(r8), pointer :: qtu_macmic1(:,:) @@ -2542,6 +2568,10 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, up_macmic2_idx, up_macmic2) call pbuf_get_field(pbuf, dn_macmic1_idx, dn_macmic1) call pbuf_get_field(pbuf, dn_macmic2_idx, dn_macmic2) + call pbuf_get_field(pbuf, upa_macmic1_idx, upa_macmic1) + call pbuf_get_field(pbuf, upa_macmic2_idx, upa_macmic2) + call pbuf_get_field(pbuf, dna_macmic1_idx, dna_macmic1) + call pbuf_get_field(pbuf, dna_macmic2_idx, dna_macmic2) call pbuf_get_field(pbuf, thlu_macmic1_idx, thlu_macmic1) call pbuf_get_field(pbuf, thlu_macmic2_idx, thlu_macmic2) call pbuf_get_field(pbuf, qtu_macmic1_idx, qtu_macmic1) @@ -3218,6 +3248,10 @@ subroutine clubb_tend_cam( & if (macmic_it==1) up_macmic2(i,:) = 0._r8 if (macmic_it==1) dn_macmic1(i,:) = 0._r8 if (macmic_it==1) dn_macmic2(i,:) = 0._r8 + if (macmic_it==1) upa_macmic1(i,:) = 0._r8 + if (macmic_it==1) upa_macmic2(i,:) = 0._r8 + if (macmic_it==1) dna_macmic1(i,:) = 0._r8 + if (macmic_it==1) dna_macmic2(i,:) = 0._r8 if (macmic_it==1) thlu_macmic1(i,:) = 0._r8 if (macmic_it==1) thlu_macmic2(i,:) = 0._r8 if (macmic_it==1) qtu_macmic1(i,:) = 0._r8 @@ -3470,6 +3504,22 @@ subroutine clubb_tend_cam( & dn_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) end do + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + upa_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + dna_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + do k=1,nlev+1 flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) end do @@ -3553,6 +3603,22 @@ subroutine clubb_tend_cam( & dn_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) end do + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + upa_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + + do k=1,nlev+1 + flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) + end do + + do k=1,clubb_mf_nup + dna_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + end do + do k=1,nlev+1 flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) end do @@ -4813,6 +4879,10 @@ subroutine clubb_tend_cam( & call outfld( 'up_macmic2' , up_macmic2, pcols, lchnk ) call outfld( 'dn_macmic1' , dn_macmic1, pcols, lchnk ) call outfld( 'dn_macmic2' , dn_macmic2, pcols, lchnk ) + call outfld( 'upa_macmic1' , upa_macmic1, pcols, lchnk ) + call outfld( 'upa_macmic2' , upa_macmic2, pcols, lchnk ) + call outfld( 'dna_macmic1' , dna_macmic1, pcols, lchnk ) + call outfld( 'dna_macmic2' , dna_macmic2, pcols, lchnk ) call outfld( 'thlu_macmic1' , thlu_macmic1, pcols, lchnk ) call outfld( 'thlu_macmic2' , thlu_macmic2, pcols, lchnk ) call outfld( 'qtu_macmic1' , qtu_macmic1, pcols, lchnk ) From 4d3630411d79076e04db37a30ead117ab783cdd4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 7 Mar 2023 16:03:31 -0700 Subject: [PATCH 135/466] add dd mods forcing detrainment in subcloud layer --- src/physics/cam/clubb_intr.F90 | 6 +- src/physics/cam/clubb_mf.F90 | 123 ++++++++++++++++++++++----------- 2 files changed, 85 insertions(+), 44 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index f39717a746..712f0baa2f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1414,11 +1414,9 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) -!+++ARH call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) call addfld ( 'edmf_ddcp' , horiz_only, 'A', 'm/s' , 'edmf ddcp', flag_xyfill=.True.) call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) -!---ARH call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) @@ -4013,7 +4011,7 @@ subroutine clubb_tend_cam( & if (do_clubb_mf) then if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue - mf_ztop_output(i) = mf_ztop_nadv + mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv mf_L0_output(i) = mf_L0_nadv mf_cfl_output(i) = max_cfl_nadv mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) @@ -4846,9 +4844,9 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_dnqt' , mf_dnqt_output, pcols, lchnk ) call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) - call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) !+++ARH ! macmic_it==1 ensures that this is ddcp aeraged over the prior time-steps + if (macmic_it==1) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) !---ARH call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 185cfd0de7..ae34a5aed2 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -317,6 +317,7 @@ subroutine integrate_mf( nz, ! ! other variables integer :: k,i,kstart,ddtop,kcb + integer, dimension(clubb_mf_nup) :: ddbot real(r8), dimension(clubb_mf_nup) :: zcb real(r8) :: zcb_unset, cpfac, & wthv, ddint, iddcp, & @@ -338,7 +339,8 @@ subroutine integrate_mf( nz, wn, & ! momentum grid lmixn, srfarea, & ! momentum grid srfwqtu, srfwthvu, & - facqtu, facthvu + facqtu, facthvu, & + zsub, wcb ! ! ! ! cape variables @@ -375,6 +377,7 @@ subroutine integrate_mf( nz, thln0, qtn0, wn0, & entn, detn, mfn, & ee2, ud2 + ! ! parameters defining initial conditions for updrafts real(r8),parameter :: pwmin = 1.5_r8, & @@ -937,7 +940,17 @@ subroutine integrate_mf( nz, if (do_clubb_mf_precip .and. clubb_mf_fdd > 0._r8) then do i=1,clubb_mf_nup + + ! find cloud base + ddbot(i) = 0 + do k = 1,nz + if (upqc(k,i) > 0._r8) then + ddbot(i) = k + exit + end if + end do + ! find cloud top ddtop = 0 do k = 1,nz if (uprr(k,i) > 0._r8) ddtop = k @@ -1035,30 +1048,45 @@ subroutine integrate_mf( nz, dnrr(k,i) = max( dnrr(k+1,i) & - rho_zt(k+1)*dzt(k+1)*(sdnqt(k,i) + upauto(k+1,i)*clubb_mf_fdd) , 0._r8 ) end if - ! get virtual temperature dnthv(k,i) = dnthl(k,i)*(1._r8+zvir*dnqt(k,i)) + + if (k > ddbot(i)) then + ! get virtual temperature + dnthv(k,i) = dnthl(k,i)*(1._r8+zvir*dnqt(k,i)) + + ! get buoyancy + ! (midpoint k is surrounded by interface k and k-1, + ! and therefore we can't compute B at the midpoint properly) + B = gravit*(dnthv(k,i)/thv(k)-1._r8) + + ! get wn2 + wp = wb*entn*eturb & + + clubb_mf_pwfac/( 2._r8*zm(k)+tinynum ) * max( 1._r8 - exp( zm(k)/z00dn-1._r8), 0._r8 ) + if (wp==0._r8) then + wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) + else + entw = exp(-2._r8*wp*dzt(k+1)) + wn2 = entw*dnw(k+1,i)**2._r8-(1._r8-entw)*wa*B/wp + end if + wn2 = max(wn2,mindnw**2._r8) + dnw(k,i) = -1._r8*sqrt(wn2) - ! get buoyancy - ! (midpoint k is surrounded by interface k and k-1, - ! and therefore we can't compute B at the midpoint properly) - B = gravit*(dnthv(k,i)/thv(k)-1._r8) + ! enforce net positive mass flux at cloud base + !if (k == (ddbot(i)+1)) then + ! if (sqrt(wn2) > upw(k,i)) dnw(k,i) = -1._r8*upw(k,i) + !end if - ! get wn2 - wp = wb*entn*eturb & - + clubb_mf_pwfac/( 2._r8*zm(k)+tinynum ) * max( 1._r8 - exp( zm(k)/z00dn-1._r8), 0._r8 ) - if (wp==0._r8) then - wn2 = dnw(k+1,i)**2._r8-2._r8*wa*B*dzt(k+1) else - entw = exp(-2._r8*wp*dzt(k+1)) - wn2 = entw*dnw(k+1,i)**2._r8-(1._r8-entw)*wa*B/wp + zsub = zm(ddbot(i)+1) + wcb = dnw(ddbot(i)+1,i) + dnw(k,i) = wcb - (wcb/(zsub**3._r8))*(zsub - zm(k))**3._r8 + dnw(k,i) = min(dnw(k,i),-1._r8*mindnw) end if - wn2 = max(wn2,mindnw**2._r8) - dnw(k,i) = -1._r8*sqrt(wn2) end do!k - + end if end do!i @@ -1068,7 +1096,10 @@ subroutine integrate_mf( nz, ! zero out downdraft fluxes for dnw == -mindnw do i=1,clubb_mf_nup do k=1,nz - if ( dnw(k,i) == -1._r8*mindnw ) dnw(k,i) = 0._r8 + if ( dnw(k,i) == -1._r8*mindnw ) then + dnw(k,i) = 0._r8 + dna(k,i) = 0._r8 + end if end do end do @@ -1228,36 +1259,48 @@ subroutine integrate_mf( nz, ! --------------------------------------------------------- ! ! bulk downdraft velocity for coldpool parameterization ! ! --------------------------------------------------------- ! - +!+++ARH +! ! reset ddcp +! ddcp = 0._r8 +! do i=1,clubb_mf_nup +! ! find cloud base +! kcb = 0 +! do k=1,nz +! if (upqc(k,i) > 0._r8) then +! kcb = k +! exit +! end if +! end do +! +! ! reset iddcp +! iddcp = 0._r8 +! if (kcb == 0) then +! continue +! else if (kcb == 1) then +! iddcp = iddcp + dna(k,i)*dnw(k,i) +! continue +! else +! ddint = 0._r8 +! do k=1,kcb-1 +! ddint = ddint + dna(k,i)*dnw(k,i)*dzt(k+1) +! end do +! iddcp = iddcp + -1._r8*ddint/zm(kcb) +! end if +! ddcp = ddcp + iddcp +! ! +! end do +! + ! use single level for cold pool param. ! reset ddcp ddcp = 0._r8 do i=1,clubb_mf_nup - ! find cloud base - kcb = 0 - do k=1,nz - if (upqc(k,i) > 0._r8) then - kcb = k - exit - end if - end do - - ! reset iddcp - iddcp = 0._r8 - if (kcb == 0) then - continue - else if (kcb == 1) then - iddcp = iddcp + dna(k,i)*dnw(k,i) + if (ddbot(i) == 0) then continue else - ddint = 0._r8 - do k=1,kcb-1 - ddint = ddint + dna(k,i)*dnw(k,i)*dzt(k+1) - end do - iddcp = iddcp + -1._r8*ddint/zm(kcb) + ddcp = ddcp + -1._r8*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) end if - ddcp = ddcp + iddcp - ! end do +!---ARH ! --------------------------------------------------------- ! ! downward sweep to get ensemble mean precip ! From d72278fa1115d57fd792f45a1d7bf64543bd3c14 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 7 Mar 2023 17:16:11 -0700 Subject: [PATCH 136/466] added dd namelist ddexp --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 5 +++++ src/physics/cam/clubb_mf.F90 | 7 +++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 3abe817860..e8d827e851 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3150,6 +3150,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_ddalph'); add_default($nl, 'clubb_mf_ddbeta'); add_default($nl, 'clubb_mf_pwfac'); + add_default($nl, 'clubb_mf_ddexp'); add_default($nl, 'do_clubb_mf_ustar'); add_default($nl, 'clubb_mf_up_ndt'); add_default($nl, 'clubb_mf_cp_ndt'); diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 85df0ca02f..c7f0c4d328 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1957,6 +1957,7 @@ 2.e2 1.0 1.0 + 3.0 .false. 1 1 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 4f5d4eb6f6..e6510bc4ad 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3965,6 +3965,11 @@ Default: 1.0 Enhancement factor for the near surface pressure drag term in downdraft equation Default: 1.0 + +Elevation power law exponent for downdrafts velocities in the subcloud layer +Default: 3.0 + If .true. use ustar for initializing the plume ensemble diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index ae34a5aed2..1b50064de2 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -50,6 +50,7 @@ module clubb_mf real(r8) :: clubb_mf_ddalph = 0._r8 real(r8) :: clubb_mf_ddbeta = 0._r8 real(r8) :: clubb_mf_pwfac = 0._r8 + real(r8) :: clubb_mf_ddexp = 0._r8 integer :: clubb_mf_up_ndt = 1 integer :: clubb_mf_cp_ndt = 1 integer, protected :: clubb_mf_nup = 0 @@ -83,7 +84,7 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & - clubb_mf_up_ndt, clubb_mf_cp_ndt + clubb_mf_ddexp, clubb_mf_up_ndt, clubb_mf_cp_ndt if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -137,6 +138,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_cp_ndt") call mpi_bcast(do_clubb_mf_ustar, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_ustar") + call mpi_bcast(clubb_mf_ddexp, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ddexp") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -1081,7 +1084,7 @@ subroutine integrate_mf( nz, else zsub = zm(ddbot(i)+1) wcb = dnw(ddbot(i)+1,i) - dnw(k,i) = wcb - (wcb/(zsub**3._r8))*(zsub - zm(k))**3._r8 + dnw(k,i) = wcb - (wcb/(zsub**clubb_mf_ddexp))*(zsub - zm(k))**clubb_mf_ddexp dnw(k,i) = min(dnw(k,i),-1._r8*mindnw) end if From 2ffd790e0984c995e97aa01e20fb82a85bbad5d2 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 9 Mar 2023 16:15:18 -0700 Subject: [PATCH 137/466] added DQCORE diagnostic (cam_dev only) --- src/physics/cam/check_energy.F90 | 4 ++++ src/physics/cam_dev/physpkg.F90 | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/physics/cam/check_energy.F90 b/src/physics/cam/check_energy.F90 index 3d0232b356..ea66ac11ed 100644 --- a/src/physics/cam/check_energy.F90 +++ b/src/physics/cam/check_energy.F90 @@ -66,6 +66,7 @@ module check_energy integer :: teout_idx = 0 ! teout index in physics buffer integer :: dtcore_idx = 0 ! dtcore index in physics buffer + integer :: dqcore_idx = 0 ! dqcore index in physics buffer integer :: ducore_idx = 0 ! ducore index in physics buffer integer :: dvcore_idx = 0 ! dvcore index in physics buffer @@ -139,11 +140,13 @@ subroutine check_energy_register() call pbuf_add_field('TEOUT', 'global',dtype_r8 , (/pcols,dyn_time_lvls/), teout_idx) call pbuf_add_field('DTCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dtcore_idx) + call pbuf_add_field('DQCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dqcore_idx) call pbuf_add_field('DUCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),ducore_idx) call pbuf_add_field('DVCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dvcore_idx) if(is_subcol_on()) then call pbuf_register_subcol('TEOUT', 'phys_register', teout_idx) call pbuf_register_subcol('DTCORE', 'phys_register', dtcore_idx) + call pbuf_register_subcol('DQCORE', 'phys_register', dqcore_idx) call pbuf_register_subcol('DUCORE', 'phys_register', ducore_idx) call pbuf_register_subcol('DVCORE', 'phys_register', dvcore_idx) end if @@ -199,6 +202,7 @@ subroutine check_energy_init() call addfld('TEFIX', horiz_only, 'A', 'J/m2', 'Total energy after fixer') call addfld('EFIX', horiz_only, 'A', 'W/m2', 'Effective sensible heat flux due to energy fixer') call addfld('DTCORE', (/ 'lev' /), 'A', 'K/s' , 'T tendency due to dynamical core') + call addfld('DQCORE', (/ 'lev' /), 'A', 'kg/kg/s' , 'Water vapor tendency due to dynamical core') if ( history_budget ) then call add_default ('DTCORE', history_budget_histfile_num, ' ') diff --git a/src/physics/cam_dev/physpkg.F90 b/src/physics/cam_dev/physpkg.F90 index 27c13bb265..f9e6d9d510 100644 --- a/src/physics/cam_dev/physpkg.F90 +++ b/src/physics/cam_dev/physpkg.F90 @@ -86,6 +86,7 @@ module physpkg integer :: ducore_idx = 0 ! ducore index in physics buffer integer :: dvcore_idx = 0 ! dvcore index in physics buffer integer :: dtcore_idx = 0 + integer :: dqcore_idx = 0 ! dqcore index in physics buffer integer :: cmfmczm_idx = 0 ! Zhang-McFarlane convective mass fluxes integer :: rliqbc_idx = 0 ! tphysbc reserve liquid !======================================================================= @@ -995,6 +996,7 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) ducore_idx = pbuf_get_index('DUCORE') dvcore_idx = pbuf_get_index('DVCORE') dtcore_idx = pbuf_get_index('DTCORE') + dqcore_idx = pbuf_get_index('DQCORE') end subroutine phys_init @@ -1453,6 +1455,7 @@ subroutine tphysac (ztodt, cam_in, & real(r8), pointer, dimension(:,:) :: cldliqini real(r8), pointer, dimension(:,:) :: cldiceini real(r8), pointer, dimension(:,:) :: dtcore + real(r8), pointer, dimension(:,:) :: dqcore real(r8), pointer, dimension(:,:) :: ducore real(r8), pointer, dimension(:,:) :: dvcore real(r8), pointer, dimension(:,:) :: ast ! relative humidity cloud fraction @@ -1515,6 +1518,7 @@ subroutine tphysac (ztodt, cam_in, & itim_old = pbuf_old_tim_idx() call pbuf_get_field(pbuf, dtcore_idx, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, dqcore_idx, dqcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) @@ -2348,6 +2352,7 @@ subroutine tphysac (ztodt, cam_in, & ! store T, U, and V in buffer for use in computing dynamics T-tendency in next timestep do k = 1,pver dtcore(:ncol,k) = state%t(:ncol,k) + dqcore(:ncol,k) = state%q(:ncol,k,ixq) ducore(:ncol,k) = state%u(:ncol,k) dvcore(:ncol,k) = state%v(:ncol,k) end do @@ -2478,6 +2483,7 @@ subroutine tphysbc (ztodt, state, & real(r8), pointer, dimension(:,:) :: cldliqini real(r8), pointer, dimension(:,:) :: cldiceini real(r8), pointer, dimension(:,:) :: dtcore + real(r8), pointer, dimension(:,:) :: dqcore real(r8), pointer, dimension(:,:) :: ducore real(r8), pointer, dimension(:,:) :: dvcore @@ -2542,6 +2548,7 @@ subroutine tphysbc (ztodt, state, & call pbuf_get_field(pbuf, cldiceini_idx, cldiceini) call pbuf_get_field(pbuf, dtcore_idx, dtcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) + call pbuf_get_field(pbuf, dqcore_idx, dqcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) call pbuf_get_field(pbuf, ducore_idx, ducore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) call pbuf_get_field(pbuf, dvcore_idx, dvcore, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) ) @@ -2614,9 +2621,11 @@ subroutine tphysbc (ztodt, state, & ! T, U, V tendency due to dynamics if ( nstep > dyn_time_lvls-1 ) then dtcore(:ncol,:pver) = (state%t(:ncol,:pver) - dtcore(:ncol,:pver))/ztodt + dqcore(:ncol,:pver) = (state%q(:ncol,:pver,ixq) - dqcore(:ncol,:pver))/ztodt ducore(:ncol,:pver) = (state%u(:ncol,:pver) - ducore(:ncol,:pver))/ztodt dvcore(:ncol,:pver) = (state%v(:ncol,:pver) - dvcore(:ncol,:pver))/ztodt call outfld( 'DTCORE', dtcore, pcols, lchnk ) + call outfld( 'DQCORE', dqcore, pcols, lchnk ) call outfld( 'UTEND_CORE', ducore, pcols, lchnk ) call outfld( 'VTEND_CORE', dvcore, pcols, lchnk ) end if From 262858305def43c69f8a869aab87b3f44e20e9cf Mon Sep 17 00:00:00 2001 From: adamrher Date: Sat, 11 Mar 2023 13:22:42 -0700 Subject: [PATCH 138/466] add option to use clubbmf mixing depth in place of PBLH --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 +++ src/physics/cam/clubb_intr.F90 | 27 ++++++++++- src/physics/cam/clubb_mf.F90 | 48 ++++++++++++++++++-- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index e8d827e851..b75cf402e6 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3152,6 +3152,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_pwfac'); add_default($nl, 'clubb_mf_ddexp'); add_default($nl, 'do_clubb_mf_ustar'); + add_default($nl, 'do_clubb_mf_mixd'); add_default($nl, 'clubb_mf_up_ndt'); add_default($nl, 'clubb_mf_cp_ndt'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index c7f0c4d328..3f10546dbf 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1959,6 +1959,7 @@ 1.0 3.0 .false. + .false. 1 1 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index e6510bc4ad..3f69928bf9 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3976,6 +3976,12 @@ If .true. use ustar for initializing the plume ensemble Default: .false. + +If .true. use clubbmf mixing depth in place of the PBLH pbuf var +Default: .false. + + Real: number of time-steps for running average of the convective height scale diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 712f0baa2f..f2c7a69676 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -335,6 +335,8 @@ module clubb_intr integer :: ddcp_idx integer :: ddcp_macmic_idx integer :: ddcpmn_idx + integer :: cbm1_idx + integer :: cbm1_macmic_idx ! Output arrays for CLUBB statistics real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc @@ -489,6 +491,8 @@ subroutine clubb_register_cam( ) call pbuf_add_field('DDCP' ,'global' , dtype_r8, (/pcols/), ddcp_idx) call pbuf_add_field('DDCP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ddcp_macmic_idx) call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols/), ddcpmn_idx) + call pbuf_add_field('CBM1' ,'global' , dtype_r8, (/pcols/), cbm1_idx) + call pbuf_add_field('CBM1_MACMIC' ,'physpkg', dtype_r8, (/pcols/), cbm1_macmic_idx) !+++ARH call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) @@ -1754,6 +1758,8 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, ddcp_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcp_macmic_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcpmn_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, cbm1_idx, 0.0_r8) + call pbuf_set_field(pbuf2d, cbm1_macmic_idx, 0.0_r8) !+++ARH call pbuf_set_field(pbuf2d, up_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, up_macmic2_idx, 0.0_r8) @@ -2185,6 +2191,9 @@ subroutine clubb_tend_cam( & real(r8), pointer :: ddcp_macmic(:) real(r8), pointer :: ddcpmn(:,:) + real(r8), pointer :: cbm1(:) + real(r8), pointer :: cbm1_macmic(:) + !+++ARH real(r8), pointer :: qtm_macmic1(:,:) real(r8), pointer :: qtm_macmic2(:,:) @@ -2375,7 +2384,8 @@ subroutine clubb_tend_cam( & mf_ztopm1, mf_ztopm1_nadv, & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & - mf_ddcp, mf_ddcp_nadv + mf_ddcp, mf_ddcp_nadv, & + mf_cbm1, mf_cbm1_nadv real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat @@ -2561,6 +2571,9 @@ subroutine clubb_tend_cam( & call pbuf_get_field(pbuf, ddcp_idx, ddcp) call pbuf_get_field(pbuf, ddcp_macmic_idx, ddcp_macmic) call pbuf_get_field(pbuf, ddcpmn_idx, ddcpmn) + + call pbuf_get_field(pbuf, cbm1_idx, cbm1) + call pbuf_get_field(pbuf, cbm1_macmic_idx, cbm1_macmic) !+++ARH call pbuf_get_field(pbuf, up_macmic1_idx, up_macmic1) call pbuf_get_field(pbuf, up_macmic2_idx, up_macmic2) @@ -3237,9 +3250,12 @@ subroutine clubb_tend_cam( & mf_ztopm1 = 0._r8 mf_ztopm1_nadv = 0._r8 mf_ddcp_nadv = 0._r8 + mf_cbm1 = 0._r8 + mf_cbm1_nadv = 0._r8 if (macmic_it==1) ztopm1_macmic(i) = 0._r8 if (macmic_it==1) ddcp_macmic(i) = 0._r8 + if (macmic_it==1) cbm1_macmic(i) = 0._r8 !+++ARH if (macmic_it==1) up_macmic1(i,:) = 0._r8 @@ -3340,6 +3356,7 @@ subroutine clubb_tend_cam( & mf_ztopm1 = ztopma(i) mf_ddcp = ddcp(i) + mf_cbm1 = cbm1(i) rhinv = 0._r8 if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 @@ -3354,7 +3371,7 @@ subroutine clubb_tend_cam( & th_zm, qv_zm, qc_zm, & ! input ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input - mf_cape_output(i), mf_ddcp, & ! output - plume diagnostics + mf_cape_output(i), mf_ddcp, mf_cbm1, & ! output - plume diagnostics mf_upa, mf_dna, & ! output - plume diagnostics mf_upw, mf_dnw, & ! output - plume diagnostics mf_upmf, & ! output - plume diagnostics @@ -3469,6 +3486,7 @@ subroutine clubb_tend_cam( & mf_ztop_nadv = mf_ztop_nadv + mf_ztop mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 mf_ddcp_nadv = mf_ddcp_nadv + mf_ddcp + mf_cbm1_nadv = mf_cbm1_nadv + mf_cbm1 mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp) + mf_thlforcup(:pverp) mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp) + mf_qtforcup(:pverp) @@ -3795,13 +3813,17 @@ subroutine clubb_tend_cam( & mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) + mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) ! accumulate in buffer ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv + cbm1_macmic(i) = cbm1_macmic(i) + mf_cbm1_nadv if (macmic_it == cld_macmic_num_steps) then + cbm1(i) = cbm1_macmic(i)/REAL(cld_macmic_num_steps) + if (clubb_mf_up_ndt == 1) then ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) else @@ -3825,6 +3847,7 @@ subroutine clubb_tend_cam( & end do ddcp(i) = ddcp(i)/REAL(clubb_mf_cp_ndt) end if + ddcp(i) = clubb_mf_ddalph*ddcp(i) end if diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 1b50064de2..3b9d55a6ce 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -59,6 +59,7 @@ module clubb_mf logical, protected :: do_clubb_mf_rad = .false. logical, protected :: do_clubb_mf_coldpool = .false. logical, protected :: do_clubb_mf_ustar = .false. + logical, protected :: do_clubb_mf_mixd = .false. logical, protected :: do_clubb_mf_precip = .false. logical :: tht_tweaks = .true. integer :: mf_num_cin = 5 @@ -84,7 +85,7 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & - clubb_mf_ddexp, clubb_mf_up_ndt, clubb_mf_cp_ndt + clubb_mf_ddexp, do_clubb_mf_mixd, clubb_mf_up_ndt, clubb_mf_cp_ndt if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -140,6 +141,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_ustar") call mpi_bcast(clubb_mf_ddexp, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_ddexp") + call mpi_bcast(do_clubb_mf_mixd, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_mixd") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -157,7 +160,7 @@ subroutine integrate_mf( nz, th_zm, qv_zm, qc_zm, & ! input ustar, ths, wthl, wqt, pblh, & ! input wpthlp_env, tke, tpert, ztopm1, rhinv, & ! input - mcape, ddcp, & ! output + mcape, ddcp, cbm1, & ! output upa, dna, & ! output upw, dnw, & ! output upmf, & ! output @@ -239,7 +242,7 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv real(r8), intent(in) :: ths,ustar - real(r8), intent(inout) :: ztopm1,ddcp + real(r8), intent(inout) :: ztopm1,ddcp,cbm1 real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid @@ -320,7 +323,7 @@ subroutine integrate_mf( nz, ! ! other variables integer :: k,i,kstart,ddtop,kcb - integer, dimension(clubb_mf_nup) :: ddbot + integer, dimension(clubb_mf_nup) :: ddbot,kcbarr real(r8), dimension(clubb_mf_nup) :: zcb real(r8) :: zcb_unset, cpfac, & wthv, ddint, iddcp, & @@ -561,15 +564,22 @@ subroutine integrate_mf( nz, ! if surface buoyancy is positive then do mass-flux if ( wthv > 0._r8 ) then + if (do_clubb_mf_mixd) then + convh = max(cbm1,pblhmin) + else + convh = max(pblh,pblhmin) + end if + ! --------------------------------------------------------- ! ! Initialize using Deardorff convective velocity scale ! ! --------------------------------------------------------- ! - convh = max(pblh,pblhmin) + wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) ! --------------------------------------------------------- ! ! Compute cold pool feedback parameter ! ! --------------------------------------------------------- ! + cpfac = 1._r8 if (do_clubb_mf_coldpool) cpfac = min( (max(ddcp/wstar,1._r8))**clubb_mf_ddbeta, max_cpfac ) @@ -1259,6 +1269,34 @@ subroutine integrate_mf( nz, if (ac(k) > 0._r8) ztopm1 = zm(k) end do + ! --------------------------------------------------------- ! + ! cloud base / mixing depth calculation ! + ! --------------------------------------------------------- ! + cbm1 = 0._r8 + do i=1,clubb_mf_nup + kcbarr(i) = 0 + do k=1,nz + if (upqc(k,i) > 0._r8) then + kcbarr(i) = k + exit + end if + end do + + ! find height of dry plumes + if (kcbarr(i) == 0) then + do k=1,nz + if (upw(k,i) <= 0._r8) then + kcbarr(i) = k + exit + end if + end do + end if + + cbm1 = cbm1 + zm(kcbarr(i)) + + end do + cbm1 = cbm1/REAL(clubb_mf_nup) + ! --------------------------------------------------------- ! ! bulk downdraft velocity for coldpool parameterization ! ! --------------------------------------------------------- ! From f7330245e6ebc295624480c28c38372fc82050ca Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 14 Mar 2023 16:11:12 -0600 Subject: [PATCH 139/466] added aww to default history output --- src/physics/cam/clubb_intr.F90 | 9 +++++++++ src/physics/cam/clubb_mf.F90 | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index f2c7a69676..7a98715f9a 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1394,6 +1394,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) + call addfld ( 'edmf_S_AWW' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*w_i (EDMF)' ) call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) @@ -1605,6 +1606,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_precc' , 1, ' ') call add_default( 'edmf_S_AE' , 1, ' ') call add_default( 'edmf_S_AW' , 1, ' ') + call add_default( 'edmf_S_AWW' , 1, ' ') call add_default( 'edmf_S_AWTH' , 1, ' ') call add_default( 'edmf_S_AWTHL' , 1, ' ') call add_default( 'edmf_S_AWQT' , 1, ' ') @@ -2267,6 +2269,7 @@ subroutine clubb_tend_cam( & s_awthldn_output, s_awqtdn_output, & s_awthl_output, s_awqt_output, & s_awu_output, s_awv_output, & + s_aww_output, & mf_thlflxup_output,mf_qtflxup_output, & mf_thlflxdn_output,mf_qtflxdn_output, & mf_thlflx_output, mf_qtflx_output, & @@ -2332,6 +2335,8 @@ subroutine clubb_tend_cam( & s_aup, s_adn, & s_aw, & s_awup, s_awdn, & + s_aww, & + s_awwup, s_awwdn, & s_awthlup, s_awqtup, & s_awthldn, s_awqtdn, & s_awthl, s_awqt, & @@ -2861,6 +2866,7 @@ subroutine clubb_tend_cam( & s_awqt_output(:,:) = 0._r8 s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 + s_aww_output(:,:) = 0._r8 mf_upa_output(:,:) = 0._r8 mf_upw_output(:,:) = 0._r8 mf_upmf_output(:,:) = 0._r8 @@ -3393,6 +3399,7 @@ subroutine clubb_tend_cam( & s_ae, & ! output - plume diagnostics s_ac, s_aup, s_adn, & ! output - plume diagnostics s_aw, s_awup, s_awdn, & ! output - plume diagnostics + s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics s_awthlup, s_awqtup, & ! output - plume diagnostics s_awthldn, s_awqtdn, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics @@ -3986,6 +3993,7 @@ subroutine clubb_tend_cam( & s_awu_output(i,pverp-k+1) = s_awu(k) s_awv_output(i,pverp-k+1) = s_awv(k) + s_aww_output(i,pverp-k+1) = s_aww(k) mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) @@ -4831,6 +4839,7 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) + call outfld( 'edmf_S_AWW' , s_aww_output, pcols, lchnk ) call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 3b9d55a6ce..013d0ea73c 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -182,6 +182,7 @@ subroutine integrate_mf( nz, ae, & ac, aup, adn, & aw, awup, awdn, & + aww, awwup, awwdn, & awthlup, awqtup, & ! output awthldn, awqtdn, & ! output awthl, awqt, & ! output @@ -275,6 +276,7 @@ subroutine integrate_mf( nz, real(r8),dimension(nz), intent(out) :: ae, & ac, aup, adn, & aw, awup, awdn, & + aww, awwup, awwdn, & awthlup, awqtup, & ! momentum grid awthldn, awqtdn, & ! momentum grid awthl, awqt, & ! momentum grid @@ -472,6 +474,9 @@ subroutine integrate_mf( nz, aw = 0._r8 awup = 0._r8 awdn = 0._r8 + aww = 0._r8 + awwup = 0._r8 + awwdn = 0._r8 awthvup = 0._r8 awthvdn = 0._r8 awthlup = 0._r8 @@ -1226,6 +1231,9 @@ subroutine integrate_mf( nz, awup(k) = awup(k) + upa(k,i)*upw(k,i) awdn(k) = awdn(k) + dna(k,i)*dnw(k,i) + awwup(k) = awwup(k) + upa(k,i)*upw(k,i)*upw(k,i) + awwdn(k) = awwdn(k) + dna(k,i)*dnw(k,i)*dnw(k,i) + awthvdn(k)= awthvdn(k)+ dna(k,i)*dnw(k,i)*dnthv(k,i) awthldn(k)= awthldn(k)+ dna(k,i)*dnw(k,i)*dnthl(k,i) awqtdn(k) = awqtdn(k) + dna(k,i)*dnw(k,i)*dnqt(k,i) @@ -1247,7 +1255,8 @@ subroutine integrate_mf( nz, enddo - aw (k) = awup(k) + awdn(k) + aw (k) = awup(k)+ awdn(k) + aww(k) = awwup(k)+ awwdn(k) sqt(k) = sqtup(k) + sqtdn(k) sthl(k)= sthlup(k) + sthldn(k) From 8da39b6a9b749261fb47849c92c3a33a1acf2d3a Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 3 Apr 2023 15:50:23 -0600 Subject: [PATCH 140/466] fix bc ddbot not initiailzed for fdd=0 --- src/physics/cam/clubb_intr.F90 | 6 ++++-- src/physics/cam/clubb_mf.F90 | 23 +++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7a98715f9a..3e9806d588 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4040,8 +4040,10 @@ subroutine clubb_tend_cam( & enddo if (do_clubb_mf) then - if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue - if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue +!+++ARH + !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue + !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue +!---ARH mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv mf_L0_output(i) = mf_L0_nadv mf_cfl_output(i) = max_cfl_nadv diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 013d0ea73c..9a93fad11e 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1340,16 +1340,19 @@ subroutine integrate_mf( nz, ! ! ! end do ! - ! use single level for cold pool param. - ! reset ddcp - ddcp = 0._r8 - do i=1,clubb_mf_nup - if (ddbot(i) == 0) then - continue - else - ddcp = ddcp + -1._r8*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) - end if - end do + + if (do_clubb_mf_coldpool .and. clubb_mf_fdd > 0._r8) then + ! use single level for cold pool param. + ! reset ddcp + ddcp = 0._r8 + do i=1,clubb_mf_nup + if (ddbot(i) == 0) then + continue + else + ddcp = ddcp + -1._r8*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) + end if + end do + end if !---ARH ! --------------------------------------------------------- ! From dfbb4c62b3c84952ccf1cf8be4d746f47948e239 Mon Sep 17 00:00:00 2001 From: adamrher Date: Mon, 3 Apr 2023 17:37:52 -0600 Subject: [PATCH 141/466] added freq active variable --- src/physics/cam/clubb_intr.F90 | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 3e9806d588..93841b93f5 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1422,6 +1422,7 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) call addfld ( 'edmf_ddcp' , horiz_only, 'A', 'm/s' , 'edmf ddcp', flag_xyfill=.True.) call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) + call addfld ( 'edmf_freq' , horiz_only, 'A', 'unitless', 'edmf frequency mf is active', flag_xyfill=.True.) call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) @@ -1633,6 +1634,7 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_ztop' , 1, ' ') call add_default( 'edmf_ddcp' , 1, ' ') call add_default( 'edmf_L0' , 1, ' ') + call add_default( 'edmf_freq' , 1, ' ') call add_default( 'edmf_cape' , 1, ' ') call add_default( 'edmf_cfl' , 1, ' ') end if @@ -2278,7 +2280,7 @@ subroutine clubb_tend_cam( & ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & mf_cape_output, mf_cfl_output, & - mf_ddcp_output + mf_ddcp_output, mf_freq_output ! ! MF outputs to outfld real(r8), dimension(pcols,pver) :: mf_thlforcup_output, mf_qtforcup_output, & ! thermodynamic grid @@ -2390,7 +2392,8 @@ subroutine clubb_tend_cam( & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & mf_ddcp, mf_ddcp_nadv, & - mf_cbm1, mf_cbm1_nadv + mf_cbm1, mf_cbm1_nadv, & + mf_freq_nadv real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat @@ -2620,7 +2623,7 @@ subroutine clubb_tend_cam( & end do rhlev(:ncol) = 0._r8 - if (clubb_mf_Lopt==7) then + if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==6) then ! Interpolate RH to 500 hPa rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rhlev, & @@ -2911,6 +2914,7 @@ subroutine clubb_tend_cam( & mf_ztop_output(:) = 0._r8 mf_ddcp_output(:) = 0._r8 mf_L0_output(:) = 0._r8 + mf_freq_output(:) = 0._r8 mf_cape_output(:) = 0._r8 mf_cfl_output(:) = 0._r8 mf_dnw_output(:,:) = 0._r8 @@ -3258,6 +3262,7 @@ subroutine clubb_tend_cam( & mf_ddcp_nadv = 0._r8 mf_cbm1 = 0._r8 mf_cbm1_nadv = 0._r8 + mf_freq_nadv = 0._r8 if (macmic_it==1) ztopm1_macmic(i) = 0._r8 if (macmic_it==1) ddcp_macmic(i) = 0._r8 @@ -3495,6 +3500,8 @@ subroutine clubb_tend_cam( & mf_ddcp_nadv = mf_ddcp_nadv + mf_ddcp mf_cbm1_nadv = mf_cbm1_nadv + mf_cbm1 + if (mf_ztop > 0._r8) mf_freq_nadv = mf_freq_nadv + 1._r8 + mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp) + mf_thlforcup(:pverp) mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp) + mf_qtforcup(:pverp) mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp) + mf_thlforcdn(:pverp) @@ -3821,6 +3828,7 @@ subroutine clubb_tend_cam( & mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) + mf_freq_nadv = mf_freq_nadv/REAL(nadv) ! accumulate in buffer ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv @@ -4041,13 +4049,21 @@ subroutine clubb_tend_cam( & if (do_clubb_mf) then !+++ARH + ! these fillvalues won't average correctly !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue -!---ARH - mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv + + !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv + mf_ztop_output(i) = mf_ztop_nadv + mf_L0_output(i) = mf_L0_nadv mf_cfl_output(i) = max_cfl_nadv - mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) + + !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) + mf_ddcp_output(i) = mf_ddcp_nadv + + mf_freq_output(i) = mf_freq_nadv +!---ARH do k=1,clubb_mf_nup mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) @@ -4884,6 +4900,7 @@ subroutine clubb_tend_cam( & if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) !---ARH call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) + call outfld( 'edmf_freq' , mf_freq_output, pcols, lchnk ) call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) From f1c1d41ed605d55a74d67fe530ff716c47c48d66 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 5 Apr 2023 08:42:11 -0600 Subject: [PATCH 142/466] fixed area used in integrating microphys tends to get precip (eliminating negative precip) --- src/physics/cam/clubb_mf.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 9a93fad11e..ddb9fcabbf 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1246,11 +1246,11 @@ subroutine integrate_mf( nz, awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) if (k > 1) then - sqtup(k) = sqtup(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supqt(k,i) - sthlup(k) = sthlup(k) + 0.5_r8*(upa(k,i)+upa(k-1,i))*supthl(k,i) + sqtup(k) = sqtup(k) + upa(k-1,i)*supqt(k,i) + sthlup(k) = sthlup(k) + upa(k-1,i)*supthl(k,i) - sqtdn(k) = sqtdn(k) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnqt(k,i) - sthldn(k) = sthldn(k) + 0.5_r8*(dna(k,i)+dna(k-1,i))*sdnthl(k,i) + sqtdn(k) = sqtdn(k) + dna(k,i)*sdnqt(k,i) + sthldn(k) = sthldn(k) + dna(k,i)*sdnthl(k,i) end if enddo From 20b4ea5f9f1d2cf08ffb7b8e024f106a166f2d21 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Wed, 19 Apr 2023 16:42:48 -0600 Subject: [PATCH 143/466] mods to run SCAM w/o CLM cold start --- .../scam_mandatory/shell_commands | 6 ++-- src/dynamics/eul/dyn_comp.F90 | 14 +++++++++ src/dynamics/eul/iop.F90 | 18 ++++++++++-- src/dynamics/eul/restart_dynamics.F90 | 25 ++++++++++++---- src/dynamics/eul/scanslt.F90 | 29 +++++++++++++++++-- src/physics/cam/restart_physics.F90 | 9 ++++-- 6 files changed, 85 insertions(+), 16 deletions(-) diff --git a/cime_config/usermods_dirs/scam_mandatory/shell_commands b/cime_config/usermods_dirs/scam_mandatory/shell_commands index 0772ae5f3c..9cc82e9b18 100755 --- a/cime_config/usermods_dirs/scam_mandatory/shell_commands +++ b/cime_config/usermods_dirs/scam_mandatory/shell_commands @@ -10,6 +10,6 @@ # Note that clm cannot use initial conditions with SCAM -so will only use specified phenology # Only change if CLM_FORCE_COLDSTART exists. -if [ `./xmlquery --value CLM_FORCE_COLDSTART |& grep -c 'ERROR'` -eq 0 ]; then -./xmlchange CLM_FORCE_COLDSTART='on' -fi +#if [ `./xmlquery --value CLM_FORCE_COLDSTART |& grep -c 'ERROR'` -eq 0 ]; then +#./xmlchange CLM_FORCE_COLDSTART='on' +#fi diff --git a/src/dynamics/eul/dyn_comp.F90 b/src/dynamics/eul/dyn_comp.F90 index 0ba8285207..28b5d223b9 100644 --- a/src/dynamics/eul/dyn_comp.F90 +++ b/src/dynamics/eul/dyn_comp.F90 @@ -350,6 +350,20 @@ subroutine dyn_init(dyn_in, dyn_out) call add_default('DTH', history_budget_histfile_num, ' ') end if +!+++ARH + ! Restart allocate latiop/loniop for drydep + if (single_column) then + ! Using a standard iop - make the default grid size is + ! 4x4 degree square for mo_drydep deposition.(standard ARM IOP area) + allocate(latiop(2)) + allocate(loniop(2)) + latiop(1)=(scmlat-2._r8)*pi/180_r8 + latiop(2)=(scmlat+2._r8)*pi/180_r8 + loniop(1)=(mod(scmlon-2.0_r8+360.0_r8,360.0_r8))*pi/180.0_r8 + loniop(2)=(mod(scmlon+2.0_r8+360.0_r8,360.0_r8))*pi/180.0_r8 + end if +!---ARH + end subroutine dyn_init !========================================================================================= diff --git a/src/dynamics/eul/iop.F90 b/src/dynamics/eul/iop.F90 index c51a168a45..e54032fac2 100644 --- a/src/dynamics/eul/iop.F90 +++ b/src/dynamics/eul/iop.F90 @@ -36,7 +36,10 @@ module iop use spmd_utils, only: masterproc use string_utils, only: to_lower use time_manager, only: timemgr_init, get_curr_date, get_curr_calday,& - get_nstep,is_first_step,get_start_date,timemgr_time_inc + get_nstep,is_first_step,get_start_date,timemgr_time_inc,& +!+++ARH + is_first_restart_step +!---ARH use wrap_nf, only: wrap_inq_dimid,wrap_get_vara_realx ! ! !PUBLIC TYPES: @@ -1033,8 +1036,10 @@ subroutine setiopupdate save tsec, ntime, bdate save last_date, last_sec !------------------------------------------------------------------------------ - - if ( is_first_step() ) then +!+++ARH + !if ( is_first_step() ) then + if ( is_first_step() .or. is_first_restart_step() ) then +!---ARH ! ! Open IOP dataset ! @@ -1095,6 +1100,13 @@ subroutine setiopupdate do i=1,ntime ! set the first ioptimeidx call timemgr_time_inc(bdate, 0, next_date, next_sec, inc_s=tsec(i)) call get_start_date(yr,mon,day,start_tod) +!+++ARH + if (is_first_restart_step()) then + call get_curr_date(yr,mon,day,start_tod) + else + call get_start_date(yr,mon,day,start_tod) + end if +!---ARH start_ymd = yr*10000 + mon*100 + day if ( start_ymd > next_date .or. (start_ymd == next_date & diff --git a/src/dynamics/eul/restart_dynamics.F90 b/src/dynamics/eul/restart_dynamics.F90 index 348c2aa26c..a34be28433 100644 --- a/src/dynamics/eul/restart_dynamics.F90 +++ b/src/dynamics/eul/restart_dynamics.F90 @@ -8,7 +8,10 @@ module restart_dynamics use prognostics, only: u3, v3, t3, q3, & pdeld, ps, vort, div, & dps, phis, dpsl, dpsm, omga, ptimelevels - use scanslt, only: lammp, phimp, sigmp, qfcst + use scanslt, only: lammp, phimp, sigmp, qfcst, & +!+++ARH + psinitslt +!---ARH #if ( defined BFB_CAM_SCAM_IOP ) use iop, only: dqfx3sav,divq3dsav,divt3dsav,t2sav,betasav,fusav,fvsav #endif @@ -35,9 +38,15 @@ module restart_dynamics character(len=namlen) :: name end type restart_var_t #if ( defined BFB_CAM_SCAM_IOP ) - integer, parameter :: restartvarcnt = 24 +!+++ARH + !integer, parameter :: restartvarcnt = 24 + integer, parameter :: restartvarcnt = 25 +!---ARH #else - integer, parameter :: restartvarcnt = 17 +!+++ARH + !integer, parameter :: restartvarcnt = 17 + integer, parameter :: restartvarcnt = 18 +!---ARH #endif type(var_desc_t) :: timedesc, tmass0desc, fixmasdesc, hw1desc, hw2desc, hw3desc, alphadesc @@ -136,7 +145,10 @@ subroutine init_restart_varlist() vcnt=vcnt+1 call set_r_var('Q_fcst', 1, vcnt, v4=qfcst ) - +!+++ARH + vcnt=vcnt+1 + call set_r_var('PSINITSLT', 1, vcnt, v2=psinitslt ) +!---ARH #if ( defined BFB_CAM_SCAM_IOP ) ! @@ -155,7 +167,10 @@ subroutine init_restart_varlist() call set_r_var('T2', 1, vcnt, v3=t2sav ) vcnt=vcnt+1 - call set_r_var('FU', 1, vcnt, v3=fusav ) +!+++ARH + !call set_r_var('FU', 1, vcnt, v3=fusav ) + call set_rvar('FU', 1, vcnt, v3=fusav ) +!---ARH vcnt=vcnt+1 call set_r_var('FV', 1, vcnt, v3=fvsav ) diff --git a/src/dynamics/eul/scanslt.F90 b/src/dynamics/eul/scanslt.F90 index 40390729a0..951411fb58 100644 --- a/src/dynamics/eul/scanslt.F90 +++ b/src/dynamics/eul/scanslt.F90 @@ -63,7 +63,10 @@ module scanslt real(r8), pointer :: qminus(:,:,:,:) => null() ! constituents on previous step end type advection_state - public lammp, phimp, sigmp, qfcst ! Needed for restart + public lammp, phimp, sigmp, qfcst, & ! Needed for restart +!+++ARH + psinitslt +!---ARH ! integer, public :: nlonex(platd) = huge(1) ! num longitudes per lat (extended grid) real(r8) :: hw1lat (pcnst,plat) ! lat contribution to const. mass integral @@ -72,6 +75,9 @@ module scanslt real(r8), allocatable, target :: phimp(:,:,:) ! Phi midpoint coordinate real(r8), allocatable, target :: sigmp(:,:,:) ! Sigma midpoint coordinate real(r8), allocatable, target :: qfcst(:,:,:,:) ! slt forecast of moisture and constituents +!+++ARH + real(r8), allocatable, target :: psinitslt(:,:) !scam initial ps needed for slt lagrange interpolants +!---ARH ! ! Private data ! @@ -121,11 +127,17 @@ subroutine scanslt_alloc() allocate (phimp(plon,plev,beglat:endlat)) allocate (sigmp(plon,plev,beglat:endlat)) allocate (qfcst(plon,plev,pcnst,beglat:endlat)) +!+++ARH + allocate (psinitslt(plon,beglat:endlat)) +!---ARH lammp (:,:,:) = nan phimp (:,:,:) = nan sigmp (:,:,:) = nan qfcst (:,:,:,:) = nan +!+++ARH + psinitslt(:,:) = nan +!----ARH end subroutine scanslt_alloc ! @@ -144,7 +156,10 @@ subroutine scanslt_initial( adv_state, etamid, gravit_in, detam, cwava ) !----------------------------------------------------------------------- use commap, only: clat use prognostics, only: ps, n3 - use time_manager, only: is_first_step + use time_manager, only: is_first_step, & +!+++ARH + is_first_restart_step +!---ARH use hycoef, only: hyam, hybm, hyai, hybi, ps0 use eul_control_mod, only : pdela ! @@ -183,7 +198,15 @@ subroutine scanslt_initial( adv_state, etamid, gravit_in, detam, cwava ) ! if (single_column) then lat = beglat - call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) +!+++ARH + !call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) + if (is_first_restart_step()) then + call plevs0(plon, plon, plev, psinitslt(1,lat), pint, pmid, pdel) + else + call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) + psinitslt(1,lat)=ps(1,lat,n3) + end if +!---ARH etamid(:) = pmid(lat,:) etaint(:) = pint(lat,:) if ( any(etamid == 0.0_r8) ) call endrun('etamid == 0') diff --git a/src/physics/cam/restart_physics.F90 b/src/physics/cam/restart_physics.F90 index 9cf0a194f9..cb7efe7b83 100644 --- a/src/physics/cam/restart_physics.F90 +++ b/src/physics/cam/restart_physics.F90 @@ -352,6 +352,9 @@ subroutine read_restart_physics(File, cam_in, cam_out, pbuf2d) use subcol_utils, only: is_subcol_on use subcol, only: subcol_read_restart use pio, only: pio_read_darray +!+++ARH + use scamMod, only: single_column +!---ARH ! ! Arguments ! @@ -388,8 +391,10 @@ subroutine read_restart_physics(File, cam_in, cam_out, pbuf2d) physgrid = cam_grid_id('physgrid') call cam_grid_dimensions(physgrid, gdims(1:2)) - - if (gdims(2) == 1) then +!+++ARH + !if (gdims(2) == 1) then + if (gdims(2) == 1 .and. .not. single_column) then +!---ARH nhdims = 1 else nhdims = 2 From 7a595f0c9eed812a9bcaf313492f80705c2d1b9d Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 21 Apr 2023 18:15:38 -0600 Subject: [PATCH 144/466] updated externals to run CLM w/o a cold start in SCAM --- Externals.cfg | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 11dbbda0d3..4f9b7c1998 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -14,9 +14,11 @@ externals = Externals.cfg required = False [cmeps] -tag = cmeps0.13.40 +branch = clasp.mf +#tag = cmeps0.13.40 protocol = git -repo_url = https://github.com/ESCOMP/CMEPS.git +#repo_url = https://github.com/ESCOMP/CMEPS.git +repo_url = https://github.com/megandevlan/CMEPS.git local_path = components/cmeps required = True @@ -72,9 +74,11 @@ externals = Externals_CISM.cfg required = True [clm] -tag = ctsm5.1.dev067 +branch = clasp.mf_dev053_clminit +#tag = ctsm5.1.dev067 protocol = git -repo_url = https://github.com/ESCOMP/CTSM +#repo_url = https://github.com/ESCOMP/CTSM +repo_url = https://github.com/megandevlan/CTSM.git local_path = components/clm externals = Externals_CLM.cfg required = True From 0c025713bdea57bb231e2574d1177515b2bea642 Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 5 May 2023 16:04:40 -0600 Subject: [PATCH 145/466] Revert "updated externals to run CLM w/o a cold start in SCAM" This reverts commit 7a595f0c9eed812a9bcaf313492f80705c2d1b9d. --- Externals.cfg | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 4f9b7c1998..11dbbda0d3 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -14,11 +14,9 @@ externals = Externals.cfg required = False [cmeps] -branch = clasp.mf -#tag = cmeps0.13.40 +tag = cmeps0.13.40 protocol = git -#repo_url = https://github.com/ESCOMP/CMEPS.git -repo_url = https://github.com/megandevlan/CMEPS.git +repo_url = https://github.com/ESCOMP/CMEPS.git local_path = components/cmeps required = True @@ -74,11 +72,9 @@ externals = Externals_CISM.cfg required = True [clm] -branch = clasp.mf_dev053_clminit -#tag = ctsm5.1.dev067 +tag = ctsm5.1.dev067 protocol = git -#repo_url = https://github.com/ESCOMP/CTSM -repo_url = https://github.com/megandevlan/CTSM.git +repo_url = https://github.com/ESCOMP/CTSM local_path = components/clm externals = Externals_CLM.cfg required = True From ea0e3b3890dc57107087c35876c957fa039b3aea Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 5 May 2023 16:05:01 -0600 Subject: [PATCH 146/466] Revert "mods to run SCAM w/o CLM cold start" This reverts commit 20b4ea5f9f1d2cf08ffb7b8e024f106a166f2d21. --- .../scam_mandatory/shell_commands | 6 ++-- src/dynamics/eul/dyn_comp.F90 | 14 --------- src/dynamics/eul/iop.F90 | 18 ++---------- src/dynamics/eul/restart_dynamics.F90 | 25 ++++------------ src/dynamics/eul/scanslt.F90 | 29 ++----------------- src/physics/cam/restart_physics.F90 | 9 ++---- 6 files changed, 16 insertions(+), 85 deletions(-) diff --git a/cime_config/usermods_dirs/scam_mandatory/shell_commands b/cime_config/usermods_dirs/scam_mandatory/shell_commands index 9cc82e9b18..0772ae5f3c 100755 --- a/cime_config/usermods_dirs/scam_mandatory/shell_commands +++ b/cime_config/usermods_dirs/scam_mandatory/shell_commands @@ -10,6 +10,6 @@ # Note that clm cannot use initial conditions with SCAM -so will only use specified phenology # Only change if CLM_FORCE_COLDSTART exists. -#if [ `./xmlquery --value CLM_FORCE_COLDSTART |& grep -c 'ERROR'` -eq 0 ]; then -#./xmlchange CLM_FORCE_COLDSTART='on' -#fi +if [ `./xmlquery --value CLM_FORCE_COLDSTART |& grep -c 'ERROR'` -eq 0 ]; then +./xmlchange CLM_FORCE_COLDSTART='on' +fi diff --git a/src/dynamics/eul/dyn_comp.F90 b/src/dynamics/eul/dyn_comp.F90 index 28b5d223b9..0ba8285207 100644 --- a/src/dynamics/eul/dyn_comp.F90 +++ b/src/dynamics/eul/dyn_comp.F90 @@ -350,20 +350,6 @@ subroutine dyn_init(dyn_in, dyn_out) call add_default('DTH', history_budget_histfile_num, ' ') end if -!+++ARH - ! Restart allocate latiop/loniop for drydep - if (single_column) then - ! Using a standard iop - make the default grid size is - ! 4x4 degree square for mo_drydep deposition.(standard ARM IOP area) - allocate(latiop(2)) - allocate(loniop(2)) - latiop(1)=(scmlat-2._r8)*pi/180_r8 - latiop(2)=(scmlat+2._r8)*pi/180_r8 - loniop(1)=(mod(scmlon-2.0_r8+360.0_r8,360.0_r8))*pi/180.0_r8 - loniop(2)=(mod(scmlon+2.0_r8+360.0_r8,360.0_r8))*pi/180.0_r8 - end if -!---ARH - end subroutine dyn_init !========================================================================================= diff --git a/src/dynamics/eul/iop.F90 b/src/dynamics/eul/iop.F90 index e54032fac2..c51a168a45 100644 --- a/src/dynamics/eul/iop.F90 +++ b/src/dynamics/eul/iop.F90 @@ -36,10 +36,7 @@ module iop use spmd_utils, only: masterproc use string_utils, only: to_lower use time_manager, only: timemgr_init, get_curr_date, get_curr_calday,& - get_nstep,is_first_step,get_start_date,timemgr_time_inc,& -!+++ARH - is_first_restart_step -!---ARH + get_nstep,is_first_step,get_start_date,timemgr_time_inc use wrap_nf, only: wrap_inq_dimid,wrap_get_vara_realx ! ! !PUBLIC TYPES: @@ -1036,10 +1033,8 @@ subroutine setiopupdate save tsec, ntime, bdate save last_date, last_sec !------------------------------------------------------------------------------ -!+++ARH - !if ( is_first_step() ) then - if ( is_first_step() .or. is_first_restart_step() ) then -!---ARH + + if ( is_first_step() ) then ! ! Open IOP dataset ! @@ -1100,13 +1095,6 @@ subroutine setiopupdate do i=1,ntime ! set the first ioptimeidx call timemgr_time_inc(bdate, 0, next_date, next_sec, inc_s=tsec(i)) call get_start_date(yr,mon,day,start_tod) -!+++ARH - if (is_first_restart_step()) then - call get_curr_date(yr,mon,day,start_tod) - else - call get_start_date(yr,mon,day,start_tod) - end if -!---ARH start_ymd = yr*10000 + mon*100 + day if ( start_ymd > next_date .or. (start_ymd == next_date & diff --git a/src/dynamics/eul/restart_dynamics.F90 b/src/dynamics/eul/restart_dynamics.F90 index a34be28433..348c2aa26c 100644 --- a/src/dynamics/eul/restart_dynamics.F90 +++ b/src/dynamics/eul/restart_dynamics.F90 @@ -8,10 +8,7 @@ module restart_dynamics use prognostics, only: u3, v3, t3, q3, & pdeld, ps, vort, div, & dps, phis, dpsl, dpsm, omga, ptimelevels - use scanslt, only: lammp, phimp, sigmp, qfcst, & -!+++ARH - psinitslt -!---ARH + use scanslt, only: lammp, phimp, sigmp, qfcst #if ( defined BFB_CAM_SCAM_IOP ) use iop, only: dqfx3sav,divq3dsav,divt3dsav,t2sav,betasav,fusav,fvsav #endif @@ -38,15 +35,9 @@ module restart_dynamics character(len=namlen) :: name end type restart_var_t #if ( defined BFB_CAM_SCAM_IOP ) -!+++ARH - !integer, parameter :: restartvarcnt = 24 - integer, parameter :: restartvarcnt = 25 -!---ARH + integer, parameter :: restartvarcnt = 24 #else -!+++ARH - !integer, parameter :: restartvarcnt = 17 - integer, parameter :: restartvarcnt = 18 -!---ARH + integer, parameter :: restartvarcnt = 17 #endif type(var_desc_t) :: timedesc, tmass0desc, fixmasdesc, hw1desc, hw2desc, hw3desc, alphadesc @@ -145,10 +136,7 @@ subroutine init_restart_varlist() vcnt=vcnt+1 call set_r_var('Q_fcst', 1, vcnt, v4=qfcst ) -!+++ARH - vcnt=vcnt+1 - call set_r_var('PSINITSLT', 1, vcnt, v2=psinitslt ) -!---ARH + #if ( defined BFB_CAM_SCAM_IOP ) ! @@ -167,10 +155,7 @@ subroutine init_restart_varlist() call set_r_var('T2', 1, vcnt, v3=t2sav ) vcnt=vcnt+1 -!+++ARH - !call set_r_var('FU', 1, vcnt, v3=fusav ) - call set_rvar('FU', 1, vcnt, v3=fusav ) -!---ARH + call set_r_var('FU', 1, vcnt, v3=fusav ) vcnt=vcnt+1 call set_r_var('FV', 1, vcnt, v3=fvsav ) diff --git a/src/dynamics/eul/scanslt.F90 b/src/dynamics/eul/scanslt.F90 index 951411fb58..40390729a0 100644 --- a/src/dynamics/eul/scanslt.F90 +++ b/src/dynamics/eul/scanslt.F90 @@ -63,10 +63,7 @@ module scanslt real(r8), pointer :: qminus(:,:,:,:) => null() ! constituents on previous step end type advection_state - public lammp, phimp, sigmp, qfcst, & ! Needed for restart -!+++ARH - psinitslt -!---ARH + public lammp, phimp, sigmp, qfcst ! Needed for restart ! integer, public :: nlonex(platd) = huge(1) ! num longitudes per lat (extended grid) real(r8) :: hw1lat (pcnst,plat) ! lat contribution to const. mass integral @@ -75,9 +72,6 @@ module scanslt real(r8), allocatable, target :: phimp(:,:,:) ! Phi midpoint coordinate real(r8), allocatable, target :: sigmp(:,:,:) ! Sigma midpoint coordinate real(r8), allocatable, target :: qfcst(:,:,:,:) ! slt forecast of moisture and constituents -!+++ARH - real(r8), allocatable, target :: psinitslt(:,:) !scam initial ps needed for slt lagrange interpolants -!---ARH ! ! Private data ! @@ -127,17 +121,11 @@ subroutine scanslt_alloc() allocate (phimp(plon,plev,beglat:endlat)) allocate (sigmp(plon,plev,beglat:endlat)) allocate (qfcst(plon,plev,pcnst,beglat:endlat)) -!+++ARH - allocate (psinitslt(plon,beglat:endlat)) -!---ARH lammp (:,:,:) = nan phimp (:,:,:) = nan sigmp (:,:,:) = nan qfcst (:,:,:,:) = nan -!+++ARH - psinitslt(:,:) = nan -!----ARH end subroutine scanslt_alloc ! @@ -156,10 +144,7 @@ subroutine scanslt_initial( adv_state, etamid, gravit_in, detam, cwava ) !----------------------------------------------------------------------- use commap, only: clat use prognostics, only: ps, n3 - use time_manager, only: is_first_step, & -!+++ARH - is_first_restart_step -!---ARH + use time_manager, only: is_first_step use hycoef, only: hyam, hybm, hyai, hybi, ps0 use eul_control_mod, only : pdela ! @@ -198,15 +183,7 @@ subroutine scanslt_initial( adv_state, etamid, gravit_in, detam, cwava ) ! if (single_column) then lat = beglat -!+++ARH - !call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) - if (is_first_restart_step()) then - call plevs0(plon, plon, plev, psinitslt(1,lat), pint, pmid, pdel) - else - call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) - psinitslt(1,lat)=ps(1,lat,n3) - end if -!---ARH + call plevs0(plon, plon, plev, ps(1,lat,n3), pint, pmid, pdel) etamid(:) = pmid(lat,:) etaint(:) = pint(lat,:) if ( any(etamid == 0.0_r8) ) call endrun('etamid == 0') diff --git a/src/physics/cam/restart_physics.F90 b/src/physics/cam/restart_physics.F90 index cb7efe7b83..9cf0a194f9 100644 --- a/src/physics/cam/restart_physics.F90 +++ b/src/physics/cam/restart_physics.F90 @@ -352,9 +352,6 @@ subroutine read_restart_physics(File, cam_in, cam_out, pbuf2d) use subcol_utils, only: is_subcol_on use subcol, only: subcol_read_restart use pio, only: pio_read_darray -!+++ARH - use scamMod, only: single_column -!---ARH ! ! Arguments ! @@ -391,10 +388,8 @@ subroutine read_restart_physics(File, cam_in, cam_out, pbuf2d) physgrid = cam_grid_id('physgrid') call cam_grid_dimensions(physgrid, gdims(1:2)) -!+++ARH - !if (gdims(2) == 1) then - if (gdims(2) == 1 .and. .not. single_column) then -!---ARH + + if (gdims(2) == 1) then nhdims = 1 else nhdims = 2 From b818b52fd66ccef9d0bd7b83eef174872a957092 Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 5 May 2023 16:59:43 -0600 Subject: [PATCH 147/466] added namelist option for rhtke --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 ++++++ src/physics/cam/clubb_mf.F90 | 15 ++++++++++----- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index b75cf402e6..caf88a5cd1 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3155,6 +3155,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'do_clubb_mf_mixd'); add_default($nl, 'clubb_mf_up_ndt'); add_default($nl, 'clubb_mf_cp_ndt'); + add_default($nl, 'do_clubb_mf_rhtke'); } # Force exit if running cam_dev and CLUBB is off diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 3f10546dbf..d62e29fe90 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1962,6 +1962,7 @@ .false. 1 1 + .false. .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 3f69928bf9..e00dadc2a2 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3994,6 +3994,12 @@ Real: number of time-steps for running average of cold pool effects Default: 1 + +If .true. use relative humidity thresholds to turn off TKE enhanced entrainment +Default: .false. + + max_L0 ! ! --------------------------------------------------------- ! - if (dynamic_L0 >= clubb_mf_max_L0) then - eturb = 1._r8 + eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + if (do_clubb_mf_rhtke) then + rh_L0 = 50._r8*(rhinv**3._r8) + if (rh_L0 >= 733.34_r8) eturb = 1._r8 else - eturb = (1._r8 + clubb_mf_alphturb*sqrt(tke(k))/upw(k,i)) + if (dynamic_L0 >= clubb_mf_max_L0) eturb = 1._r8 end if entn = entn * eturb From 79afdcfe14c5374b223584b428a0818502bba150 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 25 May 2023 17:05:36 -0600 Subject: [PATCH 148/466] bug - clubbs buouyancy fluxes inflated by up to a factor cp --- src/physics/cam/clubb_intr.F90 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 93841b93f5..bf78ded404 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4572,7 +4572,6 @@ subroutine clubb_tend_cam( & rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - wpthvp(i,k) = wpthvp(i,k)*rho(i,k)*cpair if (do_clubb_mf) then ! comment out for kinemtatic fluxes !+++ARH @@ -4800,7 +4799,7 @@ subroutine clubb_tend_cam( & temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - temp2dp(:ncol,:) = wpthvp(:ncol,:) + temp2dp(:ncol,:) = wpthvp(:ncol,:)*rho(:ncol,:)*cpair call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) From a5601853ae423dd3256299a5424f9debe2a9f0de Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Mon, 5 Jun 2023 12:31:46 -0600 Subject: [PATCH 149/466] Adding mods for CLUBB+MF momentum transport. --- src/physics/cam/clubb_intr.F90 | 120 +++++++++++++++++++++++---------- src/physics/cam/clubb_mf.F90 | 64 ++++++++++++------ 2 files changed, 127 insertions(+), 57 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index bf78ded404..a0c2ea4c9a 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1414,6 +1414,12 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thl flux (EDMF)' ) call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt flux (EDMF)' ) call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thv flux (EDMF)' ) + call addfld ( 'edmf_uflxup' , (/ 'ilev' /), 'A', 'm2/s2' , 'u updraft flux (EDMF)' ) + call addfld ( 'edmf_vflxup' , (/ 'ilev' /), 'A', 'm2/s2' , 'v updraft flux (EDMF)' ) + call addfld ( 'edmf_uflxdn' , (/ 'ilev' /), 'A', 'm2/s2' , 'u downdraft flux (EDMF)' ) + call addfld ( 'edmf_vflxdn' , (/ 'ilev' /), 'A', 'm2/s2' , 'v downdraft flux (EDMF)' ) + call addfld ( 'edmf_uflx' , (/ 'ilev' /), 'A', 'm2/s2' , 'u flux (EDMF)' ) + call addfld ( 'edmf_vflx' , (/ 'ilev' /), 'A', 'm2/s2' , 'v flux (EDMF)' ) call addfld ( 'edmf_sqtup' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume updraft microphysics tendency (EDMF)' ) call addfld ( 'edmf_sqtdn' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume downdraft microphysics tendency (EDMF)' ) call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) @@ -1619,6 +1625,12 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_qtflxdn' , 1, ' ') call add_default( 'edmf_thlflx' , 1, ' ') call add_default( 'edmf_thvflx' , 1, ' ') + call add_default( 'edmf_uflxup' , 1, ' ') + call add_default( 'edmf_vflxup' , 1, ' ') + call add_default( 'edmf_uflxdn' , 1, ' ') + call add_default( 'edmf_vflxdn' , 1, ' ') + call add_default( 'edmf_uflx' , 1, ' ') + call add_default( 'edmf_vflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') call add_default( 'edmf_thlforcup', 1, ' ') call add_default( 'edmf_qtforcup' , 1, ' ') @@ -2259,23 +2271,23 @@ subroutine clubb_tend_cam( & logical :: apply_to_surface ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthlup_output, s_awqtup_output, & - s_awthldn_output, s_awqtdn_output, & - s_awthl_output, s_awqt_output, & - s_awu_output, s_awv_output, & - s_aww_output, & - mf_thlflxup_output,mf_qtflxup_output, & - mf_thlflxdn_output,mf_qtflxdn_output, & - mf_thlflx_output, mf_qtflx_output, & - mf_thvflx_output, & + real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & + mf_dry_w_output, mf_moist_w_output, & + mf_dry_qt_output, mf_moist_qt_output, & + mf_dry_thl_output, mf_moist_thl_output, & + mf_dry_u_output, mf_moist_u_output, & + mf_dry_v_output, mf_moist_v_output, & + mf_moist_qc_output, & + s_ae_output, s_aw_output, & + s_awthlup_output, s_awqtup_output, s_auwup_output, s_avwup_output, & + s_awthldn_output, s_awqtdn_output, s_auwdn_output, s_avwdn_output, & + s_awthl_output, s_awqt_output, & + s_awu_output, s_awv_output, & + s_aww_output, & + mf_thlflxup_output,mf_qtflxup_output, mf_uflxup_output, mf_vflxup_output, & + mf_thlflxdn_output,mf_qtflxdn_output, mf_uflxdn_output, mf_vflxdn_output, & + mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & + mf_thvflx_output, & mf_rcm_output, mf_precc_output ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & @@ -2339,8 +2351,8 @@ subroutine clubb_tend_cam( & s_awup, s_awdn, & s_aww, & s_awwup, s_awwdn, & - s_awthlup, s_awqtup, & - s_awthldn, s_awqtdn, & + s_awthlup, s_awqtup, s_auwup, s_avwup, & + s_awthldn, s_awqtdn, s_auwdn, s_avwdn, & s_awthl, s_awqt, & s_awu, s_awv, & mf_sqtup, mf_sthlup, & @@ -2348,19 +2360,19 @@ subroutine clubb_tend_cam( & mf_sqt, mf_sthl, & mf_precc - real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, & - mf_thlflxdn, mf_qtflxdn, & - mf_thlflx, mf_qtflx, & - mf_thvflx, & - mf_thlforcup, mf_qtforcup, & - mf_thlforcdn, mf_qtforcdn, & - mf_thlforcup_nadv,mf_qtforcup_nadv, & - mf_thlforcdn_nadv,mf_qtforcdn_nadv, & - mf_thlforc_nadv, mf_qtforc_nadv, & - mf_qc, mf_cloudfrac, & - mf_qc_nadv, mf_cloudfrac_nadv,& - mf_qc_zt, mf_cloudfrac_zt, & - mf_rcm, mf_rcm_nadv, & + real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & + mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & + mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & + mf_thvflx, & + mf_thlforcup, mf_qtforcup, & + mf_thlforcdn, mf_qtforcdn, & + mf_thlforcup_nadv,mf_qtforcup_nadv, & + mf_thlforcdn_nadv,mf_qtforcdn_nadv, & + mf_thlforc_nadv, mf_qtforc_nadv, & + mf_qc, mf_cloudfrac, & + mf_qc_nadv, mf_cloudfrac_nadv, & + mf_qc_zt, mf_cloudfrac_zt, & + mf_rcm, mf_rcm_nadv, & mf_ent_nadv ! MF plume level @@ -2867,6 +2879,10 @@ subroutine clubb_tend_cam( & s_awqtdn_output(:,:) = 0._r8 s_awthl_output(:,:) = 0._r8 s_awqt_output(:,:) = 0._r8 + s_auwup_output(:,:) = 0._r8 + s_avwup_output(:,:) = 0._r8 + s_auwdn_output(:,:) = 0._r8 + s_avwdn_output(:,:) = 0._r8 s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 s_aww_output(:,:) = 0._r8 @@ -2899,6 +2915,12 @@ subroutine clubb_tend_cam( & mf_thlflx_output(:,:) = 0._r8 mf_qtflx_output(:,:) = 0._r8 mf_thvflx_output(:,:) = 0._r8 + mf_uflxup_output(:,:) = 0._r8 + mf_vflxup_output(:,:) = 0._r8 + mf_uflxdn_output(:,:) = 0._r8 + mf_vflxdn_output(:,:) = 0._r8 + mf_uflx_output(:,:) = 0._r8 + mf_vflx_output(:,:) = 0._r8 mf_thlforcup_output(:,:) = 0._r8 mf_qtforcup_output(:,:) = 0._r8 mf_thlforcdn_output(:,:) = 0._r8 @@ -3405,13 +3427,13 @@ subroutine clubb_tend_cam( & s_ac, s_aup, s_adn, & ! output - plume diagnostics s_aw, s_awup, s_awdn, & ! output - plume diagnostics s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics - s_awthlup, s_awqtup, & ! output - plume diagnostics - s_awthldn, s_awqtdn, & ! output - plume diagnostics + s_awthlup, s_awqtup, s_auwup, s_avwup, & ! output - plume diagnostics + s_awthldn, s_awqtdn, s_auwdn, s_avwdn, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics s_awu, s_awv, & ! output - plume diagnostics - mf_thlflxup, mf_qtflxup, & ! output - plume diagnostics - mf_thlflxdn, mf_qtflxdn, & ! output - plume diagnostics - mf_thlflx, mf_qtflx, & ! output - variables needed for solver + mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics + mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & ! output - plume diagnostics + mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & ! output - variables needed for solver mf_thvflx, & ! output - plume diagnostics mf_sqtup, mf_sthlup, & ! output - plume diagnostics mf_sqtdn, mf_sthldn, & ! output - plume diagnostics @@ -3466,6 +3488,12 @@ subroutine clubb_tend_cam( & ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & + mf_sthl(k) + um_forcing(k) = um_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_uflx(k)) - (rho_ds_zm(k-1) * mf_uflx(k-1))) + + vm_forcing(k) = vm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & + ((rho_ds_zm(k) * mf_vflx(k)) - (rho_ds_zm(k-1) * mf_vflx(k-1))) + mf_qtforcup(k) = mf_qtforcup(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & ((rho_ds_zm(k) * mf_qtflxup(k)) - (rho_ds_zm(k-1) * mf_qtflxup(k-1))) & + mf_sqtup(k) @@ -3999,6 +4027,11 @@ subroutine clubb_tend_cam( & s_awthl_output(i,pverp-k+1) = s_awthl(k) s_awqt_output(i,pverp-k+1) = s_awqt(k) + s_auwup_output(i,pverp-k+1) = s_auwup(k) + s_avwup_output(i,pverp-k+1) = s_avwup(k) + s_auwdn_output(i,pverp-k+1) = s_auwdn(k) + s_avwdn_output(i,pverp-k+1) = s_auwdn(k) + s_awu_output(i,pverp-k+1) = s_awu(k) s_awv_output(i,pverp-k+1) = s_awv(k) s_aww_output(i,pverp-k+1) = s_aww(k) @@ -4011,6 +4044,13 @@ subroutine clubb_tend_cam( & mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) + mf_uflxup_output(i,pverp-k+1) = mf_uflxup(k) + mf_vflxup_output(i,pverp-k+1) = mf_vflxup(k) + mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(k) + mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(k) + mf_uflx_output(i,pverp-k+1) = mf_uflx(k) + mf_vflx_output(i,pverp-k+1) = mf_vflx(k) + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) mf_precc_output(i,pverp-k+1) = mf_precc(k) @@ -4875,6 +4915,12 @@ subroutine clubb_tend_cam( & call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) + call outfld( 'edmf_uflxup' , mf_uflxup_output, pcols, lchnk ) + call outfld( 'edmf_vflxup' , mf_vflxup_output, pcols, lchnk ) + call outfld( 'edmf_uflxdn' , mf_uflxdn_output, pcols, lchnk ) + call outfld( 'edmf_vflxdn' , mf_vflxdn_output, pcols, lchnk ) + call outfld( 'edmf_uflx' , mf_uflx_output, pcols, lchnk ) + call outfld( 'edmf_vflx' , mf_vflx_output, pcols, lchnk ) call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index fd7fafe8b3..dba95109c1 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -186,13 +186,13 @@ subroutine integrate_mf( nz, ac, aup, adn, & aw, awup, awdn, & aww, awwup, awwdn, & - awthlup, awqtup, & ! output - awthldn, awqtdn, & ! output + awthlup, awqtup, auwup, avwup, & ! output + awthldn, awqtdn, auwdn, avwdn, & ! output awthl, awqt, & ! output awu, awv, & ! output - thlflxup,qtflxup, & ! output - thlflxdn,qtflxdn, & ! output - thlflx, qtflx, & ! output - variables needed for solver + thlflxup,qtflxup, uflxup, vflxup, & ! output + thlflxdn,qtflxdn, uflxdn, vflxdn, & ! output + thlflx, qtflx, uflx, vflx, & ! output - variables needed for solver thvflx, & ! output sqtup, sthlup, & ! output sqtdn, sthldn, & ! output @@ -276,21 +276,21 @@ subroutine integrate_mf( nz, dry_v, moist_v, & ! momentum grid moist_qc ! momentum grid ! - real(r8),dimension(nz), intent(out) :: ae, & - ac, aup, adn, & - aw, awup, awdn, & - aww, awwup, awwdn, & - awthlup, awqtup, & ! momentum grid - awthldn, awqtdn, & ! momentum grid - awthl, awqt, & ! momentum grid - awu, awv, & ! momentum grid - thlflxup,qtflxup, & ! momentum grid - thlflxdn,qtflxdn, & ! momentum grid - thlflx, qtflx, & ! momentum grid - thvflx, & - sqtup, sthlup, & ! thermodynamic grid - sqtdn, sthldn, & ! thermodynamic grid - sqt, sthl, & ! thermodynamic grid + real(r8),dimension(nz), intent(out) :: ae, & + ac, aup, adn, & + aw, awup, awdn, & + aww, awwup, awwdn, & + awthlup, awqtup, auwup, avwup, & ! momentum grid + awthldn, awqtdn, auwdn, avwdn, & ! momentum grid + awthl, awqt, & ! momentum grid + awu, awv, & ! momentum grid + thlflxup,qtflxup, uflxup, vflxup, & ! momentum grid + thlflxdn,qtflxdn, uflxdn, vflxdn, & ! momentum grid + thlflx, qtflx, uflx, vflx, & ! momentum grid + thvflx, & + sqtup, sthlup, & ! thermodynamic grid + sqtdn, sthldn, & ! thermodynamic grid + sqt, sthl, & ! thermodynamic grid precc real(r8), intent(out) :: ztop, dynamic_L0, & @@ -480,6 +480,10 @@ subroutine integrate_mf( nz, aww = 0._r8 awwup = 0._r8 awwdn = 0._r8 + auwup = 0._r8 + avwup = 0._r8 + auwdn = 0._r8 + avwdn = 0._r8 awthvup = 0._r8 awthvdn = 0._r8 awthlup = 0._r8 @@ -498,6 +502,12 @@ subroutine integrate_mf( nz, qtflxdn = 0._r8 thvflx = 0._r8 thlflx = 0._r8 + uflxup = 0._r8 + vflxup = 0._r8 + uflxdn = 0._r8 + vflxdn = 0._r8 + uflx = 0._r8 + vflx = 0._r8 qtflx = 0._r8 sqtup = 0._r8 sthlup = 0._r8 @@ -1239,6 +1249,11 @@ subroutine integrate_mf( nz, awwup(k) = awwup(k) + upa(k,i)*upw(k,i)*upw(k,i) awwdn(k) = awwdn(k) + dna(k,i)*dnw(k,i)*dnw(k,i) + auwup(k) = auwup(k) + upa(k,i)*upu(k,i)*upw(k,i) + auwdn(k) = auwdn(k) + dna(k,i)*dnu(k,i)*dnw(k,i) + avwup(k) = avwup(k) + upa(k,i)*upv(k,i)*upw(k,i) + avwdn(k) = avwdn(k) + dna(k,i)*dnv(k,i)*dnw(k,i) + awthvdn(k)= awthvdn(k)+ dna(k,i)*dnw(k,i)*dnthv(k,i) awthldn(k)= awthldn(k)+ dna(k,i)*dnw(k,i)*dnthl(k,i) awqtdn(k) = awqtdn(k) + dna(k,i)*dnw(k,i)*dnqt(k,i) @@ -1391,14 +1406,23 @@ subroutine integrate_mf( nz, thlflxup(k)= awthlup(k) - awup(k)*thl_env(k+1) qtflxup (k)= awqtup (k) - awup(k)*qt_env (k+1) + uflxup (k)= uflxup (k) - awup(k)*u(k+1) + vflxup (k)= vflxup (k) - awup(k)*v(k+1) + ! if no downdrafts, should be zero since awdn should be zero thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k) thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k) qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k) + uflxdn (k)= uflxdn (k) - awdn(k)*u(k) + vflxdn (k)= vflxdn (k) - awdn(k)*v(k) + thvflx(k) = thvflxup(k) + thvflxdn(k) thlflx(k) = thlflxup(k) + thlflxdn(k) qtflx (k) = qtflxup (k) + qtflxdn (k) + + uflx(k) = uflxup(k) + uflxdn(k) + vflx(k) = vflxup(k) + vflxdn(k) enddo else From 22d90a676690c98566fce8d160aad967a53c1d08 Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Tue, 6 Jun 2023 08:22:34 -0600 Subject: [PATCH 150/466] Making requested changes. --- src/physics/cam/clubb_intr.F90 | 28 ++++++++++++------------- src/physics/cam/clubb_mf.F90 | 37 +++++++++++++++++----------------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index a0c2ea4c9a..de7df9cd0c 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2279,8 +2279,8 @@ subroutine clubb_tend_cam( & mf_dry_v_output, mf_moist_v_output, & mf_moist_qc_output, & s_ae_output, s_aw_output, & - s_awthlup_output, s_awqtup_output, s_auwup_output, s_avwup_output, & - s_awthldn_output, s_awqtdn_output, s_auwdn_output, s_avwdn_output, & + s_awthlup_output, s_awqtup_output, s_awuup_output, s_awvup_output, & + s_awthldn_output, s_awqtdn_output, s_awudn_output, s_awvdn_output, & s_awthl_output, s_awqt_output, & s_awu_output, s_awv_output, & s_aww_output, & @@ -2351,8 +2351,8 @@ subroutine clubb_tend_cam( & s_awup, s_awdn, & s_aww, & s_awwup, s_awwdn, & - s_awthlup, s_awqtup, s_auwup, s_avwup, & - s_awthldn, s_awqtdn, s_auwdn, s_avwdn, & + s_awthlup, s_awqtup, s_awuup, s_awvup, & + s_awthldn, s_awqtdn, s_awudn, s_awvdn, & s_awthl, s_awqt, & s_awu, s_awv, & mf_sqtup, mf_sthlup, & @@ -2879,10 +2879,10 @@ subroutine clubb_tend_cam( & s_awqtdn_output(:,:) = 0._r8 s_awthl_output(:,:) = 0._r8 s_awqt_output(:,:) = 0._r8 - s_auwup_output(:,:) = 0._r8 - s_avwup_output(:,:) = 0._r8 - s_auwdn_output(:,:) = 0._r8 - s_avwdn_output(:,:) = 0._r8 + s_awuup_output(:,:) = 0._r8 + s_awvup_output(:,:) = 0._r8 + s_awudn_output(:,:) = 0._r8 + s_awvdn_output(:,:) = 0._r8 s_awu_output(:,:) = 0._r8 s_awv_output(:,:) = 0._r8 s_aww_output(:,:) = 0._r8 @@ -3427,8 +3427,8 @@ subroutine clubb_tend_cam( & s_ac, s_aup, s_adn, & ! output - plume diagnostics s_aw, s_awup, s_awdn, & ! output - plume diagnostics s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics - s_awthlup, s_awqtup, s_auwup, s_avwup, & ! output - plume diagnostics - s_awthldn, s_awqtdn, s_auwdn, s_avwdn, & ! output - plume diagnostics + s_awthlup, s_awqtup, s_awuup, s_awvup, & ! output - plume diagnostics + s_awthldn, s_awqtdn, s_awudn, s_awvdn, & ! output - plume diagnostics s_awthl, s_awqt, & ! output - plume diagnostics s_awu, s_awv, & ! output - plume diagnostics mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics @@ -4027,10 +4027,10 @@ subroutine clubb_tend_cam( & s_awthl_output(i,pverp-k+1) = s_awthl(k) s_awqt_output(i,pverp-k+1) = s_awqt(k) - s_auwup_output(i,pverp-k+1) = s_auwup(k) - s_avwup_output(i,pverp-k+1) = s_avwup(k) - s_auwdn_output(i,pverp-k+1) = s_auwdn(k) - s_avwdn_output(i,pverp-k+1) = s_auwdn(k) + s_awuup_output(i,pverp-k+1) = s_awuup(k) + s_awvup_output(i,pverp-k+1) = s_awvup(k) + s_awudn_output(i,pverp-k+1) = s_awudn(k) + s_awvdn_output(i,pverp-k+1) = s_awvdn(k) s_awu_output(i,pverp-k+1) = s_awu(k) s_awv_output(i,pverp-k+1) = s_awv(k) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index dba95109c1..99a9b46dc1 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -186,8 +186,8 @@ subroutine integrate_mf( nz, ac, aup, adn, & aw, awup, awdn, & aww, awwup, awwdn, & - awthlup, awqtup, auwup, avwup, & ! output - awthldn, awqtdn, auwdn, avwdn, & ! output + awthlup, awqtup, awuup, awvup, & ! output + awthldn, awqtdn, awudn, awvdn, & ! output awthl, awqt, & ! output awu, awv, & ! output thlflxup,qtflxup, uflxup, vflxup, & ! output @@ -280,8 +280,8 @@ subroutine integrate_mf( nz, ac, aup, adn, & aw, awup, awdn, & aww, awwup, awwdn, & - awthlup, awqtup, auwup, avwup, & ! momentum grid - awthldn, awqtdn, auwdn, avwdn, & ! momentum grid + awthlup, awqtup, awuup, awvup, & ! momentum grid + awthldn, awqtdn, awudn, awvdn, & ! momentum grid awthl, awqt, & ! momentum grid awu, awv, & ! momentum grid thlflxup,qtflxup, uflxup, vflxup, & ! momentum grid @@ -480,10 +480,10 @@ subroutine integrate_mf( nz, aww = 0._r8 awwup = 0._r8 awwdn = 0._r8 - auwup = 0._r8 - avwup = 0._r8 - auwdn = 0._r8 - avwdn = 0._r8 + awuup = 0._r8 + awvup = 0._r8 + awudn = 0._r8 + awvdn = 0._r8 awthvup = 0._r8 awthvdn = 0._r8 awthlup = 0._r8 @@ -1249,10 +1249,10 @@ subroutine integrate_mf( nz, awwup(k) = awwup(k) + upa(k,i)*upw(k,i)*upw(k,i) awwdn(k) = awwdn(k) + dna(k,i)*dnw(k,i)*dnw(k,i) - auwup(k) = auwup(k) + upa(k,i)*upu(k,i)*upw(k,i) - auwdn(k) = auwdn(k) + dna(k,i)*dnu(k,i)*dnw(k,i) - avwup(k) = avwup(k) + upa(k,i)*upv(k,i)*upw(k,i) - avwdn(k) = avwdn(k) + dna(k,i)*dnv(k,i)*dnw(k,i) + awuup(k) = awuup(k) + upa(k,i)*upu(k,i)*upw(k,i) + awudn(k) = awudn(k) + dna(k,i)*dnu(k,i)*dnw(k,i) + awvup(k) = awvup(k) + upa(k,i)*upv(k,i)*upw(k,i) + awvdn(k) = awvdn(k) + dna(k,i)*dnv(k,i)*dnw(k,i) awthvdn(k)= awthvdn(k)+ dna(k,i)*dnw(k,i)*dnthv(k,i) awthldn(k)= awthldn(k)+ dna(k,i)*dnw(k,i)*dnthl(k,i) @@ -1262,9 +1262,6 @@ subroutine integrate_mf( nz, awthlup(k)= awthlup(k)+ upa(k,i)*upw(k,i)*upthl(k,i) awqtup(k) = awqtup(k) + upa(k,i)*upw(k,i)*upqt(k,i) - awu (k) = awu (k) + upa(k,i)*upw(k,i)*upu(k,i) - awv (k) = awv (k) + upa(k,i)*upw(k,i)*upv(k,i) - if (k > 1) then sqtup(k) = sqtup(k) + upa(k-1,i)*supqt(k,i) sthlup(k) = sthlup(k) + upa(k-1,i)*supthl(k,i) @@ -1277,6 +1274,8 @@ subroutine integrate_mf( nz, aw (k) = awup(k)+ awdn(k) aww(k) = awwup(k)+ awwdn(k) + awu(k) = awuup(k)+ awudn(k) + awv(k) = awvup(k)+ awvdn(k) sqt(k) = sqtup(k) + sqtdn(k) sthl(k)= sthlup(k) + sthldn(k) @@ -1406,16 +1405,16 @@ subroutine integrate_mf( nz, thlflxup(k)= awthlup(k) - awup(k)*thl_env(k+1) qtflxup (k)= awqtup (k) - awup(k)*qt_env (k+1) - uflxup (k)= uflxup (k) - awup(k)*u(k+1) - vflxup (k)= vflxup (k) - awup(k)*v(k+1) + uflxup (k)= uflxup (k) - awuup(k)*u(k+1) + vflxup (k)= vflxup (k) - awvup(k)*v(k+1) ! if no downdrafts, should be zero since awdn should be zero thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k) thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k) qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k) - uflxdn (k)= uflxdn (k) - awdn(k)*u(k) - vflxdn (k)= vflxdn (k) - awdn(k)*v(k) + uflxdn (k)= uflxdn (k) - awudn(k)*u(k) + vflxdn (k)= vflxdn (k) - awvdn(k)*v(k) thvflx(k) = thvflxup(k) + thvflxdn(k) thlflx(k) = thlflxup(k) + thlflxdn(k) From 4f08a7963cd8b62c7a78dfab967018a267e61b95 Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Tue, 6 Jun 2023 09:49:29 -0600 Subject: [PATCH 151/466] Making requested changes. --- src/physics/cam/clubb_mf.F90 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 99a9b46dc1..7fa13b1664 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1249,10 +1249,10 @@ subroutine integrate_mf( nz, awwup(k) = awwup(k) + upa(k,i)*upw(k,i)*upw(k,i) awwdn(k) = awwdn(k) + dna(k,i)*dnw(k,i)*dnw(k,i) - awuup(k) = awuup(k) + upa(k,i)*upu(k,i)*upw(k,i) - awudn(k) = awudn(k) + dna(k,i)*dnu(k,i)*dnw(k,i) - awvup(k) = awvup(k) + upa(k,i)*upv(k,i)*upw(k,i) - awvdn(k) = awvdn(k) + dna(k,i)*dnv(k,i)*dnw(k,i) + awuup(k) = awuup(k) + upa(k,i)*upw(k,i)*upu(k,i) + awudn(k) = awudn(k) + dna(k,i)*dnw(k,i)*dnu(k,i) + awvup(k) = awvup(k) + upa(k,i)*upw(k,i)*upv(k,i) + awvdn(k) = awvdn(k) + dna(k,i)*dnw(k,i)*dnv(k,i) awthvdn(k)= awthvdn(k)+ dna(k,i)*dnw(k,i)*dnthv(k,i) awthldn(k)= awthldn(k)+ dna(k,i)*dnw(k,i)*dnthl(k,i) @@ -1405,16 +1405,16 @@ subroutine integrate_mf( nz, thlflxup(k)= awthlup(k) - awup(k)*thl_env(k+1) qtflxup (k)= awqtup (k) - awup(k)*qt_env (k+1) - uflxup (k)= uflxup (k) - awuup(k)*u(k+1) - vflxup (k)= vflxup (k) - awvup(k)*v(k+1) + uflxup (k)= awuup(k) - awup(k)*u(k+1) + vflxup (k)= awvup(k) - awup(k)*v(k+1) ! if no downdrafts, should be zero since awdn should be zero thvflxdn(k)= awthvdn(k) - awdn(k)*thv_env(k) thlflxdn(k)= awthldn(k) - awdn(k)*thl_env(k) qtflxdn (k)= awqtdn (k) - awdn(k)*qt_env (k) - uflxdn (k)= uflxdn (k) - awudn(k)*u(k) - vflxdn (k)= vflxdn (k) - awvdn(k)*v(k) + uflxdn (k)= awudn(k) - awdn(k)*u(k) + vflxdn (k)= awvdn(k) - awdn(k)*v(k) thvflx(k) = thvflxup(k) + thvflxdn(k) thlflx(k) = thlflxup(k) + thlflxdn(k) From 058988d55b79919fd07a60d7b6bc3936ea273c2c Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Mon, 26 Jun 2023 15:14:40 -0600 Subject: [PATCH 152/466] Working on clubb_intr.F90 conflicts. --- src/physics/cam/clubb_intr.F90 | 876 ++++++++------------------------- 1 file changed, 211 insertions(+), 665 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index e7472c6f03..9899c72a08 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -25,7 +25,7 @@ module clubb_intr use phys_control, only: phys_getopts use physconst, only: cpair, gravit, rga, latvap, latice, zvir, rh2o, karman, rhoh2o use air_composition, only: rairv, cpairv - use cam_history_support, only: fillvalue, max_fieldname_len ! do we need fillvalue? BAS + use cam_history_support, only: fillvalue, max_fieldname_len use spmd_utils, only: masterproc use constituents, only: pcnst, cnst_add @@ -2057,7 +2057,6 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('WM_ZT_CLUBB', 1, ' ') call add_default('PBLH', 1, ' ') call add_default('CONCLD', 1, ' ') -!<<<<<<< HEAD BAS call add_default('TKE_CLUBB', 1, ' ') call add_default('ELEAK_CLUBB', 1, ' ') call add_default('TFIX_CLUBB', 1, ' ') @@ -2199,10 +2198,6 @@ subroutine clubb_ini_cam(pbuf2d) end if end if -!======= -! endif - -!>>>>>>> ESCOMP/cam_development if (history_amwg) then call add_default('PBLH', 1, ' ') end if @@ -2303,7 +2298,6 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) -!<<<<<<< HEAD BAS if (do_clubb_mf) then call pbuf_set_field(pbuf2d, ztopmn_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ztopma_idx, 0.0_r8) @@ -2348,13 +2342,11 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, ddcp_macmic2_idx, 0.0_r8) !---ARH end if -!======= call pbuf_set_field(pbuf2d, pdf_zm_w_1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, pdf_zm_w_2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, pdf_zm_varnce_w_1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, pdf_zm_varnce_w_2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, pdf_zm_mixt_frac_idx, 0.0_r8) -!>>>>>>> ESCOMP/cam_development endif @@ -2373,39 +2365,6 @@ end subroutine clubb_ini_cam ! =============================================================================== ! ! ! ! =============================================================================== ! -!<<<<<<< HEAD BAS -! -! subroutine clubb_tend_cam( & -! state, ptend_all, pbuf, hdtime, & -! cmfmc, cam_in, & -! macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) -! -!!------------------------------------------------------------------------------- -!! Description: Provide tendencies of shallow convection, turbulence, and -!! macrophysics from CLUBB to CAM -!! -!! Author: Cheryl Craig, March 2011 -!! Modifications: Pete Bogenschutz, March 2011 and onward -!! Origin: Based heavily on UWM clubb_init.F90 -!! References: -!! None -!!------------------------------------------------------------------------------- -! -! use physics_types, only: physics_state, physics_ptend, & -! physics_state_copy, physics_ptend_init, & -! physics_ptend_sum, physics_update, set_dry_to_wet -! -! use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc -! -! use constituents, only: cnst_get_ind, cnst_type -! use camsrfexch, only: cam_in_t -! use time_manager, only: is_first_step -! use cam_abortutils, only: endrun -! use cam_logfile, only: iulog -! use tropopause, only: tropopause_findChemTrop -! use time_manager, only: get_nstep -! -!======= subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & cmfmc, cam_in, & macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) @@ -2435,11 +2394,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & use tropopause, only: tropopause_findChemTrop use time_manager, only: get_nstep, is_first_restart_step - use wv_saturation, only: qsat !BAS - use interpolate_data,only: vertinterp !BAS + use wv_saturation, only: qsat + use interpolate_data,only: vertinterp -!>>>>>>> ESCOMP/cam_development - #ifdef CLUBB_SGS use hb_diff, only: pblintd use scamMOD, only: single_column,scm_clubb_iop_name @@ -2533,250 +2490,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & integer :: iter -<<<<<<< HEAD - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: tke_in(pverp+1-top_lev) ! TKE - real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] - real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] - real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] - real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] - real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] - real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] - real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] - real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] - real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] - real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] - real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] - real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] - real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] - real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] - real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] - real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] - real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] - real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] - real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] - real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] - real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] - real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] - real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] - real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap - real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap - real(r8) :: wprtp_mc_out(pverp+1-top_lev) - real(r8) :: wpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] - real(r8) :: rcm_out_zm(pverp+1-top_lev) - real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] - real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] - real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] - real(r8) :: thlprcp_out(pverp+1-top_lev) - real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] - real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] - real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] - real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] - real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] - real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] - real(r8) :: rfrzm(pverp+1-top_lev) - real(r8) :: radf(pverp+1-top_lev) - real(r8) :: wprtp_forcing(pverp+1-top_lev) - real(r8) :: wpthlp_forcing(pverp+1-top_lev) - real(r8) :: rtp2_forcing(pverp+1-top_lev) - real(r8) :: thlp2_forcing(pverp+1-top_lev) - real(r8) :: rtpthlp_forcing(pverp+1-top_lev) - real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) - real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] - real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: fcor ! Coriolis forcing [s^-1] - real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] - real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] - real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] - real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] - real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] - real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] - real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] - real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] - real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] - real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] - real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] - real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] - real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] - real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] - real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] - real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] - real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] - real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] - real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] - real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) - real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) - real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) - real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) - real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) - real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] - real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo ! roughness height [m] - real(r8) :: dz_g(pver) ! thickness of layer [m] - real(r8) :: relvarmax - real(r8) :: se_upper_a, se_upper_b, se_upper_diss - real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss - real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - real(r8) :: host_dx, host_dy ! CAM grid [m] - - ! Variables below are needed to compute energy integrals for conservation - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) - real(r8) :: eleak(pcols) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: qrl_clubb(pverp+1-top_lev) - real(r8) :: qrl_zm(pverp+1-top_lev) - real(r8) :: thlp2_rad_out(pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - real(r8) :: dl_rad, di_rad, dt_low - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend - - ! --------------- ! - ! Pointers ! - ! --------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - real(r8),pointer :: prec_sh(:) ! total precipitation from MF real(r8),pointer :: snow_sh(:) ! snow from MF @@ -2840,37 +2556,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8), pointer :: ddcp_macmic2(:,:) !---ARH - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface - - ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthlup_output, s_awqtup_output, s_awuup_output, s_awvup_output, & - s_awthldn_output, s_awqtdn_output, s_awudn_output, s_awvdn_output, & - s_awthl_output, s_awqt_output, & - s_awu_output, s_awv_output, & - s_aww_output, & - mf_thlflxup_output,mf_qtflxup_output, mf_uflxup_output, mf_vflxup_output, & - mf_thlflxdn_output,mf_qtflxdn_output, mf_uflxdn_output, mf_vflxdn_output, & - mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & - mf_thvflx_output, & - mf_rcm_output, mf_precc_output - ! real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & mf_cape_output, mf_cfl_output, & mf_ddcp_output, mf_freq_output @@ -2919,56 +2604,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! MF Plume real(r8), pointer :: tpert(:) - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - s_ae, s_ac, & - s_aup, s_adn, & - s_aw, & - s_awup, s_awdn, & - s_aww, & - s_awwup, s_awwdn, & - s_awthlup, s_awqtup, s_awuup, s_awvup, & - s_awthldn, s_awqtdn, s_awudn, s_awvdn, & - s_awthl, s_awqt, & - s_awu, s_awv, & - mf_sqtup, mf_sthlup, & - mf_sqtdn, mf_sthldn, & - mf_sqt, mf_sthl, & - mf_precc - real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & - mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & - mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & - mf_thvflx, & - mf_thlforcup, mf_qtforcup, & - mf_thlforcdn, mf_qtforcdn, & - mf_thlforcup_nadv,mf_qtforcup_nadv, & - mf_thlforcdn_nadv,mf_qtforcdn_nadv, & - mf_thlforc_nadv, mf_qtforc_nadv, & - mf_qc, mf_cloudfrac, & - mf_qc_nadv, mf_cloudfrac_nadv, & - mf_qc_zt, mf_cloudfrac_zt, & - mf_rcm, mf_rcm_nadv, & - mf_ent_nadv - - ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, mf_dna, & - mf_upw, mf_dnw, & - mf_upmf, & - mf_upqt, mf_dnqt, & - mf_upthl, mf_dnthl, & - mf_upthv, mf_dnthv, & - mf_upth, mf_dnth, & - mf_upqc, mf_dnqc, & - mf_upbuoy, & - mf_updet, & - mf_upent - real(r8), dimension(pverp,clubb_mf_nup) :: flip real(r8), dimension(pverp) :: lilflip @@ -2993,26 +2629,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8), dimension(pcols) :: rhlev real(r8) :: rhinv - ! MF local vars - real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - th_zt, qv_zt, & ! momentum grid - th_zm, qv_zm, & ! momentum grid - qc_zm, & ! momentum grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - dzm, invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - real(r8) :: valmax - - integer :: nlev +! real(r8) :: valmax !BAS need this? - intrinsic :: max - - character(len=*), parameter :: subr='clubb_tend_cam' -======= integer :: clubbtop(pcols) real(r8) :: frac_limit, ic_limit @@ -3228,7 +2846,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing + real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, , rtm_integral_vtend, rtm_integral_ltend !BAS do we need the last two? ! ---------------------------------------------------- ! ! Pointers ! @@ -3338,10 +2956,18 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_dry_v_output, mf_moist_v_output, & mf_moist_qc_output, & s_ae_output, s_aw_output, & + s_awthlup_output, s_awqtup_output, s_awuup_output, s_awvup_output, & + s_awthldn_output, s_awqtdn_output, s_awudn_output, s_awvdn_output, & s_awthl_output, s_awqt_output, & - s_awql_output, s_awqi_output, & +! s_awql_output, s_awqi_output, & !BAS need this? s_awu_output, s_awv_output, & - mf_thlflx_output, mf_qtflx_output + s_aww_output, & + mf_thlflxup_output,mf_qtflxup_output, mf_uflxup_output, mf_vflxup_output, & + mf_thlflxdn_output,mf_qtflxdn_output, mf_uflxdn_output, mf_vflxdn_output, & + mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & + mf_thvflx_output, & + mf_rcm_output, mf_precc_output + ! MF Plume ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines real(r8), dimension(pcols,pverp) :: mf_dry_a, mf_moist_a, & @@ -3351,11 +2977,48 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_dry_u, mf_moist_u, & mf_dry_v, mf_moist_v, & mf_moist_qc, & - s_ae, s_aw, & + s_ae, s_ac, & + s_aup, s_adn, & + s_aw, & + s_awup, s_awdn, & + s_aww, & + s_awwup, s_awwdn, & + s_awthlup, s_awqtup, s_awuup, s_awvup, & + s_awthldn, s_awqtdn, s_awudn, s_awvdn, & s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awu, s_awv, & - mf_thlflx, mf_qtflx + s_awu, s_awv, & + mf_sqtup, mf_sthlup, & + mf_sqtdn, mf_sthldn, & + mf_sqt, mf_sthl, & + mf_precc + + real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & + mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & + mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & + mf_thvflx, & + mf_thlforcup, mf_qtforcup, & + mf_thlforcdn, mf_qtforcdn, & + mf_thlforcup_nadv,mf_qtforcup_nadv, & + mf_thlforcdn_nadv,mf_qtforcdn_nadv, & + mf_thlforc_nadv, mf_qtforc_nadv, & + mf_qc, mf_cloudfrac, & + mf_qc_nadv, mf_cloudfrac_nadv, & + mf_qc_zt, mf_cloudfrac_zt, & + mf_rcm, mf_rcm_nadv, & + mf_ent_nadv + + ! MF plume level + real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + mf_upw, mf_dnw, & + mf_upmf, & + mf_upqt, mf_dnqt, & + mf_upthl, mf_dnthl, & + mf_upthv, mf_dnthv, & + mf_upth, mf_dnth, & + mf_upqc, mf_dnqc, & + mf_upbuoy, & + mf_updet, & + mf_upent real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend @@ -3364,15 +3027,17 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & dzt, invrs_dzt, & ! thermodynamic grid invrs_exner_zt,& ! thermodynamic grid kappa_zt, qc_zt, & ! thermodynamic grid + th_zt, qv_zt, & ! momentum grid + th_zm, qv_zm, & ! momentum grid + qc_zm, & ! momentum grid kappa_zm, p_in_Pa_zm, & ! momentum grid - invrs_exner_zm ! momentum grid + dzm, invrs_exner_zm ! momentum grid real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs integer :: nlev intrinsic :: max ->>>>>>> ESCOMP/cam_development character(len=*), parameter :: subr='clubb_tend_cam' @@ -3530,7 +3195,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) -<<<<<<< HEAD call pbuf_get_field(pbuf, tke_idx, tke) call pbuf_get_field(pbuf, qrl_idx, qrl) call pbuf_get_field(pbuf, radf_idx, radf_clubb) @@ -3654,9 +3318,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end if end if - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then -======= ! Allocate pdf_params only if they aren't allocated already. if ( .not. allocated(pdf_params_chnk(lchnk)%mixt_frac) ) then call init_pdf_params_api( pverp+1-top_lev, ncol, pdf_params_chnk(lchnk) ) @@ -3668,9 +3329,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & pdf_implicit_coefs_terms_chnk(lchnk) ) end if - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then ->>>>>>> ESCOMP/cam_development apply_const = 0._r8 ! On first time through do not remove constant ! from moments since it has not been added yet endif @@ -3847,27 +3505,26 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & um(1:ncol,pverp) = state1%u(1:ncol,pver) vm(1:ncol,pverp) = state1%v(1:ncol,pver) thlm(1:ncol,pverp) = thlm(1:ncol,pver) - -<<<<<<< HEAD - if (clubb_do_adv) then - thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) - rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) - wp2(1:ncol,pverp)=wp2(1:ncol,pver) - wp3(1:ncol,pverp)=wp3(1:ncol,pver) - up2(1:ncol,pverp)=up2(1:ncol,pver) - vp2(1:ncol,pverp)=vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) - enddo - enddo + + if (clubb_do_adv) then + thlp2(1:ncol,pverp) = thlp2(1:ncol,pver) + rtp2(1:ncol,pverp) = rtp2(1:ncol,pver) + rtpthlp(1:ncol,pverp) = rtpthlp(1:ncol,pver) + wpthlp(1:ncol,pverp) = wpthlp(1:ncol,pver) + wprtp(1:ncol,pverp) = wprtp(1:ncol,pver) + wp2(1:ncol,pverp) = wp2(1:ncol,pver) + wp3(1:ncol,pverp) = wp3(1:ncol,pver) + up2(1:ncol,pverp) = up2(1:ncol,pver) + vp2(1:ncol,pverp) = vp2(1:ncol,pver) + endif + + ! Compute virtual potential temperature, which is needed for CLUBB + do k=1,pver + do i=1,ncol + thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& + -state1%q(i,k,ixcldliq)) + enddo + enddo call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) @@ -4030,25 +3687,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wm_zt(1) = 0._r8 do k=1,nlev wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) -======= - if (clubb_do_adv) then - thlp2(1:ncol,pverp) = thlp2(1:ncol,pver) - rtp2(1:ncol,pverp) = rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp) = rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp) = wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp) = wprtp(1:ncol,pver) - wp2(1:ncol,pverp) = wp2(1:ncol,pver) - wp3(1:ncol,pverp) = wp3(1:ncol,pver) - up2(1:ncol,pverp) = up2(1:ncol,pver) - vp2(1:ncol,pverp) = vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) ->>>>>>> ESCOMP/cam_development enddo enddo @@ -4167,7 +3805,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wm_zt(i,1) = wm_zt(i,2) end do - ! ------------------------------------------------- ! ! Begin case specific code for SCAM cases. ! ! This section of code block is NOT called in ! @@ -4189,102 +3826,137 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! Below denotes case specifics for surface momentum ! and thermodynamic fluxes, depending on the case -<<<<<<< HEAD - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & - zi_g(1), zi_g, zt_g) - - call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & - zi_g, zt_g, & - clubb_config_flags%l_prescribed_avg_deltaz, & - err_code ) - - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing = 0._r8 - rtm_forcing = 0._r8 - um_forcing = 0._r8 - vm_forcing = 0._r8 - - wprtp_forcing = 0._r8 - wpthlp_forcing = 0._r8 - rtp2_forcing = 0._r8 - thlp2_forcing = 0._r8 - rtpthlp_forcing = 0._r8 - - ice_supersat_frac_out = 0._r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) - thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) - wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) - wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) - rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(i,:) = 0.0_r8 - thlp2_mc_zt(i,:) = 0.0_r8 - wprtp_mc_zt(i,:) = 0.0_r8 - wpthlp_mc_zt(i,:) = 0.0_r8 - rtpthlp_mc_zt(i,:) = 0.0_r8 - - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api(rho_ds_zt) - rho_zm = zt2zm_api(rho_zt) - invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) - thv_ds_zm = zt2zm_api(thv_ds_zt) - wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model - wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux - wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) - upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - um_in(k) = um(i,pverp-k+1) - vm_in(k) = vm(i,pverp-k+1) - upwp_in(k) = upwp(i,pverp-k+1) - vpwp_in(k) = vpwp(i,pverp-k+1) - wpthvp_in(k) = wpthvp(i,pverp-k+1) - wp2thvp_in(k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(k)= thlpthvp(i,pverp-k+1) - up2_in(k) = up2(i,pverp-k+1) - vp2_in(k) = vp2(i,pverp-k+1) - up3_in(k) = up3(i,pverp-k+1) - vp3_in(k) = vp3(i,pverp-k+1) - wp2_in(k) = wp2(i,pverp-k+1) - wp3_in(k) = wp3(i,pverp-k+1) - rtp2_in(k) = rtp2(i,pverp-k+1) - thlp2_in(k) = thlp2(i,pverp-k+1) - rtp3_in(k) = rtp3(i,pverp-k+1) - thlp3_in(k) = thlp3(i,pverp-k+1) - thlm_in(k) = thlm(i,pverp-k+1) - rtm_in(k) = rtm(i,pverp-k+1) - rvm_in(k) = rvm(i,pverp-k+1) - wprtp_in(k) = wprtp(i,pverp-k+1) - wpthlp_in(k) = wpthlp(i,pverp-k+1) - tke_in(k) = tke(i,pverp-k+1) - rtpthlp_in(k) = rtpthlp(i,pverp-k+1) - rcm_inout(k) = rcm(i,pverp-k+1) - cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) - sclrpthvp_inout(k,:) = 0._r8 + ! Define ustar (based on case, if not variable) + ustar = 0.25_r8 ! Initialize ustar in case no case + + if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then + ustar = 0.30_r8 + endif + + if(trim(scm_clubb_iop_name) == 'RICO_3day') then + ustar = 0.28_r8 + endif + + if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & + trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & + trim(scm_clubb_iop_name) == 'ARM_CC') then + + bflx22(1) = (gravit/theta0)*wpthlp_sfc(1) + ustar = diag_ustar(zt_g(1,2),bflx22(1),ubar,zo(1)) + endif + + ! Compute the surface momentum fluxes, if this is a SCAM simulation + upwp_sfc(1) = -um(1,pver)*ustar**2/ubar + vpwp_sfc(1) = -vm(1,pver)*ustar**2/ubar + + end if + + ! Define surface sources for transported variables for diffusion, will + ! be zero as these tendencies are done in vertical_diffusion + do ixind=1,edsclr_dim + do i=1,ncol + wpedsclrp_sfc(i,ixind) = 0._r8 + end do + end do + + ! Set stats output and increment equal to CLUBB and host dt + stats_tsamp = dtime + stats_tout = hdtime + + stats_nsamp = nint(stats_tsamp/dtime) + stats_nout = nint(stats_tout/dtime) + + ! Heights need to be set at each timestep. Therefore, recall + ! setup_grid and setup_parameters for this. + + ! Set-up CLUBB core at each CLUBB call because heights can change + ! Important note: do not make any calls that use CLUBB grid-height + ! operators (such as zt2zm_api, etc.) until AFTER the + ! call to setup_grid_heights_api. + call setup_grid_api( nlev+1, ncol, sfc_elevation, l_implemented, & ! intent(in) + grid_type, zi_g(:,2), zi_g(:,1), zi_g(:,nlev+1), & ! intent(in) + zi_g, zt_g, & ! intent(in) + gr, begin_height, end_height ) ! intent(out) + + call setup_parameters_api( zi_g(:,2), clubb_params, nlev+1, ncol, grid_type, & ! intent(in) + zi_g, zt_g, & ! intent(in) + clubb_config_flags%l_prescribed_avg_deltaz, & ! intent(in) + lmin, nu_vert_res_dep, err_code ) ! intent(out) + if ( err_code == clubb_fatal_error ) then + call endrun(subr//': Fatal error in CLUBB setup_parameters') + end if + + ! Define forcings from CAM to CLUBB as zero for momentum and thermo, + ! forcings already applied through CAM + thlm_forcing(:,:) = 0._r8 + rtm_forcing(:,:) = 0._r8 + um_forcing(:,:) = 0._r8 + vm_forcing(:,:) = 0._r8 + + + rtm_ref(:,:) = 0.0_r8 + thlm_ref(:,:) = 0.0_r8 + um_ref(:,:) = 0.0_r8 + vm_ref(:,:) = 0.0_r8 + ug(:,:) = 0.0_r8 + vg(:,:) = 0.0_r8 + + ! Add forcings for SILHS covariance contributions + rtp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtp2_mc_zt(1:ncol,:) ) + thlp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, thlp2_mc_zt(1:ncol,:) ) + wprtp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wprtp_mc_zt(1:ncol,:) ) + wpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wpthlp_mc_zt(1:ncol,:) ) + rtpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtpthlp_mc_zt(1:ncol,:) ) + + ! Zero out SILHS covariance contribution terms + rtp2_mc_zt(:,:) = 0.0_r8 + thlp2_mc_zt(:,:) = 0.0_r8 + wprtp_mc_zt(:,:) = 0.0_r8 + wpthlp_mc_zt(:,:) = 0.0_r8 + rtpthlp_mc_zt(:,:) = 0.0_r8 + + + ! Compute some inputs from the thermodynamic grid + ! to the momentum grid + rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_ds_zt ) + rho_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_zt ) + invrs_rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, invrs_rho_ds_zt ) + thv_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt ) + wm_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, wm_zt ) + + ! Surface fluxes provided by host model + do i=1,ncol + wpthlp_sfc(i) = cam_in%shf(i)/(cpairv(i,pver,lchnk)*rho_ds_zm(i,1)) ! Sensible heat flux + wpthlp_sfc(i) = wpthlp_sfc(i)*inv_exner_clubb_surf(i) ! Potential temperature flux + wprtp_sfc(i) = cam_in%cflx(i,1)/rho_ds_zm(i,1) ! Moisture flux + end do + + ! Implementation after Thomas Toniazzo (NorESM) and Colin Zarzycki (PSU) + ! Other Surface fluxes provided by host model + if( (cld_macmic_num_steps > 1) .and. clubb_l_intr_sfc_flux_smooth ) then + ! Adjust surface stresses using winds from the prior macmic iteration + do i=1,ncol + ubar = sqrt(state1%u(i,pver)**2+state1%v(i,pver)**2) + if (ubar < 0.25_r8) ubar = 0.25_r8 + + call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & + rrho(i), ustar ) + + upwp_sfc(i) = -state1%u(i,pver)*ustar**2/ubar + vpwp_sfc(i) = -state1%v(i,pver)*ustar**2/ubar + end do + else + do i=1,ncol + upwp_sfc(i) = cam_in%wsx(i)/rho_ds_zm(i,1) ! Surface meridional momentum flux + vpwp_sfc(i) = cam_in%wsy(i)/rho_ds_zm(i,1) ! Surface zonal momentum flux + end do + endif + + if (k .ne. 1) then pre_in(k) = prer_evap(i,pverp-k+1) @@ -4338,43 +4010,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rrho(i), ustar ) end if ======= - ! Define ustar (based on case, if not variable) - ustar = 0.25_r8 ! Initialize ustar in case no case - - if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then - ustar = 0.30_r8 - endif - - if(trim(scm_clubb_iop_name) == 'RICO_3day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & - trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then >>>>>>> ESCOMP/cam_development - - bflx22(1) = (gravit/theta0)*wpthlp_sfc(1) - ustar = diag_ustar(zt_g(1,2),bflx22(1),ubar,zo(1)) - endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation - upwp_sfc(1) = -um(1,pver)*ustar**2/ubar - vpwp_sfc(1) = -vm(1,pver)*ustar**2/ubar - - end if - - ! Define surface sources for transported variables for diffusion, will - ! be zero as these tendencies are done in vertical_diffusion - do ixind=1,edsclr_dim - do i=1,ncol - wpedsclrp_sfc(i,ixind) = 0._r8 - end do - end do <<<<<<< HEAD !+++ARH @@ -4882,32 +4518,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end if !---ARH ======= - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - stats_nsamp = nint(stats_tsamp/dtime) - stats_nout = nint(stats_tout/dtime) - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_api( nlev+1, ncol, sfc_elevation, l_implemented, & ! intent(in) - grid_type, zi_g(:,2), zi_g(:,1), zi_g(:,nlev+1), & ! intent(in) - zi_g, zt_g, & ! intent(in) - gr, begin_height, end_height ) ! intent(out) - - call setup_parameters_api( zi_g(:,2), clubb_params, nlev+1, ncol, grid_type, & ! intent(in) - zi_g, zt_g, & ! intent(in) - clubb_config_flags%l_prescribed_avg_deltaz, & ! intent(in) - lmin, nu_vert_res_dep, err_code ) ! intent(out) - if ( err_code == clubb_fatal_error ) then - call endrun(subr//': Fatal error in CLUBB setup_parameters') - end if >>>>>>> ESCOMP/cam_development @@ -4918,37 +4528,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do !---ARH ======= - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing(:,:) = 0._r8 - rtm_forcing(:,:) = 0._r8 - um_forcing(:,:) = 0._r8 - vm_forcing(:,:) = 0._r8 >>>>>>> ESCOMP/cam_development - - rtm_ref(:,:) = 0.0_r8 - thlm_ref(:,:) = 0.0_r8 - um_ref(:,:) = 0.0_r8 - vm_ref(:,:) = 0.0_r8 - ug(:,:) = 0.0_r8 - vg(:,:) = 0.0_r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtp2_mc_zt(1:ncol,:) ) - thlp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, thlp2_mc_zt(1:ncol,:) ) - wprtp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wprtp_mc_zt(1:ncol,:) ) - wpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wpthlp_mc_zt(1:ncol,:) ) - rtpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtpthlp_mc_zt(1:ncol,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(:,:) = 0.0_r8 - thlp2_mc_zt(:,:) = 0.0_r8 - wprtp_mc_zt(:,:) = 0.0_r8 - wpthlp_mc_zt(:,:) = 0.0_r8 - rtpthlp_mc_zt(:,:) = 0.0_r8 - - <<<<<<< HEAD ! update turbulent moments based on rain evaporation rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime @@ -5068,41 +4649,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! Arrays need to be "flipped" to CAM grid ======= - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_ds_zt ) - rho_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_zt ) - invrs_rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, invrs_rho_ds_zt ) - thv_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt ) - wm_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, wm_zt ) - - ! Surface fluxes provided by host model - do i=1,ncol - wpthlp_sfc(i) = cam_in%shf(i)/(cpairv(i,pver,lchnk)*rho_ds_zm(i,1)) ! Sensible heat flux - wpthlp_sfc(i) = wpthlp_sfc(i)*inv_exner_clubb_surf(i) ! Potential temperature flux - wprtp_sfc(i) = cam_in%cflx(i,1)/rho_ds_zm(i,1) ! Moisture flux - end do - - ! Implementation after Thomas Toniazzo (NorESM) and Colin Zarzycki (PSU) - ! Other Surface fluxes provided by host model - if( (cld_macmic_num_steps > 1) .and. clubb_l_intr_sfc_flux_smooth ) then - ! Adjust surface stresses using winds from the prior macmic iteration - do i=1,ncol - ubar = sqrt(state1%u(i,pver)**2+state1%v(i,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & - rrho(i), ustar ) - - upwp_sfc(i) = -state1%u(i,pver)*ustar**2/ubar - vpwp_sfc(i) = -state1%v(i,pver)*ustar**2/ubar - end do - else - do i=1,ncol - upwp_sfc(i) = cam_in%wsx(i)/rho_ds_zm(i,1) ! Surface meridional momentum flux - vpwp_sfc(i) = cam_in%wsy(i)/rho_ds_zm(i,1) ! Surface zonal momentum flux - end do - endif >>>>>>> ESCOMP/cam_development ! Perturbed winds are not used in CAM From 60fd22096b68fc111c6b2d90dcd73356f1300d15 Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Tue, 27 Jun 2023 21:05:59 -0600 Subject: [PATCH 153/466] more conflict resolution --- src/physics/cam/clubb_intr.F90 | 32 --------------------------- src/physics/rrtmg/cloud_rad_props.F90 | 12 ++-------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 9899c72a08..d49f80a52b 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -5872,7 +5872,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & enddo enddo -<<<<<<< HEAD rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) @@ -5884,20 +5883,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) end if - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! -======= ! --------------------------------------------------------------------------------- ! ! Diagnose some quantities that are computed in macrop_tend here. ! ! These are inputs required for the microphysics calculation. ! ! ! ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! ! --------------------------------------------------------------------------------- ! ->>>>>>> ESCOMP/cam_development ! initialize variables alst(:,:) = 0.0_r8 @@ -5919,7 +5910,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & do k=1,pver-1 do i=1,ncol -<<<<<<< HEAD ! diagnose the deep convective cloud fraction, as done in macrophysics based on the ! deep convective mass flux, read in from pbuf. Since shallow convection is never ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud @@ -5944,24 +5934,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud ! from CLUBB plus the deep convective cloud fraction concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) -======= - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(dp1*log(1.0_r8+dp2*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = 0._r8 - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) ->>>>>>> ESCOMP/cam_development enddo enddo @@ -6037,11 +6009,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! be outputting the shallow convective cloud fraction do k=1,pver do i=1,ncol -<<<<<<< HEAD cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) -======= - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) ->>>>>>> ESCOMP/cam_development enddo enddo diff --git a/src/physics/rrtmg/cloud_rad_props.F90 b/src/physics/rrtmg/cloud_rad_props.F90 index 264887e444..07e183e241 100644 --- a/src/physics/rrtmg/cloud_rad_props.F90 +++ b/src/physics/rrtmg/cloud_rad_props.F90 @@ -6,7 +6,7 @@ module cloud_rad_props use shr_kind_mod, only: r8 => shr_kind_r8 use ppgrid, only: pcols, pver, pverp use physics_types, only: physics_state -use physics_buffer, only: physics_buffer_desc, pbuf_set_field, pbuf_get_index, pbuf_get_field, & +use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, & pbuf_old_tim_idx use radconstants, only: nswbands, nlwbands, idx_sw_diag, ot_length, idx_lw_diag use cam_abortutils, only: endrun @@ -75,7 +75,7 @@ module cloud_rad_props contains !============================================================================== -subroutine cloud_rad_props_init(pbuf2d) +subroutine cloud_rad_props_init() use netcdf use spmd_utils, only: masterproc @@ -88,8 +88,6 @@ subroutine cloud_rad_props_init(pbuf2d) use slingo, only: slingo_rad_props_init use ebert_curry, only: ec_rad_props_init, scalefactor - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - character(len=256) :: liquidfile character(len=256) :: icefile character(len=256) :: locfn @@ -123,12 +121,6 @@ subroutine cloud_rad_props_init(pbuf2d) i_icgrauwp = pbuf_get_index('ICGRAUWP',errcode=err) ! Available when using MG3 i_degrau = pbuf_get_index('DEGRAU',errcode=err) ! Available when using MG3 - call pbuf_set_field(pbuf2d, i_dei, 0.0_r8) - call pbuf_set_field(pbuf2d, i_des, 0.0_r8) - if (i_degrau > 0) then - call pbuf_set_field(pbuf2d, i_degrau, 0.0_r8) - end if - ! old optics call cnst_get_ind('CLDICE', ixcldice) call cnst_get_ind('CLDLIQ', ixcldliq) From 026bdb750c36227a3ade6f3e94be2a8b58709600 Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Wed, 28 Jun 2023 12:38:50 -0600 Subject: [PATCH 154/466] More conflict resolution --- src/physics/cam/clubb_intr.F90 | 1258 ++++++++++++-------------------- 1 file changed, 479 insertions(+), 779 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d49f80a52b..7738fa4031 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -3956,63 +3956,221 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do endif + ! Perturbed winds are not used in CAM + upwp_sfc_pert = 0.0_r8 + vpwp_sfc_pert = 0.0_r8 + ! Need to flip arrays around for CLUBB core + do k=1,nlev+1 + do i=1,ncol + um_in(i,k) = um(i,pverp-k+1) + vm_in(i,k) = vm(i,pverp-k+1) + upwp_in(i,k) = upwp(i,pverp-k+1) + vpwp_in(i,k) = vpwp(i,pverp-k+1) + wpthvp_in(i,k) = wpthvp(i,pverp-k+1) + wp2thvp_in(i,k) = wp2thvp(i,pverp-k+1) + rtpthvp_in(i,k) = rtpthvp(i,pverp-k+1) + thlpthvp_in(i,k)= thlpthvp(i,pverp-k+1) + up2_in(i,k) = up2(i,pverp-k+1) + vp2_in(i,k) = vp2(i,pverp-k+1) + up3_in(i,k) = up3(i,pverp-k+1) + vp3_in(i,k) = vp3(i,pverp-k+1) + wp2_in(i,k) = wp2(i,pverp-k+1) + wp3_in(i,k) = wp3(i,pverp-k+1) + rtp2_in(i,k) = rtp2(i,pverp-k+1) + thlp2_in(i,k) = thlp2(i,pverp-k+1) + rtp3_in(i,k) = rtp3(i,pverp-k+1) + thlp3_in(i,k) = thlp3(i,pverp-k+1) + thlm_in(i,k) = thlm(i,pverp-k+1) + rtm_in(i,k) = rtm(i,pverp-k+1) + rvm_in(i,k) = rvm(i,pverp-k+1) + wprtp_in(i,k) = wprtp(i,pverp-k+1) + wpthlp_in(i,k) = wpthlp(i,pverp-k+1) + rtpthlp_in(i,k) = rtpthlp(i,pverp-k+1) + cloud_frac_inout(i,k) = cloud_frac(i,pverp-k+1) + if (k>1) then + rcm_inout(i,k) = state1%q(i,pverp-k+1,ixcldliq) + end if - if (k .ne. 1) then - pre_in(k) = prer_evap(i,pverp-k+1) - endif + ! We only need to copy pdf_params from pbuf if this is a restart and + ! we're calling pdf_closure at the end of advance_clubb_core + if ( is_first_restart_step() & + .and. clubb_config_flags%ipdf_call_placement .eq. ipdf_post_advance_fields ) then + pdf_params_zm_chnk(lchnk)%w_1(i,k) = pdf_zm_w_1(i,pverp-k+1) + pdf_params_zm_chnk(lchnk)%w_2(i,k) = pdf_zm_w_2(i,pverp-k+1) + pdf_params_zm_chnk(lchnk)%varnce_w_1(i,k) = pdf_zm_varnce_w_1(i,pverp-k+1) + pdf_params_zm_chnk(lchnk)%varnce_w_2(i,k) = pdf_zm_varnce_w_2(i,pverp-k+1) + pdf_params_zm_chnk(lchnk)%mixt_frac(i,k) = pdf_zm_mixt_frac(i,pverp-k+1) + end if - ! Initialize these to prevent crashing behavior - wprcp_out(k) = 0._r8 - rcm_in_layer_out(k) = 0._r8 - cloud_cover_out(k) = 0._r8 - edsclr_in(k,:) = 0._r8 - khzm_out(k) = 0._r8 - khzt_out(k) = 0._r8 - - ! higher order scalar stuff, put to zero - sclrm(k,:) = 0._r8 - wpsclrp(k,:) = 0._r8 - sclrp2(k,:) = 0._r8 - sclrp3(k,:) = 0._r8 - sclrprtp(k,:) = 0._r8 - sclrpthlp(k,:) = 0._r8 - wpsclrp_sfc(:) = 0._r8 - hydromet(k,:) = 0._r8 - wphydrometp(k,:) = 0._r8 - wp2hmp(k,:) = 0._r8 - rtphmp_zt(k,:) = 0._r8 - thlphmp_zt(k,:) = 0._r8 - - enddo - pre_in(1) = pre_in(2) + sclrpthvp_inout(i,k,:) = 0._r8 + wp2rtp_inout(i,k) = wp2rtp(i,pverp-k+1) + wp2thlp_inout(i,k) = wp2thlp(i,pverp-k+1) + uprcp_inout(i,k) = uprcp(i,pverp-k+1) + vprcp_inout(i,k) = vprcp(i,pverp-k+1) + rc_coef_inout(i,k) = rc_coef(i,pverp-k+1) + wp4_inout(i,k) = wp4(i,pverp-k+1) + wpup2_inout(i,k) = wpup2(i,pverp-k+1) + wpvp2_inout(i,k) = wpvp2(i,pverp-k+1) + wp2up2_inout(i,k) = wp2up2(i,pverp-k+1) + wp2vp2_inout(i,k) = wp2vp2(i,pverp-k+1) + ice_supersat_frac_inout(i,k) = ice_supersat_frac(i,pverp-k+1) + end do + end do - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - do k=1,pver - kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) - enddo - kappa_zt(1) = kappa_zt(2) - qc_zt(1) = qc_zt(2) - invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) - do k=1,pverp - p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) - enddo + ! Perturbed winds are not used in CAM + um_pert_inout = 0.0_r8 + vm_pert_inout = 0.0_r8 + upwp_pert_inout = 0.0_r8 + vpwp_pert_inout = 0.0_r8 + + do k=2,nlev+1 + do i=1,ncol + pre_in(i,k) = prer_evap(i,pverp-k+1) + end do + end do + + do i=1,ncol + pre_in(i,1) = pre_in(i,2) + end do + + do i=1,ncol + rcm_inout(i,1) = rcm_inout(i,2) + end do + + ! Initialize these to prevent crashing behavior + do k=1,nlev+1 + do i=1,ncol + wprcp_out(i,k) = 0._r8 + rcm_in_layer_out(i,k) = 0._r8 + cloud_cover_out(i,k) = 0._r8 + edsclr_in(i,k,:) = 0._r8 + khzm_out(i,k) = 0._r8 + khzt_out(i,k) = 0._r8 + end do + end do + + ! higher order scalar stuff, put to zero + do ixind=1, sclr_dim + do k=1, nlev+1 + do i=1, ncol + sclrm(i,k,ixind) = 0._r8 + wpsclrp(i,k,ixind) = 0._r8 + sclrp2(i,k,ixind) = 0._r8 + sclrp3(i,k,ixind) = 0._r8 + sclrprtp(i,k,ixind) = 0._r8 + sclrpthlp(i,k,ixind) = 0._r8 + wpsclrp_sfc(i,ixind) = 0._r8 + end do + end do + end do + + do ixind=1, hydromet_dim + do k=1, nlev+1 + do i=1, ncol + hydromet(i,k,ixind) = 0._r8 + wphydrometp(i,k,ixind) = 0._r8 + wp2hmp(i,k,ixind) = 0._r8 + rtphmp_zt(i,k,ixind) = 0._r8 + thlphmp_zt(i,k,ixind) = 0._r8 + end do + end do + end do + + ! pressure,exner on momentum grid needed for mass flux calc. + if (do_clubb_mf) then + + do k=1,pver + do i=1,ncol + kappa_zt(i,k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) + qc_zt(i,k+1) = state1%q(i,pver-k+1,ixcldliq) + invrs_exner_zt(i,k+1) = inv_exner_clubb(i,pver-k+1) + end do + end do + + do i=1,ncol + kappa_zt(i,1) = kappa_zt(i,2) + qc_zt(i,1) = qc_zt(i,2) + invrs_exner_zt(i,1) = invrs_exner_zt(i,2) + end do + + kappa_zm(1:ncol,:) = zt2zm_api(pverp+1-top_lev, ncol, gr, kappa_zt(1:ncol,:)) + + do k=1,pverp + do i=1,ncol + p_in_Pa_zm(i,k) = state1%pint(i,pverp-k+1) + invrs_exner_zm(i,k) = 1._r8/((p_in_Pa_zm(i,k)/p0_clubb)**(kappa_zm(i,k))) + end do + end do + + th_sfc = cam_in%ts(i)*invrs_exner_zm(1) + + call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & + rrho(i), ustar ) + + end if + + if (clubb_do_adv) then + if (macmic_it == 1) then + + wp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wp2_in ) + wpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wpthlp_in ) + wprtp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wprtp_in ) + up2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, up2_in ) + vp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, vp2_in ) + thlp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, thlp2_in ) + rtp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtp2_in ) + rtpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtpthlp_in ) + + do k=1,nlev+1 + do i=1,ncol + thlp2_in(i,k) = max(thl_tol**2,thlp2_in(i,k)) + rtp2_in(i,k) = max(rt_tol**2,rtp2_in(i,k)) + wp2_in(i,k) = max(w_tol_sqd,wp2_in(i,k)) + up2_in(i,k) = max(w_tol_sqd,up2_in(i,k)) + vp2_in(i,k) = max(w_tol_sqd,vp2_in(i,k)) + end do + end do + + end if + end if + + ! Do the same for tracers + icnt=0 + do ixind=1,pcnst + if (lq(ixind)) then + + icnt = icnt+1 + + do k=1,nlev + do i=1,ncol + edsclr_in(i,k+1,icnt) = state1%q(i,pver-k+1,ixind) + end do + end do - th_sfc = cam_in%ts(i)*invrs_exner_zm(1) + do i=1,ncol + edsclr_in(i,1,icnt) = edsclr_in(i,2,icnt) + end do - call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & - rrho(i), ustar ) end if -======= ->>>>>>> ESCOMP/cam_development + end do + + + if (clubb_l_do_expldiff_rtm_thlm) then + do k=1,nlev + do i=1, ncol + edsclr_in(i,k+1,icnt+1) = thlm(i,pver-k+1) + edsclr_in(i,k+1,icnt+2) = rtm(i,pver-k+1) + end do + end do + + do i=1, ncol + edsclr_in(i,1,icnt+1) = edsclr_in(i,2,icnt+1) + edsclr_in(i,1,icnt+2) = edsclr_in(i,2,icnt+2) + end do + + endif -<<<<<<< HEAD !+++ARH if (macmic_it==1) thlm_macmic1(i,:) = 0._r8 if (macmic_it==1) thlm_macmic2(i,:) = 0._r8 @@ -4110,16 +4268,22 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & !####################################################################### if (do_clubb_mf) then - do k=2,pverp - dzt(k) = zi_g(k) - zi_g(k-1) - dzm(k-1) = zt_g(k) - zt_g(k-1) - enddo - dzt(1) = dzt(2) - dzm(pverp) = dzm(pver) - invrs_dzt = 1._r8/dzt - - rtm_zm_in = zt2zm_api( rtm_in ) - thlm_zm_in = zt2zm_api( thlm_in ) + + do k=2,pverp + do i=1, ncol + dzt(i,k) = zi_g(i,k) - zi_g(i,k-1) + end do + end do + + do i=1, ncol + dzt(i,1) = dzt(i,2) + invrs_dzt(i,:) = 1._r8/dzt(i,:) + end do + + rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) + thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) + + ! BAS update these (and all zt2zm_api etc) th_zm = zt2zm_api( th_zt ) qv_zm = zt2zm_api( qv_zt ) qc_zm = zt2zm_api( qc_zt ) @@ -4141,6 +4305,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 if (rhlev(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) + ! BAS need to do loop over ncol? call integrate_mf( pverp, & ! input rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input @@ -4216,7 +4381,27 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*mf_sqt(k) end do + + + ! pass MF turbulent advection term as CLUBB explicit forcing term +! do i=1, ncol +! rtm_forcing(i,1) = 0._r8 +! thlm_forcing(i,1)= 0._r8 +! end do +! +! do k=2,pverp +! do i=1, ncol +! rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & +! ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) +! +! thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & +! ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) +! end do +! end do + + ! pass MF turbulent advection term as CLUBB explicit forcing term + ! BAS loop over ncol (see above) rtm_forcing = 0._r8 thlm_forcing = 0._r8 mf_qtforcup = 0._r8 @@ -4224,6 +4409,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_qtforcdn = 0._r8 mf_thlforcdn = 0._r8 + ! BAS loop over ncol do k=2,pverp rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & @@ -4466,614 +4652,58 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & dqt_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcup(k) - end do - dthlu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcup(k) - end do - dqtu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcdn(k) - end do - dthld_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcdn(k) - end do - dqtd_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - end if -!---ARH - - end if !clubbmf - -!+++ARH - if (t==1) then - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - else if (t==2) then - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - end if -!---ARH -======= ->>>>>>> ESCOMP/cam_development - - -<<<<<<< HEAD -!+++ARH ! clip negative water - do k=1,pverp - if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) - end do -!---ARH -======= ->>>>>>> ESCOMP/cam_development - -<<<<<<< HEAD - ! update turbulent moments based on rain evaporation - rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime - wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime - wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(rcm_inout) - qrl_zm = zt2zm_api(qrl_clubb) - thlp2_rad_out(:) = 0._r8 - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) - thlp2_in = thlp2_in + thlp2_rad_out * dtime - thlp2_in = max(thl_tol**2,thlp2_in) - endif - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& - out_radzt,out_radzm,out_sfc) - - enddo ! end time loop - - if (do_clubb_mf) then - ! average over nadv - mf_L0_nadv = mf_L0_nadv/REAL(nadv) - mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) - mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) - mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) - mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) - mf_freq_nadv = mf_freq_nadv/REAL(nadv) - - ! accumulate in buffer - ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv - ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv - cbm1_macmic(i) = cbm1_macmic(i) + mf_cbm1_nadv - - if (macmic_it == cld_macmic_num_steps) then - - cbm1(i) = cbm1_macmic(i)/REAL(cld_macmic_num_steps) - - if (clubb_mf_up_ndt == 1) then - ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - else - ztopmn(2:clubb_mf_up_ndt,i) = ztopmn(1:clubb_mf_up_ndt-1,i) - ztopmn(1,i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - ztopma(i) = 0._r8 - do t=1,clubb_mf_up_ndt - ztopma(i) = ztopma(i) + ztopmn(t,i) - end do - ztopma(i) = ztopma(i)/REAL(clubb_mf_up_ndt) - end if - - if (clubb_mf_cp_ndt == 1) then - ddcp(i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - else - ddcpmn(2:clubb_mf_cp_ndt,i) = ddcpmn(1:clubb_mf_cp_ndt-1,i) - ddcpmn(1,i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - ddcp(i) = 0._r8 - do t=1,clubb_mf_cp_ndt - ddcp(i) = ddcp(i) + ddcpmn(t,i) - end do - ddcp(i) = ddcp(i)/REAL(clubb_mf_cp_ndt) - end if - - ddcp(i) = clubb_mf_ddalph*ddcp(i) - - end if - - mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) - mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) - mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) - prec_sh(i) = mf_precc_nadv/REAL(nadv) - snow_sh(i) = mf_snow_nadv/REAL(nadv) - - mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp)/REAL(nadv) - mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp)/REAL(nadv) - mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp)/REAL(nadv) - mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp)/REAL(nadv) - mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) - mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) - - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp)/REAL(nadv) - end if - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) - wpthlp_in=zm2zt_api(wpthlp_in) - wprtp_in=zm2zt_api(wprtp_in) - up2_in=zm2zt_api(up2_in) - vp2_in=zm2zt_api(vp2_in) - thlp2_in=zm2zt_api(thlp2_in) - rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api(rtp2_in) - thl2_zt = zm2zt_api(thlp2_in) - wp2_zt = zm2zt_api(wp2_in) - - ! Need moist_qc and cloudfrac on thermo grid for output - mf_qc_zt = zm2zt_api(mf_qc) - mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) - - ! Arrays need to be "flipped" to CAM grid -======= ->>>>>>> ESCOMP/cam_development - - ! Perturbed winds are not used in CAM - upwp_sfc_pert = 0.0_r8 - vpwp_sfc_pert = 0.0_r8 - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - do i=1,ncol - um_in(i,k) = um(i,pverp-k+1) - vm_in(i,k) = vm(i,pverp-k+1) - upwp_in(i,k) = upwp(i,pverp-k+1) - vpwp_in(i,k) = vpwp(i,pverp-k+1) - wpthvp_in(i,k) = wpthvp(i,pverp-k+1) - wp2thvp_in(i,k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(i,k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(i,k)= thlpthvp(i,pverp-k+1) - up2_in(i,k) = up2(i,pverp-k+1) - vp2_in(i,k) = vp2(i,pverp-k+1) - up3_in(i,k) = up3(i,pverp-k+1) - vp3_in(i,k) = vp3(i,pverp-k+1) - wp2_in(i,k) = wp2(i,pverp-k+1) - wp3_in(i,k) = wp3(i,pverp-k+1) - rtp2_in(i,k) = rtp2(i,pverp-k+1) - thlp2_in(i,k) = thlp2(i,pverp-k+1) - rtp3_in(i,k) = rtp3(i,pverp-k+1) - thlp3_in(i,k) = thlp3(i,pverp-k+1) - thlm_in(i,k) = thlm(i,pverp-k+1) - rtm_in(i,k) = rtm(i,pverp-k+1) - rvm_in(i,k) = rvm(i,pverp-k+1) - wprtp_in(i,k) = wprtp(i,pverp-k+1) - wpthlp_in(i,k) = wpthlp(i,pverp-k+1) - rtpthlp_in(i,k) = rtpthlp(i,pverp-k+1) - cloud_frac_inout(i,k) = cloud_frac(i,pverp-k+1) - if (k>1) then - rcm_inout(i,k) = state1%q(i,pverp-k+1,ixcldliq) - end if - -<<<<<<< HEAD - if (do_clubb_mf) then - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - - s_awthlup_output(i,pverp-k+1) = s_awthlup(k) - s_awqtup_output(i,pverp-k+1) = s_awqtup(k) - s_awthldn_output(i,pverp-k+1) = s_awthldn(k) - s_awqtdn_output(i,pverp-k+1) = s_awqtdn(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - - s_awuup_output(i,pverp-k+1) = s_awuup(k) - s_awvup_output(i,pverp-k+1) = s_awvup(k) - s_awudn_output(i,pverp-k+1) = s_awudn(k) - s_awvdn_output(i,pverp-k+1) = s_awvdn(k) - - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - s_aww_output(i,pverp-k+1) = s_aww(k) - - mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) - mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) - mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) - mf_qtflxdn_output(i,pverp-k+1) = mf_qtflxdn(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) - - mf_uflxup_output(i,pverp-k+1) = mf_uflxup(k) - mf_vflxup_output(i,pverp-k+1) = mf_vflxup(k) - mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(k) - mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(k) - mf_uflx_output(i,pverp-k+1) = mf_uflx(k) - mf_vflx_output(i,pverp-k+1) = mf_vflx(k) - - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) - - if (k.ne.1) then - mf_thlforcup_output(i,pverp-k+1) = mf_thlforcup_nadv(k) - mf_qtforcup_output(i,pverp-k+1) = mf_qtforcup_nadv(k) - mf_thlforcdn_output(i,pverp-k+1) = mf_thlforcdn_nadv(k) - mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(k) - mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) - mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) - mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) - mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) - - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) - mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) - mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) - end if - - mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(k,:clubb_mf_nup) - mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) - mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) - mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) - mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) - mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) - mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) - mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) - end if -======= - ! We only need to copy pdf_params from pbuf if this is a restart and - ! we're calling pdf_closure at the end of advance_clubb_core - if ( is_first_restart_step() & - .and. clubb_config_flags%ipdf_call_placement .eq. ipdf_post_advance_fields ) then - pdf_params_zm_chnk(lchnk)%w_1(i,k) = pdf_zm_w_1(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%w_2(i,k) = pdf_zm_w_2(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%varnce_w_1(i,k) = pdf_zm_varnce_w_1(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%varnce_w_2(i,k) = pdf_zm_varnce_w_2(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%mixt_frac(i,k) = pdf_zm_mixt_frac(i,pverp-k+1) - end if ->>>>>>> ESCOMP/cam_development - - sclrpthvp_inout(i,k,:) = 0._r8 - wp2rtp_inout(i,k) = wp2rtp(i,pverp-k+1) - wp2thlp_inout(i,k) = wp2thlp(i,pverp-k+1) - uprcp_inout(i,k) = uprcp(i,pverp-k+1) - vprcp_inout(i,k) = vprcp(i,pverp-k+1) - rc_coef_inout(i,k) = rc_coef(i,pverp-k+1) - wp4_inout(i,k) = wp4(i,pverp-k+1) - wpup2_inout(i,k) = wpup2(i,pverp-k+1) - wpvp2_inout(i,k) = wpvp2(i,pverp-k+1) - wp2up2_inout(i,k) = wp2up2(i,pverp-k+1) - wp2vp2_inout(i,k) = wp2vp2(i,pverp-k+1) - ice_supersat_frac_inout(i,k) = ice_supersat_frac(i,pverp-k+1) - end do - end do - -<<<<<<< HEAD - if (do_clubb_mf) then -!+++ARH - ! these fillvalues won't average correctly - !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue - !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue - - !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv - mf_ztop_output(i) = mf_ztop_nadv - - mf_L0_output(i) = mf_L0_nadv - mf_cfl_output(i) = max_cfl_nadv - - !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) - mf_ddcp_output(i) = mf_ddcp_nadv - - mf_freq_output(i) = mf_freq_nadv -!---ARH - do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) - mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) - mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) - mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) - mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) - end do - end if - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - upwp(i,:top_lev-1) = 0._r8 - vpwp(i,:top_lev-1) = 0._r8 - rcm(i,:top_lev-1) = 0._r8 - wprcp(i,:top_lev-1) = 0._r8 - cloud_frac(i,:top_lev-1) = 0._r8 - rcm_in_layer(i,:top_lev-1) = 0._r8 - zt_out(i,:top_lev-1) = 0._r8 - zi_out(i,:top_lev-1) = 0._r8 - khzm(i,:top_lev-1) = 0._r8 - qclvar(i,:top_lev-1) = 2._r8 - - - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end if - enddo -======= - ! Perturbed winds are not used in CAM - um_pert_inout = 0.0_r8 - vm_pert_inout = 0.0_r8 - upwp_pert_inout = 0.0_r8 - vpwp_pert_inout = 0.0_r8 - - do k=2,nlev+1 - do i=1,ncol - pre_in(i,k) = prer_evap(i,pverp-k+1) - end do - end do - - do i=1,ncol - pre_in(i,1) = pre_in(i,2) - end do ->>>>>>> ESCOMP/cam_development - - do i=1,ncol - rcm_inout(i,1) = rcm_inout(i,2) - end do - - ! Initialize these to prevent crashing behavior - do k=1,nlev+1 - do i=1,ncol - wprcp_out(i,k) = 0._r8 - rcm_in_layer_out(i,k) = 0._r8 - cloud_cover_out(i,k) = 0._r8 - edsclr_in(i,k,:) = 0._r8 - khzm_out(i,k) = 0._r8 - khzt_out(i,k) = 0._r8 - end do - end do - - ! higher order scalar stuff, put to zero - do ixind=1, sclr_dim - do k=1, nlev+1 - do i=1, ncol - sclrm(i,k,ixind) = 0._r8 - wpsclrp(i,k,ixind) = 0._r8 - sclrp2(i,k,ixind) = 0._r8 - sclrp3(i,k,ixind) = 0._r8 - sclrprtp(i,k,ixind) = 0._r8 - sclrpthlp(i,k,ixind) = 0._r8 - wpsclrp_sfc(i,ixind) = 0._r8 - end do - end do - end do - - do ixind=1, hydromet_dim - do k=1, nlev+1 - do i=1, ncol - hydromet(i,k,ixind) = 0._r8 - wphydrometp(i,k,ixind) = 0._r8 - wp2hmp(i,k,ixind) = 0._r8 - rtphmp_zt(i,k,ixind) = 0._r8 - thlphmp_zt(i,k,ixind) = 0._r8 - end do - end do - end do - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - - do k=1,pver - do i=1,ncol - kappa_zt(i,k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(i,k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(i,k+1) = inv_exner_clubb(i,pver-k+1) - end do - end do - - do i=1,ncol - kappa_zt(i,1) = kappa_zt(i,2) - qc_zt(i,1) = qc_zt(i,2) - invrs_exner_zt(i,1) = invrs_exner_zt(i,2) - end do + lilflip(pverp-k+1) = mf_thlforcup(k) + end do + dthlu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - kappa_zm(1:ncol,:) = zt2zm_api(pverp+1-top_lev, ncol, gr, kappa_zt(1:ncol,:)) - - do k=1,pverp - do i=1,ncol - p_in_Pa_zm(i,k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(i,k) = 1._r8/((p_in_Pa_zm(i,k)/p0_clubb)**(kappa_zm(i,k))) - end do - end do - - end if - - - if (clubb_do_adv) then - if (macmic_it == 1) then - - wp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wp2_in ) - wpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wpthlp_in ) - wprtp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wprtp_in ) - up2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, up2_in ) - vp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, vp2_in ) - thlp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, thlp2_in ) - rtp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtp2_in ) - rtpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtpthlp_in ) + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcup(k) + end do + dqtu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - do k=1,nlev+1 - do i=1,ncol - thlp2_in(i,k) = max(thl_tol**2,thlp2_in(i,k)) - rtp2_in(i,k) = max(rt_tol**2,rtp2_in(i,k)) - wp2_in(i,k) = max(w_tol_sqd,wp2_in(i,k)) - up2_in(i,k) = max(w_tol_sqd,up2_in(i,k)) - vp2_in(i,k) = max(w_tol_sqd,vp2_in(i,k)) - end do - end do - - end if - end if + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_thlforcdn(k) + end do + dthld_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - ! Do the same for tracers - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - - icnt = icnt+1 - - do k=1,nlev - do i=1,ncol - edsclr_in(i,k+1,icnt) = state1%q(i,pver-k+1,ixind) - end do - end do - - do i=1,ncol - edsclr_in(i,1,icnt) = edsclr_in(i,2,icnt) - end do - - end if - end do + do k=1,nlev+1 + lilflip(pverp-k+1) = mf_qtforcdn(k) + end do + dqtd_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - if (clubb_l_do_expldiff_rtm_thlm) then - do k=1,nlev - do i=1, ncol - edsclr_in(i,k+1,icnt+1) = thlm(i,pver-k+1) - edsclr_in(i,k+1,icnt+2) = rtm(i,pver-k+1) - end do - end do - - do i=1, ncol - edsclr_in(i,1,icnt+1) = edsclr_in(i,2,icnt+1) - edsclr_in(i,1,icnt+2) = edsclr_in(i,2,icnt+2) - end do - - endif + end if +!---ARH + end if !clubbmf - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif +!+++ARH + if (t==1) then - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - do i=1, ncol - dzt(i,k) = zi_g(i,k) - zi_g(i,k-1) - end do - end do - - do i=1, ncol - dzt(i,1) = dzt(i,2) - invrs_dzt(i,:) = 1._r8/dzt(i,:) - end do - - rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) - thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_in(k) + end do + thlm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - do i=1, ncol - call integrate_mf( pverp, dzt(i,:), zi_g(i,:), p_in_Pa_zm(i,:), invrs_exner_zm(i,:), & ! input - p_in_Pa(i,:), invrs_exner_zt(i,:), & ! input - um_in(i,:), vm_in(i,:), thlm_in(i,:), rtm_in(i,:), thv(i,:), & ! input - thlm_zm_in(i,:), rtm_zm_in(i,:), & ! input - wpthlp_sfc(i), wprtp_sfc(i), pblh(i), & ! input - mf_dry_a(i,:), mf_moist_a(i,:), & ! output - plume diagnostics - mf_dry_w(i,:), mf_moist_w(i,:), & ! output - plume diagnostics - mf_dry_qt(i,:), mf_moist_qt(i,:), & ! output - plume diagnostics - mf_dry_thl(i,:), mf_moist_thl(i,:), & ! output - plume diagnostics - mf_dry_u(i,:), mf_moist_u(i,:), & ! output - plume diagnostics - mf_dry_v(i,:), mf_moist_v(i,:), & ! output - plume diagnostics - mf_moist_qc(i,:), & ! output - plume diagnostics - s_ae(i,:), s_aw(i,:), & ! output - plume diagnostics - s_awthl(i,:), s_awqt(i,:), & ! output - plume diagnostics - s_awql(i,:), s_awqi(i,:), & ! output - plume diagnostics - s_awu(i,:), s_awv(i,:), & ! output - plume diagnostics - mf_thlflx(i,:), mf_qtflx(i,:) ) ! output - variables needed for solver - end do + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_in(k) + end do + qtm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - ! pass MF turbulent advection term as CLUBB explicit forcing term - do i=1, ncol - rtm_forcing(i,1) = 0._r8 - thlm_forcing(i,1)= 0._r8 - end do - - do k=2,pverp - do i=1, ncol - rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) - - thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) - end do - end do + else if (t==2) then + + do k=1,nlev+1 + lilflip(pverp-k+1) = thlm_in(k) + end do + thlm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + do k=1,nlev+1 + lilflip(pverp-k+1) = rtm_in(k) + end do + qtm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + + end if +!---ARH - end if - ! Advance CLUBB CORE one timestep in the future call advance_clubb_core_api( gr, pverp+1-top_lev, ncol, & l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & @@ -5124,6 +4754,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & write(fstderr,*) "LON: Range:", state1%lon(1), " -- ", state1%lon(ncol) call endrun(subr//': Fatal error in CLUBB library') end if + +!+++ARH ! clip negative water + do k=1,pverp + if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) + end do +!---ARH if (do_rainturb) then @@ -5154,7 +4790,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end if - if (do_cldcool) then rcm_out_zm = zt2zm_api(pverp+1-top_lev, ncol, gr, rcm_inout ) @@ -5184,6 +4819,68 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & enddo ! end time loop + if (do_clubb_mf) then + ! average over nadv + mf_L0_nadv = mf_L0_nadv/REAL(nadv) + mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) + mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) + mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) + mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) + mf_freq_nadv = mf_freq_nadv/REAL(nadv) + + ! accumulate in buffer + ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv + ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv + cbm1_macmic(i) = cbm1_macmic(i) + mf_cbm1_nadv + + if (macmic_it == cld_macmic_num_steps) then + + cbm1(i) = cbm1_macmic(i)/REAL(cld_macmic_num_steps) + + if (clubb_mf_up_ndt == 1) then + ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) + else + ztopmn(2:clubb_mf_up_ndt,i) = ztopmn(1:clubb_mf_up_ndt-1,i) + ztopmn(1,i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) + ztopma(i) = 0._r8 + do t=1,clubb_mf_up_ndt + ztopma(i) = ztopma(i) + ztopmn(t,i) + end do + ztopma(i) = ztopma(i)/REAL(clubb_mf_up_ndt) + end if + + if (clubb_mf_cp_ndt == 1) then + ddcp(i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) + else + ddcpmn(2:clubb_mf_cp_ndt,i) = ddcpmn(1:clubb_mf_cp_ndt-1,i) + ddcpmn(1,i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) + ddcp(i) = 0._r8 + do t=1,clubb_mf_cp_ndt + ddcp(i) = ddcp(i) + ddcpmn(t,i) + end do + ddcp(i) = ddcp(i)/REAL(clubb_mf_cp_ndt) + end if + + ddcp(i) = clubb_mf_ddalph*ddcp(i) + + end if + + mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) + mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) + mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) + prec_sh(i) = mf_precc_nadv/REAL(nadv) + snow_sh(i) = mf_snow_nadv/REAL(nadv) + + mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp)/REAL(nadv) + mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp)/REAL(nadv) + mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp)/REAL(nadv) + mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp)/REAL(nadv) + mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) + mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) + + mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp)/REAL(nadv) + end if + if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then @@ -5214,6 +4911,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & thl2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, thlp2_in ) wp2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, wp2_in ) + ! Need moist_qc and cloudfrac on thermo grid for output + mf_qc_zt = zm2zt_api(mf_qc) + mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) + ! Arrays need to be "flipped" to CAM grid do k=1, nlev+1 do i=1, ncol @@ -5331,6 +5032,124 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end if + if (do_clubb_mf) then + mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) + mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) + mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) + mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) + mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) + mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) + mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) + mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) + mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) + mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) + mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) + mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) + mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) + + s_ae_output(i,pverp-k+1) = s_ae(k) + s_aw_output(i,pverp-k+1) = s_aw(k) + + s_awthlup_output(i,pverp-k+1) = s_awthlup(k) + s_awqtup_output(i,pverp-k+1) = s_awqtup(k) + s_awthldn_output(i,pverp-k+1) = s_awthldn(k) + s_awqtdn_output(i,pverp-k+1) = s_awqtdn(k) + s_awthl_output(i,pverp-k+1) = s_awthl(k) + s_awqt_output(i,pverp-k+1) = s_awqt(k) + + s_awuup_output(i,pverp-k+1) = s_awuup(k) + s_awvup_output(i,pverp-k+1) = s_awvup(k) + s_awudn_output(i,pverp-k+1) = s_awudn(k) + s_awvdn_output(i,pverp-k+1) = s_awvdn(k) + + s_awu_output(i,pverp-k+1) = s_awu(k) + s_awv_output(i,pverp-k+1) = s_awv(k) + s_aww_output(i,pverp-k+1) = s_aww(k) + + mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) + mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) + mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) + mf_qtflxdn_output(i,pverp-k+1) = mf_qtflxdn(k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) + mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) + + mf_uflxup_output(i,pverp-k+1) = mf_uflxup(k) + mf_vflxup_output(i,pverp-k+1) = mf_vflxup(k) + mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(k) + mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(k) + mf_uflx_output(i,pverp-k+1) = mf_uflx(k) + mf_vflx_output(i,pverp-k+1) = mf_vflx(k) + + mf_rcm_output(i,pverp-k+1) = mf_rcm(k) + mf_precc_output(i,pverp-k+1) = mf_precc(k) + + if (k.ne.1) then + mf_thlforcup_output(i,pverp-k+1) = mf_thlforcup_nadv(k) + mf_qtforcup_output(i,pverp-k+1) = mf_qtforcup_nadv(k) + mf_thlforcdn_output(i,pverp-k+1) = mf_thlforcdn_nadv(k) + mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(k) + mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) + mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) + mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) + mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) + + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) + mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) + mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) + end if + + mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(k,:clubb_mf_nup) + mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) + mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) + mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) + mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) + mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) + mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + end if + + if (do_clubb_mf) then +!+++ARH + ! these fillvalues won't average correctly + !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue + !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue + + !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv + mf_ztop_output(i) = mf_ztop_nadv + + mf_L0_output(i) = mf_L0_nadv + mf_cfl_output(i) = max_cfl_nadv + + !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) + mf_ddcp_output(i) = mf_ddcp_nadv + + mf_freq_output(i) = mf_freq_nadv +!---ARH + do k=1,clubb_mf_nup + mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) + mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) + mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) + mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) + mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) + mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) + mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) + mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) + mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) + mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) + mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) + mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) + end do + end if + ! Values to use above top_lev, for variables that have not already been ! set up there. These are mostly fill values that should not actually be ! used in the run, but may end up in diagnostic output. @@ -5432,7 +5251,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime ! Compute the disbalance of total energy, over depth where CLUBB is active -<<<<<<< HEAD se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) ! Fix the total energy coming out of CLUBB so it achieves enery conservation. @@ -5449,10 +5267,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & endif ! convert to units of +ve [K] se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) -======= - se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop(i))) - end do ->>>>>>> ESCOMP/cam_development ! Fix the total energy coming out of CLUBB so it achieves energy conservation. ! Apply this fixer throughout the column evenly, but only at layers where @@ -5483,15 +5297,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ptend_loc%q(i,k,ixcldliq) = (rcm(i,k) - state1%q(i,k,ixcldliq)) / hdtime ! Tendency of liquid water ptend_loc%s(i,k) = (clubb_s(i,k) - state1%s(i,k)) / hdtime ! Tendency of static energy -<<<<<<< HEAD - ! dte / hdtime = [kg/s2]/[s] = W/m2 - eleak(:ncol) = (te_a(:ncol) - te_b(:ncol))/hdtime - call outfld('ELEAK_CLUBB', eleak, pcols, lchnk) - - call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) -======= end do end do @@ -5541,8 +5346,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end if end if - ->>>>>>> ESCOMP/cam_development ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. ! Loading up this array doesn't mean the tendencies are applied. @@ -5566,11 +5369,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end if end if end do - + call t_stopf("clubb_tend_cam_i_loop") call outfld('KVH_CLUBB', khzm, pcols, lchnk) + ! dte / hdtime = [kg/s2]/[s] = W/m2 eleak(:ncol) = (te_a(:ncol) - te_b(:ncol))/hdtime call outfld('ELEAK_CLUBB', eleak, pcols, lchnk) call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) @@ -5594,22 +5398,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) call outfld( 'RVMTEND_CLUBB', temp2d, pcols, lchnk) -<<<<<<< HEAD - ! Output CLUBB tendencies - call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) - call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) -======= temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldliq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) call outfld( 'RCMTEND_CLUBB', temp2d, pcols, lchnk) temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldice)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) call outfld( 'RIMTEND_CLUBB', temp2d, pcols, lchnk) ->>>>>>> ESCOMP/cam_development call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) @@ -5839,7 +5632,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & do k=1,pverp do i=1,ncol -<<<<<<< HEAD !+++ARH !wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux !wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux @@ -5858,17 +5650,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & !---ARH mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o end if -======= - wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - if (do_clubb_mf) then - mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - end if ->>>>>>> ESCOMP/cam_development enddo enddo @@ -6055,7 +5836,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! ! --------------------------------------------------------------------------------- ! -<<<<<<< HEAD ! Output calls of variables goes here call outfld( 'RELVAR', relvar, pcols, lchnk ) call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) @@ -6107,14 +5887,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call outfld( 'THETAL', thetal_output, pcols, lchnk ) call outfld( 'QT', qt_output, pcols, lchnk ) call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) call outfld( 'CONCLD', concld, pcols, lchnk ) call outfld( 'DP_CLD', deepcu, pcols, lchnk ) call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) @@ -6251,78 +6023,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & !---ARH end if end if -======= - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho(:,1:pver), pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output(:,1:pver), pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - call outfld( 'RTP2_CLUBB', rtp2, pcols, lchnk ) - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - call outfld( 'RCM_CLUBB', rcm(:,1:pver), pcols, lchnk ) - call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) - call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:) * cpair - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'RCMINLAYER_CLUBB', rcm_in_layer(:,1:pver), pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac(:,1:pver), pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um(:,1:pver), pcols, lchnk ) - call outfld( 'VM_CLUBB', vm(:,1:pver), pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - end if ->>>>>>> ESCOMP/cam_development ! Output CLUBB history here if (l_stats) then From 1e6e1dd1f7f844a20e5f94d45b518c9ef01b6fbf Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Wed, 28 Jun 2023 13:23:37 -0600 Subject: [PATCH 155/466] More conflict resolution --- src/physics/cam/clubb_intr.F90 | 495 +++++++++++++-------------------- 1 file changed, 189 insertions(+), 306 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7738fa4031..ae9cb3376d 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2846,7 +2846,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, , rtm_integral_vtend, rtm_integral_ltend !BAS do we need the last two? + real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend !BAS do we need the last two? ! ---------------------------------------------------- ! ! Pointers ! @@ -2959,7 +2959,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & s_awthlup_output, s_awqtup_output, s_awuup_output, s_awvup_output, & s_awthldn_output, s_awqtdn_output, s_awudn_output, s_awvdn_output, & s_awthl_output, s_awqt_output, & -! s_awql_output, s_awqi_output, & !BAS need this? s_awu_output, s_awv_output, & s_aww_output, & mf_thlflxup_output,mf_qtflxup_output, mf_uflxup_output, mf_vflxup_output, & @@ -3531,213 +3530,114 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call tropopause_findChemTrop(state, troplev) ! Initialize EDMF outputs - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - mf_precc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthlup_output(:,:) = 0._r8 - s_awqtup_output(:,:) = 0._r8 - s_awthldn_output(:,:) = 0._r8 - s_awqtdn_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awuup_output(:,:) = 0._r8 - s_awvup_output(:,:) = 0._r8 - s_awudn_output(:,:) = 0._r8 - s_awvdn_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - s_aww_output(:,:) = 0._r8 - mf_upa_output(:,:) = 0._r8 - mf_upw_output(:,:) = 0._r8 - mf_upmf_output(:,:) = 0._r8 - mf_upqt_output(:,:) = 0._r8 - mf_upthl_output(:,:) = 0._r8 - mf_upthv_output(:,:) = 0._r8 - mf_upth_output(:,:) = 0._r8 - mf_upqc_output(:,:) = 0._r8 - mf_upbuoy_output(:,:) = 0._r8 - mf_upent_output(:,:) = 0._r8 - mf_updet_output(:,:) = 0._r8 - mf_upa_flip(:,:,:) = 0._r8 - mf_upw_flip(:,:,:) = 0._r8 - mf_upmf_flip(:,:,:) = 0._r8 - mf_upqt_flip(:,:,:) = 0._r8 - mf_upthl_flip(:,:,:) = 0._r8 - mf_upthv_flip(:,:,:) = 0._r8 - mf_upth_flip(:,:,:) = 0._r8 - mf_upqc_flip(:,:,:) = 0._r8 - mf_upbuoy_flip(:,:,:) = 0._r8 - mf_upent_flip(:,:,:) = 0._r8 - mf_updet_flip(:,:,:) = 0._r8 - mf_thlflxup_output(:,:) = 0._r8 - mf_qtflxup_output(:,:) = 0._r8 - mf_thlflxdn_output(:,:) = 0._r8 - mf_qtflxdn_output(:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - mf_thvflx_output(:,:) = 0._r8 - mf_uflxup_output(:,:) = 0._r8 - mf_vflxup_output(:,:) = 0._r8 - mf_uflxdn_output(:,:) = 0._r8 - mf_vflxdn_output(:,:) = 0._r8 - mf_uflx_output(:,:) = 0._r8 - mf_vflx_output(:,:) = 0._r8 - mf_thlforcup_output(:,:) = 0._r8 - mf_qtforcup_output(:,:) = 0._r8 - mf_thlforcdn_output(:,:) = 0._r8 - mf_qtforcdn_output(:,:) = 0._r8 - mf_thlforc_output(:,:) = 0._r8 - mf_qtforc_output(:,:) = 0._r8 - mf_sqtup_output(:,:) = 0._r8 - mf_sqtdn_output(:,:) = 0._r8 - mf_rcm_output(:,:) = 0._r8 - mf_cloudfrac_output(:,:) = 0._r8 - mf_ent_output(:,:) = 0._r8 - mf_qc_output(:,:) = 0._r8 - mf_ztop_output(:) = 0._r8 - mf_ddcp_output(:) = 0._r8 - mf_L0_output(:) = 0._r8 - mf_freq_output(:) = 0._r8 - mf_cape_output(:) = 0._r8 - mf_cfl_output(:) = 0._r8 - mf_dnw_output(:,:) = 0._r8 - mf_dnthl_output(:,:) = 0._r8 - mf_dnqt_output(:,:) = 0._r8 - mf_dnw_flip(:,:,:) = 0._r8 - mf_dnthl_flip(:,:,:) = 0._r8 - mf_dnqt_flip(:,:,:) = 0._r8 - - ! Loop over all columns in lchnk to advance CLUBB core - do i=1,ncol ! loop over columns - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1,nlev+1 - zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1,nlev - zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - - do k=1,pver - dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - enddo - - ! Thermodynamic ghost point is below surface - zt_g(1) = -1._r8*zt_g(2) - - ! Set the elevation of the surface - sfc_elevation = state1%zi(i,pver+1) - - ! Set the grid size - host_dx = grid_dx(i) - host_dy = grid_dy(i) - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile - exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) - invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo - thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo - th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) - qv_zt(k+1) = state1%q(i,pver-k+1,ixq) - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) - radf(k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) - enddo - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - rho_ds_zt(1) = rho_ds_zt(2) - invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) - rho_in(1) = rho_ds_zt(2) - thv_ds_zt(1) = thv_ds_zt(2) - rho_zt(:) = rho_in(:) - p_in_Pa(1) = p_in_Pa(2) - exner(1) = exner(2) - rfrzm(1) = rfrzm(2) - radf(1) = radf(2) - qrl_clubb(1) = qrl_clubb(2) - th_zt(1) = th_zt(2) - qv_zt(1) = qv_zt(2) - - ! Compute mean w wind on thermo grid, convert from omega to w - wm_zt(1) = 0._r8 - do k=1,nlev - wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - if (do_clubb_mf) then - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awql_output(:,:) = 0._r8 - s_awqi_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 + if (do_clubb_mf) then + mf_dry_a_output(:,:) = 0._r8 + mf_moist_a_output(:,:) = 0._r8 + mf_dry_w_output(:,:) = 0._r8 + mf_moist_w_output(:,:) = 0._r8 + mf_dry_qt_output(:,:) = 0._r8 + mf_moist_qt_output(:,:) = 0._r8 + mf_dry_thl_output(:,:) = 0._r8 + mf_moist_thl_output(:,:) = 0._r8 + mf_dry_u_output(:,:) = 0._r8 + mf_moist_u_output(:,:) = 0._r8 + mf_dry_v_output(:,:) = 0._r8 + mf_moist_v_output(:,:) = 0._r8 + mf_moist_qc_output(:,:) = 0._r8 + mf_precc_output(:,:) = 0._r8 + s_ae_output(:,:) = 0._r8 + s_aw_output(:,:) = 0._r8 + s_awthlup_output(:,:) = 0._r8 + s_awqtup_output(:,:) = 0._r8 + s_awthldn_output(:,:) = 0._r8 + s_awqtdn_output(:,:) = 0._r8 + s_awthl_output(:,:) = 0._r8 + s_awqt_output(:,:) = 0._r8 + s_awuup_output(:,:) = 0._r8 + s_awvup_output(:,:) = 0._r8 + s_awudn_output(:,:) = 0._r8 + s_awvdn_output(:,:) = 0._r8 + s_awu_output(:,:) = 0._r8 + s_awv_output(:,:) = 0._r8 + s_aww_output(:,:) = 0._r8 + mf_upa_output(:,:) = 0._r8 + mf_upw_output(:,:) = 0._r8 + mf_upmf_output(:,:) = 0._r8 + mf_upqt_output(:,:) = 0._r8 + mf_upthl_output(:,:) = 0._r8 + mf_upthv_output(:,:) = 0._r8 + mf_upth_output(:,:) = 0._r8 + mf_upqc_output(:,:) = 0._r8 + mf_upbuoy_output(:,:) = 0._r8 + mf_upent_output(:,:) = 0._r8 + mf_updet_output(:,:) = 0._r8 + mf_upa_flip(:,:,:) = 0._r8 + mf_upw_flip(:,:,:) = 0._r8 + mf_upmf_flip(:,:,:) = 0._r8 + mf_upqt_flip(:,:,:) = 0._r8 + mf_upthl_flip(:,:,:) = 0._r8 + mf_upthv_flip(:,:,:) = 0._r8 + mf_upth_flip(:,:,:) = 0._r8 + mf_upqc_flip(:,:,:) = 0._r8 + mf_upbuoy_flip(:,:,:) = 0._r8 + mf_upent_flip(:,:,:) = 0._r8 + mf_updet_flip(:,:,:) = 0._r8 + mf_thlflxup_output(:,:) = 0._r8 + mf_qtflxup_output(:,:) = 0._r8 + mf_thlflxdn_output(:,:) = 0._r8 + mf_qtflxdn_output(:,:) = 0._r8 + mf_thlflx_output(:,:) = 0._r8 + mf_qtflx_output(:,:) = 0._r8 + mf_thvflx_output(:,:) = 0._r8 + mf_uflxup_output(:,:) = 0._r8 + mf_vflxup_output(:,:) = 0._r8 + mf_uflxdn_output(:,:) = 0._r8 + mf_vflxdn_output(:,:) = 0._r8 + mf_uflx_output(:,:) = 0._r8 + mf_vflx_output(:,:) = 0._r8 + mf_thlforcup_output(:,:) = 0._r8 + mf_qtforcup_output(:,:) = 0._r8 + mf_thlforcdn_output(:,:) = 0._r8 + mf_qtforcdn_output(:,:) = 0._r8 + mf_thlforc_output(:,:) = 0._r8 + mf_qtforc_output(:,:) = 0._r8 + mf_sqtup_output(:,:) = 0._r8 + mf_sqtdn_output(:,:) = 0._r8 + mf_rcm_output(:,:) = 0._r8 + mf_cloudfrac_output(:,:) = 0._r8 + mf_ent_output(:,:) = 0._r8 + mf_qc_output(:,:) = 0._r8 + mf_ztop_output(:) = 0._r8 + mf_ddcp_output(:) = 0._r8 + mf_L0_output(:) = 0._r8 + mf_freq_output(:) = 0._r8 + mf_cape_output(:) = 0._r8 + mf_cfl_output(:) = 0._r8 + mf_dnw_output(:,:) = 0._r8 + mf_dnthl_output(:,:) = 0._r8 + mf_dnqt_output(:,:) = 0._r8 + mf_dnw_flip(:,:,:) = 0._r8 + mf_dnthl_flip(:,:,:) = 0._r8 + mf_dnqt_flip(:,:,:) = 0._r8 end if - + call t_startf("clubb_tend_cam_i_loop") ! Determine Coriolis force at given latitude. This is never used ! when CLUBB is implemented in a host model, therefore just set ! to zero. - fcor(:) = 0._r8 + fcor(:) = 0._r8 ! Define the CLUBB momentum grid (in height, units of m) do k=1, nlev+1 - do i=1, ncol + do i=1, ncol zi_g(i,k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - end do + end do end do ! Define the CLUBB thermodynamic grid (in units of m) do k=1, nlev - do i=1, ncol + do i=1, ncol zt_g(i,k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) end do end do @@ -3747,18 +3647,18 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & dz_g(i,k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness end do end do - - ! Thermodynamic ghost point is below surface + + ! Thermodynamic ghost point is below surface do i=1, ncol zt_g(i,1) = -1._r8*zt_g(i,2) end do - + do i=1, ncol ! Set the elevation of the surface sfc_elevation(i) = state1%zi(i,pver+1) end do - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. + ! Compute thermodynamic stuff needed for CLUBB on thermo levels. ! Inputs for the momentum levels are set below setup_clubb core do k=1,nlev do i=1, ncol @@ -3767,7 +3667,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & invrs_rho_ds_zt(i,k+1) = 1._r8/(rho_ds_zt(i,k+1)) ! full state (moist) variables - p_in_Pa(i,k+1) = state1%pmid(i,pver-k+1) + p_in_Pa(i,k+1) = state1%pmid(i,pver-k+1) exner(i,k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) thv(i,k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1)*(1._r8+zvir*state1%q(i,pver-k+1,ixq) & -state1%q(i,pver-k+1,ixcldliq)) @@ -3776,13 +3676,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! exception - setting this to moist thv thv_ds_zt(i,k+1) = thv(i,k+1) - rfrzm(i,k+1) = state1%q(i,pver-k+1,ixcldice) + rfrzm(i,k+1) = state1%q(i,pver-k+1,ixcldice) radf(i,k+1) = radf_clubb(i,pver-k+1) qrl_clubb(i,k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdeldry(i,pver-k+1)) end do end do - - ! Compute mean w wind on thermo grid, convert from omega to w + + ! Compute mean w wind on thermo grid, convert from omega to w do k=1,nlev do i=1,ncol wm_zt(i,k+1) = -1._r8*(state1%omega(i,pver-k+1)-state1%omega(i,pver))/(rho_zt(i,k+1)*gravit) @@ -3804,7 +3704,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & qrl_clubb(i,1) = qrl_clubb(i,2) wm_zt(i,1) = wm_zt(i,2) end do - + + ! ------------------------------------------------- ! ! Begin case specific code for SCAM cases. ! ! This section of code block is NOT called in ! @@ -4282,12 +4183,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) + th_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, th_zt(1:ncol,:) ) + qv_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, qv_zt(1:ncol,:) ) + qc_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, qc_zt(1:ncol,:) ) ! BAS update these (and all zt2zm_api etc) - th_zm = zt2zm_api( th_zt ) - qv_zm = zt2zm_api( qv_zt ) - qc_zm = zt2zm_api( qc_zt ) - if (t>1) then ! update thv if clubb is subcycled thv_ds_zt(:pverp) = thlm_in(:pverp) & @@ -4305,52 +4205,53 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 if (rhlev(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) - ! BAS need to do loop over ncol? - call integrate_mf( pverp, & ! input - rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input - mf_cape_output(i), mf_ddcp, mf_cbm1, & ! output - plume diagnostics - mf_upa, mf_dna, & ! output - plume diagnostics - mf_upw, mf_dnw, & ! output - plume diagnostics - mf_upmf, & ! output - plume diagnostics - mf_upqt, mf_dnqt, & ! output - plume diagnostics - mf_upthl, mf_dnthl, & ! output - plume diagnostics - mf_upthv, mf_dnthv, & ! output - plume diagnostics - mf_upth, mf_dnth, & ! output - plume diagnostics - mf_upqc, mf_dnqc, & ! output - plume diagnostics - mf_upbuoy, & ! output - plume diagnostics - mf_upent, & ! output - plume diagnostics - mf_updet, & ! output - plume diagnostics - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - s_ae, & ! output - plume diagnostics - s_ac, s_aup, s_adn, & ! output - plume diagnostics - s_aw, s_awup, s_awdn, & ! output - plume diagnostics - s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics - s_awthlup, s_awqtup, s_awuup, s_awvup, & ! output - plume diagnostics - s_awthldn, s_awqtdn, s_awudn, s_awvdn, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics - mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & ! output - plume diagnostics - mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & ! output - variables needed for solver - mf_thvflx, & ! output - plume diagnostics - mf_sqtup, mf_sthlup, & ! output - plume diagnostics - mf_sqtdn, mf_sthldn, & ! output - plume diagnostics - mf_sqt, mf_sthl, & ! output - variables needed for solver - mf_precc, & ! output - plume diagnostics - mf_ztop, mf_L0 ) + do i=1, ncol + call integrate_mf( pverp, & ! input + rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input + rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input + um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input + th_zt, qv_zt, qc_zt, & ! input + thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input + th_zm, qv_zm, qc_zm, & ! input + ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input + wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input + mf_cape_output(i), mf_ddcp, mf_cbm1, & ! output - plume diagnostics + mf_upa, mf_dna, & ! output - plume diagnostics + mf_upw, mf_dnw, & ! output - plume diagnostics + mf_upmf, & ! output - plume diagnostics + mf_upqt, mf_dnqt, & ! output - plume diagnostics + mf_upthl, mf_dnthl, & ! output - plume diagnostics + mf_upthv, mf_dnthv, & ! output - plume diagnostics + mf_upth, mf_dnth, & ! output - plume diagnostics + mf_upqc, mf_dnqc, & ! output - plume diagnostics + mf_upbuoy, & ! output - plume diagnostics + mf_upent, & ! output - plume diagnostics + mf_updet, & ! output - plume diagnostics + mf_dry_a, mf_moist_a, & ! output - plume diagnostics + mf_dry_w, mf_moist_w, & ! output - plume diagnostics + mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics + mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics + mf_dry_u, mf_moist_u, & ! output - plume diagnostics + mf_dry_v, mf_moist_v, & ! output - plume diagnostics + mf_moist_qc, & ! output - plume diagnostics + s_ae, & ! output - plume diagnostics + s_ac, s_aup, s_adn, & ! output - plume diagnostics + s_aw, s_awup, s_awdn, & ! output - plume diagnostics + s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics + s_awthlup, s_awqtup, s_awuup, s_awvup, & ! output - plume diagnostics + s_awthldn, s_awqtdn, s_awudn, s_awvdn, & ! output - plume diagnostics + s_awthl, s_awqt, & ! output - plume diagnostics + s_awu, s_awv, & ! output - plume diagnostics + mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics + mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & ! output - plume diagnostics + mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & ! output - variables needed for solver + mf_thvflx, & ! output - plume diagnostics + mf_sqtup, mf_sthlup, & ! output - plume diagnostics + mf_sqtdn, mf_sthldn, & ! output - plume diagnostics + mf_sqt, mf_sthl, & ! output - variables needed for solver + mf_precc, & ! output - plume diagnostics + mf_ztop, mf_L0 ) + end do ! CFL limiter s_aw(1) = 0._r8 @@ -4384,65 +4285,49 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! pass MF turbulent advection term as CLUBB explicit forcing term -! do i=1, ncol -! rtm_forcing(i,1) = 0._r8 -! thlm_forcing(i,1)= 0._r8 -! end do -! -! do k=2,pverp -! do i=1, ncol -! rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & -! ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) -! -! thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & -! ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) -! end do -! end do - - - ! pass MF turbulent advection term as CLUBB explicit forcing term - ! BAS loop over ncol (see above) - rtm_forcing = 0._r8 - thlm_forcing = 0._r8 - mf_qtforcup = 0._r8 - mf_thlforcup = 0._r8 - mf_qtforcdn = 0._r8 - mf_thlforcdn = 0._r8 - - ! BAS loop over ncol - do k=2,pverp + do i=1, ncol + rtm_forcing(i,1) = 0._r8 + thlm_forcing(i,1) = 0._r8 + mf_qtforcup(i,1) = 0._r8 + mf_thlforcup(i,1) = 0._r8 + mf_qtforcdn(i,1) = 0._r8 + mf_thlforcdn(i,1) = 0._r8 + end do + + do k=2,pverp + do i=1, ncol + rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & + ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) + + thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & + ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & - + mf_sqt(k) + um_forcing(i,k) = um_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_uflx(i,k)) - (rho_ds_zm(i,k-1) * mf_uflx(i,k-1))) - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & - + mf_sthl(k) + vm_forcing(i,k) = vm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_vflx(i,k)) - (rho_ds_zm(i,k-1) * mf_vflx(i,k-1))) - um_forcing(k) = um_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_uflx(k)) - (rho_ds_zm(k-1) * mf_uflx(k-1))) + mf_qtforcup(i,k) = mf_qtforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_qtflxup(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflxup(i,k-1))) & + + mf_sqtup(i,k) - vm_forcing(k) = vm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_vflx(k)) - (rho_ds_zm(k-1) * mf_vflx(k-1))) + mf_thlforcup(i,k) = mf_thlforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_thlflxup(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflxup(i,k-1))) & + + mf_sthlup(i,k) - mf_qtforcup(k) = mf_qtforcup(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflxup(k)) - (rho_ds_zm(k-1) * mf_qtflxup(k-1))) & - + mf_sqtup(k) + mf_qtforcdn(i,k) = mf_qtforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_qtflxdn(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflxdn(i,k-1))) & + + mf_sqtdn(i,k) - mf_thlforcup(k) = mf_thlforcup(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflxup(k)) - (rho_ds_zm(k-1) * mf_thlflxup(k-1))) & - + mf_sthlup(k) + mf_thlforcdn(i,k) = mf_thlforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + ((rho_ds_zm(i,k) * mf_thlflxdn(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflxdn(i,k-1))) & + + mf_sthldn(i,k) - mf_qtforcdn(k) = mf_qtforcdn(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflxdn(k)) - (rho_ds_zm(k-1) * mf_qtflxdn(k-1))) & - + mf_sqtdn(k) + end do + end do - mf_thlforcdn(k) = mf_thlforcdn(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflxdn(k)) - (rho_ds_zm(k-1) * mf_thlflxdn(k-1))) & - + mf_sthldn(k) - end do ! compute ensemble cloud properties mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) @@ -5022,8 +4907,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & s_aw_output(i,pverp-k+1) = s_aw(i,k) s_awthl_output(i,pverp-k+1) = s_awthl(i,k) s_awqt_output(i,pverp-k+1) = s_awqt(i,k) - s_awql_output(i,pverp-k+1) = s_awql(i,k) - s_awqi_output(i,pverp-k+1) = s_awqi(i,k) s_awu_output(i,pverp-k+1) = s_awu(i,k) s_awv_output(i,pverp-k+1) = s_awv(i,k) mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) From 24b711c118c4241c79fb85bc60e58ca7d4dafd34 Mon Sep 17 00:00:00 2001 From: bstephens82 Date: Thu, 29 Jun 2023 11:14:08 -0600 Subject: [PATCH 156/466] More conflict resolution --- src/physics/cam/clubb_intr.F90 | 472 ++++++++++++++------------------- 1 file changed, 203 insertions(+), 269 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index ae9cb3376d..4decd7607e 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -635,6 +635,12 @@ subroutine clubb_register_cam( ) call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) + call pbuf_add_field('pdf_zm_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_1_idx) + call pbuf_add_field('pdf_zm_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_2_idx) + call pbuf_add_field('pdf_zm_var_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_1_idx) + call pbuf_add_field('pdf_zm_var_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_2_idx) + call pbuf_add_field('pdf_zm_mixt_frac', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_mixt_frac_idx) + call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') @@ -697,12 +703,6 @@ subroutine clubb_register_cam( ) !---ARH end if - call pbuf_add_field('pdf_zm_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_1_idx) - call pbuf_add_field('pdf_zm_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_2_idx) - call pbuf_add_field('pdf_zm_var_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_1_idx) - call pbuf_add_field('pdf_zm_var_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_2_idx) - call pbuf_add_field('pdf_zm_mixt_frac', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_mixt_frac_idx) - #endif end subroutine clubb_register_cam @@ -1448,8 +1448,8 @@ subroutine clubb_ini_cam(pbuf2d) iiedsclr_thl, & iiedsclr_CO2 - use time_manager, only: is_first_step - use clubb_api_module, only: hydromet_dim + use time_manager, only: is_first_step + use clubb_api_module, only: hydromet_dim use constituents, only: cnst_get_ind use phys_control, only: phys_getopts use spmd_utils, only: iam @@ -2489,158 +2489,17 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & logical :: lq2(pcnst) integer :: iter - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - - real(r8),pointer :: prec_sh(:) ! total precipitation from MF - real(r8),pointer :: snow_sh(:) ! snow from MF - - real(r8), pointer :: ztopmn(:,:) - real(r8), pointer :: ztopma(:) - real(r8), pointer :: ztopm1_macmic(:) - - real(r8), pointer :: ddcp(:) - real(r8), pointer :: ddcp_macmic(:) - real(r8), pointer :: ddcpmn(:,:) - - real(r8), pointer :: cbm1(:) - real(r8), pointer :: cbm1_macmic(:) - -!+++ARH - real(r8), pointer :: qtm_macmic1(:,:) - real(r8), pointer :: qtm_macmic2(:,:) - real(r8), pointer :: thlm_macmic1(:,:) - real(r8), pointer :: thlm_macmic2(:,:) -!---ARH - real(r8), pointer :: rcm_macmic(:,:) - real(r8), pointer :: cldfrac_macmic(:,:) - real(r8), pointer :: wpthlp_macmic(:,:) - real(r8), pointer :: wprtp_macmic(:,:) - real(r8), pointer :: wpthvp_macmic(:,:) - real(r8), pointer :: mf_thlflx_macmic(:,:) - real(r8), pointer :: mf_qtflx_macmic(:,:) - real(r8), pointer :: mf_thvflx_macmic(:,:) -!+++ARH - real(r8), pointer :: up_macmic1(:,:) - real(r8), pointer :: up_macmic2(:,:) - real(r8), pointer :: dn_macmic1(:,:) - real(r8), pointer :: dn_macmic2(:,:) - real(r8), pointer :: upa_macmic1(:,:) - real(r8), pointer :: upa_macmic2(:,:) - real(r8), pointer :: dna_macmic1(:,:) - real(r8), pointer :: dna_macmic2(:,:) - real(r8), pointer :: thlu_macmic1(:,:) - real(r8), pointer :: thlu_macmic2(:,:) - real(r8), pointer :: qtu_macmic1(:,:) - real(r8), pointer :: qtu_macmic2(:,:) - real(r8), pointer :: thld_macmic1(:,:) - real(r8), pointer :: thld_macmic2(:,:) - real(r8), pointer :: qtd_macmic1(:,:) - real(r8), pointer :: qtd_macmic2(:,:) - real(r8), pointer :: dthl_macmic1(:,:) - real(r8), pointer :: dthl_macmic2(:,:) - real(r8), pointer :: dqt_macmic1(:,:) - real(r8), pointer :: dqt_macmic2(:,:) - real(r8), pointer :: dthlu_macmic1(:,:) - real(r8), pointer :: dthlu_macmic2(:,:) - real(r8), pointer :: dqtu_macmic1(:,:) - real(r8), pointer :: dqtu_macmic2(:,:) - real(r8), pointer :: dthld_macmic1(:,:) - real(r8), pointer :: dthld_macmic2(:,:) - real(r8), pointer :: dqtd_macmic1(:,:) - real(r8), pointer :: dqtd_macmic2(:,:) - real(r8), pointer :: ztop_macmic1(:,:) - real(r8), pointer :: ztop_macmic2(:,:) - real(r8), pointer :: ddcp_macmic1(:,:) - real(r8), pointer :: ddcp_macmic2(:,:) -!---ARH - - real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & - mf_cape_output, mf_cfl_output, & - mf_ddcp_output, mf_freq_output - ! - ! MF outputs to outfld - real(r8), dimension(pcols,pver) :: mf_thlforcup_output, mf_qtforcup_output, & ! thermodynamic grid - mf_thlforcdn_output, mf_qtforcdn_output, & ! thermodynamic grid - mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid - mf_ent_output, & ! thermodynamic grid - mf_sqtup_output, mf_sqtdn_output, & ! thermodynamic grid - mf_qc_output, mf_cloudfrac_output ! thermodynamic grid - - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & - mf_upw_flip, & - mf_upmf_flip, & - mf_upqt_flip, & - mf_upthl_flip, & - mf_upthv_flip, & - mf_upth_flip, & - mf_upqc_flip, & - mf_upbuoy_flip, & - mf_upent_flip, & - mf_updet_flip - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & - mf_upw_output, & - mf_upmf_output, & - mf_upqt_output, & - mf_upthl_output, & - mf_upthv_output, & - mf_upth_output, & - mf_upqc_output, & - mf_upent_output, & - mf_updet_output, & - mf_upbuoy_output - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip, & - mf_dnthl_flip, & - mf_dnqt_flip - - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output, & - mf_dnthl_output, & - mf_dnqt_output - - ! MF Plume - real(r8), pointer :: tpert(:) - - real(r8), dimension(pverp,clubb_mf_nup) :: flip - real(r8), dimension(pverp) :: lilflip - - ! CFL limiter vars - real(r8), parameter :: cflval = 1._r8 - real(r8) :: cflfac, max_cfl, & - lambda, max_cfl_nadv, & - th_sfc - - logical :: cfllim - - real(r8) :: mf_ztop, mf_ztop_nadv, & - mf_ztopm1, mf_ztopm1_nadv, & - mf_precc_nadv, mf_snow_nadv,& - mf_L0, mf_L0_nadv, & - mf_ddcp, mf_ddcp_nadv, & - mf_cbm1, mf_cbm1_nadv, & - mf_freq_nadv - - real(r8), dimension(pcols,pver) :: esat, rh - real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(pcols) :: rhlev - real(r8) :: rhinv - -! real(r8) :: valmax !BAS need this? integer :: clubbtop(pcols) - + real(r8) :: frac_limit, ic_limit - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] + real(r8) :: dtime ! CLUBB time step [s] + real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] + real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] + real(r8) :: ubar ! surface wind [m/s] + real(r8) :: ustar ! surface stress [m/s] + real(r8) :: z0 ! roughness height [m] real(r8) :: bflx22(pcols) ! Variable for buoyancy flux for pbl [K m/s] real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] real(r8) :: zo(pcols) ! roughness height [m] @@ -2650,8 +2509,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES real(r8), dimension(state%ncol) :: & - fcor, & ! Coriolis forcing [s^-1] - sfc_elevation, & ! Elevation of ground [m AMSL][m] + fcor, & ! Coriolis forcing [s^-1] + sfc_elevation, & ! Elevation of ground [m AMSL][m] wpthlp_sfc, & ! w' theta_l' at surface [(m K)/s] wprtp_sfc, & ! w' r_t' at surface [(kg m)/( kg s)] upwp_sfc, & ! u'w' at surface [m^2/s^2] @@ -2659,7 +2518,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & upwp_sfc_pert, & ! perturbed u'w' at surface [m^2/s^2] vpwp_sfc_pert, & ! perturbed v'w' at surface [m^2/s^2] grid_dx, grid_dy ! CAM grid [m] - + real(r8), dimension(state%ncol,sclr_dim) :: & wpsclrp_sfc ! Scalar flux at surface [{units vary} m/s] @@ -2670,64 +2529,64 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES real(r8), dimension(state%ncol,pverp+1-top_lev) :: & thlm_forcing, & ! theta_l forcing (thermodynamic levels) [K/s] - rtm_forcing, & ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - um_forcing, & ! u wind forcing (thermodynamic levels) [m/s/s] - vm_forcing, & ! v wind forcing (thermodynamic levels) [m/s/s] + rtm_forcing, & ! r_t forcing (thermodynamic levels) [(kg/kg)/s] + um_forcing, & ! u wind forcing (thermodynamic levels) [m/s/s] + vm_forcing, & ! v wind forcing (thermodynamic levels) [m/s/s] wprtp_forcing, & wpthlp_forcing, & rtp2_forcing, & thlp2_forcing, & rtpthlp_forcing, & - wm_zm, & ! w mean wind component on momentum levels [m/s] - wm_zt, & ! w mean wind component on thermo. levels [m/s] + wm_zm, & ! w mean wind component on momentum levels [m/s] + wm_zt, & ! w mean wind component on thermo. levels [m/s] rtm_ref, & ! Initial profile of rtm [kg/kg] thlm_ref, & ! Initial profile of thlm [K] um_ref, & ! Initial profile of um [m/s] vm_ref, & ! Initial profile of vm [m/s] ug, & ! U geostrophic wind [m/s] vg, & ! V geostrophic wind [m/s] - p_in_Pa, & ! Air pressure (thermodynamic levels) [Pa] + p_in_Pa, & ! Air pressure (thermodynamic levels) [Pa] rho_zm, & ! Air density on momentum levels [kg/m^3] rho_zt, & ! Air density on thermo levels [kg/m^3] exner, & ! Exner function (thermodynamic levels) [-] - rho_ds_zm, & ! Dry, static density on momentum levels [kg/m^3] - rho_ds_zt, & ! Dry, static density on thermodynamic levels [kg/m^3] - invrs_rho_ds_zm, & ! Inv. dry, static density on momentum levels [m^3/kg] - invrs_rho_ds_zt, & ! Inv. dry, static density on thermo. levels [m^3/kg] - thv_ds_zm, & ! Dry, base-state theta_v on momentum levels [K] - thv_ds_zt, & ! Dry, base-state theta_v on thermo. levels [K] + rho_ds_zm, & ! Dry, static density on momentum levels [kg/m^3] + rho_ds_zt, & ! Dry, static density on thermodynamic levels [kg/m^3] + invrs_rho_ds_zm, & ! Inv. dry, static density on momentum levels [m^3/kg] + invrs_rho_ds_zt, & ! Inv. dry, static density on thermo. levels [m^3/kg] + thv_ds_zm, & ! Dry, base-state theta_v on momentum levels [K] + thv_ds_zt, & ! Dry, base-state theta_v on thermo. levels [K] rfrzm, & radf, & - um_in, & ! meridional wind [m/s] - vm_in, & ! zonal wind [m/s] - upwp_in, & ! meridional wind flux [m^2/s^2] - vpwp_in, & ! zonal wind flux [m^2/s^2] - up2_in, & ! meridional wind variance [m^2/s^2] - vp2_in, & ! zonal wind variance [m^2/s^2] + um_in, & ! meridional wind [m/s] + vm_in, & ! zonal wind [m/s] + upwp_in, & ! meridional wind flux [m^2/s^2] + vpwp_in, & ! zonal wind flux [m^2/s^2] + up2_in, & ! meridional wind variance [m^2/s^2] + vp2_in, & ! zonal wind variance [m^2/s^2] up3_in, & ! meridional wind third-order [m^3/s^3] vp3_in, & ! zonal wind third-order [m^3/s^3] - thlm_in, & ! liquid water potential temperature (thetal) [K] + thlm_in, & ! liquid water potential temperature (thetal) [K] rvm_in, & ! water vapor mixing ratio [kg/kg] - rtm_in, & ! total water mixing ratio [kg/kg] - wprtp_in, & ! turbulent flux of total water [kg/kg m/s] - wpthlp_in, & ! turbulent flux of thetal [K m/s] - wp2_in, & ! vertical velocity variance (CLUBB) [m^2/s^2] - wp3_in, & ! third moment vertical velocity [m^3/s^3] - rtp2_in, & ! total water variance [kg^2/kg^2] + rtm_in, & ! total water mixing ratio [kg/kg] + wprtp_in, & ! turbulent flux of total water [kg/kg m/s] + wpthlp_in, & ! turbulent flux of thetal [K m/s] + wp2_in, & ! vertical velocity variance (CLUBB) [m^2/s^2] + wp3_in, & ! third moment vertical velocity [m^3/s^3] + rtp2_in, & ! total water variance [kg^2/kg^2] rtp2_zt, & ! CLUBB R-tot variance on thermo levs thl2_zt, & ! CLUBB Theta-l variance on thermo levs [K^2] wp2_zt, & ! CLUBB W variance on theromo levs [m^2/s^2] - rtp3_in, & ! total water 3rd order [kg^3/kg^3] - thlp2_in, & ! thetal variance [K^2] - thlp3_in, & ! thetal 3rd order [K^3] - rtpthlp_in, & ! covariance of thetal and qt [kg/kg K] - rcm_inout, & ! CLUBB output of liquid water mixing ratio [kg/kg] + rtp3_in, & ! total water 3rd order [kg^3/kg^3] + thlp2_in, & ! thetal variance [K^2] + thlp3_in, & ! thetal 3rd order [K^3] + rtpthlp_in, & ! covariance of thetal and qt [kg/kg K] + rcm_inout, & ! CLUBB output of liquid water mixing ratio [kg/kg] rcm_out_zm, & - cloud_frac_inout, & ! CLUBB output of cloud fraction [fraction] - wpthvp_in, & ! w'th_v' (momentum levels) [m/s K] - wp2thvp_in, & ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - rtpthvp_in, & ! r_t'th_v' (momentum levels) [kg/kg K] - thlpthvp_in, & ! th_l'th_v' (momentum levels) [K^2] + cloud_frac_inout, & ! CLUBB output of cloud fraction [fraction] + wpthvp_in, & ! w'th_v' (momentum levels) [m/s K] + wp2thvp_in, & ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] + rtpthvp_in, & ! r_t'th_v' (momentum levels) [kg/kg K] + thlpthvp_in, & ! th_l'th_v' (momentum levels) [K^2] ice_supersat_frac_inout, & um_pert_inout, & ! Perturbed U wind [m/s] vm_pert_inout, & ! Perturbed V wind [m/s] @@ -2737,15 +2596,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & khzt_out, & ! eddy diffusivity on thermo grids [m^2/s] qclvar_out, & ! cloud water variance [kg^2/kg^2] thlprcp_out, & - wprcp_out, & ! CLUBB output of flux of liquid water [kg/kg m/s] + wprcp_out, & ! CLUBB output of flux of liquid water [kg/kg m/s] w_up_in_cloud_out, & w_down_in_cloud_out, & cloudy_updraft_frac_out, & cloudy_downdraft_frac_out,& rcm_in_layer_out, & ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - cloud_cover_out, & ! CLUBB output of in-cloud cloud fraction [fraction] - invrs_tau_zm_out, & ! CLUBB output of 1 divided by time-scale [1/s] - rtp2_mc_out, & ! total water tendency from rain evap + cloud_cover_out, & ! CLUBB output of in-cloud cloud fraction [fraction] + invrs_tau_zm_out, & ! CLUBB output of 1 divided by time-scale [1/s] + rtp2_mc_out, & ! total water tendency from rain evap thlp2_mc_out, & ! thetal tendency from rain evap wprtp_mc_out, & wpthlp_mc_out, & @@ -2763,8 +2622,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wpvp2_inout, & ! w'v'^2 (thermodynamic levels) wp2up2_inout, & ! w'^2 u'^2 (momentum levels) wp2vp2_inout, & ! w'^2 v'^2 (momentum levels) - zt_g, & ! Thermodynamic grid of CLUBB [m] - zi_g ! Momentum grid of CLUBB [m] + zt_g, & ! Thermodynamic grid of CLUBB [m] + zi_g ! Momentum grid of CLUBB [m] ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES @@ -2776,13 +2635,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & sclrprtp, & ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] sclrpthlp, & ! sclr'thlp' (momentum levels) [{units vary} (K)] wpsclrp ! w'sclr' (momentum levels) [{units vary} m/s] - + real(r8), dimension(state%ncol,pverp,sclr_dim) :: & sclrpthvp_inout ! sclr'th_v' (momentum levels) [{units vary} (K)] real(r8), dimension(state%ncol,pverp+1-top_lev,edsclr_dim) :: & edsclrm_forcing, & ! Eddy passive scalar forcing [{units vary}/s] - edsclr_in ! Scalars to be diffused through CLUBB [units vary] + edsclr_in ! Scalars to be diffused through CLUBB [units vary] ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES @@ -2792,7 +2651,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wp2hmp, & rtphmp_zt, & thlphmp_zt - + ! Variables below are needed to compute energy integrals for conservation ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) @@ -2946,6 +2805,115 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & logical :: lqice(pcnst) logical :: apply_to_surface(pcols) + ! CLUBB-MF pointers + real(r8),pointer :: prec_sh(:) ! total precipitation from MF + real(r8),pointer :: snow_sh(:) ! snow from MF + + real(r8), pointer :: ztopmn(:,:) + real(r8), pointer :: ztopma(:) + real(r8), pointer :: ztopm1_macmic(:) + + real(r8), pointer :: ddcp(:) + real(r8), pointer :: ddcp_macmic(:) + real(r8), pointer :: ddcpmn(:,:) + + real(r8), pointer :: cbm1(:) + real(r8), pointer :: cbm1_macmic(:) + + real(r8), pointer :: qtm_macmic1(:,:) + real(r8), pointer :: qtm_macmic2(:,:) + real(r8), pointer :: thlm_macmic1(:,:) + real(r8), pointer :: thlm_macmic2(:,:) + real(r8), pointer :: rcm_macmic(:,:) + real(r8), pointer :: cldfrac_macmic(:,:) + real(r8), pointer :: wpthlp_macmic(:,:) + real(r8), pointer :: wprtp_macmic(:,:) + real(r8), pointer :: wpthvp_macmic(:,:) + real(r8), pointer :: mf_thlflx_macmic(:,:) + real(r8), pointer :: mf_qtflx_macmic(:,:) + real(r8), pointer :: mf_thvflx_macmic(:,:) + real(r8), pointer :: up_macmic1(:,:) + real(r8), pointer :: up_macmic2(:,:) + real(r8), pointer :: dn_macmic1(:,:) + real(r8), pointer :: dn_macmic2(:,:) + real(r8), pointer :: upa_macmic1(:,:) + real(r8), pointer :: upa_macmic2(:,:) + real(r8), pointer :: dna_macmic1(:,:) + real(r8), pointer :: dna_macmic2(:,:) + real(r8), pointer :: thlu_macmic1(:,:) + real(r8), pointer :: thlu_macmic2(:,:) + real(r8), pointer :: qtu_macmic1(:,:) + real(r8), pointer :: qtu_macmic2(:,:) + real(r8), pointer :: thld_macmic1(:,:) + real(r8), pointer :: thld_macmic2(:,:) + real(r8), pointer :: qtd_macmic1(:,:) + real(r8), pointer :: qtd_macmic2(:,:) + real(r8), pointer :: dthl_macmic1(:,:) + real(r8), pointer :: dthl_macmic2(:,:) + real(r8), pointer :: dqt_macmic1(:,:) + real(r8), pointer :: dqt_macmic2(:,:) + real(r8), pointer :: dthlu_macmic1(:,:) + real(r8), pointer :: dthlu_macmic2(:,:) + real(r8), pointer :: dqtu_macmic1(:,:) + real(r8), pointer :: dqtu_macmic2(:,:) + real(r8), pointer :: dthld_macmic1(:,:) + real(r8), pointer :: dthld_macmic2(:,:) + real(r8), pointer :: dqtd_macmic1(:,:) + real(r8), pointer :: dqtd_macmic2(:,:) + real(r8), pointer :: ztop_macmic1(:,:) + real(r8), pointer :: ztop_macmic2(:,:) + real(r8), pointer :: ddcp_macmic1(:,:) + real(r8), pointer :: ddcp_macmic2(:,:) + + real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & + mf_cape_output, mf_cfl_output, & + mf_ddcp_output, mf_freq_output + ! + ! MF outputs to outfld + real(r8), dimension(pcols,pver) :: mf_thlforcup_output, mf_qtforcup_output, & ! thermodynamic grid + mf_thlforcdn_output, mf_qtforcdn_output, & ! thermodynamic grid + mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid + mf_ent_output, & ! thermodynamic grid + mf_sqtup_output, mf_sqtdn_output, & ! thermodynamic grid + mf_qc_output, mf_cloudfrac_output ! thermodynamic grid + + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & + mf_upw_flip, & + mf_upmf_flip, & + mf_upqt_flip, & + mf_upthl_flip, & + mf_upthv_flip, & + mf_upth_flip, & + mf_upqc_flip, & + mf_upbuoy_flip, & + mf_upent_flip, & + mf_updet_flip + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & + mf_upw_output, & + mf_upmf_output, & + mf_upqt_output, & + mf_upthl_output, & + mf_upthv_output, & + mf_upth_output, & + mf_upqc_output, & + mf_upent_output, & + mf_updet_output, & + mf_upbuoy_output + ! MF plume level outputs + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip, & + mf_dnthl_flip, & + mf_dnqt_flip + + ! MF plume level outputs to outfld + real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output, & + mf_dnthl_output, & + mf_dnqt_output + + ! MF Plume + real(r8), pointer :: tpert(:) + ! MF outputs to outfld ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & @@ -3021,6 +2989,32 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend + real(r8), dimension(pverp,clubb_mf_nup) :: flip + real(r8), dimension(pverp) :: lilflip + + ! CFL limiter vars + real(r8), parameter :: cflval = 1._r8 + real(r8) :: cflfac, max_cfl, & + lambda, max_cfl_nadv, & + th_sfc + + logical :: cfllim + + real(r8) :: mf_ztop, mf_ztop_nadv, & + mf_ztopm1, mf_ztopm1_nadv, & + mf_precc_nadv, mf_snow_nadv,& + mf_L0, mf_L0_nadv, & + mf_ddcp, mf_ddcp_nadv, & + mf_cbm1, mf_cbm1_nadv, & + mf_freq_nadv + + real(r8), dimension(pcols,pver) :: esat, rh + real(r8), dimension(pcols,pver) :: mq, mqsat + real(r8), dimension(pcols) :: rhlev + real(r8) :: rhinv + + ! real(r8) :: valmax !BAS need this? + ! MF local vars real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid @@ -3194,44 +3188,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - !+++ARH call pbuf_get_field(pbuf, qtm_macmic1_idx, qtm_macmic1) call pbuf_get_field(pbuf, qtm_macmic2_idx, qtm_macmic2) @@ -3593,8 +3552,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_vflxup_output(:,:) = 0._r8 mf_uflxdn_output(:,:) = 0._r8 mf_vflxdn_output(:,:) = 0._r8 - mf_uflx_output(:,:) = 0._r8 - mf_vflx_output(:,:) = 0._r8 + mf_uflx_output(:,:) = 0._r8 + mf_vflx_output(:,:) = 0._r8 mf_thlforcup_output(:,:) = 0._r8 mf_qtforcup_output(:,:) = 0._r8 mf_thlforcdn_output(:,:) = 0._r8 @@ -3791,6 +3750,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call endrun(subr//': Fatal error in CLUBB setup_parameters') end if + ! Define forcings from CAM to CLUBB as zero for momentum and thermo, ! forcings already applied through CAM thlm_forcing(:,:) = 0._r8 @@ -4888,34 +4848,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (do_clubb_mf) then do k=1, nlev+1 do i=1, ncol - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(i,k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(i,k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(i,k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(i,k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(i,k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(i,k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(i,k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(i,k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(i,k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(i,k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(i,k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(i,k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(i,k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(i,k) - s_ae_output(i,pverp-k+1) = s_ae(i,k) - s_aw_output(i,pverp-k+1) = s_aw(i,k) - s_awthl_output(i,pverp-k+1) = s_awthl(i,k) - s_awqt_output(i,pverp-k+1) = s_awqt(i,k) - s_awu_output(i,pverp-k+1) = s_awu(i,k) - s_awv_output(i,pverp-k+1) = s_awv(i,k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(i,k) - end do - end do - end if - - if (do_clubb_mf) then mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) @@ -4996,6 +4928,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + end do + end do end if if (do_clubb_mf) then @@ -5515,7 +5449,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & do k=1,pverp do i=1,ncol -!+++ARH +!+++ARH BAS not sure about how we want to set this block up !wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux !wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux wpthlp_output(i,k) = wpthlp(i,k) From c858e0c762be1d9eea3b60eee84351748f78ddfe Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 11 Jul 2023 20:24:10 -0600 Subject: [PATCH 157/466] builds and runs --- Externals_CAM.cfg | 6 - src/physics/cam/clubb_intr.F90 | 1429 +++-- src/physics/cam/clubb_intr_copy.F90 | 7875 --------------------------- src/physics/rrtmg/radiation.F90 | 6 +- 4 files changed, 701 insertions(+), 8615 deletions(-) delete mode 100644 src/physics/cam/clubb_intr_copy.F90 diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index cbe8ccd15f..caba5270c2 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -21,15 +21,9 @@ required = True [clubb] local_path = src/physics/clubb -<<<<<<< HEAD -protocol = git -repo_url = https://github.com/adamrher/CLUBB_CESM -tag = clubb_release_b76a124.clubbmf -======= protocol = svn repo_url = https://github.com/larson-group/clubb_release/tags/ tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag/src/CLUBB_core ->>>>>>> ESCOMP/cam_development required = True [silhs] diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 4decd7607e..2201913694 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -1866,8 +1866,6 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') - call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') - call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') ! ---------------------------------------------------------------------------- ! ! Below are for detailed analysis of EDMF Scheme ! ! ---------------------------------------------------------------------------- ! @@ -2088,8 +2086,10 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('ZM_CLUBB', 1, ' ') call add_default('UM_CLUBB', 1, ' ') call add_default('VM_CLUBB', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') +!+++ARH + !call add_default('SL', 1, ' ') + !call add_default('QT', 1, ' ') +!---ARH call add_default('CONCLD', 1, ' ') if (do_clubb_mf_diag) then @@ -2570,6 +2570,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rtm_in, & ! total water mixing ratio [kg/kg] wprtp_in, & ! turbulent flux of total water [kg/kg m/s] wpthlp_in, & ! turbulent flux of thetal [K m/s] + tke_in, & ! TKE [m^2/s^2] wp2_in, & ! vertical velocity variance (CLUBB) [m^2/s^2] wp3_in, & ! third moment vertical velocity [m^3/s^3] rtp2_in, & ! total water variance [kg^2/kg^2] @@ -2705,7 +2706,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend !BAS do we need the last two? + real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing ! ---------------------------------------------------- ! ! Pointers ! @@ -2765,6 +2766,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] + real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] @@ -2959,7 +2961,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqt, mf_sthl, & mf_precc - real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & + real(r8), dimension(pcols,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & mf_thvflx, & @@ -2975,32 +2977,32 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_ent_nadv ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, mf_dna, & - mf_upw, mf_dnw, & - mf_upmf, & - mf_upqt, mf_dnqt, & - mf_upthl, mf_dnthl, & - mf_upthv, mf_dnthv, & - mf_upth, mf_dnth, & - mf_upqc, mf_dnqc, & - mf_upbuoy, & - mf_updet, & - mf_upent + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + mf_upw, mf_dnw, & + mf_upmf, & + mf_upqt, mf_dnqt, & + mf_upthl, mf_dnthl, & + mf_upthv, mf_dnthv, & + mf_upth, mf_dnth, & + mf_upqc, mf_dnqc, & + mf_upbuoy, & + mf_updet, & + mf_upent real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend - real(r8), dimension(pverp,clubb_mf_nup) :: flip - real(r8), dimension(pverp) :: lilflip + real(r8), dimension(pcols,pverp,clubb_mf_nup) :: flip + real(r8), dimension(pcols,pverp) :: lilflip ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 - real(r8) :: cflfac, max_cfl, & - lambda, max_cfl_nadv, & - th_sfc + real(r8) :: lambda + real(r8), dimension(pcols) :: cflfac, max_cfl, & + th_sfc, max_cfl_nadv logical :: cfllim - real(r8) :: mf_ztop, mf_ztop_nadv, & + real(r8), dimension(pcols) :: mf_ztop, mf_ztop_nadv, & mf_ztopm1, mf_ztopm1_nadv, & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & @@ -3010,10 +3012,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8), dimension(pcols,pver) :: esat, rh real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(pcols) :: rhlev - real(r8) :: rhinv - - ! real(r8) :: valmax !BAS need this? + real(r8), dimension(pcols) :: rhlev, rhinv ! MF local vars real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid @@ -3179,6 +3178,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, kvh_idx, khzm) call pbuf_get_field(pbuf, pblh_idx, pblh) call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) + call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) ! SILHS covariance contributions @@ -3282,11 +3282,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call init_pdf_params_api( pverp+1-top_lev, ncol, pdf_params_zm_chnk(lchnk) ) end if - if ( .not. allocated(pdf_implicit_coefs_terms_chnk(lchnk)%coef_wp4_implicit) ) then - call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, ncol, sclr_dim, & + if ( .not. allocated(pdf_implicit_coefs_terms_chnk(lchnk)%coef_wp4_implicit) ) then + call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, ncol, sclr_dim, & pdf_implicit_coefs_terms_chnk(lchnk) ) - end if + end if + ! Initialize the apply_const variable (note special logic is due to eularian backstepping) + if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then apply_const = 0._r8 ! On first time through do not remove constant ! from moments since it has not been added yet endif @@ -3650,19 +3652,17 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! Below computes the same stuff for the ghost point. May or may ! not be needed, just to be safe to avoid NaN's - do i=1, ncol - thv_ds_zt(i,1) = thv_ds_zt(i,2) - rho_ds_zt(i,1) = rho_ds_zt(i,2) - invrs_rho_ds_zt(i,1) = invrs_rho_ds_zt(i,2) - p_in_Pa(i,1) = p_in_Pa(i,2) - exner(i,1) = exner(i,2) - thv(i,1) = thv(i,2) - rho_zt(i,1) = rho_zt(i,2) - rfrzm(i,1) = rfrzm(i,2) - radf(i,1) = radf(i,2) - qrl_clubb(i,1) = qrl_clubb(i,2) - wm_zt(i,1) = wm_zt(i,2) - end do + thv_ds_zt(:ncol,1) = thv_ds_zt(:ncol,2) + rho_ds_zt(:ncol,1) = rho_ds_zt(:ncol,2) + invrs_rho_ds_zt(:ncol,1) = invrs_rho_ds_zt(:ncol,2) + p_in_Pa(:ncol,1) = p_in_Pa(:ncol,2) + exner(:ncol,1) = exner(:ncol,2) + thv(:ncol,1) = thv(:ncol,2) + rho_zt(:ncol,1) = rho_zt(:ncol,2) + rfrzm(:ncol,1) = rfrzm(:ncol,2) + radf(:ncol,1) = radf(:ncol,2) + qrl_clubb(:ncol,1) = qrl_clubb(:ncol,2) + wm_zt(:ncol,1) = wm_zt(:ncol,2) ! ------------------------------------------------- ! @@ -3783,11 +3783,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! Compute some inputs from the thermodynamic grid ! to the momentum grid - rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_ds_zt ) - rho_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_zt ) - invrs_rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, invrs_rho_ds_zt ) - thv_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt ) - wm_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, wm_zt ) + rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_ds_zt(1:ncol,:) ) + rho_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_zt(1:ncol,:) ) + invrs_rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, invrs_rho_ds_zt(1:ncol,:) ) + thv_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt(1:ncol,:) ) + wm_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, wm_zt(1:ncol,:) ) ! Surface fluxes provided by host model do i=1,ncol @@ -3949,11 +3949,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end do - do i=1,ncol - kappa_zt(i,1) = kappa_zt(i,2) - qc_zt(i,1) = qc_zt(i,2) - invrs_exner_zt(i,1) = invrs_exner_zt(i,2) - end do + kappa_zt(:ncol,1) = kappa_zt(:ncol,2) + qc_zt(:ncol,1) = qc_zt(:ncol,2) + invrs_exner_zt(:ncol,1) = invrs_exner_zt(:ncol,2) kappa_zm(1:ncol,:) = zt2zm_api(pverp+1-top_lev, ncol, gr, kappa_zt(1:ncol,:)) @@ -3964,11 +3962,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end do - th_sfc = cam_in%ts(i)*invrs_exner_zm(1) - - call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & - rrho(i), ustar ) + th_sfc(1:ncol) = cam_in%ts(1:ncol)*invrs_exner_zm(1:ncol,1) + call calc_ustar( ncol, state1%t(:ncol,pver), state1%pmid(:ncol,pver), cam_in%wsx(:ncol), cam_in%wsy(:ncol), & + rrho(:ncol), ustar2(:ncol) ) end if if (clubb_do_adv) then @@ -4025,109 +4022,103 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end do - do i=1, ncol - edsclr_in(i,1,icnt+1) = edsclr_in(i,2,icnt+1) - edsclr_in(i,1,icnt+2) = edsclr_in(i,2,icnt+2) - end do + edsclr_in(:ncol,1,icnt+1) = edsclr_in(:ncol,2,icnt+1) + edsclr_in(:ncol,1,icnt+2) = edsclr_in(:ncol,2,icnt+2) endif -!+++ARH - if (macmic_it==1) thlm_macmic1(i,:) = 0._r8 - if (macmic_it==1) thlm_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtm_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtm_macmic2(i,:) = 0._r8 -!---ARH - - if (do_clubb_mf) then - mf_L0 = 0._r8 - mf_L0_nadv = 0._r8 - mf_ztop = 0._r8 - mf_ztop_nadv = 0._r8 - mf_ztopm1 = 0._r8 - mf_ztopm1_nadv = 0._r8 - mf_ddcp_nadv = 0._r8 - mf_cbm1 = 0._r8 - mf_cbm1_nadv = 0._r8 - mf_freq_nadv = 0._r8 - - if (macmic_it==1) ztopm1_macmic(i) = 0._r8 - if (macmic_it==1) ddcp_macmic(i) = 0._r8 - if (macmic_it==1) cbm1_macmic(i) = 0._r8 + if (macmic_it==1) thlm_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) thlm_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) qtm_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) qtm_macmic2(:ncol,:) = 0._r8 -!+++ARH - if (macmic_it==1) up_macmic1(i,:) = 0._r8 - if (macmic_it==1) up_macmic2(i,:) = 0._r8 - if (macmic_it==1) dn_macmic1(i,:) = 0._r8 - if (macmic_it==1) dn_macmic2(i,:) = 0._r8 - if (macmic_it==1) upa_macmic1(i,:) = 0._r8 - if (macmic_it==1) upa_macmic2(i,:) = 0._r8 - if (macmic_it==1) dna_macmic1(i,:) = 0._r8 - if (macmic_it==1) dna_macmic2(i,:) = 0._r8 - if (macmic_it==1) thlu_macmic1(i,:) = 0._r8 - if (macmic_it==1) thlu_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtu_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtu_macmic2(i,:) = 0._r8 - if (macmic_it==1) thld_macmic1(i,:) = 0._r8 - if (macmic_it==1) thld_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtd_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtd_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthl_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthl_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqt_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqt_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthlu_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthlu_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqtu_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqtu_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthld_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthld_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqtd_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqtd_macmic2(i,:) = 0._r8 - if (macmic_it==1) ztop_macmic1(i,:) = 0._r8 - if (macmic_it==1) ztop_macmic2(i,:) = 0._r8 - if (macmic_it==1) ddcp_macmic1(i,:) = 0._r8 - if (macmic_it==1) ddcp_macmic2(i,:) = 0._r8 -!---ARH + if (do_clubb_mf) then + mf_L0 = 0._r8 + mf_L0_nadv = 0._r8 + mf_ztop = 0._r8 + mf_ztop_nadv = 0._r8 + mf_ztopm1 = 0._r8 + mf_ztopm1_nadv = 0._r8 + mf_ddcp_nadv = 0._r8 + mf_cbm1 = 0._r8 + mf_cbm1_nadv = 0._r8 + mf_freq_nadv = 0._r8 + + if (macmic_it==1) ztopm1_macmic(:ncol) = 0._r8 + if (macmic_it==1) ddcp_macmic(:ncol) = 0._r8 + if (macmic_it==1) cbm1_macmic(:ncol) = 0._r8 + + if (macmic_it==1) up_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) up_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dn_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dn_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) upa_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) upa_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dna_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dna_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) thlu_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) thlu_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) qtu_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) qtu_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) thld_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) thld_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) qtd_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) qtd_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dthl_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dthl_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dqt_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dqt_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dthlu_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dthlu_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dqtu_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dqtu_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dthld_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dthld_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) dqtd_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) dqtd_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) ztop_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) ztop_macmic2(:ncol,:) = 0._r8 + if (macmic_it==1) ddcp_macmic1(:ncol,:) = 0._r8 + if (macmic_it==1) ddcp_macmic2(:ncol,:) = 0._r8 !+++ARH - Temporary hack - pbuf_set_field is apparently not taking? - if (is_first_step() .and. macmic_it==1) then - ddcp(i) = 0._r8 - end if + if (is_first_step() .and. macmic_it==1) then + ddcp(:ncol) = 0._r8 + end if !---ARH - mf_precc_nadv = 0._r8 - mf_snow_nadv = 0._r8 - - mf_qc(:pverp) = 0._r8 - mf_rcm(:pverp) = 0._r8 - mf_cloudfrac(:pverp) = 0._r8 - mf_qc_nadv(:pverp) = 0._r8 - mf_rcm_nadv(:pverp) = 0._r8 - mf_cloudfrac_nadv(:pverp) = 0._r8 - - mf_thlforcup_nadv(:pverp) = 0._r8 - mf_qtforcup_nadv(:pverp) = 0._r8 - mf_thlforcdn_nadv(:pverp) = 0._r8 - mf_qtforcdn_nadv(:pverp) = 0._r8 - mf_thlforc_nadv(:pverp) = 0._r8 - mf_qtforc_nadv(:pverp) = 0._r8 - mf_ent_nadv(:pverp) = 0._r8 - - max_cfl_nadv = 0._r8 - end if + mf_precc_nadv(:ncol) = 0._r8 + mf_snow_nadv(:ncol) = 0._r8 + + mf_qc(:ncol,:pverp) = 0._r8 + mf_rcm(:ncol,:pverp) = 0._r8 + mf_cloudfrac(:ncol,:pverp) = 0._r8 + mf_qc_nadv(:ncol,:pverp) = 0._r8 + mf_rcm_nadv(:ncol,:pverp) = 0._r8 + mf_cloudfrac_nadv(:ncol,:pverp) = 0._r8 + + mf_thlforcup_nadv(:ncol,:pverp) = 0._r8 + mf_qtforcup_nadv(:ncol,:pverp) = 0._r8 + mf_thlforcdn_nadv(:ncol,:pverp) = 0._r8 + mf_qtforcdn_nadv(:ncol,:pverp) = 0._r8 + mf_thlforc_nadv(:ncol,:pverp) = 0._r8 + mf_qtforc_nadv(:ncol,:pverp) = 0._r8 + mf_ent_nadv(:ncol,:pverp) = 0._r8 + + max_cfl_nadv(:ncol) = 0._r8 + end if - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step + do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif + ! Increment the statistics then being stats timestep + if (l_stats) then + call stats_begin_timestep_api(t, stats_nsamp, stats_nout) + endif - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then + !####################################################################### + !###################### CALL MF DIAGNOSTIC PLUMES ###################### + !####################################################################### + if (do_clubb_mf) then do k=2,pverp @@ -4136,10 +4127,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end do - do i=1, ncol - dzt(i,1) = dzt(i,2) - invrs_dzt(i,:) = 1._r8/dzt(i,:) - end do + dzt(:ncol,1) = dzt(:ncol,2) + invrs_dzt(:ncol,:) = 1._r8/dzt(:ncol,:) rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) @@ -4147,140 +4136,149 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & qv_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, qv_zt(1:ncol,:) ) qc_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, qc_zt(1:ncol,:) ) - ! BAS update these (and all zt2zm_api etc) - if (t>1) then - ! update thv if clubb is subcycled - thv_ds_zt(:pverp) = thlm_in(:pverp) & - + latvap*rcm_inout(:pverp)*invrs_exner_zt(:pverp)/cpair - thv_ds_zt(:pverp) = thv_ds_zt(:pverp) & - * (1._r8+zvir*(rtm_in(:pverp)-rcm_inout(:pverp)) - rcm_inout(:pverp)) - thv_ds_zm = zt2zm_api( thv_ds_zt ) - end if + if (t>1) then + ! update thv if clubb is subcycled + do i=1, ncol + thv_ds_zt(i,:pverp) = thlm_in(i,:pverp) & + + latvap*rcm_inout(i,:pverp)*invrs_exner_zt(i,:pverp)/cpair + thv_ds_zt(i,:pverp) = thv_ds_zt(i,:pverp) & + * (1._r8+zvir*(rtm_in(i,:pverp)-rcm_inout(i,:pverp)) - rcm_inout(i,:pverp)) + end do + thv_ds_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt(1:ncol,:) ) + end if - mf_ztopm1 = ztopma(i) - mf_ddcp = ddcp(i) - mf_cbm1 = cbm1(i) + mf_ztopm1(1:ncol) = ztopma(1:ncol) + mf_ddcp(1:ncol) = ddcp(1:ncol) + mf_cbm1(1:ncol) = cbm1(1:ncol) - rhinv = 0._r8 - if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 - if (rhlev(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) + rhinv(1:ncol) = 0._r8 + do i=1, ncol + if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 + if (rhlev(i) > 0._r8) rhinv(i) = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) + end do do i=1, ncol - call integrate_mf( pverp, & ! input - rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input - mf_cape_output(i), mf_ddcp, mf_cbm1, & ! output - plume diagnostics - mf_upa, mf_dna, & ! output - plume diagnostics - mf_upw, mf_dnw, & ! output - plume diagnostics - mf_upmf, & ! output - plume diagnostics - mf_upqt, mf_dnqt, & ! output - plume diagnostics - mf_upthl, mf_dnthl, & ! output - plume diagnostics - mf_upthv, mf_dnthv, & ! output - plume diagnostics - mf_upth, mf_dnth, & ! output - plume diagnostics - mf_upqc, mf_dnqc, & ! output - plume diagnostics - mf_upbuoy, & ! output - plume diagnostics - mf_upent, & ! output - plume diagnostics - mf_updet, & ! output - plume diagnostics - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - s_ae, & ! output - plume diagnostics - s_ac, s_aup, s_adn, & ! output - plume diagnostics - s_aw, s_awup, s_awdn, & ! output - plume diagnostics - s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics - s_awthlup, s_awqtup, s_awuup, s_awvup, & ! output - plume diagnostics - s_awthldn, s_awqtdn, s_awudn, s_awvdn, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics - mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & ! output - plume diagnostics - mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & ! output - variables needed for solver - mf_thvflx, & ! output - plume diagnostics - mf_sqtup, mf_sthlup, & ! output - plume diagnostics - mf_sqtdn, mf_sthldn, & ! output - plume diagnostics - mf_sqt, mf_sthl, & ! output - variables needed for solver - mf_precc, & ! output - plume diagnostics - mf_ztop, mf_L0 ) + call integrate_mf( pverp, & ! input + rho_zm(i,:), dzm(i,:), zi_g(i,:), p_in_Pa_zm(i,:), invrs_exner_zm(i,:), & ! input + rho_zt(i,:), dzt(i,:), zt_g(i,:), p_in_Pa(i,:), invrs_exner_zt(i,:), & ! input + um_in(i,:), vm_in(i,:), thlm_in(i,:), rtm_in(i,:), thv_ds_zt(i,:), & ! input + th_zt(i,:), qv_zt(i,:), qc_zt(i,:), & ! input + thlm_zm_in(i,:), rtm_zm_in(i,:), thv_ds_zm(i,:), & ! input + th_zm(i,:), qv_zm(i,:), qc_zm(i,:), & ! input + ustar2(i), th_sfc(i), wpthlp_sfc(i), wprtp_sfc(i), pblh(i), & ! input + wpthlp_in(i,:), tke_in(i,:), tpert(i), mf_ztopm1(i), rhinv(i), & ! input + mf_cape_output(i),mf_ddcp(i), mf_cbm1(i), & ! output - plume diagnostics + mf_upa(i,:,:), mf_dna(i,:,:), & ! output - plume diagnostics + mf_upw(i,:,:), mf_dnw(i,:,:), & ! output - plume diagnostics + mf_upmf(i,:,:), & ! output - plume diagnostics + mf_upqt(i,:,:), mf_dnqt(i,:,:), & ! output - plume diagnostics + mf_upthl(i,:,:), mf_dnthl(i,:,:), & ! output - plume diagnostics + mf_upthv(i,:,:), mf_dnthv(i,:,:), & ! output - plume diagnostics + mf_upth(i,:,:), mf_dnth(i,:,:), & ! output - plume diagnostics + mf_upqc(i,:,:), mf_dnqc(i,:,:), & ! output - plume diagnostics + mf_upbuoy(i,:,:), & ! output - plume diagnostics + mf_upent(i,:,:), & ! output - plume diagnostics + mf_updet(i,:,:), & ! output - plume diagnostics + mf_dry_a(i,:), mf_moist_a(i,:), & ! output - plume diagnostics + mf_dry_w(i,:), mf_moist_w(i,:), & ! output - plume diagnostics + mf_dry_qt(i,:), mf_moist_qt(i,:), & ! output - plume diagnostics + mf_dry_thl(i,:), mf_moist_thl(i,:), & ! output - plume diagnostics + mf_dry_u(i,:), mf_moist_u(i,:), & ! output - plume diagnostics + mf_dry_v(i,:), mf_moist_v(i,:), & ! output - plume diagnostics + mf_moist_qc(i,:), & ! output - plume diagnostics + s_ae(i,:), & ! output - plume diagnostics + s_ac(i,:), s_aup(i,:), s_adn(i,:), & ! output - plume diagnostics + s_aw(i,:), s_awup(i,:), s_awdn(i,:), & ! output - plume diagnostics + s_aww(i,:), s_awwup(i,:), s_awwdn(i,:), & ! output - plume diagnostics + s_awthlup(i,:), s_awqtup(i,:), s_awuup(i,:), s_awvup(i,:), & ! output - plume diagnostics + s_awthldn(i,:), s_awqtdn(i,:), s_awudn(i,:), s_awvdn(i,:), & ! output - plume diagnostics + s_awthl(i,:), s_awqt(i,:), & ! output - plume diagnostics + s_awu(i,:), s_awv(i,:), & ! output - plume diagnostics + mf_thlflxup(i,:), mf_qtflxup(i,:), mf_uflxup(i,:), mf_vflxup(i,:), & ! output - plume diagnostics + mf_thlflxdn(i,:), mf_qtflxdn(i,:), mf_uflxdn(i,:), mf_vflxdn(i,:), & ! output - plume diagnostics + mf_thlflx(i,:), mf_qtflx(i,:), mf_uflx(i,:), mf_vflx(i,:), & ! output - variables needed for solver + mf_thvflx(i,:), & ! output - plume diagnostics + mf_sqtup(i,:), mf_sthlup(i,:), & ! output - plume diagnostics + mf_sqtdn(i,:), mf_sthldn(i,:), & ! output - plume diagnostics + mf_sqt(i,:), mf_sthl(i,:), & ! output - variables needed for solver + mf_precc(i,:), & ! output - plume diagnostics + mf_ztop(i), mf_L0(i) ) end do - ! CFL limiter - s_aw(1) = 0._r8 - max_cfl = 0._r8 - do k=2,pverp - max_cfl = max(max_cfl,dtime*invrs_dzt(k)*max(abs(s_aw(k-1)),abs(s_aw(k)))) - end do - cflfac = 1._r8 - cfllim = .true. - if (max_cfl.gt.cflval.and.cfllim) cflfac = cflval/max_cfl + ! CFL limiter + cfllim = .true. + cflfac(:ncol) = 1._r8 + s_aw(:ncol,1) = 0._r8 + max_cfl(:ncol)= 0._r8 + do i=1,ncol + do k=2,pverp + max_cfl(i) = max(max_cfl(i),dtime*invrs_dzt(i,k)*max(abs(s_aw(i,k-1)),abs(s_aw(i,k)))) + end do + if (max_cfl(i).gt.cflval.and.cfllim) cflfac(i) = cflval/max_cfl(i) + end do ! Scale microphys so it can't drive qt negative - do k=2,pverp - if ((-1._r8*mf_sqt(k)*dtime) > rtm_in(k)) then - lambda = -1._r8*rtm_in(k)/(mf_sqt(k)*dtime) - mf_sqt(k) = lambda*mf_sqt(k) - mf_sthl(k) = lambda*mf_sthl(k) - mf_sqtup(k) = lambda*mf_sqtup(k) - mf_sthlup(k) = lambda*mf_sthlup(k) - mf_sqtdn(k) = lambda*mf_sqtdn(k) - mf_sthldn(k) = lambda*mf_sthldn(k) - end if - end do + do k=2,pverp + do i=1,ncol + if ((-1._r8*mf_sqt(i,k)*dtime) > rtm_in(i,k)) then + lambda = -1._r8*rtm_in(i,k)/(mf_sqt(i,k)*dtime) + mf_sqt(i,k) = lambda*mf_sqt(i,k) + mf_sthl(i,k) = lambda*mf_sthl(i,k) + mf_sqtup(i,k) = lambda*mf_sqtup(i,k) + mf_sthlup(i,k) = lambda*mf_sthlup(i,k) + mf_sqtdn(i,k) = lambda*mf_sqtdn(i,k) + mf_sthldn(i,k) = lambda*mf_sthldn(i,k) + end if + end do + end do - ! Recalculate precip using new microphys forcing - mf_precc(:pverp) = 0._r8 - do k=pverp,2,-1 - mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*mf_sqt(k) - end do + ! Recalculate precip using new microphys forcing + mf_precc(:ncol,:pverp) = 0._r8 + do k=pverp,2,-1 + do i=1,ncol + mf_precc(i,k-1) = mf_precc(i,k) - rho_zt(i,k)*dzt(i,k)*mf_sqt(i,k) + end do + end do ! pass MF turbulent advection term as CLUBB explicit forcing term - do i=1, ncol - rtm_forcing(i,1) = 0._r8 - thlm_forcing(i,1) = 0._r8 - mf_qtforcup(i,1) = 0._r8 - mf_thlforcup(i,1) = 0._r8 - mf_qtforcdn(i,1) = 0._r8 - mf_thlforcdn(i,1) = 0._r8 - end do + rtm_forcing(:ncol,1) = 0._r8 + thlm_forcing(:ncol,1) = 0._r8 + mf_qtforcup(:ncol,1) = 0._r8 + mf_thlforcup(:ncol,1) = 0._r8 + mf_qtforcdn(:ncol,1) = 0._r8 + mf_thlforcdn(:ncol,1) = 0._r8 do k=2,pverp do i=1, ncol - rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) + rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & + ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) & + + mf_sqt(i,k) - thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) + thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & + ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) & + + mf_sthl(i,k) - um_forcing(i,k) = um_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + um_forcing(i,k) = um_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_uflx(i,k)) - (rho_ds_zm(i,k-1) * mf_uflx(i,k-1))) - vm_forcing(i,k) = vm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + vm_forcing(i,k) = vm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_vflx(i,k)) - (rho_ds_zm(i,k-1) * mf_vflx(i,k-1))) - mf_qtforcup(i,k) = mf_qtforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + mf_qtforcup(i,k) = mf_qtforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_qtflxup(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflxup(i,k-1))) & + mf_sqtup(i,k) - mf_thlforcup(i,k) = mf_thlforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + mf_thlforcup(i,k) = mf_thlforcup(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_thlflxup(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflxup(i,k-1))) & + mf_sthlup(i,k) - mf_qtforcdn(i,k) = mf_qtforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + mf_qtforcdn(i,k) = mf_qtforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_qtflxdn(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflxdn(i,k-1))) & + mf_sqtdn(i,k) - mf_thlforcdn(i,k) = mf_thlforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac * & + mf_thlforcdn(i,k) = mf_thlforcdn(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & ((rho_ds_zm(i,k) * mf_thlflxdn(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflxdn(i,k-1))) & + mf_sthldn(i,k) @@ -4288,266 +4286,264 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do - + do i=1,ncol ! compute ensemble cloud properties - mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) - mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac_nadv(:pverp) = mf_cloudfrac_nadv(:pverp) + mf_moist_a(:pverp) + mf_qc_nadv(i,:pverp) = mf_qc_nadv(i,:pverp) + mf_moist_qc(i,:pverp) + mf_rcm_nadv(i,:pverp) = mf_rcm_nadv(i,:pverp) + mf_moist_a(i,:pverp)*mf_moist_qc(i,:pverp) + mf_cloudfrac_nadv(i,:pverp) = mf_cloudfrac_nadv(i,:pverp) + mf_moist_a(i,:pverp) ! [kg/m2/s]->[m/s] - mf_precc_nadv = mf_precc_nadv + mf_precc(1)/1000._r8 - mf_snow_nadv = 0._r8 + mf_precc_nadv(i) = mf_precc_nadv(i) + mf_precc(i,1)/1000._r8 + mf_snow_nadv(i) = 0._r8 ! accumulate over nadv subcycles - mf_L0_nadv = mf_L0_nadv + mf_L0 - mf_ztop_nadv = mf_ztop_nadv + mf_ztop - mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 - mf_ddcp_nadv = mf_ddcp_nadv + mf_ddcp - mf_cbm1_nadv = mf_cbm1_nadv + mf_cbm1 - - if (mf_ztop > 0._r8) mf_freq_nadv = mf_freq_nadv + 1._r8 - - mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp) + mf_thlforcup(:pverp) - mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp) + mf_qtforcup(:pverp) - mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp) + mf_thlforcdn(:pverp) - mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp) + mf_qtforcdn(:pverp) - mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp) + thlm_forcing(:pverp) - mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp) + rtm_forcing(:pverp) - - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + s_awu(:pverp) + mf_L0_nadv(i) = mf_L0_nadv(i) + mf_L0(i) + mf_ztop_nadv(i) = mf_ztop_nadv(i) + mf_ztop(i) + mf_ztopm1_nadv(i) = mf_ztopm1_nadv(i) + mf_ztopm1(i) + mf_ddcp_nadv(i) = mf_ddcp_nadv(i) + mf_ddcp(i) + mf_cbm1_nadv(i) = mf_cbm1_nadv(i) + mf_cbm1(i) + + if (mf_ztop(i) > 0._r8) mf_freq_nadv(i) = mf_freq_nadv(i) + 1._r8 + + mf_thlforcup_nadv(i,:pverp) = mf_thlforcup_nadv(i,:pverp) + mf_thlforcup(i,:pverp) + mf_qtforcup_nadv(i,:pverp) = mf_qtforcup_nadv(i,:pverp) + mf_qtforcup(i,:pverp) + mf_thlforcdn_nadv(i,:pverp) = mf_thlforcdn_nadv(i,:pverp) + mf_thlforcdn(i,:pverp) + mf_qtforcdn_nadv(i,:pverp) = mf_qtforcdn_nadv(i,:pverp) + mf_qtforcdn(i,:pverp) + mf_thlforc_nadv(i,:pverp) = mf_thlforc_nadv(i,:pverp) + thlm_forcing(i,:pverp) + mf_qtforc_nadv(i,:pverp) = mf_qtforc_nadv(i,:pverp) + rtm_forcing(i,:pverp) + + mf_ent_nadv(i,:pverp) = mf_ent_nadv(i,:pverp) + s_awu(i,:pverp) - max_cfl_nadv = MAX(max_cfl,max_cfl_nadv) -!+++ARH + max_cfl_nadv(i) = MAX(max_cfl(i),max_cfl_nadv(i)) + end do + if (t==1) then - ztop_macmic1(i,macmic_it) = mf_ztopm1 - ddcp_macmic1(i,macmic_it) = mf_ddcp + ztop_macmic1(:ncol,macmic_it) = mf_ztopm1(:ncol) + ddcp_macmic1(:ncol,macmic_it) = mf_ddcp(:ncol) do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upw(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - up_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + up_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnw(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - dn_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + dn_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upa(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - upa_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + upa_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dna(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - dna_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + dna_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upthl(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - thlu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + thlu_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upqt(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - qtu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + qtu_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnthl(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - thld_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + thld_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnqt(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - qtd_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + qtd_macmic1(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_forcing(k) + lilflip(:ncol,pverp-k+1) = thlm_forcing(:ncol,k) end do - dthl_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthl_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_forcing(k) + lilflip(:ncol,pverp-k+1) = rtm_forcing(:ncol,k) end do - dqt_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqt_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcup(k) + lilflip(:ncol,pverp-k+1) = mf_thlforcup(:ncol,k) end do - dthlu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthlu_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcup(k) + lilflip(:ncol,pverp-k+1) = mf_qtforcup(:ncol,k) end do - dqtu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqtu_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcdn(k) + lilflip(:ncol,pverp-k+1) = mf_thlforcdn(:ncol,k) end do - dthld_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthld_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcdn(k) + lilflip(:ncol,pverp-k+1) = mf_qtforcdn(:ncol,k) end do - dqtd_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqtd_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) else if (t==2) then - ztop_macmic2(i,macmic_it) = mf_ztopm1 - ddcp_macmic2(i,macmic_it) = mf_ddcp + ztop_macmic2(:ncol,macmic_it) = mf_ztopm1(:ncol) + ddcp_macmic2(:ncol,macmic_it) = mf_ddcp(:ncol) do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upw(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - up_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + up_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnw(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - dn_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + dn_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upa(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - upa_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + upa_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dna(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - dna_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + dna_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upthl(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - thlu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + thlu_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upqt(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - qtu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + qtu_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnthl(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - thld_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + thld_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_dnqt(:ncol,k,:clubb_mf_nup) end do do k=1,clubb_mf_nup - qtd_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) + qtd_macmic2(:ncol, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:ncol,:pverp,k) end do do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_forcing(k) + lilflip(:ncol,pverp-k+1) = thlm_forcing(:ncol,k) end do - dthl_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthl_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_forcing(k) + lilflip(:ncol,pverp-k+1) = rtm_forcing(:ncol,k) end do - dqt_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqt_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcup(k) + lilflip(:ncol,pverp-k+1) = mf_thlforcup(:ncol,k) end do - dthlu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthlu_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcup(k) + lilflip(:ncol,pverp-k+1) = mf_qtforcup(:ncol,k) end do - dqtu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqtu_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcdn(k) + lilflip(:ncol,pverp-k+1) = mf_thlforcdn(:ncol,k) end do - dthld_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dthld_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcdn(k) + lilflip(:ncol,pverp-k+1) = mf_qtforcdn(:ncol,k) end do - dqtd_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + dqtd_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) end if -!---ARH - end if !clubbmf + end if !clubbmf -!+++ARH - if (t==1) then + if (t==1) then - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + do k=1,nlev+1 + lilflip(:ncol,pverp-k+1) = thlm_in(:ncol,k) + end do + thlm_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + do k=1,nlev+1 + lilflip(:ncol,pverp-k+1) = rtm_in(:ncol,k) + end do + qtm_macmic1(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) - else if (t==2) then + else if (t==2) then - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + do k=1,nlev+1 + lilflip(:ncol,pverp-k+1) = thlm_in(:ncol,k) + end do + thlm_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) + do k=1,nlev+1 + lilflip(:ncol,pverp-k+1) = rtm_in(:ncol,k) + end do + qtm_macmic2(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:ncol,:pverp) - end if -!---ARH + end if ! Advance CLUBB CORE one timestep in the future call advance_clubb_core_api( gr, pverp+1-top_lev, ncol, & @@ -4602,7 +4598,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & !+++ARH ! clip negative water do k=1,pverp - if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) + do i=1,ncol + if (rtm_in(i,k) < rcm_inout(i,k)) rtm_in(i,k) = rcm_inout(i,k) + end do end do !---ARH @@ -4664,68 +4662,69 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & enddo ! end time loop - if (do_clubb_mf) then - ! average over nadv - mf_L0_nadv = mf_L0_nadv/REAL(nadv) - mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) - mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) - mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) - mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) - mf_freq_nadv = mf_freq_nadv/REAL(nadv) - - ! accumulate in buffer - ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv - ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv - cbm1_macmic(i) = cbm1_macmic(i) + mf_cbm1_nadv - - if (macmic_it == cld_macmic_num_steps) then - - cbm1(i) = cbm1_macmic(i)/REAL(cld_macmic_num_steps) - - if (clubb_mf_up_ndt == 1) then - ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - else - ztopmn(2:clubb_mf_up_ndt,i) = ztopmn(1:clubb_mf_up_ndt-1,i) - ztopmn(1,i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - ztopma(i) = 0._r8 - do t=1,clubb_mf_up_ndt - ztopma(i) = ztopma(i) + ztopmn(t,i) - end do - ztopma(i) = ztopma(i)/REAL(clubb_mf_up_ndt) - end if + if (do_clubb_mf) then + ! average over nadv + mf_L0_nadv = mf_L0_nadv/REAL(nadv) + mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) + mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) + mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) + mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) + mf_freq_nadv = mf_freq_nadv/REAL(nadv) + + ! accumulate in buffer + ztopm1_macmic(:ncol) = ztopm1_macmic(:ncol) + mf_ztopm1_nadv(:ncol) + ddcp_macmic(:ncol) = ddcp_macmic(:ncol) + mf_ddcp_nadv(:ncol) + cbm1_macmic(:ncol) = cbm1_macmic(:ncol) + mf_cbm1_nadv(:ncol) - if (clubb_mf_cp_ndt == 1) then - ddcp(i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - else - ddcpmn(2:clubb_mf_cp_ndt,i) = ddcpmn(1:clubb_mf_cp_ndt-1,i) - ddcpmn(1,i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - ddcp(i) = 0._r8 - do t=1,clubb_mf_cp_ndt - ddcp(i) = ddcp(i) + ddcpmn(t,i) - end do - ddcp(i) = ddcp(i)/REAL(clubb_mf_cp_ndt) - end if + if (macmic_it == cld_macmic_num_steps) then - ddcp(i) = clubb_mf_ddalph*ddcp(i) + cbm1(:ncol) = cbm1_macmic(:ncol)/REAL(cld_macmic_num_steps) + if (clubb_mf_up_ndt == 1) then + ztopma(:ncol) = ztopm1_macmic(:ncol)/REAL(cld_macmic_num_steps) + else + ztopmn(2:clubb_mf_up_ndt,:ncol) = ztopmn(1:clubb_mf_up_ndt-1,:ncol) + ztopmn(1,:ncol) = ztopm1_macmic(:ncol)/REAL(cld_macmic_num_steps) + ztopma(:ncol) = 0._r8 + do t=1,clubb_mf_up_ndt + ztopma(:ncol) = ztopma(:ncol) + ztopmn(t,:ncol) + end do + ztopma(:ncol) = ztopma(:ncol)/REAL(clubb_mf_up_ndt) end if - mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) - mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) - mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) - prec_sh(i) = mf_precc_nadv/REAL(nadv) - snow_sh(i) = mf_snow_nadv/REAL(nadv) + if (clubb_mf_cp_ndt == 1) then + ddcp(:ncol) = ddcp_macmic(:ncol)/REAL(cld_macmic_num_steps) + else + ddcpmn(2:clubb_mf_cp_ndt,:ncol) = ddcpmn(1:clubb_mf_cp_ndt-1,:ncol) + ddcpmn(1,:ncol) = ddcp_macmic(:ncol)/REAL(cld_macmic_num_steps) + ddcp(:ncol) = 0._r8 + do t=1,clubb_mf_cp_ndt + ddcp(:ncol) = ddcp(:ncol) + ddcpmn(t,:ncol) + end do + ddcp(:ncol) = ddcp(:ncol)/REAL(clubb_mf_cp_ndt) + end if - mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp)/REAL(nadv) - mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp)/REAL(nadv) - mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp)/REAL(nadv) - mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp)/REAL(nadv) - mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) - mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) + ddcp(:ncol) = clubb_mf_ddalph*ddcp(:ncol) - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp)/REAL(nadv) end if + mf_qc(:ncol,:pverp) = mf_qc_nadv(:ncol,:pverp)/REAL(nadv) + mf_rcm(:ncol,:pverp) = mf_rcm_nadv(:ncol,:pverp)/REAL(nadv) + mf_cloudfrac(:ncol,:pverp) = mf_cloudfrac_nadv(:ncol,:pverp)/REAL(nadv) + prec_sh(:ncol) = mf_precc_nadv(:ncol)/REAL(nadv) + snow_sh(:ncol) = mf_snow_nadv(:ncol)/REAL(nadv) + + mf_thlforcup_nadv(:ncol,:pverp) = mf_thlforcup_nadv(:ncol,:pverp)/REAL(nadv) + mf_qtforcup_nadv(:ncol,:pverp) = mf_qtforcup_nadv(:ncol,:pverp)/REAL(nadv) + mf_thlforcdn_nadv(:ncol,:pverp) = mf_thlforcdn_nadv(:ncol,:pverp)/REAL(nadv) + mf_qtforcdn_nadv(:ncol,:pverp) = mf_qtforcdn_nadv(:ncol,:pverp)/REAL(nadv) + mf_thlforc_nadv(:ncol,:pverp) = mf_thlforc_nadv(:ncol,:pverp)/REAL(nadv) + mf_qtforc_nadv(:ncol,:pverp) = mf_qtforc_nadv(:ncol,:pverp)/REAL(nadv) + + mf_ent_nadv(:ncol,:pverp) = mf_ent_nadv(:ncol,:pverp)/REAL(nadv) + + end if !clubbmf + if (clubb_do_adv) then if (macmic_it == cld_macmic_num_steps) then @@ -4757,8 +4756,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wp2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, wp2_in ) ! Need moist_qc and cloudfrac on thermo grid for output - mf_qc_zt = zm2zt_api(mf_qc) - mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) + mf_qc_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_qc) + mf_cloudfrac_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_cloudfrac) ! Arrays need to be "flipped" to CAM grid do k=1, nlev+1 @@ -4848,124 +4847,122 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (do_clubb_mf) then do k=1, nlev+1 do i=1, ncol - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - - s_awthlup_output(i,pverp-k+1) = s_awthlup(k) - s_awqtup_output(i,pverp-k+1) = s_awqtup(k) - s_awthldn_output(i,pverp-k+1) = s_awthldn(k) - s_awqtdn_output(i,pverp-k+1) = s_awqtdn(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - - s_awuup_output(i,pverp-k+1) = s_awuup(k) - s_awvup_output(i,pverp-k+1) = s_awvup(k) - s_awudn_output(i,pverp-k+1) = s_awudn(k) - s_awvdn_output(i,pverp-k+1) = s_awvdn(k) - - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - s_aww_output(i,pverp-k+1) = s_aww(k) - - mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) - mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) - mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) - mf_qtflxdn_output(i,pverp-k+1) = mf_qtflxdn(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) - - mf_uflxup_output(i,pverp-k+1) = mf_uflxup(k) - mf_vflxup_output(i,pverp-k+1) = mf_vflxup(k) - mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(k) - mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(k) - mf_uflx_output(i,pverp-k+1) = mf_uflx(k) - mf_vflx_output(i,pverp-k+1) = mf_vflx(k) - - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) + mf_dry_a_output(i,pverp-k+1) = mf_dry_a(i,k) + mf_moist_a_output(i,pverp-k+1) = mf_moist_a(i,k) + mf_dry_w_output(i,pverp-k+1) = mf_dry_w(i,k) + mf_moist_w_output(i,pverp-k+1) = mf_moist_w(i,k) + mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(i,k) + mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(i,k) + mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(i,k) + mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(i,k) + mf_dry_u_output(i,pverp-k+1) = mf_dry_u(i,k) + mf_moist_u_output(i,pverp-k+1) = mf_moist_u(i,k) + mf_dry_v_output(i,pverp-k+1) = mf_dry_v(i,k) + mf_moist_v_output(i,pverp-k+1) = mf_moist_v(i,k) + mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(i,k) + + s_ae_output(i,pverp-k+1) = s_ae(i,k) + s_aw_output(i,pverp-k+1) = s_aw(i,k) + + s_awthlup_output(i,pverp-k+1) = s_awthlup(i,k) + s_awqtup_output(i,pverp-k+1) = s_awqtup(i,k) + s_awthldn_output(i,pverp-k+1) = s_awthldn(i,k) + s_awqtdn_output(i,pverp-k+1) = s_awqtdn(i,k) + s_awthl_output(i,pverp-k+1) = s_awthl(i,k) + s_awqt_output(i,pverp-k+1) = s_awqt(i,k) + + s_awuup_output(i,pverp-k+1) = s_awuup(i,k) + s_awvup_output(i,pverp-k+1) = s_awvup(i,k) + s_awudn_output(i,pverp-k+1) = s_awudn(i,k) + s_awvdn_output(i,pverp-k+1) = s_awvdn(i,k) + + s_awu_output(i,pverp-k+1) = s_awu(i,k) + s_awv_output(i,pverp-k+1) = s_awv(i,k) + s_aww_output(i,pverp-k+1) = s_aww(i,k) + + mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(i,k) + mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(i,k) + mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(i,k) + mf_qtflxdn_output(i,pverp-k+1) = mf_qtflxdn(i,k) + mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) + mf_qtflx_output(i,pverp-k+1) = mf_qtflx(i,k) + mf_thvflx_output(i,pverp-k+1) = mf_thvflx(i,k) + + mf_uflxup_output(i,pverp-k+1) = mf_uflxup(i,k) + mf_vflxup_output(i,pverp-k+1) = mf_vflxup(i,k) + mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(i,k) + mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(i,k) + mf_uflx_output(i,pverp-k+1) = mf_uflx(i,k) + mf_vflx_output(i,pverp-k+1) = mf_vflx(i,k) + + mf_rcm_output(i,pverp-k+1) = mf_rcm(i,k) + mf_precc_output(i,pverp-k+1) = mf_precc(i,k) if (k.ne.1) then - mf_thlforcup_output(i,pverp-k+1) = mf_thlforcup_nadv(k) - mf_qtforcup_output(i,pverp-k+1) = mf_qtforcup_nadv(k) - mf_thlforcdn_output(i,pverp-k+1) = mf_thlforcdn_nadv(k) - mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(k) - mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) - mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) - mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) - mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) - - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) - mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) - mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) + mf_thlforcup_output(i,pverp-k+1) = mf_thlforcup_nadv(i,k) + mf_qtforcup_output(i,pverp-k+1) = mf_qtforcup_nadv(i,k) + mf_thlforcdn_output(i,pverp-k+1) = mf_thlforcdn_nadv(i,k) + mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(i,k) + mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(i,k) + mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(i,k) + mf_sqtup_output(i,pverp-k+1) = mf_sqtup(i,k) + mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(i,k) + + mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(i,k) + mf_ent_output(i,pverp-k+1) = mf_ent_nadv(i,k) + mf_qc_output(i,pverp-k+1) = mf_qc_zt(i,k) end if - mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(k,:clubb_mf_nup) - mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) - mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) - mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) - mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) - mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) - mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) - mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) + mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(i,k,:clubb_mf_nup) + mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(i,k,:clubb_mf_nup) + mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(i,k,:clubb_mf_nup) + mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(i,k,:clubb_mf_nup) + mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(i,k,:clubb_mf_nup) + mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(i,k,:clubb_mf_nup) + mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(i,k,:clubb_mf_nup) + mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(i,k,:clubb_mf_nup) + mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(i,k,:clubb_mf_nup) + mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(i,k,:clubb_mf_nup) + mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(i,k,:clubb_mf_nup) + mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(i,k,:clubb_mf_nup) + mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(i,k,:clubb_mf_nup) + mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(i,k,:clubb_mf_nup) end do end do - end if - - if (do_clubb_mf) then -!+++ARH - ! these fillvalues won't average correctly - !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue - !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue - - !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv - mf_ztop_output(i) = mf_ztop_nadv + end if !clubbmf - mf_L0_output(i) = mf_L0_nadv - mf_cfl_output(i) = max_cfl_nadv - - !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) - mf_ddcp_output(i) = mf_ddcp_nadv - - mf_freq_output(i) = mf_freq_nadv -!---ARH - do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) - mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) - mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) - mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) - mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) - end do - end if + if (do_clubb_mf) then + ! these fillvalues won't average correctly + !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue + !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue + + !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv + mf_ztop_output(:ncol) = mf_ztop_nadv(:ncol) + + mf_L0_output(:ncol) = mf_L0_nadv(:ncol) + mf_cfl_output(:ncol) = max_cfl_nadv(:ncol) + + !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) + mf_ddcp_output(:ncol) = mf_ddcp_nadv(:ncol) + mf_freq_output(:ncol) = mf_freq_nadv(:ncol) + + do k=1,clubb_mf_nup + mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) + mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) + mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) + mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) + mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) + mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) + mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) + mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) + mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) + mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) + mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) + mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) + mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) + mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) + end do + end if !clubbmf ! Values to use above top_lev, for variables that have not already been ! set up there. These are mostly fill values that should not actually be @@ -5068,22 +5065,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime ! Compute the disbalance of total energy, over depth where CLUBB is active - se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) + se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop(i))) + end do - ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis(i)*gravit - enddo - endif - ! convert to units of +ve [K] - se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) ! Fix the total energy coming out of CLUBB so it achieves energy conservation. ! Apply this fixer throughout the column evenly, but only at layers where @@ -5449,22 +5433,19 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & do k=1,pverp do i=1,ncol -!+++ARH BAS not sure about how we want to set this block up !wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux !wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux wpthlp_output(i,k) = wpthlp(i,k) wprtp_output(i,k) = wprtp(i,k) -!+++ARH rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy if (do_clubb_mf) then ! comment out for kinemtatic fluxes -!+++ARH !mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair !mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair !mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap -!---ARH + mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o end if enddo @@ -5653,193 +5634,177 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! ! --------------------------------------------------------------------------------- ! - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 - call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) - - rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 - call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) - call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 - call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:)*rho(:ncol,:)*cpair - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) - - call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - + ! Output calls of variables goes here + call outfld( 'RELVAR', relvar, pcols, lchnk ) + call outfld( 'RHO_CLUBB', rho(:,1:pver), pcols, lchnk ) + call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) + call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) + call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) + call outfld( 'WP3_CLUBB', wp3_output(:,1:pver), pcols, lchnk ) + call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) + call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) + call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) + call outfld( 'RTP2_CLUBB', rtp2, pcols, lchnk ) + call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) + call outfld( 'RCM_CLUBB', rcm(:,1:pver), pcols, lchnk ) + call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) + call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) + + temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap + call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) + + temp2dp(:ncol,:) = wpthvp(:ncol,:) * cpair + call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) + + call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out(:,1:pver), pcols, lchnk ) + call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out(:,1:pver), pcols, lchnk ) + call outfld( 'WP2_ZT_CLUBB', wp2_zt_out(:,1:pver), pcols, lchnk ) + call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) + call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) + call outfld( 'RCMINLAYER_CLUBB', rcm_in_layer(:,1:pver), pcols, lchnk ) + call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) + call outfld( 'CLOUDCOVER_CLUBB', cloud_frac(:,1:pver), pcols, lchnk ) + call outfld( 'ZT_CLUBB', zt_out(:,1:pver), pcols, lchnk ) + call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) + call outfld( 'UM_CLUBB', um(:,1:pver), pcols, lchnk ) + call outfld( 'VM_CLUBB', vm(:,1:pver), pcols, lchnk ) + call outfld( 'WM_ZT_CLUBB', wm_zt_out(:,1:pver), pcols, lchnk ) + call outfld( 'CONCLD', concld, pcols, lchnk ) + call outfld( 'DP_CLD', deepcu, pcols, lchnk ) + call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) + call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) + call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) + call outfld( 'QSATFAC', qsatfac, pcols, lchnk ) + + call outfld( 'PRECSH' , prec_sh(:ncol), pcols, lchnk ) + call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) + ! --------------------------------------------------------------- ! ! Writing state variables after EDMF scheme for detailed analysis ! ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWW' , s_aww_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlforcup', mf_thlforcup_output, pcols, lchnk ) - call outfld( 'edmf_qtforcup' , mf_qtforcup_output, pcols, lchnk ) - call outfld( 'edmf_thlforcdn', mf_thlforcdn_output, pcols, lchnk ) - call outfld( 'edmf_qtforcdn' , mf_qtforcdn_output, pcols, lchnk ) - call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) - call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) - call outfld( 'edmf_thlflxup' , mf_thlflxup_output, pcols, lchnk ) - call outfld( 'edmf_qtflxup' , mf_qtflxup_output, pcols, lchnk ) - call outfld( 'edmf_thlflxdn' , mf_thlflxdn_output, pcols, lchnk ) - call outfld( 'edmf_qtflxdn' , mf_qtflxdn_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) - call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) - call outfld( 'edmf_uflxup' , mf_uflxup_output, pcols, lchnk ) - call outfld( 'edmf_vflxup' , mf_vflxup_output, pcols, lchnk ) - call outfld( 'edmf_uflxdn' , mf_uflxdn_output, pcols, lchnk ) - call outfld( 'edmf_vflxdn' , mf_vflxdn_output, pcols, lchnk ) - call outfld( 'edmf_uflx' , mf_uflx_output, pcols, lchnk ) - call outfld( 'edmf_vflx' , mf_vflx_output, pcols, lchnk ) - call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) - call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) - call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) - call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) - call outfld( 'edmf_upmf' , mf_upmf_output, pcols, lchnk ) - call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) - call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) - call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) - call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) - call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) - call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) - call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) - call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) - call outfld( 'edmf_dnw' , mf_dnw_output, pcols, lchnk ) - call outfld( 'edmf_dnthl' , mf_dnthl_output, pcols, lchnk ) - call outfld( 'edmf_dnqt' , mf_dnqt_output, pcols, lchnk ) - call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) - call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) -!+++ARH - ! macmic_it==1 ensures that this is ddcp aeraged over the prior time-steps - if (macmic_it==1) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) - if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) -!---ARH - call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) - call outfld( 'edmf_freq' , mf_freq_output, pcols, lchnk ) - call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) - call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) - call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) - end if + if (do_clubb_mf) then + call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) + call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) + call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) + call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) + call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) + call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) + call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) + call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) + call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) + call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) + call outfld( 'edmf_S_AWW' , s_aww_output, pcols, lchnk ) + call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) + call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) + call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) + call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) + call outfld( 'edmf_thlforcup', mf_thlforcup_output, pcols, lchnk ) + call outfld( 'edmf_qtforcup' , mf_qtforcup_output, pcols, lchnk ) + call outfld( 'edmf_thlforcdn', mf_thlforcdn_output, pcols, lchnk ) + call outfld( 'edmf_qtforcdn' , mf_qtforcdn_output, pcols, lchnk ) + call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) + call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) + call outfld( 'edmf_thlflxup' , mf_thlflxup_output, pcols, lchnk ) + call outfld( 'edmf_qtflxup' , mf_qtflxup_output, pcols, lchnk ) + call outfld( 'edmf_thlflxdn' , mf_thlflxdn_output, pcols, lchnk ) + call outfld( 'edmf_qtflxdn' , mf_qtflxdn_output, pcols, lchnk ) + call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) + call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) + call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) + call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) + call outfld( 'edmf_uflxup' , mf_uflxup_output, pcols, lchnk ) + call outfld( 'edmf_vflxup' , mf_vflxup_output, pcols, lchnk ) + call outfld( 'edmf_uflxdn' , mf_uflxdn_output, pcols, lchnk ) + call outfld( 'edmf_vflxdn' , mf_vflxdn_output, pcols, lchnk ) + call outfld( 'edmf_uflx' , mf_uflx_output, pcols, lchnk ) + call outfld( 'edmf_vflx' , mf_vflx_output, pcols, lchnk ) + call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) + call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) + call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) + call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) + call outfld( 'edmf_upmf' , mf_upmf_output, pcols, lchnk ) + call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) + call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) + call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) + call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) + call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) + call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) + call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) + call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) + call outfld( 'edmf_dnw' , mf_dnw_output, pcols, lchnk ) + call outfld( 'edmf_dnthl' , mf_dnthl_output, pcols, lchnk ) + call outfld( 'edmf_dnqt' , mf_dnqt_output, pcols, lchnk ) + call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) + call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) + + ! macmic_it==1 ensures that this is ddcp aeraged over the prior time-steps + if (macmic_it==1) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) + if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) + + call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) + call outfld( 'edmf_freq' , mf_freq_output, pcols, lchnk ) + call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) + call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) + call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) + end if - if (macmic_it==cld_macmic_num_steps) then -!+++ARH - call outfld( 'qtm_macmic1' , qtm_macmic1, pcols, lchnk ) - call outfld( 'qtm_macmic2' , qtm_macmic2, pcols, lchnk ) - call outfld( 'thlm_macmic1' , thlm_macmic1, pcols, lchnk ) - call outfld( 'thlm_macmic2' , thlm_macmic2, pcols, lchnk ) -!---ARH - call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) - call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) - - call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) - call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) - if (do_clubb_mf) then - call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) - call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) - call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) -!+++ARH - call outfld( 'up_macmic1' , up_macmic1, pcols, lchnk ) - call outfld( 'up_macmic2' , up_macmic2, pcols, lchnk ) - call outfld( 'dn_macmic1' , dn_macmic1, pcols, lchnk ) - call outfld( 'dn_macmic2' , dn_macmic2, pcols, lchnk ) - call outfld( 'upa_macmic1' , upa_macmic1, pcols, lchnk ) - call outfld( 'upa_macmic2' , upa_macmic2, pcols, lchnk ) - call outfld( 'dna_macmic1' , dna_macmic1, pcols, lchnk ) - call outfld( 'dna_macmic2' , dna_macmic2, pcols, lchnk ) - call outfld( 'thlu_macmic1' , thlu_macmic1, pcols, lchnk ) - call outfld( 'thlu_macmic2' , thlu_macmic2, pcols, lchnk ) - call outfld( 'qtu_macmic1' , qtu_macmic1, pcols, lchnk ) - call outfld( 'qtu_macmic2' , qtu_macmic2, pcols, lchnk ) - call outfld( 'thld_macmic1' , thld_macmic1, pcols, lchnk ) - call outfld( 'thld_macmic2' , thld_macmic2, pcols, lchnk ) - call outfld( 'qtd_macmic1' , qtd_macmic1, pcols, lchnk ) - call outfld( 'qtd_macmic2' , qtd_macmic2, pcols, lchnk ) - call outfld( 'dthl_macmic1' , dthl_macmic1, pcols, lchnk ) - call outfld( 'dthl_macmic2' , dthl_macmic2, pcols, lchnk ) - call outfld( 'dqt_macmic1' , dqt_macmic1, pcols, lchnk ) - call outfld( 'dqt_macmic2' , dqt_macmic2, pcols, lchnk ) - call outfld( 'dthlu_macmic1' , dthlu_macmic1, pcols, lchnk ) - call outfld( 'dthlu_macmic2' , dthlu_macmic2, pcols, lchnk ) - call outfld( 'dqtu_macmic1' , dqtu_macmic1, pcols, lchnk ) - call outfld( 'dqtu_macmic2' , dqtu_macmic2, pcols, lchnk ) - call outfld( 'dthld_macmic1' , dthld_macmic1, pcols, lchnk ) - call outfld( 'dthld_macmic2' , dthld_macmic2, pcols, lchnk ) - call outfld( 'dqtd_macmic1' , dqtd_macmic1, pcols, lchnk ) - call outfld( 'dqtd_macmic2' , dqtd_macmic2, pcols, lchnk ) - call outfld( 'ztop_macmic1' , ztop_macmic1, pcols, lchnk ) - call outfld( 'ztop_macmic2' , ztop_macmic2, pcols, lchnk ) - call outfld( 'ddcp_macmic1' , ddcp_macmic1, pcols, lchnk ) - call outfld( 'ddcp_macmic2' , ddcp_macmic2, pcols, lchnk ) -!---ARH - end if - end if + if (macmic_it==cld_macmic_num_steps) then + call outfld( 'qtm_macmic1' , qtm_macmic1, pcols, lchnk ) + call outfld( 'qtm_macmic2' , qtm_macmic2, pcols, lchnk ) + call outfld( 'thlm_macmic1' , thlm_macmic1, pcols, lchnk ) + call outfld( 'thlm_macmic2' , thlm_macmic2, pcols, lchnk ) + + call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) + call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) + + call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) + call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) + call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) + if (do_clubb_mf) then + call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) + call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) + call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) + call outfld( 'up_macmic1' , up_macmic1, pcols, lchnk ) + call outfld( 'up_macmic2' , up_macmic2, pcols, lchnk ) + call outfld( 'dn_macmic1' , dn_macmic1, pcols, lchnk ) + call outfld( 'dn_macmic2' , dn_macmic2, pcols, lchnk ) + call outfld( 'upa_macmic1' , upa_macmic1, pcols, lchnk ) + call outfld( 'upa_macmic2' , upa_macmic2, pcols, lchnk ) + call outfld( 'dna_macmic1' , dna_macmic1, pcols, lchnk ) + call outfld( 'dna_macmic2' , dna_macmic2, pcols, lchnk ) + call outfld( 'thlu_macmic1' , thlu_macmic1, pcols, lchnk ) + call outfld( 'thlu_macmic2' , thlu_macmic2, pcols, lchnk ) + call outfld( 'qtu_macmic1' , qtu_macmic1, pcols, lchnk ) + call outfld( 'qtu_macmic2' , qtu_macmic2, pcols, lchnk ) + call outfld( 'thld_macmic1' , thld_macmic1, pcols, lchnk ) + call outfld( 'thld_macmic2' , thld_macmic2, pcols, lchnk ) + call outfld( 'qtd_macmic1' , qtd_macmic1, pcols, lchnk ) + call outfld( 'qtd_macmic2' , qtd_macmic2, pcols, lchnk ) + call outfld( 'dthl_macmic1' , dthl_macmic1, pcols, lchnk ) + call outfld( 'dthl_macmic2' , dthl_macmic2, pcols, lchnk ) + call outfld( 'dqt_macmic1' , dqt_macmic1, pcols, lchnk ) + call outfld( 'dqt_macmic2' , dqt_macmic2, pcols, lchnk ) + call outfld( 'dthlu_macmic1' , dthlu_macmic1, pcols, lchnk ) + call outfld( 'dthlu_macmic2' , dthlu_macmic2, pcols, lchnk ) + call outfld( 'dqtu_macmic1' , dqtu_macmic1, pcols, lchnk ) + call outfld( 'dqtu_macmic2' , dqtu_macmic2, pcols, lchnk ) + call outfld( 'dthld_macmic1' , dthld_macmic1, pcols, lchnk ) + call outfld( 'dthld_macmic2' , dthld_macmic2, pcols, lchnk ) + call outfld( 'dqtd_macmic1' , dqtd_macmic1, pcols, lchnk ) + call outfld( 'dqtd_macmic2' , dqtd_macmic2, pcols, lchnk ) + call outfld( 'ztop_macmic1' , ztop_macmic1, pcols, lchnk ) + call outfld( 'ztop_macmic2' , ztop_macmic2, pcols, lchnk ) + call outfld( 'ddcp_macmic1' , ddcp_macmic1, pcols, lchnk ) + call outfld( 'ddcp_macmic2' , ddcp_macmic2, pcols, lchnk ) + end if + end if ! Output CLUBB history here if (l_stats) then diff --git a/src/physics/cam/clubb_intr_copy.F90 b/src/physics/cam/clubb_intr_copy.F90 deleted file mode 100644 index 8ac0d9110e..0000000000 --- a/src/physics/cam/clubb_intr_copy.F90 +++ /dev/null @@ -1,7875 +0,0 @@ -module clubb_intr - - !----------------------------------------------------------------------------------------------------- ! - ! Module to interface CAM with Cloud Layers Unified by Bi-normals (CLUBB), developed ! - ! by the University of Wisconsin Milwaukee Group (UWM). ! - ! ! - ! CLUBB replaces the exisiting turbulence, shallow convection, and macrophysics in CAM5 ! - ! ! - ! Lastly, a implicit diffusion solver is called, and tendencies retrieved by ! - ! differencing the diffused and initial states. ! - ! ! - ! Calling sequence: ! - ! ! - !---------------------------Code history-------------------------------------------------------------- ! - ! Authors: P. Bogenschutz, C. Craig, A. Gettelman ! - ! Modified by: K Thayer-Calder ! - ! ! - !----------------------------------------------------------------------------------------------------- ! - -<<<<<<< HEAD - use shr_kind_mod, only: r8=>shr_kind_r8 - use ppgrid, only: pver, pverp, pcols, begchunk, endchunk - use phys_control, only: phys_getopts - use physconst, only: rairv, cpairv, cpair, gravit, latvap, latice, zvir, rh2o, karman, rhoh2o - use physconst, only: rga -!+++ARH - use shr_const_mod, only: shr_const_pi -!---ARH - use spmd_utils, only: masterproc - use spmd_utils, only: iam - use time_manager, only: get_nstep - use cam_history_support, only : fillvalue - use constituents, only: pcnst, cnst_add - use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev - use zm_conv_intr, only: zmconv_microp -#ifdef CLUBB_SGS - use clubb_api_module, only: pdf_parameter, implicit_coefs_terms - use clubb_api_module, only: clubb_config_flags_type - use cloud_fraction, only: dp1, dp2 - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad, clubb_mf_Lopt, & - clubb_mf_ddalph, clubb_mf_up_ndt, clubb_mf_cp_ndt - use cam_history_support, only: add_hist_coord -======= - use shr_kind_mod, only: r8=>shr_kind_r8 - use ppgrid, only: pver, pverp, pcols, begchunk, endchunk - use phys_control, only: phys_getopts - use physconst, only: cpair, gravit, rga, latvap, latice, zvir, rh2o, karman - use air_composition, only: rairv, cpairv - use cam_history_support, only: max_fieldname_len - - use spmd_utils, only: masterproc - use constituents, only: pcnst, cnst_add - use pbl_utils, only: calc_ustar, calc_obklen - use ref_pres, only: top_lev => trop_cloud_top_lev - use zm_conv_intr, only: zmconv_microp -#ifdef CLUBB_SGS - use clubb_api_module, only: pdf_parameter, implicit_coefs_terms - use clubb_api_module, only: clubb_config_flags_type, grid, stats, nu_vertical_res_dep - use clubb_api_module, only: nparams - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag - use cloud_fraction, only: dp1, dp2 ->>>>>>> ESCOMP/cam_development -#endif - - implicit none -#ifdef CLUBB_SGS - ! Variables that contains all the statistics - - type (stats), target, save :: stats_zt(pcols), & ! stats_zt grid - stats_zm(pcols), & ! stats_zm grid - stats_rad_zt(pcols), & ! stats_rad_zt grid - stats_rad_zm(pcols), & ! stats_rad_zm grid - stats_sfc(pcols) ! stats_sfc - -!$omp threadprivate(stats_zt, stats_zm, stats_rad_zt, stats_rad_zm, stats_sfc) - -#endif - - private - save - - ! ----------------- ! - ! Public interfaces ! - ! ----------------- ! - - public :: clubb_ini_cam, clubb_register_cam, clubb_tend_cam, clubb_emissions_cam, & -#ifdef CLUBB_SGS - ! This utilizes CLUBB specific variables in its interface - stats_init_clubb, & - stats_zt, stats_zm, stats_sfc, & - stats_rad_zt, stats_rad_zm, & - stats_end_timestep_clubb, & -#endif - clubb_readnl, & - clubb_init_cnst, & - clubb_implements_cnst - -#ifdef CLUBB_SGS - ! Both of these utilize CLUBB specific variables in their interface - private :: stats_zero, stats_avg -#endif - - logical, public :: do_cldcool - logical :: clubb_do_icesuper - -#ifdef CLUBB_SGS - type(clubb_config_flags_type), public :: clubb_config_flags - real(r8), dimension(nparams), public :: clubb_params ! Adjustable CLUBB parameters (C1, C2 ...) -#endif - - ! ------------ ! - ! Private data ! - ! ------------ ! - - integer, parameter :: & - grid_type = 3, & ! The 2 option specifies stretched thermodynamic levels - hydromet_dim = 0 ! The hydromet array in SAM-CLUBB is currently 0 elements - - ! Even though sclr_dim is set to 0, the dimension here is set to 1 to prevent compiler errors - ! See github ticket larson-group/cam#133 for details - real(r8), parameter, dimension(1) :: & - sclr_tol = 1.e-8_r8 ! Total water in kg/kg - - character(len=6) :: saturation_equation - - real(r8), parameter :: & - theta0 = 300._r8, & ! Reference temperature [K] - ts_nudge = 86400._r8, & ! Time scale for u/v nudging (not used) [s] - p0_clubb = 100000._r8 - - integer, parameter :: & - sclr_dim = 0 ! Higher-order scalars, set to zero - - real(r8), parameter :: & - wp3_const = 1._r8 ! Constant to add to wp3 when moments are advected - - real(r8), parameter :: & - wpthlp_const = 10.0_r8 ! Constant to add to wpthlp when moments are advected - - real(r8), parameter :: & - wprtp_const = 0.01_r8 ! Constant to add to wprtp when moments are advected - - real(r8), parameter :: & - rtpthlp_const = 0.01_r8 ! Constant to add to rtpthlp when moments are advected - - real(r8), parameter :: unset_r8 = huge(1.0_r8) - integer, parameter :: unset_i = huge(1) - - ! Commonly used temperature for the melting temp of ice crystals [K] - real(r8), parameter :: meltpt_temp = 268.15_r8 - - real(r8) :: clubb_timestep = unset_r8 ! Default CLUBB timestep, unless overwriten by namelist - real(r8) :: clubb_rnevap_effic = unset_r8 - - real(r8) :: clubb_c1 = unset_r8 - real(r8) :: clubb_c1b = unset_r8 - real(r8) :: clubb_C2rt = unset_r8 - real(r8) :: clubb_C2thl = unset_r8 - real(r8) :: clubb_C2rtthl = unset_r8 - real(r8) :: clubb_C4 = unset_r8 - real(r8) :: clubb_C6rt = unset_r8 - real(r8) :: clubb_c6rtb = unset_r8 - real(r8) :: clubb_c6rtc = unset_r8 - real(r8) :: clubb_c6thl = unset_r8 - real(r8) :: clubb_c6thlb = unset_r8 - real(r8) :: clubb_c6thlc = unset_r8 - real(r8) :: clubb_C8 = unset_r8 - real(r8) :: clubb_C8b = unset_r8 - real(r8) :: clubb_C7 = unset_r8 - real(r8) :: clubb_C7b = unset_r8 - real(r8) :: clubb_c11 = unset_r8 - real(r8) :: clubb_c11b = unset_r8 - real(r8) :: clubb_c14 = unset_r8 - real(r8) :: clubb_C_wp3_pr_turb = unset_r8 - real(r8) :: clubb_c_K1 = unset_r8 - real(r8) :: clubb_c_K2 = unset_r8 - real(r8) :: clubb_nu2 = unset_r8 - real(r8) :: clubb_c_K8 = unset_r8 - real(r8) :: clubb_c_K9 = unset_r8 - real(r8) :: clubb_nu9 = unset_r8 - real(r8) :: clubb_c_K10 = unset_r8 - real(r8) :: clubb_c_K10h = unset_r8 - real(r8) :: clubb_C_invrs_tau_bkgnd = unset_r8 - real(r8) :: clubb_C_invrs_tau_sfc = unset_r8 - real(r8) :: clubb_C_invrs_tau_shear = unset_r8 - real(r8) :: clubb_C_invrs_tau_N2 = unset_r8 - real(r8) :: clubb_C_invrs_tau_N2_wp2 = unset_r8 - real(r8) :: clubb_C_invrs_tau_N2_xp2 = unset_r8 - real(r8) :: clubb_C_invrs_tau_N2_wpxp = unset_r8 - real(r8) :: clubb_C_invrs_tau_N2_clear_wp3 = unset_r8 - real(r8) :: clubb_C_uu_shr = unset_r8 - real(r8) :: clubb_C_uu_buoy = unset_r8 - real(r8) :: clubb_gamma_coef = unset_r8 - real(r8) :: clubb_gamma_coefb = unset_r8 - real(r8) :: clubb_beta = unset_r8 - real(r8) :: clubb_lambda0_stability_coef = unset_r8 - real(r8) :: clubb_lmin_coef = unset_r8 - real(r8) :: clubb_mult_coef = unset_r8 - real(r8) :: clubb_Skw_denom_coef = unset_r8 - real(r8) :: clubb_skw_max_mag = unset_r8 - real(r8) :: clubb_up2_sfc_coef = unset_r8 - real(r8) :: clubb_C_wp2_splat = unset_r8 - real(r8) :: clubb_wpxp_L_thresh = unset_r8 - real(r8) :: clubb_detliq_rad = unset_r8 - real(r8) :: clubb_detice_rad = unset_r8 - real(r8) :: clubb_detphase_lowtemp = unset_r8 - - integer :: & - clubb_iiPDF_type, & ! Selected option for the two-component normal - ! (double Gaussian) PDF type to use for the w, rt, - ! and theta-l (or w, chi, and eta) portion of - ! CLUBB's multivariate, two-component PDF. - clubb_ipdf_call_placement = unset_i, & ! Selected option for the placement of the call to - ! CLUBB's PDF. - clubb_penta_solve_method = unset_i, & ! Specifier for method to solve the penta-diagonal system - clubb_tridiag_solve_method = unset_i ! Specifier for method to solve tri-diagonal systems - - - - logical :: & - clubb_l_use_precip_frac, & ! Flag to use precipitation fraction in KK microphysics. The - ! precipitation fraction is automatically set to 1 when this - ! flag is turned off. - clubb_l_predict_upwp_vpwp, & ! Flag to predict and along with and - ! alongside the advancement of , , , - ! , , and in subroutine - ! advance_xm_wpxp. Otherwise, and are still - ! approximated by eddy diffusivity when and are - ! advanced in subroutine advance_windm_edsclrm. - clubb_l_min_wp2_from_corr_wx, & ! Flag to base the threshold minimum value of wp2 on keeping - ! the overall correlation of w and x (w and rt, as well as w - ! and theta-l) within the limits of -max_mag_correlation_flux - ! to max_mag_correlation_flux. - clubb_l_min_xp2_from_corr_wx, & ! Flag to base the threshold minimum value of xp2 (rtp2 and - ! thlp2) on keeping the overall correlation of w and x within - ! the limits of -max_mag_correlation_flux to - ! max_mag_correlation_flux. - clubb_l_C2_cloud_frac, & ! Flag to use cloud fraction to adjust the value of the - ! turbulent dissipation coefficient, C2. - clubb_l_diffuse_rtm_and_thlm, & ! Diffuses rtm and thlm - clubb_l_stability_correct_Kh_N2_zm, & ! Divides Kh_N2_zm by a stability factor - clubb_l_calc_thlp2_rad, & ! Include the contribution of radiation to thlp2 - clubb_l_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtp2, thlp2, up2, vp2, sclrp2, rtpthlp, sclrprtp, & - ! sclrpthlp. - clubb_l_upwind_xm_ma, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent or mean advection terms. It - ! affects rtm, thlm, sclrm, um and vm. - clubb_l_uv_nudge, & ! For wind speed nudging. - clubb_l_rtm_nudge, & ! For rtm nudging - clubb_l_tke_aniso, & ! For anisotropic turbulent kinetic energy, i.e. - ! TKE = 1/2 (u'^2 + v'^2 + w'^2) - clubb_l_vert_avg_closure, & ! Use 2 calls to pdf_closure and the trapezoidal rule to - ! compute the varibles that are output from high order - ! closure - clubb_l_trapezoidal_rule_zt, & ! If true, the trapezoidal rule is called for the - ! thermodynamic-level variables output from pdf_closure. - clubb_l_trapezoidal_rule_zm, & ! If true, the trapezoidal rule is called for three - ! momentum-level variables - wpthvp, thlpthvp, and rtpthvp - - ! output from pdf_closure. - clubb_l_call_pdf_closure_twice, & ! This logical flag determines whether or not to call - ! subroutine pdf_closure twice. If true, pdf_closure is - ! called first on thermodynamic levels and then on momentum - ! levels so that each variable is computed on its native - ! level. If false, pdf_closure is only called on - ! thermodynamic levels, and variables which belong on - ! momentum levels are interpolated. - clubb_l_standard_term_ta, & ! Use the standard discretization for the turbulent advection - ! terms. Setting to .false. means that a_1 and a_3 are - ! pulled outside of the derivative in - ! advance_wp2_wp3_module.F90 and in - ! advance_xp2_xpyp_module.F90. - clubb_l_partial_upwind_wp3, & ! Flag to use an "upwind" discretization rather - ! than a centered discretization for the portion - ! of the wp3 turbulent advection term for ADG1 - ! that is linearized in terms of wp3. - ! (Requires ADG1 PDF and clubb_l_standard_term_ta). - clubb_l_godunov_upwind_wpxp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent advection terms. - ! It affects wpxp only. - clubb_l_godunov_upwind_xpyp_ta, & ! This flag determines whether we want to use an upwind - ! differencing approximation rather than a centered - ! differencing for turbulent advection terms. It affects - ! xpyp only. - clubb_l_use_cloud_cover, & ! Use cloud_cover and rcm_in_layer to help boost cloud_frac - ! and rcm to help increase cloudiness at coarser grid - ! resolutions. - clubb_l_diagnose_correlations, & ! Diagnose correlations instead of using fixed ones - clubb_l_calc_w_corr, & ! Calculate the correlations between w and the hydrometeors - clubb_l_const_Nc_in_cloud, & ! Use a constant cloud droplet conc. within cloud (K&K) - clubb_l_fix_w_chi_eta_correlations, & ! Use a fixed correlation for s and t Mellor(chi/eta) - clubb_l_stability_correct_tau_zm, & ! Use tau_N2_zm instead of tau_zm in wpxp_pr1 stability - ! correction - clubb_l_damp_wp2_using_em, & ! In wp2 equation, use a dissipation formula of - ! -(2/3)*em/tau_zm, as in Bougeault (1981) - clubb_l_do_expldiff_rtm_thlm, & ! Diffuse rtm and thlm explicitly - clubb_l_Lscale_plume_centered, & ! Alternate that uses the PDF to compute the perturbed values - clubb_l_diag_Lscale_from_tau, & ! First diagnose dissipation time tau, and then diagnose the - ! mixing length scale as Lscale = tau * tke - clubb_l_use_C7_Richardson, & ! Parameterize C7 based on Richardson number - clubb_l_use_C11_Richardson, & ! Parameterize C11 and C16 based on Richardson number - clubb_l_use_shear_Richardson, & ! Use shear in the calculation of Richardson number - clubb_l_brunt_vaisala_freq_moist, & ! Use a different formula for the Brunt-Vaisala frequency in - ! saturated atmospheres (from Durran and Klemp, 1982) - clubb_l_use_thvm_in_bv_freq, & ! Use thvm in the calculation of Brunt-Vaisala frequency - clubb_l_rcm_supersat_adj, & ! Add excess supersaturated vapor to cloud water - clubb_l_lmm_stepping, & ! Apply Linear Multistep Method (LMM) Stepping - clubb_l_e3sm_config, & ! Run model with E3SM settings - clubb_l_vary_convect_depth, & ! Flag used to calculate convective velocity using - ! a variable estimate of layer depth based on the depth - ! over which wpthlp is positive near the ground when true - ! More information can be found by - ! Looking at issue #905 on the clubb repo - clubb_l_use_tke_in_wp3_pr_turb_term,& ! Use TKE formulation for wp3 pr_turb term - clubb_l_use_tke_in_wp2_wp3_K_dfsn, & ! Use TKE in eddy diffusion for wp2 and wp3 - clubb_l_smooth_Heaviside_tau_wpxp, & ! Use smooth Heaviside 'Peskin' in computation of invrs_tau - clubb_l_enable_relaxed_clipping, & ! Flag to relax clipping on wpxp in xm_wpxp_clipping_and_stats - clubb_l_linearize_pbl_winds, & ! Flag to turn on code to linearize PBL winds - clubb_l_single_C2_Skw, & ! Use a single Skewness dependent C2 for rtp2, thlp2, and - ! rtpthlp - clubb_l_damp_wp3_Skw_squared, & ! Set damping on wp3 to use Skw^2 rather than Skw^4 - clubb_l_prescribed_avg_deltaz, & ! used in adj_low_res_nu. If .true., avg_deltaz = deltaz - clubb_l_update_pressure, & ! Flag for having CLUBB update pressure and exner - clubb_l_mono_flux_lim_thlm, & ! Flag to turn on monotonic flux limiter for thlm - clubb_l_mono_flux_lim_rtm, & ! Flag to turn on monotonic flux limiter for rtm - clubb_l_mono_flux_lim_um, & ! Flag to turn on monotonic flux limiter for um - clubb_l_mono_flux_lim_vm, & ! Flag to turn on monotonic flux limiter for vm - clubb_l_mono_flux_lim_spikefix, & ! Flag to implement monotonic flux limiter code that - ! eliminates spurious drying tendencies at model top - clubb_l_intr_sfc_flux_smooth = .false. ! Add a locally calculated roughness to upwp and vpwp sfc fluxes - -! Constant parameters - logical, parameter, private :: & - l_implemented = .true., & ! Implemented in a host model (always true) - l_host_applies_sfc_fluxes = .false. ! Whether the host model applies the surface fluxes - - logical, parameter, private :: & - apply_to_heat = .false. ! Apply WACCM energy fixer to heat or not (.true. = yes (duh)) - - logical :: lq(pcnst) - logical :: prog_modal_aero - logical :: do_rainturb - logical :: clubb_do_adv - logical :: clubb_do_liqsupersat = .false. - logical :: clubb_do_energyfix = .true. - logical :: history_budget - integer :: history_budget_histfile_num - integer :: edsclr_dim ! Number of scalars to transport in CLUBB - integer :: offset - -! define physics buffer indicies here - integer :: & - wp2_idx, & ! vertical velocity variances - wp3_idx, & ! third moment of vertical velocity - wpthlp_idx, & ! turbulent flux of thetal - wprtp_idx, & ! turbulent flux of total water - rtpthlp_idx, & ! covariance of thetal and rt - rtp2_idx, & ! variance of total water - thlp2_idx, & ! variance of thetal - rtp3_idx, & ! total water 3rd order - thlp3_idx, & ! thetal 3rd order - up2_idx, & ! variance of east-west wind - vp2_idx, & ! variance of north-south wind - up3_idx, & ! east-west wind 3rd order - vp3_idx, & ! north-south wind 3rd order - upwp_idx, & ! east-west momentum flux - vpwp_idx, & ! north-south momentum flux - thlm_idx, & ! mean thetal - rtm_idx, & ! mean total water mixing ratio - um_idx, & ! mean of east-west wind - vm_idx, & ! mean of north-south wind - wpthvp_idx, & ! buoyancy flux - wp2thvp_idx, & ! second order buoyancy term - rtpthvp_idx, & ! moisture buoyancy correlation - thlpthvp_idx, & ! temperature buoyancy correlation - sclrpthvp_idx, & ! passive scalar buoyancy correlation - wp2rtp_idx, & ! w'^2 rt' - wp2thlp_idx, & ! w'^2 thl' - uprcp_idx, & ! < u' r_c' > - vprcp_idx, & ! < v' r_c' > - rc_coef_idx, & ! Coefficient of X'r_c' in Eq. (34) - wp4_idx, & ! w'^4 - wpup2_idx, & ! w'u'^2 - wpvp2_idx, & ! w'v'^2 - wp2up2_idx, & ! w'^2 u'^2 - wp2vp2_idx, & ! w'^2 v'^2 - cloud_frac_idx, & ! CLUBB's cloud fraction - cld_idx, & ! Cloud fraction - concld_idx, & ! Convective cloud fraction - ast_idx, & ! Stratiform cloud fraction - alst_idx, & ! Liquid stratiform cloud fraction - aist_idx, & ! Ice stratiform cloud fraction - qlst_idx, & ! Physical in-cloud LWC - qist_idx, & ! Physical in-cloud IWC - dp_frac_idx, & ! deep convection cloud fraction - sh_frac_idx, & ! shallow convection cloud fraction - kvh_idx, & ! CLUBB eddy diffusivity on thermo levels - pblh_idx, & ! PBL pbuf - icwmrdp_idx, & ! In cloud mixing ratio for deep convection - icwmrsh_idx, & ! In cloud mixing ratio for shallow convection (MF) - tke_idx, & ! turbulent kinetic energy - tpert_idx, & ! temperature perturbation from PBL - fice_idx, & ! fice_idx index in physics buffer - cmeliq_idx, & ! cmeliq_idx index in physics buffer - relvar_idx, & ! relative cloud water variance - accre_enhan_idx, & ! optional accretion enhancement factor for MG - npccn_idx, & ! liquid ccn number concentration - naai_idx, & ! ice number concentration - prer_evap_idx, & ! rain evaporation rate - qrl_idx, & ! longwave cooling rate - radf_idx, & - qsatfac_idx, & ! subgrid cloud water saturation scaling factor - ice_supersat_idx, & ! ice cloud fraction for SILHS - rcm_idx, & ! Cloud water mixing ratio for SILHS - ztodt_idx ! physics timestep for SILHS - - ! Indices for microphysical covariance tendencies - integer :: & - rtp2_mc_zt_idx, & - thlp2_mc_zt_idx, & - wprtp_mc_zt_idx, & - wpthlp_mc_zt_idx, & - rtpthlp_mc_zt_idx - - integer :: & ! added pbuf fields for clubb to have restart bfb when ipdf_call_placement=2 - pdf_zm_w_1_idx, & - pdf_zm_w_2_idx, & - pdf_zm_varnce_w_1_idx, & - pdf_zm_varnce_w_2_idx, & - pdf_zm_mixt_frac_idx - - integer, public :: & - ixthlp2 = 0, & - ixwpthlp = 0, & - ixwprtp = 0, & - ixwp2 = 0, & - ixwp3 = 0, & - ixrtpthlp = 0, & - ixrtp2 = 0, & - ixup2 = 0, & - ixvp2 = 0 - - integer :: cmfmc_sh_idx = 0 - - integer :: & - dlfzm_idx = -1, & ! ZM detrained convective cloud water mixing ratio. - difzm_idx = -1, & ! ZM detrained convective cloud ice mixing ratio. - dnlfzm_idx = -1, & ! ZM detrained convective cloud water num concen. - dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. - - integer :: & -!+++ARH - qtm_macmic1_idx, & - qtm_macmic2_idx, & - thlm_macmic1_idx, & - thlm_macmic2_idx, & - rcm_macmic_idx, & - cldfrac_macmic_idx, & - wpthlp_macmic_idx, & - wprtp_macmic_idx, & - wpthvp_macmic_idx, & - mf_wpthlp_macmic_idx, & - mf_wprtp_macmic_idx, & - mf_wpthvp_macmic_idx, & - up_macmic1_idx, & - up_macmic2_idx, & - dn_macmic1_idx, & - dn_macmic2_idx, & - upa_macmic1_idx, & - upa_macmic2_idx, & - dna_macmic1_idx, & - dna_macmic2_idx, & - thlu_macmic1_idx, & - thlu_macmic2_idx, & - qtu_macmic1_idx, & - qtu_macmic2_idx, & - thld_macmic1_idx, & - thld_macmic2_idx, & - qtd_macmic1_idx, & - qtd_macmic2_idx, & - dthl_macmic1_idx, & - dthl_macmic2_idx, & - dqt_macmic1_idx, & - dqt_macmic2_idx, & - dthlu_macmic1_idx, & - dthlu_macmic2_idx, & - dqtu_macmic1_idx, & - dqtu_macmic2_idx, & - dthld_macmic1_idx, & - dthld_macmic2_idx, & - dqtd_macmic1_idx, & - dqtd_macmic2_idx, & - ztop_macmic1_idx, & - ztop_macmic2_idx, & - ddcp_macmic1_idx, & - ddcp_macmic2_idx -!---ARH - - integer :: & - prec_sh_idx, & - snow_sh_idx - - integer :: ztopmn_idx - integer :: ztopma_idx - integer :: ztopm1_macmic_idx - integer :: ddcp_idx - integer :: ddcp_macmic_idx - integer :: ddcpmn_idx - integer :: cbm1_idx - integer :: cbm1_macmic_idx - - ! Output arrays for CLUBB statistics - real(r8), allocatable, dimension(:,:,:) :: out_zt, out_zm, out_radzt, out_radzm, out_sfc - - character(len=16) :: eddy_scheme ! Default set in phys_control.F90 - character(len=16) :: deep_scheme ! Default set in phys_control.F90 - character(len=16) :: subcol_scheme - - integer, parameter :: ncnst=9 - character(len=8) :: cnst_names(ncnst) - logical :: do_cnst=.false. - -#ifdef CLUBB_SGS - type(pdf_parameter), target, allocatable, public, protected :: & - pdf_params_chnk(:) ! PDF parameters (thermo. levs.) [units vary] - - type(pdf_parameter), target, allocatable :: pdf_params_zm_chnk(:) ! PDF parameters on momentum levs. [units vary] - - type(implicit_coefs_terms), target, allocatable :: pdf_implicit_coefs_terms_chnk(:) ! PDF impl. coefs. & expl. terms [units vary] -#endif - - contains - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_register_cam( ) -!------------------------------------------------------------------------------- -! Description: -! Register the constituents and fields in the physics buffer -! Author: P. Bogenschutz, C. Craig, A. Gettelman -! Modified: 7/2013 by K Thayer-Calder to include support for SILHS/subcolumns -! -!------------------------------------------------------------------------------- -#ifdef CLUBB_SGS - - !------------------------------------------------ ! - ! Register physics buffer fields and constituents ! - !------------------------------------------------ ! - - ! Add CLUBB fields to pbuf - use physics_buffer, only: pbuf_add_field, dtype_r8, dyn_time_lvls - use subcol_utils, only: subcol_get_scheme - - integer :: cld_macmic_num_steps - - call phys_getopts( eddy_scheme_out = eddy_scheme, & - deep_scheme_out = deep_scheme, & - history_budget_out = history_budget, & - history_budget_histfile_num_out = history_budget_histfile_num , & - cld_macmic_num_steps_out = cld_macmic_num_steps) - subcol_scheme = subcol_get_scheme() - - if (trim(subcol_scheme) == 'SILHS') then - saturation_equation = "flatau" - else - saturation_equation = "gfdl" ! Goff & Gratch (1946) approximation for SVP - end if - - if (clubb_do_adv) then - cnst_names =(/'THLP2 ','RTP2 ','RTPTHLP','WPTHLP ','WPRTP ','WP2 ','WP3 ','UP2 ','VP2 '/) - do_cnst=.true. - ! If CLUBB moments are advected, do not output them automatically which is typically done. Some moments - ! need a constant added to them before they are advected, thus this would corrupt the output. - ! Users should refer to the "XXXX_CLUBB" (THLP2_CLUBB for instance) output variables for these moments - call cnst_add(trim(cnst_names(1)),0._r8,0._r8,0._r8,ixthlp2,longname='second moment vertical velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(2)),0._r8,0._r8,0._r8,ixrtp2,longname='second moment rtp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(3)),0._r8,0._r8,-999999._r8,ixrtpthlp,longname='covariance rtp thlp',cam_outfld=.false.) - call cnst_add(trim(cnst_names(4)),0._r8,0._r8,-999999._r8,ixwpthlp,longname='CLUBB heat flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(5)),0._r8,0._r8,-999999._r8,ixwprtp,longname='CLUBB moisture flux',cam_outfld=.false.) - call cnst_add(trim(cnst_names(6)),0._r8,0._r8,0._r8,ixwp2,longname='CLUBB wp2',cam_outfld=.false.) - call cnst_add(trim(cnst_names(7)),0._r8,0._r8,-999999._r8,ixwp3,longname='CLUBB 3rd moment vert velocity',cam_outfld=.false.) - call cnst_add(trim(cnst_names(8)),0._r8,0._r8,0._r8,ixup2,longname='CLUBB 2nd moment u wind',cam_outfld=.false.) - call cnst_add(trim(cnst_names(9)),0._r8,0._r8,0._r8,ixvp2,longname='CLUBB 2nd moment v wind',cam_outfld=.false.) - end if - - ! put pbuf_add calls here (see macrop_driver.F90 for sample) use indicies defined at top - call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) - call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) - call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) - call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) - call pbuf_add_field('AST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), ast_idx) - call pbuf_add_field('AIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), aist_idx) - call pbuf_add_field('ALST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), alst_idx) - call pbuf_add_field('QIST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qist_idx) - call pbuf_add_field('QLST', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), qlst_idx) - call pbuf_add_field('CONCLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), concld_idx) - call pbuf_add_field('CLD', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), cld_idx) - call pbuf_add_field('FICE', 'global',dtype_r8, (/pcols,pver/), fice_idx) - call pbuf_add_field('RAD_CLUBB', 'global', dtype_r8, (/pcols,pver/), radf_idx) - call pbuf_add_field('CMELIQ', 'global',dtype_r8, (/pcols,pver/), cmeliq_idx) - call pbuf_add_field('QSATFAC', 'global',dtype_r8, (/pcols,pver/), qsatfac_idx) - - call pbuf_add_field('WP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp2_idx) - call pbuf_add_field('WP3_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wp3_idx) - call pbuf_add_field('WPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wpthlp_idx) - call pbuf_add_field('WPRTP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), wprtp_idx) - call pbuf_add_field('RTPTHLP_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtpthlp_idx) - call pbuf_add_field('RTP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp2_idx) - call pbuf_add_field('THLP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp2_idx) - call pbuf_add_field('UP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up2_idx) - call pbuf_add_field('VP2_nadv', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp2_idx) - - call pbuf_add_field('RTP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtp3_idx) - call pbuf_add_field('THLP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlp3_idx) - call pbuf_add_field('UP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), up3_idx) - call pbuf_add_field('VP3', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vp3_idx) - - call pbuf_add_field('UPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), upwp_idx) - call pbuf_add_field('VPWP', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vpwp_idx) - call pbuf_add_field('THLM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), thlm_idx) - call pbuf_add_field('RTM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), rtm_idx) - call pbuf_add_field('UM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), um_idx) - call pbuf_add_field('VM', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), vm_idx) - - call pbuf_add_field('WPTHVP', 'global', dtype_r8, (/pcols,pverp/), wpthvp_idx) - call pbuf_add_field('WP2THVP', 'global', dtype_r8, (/pcols,pverp/), wp2thvp_idx) - call pbuf_add_field('RTPTHVP', 'global', dtype_r8, (/pcols,pverp/), rtpthvp_idx) - call pbuf_add_field('THLPTHVP', 'global', dtype_r8, (/pcols,pverp/), thlpthvp_idx) - call pbuf_add_field('CLOUD_FRAC', 'global', dtype_r8, (/pcols,pverp/), cloud_frac_idx) -<<<<<<< HEAD - call pbuf_add_field('ISS_FRAC', 'global', dtype_r8, (/pcols,pverp/), ice_supersat_idx) - call pbuf_add_field('RCM', 'global', dtype_r8, (/pcols,pverp/), rcm_idx) - call pbuf_add_field('ZTODT', 'global', dtype_r8, (/pcols/), ztodt_idx) -======= - call pbuf_add_field('ISS_FRAC', 'global', dtype_r8, (/pcols,pverp/), ice_supersat_idx) - call pbuf_add_field('RCM', 'physpkg', dtype_r8, (/pcols,pverp/), rcm_idx) - call pbuf_add_field('ZTODT', 'physpkg', dtype_r8, (/pcols/), ztodt_idx) - call pbuf_add_field('WP2RTP', 'global', dtype_r8, (/pcols,pverp/), wp2rtp_idx) - call pbuf_add_field('WP2THLP', 'global', dtype_r8, (/pcols,pverp/), wp2thlp_idx) - call pbuf_add_field('UPRCP', 'global', dtype_r8, (/pcols,pverp/), uprcp_idx) - call pbuf_add_field('VPRCP', 'global', dtype_r8, (/pcols,pverp/), vprcp_idx) - call pbuf_add_field('RC_COEF', 'global', dtype_r8, (/pcols,pverp/), rc_coef_idx) - call pbuf_add_field('WP4', 'global', dtype_r8, (/pcols,pverp/), wp4_idx) - call pbuf_add_field('WPUP2', 'global', dtype_r8, (/pcols,pverp/), wpup2_idx) - call pbuf_add_field('WPVP2', 'global', dtype_r8, (/pcols,pverp/), wpvp2_idx) - call pbuf_add_field('WP2UP2', 'global', dtype_r8, (/pcols,pverp/), wp2up2_idx) - call pbuf_add_field('WP2VP2', 'global', dtype_r8, (/pcols,pverp/), wp2vp2_idx) ->>>>>>> ESCOMP/cam_development - - ! For SILHS microphysical covariance contributions - call pbuf_add_field('rtp2_mc_zt', 'global', dtype_r8, (/pcols,pverp/), rtp2_mc_zt_idx) - call pbuf_add_field('thlp2_mc_zt','global', dtype_r8, (/pcols,pverp/), thlp2_mc_zt_idx) - call pbuf_add_field('wprtp_mc_zt','global', dtype_r8, (/pcols,pverp/), wprtp_mc_zt_idx) - call pbuf_add_field('wpthlp_mc_zt','global',dtype_r8, (/pcols,pverp/), wpthlp_mc_zt_idx) - call pbuf_add_field('rtpthlp_mc_zt','global',dtype_r8,(/pcols,pverp/), rtpthlp_mc_zt_idx) - -<<<<<<< HEAD - call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') - call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') - -!+++ARH - call pbuf_add_field('qtm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic1_idx) - call pbuf_add_field('qtm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic2_idx) - call pbuf_add_field('thlm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic1_idx) - call pbuf_add_field('thlm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic2_idx) -!---ARH - call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) - call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) - call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) - call pbuf_add_field('WPRTP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthvp_macmic_idx) - call pbuf_add_field('WPTHVP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wprtp_macmic_idx) - if (do_clubb_mf) then - call pbuf_add_field('edmf_thlflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthlp_macmic_idx) - call pbuf_add_field('edmf_qtflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wprtp_macmic_idx) - call pbuf_add_field('edmf_thvflx_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), mf_wpthvp_macmic_idx) - call pbuf_add_field('ZTOPMN' ,'global' , dtype_r8, (/clubb_mf_up_ndt,pcols/), ztopmn_idx) - call pbuf_add_field('ZTOPMA' ,'global' , dtype_r8, (/pcols/), ztopma_idx) - call pbuf_add_field('ZTOP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ztopm1_macmic_idx) - call pbuf_add_field('DDCP' ,'global' , dtype_r8, (/pcols/), ddcp_idx) - call pbuf_add_field('DDCP_MACMIC' ,'physpkg', dtype_r8, (/pcols/), ddcp_macmic_idx) - call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols/), ddcpmn_idx) - call pbuf_add_field('CBM1' ,'global' , dtype_r8, (/pcols/), cbm1_idx) - call pbuf_add_field('CBM1_MACMIC' ,'physpkg', dtype_r8, (/pcols/), cbm1_macmic_idx) -!+++ARH - call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) - call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) - call pbuf_add_field('dn_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) - call pbuf_add_field('dn_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic2_idx) - call pbuf_add_field('upa_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic1_idx) - call pbuf_add_field('upa_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic2_idx) - call pbuf_add_field('dna_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic1_idx) - call pbuf_add_field('dna_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic2_idx) - call pbuf_add_field('thlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic1_idx) - call pbuf_add_field('thlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic2_idx) - call pbuf_add_field('qtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic1_idx) - call pbuf_add_field('qtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic2_idx) - call pbuf_add_field('thld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic1_idx) - call pbuf_add_field('thld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic2_idx) - call pbuf_add_field('qtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic1_idx) - call pbuf_add_field('qtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic2_idx) - call pbuf_add_field('dthl_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic1_idx) - call pbuf_add_field('dthl_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic2_idx) - call pbuf_add_field('dqt_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic1_idx) - call pbuf_add_field('dqt_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic2_idx) - call pbuf_add_field('dthlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic1_idx) - call pbuf_add_field('dthlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic2_idx) - call pbuf_add_field('dqtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic1_idx) - call pbuf_add_field('dqtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic2_idx) - call pbuf_add_field('dthld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic1_idx) - call pbuf_add_field('dthld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic2_idx) - call pbuf_add_field('dqtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic1_idx) - call pbuf_add_field('dqtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic2_idx) - call pbuf_add_field('ztop_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic1_idx) - call pbuf_add_field('ztop_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) - call pbuf_add_field('ddcp_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) - call pbuf_add_field('ddcp_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) -!---ARH - end if -======= - call pbuf_add_field('pdf_zm_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_1_idx) - call pbuf_add_field('pdf_zm_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_w_2_idx) - call pbuf_add_field('pdf_zm_var_w_1', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_1_idx) - call pbuf_add_field('pdf_zm_var_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_2_idx) - call pbuf_add_field('pdf_zm_mixt_frac', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_mixt_frac_idx) ->>>>>>> ESCOMP/cam_development - -#endif - - end subroutine clubb_register_cam - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -function clubb_implements_cnst(name) - - !----------------------------------------------------------------------------- ! - ! ! - ! Return true if specified constituent is implemented by this package ! - ! ! - !----------------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - logical :: clubb_implements_cnst ! return value - - !----------------------------------------------------------------------- - - clubb_implements_cnst = (do_cnst .and. any(name == cnst_names)) - -end function clubb_implements_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -subroutine clubb_init_cnst(name, latvals, lonvals, mask, q) -#ifdef CLUBB_SGS - use clubb_api_module, only: w_tol_sqd, rt_tol, thl_tol -#endif - - !----------------------------------------------------------------------- ! - ! ! - ! Initialize the state if clubb_do_adv ! - ! ! - !----------------------------------------------------------------------- ! - - character(len=*), intent(in) :: name ! constituent name - real(r8), intent(in) :: latvals(:) ! lat in degrees (ncol) - real(r8), intent(in) :: lonvals(:) ! lon in degrees (ncol) - logical, intent(in) :: mask(:) ! Only initialize where .true. - real(r8), intent(out) :: q(:,:) ! kg tracer/kg dry air (gcol, plev - - !----------------------------------------------------------------------- - integer :: k, nlev - -#ifdef CLUBB_SGS - if (clubb_do_adv) then - nlev = size(q, 2) - do k = 1, nlev - if (trim(name) == trim(cnst_names(1))) then - where(mask) - q(:,k) = thl_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(2))) then - where(mask) - q(:,k) = rt_tol**2 - end where - end if - if (trim(name) == trim(cnst_names(3))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(4))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(5))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(6))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(7))) then - where(mask) - q(:,k) = 0.0_r8 - end where - end if - if (trim(name) == trim(cnst_names(8))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - if (trim(name) == trim(cnst_names(9))) then - where(mask) - q(:,k) = w_tol_sqd - end where - end if - end do - end if -#endif - -end subroutine clubb_init_cnst - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_readnl(nlfile) - -#ifdef CLUBB_SGS - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use cam_abortutils, only: endrun - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_logical, mpi_real8, & - mpi_integer - use clubb_mf, only: clubb_mf_readnl - - use clubb_api_module, only: & - set_default_clubb_config_flags_api, & ! Procedure(s) - initialize_clubb_config_flags_type_api, & - l_stats, l_output_rad_files -#endif - - character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input - -#ifdef CLUBB_SGS - - character(len=*), parameter :: sub = 'clubb_readnl' - - logical :: clubb_history = .false., clubb_rad_history = .false. ! Stats enabled (T/F) - logical :: clubb_cloudtop_cooling = .false., clubb_rainevap_turb = .false. - - integer :: iunit, read_status, ierr - - namelist /clubb_his_nl/ clubb_history, clubb_rad_history - namelist /clubbpbl_diff_nl/ clubb_cloudtop_cooling, clubb_rainevap_turb, & - clubb_do_adv, clubb_timestep, & - clubb_rnevap_effic,clubb_do_icesuper - namelist /clubb_params_nl/ clubb_beta, & - clubb_c1, & - clubb_c1b, & - clubb_c11, & - clubb_c11b, & - clubb_c14, & - clubb_C2rt, & - clubb_C2rtthl, & - clubb_C2thl, & - clubb_C4, & - clubb_c6rt, & - clubb_c6rtb, & - clubb_c6rtc, & - clubb_c6thl, & - clubb_c6thlb, & - clubb_c6thlc, & - clubb_C7, & - clubb_C7b, & - clubb_C8, & - clubb_C8b, & - clubb_C_invrs_tau_bkgnd, & - clubb_C_invrs_tau_sfc, & - clubb_C_invrs_tau_shear, & - clubb_C_invrs_tau_N2, & - clubb_C_invrs_tau_N2_clear_wp3, & - clubb_C_invrs_tau_N2_wp2, & - clubb_C_invrs_tau_N2_wpxp, & - clubb_C_invrs_tau_N2_xp2, & - clubb_c_K1, & - clubb_c_K10, & - clubb_c_K10h, & - clubb_c_K2, & - clubb_c_K8, & - clubb_c_K9, & - clubb_C_uu_shr, & - clubb_C_uu_buoy, & - clubb_C_wp2_splat, & - clubb_C_wp3_pr_turb, & - clubb_detice_rad, & - clubb_detliq_rad, & - clubb_detphase_lowtemp, & - clubb_do_energyfix, & - clubb_do_liqsupersat, & - clubb_gamma_coef, & - clubb_gamma_coefb, & - clubb_ipdf_call_placement, & - clubb_lambda0_stability_coef, & - clubb_lmin_coef, & - clubb_l_brunt_vaisala_freq_moist, & - clubb_l_call_pdf_closure_twice, & - clubb_l_damp_wp2_using_em, & - clubb_l_damp_wp3_Skw_squared, & - clubb_l_diag_Lscale_from_tau, & - clubb_l_do_expldiff_rtm_thlm, & - clubb_l_e3sm_config, & - clubb_l_enable_relaxed_clipping, & - clubb_l_godunov_upwind_wpxp_ta, & - clubb_l_godunov_upwind_xpyp_ta, & - clubb_l_intr_sfc_flux_smooth, & - clubb_l_lmm_stepping, & - clubb_l_lscale_plume_centered, & - clubb_l_min_wp2_from_corr_wx, & - clubb_l_min_xp2_from_corr_wx, & - clubb_l_mono_flux_lim_rtm, & - clubb_l_mono_flux_lim_spikefix, & - clubb_l_mono_flux_lim_thlm, & - clubb_l_mono_flux_lim_um, & - clubb_l_mono_flux_lim_vm, & - clubb_l_partial_upwind_wp3, & - clubb_l_predict_upwp_vpwp, & - clubb_l_rcm_supersat_adj, & - clubb_l_smooth_Heaviside_tau_wpxp, & - clubb_l_stability_correct_tau_zm, & - clubb_l_standard_term_ta, & - clubb_l_trapezoidal_rule_zm, & - clubb_l_trapezoidal_rule_zt, & - clubb_l_upwind_xpyp_ta, & - clubb_l_use_C11_Richardson, & - clubb_l_use_C7_Richardson, & - clubb_l_use_cloud_cover, & - clubb_l_use_shear_Richardson, & - clubb_l_use_thvm_in_bv_freq, & - clubb_l_use_tke_in_wp2_wp3_K_dfsn, & - clubb_l_use_tke_in_wp3_pr_turb_term, & - clubb_l_vary_convect_depth, & - clubb_l_vert_avg_closure, & - clubb_mult_coef, & - clubb_nu2, & - clubb_nu9, & - clubb_penta_solve_method, & - clubb_Skw_denom_coef, & - clubb_skw_max_mag, & - clubb_tridiag_solve_method, & - clubb_up2_sfc_coef, & - clubb_wpxp_L_thresh - - !----- Begin Code ----- - - ! Determine if we want clubb_history to be output - clubb_history = .false. ! Initialize to false - l_stats = .false. ! Initialize to false - l_output_rad_files = .false. ! Initialize to false - do_cldcool = .false. ! Initialize to false - do_rainturb = .false. ! Initialize to false - - ! Initialize namelist variables to clubb defaults - call set_default_clubb_config_flags_api( clubb_iiPDF_type, & ! Out - clubb_ipdf_call_placement, & ! Out - clubb_penta_solve_method, & ! Out - clubb_tridiag_solve_method, & ! Out - clubb_l_use_precip_frac, & ! Out - clubb_l_predict_upwp_vpwp, & ! Out - clubb_l_min_wp2_from_corr_wx, & ! Out - clubb_l_min_xp2_from_corr_wx, & ! Out - clubb_l_C2_cloud_frac, & ! Out - clubb_l_diffuse_rtm_and_thlm, & ! Out - clubb_l_stability_correct_Kh_N2_zm, & ! Out - clubb_l_calc_thlp2_rad, & ! Out - clubb_l_upwind_xpyp_ta, & ! Out - clubb_l_upwind_xm_ma, & ! Out - clubb_l_uv_nudge, & ! Out - clubb_l_rtm_nudge, & ! Out - clubb_l_tke_aniso, & ! Out - clubb_l_vert_avg_closure, & ! Out - clubb_l_trapezoidal_rule_zt, & ! Out - clubb_l_trapezoidal_rule_zm, & ! Out - clubb_l_call_pdf_closure_twice, & ! Out - clubb_l_standard_term_ta, & ! Out - clubb_l_partial_upwind_wp3, & ! Out - clubb_l_godunov_upwind_wpxp_ta, & ! Out - clubb_l_godunov_upwind_xpyp_ta, & ! Out - clubb_l_use_cloud_cover, & ! Out - clubb_l_diagnose_correlations, & ! Out - clubb_l_calc_w_corr, & ! Out - clubb_l_const_Nc_in_cloud, & ! Out - clubb_l_fix_w_chi_eta_correlations, & ! Out - clubb_l_stability_correct_tau_zm, & ! Out - clubb_l_damp_wp2_using_em, & ! Out - clubb_l_do_expldiff_rtm_thlm, & ! Out - clubb_l_Lscale_plume_centered, & ! Out - clubb_l_diag_Lscale_from_tau, & ! Out - clubb_l_use_C7_Richardson, & ! Out - clubb_l_use_C11_Richardson, & ! Out - clubb_l_use_shear_Richardson, & ! Out - clubb_l_brunt_vaisala_freq_moist, & ! Out - clubb_l_use_thvm_in_bv_freq, & ! Out - clubb_l_rcm_supersat_adj, & ! Out - clubb_l_damp_wp3_Skw_squared, & ! Out - clubb_l_prescribed_avg_deltaz, & ! Out - clubb_l_lmm_stepping, & ! Out - clubb_l_e3sm_config, & ! Out - clubb_l_vary_convect_depth, & ! Out - clubb_l_use_tke_in_wp3_pr_turb_term, & ! Out - clubb_l_use_tke_in_wp2_wp3_K_dfsn, & ! Out - clubb_l_smooth_Heaviside_tau_wpxp, & ! Out - clubb_l_enable_relaxed_clipping, & ! Out - clubb_l_linearize_pbl_winds, & ! Out - clubb_l_mono_flux_lim_thlm, & ! Out - clubb_l_mono_flux_lim_rtm, & ! Out - clubb_l_mono_flux_lim_um, & ! Out - clubb_l_mono_flux_lim_vm, & ! Out - clubb_l_mono_flux_lim_spikefix ) ! Out - - ! Call CLUBB+MF namelist - call clubb_mf_readnl(nlfile) - - ! Read namelist to determine if CLUBB history should be called - if (masterproc) then - iunit = getunit() - open( iunit, file=trim(nlfile), status='old' ) - - call find_group_name(iunit, 'clubb_his_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_his_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - call find_group_name(iunit, 'clubb_params_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_params_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - else - call endrun('clubb_readnl: error reading namelist') - end if - - call find_group_name(iunit, 'clubbpbl_diff_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubbpbl_diff_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('clubb_readnl: error reading namelist') - end if - end if - - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_history") - call mpi_bcast(clubb_rad_history, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rad_history") - call mpi_bcast(clubb_do_icesuper, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_icesuper") - call mpi_bcast(clubb_cloudtop_cooling, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_cloudtop_cooling") - call mpi_bcast(clubb_rainevap_turb, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rainevap_turb") - call mpi_bcast(clubb_do_adv, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_adv") - call mpi_bcast(clubb_timestep, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_timestep") - call mpi_bcast(clubb_rnevap_effic, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_rnevap_effic") - - call mpi_bcast(clubb_c1, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1") - call mpi_bcast(clubb_c1b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c1b") - call mpi_bcast(clubb_c11, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11") - call mpi_bcast(clubb_c11b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c11b") - call mpi_bcast(clubb_c14, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c14") - call mpi_bcast(clubb_C_wp3_pr_turb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp3_pr_turb") - call mpi_bcast(clubb_c6rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rt") - call mpi_bcast(clubb_c6rtb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtb") - call mpi_bcast(clubb_c6rtc, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6rtc") - call mpi_bcast(clubb_c6thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thl") - call mpi_bcast(clubb_c6thlb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlb") - call mpi_bcast(clubb_c6thlc, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c6thlc") - call mpi_bcast(clubb_wpxp_L_thresh, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_wpxp_L_thresh") - call mpi_bcast(clubb_mult_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mult_coef") - call mpi_bcast(clubb_gamma_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coef") - call mpi_bcast(clubb_c_K10, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10") - call mpi_bcast(clubb_c_K10h, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K10h") - call mpi_bcast(clubb_beta, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_beta") - call mpi_bcast(clubb_C2rt, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rt") - call mpi_bcast(clubb_C2thl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2thl") - call mpi_bcast(clubb_C2rtthl, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C2rtthl") - call mpi_bcast(clubb_C8, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8") - call mpi_bcast(clubb_C8b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C8b") - call mpi_bcast(clubb_C7, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7") - call mpi_bcast(clubb_C7b, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C7b") - call mpi_bcast(clubb_Skw_denom_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_Skw_denom_coef") - call mpi_bcast(clubb_C4, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C4") - call mpi_bcast(clubb_C_uu_shr, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_uu_shr") - call mpi_bcast(clubb_C_uu_buoy, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_uu_buoy") - call mpi_bcast(clubb_c_K1, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K1") - call mpi_bcast(clubb_c_K2, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K2") - call mpi_bcast(clubb_nu2, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu2") - call mpi_bcast(clubb_c_K8, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K8") - call mpi_bcast(clubb_c_K9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_c_K9") - call mpi_bcast(clubb_nu9, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_nu9") - call mpi_bcast(clubb_C_wp2_splat, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_wp2_splat") - call mpi_bcast(clubb_lambda0_stability_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lambda0_stability_coef") - call mpi_bcast(clubb_l_lscale_plume_centered,1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lscale_plume_centered") - call mpi_bcast(clubb_do_liqsupersat, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_liqsupersat") - call mpi_bcast(clubb_do_energyfix, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_do_energyfix") - call mpi_bcast(clubb_C_invrs_tau_bkgnd, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_bkgnd") - call mpi_bcast(clubb_C_invrs_tau_sfc, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_sfc") - call mpi_bcast(clubb_C_invrs_tau_shear, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_shear") - call mpi_bcast(clubb_C_invrs_tau_N2, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_N2") - call mpi_bcast(clubb_C_invrs_tau_N2_wp2, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_N2_wp2") - call mpi_bcast(clubb_C_invrs_tau_N2_xp2, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_N2_xp2") - call mpi_bcast(clubb_C_invrs_tau_N2_wpxp, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_N2_wpxp") - call mpi_bcast(clubb_C_invrs_tau_N2_clear_wp3, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_C_invrs_tau_N2_clear_wp3") - call mpi_bcast(clubb_lmin_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_lmin_coef") - call mpi_bcast(clubb_skw_max_mag, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_skw_max_mag") - call mpi_bcast(clubb_l_stability_correct_tau_zm, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_stability_correct_tau_zm") - call mpi_bcast(clubb_gamma_coefb, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_gamma_coefb") - call mpi_bcast(clubb_up2_sfc_coef, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_up2_sfc_coef") - call mpi_bcast(clubb_detliq_rad, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detliq_rad") - call mpi_bcast(clubb_detice_rad, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detice_rad") - call mpi_bcast(clubb_detphase_lowtemp, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_detphase_lowtemp") - - call mpi_bcast(clubb_l_use_C7_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C7_Richardson") - call mpi_bcast(clubb_l_use_C11_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_C11_Richardson") - call mpi_bcast(clubb_l_use_shear_Richardson, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_shear_Richardson") - call mpi_bcast(clubb_l_brunt_vaisala_freq_moist, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_brunt_vaisala_freq_moist") - call mpi_bcast(clubb_l_use_thvm_in_bv_freq, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_thvm_in_bv_freq") - call mpi_bcast(clubb_l_rcm_supersat_adj, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_rcm_supersat_adj") - call mpi_bcast(clubb_l_damp_wp3_Skw_squared, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp3_Skw_squared") - call mpi_bcast(clubb_l_predict_upwp_vpwp, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_predict_upwp_vpwp") - call mpi_bcast(clubb_l_min_wp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_wp2_from_corr_wx") - call mpi_bcast(clubb_l_min_xp2_from_corr_wx, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_min_xp2_from_corr_wx") - call mpi_bcast(clubb_l_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_upwind_xpyp_ta") - call mpi_bcast(clubb_l_godunov_upwind_wpxp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_godunov_upwind_wpxp_ta") - call mpi_bcast(clubb_l_godunov_upwind_xpyp_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_godunov_upwind_xpyp_ta") - call mpi_bcast(clubb_l_vert_avg_closure, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vert_avg_closure") - call mpi_bcast(clubb_l_trapezoidal_rule_zt, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zt") - call mpi_bcast(clubb_l_trapezoidal_rule_zm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_trapezoidal_rule_zm") - call mpi_bcast(clubb_l_call_pdf_closure_twice, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_call_pdf_closure_twice") - call mpi_bcast(clubb_l_use_cloud_cover, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_cloud_cover") - call mpi_bcast(clubb_l_diag_Lscale_from_tau, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_diag_Lscale_from_tau") - call mpi_bcast(clubb_l_damp_wp2_using_em, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_damp_wp2_using_em") - call mpi_bcast(clubb_l_do_expldiff_rtm_thlm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_do_expldiff_rtm_thlm") - call mpi_bcast(clubb_l_lmm_stepping, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_lmm_stepping") - call mpi_bcast(clubb_l_e3sm_config, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_e3sm_config") - call mpi_bcast(clubb_l_enable_relaxed_clipping, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_enable_relaxed_clipping") - call mpi_bcast(clubb_l_use_tke_in_wp3_pr_turb_term, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_tke_in_wp3_pr_turb_term") - call mpi_bcast(clubb_l_use_tke_in_wp2_wp3_K_dfsn, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_use_tke_in_wp2_wp3_K_dfsn") - call mpi_bcast(clubb_l_smooth_Heaviside_tau_wpxp, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_smooth_Heaviside_tau_wpxp") - call mpi_bcast(clubb_ipdf_call_placement, 1, mpi_integer, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_ipdf_call_placement") - call mpi_bcast(clubb_l_mono_flux_lim_thlm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_mono_flux_lim_thlm") - call mpi_bcast(clubb_l_mono_flux_lim_rtm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_mono_flux_lim_rtm") - call mpi_bcast(clubb_l_mono_flux_lim_um, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_mono_flux_lim_um") - call mpi_bcast(clubb_l_mono_flux_lim_vm, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_mono_flux_lim_vm") - call mpi_bcast(clubb_l_mono_flux_lim_spikefix, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_mono_flux_lim_spikefix") - call mpi_bcast(clubb_penta_solve_method, 1, mpi_integer, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_penta_solve_method") - call mpi_bcast(clubb_tridiag_solve_method, 1, mpi_integer, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_tridiag_solve_method") - call mpi_bcast(clubb_l_intr_sfc_flux_smooth, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_intr_sfc_flux_smooth") - call mpi_bcast(clubb_l_vary_convect_depth, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_vary_convect_depth") - call mpi_bcast(clubb_l_standard_term_ta, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_standard_term_ta") - call mpi_bcast(clubb_l_partial_upwind_wp3, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_l_partial_upwind_wp3") - - ! Overwrite defaults if they are true - if (clubb_history) l_stats = .true. - if (clubb_rad_history) l_output_rad_files = .true. - if (clubb_cloudtop_cooling) do_cldcool = .true. - if (clubb_rainevap_turb) do_rainturb = .true. - - ! Check that all namelists have been set - if(clubb_timestep == unset_r8) call endrun(sub//": FATAL: clubb_timestep is not set") - if(clubb_rnevap_effic == unset_r8) call endrun(sub//": FATAL:clubb_rnevap_effic is not set") - - if(clubb_c1 == unset_r8) call endrun(sub//": FATAL: clubb_c1 is not set") - if(clubb_c1b == unset_r8) call endrun(sub//": FATAL: clubb_c1b is not set") - if(clubb_C2rt == unset_r8) call endrun(sub//": FATAL: clubb_C2rt is not set") - if(clubb_C2thl == unset_r8) call endrun(sub//": FATAL: clubb_C2thl is not set") - if(clubb_C2rtthl == unset_r8) call endrun(sub//": FATAL: clubb_C2rtthl is not set") - if(clubb_C4 == unset_r8) call endrun(sub//": FATAL: clubb_C4 is not set") - if(clubb_C_uu_shr == unset_r8) call endrun(sub//": FATAL: clubb_C_uu_shr is not set") - if(clubb_C_uu_buoy == unset_r8) call endrun(sub//": FATAL: clubb_C_uu_buoy is not set") - if(clubb_c6rt == unset_r8) call endrun(sub//": FATAL: clubb_c6rt is not set") - if(clubb_c6rtb == unset_r8) call endrun(sub//": FATAL: clubb_c6rtb is not set") - if(clubb_c6rtc == unset_r8) call endrun(sub//": FATAL: clubb_c6rtc is not set") - if(clubb_c6thl == unset_r8) call endrun(sub//": FATAL: clubb_c6thl is not set") - if(clubb_c6thlb == unset_r8) call endrun(sub//": FATAL: clubb_c6thlb is not set") - if(clubb_c6thlc == unset_r8) call endrun(sub//": FATAL: clubb_c6thlc is not set") - if(clubb_wpxp_L_thresh == unset_r8) call endrun(sub//": FATAL: clubb_wpxp_L_thresh is not set") - if(clubb_C8 == unset_r8) call endrun(sub//": FATAL: clubb_C8 is not set") - if(clubb_C8b == unset_r8) call endrun(sub//": FATAL: clubb_C8b is not set") - if(clubb_C7 == unset_r8) call endrun(sub//": FATAL: clubb_C7 is not set") - if(clubb_C7b == unset_r8) call endrun(sub//": FATAL: clubb_C7b is not set") - if(clubb_c11 == unset_r8) call endrun(sub//": FATAL: clubb_c11 is not set") - if(clubb_c11b == unset_r8) call endrun(sub//": FATAL: clubb_c11b is not set") - if(clubb_c14 == unset_r8) call endrun(sub//": FATAL: clubb_c14 is not set") - if(clubb_C_wp3_pr_turb == unset_r8) call endrun(sub//": FATAL: clubb_C_wp3_pr_turb is not set") - if(clubb_c_K1 == unset_r8) call endrun(sub//": FATAL: clubb_c_K1 is not set") - if(clubb_c_K2 == unset_r8) call endrun(sub//": FATAL: clubb_c_K2 is not set") - if(clubb_nu2 == unset_r8) call endrun(sub//": FATAL: clubb_nu2 is not set") - if(clubb_c_K8 == unset_r8) call endrun(sub//": FATAL: clubb_c_K8 is not set") - if(clubb_c_K9 == unset_r8) call endrun(sub//": FATAL: clubb_c_K9 is not set") - if(clubb_nu9 == unset_r8) call endrun(sub//": FATAL: clubb_nu9 is not set") - if(clubb_c_K10 == unset_r8) call endrun(sub//": FATAL: clubb_c_K10 is not set") - if(clubb_c_K10h == unset_r8) call endrun(sub//": FATAL: clubb_c_K10h is not set") - if(clubb_C_invrs_tau_bkgnd == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_bkgnd is not set") - if(clubb_C_invrs_tau_sfc == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_sfc is not set") - if(clubb_C_invrs_tau_shear == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_shear is not set") - if(clubb_C_invrs_tau_N2 == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_N2 is not set") - if(clubb_C_invrs_tau_N2_wp2 == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_N2_wp2 is not set") - if(clubb_C_invrs_tau_N2_xp2 == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_N2_xp2 is not set") - if(clubb_C_invrs_tau_N2_wpxp == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_N2_wpxp is not set") - if(clubb_C_invrs_tau_N2_clear_wp3 == unset_r8) call endrun(sub//": FATAL: clubb_C_invrs_tau_N2_clear_wp3 is not set") - if(clubb_gamma_coef == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coef is not set") - if(clubb_gamma_coefb == unset_r8) call endrun(sub//": FATAL: clubb_gamma_coefb is not set") - if(clubb_beta == unset_r8) call endrun(sub//": FATAL: clubb_beta is not set") - if(clubb_lambda0_stability_coef == unset_r8) call endrun(sub//": FATAL: clubb_lambda0_stability_coef is not set") - if(clubb_lmin_coef == unset_r8) call endrun(sub//": FATAL: clubb_lmin_coef is not set") - if(clubb_mult_coef == unset_r8) call endrun(sub//": FATAL: clubb_mult_coef is not set") - if(clubb_Skw_denom_coef == unset_r8) call endrun(sub//": FATAL: clubb_Skw_denom_coef is not set") - if(clubb_skw_max_mag == unset_r8) call endrun(sub//": FATAL: clubb_skw_max_mag is not set") - if(clubb_up2_sfc_coef == unset_r8) call endrun(sub//": FATAL: clubb_up2_sfc_coef is not set") - if(clubb_C_wp2_splat == unset_r8) call endrun(sub//": FATAL: clubb_C_wp2_splatis not set") - if(clubb_detliq_rad == unset_r8) call endrun(sub//": FATAL: clubb_detliq_rad not set") - if(clubb_detice_rad == unset_r8) call endrun(sub//": FATAL: clubb_detice_rad not set") - if(clubb_ipdf_call_placement == unset_i) call endrun(sub//": FATAL: clubb_ipdf_call_placement not set") - if(clubb_detphase_lowtemp == unset_r8) call endrun(sub//": FATAL: clubb_detphase_lowtemp not set") - if(clubb_penta_solve_method == unset_i) call endrun(sub//": FATAL: clubb_penta_solve_method not set") - if(clubb_tridiag_solve_method == unset_i) call endrun(sub//": FATAL: clubb_tridiag_solve_method not set") - if(clubb_detphase_lowtemp >= meltpt_temp) & - call endrun(sub//": ERROR: clubb_detphase_lowtemp must be less than 268.15 K") - - call initialize_clubb_config_flags_type_api( clubb_iiPDF_type, & ! In - clubb_ipdf_call_placement, & ! In - clubb_penta_solve_method, & ! In - clubb_tridiag_solve_method, & ! In - clubb_l_use_precip_frac, & ! In - clubb_l_predict_upwp_vpwp, & ! In - clubb_l_min_wp2_from_corr_wx, & ! In - clubb_l_min_xp2_from_corr_wx, & ! In - clubb_l_C2_cloud_frac, & ! In - clubb_l_diffuse_rtm_and_thlm, & ! In - clubb_l_stability_correct_Kh_N2_zm, & ! In - clubb_l_calc_thlp2_rad, & ! In - clubb_l_upwind_xpyp_ta, & ! In - clubb_l_upwind_xm_ma, & ! In - clubb_l_uv_nudge, & ! In - clubb_l_rtm_nudge, & ! In - clubb_l_tke_aniso, & ! In - clubb_l_vert_avg_closure, & ! In - clubb_l_trapezoidal_rule_zt, & ! In - clubb_l_trapezoidal_rule_zm, & ! In - clubb_l_call_pdf_closure_twice, & ! In - clubb_l_standard_term_ta, & ! In - clubb_l_partial_upwind_wp3, & ! In - clubb_l_godunov_upwind_wpxp_ta, & ! In - clubb_l_godunov_upwind_xpyp_ta, & ! In - clubb_l_use_cloud_cover, & ! In - clubb_l_diagnose_correlations, & ! In - clubb_l_calc_w_corr, & ! In - clubb_l_const_Nc_in_cloud, & ! In - clubb_l_fix_w_chi_eta_correlations, & ! In - clubb_l_stability_correct_tau_zm, & ! In - clubb_l_damp_wp2_using_em, & ! In - clubb_l_do_expldiff_rtm_thlm, & ! In - clubb_l_Lscale_plume_centered, & ! In - clubb_l_diag_Lscale_from_tau, & ! In - clubb_l_use_C7_Richardson, & ! In - clubb_l_use_C11_Richardson, & ! In - clubb_l_use_shear_Richardson, & ! In - clubb_l_brunt_vaisala_freq_moist, & ! In - clubb_l_use_thvm_in_bv_freq, & ! In - clubb_l_rcm_supersat_adj, & ! In - clubb_l_damp_wp3_Skw_squared, & ! In - clubb_l_prescribed_avg_deltaz, & ! In - clubb_l_lmm_stepping, & ! In - clubb_l_e3sm_config, & ! In - clubb_l_vary_convect_depth, & ! In - clubb_l_use_tke_in_wp3_pr_turb_term, & ! In - clubb_l_use_tke_in_wp2_wp3_K_dfsn, & ! In - clubb_l_smooth_Heaviside_tau_wpxp, & ! In - clubb_l_enable_relaxed_clipping, & ! In - clubb_l_linearize_pbl_winds, & ! In - clubb_l_mono_flux_lim_thlm, & ! In - clubb_l_mono_flux_lim_rtm, & ! In - clubb_l_mono_flux_lim_um, & ! In - clubb_l_mono_flux_lim_vm, & ! In - clubb_l_mono_flux_lim_spikefix, & ! In - clubb_config_flags ) ! Out - -#endif - end subroutine clubb_readnl - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - subroutine clubb_ini_cam(pbuf2d) -!------------------------------------------------------------------------------- -! Description: -! Initialize UWM CLUBB. -! Author: Cheryl Craig March 2011 -! Modifications: Pete Bogenschutz 2011 March and onward -! Modifications: K Thayer-Calder 2013 July and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - - -#ifdef CLUBB_SGS - - ! From CAM libraries - use cam_history, only: addfld, add_default, horiz_only - use ref_pres, only: pref_mid - use hb_diff, only: init_hb_diff - use rad_constituents, only: rad_cnst_get_info, rad_cnst_get_mode_num_idx, rad_cnst_get_mam_mmr_idx - use cam_abortutils, only: endrun - - ! These are needed to set parameters - use clubb_api_module, only: & - core_rknd, em_min, & - ilambda0_stability_coef, ic_K10, ic_K10h, iC7, iC7b, iC8, iC8b, iC11, iC11b, iC4, iC_uu_shr, iC_uu_buoy, & - iC1, iC1b, iC6rt, iC6rtb, iC6rtc, iC6thl, iC6thlb, iC6thlc, iup2_sfc_coef, iwpxp_L_thresh, & - iC14, iC_wp3_pr_turb, igamma_coef, igamma_coefb, imult_coef, ilmin_coef, & - iSkw_denom_coef, ibeta, iskw_max_mag, & - iC_invrs_tau_bkgnd,iC_invrs_tau_sfc,iC_invrs_tau_shear,iC_invrs_tau_N2,iC_invrs_tau_N2_wp2, & - iC_invrs_tau_N2_xp2,iC_invrs_tau_N2_wpxp,iC_invrs_tau_N2_clear_wp3,iC_uu_shr,iC_uu_buoy, & - iC2rt, iC2thl, iC2rtthl, ic_K1, ic_K2, inu2, ic_K8, ic_K9, inu9, iC_wp2_splat, params_list - - use clubb_api_module, only: & - print_clubb_config_flags_api, & - setup_clubb_core_api, & - init_pdf_params_api, & - time_precision, & - core_rknd, & - set_clubb_debug_level_api, & - clubb_fatal_error, & ! Error code value to indicate a fatal error - nparams, & - set_default_parameters_api, & - read_parameters_api, & - l_stats, & - l_stats_samp, & - l_grads, & - w_tol_sqd, & - rt_tol, & - thl_tol - - ! These are only needed if we're using a passive scalar - use clubb_api_module, only: & - iisclr_rt, & - iisclr_thl, & - iisclr_CO2, & - iiedsclr_rt, & - iiedsclr_thl, & - iiedsclr_CO2 - - use time_manager, only: is_first_step - use clubb_api_module, only: hydromet_dim - use constituents, only: cnst_get_ind - use phys_control, only: phys_getopts - use spmd_utils, only: iam - use cam_logfile, only: iulog -#endif - - use physics_buffer, only: pbuf_get_index, pbuf_set_field, physics_buffer_desc - implicit none - ! Input Variables - type(physics_buffer_desc), pointer :: pbuf2d(:,:) - -#ifdef CLUBB_SGS - - real(kind=time_precision) :: dum1, dum2, dum3 - - ! The similar name to clubb_history is unfortunate... - logical :: history_amwg, history_clubb - - integer :: cld_macmic_num_steps - - integer :: err_code ! Code for when CLUBB fails - integer :: i, j, k, l ! Indices - integer :: ntop_eddy ! Top interface level to which eddy vertical diffusion is applied ( = 1 ) - integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) - integer :: nmodes, nspec, m - integer :: ixq, ixcldice, ixcldliq, ixnumliq, ixnumice - integer :: lptr - - logical, parameter :: l_input_fields = .false. ! Always false for CAM-CLUBB. - logical, parameter :: l_update_pressure = .false. ! Always false for CAM-CLUBB. - - integer :: nlev - - real(r8) :: & - C1, C1b, C1c, C2rt, C2thl, C2rtthl, & - C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, C6thl, C6thlb, C6thlc, & - C7, C7b, C7c, C8, C8b, C10, & - C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, & - C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, & - C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, & - c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, & - c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, & - slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, & - coef_spread_DG_means_rt, coef_spread_DG_means_thl, & - gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, & - omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, & - lambda0_stability_coef, mult_coef, taumin, taumax, Lscale_mu_coef, & - Lscale_pert_coef, alpha_corr, Skw_denom_coef, c_K10, c_K10h, & - thlp2_rad_coef, thlp2_rad_cloud_frac_thresh, up2_sfc_coef, & - Skw_max_mag, xp3_coef_base, xp3_coef_slope, altitude_threshold, & - rtp2_clip_coef, C_invrs_tau_bkgnd, C_invrs_tau_sfc, & - C_invrs_tau_shear, C_invrs_tau_N2, C_invrs_tau_N2_wp2, & - C_invrs_tau_N2_xp2, C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, & - C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, & - Cx_min, Cx_max, Richardson_num_min, Richardson_num_max, a3_coef_min - - !----- Begin Code ----- - - nlev = pver + 1 - top_lev - - if (core_rknd /= r8) then - call endrun('clubb_ini_cam: CLUBB library core_rknd must match CAM r8 and it does not') - end if - - ! Allocate PDF parameters across columns and chunks - allocate( & - pdf_params_chnk(begchunk:endchunk), & - pdf_params_zm_chnk(begchunk:endchunk), & - pdf_implicit_coefs_terms_chnk(begchunk:endchunk) ) - - ! ----------------------------------------------------------------- ! - ! Determine how many constituents CLUBB will transport. Note that - ! CLUBB does not transport aerosol consituents. Therefore, need to - ! determine how many aerosols constituents there are and subtract that - ! off of pcnst (the total consituents) - ! ----------------------------------------------------------------- ! - - call phys_getopts(prog_modal_aero_out=prog_modal_aero, & - history_amwg_out=history_amwg, & - history_clubb_out=history_clubb, & - cld_macmic_num_steps_out=cld_macmic_num_steps) - - ! Select variables to apply tendencies back to CAM - - ! Initialize all consituents to true to start - lq(1:pcnst) = .true. - edsclr_dim = pcnst - - call cnst_get_ind('Q',ixq) - call cnst_get_ind('NUMICE',ixnumice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - - if (prog_modal_aero) then - ! Turn off modal aerosols and decrement edsclr_dim accordingly - call rad_cnst_get_info(0, nmodes=nmodes) - - do m = 1, nmodes - call rad_cnst_get_mode_num_idx(m, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - - call rad_cnst_get_info(0, m, nspec=nspec) - do l = 1, nspec - call rad_cnst_get_mam_mmr_idx(m, l, lptr) - lq(lptr)=.false. - edsclr_dim = edsclr_dim-1 - end do - end do - - ! In addition, if running with MAM, droplet number is transported - ! in dropmixnuc, therefore we do NOT want CLUBB to apply transport - ! tendencies to avoid double counted. Else, we apply tendencies. - lq(ixnumliq) = .false. - edsclr_dim = edsclr_dim-1 - endif - - ! ----------------------------------------------------------------- ! - ! Set the debug level. Level 2 has additional computational expense since - ! it checks the array variables in CLUBB for invalid values. - ! ----------------------------------------------------------------- ! - call set_clubb_debug_level_api( 0 ) - - ! ----------------------------------------------------------------- ! - ! use pbuf_get_fld_idx to get existing physics buffer fields from other - ! physics packages (e.g. tke) - ! ----------------------------------------------------------------- ! - - - ! Defaults - l_stats_samp = .false. - l_grads = .false. - - ! Overwrite defaults if needbe - if (l_stats) l_stats_samp = .true. - - ! Define physics buffers indexes - cld_idx = pbuf_get_index('CLD') ! Cloud fraction - concld_idx = pbuf_get_index('CONCLD') ! Convective cloud cover - ast_idx = pbuf_get_index('AST') ! Stratiform cloud fraction - alst_idx = pbuf_get_index('ALST') ! Liquid stratiform cloud fraction - aist_idx = pbuf_get_index('AIST') ! Ice stratiform cloud fraction - qlst_idx = pbuf_get_index('QLST') ! Physical in-stratus LWC - qist_idx = pbuf_get_index('QIST') ! Physical in-stratus IWC - dp_frac_idx = pbuf_get_index('DP_FRAC') ! Deep convection cloud fraction - icwmrdp_idx = pbuf_get_index('ICWMRDP') ! In-cloud deep convective mixing ratio - icwmrsh_idx = pbuf_get_index('ICWMRSH') ! In-cloud shallow convective mixing ratio (EDMF) - sh_frac_idx = pbuf_get_index('SH_FRAC') ! Shallow convection cloud fraction - relvar_idx = pbuf_get_index('RELVAR') ! Relative cloud water variance - accre_enhan_idx = pbuf_get_index('ACCRE_ENHAN') ! accretion enhancement for MG - prer_evap_idx = pbuf_get_index('PRER_EVAP') - qrl_idx = pbuf_get_index('QRL') - cmfmc_sh_idx = pbuf_get_index('CMFMC_SH') - naai_idx = pbuf_get_index('NAAI') - npccn_idx = pbuf_get_index('NPCCN') - - ! CLUBB+MF - prec_sh_idx = pbuf_get_index('PREC_SH') - snow_sh_idx = pbuf_get_index('SNOW_SH') - - iisclr_rt = -1 - iisclr_thl = -1 - iisclr_CO2 = -1 - - iiedsclr_rt = -1 - iiedsclr_thl = -1 - iiedsclr_CO2 = -1 - - if (zmconv_microp) then - dlfzm_idx = pbuf_get_index('DLFZM') - difzm_idx = pbuf_get_index('DIFZM') - dnlfzm_idx = pbuf_get_index('DNLFZM') - dnifzm_idx = pbuf_get_index('DNIFZM') - end if - - ! ----------------------------------------------------------------- ! - ! Define number of tracers for CLUBB to diffuse - ! ----------------------------------------------------------------- ! - - if (clubb_l_do_expldiff_rtm_thlm) then - offset = 2 ! diffuse temperature and moisture explicitly - edsclr_dim = edsclr_dim + offset - endif - - ! ----------------------------------------------------------------- ! - ! Setup CLUBB core - ! ----------------------------------------------------------------- ! - - ! Read in parameters for CLUBB. Just read in default values - call set_default_parameters_api( & - C1, C1b, C1c, C2rt, C2thl, C2rtthl, & - C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, & - C6thl, C6thlb, C6thlc, C7, C7b, C7c, C8, C8b, C10, & - C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, & - C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, & - C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, & - c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, & - c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, & - slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, & - coef_spread_DG_means_rt, coef_spread_DG_means_thl, & - gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, & - omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, & - lambda0_stability_coef, mult_coef, taumin, taumax, & - Lscale_mu_coef, Lscale_pert_coef, alpha_corr, & - Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, & - thlp2_rad_cloud_frac_thresh, up2_sfc_coef, & - Skw_max_mag, xp3_coef_base, xp3_coef_slope, & - altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, & - C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, & - C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, & - C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, & - C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, & - Cx_min, Cx_max, Richardson_num_min, & - Richardson_num_max, a3_coef_min ) - - call read_parameters_api( -99, "", & - C1, C1b, C1c, C2rt, C2thl, C2rtthl, & - C4, C_uu_shr, C_uu_buoy, C6rt, C6rtb, C6rtc, & - C6thl, C6thlb, C6thlc, C7, C7b, C7c, C8, C8b, C10, & - C11, C11b, C11c, C12, C13, C14, C_wp2_pr_dfsn, C_wp3_pr_tp, & - C_wp3_pr_turb, C_wp3_pr_dfsn, C_wp2_splat, & - C6rt_Lscale0, C6thl_Lscale0, C7_Lscale0, wpxp_L_thresh, & - c_K, c_K1, nu1, c_K2, nu2, c_K6, nu6, c_K8, nu8, & - c_K9, nu9, nu10, c_K_hm, c_K_hmb, K_hm_min_coef, nu_hm, & - slope_coef_spread_DG_means_w, pdf_component_stdev_factor_w, & - coef_spread_DG_means_rt, coef_spread_DG_means_thl, & - gamma_coef, gamma_coefb, gamma_coefc, mu, beta, lmin_coef, & - omicron, zeta_vrnce_rat, upsilon_precip_frac_rat, & - lambda0_stability_coef, mult_coef, taumin, taumax, & - Lscale_mu_coef, Lscale_pert_coef, alpha_corr, & - Skw_denom_coef, c_K10, c_K10h, thlp2_rad_coef, & - thlp2_rad_cloud_frac_thresh, up2_sfc_coef, & - Skw_max_mag, xp3_coef_base, xp3_coef_slope, & - altitude_threshold, rtp2_clip_coef, C_invrs_tau_bkgnd, & - C_invrs_tau_sfc, C_invrs_tau_shear, C_invrs_tau_N2, & - C_invrs_tau_N2_wp2, C_invrs_tau_N2_xp2, & - C_invrs_tau_N2_wpxp, C_invrs_tau_N2_clear_wp3, & - C_invrs_tau_wpxp_Ri, C_invrs_tau_wpxp_N2_thresh, & - Cx_min, Cx_max, Richardson_num_min, & - Richardson_num_max, a3_coef_min, & - clubb_params ) - - clubb_params(iC2rtthl) = clubb_C2rtthl - clubb_params(iC8) = clubb_C8 - clubb_params(iC11) = clubb_c11 - clubb_params(iC11b) = clubb_c11b - clubb_params(iC14) = clubb_c14 - clubb_params(iC_wp3_pr_turb) = clubb_C_wp3_pr_turb - clubb_params(ic_K10) = clubb_c_K10 - clubb_params(imult_coef) = clubb_mult_coef - clubb_params(iSkw_denom_coef) = clubb_Skw_denom_coef - clubb_params(iC2rt) = clubb_C2rt - clubb_params(iC2thl) = clubb_C2thl - clubb_params(ibeta) = clubb_beta - clubb_params(iC6rt) = clubb_c6rt - clubb_params(iC6rtb) = clubb_c6rtb - clubb_params(iC6rtc) = clubb_c6rtc - clubb_params(iC6thl) = clubb_c6thl - clubb_params(iC6thlb) = clubb_c6thlb - clubb_params(iC6thlc) = clubb_c6thlc - clubb_params(iwpxp_L_thresh) = clubb_wpxp_L_thresh - clubb_params(iC7) = clubb_C7 - clubb_params(iC7b) = clubb_C7b - clubb_params(igamma_coef) = clubb_gamma_coef - clubb_params(ic_K10h) = clubb_c_K10h - clubb_params(ilambda0_stability_coef) = clubb_lambda0_stability_coef - clubb_params(ilmin_coef) = clubb_lmin_coef - clubb_params(iC8b) = clubb_C8b - clubb_params(iskw_max_mag) = clubb_skw_max_mag - clubb_params(iC1) = clubb_C1 - clubb_params(iC1b) = clubb_C1b - clubb_params(igamma_coefb) = clubb_gamma_coefb - clubb_params(iup2_sfc_coef) = clubb_up2_sfc_coef - clubb_params(iC4) = clubb_C4 - clubb_params(iC_uu_shr) = clubb_C_uu_shr - clubb_params(iC_uu_buoy) = clubb_C_uu_buoy - clubb_params(ic_K1) = clubb_c_K1 - clubb_params(ic_K2) = clubb_c_K2 - clubb_params(inu2) = clubb_nu2 - clubb_params(ic_K8) = clubb_c_K8 - clubb_params(ic_K9) = clubb_c_K9 - clubb_params(inu9) = clubb_nu9 - clubb_params(iC_wp2_splat) = clubb_C_wp2_splat - clubb_params(iC_invrs_tau_bkgnd) = clubb_C_invrs_tau_bkgnd - clubb_params(iC_invrs_tau_sfc) = clubb_C_invrs_tau_sfc - clubb_params(iC_invrs_tau_shear) = clubb_C_invrs_tau_shear - clubb_params(iC_invrs_tau_N2) = clubb_C_invrs_tau_N2 - clubb_params(iC_invrs_tau_N2_wp2) = clubb_C_invrs_tau_N2_wp2 - clubb_params(iC_invrs_tau_N2_xp2) = clubb_C_invrs_tau_N2_xp2 - clubb_params(iC_invrs_tau_N2_wpxp) = clubb_C_invrs_tau_N2_wpxp - clubb_params(iC_invrs_tau_N2_clear_wp3) = clubb_C_invrs_tau_N2_clear_wp3 - - ! Set up CLUBB core. Note that some of these inputs are overwritten - ! when clubb_tend_cam is called. The reason is that heights can change - ! at each time step, which is why dummy arrays are read in here for heights - ! as they are immediately overwrote. -!$OMP PARALLEL - call setup_clubb_core_api & - ( nlev+1, theta0, ts_nudge, & ! In - hydromet_dim, sclr_dim, & ! In - sclr_tol, edsclr_dim, clubb_params, & ! In - l_host_applies_sfc_fluxes, & ! In - saturation_equation, & ! In - l_input_fields, & ! In - clubb_config_flags%iiPDF_type, & ! In - clubb_config_flags%ipdf_call_placement, & ! In - clubb_config_flags%l_predict_upwp_vpwp, & ! In - clubb_config_flags%l_min_xp2_from_corr_wx, & ! In - clubb_config_flags%l_prescribed_avg_deltaz, & ! In - clubb_config_flags%l_damp_wp2_using_em, & ! In - clubb_config_flags%l_stability_correct_tau_zm, & ! In - clubb_config_flags%l_enable_relaxed_clipping, & ! In - clubb_config_flags%l_diag_Lscale_from_tau, & ! In - err_code ) ! Out - - if ( err_code == clubb_fatal_error ) then - call endrun('clubb_ini_cam: FATAL ERROR CALLING SETUP_CLUBB_CORE') - end if -!$OMP END PARALLEL - - ! Print the list of CLUBB parameters - if ( masterproc ) then - do j = 1, nparams, 1 - write(iulog,*) params_list(j), " = ", clubb_params(j) - enddo - endif - - ! Print configurable CLUBB flags - if ( masterproc ) then - write(iulog,'(a,i0,a)') " CLUBB configurable flags " - call print_clubb_config_flags_api( iulog, clubb_config_flags ) ! Intent(in) - end if - - ! ----------------------------------------------------------------- ! - ! Set-up HB diffusion. Only initialized to diagnose PBL depth ! - ! ----------------------------------------------------------------- ! - - ! Initialize eddy diffusivity module - - ntop_eddy = 1 ! if >1, must be <= nbot_molec - nbot_eddy = pver ! currently always pver - - call init_hb_diff( gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme ) - - ! ----------------------------------------------------------------- ! - ! Add output fields for the history files - ! ----------------------------------------------------------------- ! - - ! These are default CLUBB output. Not the higher order history budgets - call addfld ('RHO_CLUBB', (/ 'lev' /), 'A', 'kg/m3', 'Air Density') - call addfld ('UP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Velocity Variance') - call addfld ('VP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Velocity Variance') - call addfld ('WP2_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Vertical Velocity Variance') - call addfld ('WP2_ZT_CLUBB', (/ 'lev' /), 'A', 'm2/s2', 'Vert Vel Variance on zt grid') - call addfld ('UPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Zonal Momentum Flux') - call addfld ('VPWP_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'Meridional Momentum Flux') - call addfld ('WP3_CLUBB', (/ 'lev' /), 'A', 'm3/s3', 'Third Moment Vertical Velocity') - call addfld ('WPTHLP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Heat Flux') - call addfld ('WPRTP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Moisture Flux') - call addfld ('RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2', 'Moisture Variance') - call addfld ('RTP2_ZT_CLUBB', (/ 'lev' /), 'A', 'kg^2/kg^2','Moisture Variance on zt grid') - call addfld ('PDFP_RTP2_CLUBB', (/ 'ilev' /), 'A', 'kg^2/kg^2','PDF Rtot Variance') - call addfld ('THLP2_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance') -<<<<<<< HEAD - call addfld ('THLP2_ZT_CLUBB', (/ 'ilev' /), 'A', 'K^2', 'Temperature Variance on zt grid') - call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K g/kg', 'Temp. Moist. Covariance') - call addfld ('RCM_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water Mixing Ratio') -======= - call addfld ('THLP2_ZT_CLUBB', (/ 'lev' /), 'A', 'K^2', 'Temperature Variance on zt grid') - call addfld ('RTPTHLP_CLUBB', (/ 'ilev' /), 'A', 'K kg/kg', 'Temp. Moist. Covariance') - call addfld ('RCM_CLUBB', (/ 'lev' /), 'A', 'kg/kg', 'Cloud Water Mixing Ratio') ->>>>>>> ESCOMP/cam_development - call addfld ('RTM_CLUBB', (/ 'lev' /), 'A', 'kg/kg', 'Total Water Mixing Ratio') - call addfld ('THLM_CLUBB', (/ 'lev' /), 'A', 'K', 'Liquid Water Potential Temperature') - call addfld ('WPRCP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Liquid Water Flux') - call addfld ('CLOUDFRAC_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Fraction') -<<<<<<< HEAD - call addfld ('RCMINLAYER_CLUBB', (/ 'ilev' /), 'A', 'g/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'ilev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') - call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'g/kg /s', 'Water vapor tendency') -======= - call addfld ('RCMINLAYER_CLUBB', (/ 'lev' /), 'A', 'kg/kg', 'Cloud Water in Layer') - call addfld ('CLOUDCOVER_CLUBB', (/ 'lev' /), 'A', 'fraction', 'Cloud Cover') - call addfld ('WPTHVP_CLUBB', (/ 'ilev' /), 'A', 'W/m2', 'Buoyancy Flux') - call addfld ('RVMTEND_CLUBB', (/ 'lev' /), 'A', 'kg/kg /s', 'Water vapor tendency') ->>>>>>> ESCOMP/cam_development - call addfld ('STEND_CLUBB', (/ 'lev' /), 'A', 'J/(kg s)', 'Static energy tendency') - call addfld ('RCMTEND_CLUBB', (/ 'lev' /), 'A', 'kg/kg /s', 'Cloud Liquid Water Tendency') - call addfld ('RIMTEND_CLUBB', (/ 'lev' /), 'A', 'kg/kg /s', 'Cloud Ice Tendency') - call addfld ('UTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'U-wind Tendency') - call addfld ('VTEND_CLUBB', (/ 'lev' /), 'A', 'm/s /s', 'V-wind Tendency') - call addfld ('ZT_CLUBB', (/ 'lev' /), 'A', 'm', 'Thermodynamic Heights') - call addfld ('ZM_CLUBB', (/ 'ilev' /), 'A', 'm', 'Momentum Heights') - call addfld ('UM_CLUBB', (/ 'lev' /), 'A', 'm/s', 'Zonal Wind') - call addfld ('VM_CLUBB', (/ 'lev' /), 'A', 'm/s', 'Meridional Wind') - call addfld ('WM_ZT_CLUBB', (/ 'lev' /), 'A', 'm/s', 'Vertical Velocity') - call addfld ('PBLH', horiz_only, 'A', 'm', 'PBL height') - call addfld ('CLDST', (/ 'lev' /), 'A', 'fraction', 'Stratus cloud fraction') - call addfld ('ZMDLF', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from ZM convection') - call addfld ('TTENDICE', (/ 'lev' /), 'A', 'K/s', 'T tendency from Ice Saturation Adjustment') - call addfld ('QVTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Q tendency from Ice Saturation Adjustment') - call addfld ('QITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NITENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - - - call addfld ('QCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'CLDICE tendency from Ice Saturation Adjustment') - call addfld ('NCTENDICE', (/ 'lev' /), 'A', 'kg/kg/s', 'NUMICE tendency from Ice Saturation Adjustment') - call addfld ('FQTENDICE', (/ 'lev' /), 'A', 'fraction', 'Frequency of Ice Saturation Adjustment') - - call addfld ('DPDLFLIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained liquid water from deep convection') - call addfld ('DPDLFICE', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice from deep convection') - call addfld ('DPDLFT', (/ 'lev' /), 'A', 'K/s', 'T-tendency due to deep convective detrainment') - call addfld ('RELVAR', (/ 'lev' /), 'A', '-', 'Relative cloud water variance') - call addfld ('CLUBB_GRID_SIZE', horiz_only, 'A', 'm', 'Horizontal grid box size seen by CLUBB') - - - call addfld ('ZMDLFI', (/ 'lev' /), 'A', 'kg/kg/s', 'Detrained ice water from ZM convection') - call addfld ('CONCLD', (/ 'lev' /), 'A', 'fraction', 'Convective cloud cover') - call addfld ('CMELIQ', (/ 'lev' /), 'A', 'kg/kg/s', 'Rate of cond-evap of liq within the cloud') - call addfld ('DETNLIQTND', (/ 'lev' /), 'A', '1/kg/s', 'CLDNUM tendency in detrained water') - - call addfld ('QSATFAC', (/ 'lev' /), 'A', '-', 'Subgrid cloud water saturation scaling factor') - call addfld ('KVH_CLUBB', (/ 'ilev' /), 'A', 'm2/s', 'CLUBB vertical diffusivity of heat/moisture on interface levels') - call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') - call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') - - call addfld ('TKE_CLUBB', (/ 'ilev' /), 'A', 'm2/s2', 'CLUBB tke on interface levels') - call addfld ('ELEAK_CLUBB', horiz_only, 'A', 'W/m2', 'CLUBB energy leak') - call addfld ('TFIX_CLUBB', horiz_only, 'A', 'K', 'Temperature increment to conserve energy') - ! ---------------------------------------------------------------------------- ! - ! Below are for detailed analysis of EDMF Scheme ! - ! ---------------------------------------------------------------------------- ! - if (do_clubb_mf) then - call addfld ( 'edmf_DRY_A' , (/ 'ilev' /), 'A', 'fraction', 'Dry updraft area fraction (EDMF)' ) - call addfld ( 'edmf_MOIST_A' , (/ 'ilev' /), 'A', 'fraction', 'Moist updraft area fraction (EDMF)' ) - call addfld ( 'edmf_DRY_W' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_W' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_DRY_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Dry updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_MOIST_QT' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_DRY_THL' , (/ 'ilev' /), 'A', 'K' , 'Dry updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_MOIST_THL', (/ 'ilev' /), 'A', 'K' , 'Moist updraft liquid-ice potential temperature (EDMF)' ) - call addfld ( 'edmf_DRY_U' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_U' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft zonal velocity (EDMF)' ) - call addfld ( 'edmf_DRY_V' , (/ 'ilev' /), 'A', 'm/s' , 'Dry updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_V' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft meridional velocity (EDMF)' ) - call addfld ( 'edmf_MOIST_QC' , (/ 'ilev' /), 'A', 'kg/kg' , 'Moist updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_precc' , (/ 'ilev' /), 'A', 'm/s' , 'Moist updraft precipitation rate (EDMF)' ) - call addfld ( 'edmf_S_AE' , (/ 'ilev' /), 'A', 'fraction', '1 minus sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AW' , (/ 'ilev' /), 'A', 'm/s' , 'Sum of a_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AWW' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*w_i (EDMF)' ) - call addfld ( 'edmf_S_AWTHL' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*thl_i (EDMF)' ) - call addfld ( 'edmf_S_AWQT' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_ti (EDMF)' ) - call addfld ( 'edmf_S_AWTH' , (/ 'ilev' /), 'A', 'K m/s' , 'Sum of a_i*w_i*th_i (EDMF)' ) - call addfld ( 'edmf_S_AWQV' , (/ 'ilev' /), 'A', 'kgm/kgs' , 'Sum of a_i*w_i*q_vi (EDMF)' ) - call addfld ( 'edmf_S_AWU' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*u_i (EDMF)' ) - call addfld ( 'edmf_S_AWV' , (/ 'ilev' /), 'A', 'm2/s2' , 'Sum of a_i*w_i*v_i (EDMF)' ) - call addfld ( 'edmf_thlforcup', (/ 'lev' /), 'A', 'K/s' , 'thl updraft forcing (EDMF)' ) - call addfld ( 'edmf_qtforcup' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt updraft forcing (EDMF)' ) - call addfld ( 'edmf_thlforcdn', (/ 'lev' /), 'A', 'K/s' , 'thl downdraft forcing (EDMF)' ) - call addfld ( 'edmf_qtforcdn' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt downdraft forcing (EDMF)' ) - call addfld ( 'edmf_thlforc' , (/ 'lev' /), 'A', 'K/s' , 'thl forcing (EDMF)' ) - call addfld ( 'edmf_qtforc' , (/ 'lev' /), 'A', 'kg/kg/s' , 'qt forcing (EDMF)' ) - call addfld ( 'edmf_thlflxup' , (/ 'ilev' /), 'A', 'K m/s' , 'thl updraft flux (EDMF)' ) - call addfld ( 'edmf_qtflxup' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt updraft flux (EDMF)' ) - call addfld ( 'edmf_thlflxdn' , (/ 'ilev' /), 'A', 'K m/s' , 'thl downdraft flux (EDMF)' ) - call addfld ( 'edmf_qtflxdn' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt downdraft flux (EDMF)' ) - call addfld ( 'edmf_thlflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thl flux (EDMF)' ) - call addfld ( 'edmf_qtflx' , (/ 'ilev' /), 'A', 'kg/kg m/s', 'qt flux (EDMF)' ) - call addfld ( 'edmf_thvflx' , (/ 'ilev' /), 'A', 'K m/s' , 'thv flux (EDMF)' ) - call addfld ( 'edmf_uflxup' , (/ 'ilev' /), 'A', 'm2/s2' , 'u updraft flux (EDMF)' ) - call addfld ( 'edmf_vflxup' , (/ 'ilev' /), 'A', 'm2/s2' , 'v updraft flux (EDMF)' ) - call addfld ( 'edmf_uflxdn' , (/ 'ilev' /), 'A', 'm2/s2' , 'u downdraft flux (EDMF)' ) - call addfld ( 'edmf_vflxdn' , (/ 'ilev' /), 'A', 'm2/s2' , 'v downdraft flux (EDMF)' ) - call addfld ( 'edmf_uflx' , (/ 'ilev' /), 'A', 'm2/s2' , 'u flux (EDMF)' ) - call addfld ( 'edmf_vflx' , (/ 'ilev' /), 'A', 'm2/s2' , 'v flux (EDMF)' ) - call addfld ( 'edmf_sqtup' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume updraft microphysics tendency (EDMF)' ) - call addfld ( 'edmf_sqtdn' , (/ 'lev' /), 'A', 'kg/kg/s' , 'Plume downdraft microphysics tendency (EDMF)' ) - call addfld ( 'edmf_rcm' , (/ 'ilev' /), 'A', 'kg/kg' , 'grid mean cloud (EDMF)' ) - call addfld ( 'edmf_cloudfrac', (/ 'lev' /), 'A', 'fraction', 'grid mean cloud fraction (EDMF)' ) - call addfld ( 'edmf_ent' , (/ 'lev' /), 'A', '1/m' , 'ensemble mean entrainment (EDMF)' ) - call addfld ( 'edmf_ztop' , horiz_only, 'A', 'm' , 'edmf ztop', flag_xyfill=.True.) - call addfld ( 'edmf_ddcp' , horiz_only, 'A', 'm/s' , 'edmf ddcp', flag_xyfill=.True.) - call addfld ( 'edmf_L0' , horiz_only, 'A', 'm' , 'edmf dynamic L0', flag_xyfill=.True.) - call addfld ( 'edmf_freq' , horiz_only, 'A', 'unitless', 'edmf frequency mf is active', flag_xyfill=.True.) - call addfld ( 'edmf_cfl' , horiz_only, 'A', 'unitless', 'max flux cfl number (EDMF)' ) - call addfld ( 'edmf_cape' , horiz_only, 'A', 'J/kg' , 'ensemble mean CAPE (EDMF)' ) - call addfld ( 'edmf_upa' , (/ 'ilev', 'nens' /), 'A', 'fraction', 'Plume updraft area fraction (EDMF)' ) - call addfld ( 'edmf_upw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_upmf' , (/ 'ilev', 'nens' /), 'A', 'kg/m2/s' , 'Plume updraft mass flux (EDMF)' ) - call addfld ( 'edmf_upqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft total water mixing ratio (EDMF)' ) - call addfld ( 'edmf_upthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume updraft liquid potential temperature (EDMF)' ) - call addfld ( 'edmf_upthv' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft virtual potential temperature (EDMF)' ) - call addfld ( 'edmf_upth' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume updraft potential temperature (EDMF)' ) - call addfld ( 'edmf_upqc' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume updraft condensate mixing ratio (EDMF)' ) - call addfld ( 'edmf_upent' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft entrainment rate (EDMF)' ) - call addfld ( 'edmf_updet' , (/ 'ilev', 'nens' /), 'A', '1/m' , 'Plume updraft dettrainment rate (EDMF)' ) - call addfld ( 'edmf_upbuoy' , (/ 'ilev', 'nens' /), 'A', 'm/s2' , 'Plume updraft buoyancy (EDMF)' ) - call addfld ( 'edmf_dnw' , (/ 'ilev', 'nens' /), 'A', 'm/s' , 'Plume downdraft vertical velocity (EDMF)' ) - call addfld ( 'edmf_dnthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume downdraft liquid potential temperature (EDMF)' ) - call addfld ( 'edmf_dnqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume downdraft total water mixing ratio (EDMF)' ) - end if -!+++ARH - call addfld ('qtm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('qtm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') - call addfld ('thlm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') - call addfld ('thlm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') -!---ARH - call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') - call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'ncyc' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') - call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') - call addfld ('WPRTP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Moisture Flux at macro/micro substep') - call addfld ('WPTHVP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Buoyancy Flux at macro/micro substep') - if (do_clubb_mf) then - call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thl flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thv flux (EDMF) at macro/micro substep' ) - call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg m/s' , 'qt flux (EDMF) at macro/micro substep' ) -!+++ARH - call addfld ( 'up_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) - call addfld ( 'up_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) - call addfld ( 'dn_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) - call addfld ( 'dn_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) - call addfld ( 'upa_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'upa' ) - call addfld ( 'upa_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'upa' ) - call addfld ( 'dna_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'dna' ) - call addfld ( 'dna_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'fraction' , 'dna' ) - call addfld ( 'thlu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) - call addfld ( 'thlu_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl up' ) - call addfld ( 'qtu_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt up' ) - call addfld ( 'qtu_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt up' ) - call addfld ( 'thld_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl dn' ) - call addfld ( 'thld_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'thl dn' ) - call addfld ( 'qtd_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt dn' ) - call addfld ( 'qtd_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'qt dn' ) - call addfld ( 'dthl_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl tend' ) - call addfld ( 'dthl_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl tend' ) - call addfld ( 'dqt_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt tend' ) - call addfld ( 'dqt_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt tend' ) - call addfld ( 'dthlu_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl up tend' ) - call addfld ( 'dthlu_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl up tend' ) - call addfld ( 'dqtu_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt up tend' ) - call addfld ( 'dqtu_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt up tend' ) - call addfld ( 'dthld_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl dn tend' ) - call addfld ( 'dthld_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'thl dn tend' ) - call addfld ( 'dqtd_macmic1', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt dn tend' ) - call addfld ( 'dqtd_macmic2', (/ 'ilev', 'ncyc' /), 'I', 'm/s' , 'qt dn tend' ) - call addfld ( 'ztop_macmic1', (/ 'ncyc' /), 'I', 'm/s' , 'ztop' ) - call addfld ( 'ztop_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ztop' ) - call addfld ( 'ddcp_macmic1', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) - call addfld ( 'ddcp_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) -!---ARH - end if - - ! Initialize statistics, below are dummy variables - dum1 = 300._r8 - dum2 = 1200._r8 - dum3 = 300._r8 - - if (l_stats) then - - do i=1, pcols - call stats_init_clubb( .true., dum1, dum2, & - nlev+1, nlev+1, nlev+1, dum3, & - stats_zt(i), stats_zm(i), stats_sfc(i), & - stats_rad_zt(i), stats_rad_zm(i)) - end do - - allocate(out_zt(pcols,pverp,stats_zt(1)%num_output_fields)) - allocate(out_zm(pcols,pverp,stats_zm(1)%num_output_fields)) - allocate(out_sfc(pcols,1,stats_sfc(1)%num_output_fields)) - - allocate(out_radzt(pcols,pverp,stats_rad_zt(1)%num_output_fields)) - allocate(out_radzm(pcols,pverp,stats_rad_zm(1)%num_output_fields)) - - endif - - ! ----------------------------------------------------------------- ! - ! Make all of this output default, this is not CLUBB history - ! ----------------------------------------------------------------- ! - - if (clubb_do_adv .or. history_clubb) then - call add_default('RELVAR', 1, ' ') - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UP2_CLUBB', 1, ' ') - call add_default('VP2_CLUBB', 1, ' ') - call add_default('WP2_CLUBB', 1, ' ') - call add_default('WP2_ZT_CLUBB', 1, ' ') - call add_default('WP3_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('WPTHLP_CLUBB', 1, ' ') - call add_default('WPRTP_CLUBB', 1, ' ') - call add_default('RTP2_CLUBB', 1, ' ') - call add_default('RTP2_ZT_CLUBB', 1, ' ') - call add_default('PDFP_RTP2_CLUBB', 1, ' ') - call add_default('THLP2_CLUBB', 1, ' ') - call add_default('THLP2_ZT_CLUBB', 1, ' ') - call add_default('RTPTHLP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('RTM_CLUBB', 1, ' ') - call add_default('THLM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('WM_ZT_CLUBB', 1, ' ') - call add_default('PBLH', 1, ' ') - call add_default('CONCLD', 1, ' ') -<<<<<<< HEAD - call add_default('TKE_CLUBB', 1, ' ') - call add_default('ELEAK_CLUBB', 1, ' ') - call add_default('TFIX_CLUBB', 1, ' ') - end if - - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (history_clubb) then - - call add_default('RELVAR', 1, ' ') - call add_default('RHO_CLUBB', 1, ' ') - call add_default('UPWP_CLUBB', 1, ' ') - call add_default('VPWP_CLUBB', 1, ' ') - call add_default('RCM_CLUBB', 1, ' ') - call add_default('WPRCP_CLUBB', 1, ' ') - call add_default('CLOUDFRAC_CLUBB', 1, ' ') - call add_default('RCMINLAYER_CLUBB', 1, ' ') - call add_default('CLOUDCOVER_CLUBB', 1, ' ') - call add_default('WPTHVP_CLUBB', 1, ' ') - call add_default('RVMTEND_CLUBB', 1, ' ') - call add_default('STEND_CLUBB', 1, ' ') - call add_default('RCMTEND_CLUBB', 1, ' ') - call add_default('RIMTEND_CLUBB', 1, ' ') - call add_default('UTEND_CLUBB', 1, ' ') - call add_default('VTEND_CLUBB', 1, ' ') - call add_default('ZT_CLUBB', 1, ' ') - call add_default('ZM_CLUBB', 1, ' ') - call add_default('UM_CLUBB', 1, ' ') - call add_default('VM_CLUBB', 1, ' ') - call add_default('SL', 1, ' ') - call add_default('QT', 1, ' ') - call add_default('CONCLD', 1, ' ') - - if (do_clubb_mf_diag) then - call add_default( 'edmf_DRY_A' , 1, ' ') - call add_default( 'edmf_MOIST_A' , 1, ' ') - call add_default( 'edmf_DRY_W' , 1, ' ') - call add_default( 'edmf_MOIST_W' , 1, ' ') - call add_default( 'edmf_DRY_QT' , 1, ' ') - call add_default( 'edmf_MOIST_QT' , 1, ' ') - call add_default( 'edmf_DRY_THL' , 1, ' ') - call add_default( 'edmf_MOIST_THL', 1, ' ') - call add_default( 'edmf_DRY_U' , 1, ' ') - call add_default( 'edmf_MOIST_U' , 1, ' ') - call add_default( 'edmf_DRY_V' , 1, ' ') - call add_default( 'edmf_MOIST_V' , 1, ' ') - call add_default( 'edmf_MOIST_QC' , 1, ' ') - call add_default( 'edmf_precc' , 1, ' ') - call add_default( 'edmf_S_AE' , 1, ' ') - call add_default( 'edmf_S_AW' , 1, ' ') - call add_default( 'edmf_S_AWW' , 1, ' ') - call add_default( 'edmf_S_AWTH' , 1, ' ') - call add_default( 'edmf_S_AWTHL' , 1, ' ') - call add_default( 'edmf_S_AWQT' , 1, ' ') - call add_default( 'edmf_S_AWU' , 1, ' ') - call add_default( 'edmf_S_AWV' , 1, ' ') - call add_default( 'edmf_thlflxup' , 1, ' ') - call add_default( 'edmf_qtflxup' , 1, ' ') - call add_default( 'edmf_thlflxdn' , 1, ' ') - call add_default( 'edmf_qtflxdn' , 1, ' ') - call add_default( 'edmf_thlflx' , 1, ' ') - call add_default( 'edmf_thvflx' , 1, ' ') - call add_default( 'edmf_uflxup' , 1, ' ') - call add_default( 'edmf_vflxup' , 1, ' ') - call add_default( 'edmf_uflxdn' , 1, ' ') - call add_default( 'edmf_vflxdn' , 1, ' ') - call add_default( 'edmf_uflx' , 1, ' ') - call add_default( 'edmf_vflx' , 1, ' ') - call add_default( 'edmf_qtflx' , 1, ' ') - call add_default( 'edmf_thlforcup', 1, ' ') - call add_default( 'edmf_qtforcup' , 1, ' ') - call add_default( 'edmf_thlforcdn', 1, ' ') - call add_default( 'edmf_qtforcdn' , 1, ' ') - call add_default( 'edmf_thlforc' , 1, ' ') - call add_default( 'edmf_qtforc' , 1, ' ') - call add_default( 'edmf_sqtup' , 1, ' ') - call add_default( 'edmf_sqtdn' , 1, ' ') - call add_default( 'edmf_rcm' , 1, ' ') - call add_default( 'edmf_cloudfrac', 1, ' ') - call add_default( 'edmf_ent' , 1, ' ') - call add_default( 'edmf_ztop' , 1, ' ') - call add_default( 'edmf_ddcp' , 1, ' ') - call add_default( 'edmf_L0' , 1, ' ') - call add_default( 'edmf_freq' , 1, ' ') - call add_default( 'edmf_cape' , 1, ' ') - call add_default( 'edmf_cfl' , 1, ' ') - end if -!+++ARH - !call add_default( 'qtm_macmic1' , 1, ' ') - !call add_default( 'qtm_macmic2' , 1, ' ') - !call add_default( 'thlm_macmic1' , 1, ' ') - !call add_default( 'thlm_macmic2' , 1, ' ') -!---ARH - call add_default( 'RCM_CLUBB_macmic' , 1, ' ') - call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') - call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPRTP_CLUBB_macmic' , 1, ' ') - call add_default( 'WPTHVP_CLUBB_macmic' , 1, ' ') - if (do_clubb_mf_diag) then - call add_default( 'edmf_thlflx_macmic' , 1, ' ') - call add_default( 'edmf_qtflx_macmic' , 1, ' ') - call add_default( 'edmf_thvflx_macmic' , 1, ' ') -!+++ARH - !call add_default( 'up_macmic1' , 1, ' ') - !call add_default( 'up_macmic2' , 1, ' ') - !call add_default( 'dn_macmic1' , 1, ' ') - !call add_default( 'dn_macmic2' , 1, ' ') - !call add_default( 'upa_macmic1' , 1, ' ') - !call add_default( 'upa_macmic2' , 1, ' ') - !call add_default( 'dna_macmic1' , 1, ' ') - !call add_default( 'dna_macmic2' , 1, ' ') - !call add_default( 'thlu_macmic1' , 1, ' ') - !call add_default( 'thlu_macmic2' , 1, ' ') - !call add_default( 'qtu_macmic1' , 1, ' ') - !call add_default( 'qtu_macmic2' , 1, ' ') - !call add_default( 'thld_macmic1' , 1, ' ') - !call add_default( 'thld_macmic2' , 1, ' ') - !call add_default( 'qtd_macmic1' , 1, ' ') - !call add_default( 'qtd_macmic2' , 1, ' ') - !call add_default( 'dthl_macmic1' , 1, ' ') - !call add_default( 'dthl_macmic2' , 1, ' ') - !call add_default( 'dqt_macmic1' , 1, ' ') - !call add_default( 'dqt_macmic2' , 1, ' ') - !call add_default( 'dthlu_macmic1' , 1, ' ') - !call add_default( 'dthlu_macmic2' , 1, ' ') - !call add_default( 'dqtu_macmic1' , 1, ' ') - !call add_default( 'dqtu_macmic2' , 1, ' ') - !call add_default( 'dthld_macmic1' , 1, ' ') - !call add_default( 'dthld_macmic2' , 1, ' ') - !call add_default( 'dqtd_macmic1' , 1, ' ') - !call add_default( 'dqtd_macmic2' , 1, ' ') - !call add_default( 'ztop_macmic1' , 1, ' ') - !call add_default( 'ztop_macmic2' , 1, ' ') - !call add_default( 'ddcp_macmic1' , 1, ' ') - !call add_default( 'ddcp_macmic2' , 1, ' ') -!---ARH - end if - end if - -======= - endif - ->>>>>>> ESCOMP/cam_development - if (history_amwg) then - call add_default('PBLH', 1, ' ') - end if - - if (do_clubb_mf_diag) then - call add_default( 'edmf_DRY_A' , 1, ' ') - call add_default( 'edmf_MOIST_A' , 1, ' ') - call add_default( 'edmf_DRY_W' , 1, ' ') - call add_default( 'edmf_MOIST_W' , 1, ' ') - call add_default( 'edmf_DRY_QT' , 1, ' ') - call add_default( 'edmf_MOIST_QT' , 1, ' ') - call add_default( 'edmf_DRY_THL' , 1, ' ') - call add_default( 'edmf_MOIST_THL', 1, ' ') - call add_default( 'edmf_DRY_U' , 1, ' ') - call add_default( 'edmf_MOIST_U' , 1, ' ') - call add_default( 'edmf_DRY_V' , 1, ' ') - call add_default( 'edmf_MOIST_V' , 1, ' ') - call add_default( 'edmf_MOIST_QC' , 1, ' ') - call add_default( 'edmf_S_AE' , 1, ' ') - call add_default( 'edmf_S_AW' , 1, ' ') - call add_default( 'edmf_S_AWTHL' , 1, ' ') - call add_default( 'edmf_S_AWQT' , 1, ' ') - call add_default( 'edmf_S_AWU' , 1, ' ') - call add_default( 'edmf_S_AWV' , 1, ' ') - call add_default( 'edmf_thlflx' , 1, ' ') - call add_default( 'edmf_qtflx' , 1, ' ') - end if - - if (history_budget) then - call add_default('DPDLFLIQ', history_budget_histfile_num, ' ') - call add_default('DPDLFICE', history_budget_histfile_num, ' ') - call add_default('DPDLFT', history_budget_histfile_num, ' ') - call add_default('STEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RCMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RIMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('RVMTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('UTEND_CLUBB', history_budget_histfile_num, ' ') - call add_default('VTEND_CLUBB', history_budget_histfile_num, ' ') - endif - - - ! --------------- ! - ! First step? ! - ! Initialization ! - ! --------------- ! - - ! Is this the first time step? If so then initialize CLUBB variables as follows - if (is_first_step()) then - - call pbuf_set_field(pbuf2d, wp2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, wp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtp2_idx, rt_tol**2) - call pbuf_set_field(pbuf2d, thlp2_idx, thl_tol**2) - call pbuf_set_field(pbuf2d, up2_idx, w_tol_sqd) - call pbuf_set_field(pbuf2d, vp2_idx, w_tol_sqd) - - call pbuf_set_field(pbuf2d, rtp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, up3_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vp3_idx, 0.0_r8) - - call pbuf_set_field(pbuf2d, upwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vpwp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2thvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthvp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlpthvp_idx,0.0_r8) - call pbuf_set_field(pbuf2d, rcm_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cloud_frac_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, tke_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, kvh_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, radf_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2rtp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2thlp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, uprcp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, vprcp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rc_coef_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp4_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpup2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpvp2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2up2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wp2vp2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ice_supersat_idx, 0.0_r8) - -!+++ARH - call pbuf_set_field(pbuf2d, thlm_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlm_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtm_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtm_macmic2_idx, 0.0_r8) -!---ARH - ! Initialize SILHS covariance contributions - call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wprtp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, wpthlp_mc_zt_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, rtpthlp_mc_zt_idx, 0.0_r8) - -<<<<<<< HEAD - if (do_clubb_mf) then - call pbuf_set_field(pbuf2d, ztopmn_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztopma_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztopm1_macmic_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ddcp_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ddcp_macmic_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ddcpmn_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cbm1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, cbm1_macmic_idx, 0.0_r8) -!+++ARH - call pbuf_set_field(pbuf2d, up_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, up_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dn_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dn_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, upa_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, upa_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dna_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dna_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlu_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thlu_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtu_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtu_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thld_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, thld_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtd_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, qtd_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthl_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthl_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqt_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqt_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthlu_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthlu_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqtu_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqtu_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthld_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dthld_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqtd_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, dqtd_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztop_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ztop_macmic2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ddcp_macmic1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, ddcp_macmic2_idx, 0.0_r8) -!---ARH - end if -======= - call pbuf_set_field(pbuf2d, pdf_zm_w_1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, pdf_zm_w_2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, pdf_zm_varnce_w_1_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, pdf_zm_varnce_w_2_idx, 0.0_r8) - call pbuf_set_field(pbuf2d, pdf_zm_mixt_frac_idx, 0.0_r8) ->>>>>>> ESCOMP/cam_development - - endif - - ! The following is physpkg, so it needs to be initialized every time - call pbuf_set_field(pbuf2d, fice_idx, 0.0_r8) - - ! --------------- ! - ! End ! - ! Initialization ! - ! --------------- ! - -#endif - end subroutine clubb_ini_cam - - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! -<<<<<<< HEAD - - subroutine clubb_tend_cam( & - state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & - macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) - -!------------------------------------------------------------------------------- -! Description: Provide tendencies of shallow convection, turbulence, and -! macrophysics from CLUBB to CAM -! -! Author: Cheryl Craig, March 2011 -! Modifications: Pete Bogenschutz, March 2011 and onward -! Origin: Based heavily on UWM clubb_init.F90 -! References: -! None -!------------------------------------------------------------------------------- - - use physics_types, only: physics_state, physics_ptend, & - physics_state_copy, physics_ptend_init, & - physics_ptend_sum, physics_update, set_dry_to_wet - - use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc - - use constituents, only: cnst_get_ind, cnst_type - use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use tropopause, only: tropopause_findChemTrop - use time_manager, only: get_nstep - - use wv_saturation, only: qsat - use interpolate_data,only: vertinterp -======= - subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & - cmfmc, cam_in, & - macmic_it, cld_macmic_num_steps,dlf, det_s, det_ice) - - !------------------------------------------------------------------------------- - ! Description: Provide tendencies of shallow convection, turbulence, and - ! macrophysics from CLUBB to CAM - ! - ! Author: Cheryl Craig, March 2011 - ! Modifications: Pete Bogenschutz, March 2011 and onward - ! Origin: Based heavily on UWM clubb_init.F90 - ! References: - ! None - !------------------------------------------------------------------------------- - - use physics_types, only: physics_state, physics_ptend, & - physics_state_copy, physics_ptend_init, & - physics_ptend_sum, physics_update, set_wet_to_dry - - use physics_buffer, only: pbuf_old_tim_idx, pbuf_get_field, physics_buffer_desc - - use constituents, only: cnst_get_ind, cnst_type - use camsrfexch, only: cam_in_t - use time_manager, only: is_first_step - use cam_abortutils, only: endrun - use cam_logfile, only: iulog - use tropopause, only: tropopause_findChemTrop - use time_manager, only: get_nstep, is_first_restart_step ->>>>>>> ESCOMP/cam_development - -#ifdef CLUBB_SGS - use hb_diff, only: pblintd - use scamMOD, only: single_column,scm_clubb_iop_name - use clubb_api_module, only: & - nparams, & - setup_parameters_api, & - time_precision, & - advance_clubb_core_api, & - zt2zm_api, zm2zt_api, & - setup_grid_heights_api, & - em_min, & - w_tol_sqd, & - rt_tol, & - thl_tol, & - l_stats, & - stats_tsamp, & - stats_tout, & - l_output_rad_files, & - stats_begin_timestep_api, & - hydromet_dim, calculate_thlp2_rad_api, update_xp2_mc_api, & - sat_mixrat_liq_api, & - fstderr, & - ipdf_post_advance_fields, & - copy_single_pdf_params_to_multi, & - copy_multi_pdf_params_to_single, & - pdf_parameter, & - init_pdf_params_api, & - init_pdf_implicit_coefs_terms_api, & - setup_grid_api - - use clubb_api_module, only: & - clubb_fatal_error ! Error code value to indicate a fatal error - - use cldfrc2m, only: aist_vector, rhmini_const, rhmaxi_const, rhminis_const, rhmaxis_const - use cam_history, only: outfld - - use macrop_driver, only: liquid_macro_tend - use clubb_mf, only: integrate_mf - - use perf_mod - -#endif - - implicit none - - ! ---------------------------------------------------- ! - ! Input Auguments ! - ! ---------------------------------------------------- ! - - type(physics_state), intent(in) :: state ! Physics state variables [vary] - type(cam_in_t), intent(in) :: cam_in - real(r8), intent(in) :: hdtime ! Host model timestep [s] - real(r8), intent(in) :: dlf(pcols,pver) ! Detraining cld H20 from deep convection [kg/ks/s] - real(r8), intent(in) :: cmfmc(pcols,pverp) ! convective mass flux--m sub c [kg/m2/s] - integer, intent(in) :: cld_macmic_num_steps ! number of mac-mic iterations - integer, intent(in) :: macmic_it ! number of mac-mic iterations - - ! ---------------------------------------------------- ! - ! Input-Output Auguments ! - ! ---------------------------------------------------- ! - - type(physics_buffer_desc), pointer :: pbuf(:) - - ! ---------------------------------------------------- ! - ! Output Auguments ! - ! ---------------------------------------------------- ! - - type(physics_ptend), intent(out) :: ptend_all ! package tendencies - - ! These two variables are needed for energy check - real(r8), intent(out) :: det_s(pcols) ! Integral of detrained static energy from ice - real(r8), intent(out) :: det_ice(pcols) ! Integral of detrained ice for energy check - - - ! ---------------------------------------------------- ! - ! Local Variables ! - ! ---------------------------------------------------- ! - -#ifdef CLUBB_SGS - - type(physics_state) :: state1 ! Local copy of state variable - type(physics_ptend) :: ptend_loc ! Local tendency from processes, added up to return as ptend_all - - integer :: i, j, k, t, ixind, nadv - integer :: ixcldice, ixcldliq, ixnumliq, ixnumice, ixq - integer :: itim_old - integer :: ncol, lchnk ! # of columns, and chunk identifier - integer :: err_code ! Diagnostic, for if some calculation goes amiss. - integer :: icnt - logical :: lq2(pcnst) - - integer :: iter - -<<<<<<< HEAD - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: edsclr_in(pverp+1-top_lev,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: tke_in(pverp+1-top_lev) ! TKE - real(r8) :: wp2_in(pverp+1-top_lev) ! vertical velocity variance (CLUBB) [m^2/s^2] - real(r8) :: wp3_in(pverp+1-top_lev) ! third moment vertical velocity [m^3/s^3] - real(r8) :: wpthlp_in(pverp+1-top_lev) ! turbulent flux of thetal [K m/s] - real(r8) :: wprtp_in(pverp+1-top_lev) ! turbulent flux of total water [kg/kg m/s] - real(r8) :: rtpthlp_in(pverp+1-top_lev) ! covariance of thetal and qt [kg/kg K] - real(r8) :: rtp2_in(pverp+1-top_lev) ! total water variance [kg^2/kg^2] - real(r8) :: thlp2_in(pverp+1-top_lev) ! thetal variance [K^2] - real(r8) :: rtp3_in(pverp+1-top_lev) ! total water 3rd order [kg^3/kg^3] - real(r8) :: thlp3_in(pverp+1-top_lev) ! thetal 3rd order [K^3] - real(r8) :: up2_in(pverp+1-top_lev) ! meridional wind variance [m^2/s^2] - real(r8) :: vp2_in(pverp+1-top_lev) ! zonal wind variance [m^2/s^2] - real(r8) :: up3_in(pverp+1-top_lev) ! meridional wind third-order [m^3/s^3] - real(r8) :: vp3_in(pverp+1-top_lev) ! zonal wind third-order [m^3/s^3] - real(r8) :: upwp_in(pverp+1-top_lev) ! meridional wind flux [m^2/s^2] - real(r8) :: vpwp_in(pverp+1-top_lev) ! zonal wind flux [m^2/s^2] - real(r8) :: wpthvp_in(pverp+1-top_lev) ! w'th_v' (momentum levels) [m/s K] - real(r8) :: wp2thvp_in(pverp+1-top_lev) ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8) :: rtpthvp_in(pverp+1-top_lev) ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8) :: thlpthvp_in(pverp+1-top_lev) ! th_l'th_v' (momentum levels) [K^2] - real(r8) :: thlm_in(pverp+1-top_lev) ! liquid water potential temperature (thetal) [K] - real(r8) :: rtm_in(pverp+1-top_lev) ! total water mixing ratio [kg/kg] - real(r8) :: rvm_in(pverp+1-top_lev) ! water vapor mixing ratio [kg/kg] - real(r8) :: um_in(pverp+1-top_lev) ! meridional wind [m/s] - real(r8) :: vm_in(pverp+1-top_lev) ! zonal wind [m/s] - real(r8) :: rho_in(pverp+1-top_lev) ! mid-point density [kg/m^3] - real(r8) :: pre_in(pverp+1-top_lev) ! input for precip evaporation - real(r8) :: rtp2_mc_out(pverp+1-top_lev) ! total water tendency from rain evap - real(r8) :: thlp2_mc_out(pverp+1-top_lev) ! thetal tendency from rain evap - real(r8) :: wprtp_mc_out(pverp+1-top_lev) - real(r8) :: wpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rtpthlp_mc_out(pverp+1-top_lev) - real(r8) :: rcm_inout(pverp+1-top_lev) ! CLUBB output of liquid water mixing ratio [kg/kg] - real(r8) :: rcm_out_zm(pverp+1-top_lev) - real(r8) :: wprcp_out(pverp+1-top_lev) ! CLUBB output of flux of liquid water [kg/kg m/s] - real(r8) :: cloud_frac_inout(pverp+1-top_lev) ! CLUBB output of cloud fraction [fraction] - real(r8) :: rcm_in_layer_out(pverp+1-top_lev) ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - real(r8) :: cloud_cover_out(pverp+1-top_lev) ! CLUBB output of in-cloud cloud fraction [fraction] - real(r8) :: thlprcp_out(pverp+1-top_lev) - real(r8) :: rho_ds_zm(pverp+1-top_lev) ! Dry, static density on momentum levels [kg/m^3] - real(r8) :: rho_ds_zt(pverp+1-top_lev) ! Dry, static density on thermodynamic levels [kg/m^3] - real(r8) :: invrs_rho_ds_zm(pverp+1-top_lev) ! Inv. dry, static density on momentum levels [m^3/kg] - real(r8) :: invrs_rho_ds_zt(pverp+1-top_lev) ! Inv. dry, static density on thermo. levels [m^3/kg] - real(r8) :: thv_ds_zm(pverp+1-top_lev) ! Dry, base-state theta_v on momentum levels [K] - real(r8) :: thv_ds_zt(pverp+1-top_lev) ! Dry, base-state theta_v on thermo. levels [K] - real(r8) :: rfrzm(pverp+1-top_lev) - real(r8) :: radf(pverp+1-top_lev) - real(r8) :: wprtp_forcing(pverp+1-top_lev) - real(r8) :: wpthlp_forcing(pverp+1-top_lev) - real(r8) :: rtp2_forcing(pverp+1-top_lev) - real(r8) :: thlp2_forcing(pverp+1-top_lev) - real(r8) :: rtpthlp_forcing(pverp+1-top_lev) - real(r8) :: ice_supersat_frac_out(pverp+1-top_lev) - real(r8) :: zt_g(pverp+1-top_lev) ! Thermodynamic grid of CLUBB [m] - real(r8) :: zi_g(pverp+1-top_lev) ! Momentum grid of CLUBB [m] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: fcor ! Coriolis forcing [s^-1] - real(r8) :: sfc_elevation ! Elevation of ground [m AMSL] [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: thlm_forcing(pverp+1-top_lev) ! theta_l forcing (thermodynamic levels) [K/s] - real(r8) :: rtm_forcing(pverp+1-top_lev) ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - real(r8) :: um_forcing(pverp+1-top_lev) ! u wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: vm_forcing(pverp+1-top_lev) ! v wind forcing (thermodynamic levels) [m/s/s] - real(r8) :: wm_zm(pverp+1-top_lev) ! w mean wind component on momentum levels [m/s] - real(r8) :: wm_zt(pverp+1-top_lev) ! w mean wind component on thermo. levels [m/s] - real(r8) :: p_in_Pa(pverp+1-top_lev) ! Air pressure (thermodynamic levels) [Pa] - real(r8) :: rho_zt(pverp+1-top_lev) ! Air density on thermo levels [kt/m^3] - real(r8) :: rho_zm(pverp+1-top_lev) ! Air density on momentum levels [kg/m^3] - real(r8) :: exner(pverp+1-top_lev) ! Exner function (thermodynamic levels) [-] - real(r8) :: wpthlp_sfc ! w' theta_l' at surface [(m K)/s] - real(r8) :: wprtp_sfc ! w' r_t' at surface [(kg m)/( kg s)] - real(r8) :: upwp_sfc ! u'w' at surface [m^2/s^2] - real(r8) :: vpwp_sfc ! v'w' at surface [m^2/s^2] - real(r8) :: sclrm_forcing(pverp+1-top_lev,sclr_dim) ! Passive scalar forcing [{units vary}/s] - real(r8) :: wpsclrp_sfc(sclr_dim) ! Scalar flux at surface [{units vary} m/s] - real(r8) :: edsclrm_forcing(pverp+1-top_lev,edsclr_dim)! Eddy passive scalar forcing [{units vary}/s] - real(r8) :: wpedsclrp_sfc(edsclr_dim) ! Eddy-scalar flux at surface [{units vary} m/s] - real(r8) :: sclrm(pverp+1-top_lev,sclr_dim) ! Passive scalar mean (thermo. levels) [units vary] - real(r8) :: wpsclrp(pverp+1-top_lev,sclr_dim)! w'sclr' (momentum levels) [{units vary} m/s] - real(r8) :: sclrp2(pverp+1-top_lev,sclr_dim) ! sclr'^2 (momentum levels) [{units vary}^2] - real(r8) :: sclrp3(pverp+1-top_lev,sclr_dim) ! sclr'^3 (thermo. levels) [{units vary}^3] - real(r8) :: sclrprtp(pverp+1-top_lev,sclr_dim) ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - real(r8) :: sclrpthlp(pverp+1-top_lev,sclr_dim) ! sclr'thlp' (momentum levels) [{units vary} (K)] - real(r8) :: sclrpthvp_inout(pverp,sclr_dim) ! sclr'th_v' (momentum levels) [{units vary} (K)] - real(r8) :: hydromet(pverp+1-top_lev,hydromet_dim) - real(r8) :: wphydrometp(pverp+1-top_lev,hydromet_dim) - real(r8) :: wp2hmp(pverp+1-top_lev,hydromet_dim) - real(r8) :: rtphmp_zt(pverp+1-top_lev,hydromet_dim) - real(r8) :: thlphmp_zt (pverp+1-top_lev,hydromet_dim) - real(r8) :: bflx22 ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: khzm_out(pverp+1-top_lev) ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8) :: khzt_out(pverp+1-top_lev) ! eddy diffusivity on thermo grids [m^2/s] - real(r8) :: qclvar_out(pverp+1-top_lev) ! cloud water variance [kg^2/kg^2] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo ! roughness height [m] - real(r8) :: dz_g(pver) ! thickness of layer [m] - real(r8) :: relvarmax - real(r8) :: se_upper_a, se_upper_b, se_upper_diss - real(r8) :: tw_upper_a, tw_upper_b, tw_upper_diss - real(r8) :: grid_dx(pcols), grid_dy(pcols) ! CAM grid [m] - real(r8) :: host_dx, host_dy ! CAM grid [m] - - ! Variables below are needed to compute energy integrals for conservation - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pver) - real(r8) :: eleak(pcols) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt(pverp+1-top_lev) ! CLUBB R-tot variance on thermo levs - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt(pverp+1-top_lev) ! CLUBB Theta-l variance on thermo levs [K^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt(pverp+1-top_lev) ! CLUBB W variance on theromo levs [m^2/s^2] - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: qrl_clubb(pverp+1-top_lev) - real(r8) :: qrl_zm(pverp+1-top_lev) - real(r8) :: thlp2_rad_out(pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - real(r8) :: dl_rad, di_rad, dt_low - - real(r8), dimension(nparams) :: clubb_params ! These adjustable CLUBB parameters (C1, C2 ...) - real(r8), dimension(sclr_dim) :: sclr_tol ! Tolerance on passive scalar [units vary] - - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing, rtm_integral_vtend, rtm_integral_ltend - - ! --------------- ! - ! Pointers ! - ! --------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: sh_icwmr ! shallow convection (EDMF) in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - - real(r8),pointer :: prec_sh(:) ! total precipitation from MF - real(r8),pointer :: snow_sh(:) ! snow from MF - - real(r8), pointer :: ztopmn(:,:) - real(r8), pointer :: ztopma(:) - real(r8), pointer :: ztopm1_macmic(:) - - real(r8), pointer :: ddcp(:) - real(r8), pointer :: ddcp_macmic(:) - real(r8), pointer :: ddcpmn(:,:) - - real(r8), pointer :: cbm1(:) - real(r8), pointer :: cbm1_macmic(:) - -!+++ARH - real(r8), pointer :: qtm_macmic1(:,:) - real(r8), pointer :: qtm_macmic2(:,:) - real(r8), pointer :: thlm_macmic1(:,:) - real(r8), pointer :: thlm_macmic2(:,:) -!---ARH - real(r8), pointer :: rcm_macmic(:,:) - real(r8), pointer :: cldfrac_macmic(:,:) - real(r8), pointer :: wpthlp_macmic(:,:) - real(r8), pointer :: wprtp_macmic(:,:) - real(r8), pointer :: wpthvp_macmic(:,:) - real(r8), pointer :: mf_thlflx_macmic(:,:) - real(r8), pointer :: mf_qtflx_macmic(:,:) - real(r8), pointer :: mf_thvflx_macmic(:,:) -!+++ARH - real(r8), pointer :: up_macmic1(:,:) - real(r8), pointer :: up_macmic2(:,:) - real(r8), pointer :: dn_macmic1(:,:) - real(r8), pointer :: dn_macmic2(:,:) - real(r8), pointer :: upa_macmic1(:,:) - real(r8), pointer :: upa_macmic2(:,:) - real(r8), pointer :: dna_macmic1(:,:) - real(r8), pointer :: dna_macmic2(:,:) - real(r8), pointer :: thlu_macmic1(:,:) - real(r8), pointer :: thlu_macmic2(:,:) - real(r8), pointer :: qtu_macmic1(:,:) - real(r8), pointer :: qtu_macmic2(:,:) - real(r8), pointer :: thld_macmic1(:,:) - real(r8), pointer :: thld_macmic2(:,:) - real(r8), pointer :: qtd_macmic1(:,:) - real(r8), pointer :: qtd_macmic2(:,:) - real(r8), pointer :: dthl_macmic1(:,:) - real(r8), pointer :: dthl_macmic2(:,:) - real(r8), pointer :: dqt_macmic1(:,:) - real(r8), pointer :: dqt_macmic2(:,:) - real(r8), pointer :: dthlu_macmic1(:,:) - real(r8), pointer :: dthlu_macmic2(:,:) - real(r8), pointer :: dqtu_macmic1(:,:) - real(r8), pointer :: dqtu_macmic2(:,:) - real(r8), pointer :: dthld_macmic1(:,:) - real(r8), pointer :: dthld_macmic2(:,:) - real(r8), pointer :: dqtd_macmic1(:,:) - real(r8), pointer :: dqtd_macmic2(:,:) - real(r8), pointer :: ztop_macmic1(:,:) - real(r8), pointer :: ztop_macmic2(:,:) - real(r8), pointer :: ddcp_macmic1(:,:) - real(r8), pointer :: ddcp_macmic2(:,:) -!---ARH - - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface - - ! MF outputs to outfld - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthlup_output, s_awqtup_output, s_awuup_output, s_awvup_output, & - s_awthldn_output, s_awqtdn_output, s_awudn_output, s_awvdn_output, & - s_awthl_output, s_awqt_output, & - s_awu_output, s_awv_output, & - s_aww_output, & - mf_thlflxup_output,mf_qtflxup_output, mf_uflxup_output, mf_vflxup_output, & - mf_thlflxdn_output,mf_qtflxdn_output, mf_uflxdn_output, mf_vflxdn_output, & - mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & - mf_thvflx_output, & - mf_rcm_output, mf_precc_output - ! - real(r8), dimension(pcols) :: mf_ztop_output, mf_L0_output, & - mf_cape_output, mf_cfl_output, & - mf_ddcp_output, mf_freq_output - ! - ! MF outputs to outfld - real(r8), dimension(pcols,pver) :: mf_thlforcup_output, mf_qtforcup_output, & ! thermodynamic grid - mf_thlforcdn_output, mf_qtforcdn_output, & ! thermodynamic grid - mf_thlforc_output, mf_qtforc_output, & ! thermodynamic grid - mf_ent_output, & ! thermodynamic grid - mf_sqtup_output, mf_sqtdn_output, & ! thermodynamic grid - mf_qc_output, mf_cloudfrac_output ! thermodynamic grid - - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa_flip, & - mf_upw_flip, & - mf_upmf_flip, & - mf_upqt_flip, & - mf_upthl_flip, & - mf_upthv_flip, & - mf_upth_flip, & - mf_upqc_flip, & - mf_upbuoy_flip, & - mf_upent_flip, & - mf_updet_flip - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_upa_output, & - mf_upw_output, & - mf_upmf_output, & - mf_upqt_output, & - mf_upthl_output, & - mf_upthv_output, & - mf_upth_output, & - mf_upqc_output, & - mf_upent_output, & - mf_updet_output, & - mf_upbuoy_output - ! MF plume level outputs - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_dnw_flip, & - mf_dnthl_flip, & - mf_dnqt_flip - - ! MF plume level outputs to outfld - real(r8), dimension(pcols,pverp*clubb_mf_nup) :: mf_dnw_output, & - mf_dnthl_output, & - mf_dnqt_output - - ! MF Plume - real(r8), pointer :: tpert(:) - real(r8), dimension(pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - s_ae, s_ac, & - s_aup, s_adn, & - s_aw, & - s_awup, s_awdn, & - s_aww, & - s_awwup, s_awwdn, & - s_awthlup, s_awqtup, s_awuup, s_awvup, & - s_awthldn, s_awqtdn, s_awudn, s_awvdn, & - s_awthl, s_awqt, & - s_awu, s_awv, & - mf_sqtup, mf_sthlup, & - mf_sqtdn, mf_sthldn, & - mf_sqt, mf_sthl, & - mf_precc - - real(r8), dimension(pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & - mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & - mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & - mf_thvflx, & - mf_thlforcup, mf_qtforcup, & - mf_thlforcdn, mf_qtforcdn, & - mf_thlforcup_nadv,mf_qtforcup_nadv, & - mf_thlforcdn_nadv,mf_qtforcdn_nadv, & - mf_thlforc_nadv, mf_qtforc_nadv, & - mf_qc, mf_cloudfrac, & - mf_qc_nadv, mf_cloudfrac_nadv, & - mf_qc_zt, mf_cloudfrac_zt, & - mf_rcm, mf_rcm_nadv, & - mf_ent_nadv - - ! MF plume level - real(r8), dimension(pverp,clubb_mf_nup) :: mf_upa, mf_dna, & - mf_upw, mf_dnw, & - mf_upmf, & - mf_upqt, mf_dnqt, & - mf_upthl, mf_dnthl, & - mf_upthv, mf_dnthv, & - mf_upth, mf_dnth, & - mf_upqc, mf_dnqc, & - mf_upbuoy, & - mf_updet, & - mf_upent - - real(r8), dimension(pverp,clubb_mf_nup) :: flip - real(r8), dimension(pverp) :: lilflip - - ! CFL limiter vars - real(r8), parameter :: cflval = 1._r8 - real(r8) :: cflfac, max_cfl, & - lambda, max_cfl_nadv, & - th_sfc - - logical :: cfllim - - real(r8) :: mf_ztop, mf_ztop_nadv, & - mf_ztopm1, mf_ztopm1_nadv, & - mf_precc_nadv, mf_snow_nadv,& - mf_L0, mf_L0_nadv, & - mf_ddcp, mf_ddcp_nadv, & - mf_cbm1, mf_cbm1_nadv, & - mf_freq_nadv - - real(r8), dimension(pcols,pver) :: esat, rh - real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(pcols) :: rhlev - real(r8) :: rhinv - - ! MF local vars - real(r8), dimension(pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - th_zt, qv_zt, & ! momentum grid - th_zm, qv_zm, & ! momentum grid - qc_zm, & ! momentum grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - dzm, invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - real(r8) :: valmax - - integer :: nlev - - intrinsic :: max - - character(len=*), parameter :: subr='clubb_tend_cam' -======= - integer :: clubbtop(pcols) - - real(r8) :: frac_limit, ic_limit - - real(r8) :: dtime ! CLUBB time step [s] - real(r8) :: zt_out(pcols,pverp) ! output for the thermo CLUBB grid [m] - real(r8) :: zi_out(pcols,pverp) ! output for momentum CLUBB grid [m] - real(r8) :: ubar ! surface wind [m/s] - real(r8) :: ustar ! surface stress [m/s] - real(r8) :: z0 ! roughness height [m] - real(r8) :: bflx22(pcols) ! Variable for buoyancy flux for pbl [K m/s] - real(r8) :: qclvar(pcols,pverp) ! cloud water variance [kg^2/kg^2] - real(r8) :: zo(pcols) ! roughness height [m] - real(r8) :: dz_g(pcols,pver) ! thickness of layer [m] - real(r8) :: relvarmax - - ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api - ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES - real(r8), dimension(state%ncol) :: & - fcor, & ! Coriolis forcing [s^-1] - sfc_elevation, & ! Elevation of ground [m AMSL][m] - wpthlp_sfc, & ! w' theta_l' at surface [(m K)/s] - wprtp_sfc, & ! w' r_t' at surface [(kg m)/( kg s)] - upwp_sfc, & ! u'w' at surface [m^2/s^2] - vpwp_sfc, & ! v'w' at surface [m^2/s^2] - upwp_sfc_pert, & ! perturbed u'w' at surface [m^2/s^2] - vpwp_sfc_pert, & ! perturbed v'w' at surface [m^2/s^2] - grid_dx, grid_dy ! CAM grid [m] - - real(r8), dimension(state%ncol,sclr_dim) :: & - wpsclrp_sfc ! Scalar flux at surface [{units vary} m/s] - - real(r8), dimension(state%ncol,edsclr_dim) :: & - wpedsclrp_sfc ! Eddy-scalar flux at surface [{units vary} m/s] - - ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api - ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES - real(r8), dimension(state%ncol,pverp+1-top_lev) :: & - thlm_forcing, & ! theta_l forcing (thermodynamic levels) [K/s] - rtm_forcing, & ! r_t forcing (thermodynamic levels) [(kg/kg)/s] - um_forcing, & ! u wind forcing (thermodynamic levels) [m/s/s] - vm_forcing, & ! v wind forcing (thermodynamic levels) [m/s/s] - wprtp_forcing, & - wpthlp_forcing, & - rtp2_forcing, & - thlp2_forcing, & - rtpthlp_forcing, & - wm_zm, & ! w mean wind component on momentum levels [m/s] - wm_zt, & ! w mean wind component on thermo. levels [m/s] - rtm_ref, & ! Initial profile of rtm [kg/kg] - thlm_ref, & ! Initial profile of thlm [K] - um_ref, & ! Initial profile of um [m/s] - vm_ref, & ! Initial profile of vm [m/s] - ug, & ! U geostrophic wind [m/s] - vg, & ! V geostrophic wind [m/s] - p_in_Pa, & ! Air pressure (thermodynamic levels) [Pa] - rho_zm, & ! Air density on momentum levels [kg/m^3] - rho_zt, & ! Air density on thermo levels [kg/m^3] - exner, & ! Exner function (thermodynamic levels) [-] - rho_ds_zm, & ! Dry, static density on momentum levels [kg/m^3] - rho_ds_zt, & ! Dry, static density on thermodynamic levels [kg/m^3] - invrs_rho_ds_zm, & ! Inv. dry, static density on momentum levels [m^3/kg] - invrs_rho_ds_zt, & ! Inv. dry, static density on thermo. levels [m^3/kg] - thv_ds_zm, & ! Dry, base-state theta_v on momentum levels [K] - thv_ds_zt, & ! Dry, base-state theta_v on thermo. levels [K] - rfrzm, & - radf, & - um_in, & ! meridional wind [m/s] - vm_in, & ! zonal wind [m/s] - upwp_in, & ! meridional wind flux [m^2/s^2] - vpwp_in, & ! zonal wind flux [m^2/s^2] - up2_in, & ! meridional wind variance [m^2/s^2] - vp2_in, & ! zonal wind variance [m^2/s^2] - up3_in, & ! meridional wind third-order [m^3/s^3] - vp3_in, & ! zonal wind third-order [m^3/s^3] - thlm_in, & ! liquid water potential temperature (thetal) [K] - rvm_in, & ! water vapor mixing ratio [kg/kg] - rtm_in, & ! total water mixing ratio [kg/kg] - wprtp_in, & ! turbulent flux of total water [kg/kg m/s] - wpthlp_in, & ! turbulent flux of thetal [K m/s] - wp2_in, & ! vertical velocity variance (CLUBB) [m^2/s^2] - wp3_in, & ! third moment vertical velocity [m^3/s^3] - rtp2_in, & ! total water variance [kg^2/kg^2] - rtp2_zt, & ! CLUBB R-tot variance on thermo levs - thl2_zt, & ! CLUBB Theta-l variance on thermo levs [K^2] - wp2_zt, & ! CLUBB W variance on theromo levs [m^2/s^2] - rtp3_in, & ! total water 3rd order [kg^3/kg^3] - thlp2_in, & ! thetal variance [K^2] - thlp3_in, & ! thetal 3rd order [K^3] - rtpthlp_in, & ! covariance of thetal and qt [kg/kg K] - rcm_inout, & ! CLUBB output of liquid water mixing ratio [kg/kg] - rcm_out_zm, & - cloud_frac_inout, & ! CLUBB output of cloud fraction [fraction] - wpthvp_in, & ! w'th_v' (momentum levels) [m/s K] - wp2thvp_in, & ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - rtpthvp_in, & ! r_t'th_v' (momentum levels) [kg/kg K] - thlpthvp_in, & ! th_l'th_v' (momentum levels) [K^2] - ice_supersat_frac_inout, & - um_pert_inout, & ! Perturbed U wind [m/s] - vm_pert_inout, & ! Perturbed V wind [m/s] - upwp_pert_inout, & ! Perturbed u'w' [m^2/s^2] - vpwp_pert_inout, & ! Perturbed v'w' [m^2/s^2] - khzm_out, & ! Eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - khzt_out, & ! eddy diffusivity on thermo grids [m^2/s] - qclvar_out, & ! cloud water variance [kg^2/kg^2] - thlprcp_out, & - wprcp_out, & ! CLUBB output of flux of liquid water [kg/kg m/s] - w_up_in_cloud_out, & - w_down_in_cloud_out, & - cloudy_updraft_frac_out, & - cloudy_downdraft_frac_out,& - rcm_in_layer_out, & ! CLUBB output of in-cloud liq. wat. mix. ratio [kg/kg] - cloud_cover_out, & ! CLUBB output of in-cloud cloud fraction [fraction] - invrs_tau_zm_out, & ! CLUBB output of 1 divided by time-scale [1/s] - rtp2_mc_out, & ! total water tendency from rain evap - thlp2_mc_out, & ! thetal tendency from rain evap - wprtp_mc_out, & - wpthlp_mc_out, & - rtpthlp_mc_out, & - pre_in, & ! input for precip evaporation - qrl_clubb, & - qrl_zm, & - wp2rtp_inout, & ! w'^2 rt' (thermodynamic levels) - wp2thlp_inout, & ! w'^2 thl' (thermodynamic levels) - uprcp_inout, & ! < u' r_c' > (momentum levels) - vprcp_inout, & ! < v' r_c' > (momentum levels) - rc_coef_inout, & ! Coef. of X'r_c' in Eq. (34) (t-levs.) - wp4_inout, & ! w'^4 (momentum levels - wpup2_inout, & ! w'u'^2 (thermodynamic levels) - wpvp2_inout, & ! w'v'^2 (thermodynamic levels) - wp2up2_inout, & ! w'^2 u'^2 (momentum levels) - wp2vp2_inout, & ! w'^2 v'^2 (momentum levels) - zt_g, & ! Thermodynamic grid of CLUBB [m] - zi_g ! Momentum grid of CLUBB [m] - - ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api - ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES - real(r8), dimension(state%ncol,pverp+1-top_lev,sclr_dim) :: & - sclrm_forcing, & ! Passive scalar forcing [{units vary}/s] - sclrm, & ! Passive scalar mean (thermo. levels) [units vary] - sclrp2, & ! sclr'^2 (momentum levels) [{units vary}^2] - sclrp3, & ! sclr'^3 (thermo. levels) [{units vary}^3] - sclrprtp, & ! sclr'rt' (momentum levels) [{units vary} (kg/kg)] - sclrpthlp, & ! sclr'thlp' (momentum levels) [{units vary} (K)] - wpsclrp ! w'sclr' (momentum levels) [{units vary} m/s] - - real(r8), dimension(state%ncol,pverp,sclr_dim) :: & - sclrpthvp_inout ! sclr'th_v' (momentum levels) [{units vary} (K)] - - real(r8), dimension(state%ncol,pverp+1-top_lev,edsclr_dim) :: & - edsclrm_forcing, & ! Eddy passive scalar forcing [{units vary}/s] - edsclr_in ! Scalars to be diffused through CLUBB [units vary] - - ! Local CLUBB variables dimensioned as NCOL (only useful columns) to be sent into the clubb run api - ! NOTE: THESE VARIABLS SHOULD NOT BE USED IN PBUF OR OUTFLD (HISTORY) SUBROUTINES - real(r8), dimension(state%ncol,pverp+1-top_lev,hydromet_dim) :: & - hydromet, & - wphydrometp, & - wp2hmp, & - rtphmp_zt, & - thlphmp_zt - - ! Variables below are needed to compute energy integrals for conservation - ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines - real(r8) :: ke_a(pcols), ke_b(pcols), te_a(pcols), te_b(pcols) - real(r8) :: wv_a(pcols), wv_b(pcols), wl_b(pcols), wl_a(pcols) - real(r8) :: se_dis(pcols), se_a(pcols), se_b(pcols), clubb_s(pcols,pver) - real(r8) :: eleak(pcols) - - real(r8) :: inv_exner_clubb(pcols,pverp) ! Inverse exner function consistent with CLUBB [-] - real(r8) :: inv_exner_clubb_surf(pcols) ! Inverse exner function at the surface - real(r8) :: wpthlp_output(pcols,pverp) ! Heat flux output variable [W/m2] - real(r8) :: wprtp_output(pcols,pverp) ! Total water flux output variable [W/m2] - real(r8) :: wp3_output(pcols,pverp) ! wp3 output [m^3/s^3] - real(r8) :: rtpthlp_output(pcols,pverp) ! rtpthlp ouptut [K kg/kg] - real(r8) :: qt_output(pcols,pver) ! Total water mixing ratio for output [kg/kg] - real(r8) :: thetal_output(pcols,pver) ! Liquid water potential temperature output [K] - real(r8) :: sl_output(pcols,pver) ! Liquid water static energy [J/kg] - real(r8) :: ustar2(pcols) ! Surface stress for PBL height [m2/s2] - real(r8) :: rho(pcols,pverp) ! Midpoint density in CAM [kg/m^3] - real(r8) :: thv(pcols,pverp) ! virtual potential temperature [K] - real(r8) :: edsclr_out(pcols,pverp,edsclr_dim) ! Scalars to be diffused through CLUBB [units vary] - real(r8) :: rcm_in_layer(pcols,pverp) ! CLUBB in-cloud liquid water mixing ratio [kg/kg] - real(r8) :: cloud_cover(pcols,pverp) ! CLUBB in-cloud cloud fraction [fraction] - real(r8) :: wprcp(pcols,pverp) ! CLUBB liquid water flux [m/s kg/kg] - real(r8) :: wpthvp_diag(pcols,pverp) ! CLUBB buoyancy flux [W/m^2] - real(r8) :: rvm(pcols,pverp) - real(r8) :: pdfp_rtp2(pcols, pverp) ! Calculated R-tot variance from pdf_params [kg^2/kg^2] - real(r8) :: rtp2_zt_out(pcols, pverp) ! CLUBB R-tot variance on thermo levs [kg^2/kg^2] - real(r8) :: thl2_zt_out(pcols, pverp) ! CLUBB Theta-l variance on thermo levs - real(r8) :: wp2_zt_out(pcols, pverp) - real(r8) :: dlf_liq_out(pcols, pverp) ! Detrained liquid water from ZM [kg/kg/s] - real(r8) :: dlf_ice_out(pcols, pverp) ! Detrained ice water from ZM [kg/kg/s] - real(r8) :: wm_zt_out(pcols, pverp) ! CLUBB mean W on thermo levs output [m/s] - real(r8) :: mean_rt ! Calculated R-tot mean from pdf_params (temp) [kg/kg] - real(r8) :: dlf2(pcols,pver) ! Detraining cld H20 from shallow convection [kg/kg/day] - real(r8) :: eps ! Rv/Rd [-] - real(r8) :: dum1 ! dummy variable [units vary] - real(r8) :: obklen(pcols) ! Obukov length [m] - real(r8) :: kbfs(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: th(pcols,pver) ! potential temperature [K] - real(r8) :: dummy2(pcols) ! dummy variable [units vary] - real(r8) :: dummy3(pcols) ! dummy variable [units vary] - real(r8) :: kinheat(pcols) ! Kinematic Surface heat flux [K m/s] - real(r8) :: rrho(pcols) ! Inverse of air density [1/kg/m^3] - real(r8) :: kinwat(pcols) ! Kinematic water vapor flux [m/s] - real(r8) :: latsub - real(r8) :: thlp2_rad_out(pcols,pverp+1-top_lev) - real(r8) :: apply_const, rtm_test - real(r8) :: dl_rad, di_rad, dt_low - - character(len=200) :: temp1, sub ! Strings needed for CLUBB output - real(kind=time_precision) :: time_elapsed ! time keep track of stats [s] - integer :: stats_nsamp, stats_nout ! Stats sampling and output intervals for CLUBB [timestep] - - real(r8) :: rtm_integral_1, rtm_integral_update, rtm_integral_forcing - - ! ---------------------------------------------------- ! - ! Pointers ! - ! ---------------------------------------------------- ! - - real(r8), pointer, dimension(:,:) :: wp2 ! vertical velocity variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wp3 ! third moment of vertical velocity [m^3/s^3] - real(r8), pointer, dimension(:,:) :: wpthlp ! turbulent flux of thetal [m/s K] - real(r8), pointer, dimension(:,:) :: wprtp ! turbulent flux of moisture [m/s kg/kg] - real(r8), pointer, dimension(:,:) :: rtpthlp ! covariance of thetal and qt [kg/kg K] - real(r8), pointer, dimension(:,:) :: rtp2 ! moisture variance [kg^2/kg^2] - real(r8), pointer, dimension(:,:) :: thlp2 ! temperature variance [K^2] - real(r8), pointer, dimension(:,:) :: rtp3 ! moisture 3rd order [kg^3/kg^3] - real(r8), pointer, dimension(:,:) :: thlp3 ! temperature 3rd order [K^3] - real(r8), pointer, dimension(:,:) :: up2 ! east-west wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vp2 ! north-south wind variance [m^2/s^2] - real(r8), pointer, dimension(:,:) :: up3 ! east-west wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: vp3 ! north-south wind 3rd order [m^3/s^3] - real(r8), pointer, dimension(:,:) :: upwp ! east-west momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: vpwp ! north-south momentum flux [m^2/s^2] - real(r8), pointer, dimension(:,:) :: wpthvp ! w'th_v' (momentum levels) [m/s K] - real(r8), pointer, dimension(:,:) :: wp2thvp ! w'^2 th_v' (thermodynamic levels) [m^2/s^2 K] - real(r8), pointer, dimension(:,:) :: rtpthvp ! r_t'th_v' (momentum levels) [kg/kg K] - real(r8), pointer, dimension(:,:) :: thlpthvp ! th_l'th_v' (momentum levels) [K^2] - real(r8), pointer, dimension(:,:) :: cloud_frac ! Cloud fraction (thermodynamic levels) [K^2] - real(r8), pointer, dimension(:,:) :: pdf_zm_w_1 !work pointer for pdf_params_zm - real(r8), pointer, dimension(:,:) :: pdf_zm_w_2 !work pointer for pdf_params_zm - real(r8), pointer, dimension(:,:) :: pdf_zm_varnce_w_1 !work pointer for pdf_params_zm - real(r8), pointer, dimension(:,:) :: pdf_zm_varnce_w_2 !work pointer for pdf_params_zm - real(r8), pointer, dimension(:,:) :: pdf_zm_mixt_frac !work pointer for pdf_params_zm - real(r8), pointer, dimension(:,:) :: wp2rtp ! w'^2 rt' (thermodynamic levels) - real(r8), pointer, dimension(:,:) :: wp2thlp ! w'^2 thl' (thermodynamic levels) - real(r8), pointer, dimension(:,:) :: uprcp ! < u' r_c' > (momentum levels) - real(r8), pointer, dimension(:,:) :: vprcp ! < v' r_c' > (momentum levels) - real(r8), pointer, dimension(:,:) :: rc_coef ! Coef. of X'r_c' in Eq. (34) (t-levs.) - real(r8), pointer, dimension(:,:) :: wp4 ! w'^4 (momentum levels - real(r8), pointer, dimension(:,:) :: wpup2 ! w'u'^2 (thermodynamic levels) - real(r8), pointer, dimension(:,:) :: wpvp2 ! w'v'^2 (thermodynamic levels) - real(r8), pointer, dimension(:,:) :: wp2up2 ! w'^2 u'^2 (momentum levels) - real(r8), pointer, dimension(:,:) :: wp2vp2 ! w'^2 v'^2 (momentum levels) - real(r8), pointer, dimension(:,:) :: thlm ! mean temperature [K] - real(r8), pointer, dimension(:,:) :: rtm ! mean moisture mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: rcm ! CLUBB cloud water mixing ratio [kg/kg] - real(r8), pointer, dimension(:) :: ztodtptr ! timestep to send to SILHS - real(r8), pointer, dimension(:,:) :: um ! mean east-west wind [m/s] - real(r8), pointer, dimension(:,:) :: vm ! mean north-south wind [m/s] - real(r8), pointer, dimension(:,:) :: cld ! cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: concld ! convective cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: ast ! stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: alst ! liquid stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: aist ! ice stratiform cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: qlst ! Physical in-stratus LWC [kg/kg] - real(r8), pointer, dimension(:,:) :: qist ! Physical in-stratus IWC [kg/kg] - real(r8), pointer, dimension(:,:) :: deepcu ! deep convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: shalcu ! shallow convection cloud fraction [fraction] - real(r8), pointer, dimension(:,:) :: khzm ! CLUBB's eddy diffusivity of heat/moisture on momentum (i.e. interface) levels [m^2/s] - real(r8), pointer, dimension(:) :: pblh ! planetary boundary layer height [m] - real(r8), pointer, dimension(:,:) :: tke ! turbulent kinetic energy [m^2/s^2] - real(r8), pointer, dimension(:,:) :: dp_icwmr ! deep convection in cloud mixing ratio [kg/kg] - real(r8), pointer, dimension(:,:) :: ice_supersat_frac ! Cloud fraction of ice clouds (pverp)[fraction] - real(r8), pointer, dimension(:,:) :: relvar ! relative cloud water variance [-] - real(r8), pointer, dimension(:,:) :: accre_enhan ! accretion enhancement factor [-] - real(r8), pointer, dimension(:,:) :: naai - real(r8), pointer, dimension(:,:) :: cmeliq - real(r8), pointer, dimension(:,:) :: cmfmc_sh ! Shallow convective mass flux--m subc (pcols,pverp) [kg/m2/s/] - - real(r8), pointer, dimension(:,:) :: qsatfac - real(r8), pointer, dimension(:,:) :: npccn - real(r8), pointer, dimension(:,:) :: prer_evap - real(r8), pointer, dimension(:,:) :: qrl - real(r8), pointer, dimension(:,:) :: radf_clubb - - ! SILHS covariance contributions - real(r8), pointer, dimension(:,:) :: rtp2_mc_zt - real(r8), pointer, dimension(:,:) :: thlp2_mc_zt - real(r8), pointer, dimension(:,:) :: wprtp_mc_zt - real(r8), pointer, dimension(:,:) :: wpthlp_mc_zt - real(r8), pointer, dimension(:,:) :: rtpthlp_mc_zt - - real(r8) qitend(pcols,pver) - real(r8) initend(pcols,pver) ! Needed for ice supersaturation adjustment calculation - - ! ZM microphysics - real(r8), pointer :: dlfzm(:,:) ! ZM detrained convective cloud water mixing ratio. - real(r8), pointer :: difzm(:,:) ! ZM detrained convective cloud ice mixing ratio. - real(r8), pointer :: dnlfzm(:,:) ! ZM detrained convective cloud water num concen. - real(r8), pointer :: dnifzm(:,:) ! ZM detrained convective cloud ice num concen. - - real(r8) :: stend(pcols,pver) - real(r8) :: qvtend(pcols,pver) - real(r8) :: qctend(pcols,pver) - real(r8) :: inctend(pcols,pver) - real(r8) :: fqtend(pcols,pver) - real(r8) :: rhmini(pcols) - real(r8) :: rhmaxi(pcols) - integer :: troplev(pcols) - logical :: lqice(pcnst) - logical :: apply_to_surface(pcols) - - ! MF outputs to outfld - ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines - real(r8), dimension(pcols,pverp) :: mf_dry_a_output, mf_moist_a_output, & - mf_dry_w_output, mf_moist_w_output, & - mf_dry_qt_output, mf_moist_qt_output, & - mf_dry_thl_output, mf_moist_thl_output, & - mf_dry_u_output, mf_moist_u_output, & - mf_dry_v_output, mf_moist_v_output, & - mf_moist_qc_output, & - s_ae_output, s_aw_output, & - s_awthl_output, s_awqt_output, & - s_awql_output, s_awqi_output, & - s_awu_output, s_awv_output, & - mf_thlflx_output, mf_qtflx_output - ! MF Plume - ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines - real(r8), dimension(pcols,pverp) :: mf_dry_a, mf_moist_a, & - mf_dry_w, mf_moist_w, & - mf_dry_qt, mf_moist_qt, & - mf_dry_thl, mf_moist_thl, & - mf_dry_u, mf_moist_u, & - mf_dry_v, mf_moist_v, & - mf_moist_qc, & - s_ae, s_aw, & - s_awthl, s_awqt, & - s_awql, s_awqi, & - s_awu, s_awv, & - mf_thlflx, mf_qtflx - - real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend - - ! MF local vars - real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - dzt, invrs_dzt, & ! thermodynamic grid - invrs_exner_zt,& ! thermodynamic grid - kappa_zt, qc_zt, & ! thermodynamic grid - kappa_zm, p_in_Pa_zm, & ! momentum grid - invrs_exner_zm ! momentum grid - - real(r8) :: temp2d(pcols,pver), temp2dp(pcols,pverp) ! temporary array for holding scaled outputs - - integer :: nlev - - intrinsic :: max ->>>>>>> ESCOMP/cam_development - - character(len=*), parameter :: subr='clubb_tend_cam' - - type(grid) :: gr - integer :: begin_height, end_height - - type(nu_vertical_res_dep) :: nu_vert_res_dep ! Vertical resolution dependent nu values - real(r8) :: lmin - -#endif - det_s(:) = 0.0_r8 - det_ice(:) = 0.0_r8 - -#ifdef CLUBB_SGS - - !-----------------------------------------------------------------------------------! - ! MAIN COMPUTATION BEGINS HERE ! ! - !-----------------------------------------------------------------------------------! - - call t_startf("clubb_tend_cam") - - nlev = pver + 1 - top_lev - - rtp2_zt_out = 0._r8 - thl2_zt_out = 0._r8 - wp2_zt_out = 0._r8 - pdfp_rtp2 = 0._r8 - wm_zt_out = 0._r8 - - temp2d = 0._r8 - temp2dp = 0._r8 - - dl_rad = clubb_detliq_rad - di_rad = clubb_detice_rad - dt_low = clubb_detphase_lowtemp - - frac_limit = 0.01_r8 - ic_limit = 1.e-12_r8 - inv_rh2o = 1._r8/rh2o - - if (clubb_do_adv) then - apply_const = 1._r8 ! Initialize to one, only if CLUBB's moments are advected - else - apply_const = 0._r8 ! Never want this if CLUBB's moments are not advected - endif - - ! Get indicees for cloud and ice mass and cloud and ice number - call cnst_get_ind('Q',ixq) - call cnst_get_ind('CLDLIQ',ixcldliq) - call cnst_get_ind('CLDICE',ixcldice) - call cnst_get_ind('NUMLIQ',ixnumliq) - call cnst_get_ind('NUMICE',ixnumice) - - if (clubb_do_icesuper) then - call pbuf_get_field(pbuf, naai_idx, naai) - end if - - ! Initialize physics tendency arrays, copy the state to state1 array to use in this routine - call physics_ptend_init(ptend_all, state%psetcols, 'clubb') - - ! Copy the state to state1 array to use in this routine - call physics_state_copy(state, state1) - - ! constituents are all treated as dry mmr by clubb - call set_wet_to_dry(state1) - - if (clubb_do_liqsupersat) then - call pbuf_get_field(pbuf, npccn_idx, npccn) - endif - - ! Determine number of columns and which chunk computation is to be performed on - ncol = state%ncol - lchnk = state%lchnk - - ! Determine time step of physics buffer - itim_old = pbuf_old_tim_idx() - - ! Establish associations between pointers and physics buffer fields - call pbuf_get_field(pbuf, wp2_idx, wp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wp3_idx, wp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthlp_idx, wpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wprtp_idx, wprtp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtpthlp_idx, rtpthlp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtp2_idx, rtp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp2_idx, thlp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up2_idx, up2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp2_idx, vp2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, rtp3_idx, rtp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, thlp3_idx, thlp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, up3_idx, up3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vp3_idx, vp3, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, upwp_idx, upwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vpwp_idx, vpwp, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, wpthvp_idx, wpthvp) - call pbuf_get_field(pbuf, wp2thvp_idx, wp2thvp) - call pbuf_get_field(pbuf, rtpthvp_idx, rtpthvp) - call pbuf_get_field(pbuf, thlpthvp_idx,thlpthvp) - call pbuf_get_field(pbuf, rcm_idx, rcm) - call pbuf_get_field(pbuf, cloud_frac_idx, cloud_frac) - - call pbuf_get_field(pbuf, pdf_zm_w_1_idx, pdf_zm_w_1, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, pdf_zm_w_2_idx, pdf_zm_w_2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, pdf_zm_varnce_w_1_idx, pdf_zm_varnce_w_1, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, pdf_zm_varnce_w_2_idx, pdf_zm_varnce_w_2, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, pdf_zm_mixt_frac_idx, pdf_zm_mixt_frac, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, wp2rtp_idx, wp2rtp) - call pbuf_get_field(pbuf, wp2thlp_idx, wp2thlp) - call pbuf_get_field(pbuf, uprcp_idx, uprcp) - call pbuf_get_field(pbuf, vprcp_idx, vprcp) - call pbuf_get_field(pbuf, rc_coef_idx, rc_coef) - call pbuf_get_field(pbuf, wp4_idx, wp4) - call pbuf_get_field(pbuf, wpup2_idx, wpup2) - call pbuf_get_field(pbuf, wpvp2_idx, wpvp2) - call pbuf_get_field(pbuf, wp2up2_idx, wp2up2) - call pbuf_get_field(pbuf, wp2vp2_idx, wp2vp2) - call pbuf_get_field(pbuf, thlm_idx, thlm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, rtm_idx, rtm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, um_idx, um, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - call pbuf_get_field(pbuf, vm_idx, vm, start=(/1,1,itim_old/), kount=(/pcols,pverp,1/)) - - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - -<<<<<<< HEAD - call pbuf_get_field(pbuf, tke_idx, tke) - call pbuf_get_field(pbuf, qrl_idx, qrl) - call pbuf_get_field(pbuf, radf_idx, radf_clubb) - - call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, concld_idx, concld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, ast_idx, ast, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, alst_idx, alst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, aist_idx, aist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qlst_idx, qlst, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - call pbuf_get_field(pbuf, qist_idx, qist, start=(/1,1,itim_old/), kount=(/pcols,pver,1/)) - - call pbuf_get_field(pbuf, qsatfac_idx, qsatfac) - - call pbuf_get_field(pbuf, prer_evap_idx, prer_evap) - call pbuf_get_field(pbuf, accre_enhan_idx, accre_enhan) - call pbuf_get_field(pbuf, cmeliq_idx, cmeliq) - call pbuf_get_field(pbuf, ice_supersat_idx, ice_supersat_frac) - call pbuf_get_field(pbuf, ztodt_idx, ztodtptr) - call pbuf_get_field(pbuf, relvar_idx, relvar) - call pbuf_get_field(pbuf, dp_frac_idx, deepcu) - call pbuf_get_field(pbuf, sh_frac_idx, shalcu) - call pbuf_get_field(pbuf, kvh_idx, khzm) - call pbuf_get_field(pbuf, pblh_idx, pblh) - call pbuf_get_field(pbuf, icwmrdp_idx, dp_icwmr) - call pbuf_get_field(pbuf, icwmrsh_idx, sh_icwmr) - call pbuf_get_field(pbuf, cmfmc_sh_idx, cmfmc_sh) - - call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) - call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) - - ! SILHS covariance contributions - call pbuf_get_field(pbuf, rtp2_mc_zt_idx, rtp2_mc_zt) - call pbuf_get_field(pbuf, thlp2_mc_zt_idx, thlp2_mc_zt) - call pbuf_get_field(pbuf, wprtp_mc_zt_idx, wprtp_mc_zt) - call pbuf_get_field(pbuf, wpthlp_mc_zt_idx, wpthlp_mc_zt) - call pbuf_get_field(pbuf, rtpthlp_mc_zt_idx, rtpthlp_mc_zt) - -!+++ARH - call pbuf_get_field(pbuf, qtm_macmic1_idx, qtm_macmic1) - call pbuf_get_field(pbuf, qtm_macmic2_idx, qtm_macmic2) - call pbuf_get_field(pbuf, thlm_macmic1_idx, thlm_macmic1) - call pbuf_get_field(pbuf, thlm_macmic2_idx, thlm_macmic2) -!---ARH - call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) - call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) - call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) - call pbuf_get_field(pbuf, wprtp_macmic_idx, wprtp_macmic) - call pbuf_get_field(pbuf, wpthvp_macmic_idx, wpthvp_macmic) - if (do_clubb_mf) then - call pbuf_get_field(pbuf, mf_wpthlp_macmic_idx, mf_thlflx_macmic) - call pbuf_get_field(pbuf, mf_wprtp_macmic_idx, mf_qtflx_macmic) - call pbuf_get_field(pbuf, mf_wpthvp_macmic_idx, mf_thvflx_macmic) - call pbuf_get_field(pbuf, tpert_idx, tpert) - - call pbuf_get_field(pbuf, ztopmn_idx, ztopmn) - call pbuf_get_field(pbuf, ztopma_idx, ztopma) - call pbuf_get_field(pbuf, ztopm1_macmic_idx, ztopm1_macmic) - - call pbuf_get_field(pbuf, ddcp_idx, ddcp) - call pbuf_get_field(pbuf, ddcp_macmic_idx, ddcp_macmic) - call pbuf_get_field(pbuf, ddcpmn_idx, ddcpmn) - - call pbuf_get_field(pbuf, cbm1_idx, cbm1) - call pbuf_get_field(pbuf, cbm1_macmic_idx, cbm1_macmic) -!+++ARH - call pbuf_get_field(pbuf, up_macmic1_idx, up_macmic1) - call pbuf_get_field(pbuf, up_macmic2_idx, up_macmic2) - call pbuf_get_field(pbuf, dn_macmic1_idx, dn_macmic1) - call pbuf_get_field(pbuf, dn_macmic2_idx, dn_macmic2) - call pbuf_get_field(pbuf, upa_macmic1_idx, upa_macmic1) - call pbuf_get_field(pbuf, upa_macmic2_idx, upa_macmic2) - call pbuf_get_field(pbuf, dna_macmic1_idx, dna_macmic1) - call pbuf_get_field(pbuf, dna_macmic2_idx, dna_macmic2) - call pbuf_get_field(pbuf, thlu_macmic1_idx, thlu_macmic1) - call pbuf_get_field(pbuf, thlu_macmic2_idx, thlu_macmic2) - call pbuf_get_field(pbuf, qtu_macmic1_idx, qtu_macmic1) - call pbuf_get_field(pbuf, qtu_macmic2_idx, qtu_macmic2) - call pbuf_get_field(pbuf, thld_macmic1_idx, thld_macmic1) - call pbuf_get_field(pbuf, thld_macmic2_idx, thld_macmic2) - call pbuf_get_field(pbuf, qtd_macmic1_idx, qtd_macmic1) - call pbuf_get_field(pbuf, qtd_macmic2_idx, qtd_macmic2) - call pbuf_get_field(pbuf, dthl_macmic1_idx, dthl_macmic1) - call pbuf_get_field(pbuf, dthl_macmic2_idx, dthl_macmic2) - call pbuf_get_field(pbuf, dqt_macmic1_idx, dqt_macmic1) - call pbuf_get_field(pbuf, dqt_macmic2_idx, dqt_macmic2) - call pbuf_get_field(pbuf, dthlu_macmic1_idx, dthlu_macmic1) - call pbuf_get_field(pbuf, dthlu_macmic2_idx, dthlu_macmic2) - call pbuf_get_field(pbuf, dqtu_macmic1_idx, dqtu_macmic1) - call pbuf_get_field(pbuf, dqtu_macmic2_idx, dqtu_macmic2) - call pbuf_get_field(pbuf, dthld_macmic1_idx, dthld_macmic1) - call pbuf_get_field(pbuf, dthld_macmic2_idx, dthld_macmic2) - call pbuf_get_field(pbuf, dqtd_macmic1_idx, dqtd_macmic1) - call pbuf_get_field(pbuf, dqtd_macmic2_idx, dqtd_macmic2) - call pbuf_get_field(pbuf, ztop_macmic1_idx, ztop_macmic1) - call pbuf_get_field(pbuf, ztop_macmic2_idx, ztop_macmic2) - call pbuf_get_field(pbuf, ddcp_macmic1_idx, ddcp_macmic1) - call pbuf_get_field(pbuf, ddcp_macmic2_idx, ddcp_macmic2) -!---ARH - - ! SVP - do k = 1, pver - call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), esat(1:ncol,k), rh(1:ncol,k), ncol) - end do - - rhlev(:ncol) = 0._r8 - if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==6) then - ! Interpolate RH to 500 hPa - rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) - call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rhlev, & - extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) - else if (clubb_mf_Lopt==8) then - ! Mass of q, by layer and vertically integrated - mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga - mqsat(:ncol,:) = rh(:ncol,:) * state%pdel(:ncol,:) * rga - do k=2,pver - mq(:ncol,1) = mq(:ncol,1) + mq(:ncol,k) - mqsat(:ncol,1) = mqsat(:ncol,1) + mqsat(:ncol,k) - end do - rhlev(:ncol) = mq(:ncol,1)/mqsat(:ncol,1) - end if - end if - - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then -======= - ! Allocate pdf_params only if they aren't allocated already. - if ( .not. allocated(pdf_params_chnk(lchnk)%mixt_frac) ) then - call init_pdf_params_api( pverp+1-top_lev, ncol, pdf_params_chnk(lchnk) ) - call init_pdf_params_api( pverp+1-top_lev, ncol, pdf_params_zm_chnk(lchnk) ) - end if - - if ( .not. allocated(pdf_implicit_coefs_terms_chnk(lchnk)%coef_wp4_implicit) ) then - call init_pdf_implicit_coefs_terms_api( pverp+1-top_lev, ncol, sclr_dim, & - pdf_implicit_coefs_terms_chnk(lchnk) ) - end if - - ! Initialize the apply_const variable (note special logic is due to eularian backstepping) - if (clubb_do_adv .and. (is_first_step() .or. all(wpthlp(1:ncol,1:pver) == 0._r8))) then ->>>>>>> ESCOMP/cam_development - apply_const = 0._r8 ! On first time through do not remove constant - ! from moments since it has not been added yet - endif - - ! Set the ztodt timestep in pbuf for SILHS - ztodtptr(:) = 1.0_r8*hdtime - - ! Define the grid box size. CLUBB needs this information to determine what - ! the maximum length scale should be. This depends on the column for - ! variable mesh grids and lat-lon grids - if (single_column) then - ! If single column specify grid box size to be something - ! similar to a GCM run - grid_dx(:) = 100000._r8 - grid_dy(:) = 100000._r8 - else - - call grid_size(state1, grid_dx, grid_dy) - - end if - - if (clubb_do_icesuper) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - lq2(:) = .FALSE. - lq2(1) = .TRUE. - lq2(ixcldice) = .TRUE. - lq2(ixnumice) = .TRUE. - - latsub = latvap + latice - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qitend(:ncol,:)=0._r8 - initend(:ncol,:)=0._r8 - - call ice_macro_tend(naai(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & - state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,1), & - state1%q(1:ncol,top_lev:pver,ixcldice), state1%q(1:ncol,top_lev:pver,ixnumice), & - latsub, hdtime, stend(1:ncol,top_lev:pver), qvtend(1:ncol,top_lev:pver), & - qitend(1:ncol,top_lev:pver), initend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,1)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldice)=qitend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumice)=initend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - !Write output for tendencies: - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QITENDICE', qitend, pcols, lchnk ) - call outfld( 'NITENDICE', initend, pcols, lchnk ) - - endif - - - ! Determine CLUBB time step and make it sub-step friendly - ! For now we want CLUBB time step to be 5 min since that is - ! what has been scientifically validated. However, there are certain - ! instances when a 5 min time step will not be possible (based on - ! host model time step or on macro-micro sub-stepping - dtime = clubb_timestep - - ! Now check to see if dtime is greater than the host model - ! (or sub stepped) time step. If it is, then simply - ! set it equal to the host (or sub step) time step. - ! This section is mostly to deal with small host model - ! time steps (or small sub-steps) - if (dtime > hdtime) then - dtime = hdtime - endif - - ! Now check to see if CLUBB time step divides evenly into - ! the host model time step. If not, force it to divide evenly. - ! We also want it to be 5 minutes or less. This section is - ! mainly for host model time steps that are not evenly divisible - ! by 5 minutes - if (mod(hdtime,dtime) .ne. 0) then - dtime = hdtime/2._r8 - do while (dtime > clubb_timestep) - dtime = dtime/2._r8 - end do - endif - - ! If resulting host model time step and CLUBB time step do not divide evenly - ! into each other, have model throw a fit. - if (mod(hdtime,dtime) .ne. 0) then - call endrun(subr//': CLUBB time step and HOST time step NOT compatible') - endif - - ! determine number of timesteps CLUBB core should be advanced, - ! host time step divided by CLUBB time step - nadv = max(hdtime/dtime,1._r8) - - ! Initialize forcings for transported scalars to zero - sclrm_forcing(:,:,:) = 0._r8 - edsclrm_forcing(:,:,:) = 0._r8 - sclrm(:,:,:) = 0._r8 - - ! Compute inverse exner function consistent with CLUBB's definition, which uses a constant - ! surface pressure. CAM's exner (in state) does not. Therefore, for consistent - ! treatment with CLUBB code, anytime exner is needed to treat CLUBB variables - ! (such as thlm), use "inv_exner_clubb" otherwise use the exner in state - do k=1,pver - do i=1,ncol - inv_exner_clubb(i,k) = 1._r8/((state1%pmid(i,k)/p0_clubb)**(rairv(i,k,lchnk)/cpairv(i,k,lchnk))) - enddo - enddo - - ! Compute exner at the surface for converting the sensible heat fluxes - ! to a flux of potential temperature for use as clubb's boundary conditions - do i=1,ncol - inv_exner_clubb_surf(i) = 1._r8/((state1%pmid(i,pver)/p0_clubb)**(rairv(i,pver,lchnk)/cpairv(i,pver,lchnk))) - enddo - - ! At each CLUBB call, initialize mean momentum and thermo CLUBB state - ! from the CAM state - do k=1,pver ! loop over levels - do i=1,ncol ! loop over columns - - rtm(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq) - rvm(i,k) = state1%q(i,k,ixq) - um(i,k) = state1%u(i,k) - vm(i,k) = state1%v(i,k) - thlm(i,k) = ( state1%t(i,k) & - - (latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) ) & - * inv_exner_clubb(i,k) - - if (clubb_do_adv) then - if (macmic_it == 1) then - - ! Note that some of the moments below can be positive or negative. - ! Remove a constant that was added to prevent dynamics from clipping - ! them to prevent dynamics from making them positive. - thlp2(i,k) = state1%q(i,k,ixthlp2) - rtp2(i,k) = state1%q(i,k,ixrtp2) - rtpthlp(i,k) = state1%q(i,k,ixrtpthlp) - (rtpthlp_const*apply_const) - wpthlp(i,k) = state1%q(i,k,ixwpthlp) - (wpthlp_const*apply_const) - wprtp(i,k) = state1%q(i,k,ixwprtp) - (wprtp_const*apply_const) - wp2(i,k) = state1%q(i,k,ixwp2) - wp3(i,k) = state1%q(i,k,ixwp3) - (wp3_const*apply_const) - up2(i,k) = state1%q(i,k,ixup2) - vp2(i,k) = state1%q(i,k,ixvp2) - endif - endif - - enddo - enddo - - if (clubb_do_adv) then - ! If not last step of macmic loop then set apply_const back to - ! zero to prevent output from being corrupted. - if (macmic_it == cld_macmic_num_steps) then - apply_const = 1._r8 - else - apply_const = 0._r8 - endif - endif - - rtm(1:ncol,pverp) = rtm(1:ncol,pver) - um(1:ncol,pverp) = state1%u(1:ncol,pver) - vm(1:ncol,pverp) = state1%v(1:ncol,pver) - thlm(1:ncol,pverp) = thlm(1:ncol,pver) - -<<<<<<< HEAD - if (clubb_do_adv) then - thlp2(1:ncol,pverp)=thlp2(1:ncol,pver) - rtp2(1:ncol,pverp)=rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp)=rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp)=wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp)=wprtp(1:ncol,pver) - wp2(1:ncol,pverp)=wp2(1:ncol,pver) - wp3(1:ncol,pverp)=wp3(1:ncol,pver) - up2(1:ncol,pverp)=up2(1:ncol,pver) - vp2(1:ncol,pverp)=vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - mf_precc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthlup_output(:,:) = 0._r8 - s_awqtup_output(:,:) = 0._r8 - s_awthldn_output(:,:) = 0._r8 - s_awqtdn_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awuup_output(:,:) = 0._r8 - s_awvup_output(:,:) = 0._r8 - s_awudn_output(:,:) = 0._r8 - s_awvdn_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - s_aww_output(:,:) = 0._r8 - mf_upa_output(:,:) = 0._r8 - mf_upw_output(:,:) = 0._r8 - mf_upmf_output(:,:) = 0._r8 - mf_upqt_output(:,:) = 0._r8 - mf_upthl_output(:,:) = 0._r8 - mf_upthv_output(:,:) = 0._r8 - mf_upth_output(:,:) = 0._r8 - mf_upqc_output(:,:) = 0._r8 - mf_upbuoy_output(:,:) = 0._r8 - mf_upent_output(:,:) = 0._r8 - mf_updet_output(:,:) = 0._r8 - mf_upa_flip(:,:,:) = 0._r8 - mf_upw_flip(:,:,:) = 0._r8 - mf_upmf_flip(:,:,:) = 0._r8 - mf_upqt_flip(:,:,:) = 0._r8 - mf_upthl_flip(:,:,:) = 0._r8 - mf_upthv_flip(:,:,:) = 0._r8 - mf_upth_flip(:,:,:) = 0._r8 - mf_upqc_flip(:,:,:) = 0._r8 - mf_upbuoy_flip(:,:,:) = 0._r8 - mf_upent_flip(:,:,:) = 0._r8 - mf_updet_flip(:,:,:) = 0._r8 - mf_thlflxup_output(:,:) = 0._r8 - mf_qtflxup_output(:,:) = 0._r8 - mf_thlflxdn_output(:,:) = 0._r8 - mf_qtflxdn_output(:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - mf_thvflx_output(:,:) = 0._r8 - mf_uflxup_output(:,:) = 0._r8 - mf_vflxup_output(:,:) = 0._r8 - mf_uflxdn_output(:,:) = 0._r8 - mf_vflxdn_output(:,:) = 0._r8 - mf_uflx_output(:,:) = 0._r8 - mf_vflx_output(:,:) = 0._r8 - mf_thlforcup_output(:,:) = 0._r8 - mf_qtforcup_output(:,:) = 0._r8 - mf_thlforcdn_output(:,:) = 0._r8 - mf_qtforcdn_output(:,:) = 0._r8 - mf_thlforc_output(:,:) = 0._r8 - mf_qtforc_output(:,:) = 0._r8 - mf_sqtup_output(:,:) = 0._r8 - mf_sqtdn_output(:,:) = 0._r8 - mf_rcm_output(:,:) = 0._r8 - mf_cloudfrac_output(:,:) = 0._r8 - mf_ent_output(:,:) = 0._r8 - mf_qc_output(:,:) = 0._r8 - mf_ztop_output(:) = 0._r8 - mf_ddcp_output(:) = 0._r8 - mf_L0_output(:) = 0._r8 - mf_freq_output(:) = 0._r8 - mf_cape_output(:) = 0._r8 - mf_cfl_output(:) = 0._r8 - mf_dnw_output(:,:) = 0._r8 - mf_dnthl_output(:,:) = 0._r8 - mf_dnqt_output(:,:) = 0._r8 - mf_dnw_flip(:,:,:) = 0._r8 - mf_dnthl_flip(:,:,:) = 0._r8 - mf_dnqt_flip(:,:,:) = 0._r8 - - ! Loop over all columns in lchnk to advance CLUBB core - do i=1,ncol ! loop over columns - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1,nlev+1 - zi_g(k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - enddo - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1,nlev - zt_g(k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - - do k=1,pver - dz_g(k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - enddo - - ! Thermodynamic ghost point is below surface - zt_g(1) = -1._r8*zt_g(2) - - ! Set the elevation of the surface - sfc_elevation = state1%zi(i,pver+1) - - ! Set the grid size - host_dx = grid_dx(i) - host_dy = grid_dy(i) - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - p_in_Pa(k+1) = state1%pmid(i,pver-k+1) ! Pressure profile - exner(k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - rho_ds_zt(k+1) = (1._r8/gravit)*(state1%pdel(i,pver-k+1)/dz_g(pver-k+1)) - invrs_rho_ds_zt(k+1) = 1._r8/(rho_ds_zt(k+1)) ! Inverse ds rho at thermo - rho_in(k+1) = rho_ds_zt(k+1) ! rho on thermo - thv_ds_zt(k+1) = thv(i,pver-k+1) ! thetav on thermo - th_zt(k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) - qv_zt(k+1) = state1%q(i,pver-k+1,ixq) - rfrzm(k+1) = state1%q(i,pver-k+1,ixcldice) - radf(k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdel(i,pver-k+1)) - enddo - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - rho_ds_zt(1) = rho_ds_zt(2) - invrs_rho_ds_zt(1) = invrs_rho_ds_zt(2) - rho_in(1) = rho_ds_zt(2) - thv_ds_zt(1) = thv_ds_zt(2) - rho_zt(:) = rho_in(:) - p_in_Pa(1) = p_in_Pa(2) - exner(1) = exner(2) - rfrzm(1) = rfrzm(2) - radf(1) = radf(2) - qrl_clubb(1) = qrl_clubb(2) - th_zt(1) = th_zt(2) - qv_zt(1) = qv_zt(2) - - ! Compute mean w wind on thermo grid, convert from omega to w - wm_zt(1) = 0._r8 - do k=1,nlev - wm_zt(k+1) = -1._r8*state1%omega(i,pver-k+1)/(rho_in(k+1)*gravit) -======= - if (clubb_do_adv) then - thlp2(1:ncol,pverp) = thlp2(1:ncol,pver) - rtp2(1:ncol,pverp) = rtp2(1:ncol,pver) - rtpthlp(1:ncol,pverp) = rtpthlp(1:ncol,pver) - wpthlp(1:ncol,pverp) = wpthlp(1:ncol,pver) - wprtp(1:ncol,pverp) = wprtp(1:ncol,pver) - wp2(1:ncol,pverp) = wp2(1:ncol,pver) - wp3(1:ncol,pverp) = wp3(1:ncol,pver) - up2(1:ncol,pverp) = up2(1:ncol,pver) - vp2(1:ncol,pverp) = vp2(1:ncol,pver) - endif - - ! Compute virtual potential temperature, which is needed for CLUBB - do k=1,pver - do i=1,ncol - thv(i,k) = state1%t(i,k)*inv_exner_clubb(i,k)*(1._r8+zvir*state1%q(i,k,ixq)& - -state1%q(i,k,ixcldliq)) ->>>>>>> ESCOMP/cam_development - enddo - enddo - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lu=.true., lv=.true., lq=lq) - - call tropopause_findChemTrop(state, troplev) - - ! Initialize EDMF outputs - if (do_clubb_mf) then - mf_dry_a_output(:,:) = 0._r8 - mf_moist_a_output(:,:) = 0._r8 - mf_dry_w_output(:,:) = 0._r8 - mf_moist_w_output(:,:) = 0._r8 - mf_dry_qt_output(:,:) = 0._r8 - mf_moist_qt_output(:,:) = 0._r8 - mf_dry_thl_output(:,:) = 0._r8 - mf_moist_thl_output(:,:) = 0._r8 - mf_dry_u_output(:,:) = 0._r8 - mf_moist_u_output(:,:) = 0._r8 - mf_dry_v_output(:,:) = 0._r8 - mf_moist_v_output(:,:) = 0._r8 - mf_moist_qc_output(:,:) = 0._r8 - s_ae_output(:,:) = 0._r8 - s_aw_output(:,:) = 0._r8 - s_awthl_output(:,:) = 0._r8 - s_awqt_output(:,:) = 0._r8 - s_awql_output(:,:) = 0._r8 - s_awqi_output(:,:) = 0._r8 - s_awu_output(:,:) = 0._r8 - s_awv_output(:,:) = 0._r8 - mf_thlflx_output(:,:) = 0._r8 - mf_qtflx_output(:,:) = 0._r8 - end if - - call t_startf("clubb_tend_cam_i_loop") - - ! Determine Coriolis force at given latitude. This is never used - ! when CLUBB is implemented in a host model, therefore just set - ! to zero. - fcor(:) = 0._r8 - - ! Define the CLUBB momentum grid (in height, units of m) - do k=1, nlev+1 - do i=1, ncol - zi_g(i,k) = state1%zi(i,pverp-k+1)-state1%zi(i,pver+1) - end do - end do - - ! Define the CLUBB thermodynamic grid (in units of m) - do k=1, nlev - do i=1, ncol - zt_g(i,k+1) = state1%zm(i,pver-k+1)-state1%zi(i,pver+1) - end do - end do - - do k=1, pver - do i=1, ncol - dz_g(i,k) = state1%zi(i,k)-state1%zi(i,k+1) ! compute thickness - end do - end do - - ! Thermodynamic ghost point is below surface - do i=1, ncol - zt_g(i,1) = -1._r8*zt_g(i,2) - end do - - do i=1, ncol - ! Set the elevation of the surface - sfc_elevation(i) = state1%zi(i,pver+1) - end do - - ! Compute thermodynamic stuff needed for CLUBB on thermo levels. - ! Inputs for the momentum levels are set below setup_clubb core - do k=1,nlev - do i=1, ncol - ! base state (dry) variables - rho_ds_zt(i,k+1) = rga*(state1%pdeldry(i,pver-k+1)/dz_g(i,pver-k+1)) - invrs_rho_ds_zt(i,k+1) = 1._r8/(rho_ds_zt(i,k+1)) - - ! full state (moist) variables - p_in_Pa(i,k+1) = state1%pmid(i,pver-k+1) - exner(i,k+1) = 1._r8/inv_exner_clubb(i,pver-k+1) - thv(i,k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1)*(1._r8+zvir*state1%q(i,pver-k+1,ixq) & - -state1%q(i,pver-k+1,ixcldliq)) - rho_zt(i,k+1) = rga*state1%pdel(i,pver-k+1)/dz_g(i,pver-k+1) - - ! exception - setting this to moist thv - thv_ds_zt(i,k+1) = thv(i,k+1) - - rfrzm(i,k+1) = state1%q(i,pver-k+1,ixcldice) - radf(i,k+1) = radf_clubb(i,pver-k+1) - qrl_clubb(i,k+1) = qrl(i,pver-k+1)/(cpairv(i,k,lchnk)*state1%pdeldry(i,pver-k+1)) - end do - end do - - ! Compute mean w wind on thermo grid, convert from omega to w - do k=1,nlev - do i=1,ncol - wm_zt(i,k+1) = -1._r8*(state1%omega(i,pver-k+1)-state1%omega(i,pver))/(rho_zt(i,k+1)*gravit) - end do - end do - - ! Below computes the same stuff for the ghost point. May or may - ! not be needed, just to be safe to avoid NaN's - do i=1, ncol - thv_ds_zt(i,1) = thv_ds_zt(i,2) - rho_ds_zt(i,1) = rho_ds_zt(i,2) - invrs_rho_ds_zt(i,1) = invrs_rho_ds_zt(i,2) - p_in_Pa(i,1) = p_in_Pa(i,2) - exner(i,1) = exner(i,2) - thv(i,1) = thv(i,2) - rho_zt(i,1) = rho_zt(i,2) - rfrzm(i,1) = rfrzm(i,2) - radf(i,1) = radf(i,2) - qrl_clubb(i,1) = qrl_clubb(i,2) - wm_zt(i,1) = wm_zt(i,2) - end do - - - ! ------------------------------------------------- ! - ! Begin case specific code for SCAM cases. ! - ! This section of code block is NOT called in ! - ! global simulations ! - ! ------------------------------------------------- ! - if (single_column) then - - ! Initialize zo if variable ustar is used - if (cam_in%landfrac(1) >= 0.5_r8) then - zo(1) = 0.035_r8 - else - zo(1) = 0.0001_r8 - endif - - ! Compute surface wind (ubar) - ubar = sqrt(um(1,pver)**2+vm(1,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - ! Below denotes case specifics for surface momentum - ! and thermodynamic fluxes, depending on the case - -<<<<<<< HEAD - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Read in parameters for CLUBB. Just read in default values - call read_parameters_api( -99, "", clubb_params ) - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_heights_api(l_implemented, grid_type, zi_g(2), & - zi_g(1), zi_g, zt_g) - - call setup_parameters_api( zi_g(2), clubb_params, nlev+1, grid_type, & - zi_g, zt_g, & - clubb_config_flags%l_prescribed_avg_deltaz, & - err_code ) - - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing = 0._r8 - rtm_forcing = 0._r8 - um_forcing = 0._r8 - vm_forcing = 0._r8 - - wprtp_forcing = 0._r8 - wpthlp_forcing = 0._r8 - rtp2_forcing = 0._r8 - thlp2_forcing = 0._r8 - rtpthlp_forcing = 0._r8 - - ice_supersat_frac_out = 0._r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = rtp2_forcing + zt2zm_api( rtp2_mc_zt(i,:) ) - thlp2_forcing = thlp2_forcing + zt2zm_api( thlp2_mc_zt(i,:) ) - wprtp_forcing = wprtp_forcing + zt2zm_api( wprtp_mc_zt(i,:) ) - wpthlp_forcing = wpthlp_forcing + zt2zm_api( wpthlp_mc_zt(i,:) ) - rtpthlp_forcing = rtpthlp_forcing + zt2zm_api( rtpthlp_mc_zt(i,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(i,:) = 0.0_r8 - thlp2_mc_zt(i,:) = 0.0_r8 - wprtp_mc_zt(i,:) = 0.0_r8 - wpthlp_mc_zt(i,:) = 0.0_r8 - rtpthlp_mc_zt(i,:) = 0.0_r8 - - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api(rho_ds_zt) - rho_zm = zt2zm_api(rho_zt) - invrs_rho_ds_zm = zt2zm_api(invrs_rho_ds_zt) - thv_ds_zm = zt2zm_api(thv_ds_zt) - wm_zm = zt2zm_api(wm_zt) - - ! Surface fluxes provided by host model - wpthlp_sfc = cam_in%shf(i)/(cpair*rho_ds_zm(1)) ! Sensible heat flux - wprtp_sfc = cam_in%cflx(i,1)/rho_ds_zm(1) ! Moisture flux (check rho) - upwp_sfc = cam_in%wsx(i)/rho_ds_zm(1) ! Surface meridional momentum flux - vpwp_sfc = cam_in%wsy(i)/rho_ds_zm(1) ! Surface zonal momentum flux - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - um_in(k) = um(i,pverp-k+1) - vm_in(k) = vm(i,pverp-k+1) - upwp_in(k) = upwp(i,pverp-k+1) - vpwp_in(k) = vpwp(i,pverp-k+1) - wpthvp_in(k) = wpthvp(i,pverp-k+1) - wp2thvp_in(k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(k)= thlpthvp(i,pverp-k+1) - up2_in(k) = up2(i,pverp-k+1) - vp2_in(k) = vp2(i,pverp-k+1) - up3_in(k) = up3(i,pverp-k+1) - vp3_in(k) = vp3(i,pverp-k+1) - wp2_in(k) = wp2(i,pverp-k+1) - wp3_in(k) = wp3(i,pverp-k+1) - rtp2_in(k) = rtp2(i,pverp-k+1) - thlp2_in(k) = thlp2(i,pverp-k+1) - rtp3_in(k) = rtp3(i,pverp-k+1) - thlp3_in(k) = thlp3(i,pverp-k+1) - thlm_in(k) = thlm(i,pverp-k+1) - rtm_in(k) = rtm(i,pverp-k+1) - rvm_in(k) = rvm(i,pverp-k+1) - wprtp_in(k) = wprtp(i,pverp-k+1) - wpthlp_in(k) = wpthlp(i,pverp-k+1) - tke_in(k) = tke(i,pverp-k+1) - rtpthlp_in(k) = rtpthlp(i,pverp-k+1) - rcm_inout(k) = rcm(i,pverp-k+1) - cloud_frac_inout(k) = cloud_frac(i,pverp-k+1) - sclrpthvp_inout(k,:) = 0._r8 - - if (k .ne. 1) then - pre_in(k) = prer_evap(i,pverp-k+1) - endif - - ! Initialize these to prevent crashing behavior - wprcp_out(k) = 0._r8 - rcm_in_layer_out(k) = 0._r8 - cloud_cover_out(k) = 0._r8 - edsclr_in(k,:) = 0._r8 - khzm_out(k) = 0._r8 - khzt_out(k) = 0._r8 - - ! higher order scalar stuff, put to zero - sclrm(k,:) = 0._r8 - wpsclrp(k,:) = 0._r8 - sclrp2(k,:) = 0._r8 - sclrp3(k,:) = 0._r8 - sclrprtp(k,:) = 0._r8 - sclrpthlp(k,:) = 0._r8 - wpsclrp_sfc(:) = 0._r8 - hydromet(k,:) = 0._r8 - wphydrometp(k,:) = 0._r8 - wp2hmp(k,:) = 0._r8 - rtphmp_zt(k,:) = 0._r8 - thlphmp_zt(k,:) = 0._r8 - - enddo - pre_in(1) = pre_in(2) - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - do k=1,pver - kappa_zt(k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(k+1) = inv_exner_clubb(i,pver-k+1) - enddo - kappa_zt(1) = kappa_zt(2) - qc_zt(1) = qc_zt(2) - invrs_exner_zt(1) = invrs_exner_zt(2) - - kappa_zm = zt2zm_api(kappa_zt) - do k=1,pverp - p_in_Pa_zm(k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(k) = 1._r8/((p_in_Pa_zm(k)/p0_clubb)**(kappa_zm(k))) - enddo - - th_sfc = cam_in%ts(i)*invrs_exner_zm(1) - - call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & - rrho(i), ustar ) - end if -======= - ! Define ustar (based on case, if not variable) - ustar = 0.25_r8 ! Initialize ustar in case no case - - if(trim(scm_clubb_iop_name) == 'BOMEX_5day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'ATEX_48hr') then - ustar = 0.30_r8 - endif - - if(trim(scm_clubb_iop_name) == 'RICO_3day') then - ustar = 0.28_r8 - endif - - if(trim(scm_clubb_iop_name) == 'arm97' .or. trim(scm_clubb_iop_name) == 'gate' .or. & - trim(scm_clubb_iop_name) == 'toga' .or. trim(scm_clubb_iop_name) == 'mpace' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then ->>>>>>> ESCOMP/cam_development - - bflx22(1) = (gravit/theta0)*wpthlp_sfc(1) - ustar = diag_ustar(zt_g(1,2),bflx22(1),ubar,zo(1)) - endif - - ! Compute the surface momentum fluxes, if this is a SCAM simulation - upwp_sfc(1) = -um(1,pver)*ustar**2/ubar - vpwp_sfc(1) = -vm(1,pver)*ustar**2/ubar - - end if - - ! Define surface sources for transported variables for diffusion, will - ! be zero as these tendencies are done in vertical_diffusion - do ixind=1,edsclr_dim - do i=1,ncol - wpedsclrp_sfc(i,ixind) = 0._r8 - end do - end do - -<<<<<<< HEAD -!+++ARH - if (macmic_it==1) thlm_macmic1(i,:) = 0._r8 - if (macmic_it==1) thlm_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtm_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtm_macmic2(i,:) = 0._r8 -!---ARH - - if (do_clubb_mf) then - mf_L0 = 0._r8 - mf_L0_nadv = 0._r8 - mf_ztop = 0._r8 - mf_ztop_nadv = 0._r8 - mf_ztopm1 = 0._r8 - mf_ztopm1_nadv = 0._r8 - mf_ddcp_nadv = 0._r8 - mf_cbm1 = 0._r8 - mf_cbm1_nadv = 0._r8 - mf_freq_nadv = 0._r8 - - if (macmic_it==1) ztopm1_macmic(i) = 0._r8 - if (macmic_it==1) ddcp_macmic(i) = 0._r8 - if (macmic_it==1) cbm1_macmic(i) = 0._r8 - -!+++ARH - if (macmic_it==1) up_macmic1(i,:) = 0._r8 - if (macmic_it==1) up_macmic2(i,:) = 0._r8 - if (macmic_it==1) dn_macmic1(i,:) = 0._r8 - if (macmic_it==1) dn_macmic2(i,:) = 0._r8 - if (macmic_it==1) upa_macmic1(i,:) = 0._r8 - if (macmic_it==1) upa_macmic2(i,:) = 0._r8 - if (macmic_it==1) dna_macmic1(i,:) = 0._r8 - if (macmic_it==1) dna_macmic2(i,:) = 0._r8 - if (macmic_it==1) thlu_macmic1(i,:) = 0._r8 - if (macmic_it==1) thlu_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtu_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtu_macmic2(i,:) = 0._r8 - if (macmic_it==1) thld_macmic1(i,:) = 0._r8 - if (macmic_it==1) thld_macmic2(i,:) = 0._r8 - if (macmic_it==1) qtd_macmic1(i,:) = 0._r8 - if (macmic_it==1) qtd_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthl_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthl_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqt_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqt_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthlu_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthlu_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqtu_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqtu_macmic2(i,:) = 0._r8 - if (macmic_it==1) dthld_macmic1(i,:) = 0._r8 - if (macmic_it==1) dthld_macmic2(i,:) = 0._r8 - if (macmic_it==1) dqtd_macmic1(i,:) = 0._r8 - if (macmic_it==1) dqtd_macmic2(i,:) = 0._r8 - if (macmic_it==1) ztop_macmic1(i,:) = 0._r8 - if (macmic_it==1) ztop_macmic2(i,:) = 0._r8 - if (macmic_it==1) ddcp_macmic1(i,:) = 0._r8 - if (macmic_it==1) ddcp_macmic2(i,:) = 0._r8 -!---ARH - -!+++ARH - Temporary hack - pbuf_set_field is apparently not taking? - if (is_first_step() .and. macmic_it==1) then - ddcp(i) = 0._r8 - end if -!---ARH - - mf_precc_nadv = 0._r8 - mf_snow_nadv = 0._r8 - - mf_qc(:pverp) = 0._r8 - mf_rcm(:pverp) = 0._r8 - mf_cloudfrac(:pverp) = 0._r8 - mf_qc_nadv(:pverp) = 0._r8 - mf_rcm_nadv(:pverp) = 0._r8 - mf_cloudfrac_nadv(:pverp) = 0._r8 - - mf_thlforcup_nadv(:pverp) = 0._r8 - mf_qtforcup_nadv(:pverp) = 0._r8 - mf_thlforcdn_nadv(:pverp) = 0._r8 - mf_qtforcdn_nadv(:pverp) = 0._r8 - mf_thlforc_nadv(:pverp) = 0._r8 - mf_qtforc_nadv(:pverp) = 0._r8 - mf_ent_nadv(:pverp) = 0._r8 - - max_cfl_nadv = 0._r8 - end if - - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif - - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - dzt(k) = zi_g(k) - zi_g(k-1) - dzm(k-1) = zt_g(k) - zt_g(k-1) - enddo - dzt(1) = dzt(2) - dzm(pverp) = dzm(pver) - invrs_dzt = 1._r8/dzt - - rtm_zm_in = zt2zm_api( rtm_in ) - thlm_zm_in = zt2zm_api( thlm_in ) - th_zm = zt2zm_api( th_zt ) - qv_zm = zt2zm_api( qv_zt ) - qc_zm = zt2zm_api( qc_zt ) - - if (t>1) then - ! update thv if clubb is subcycled - thv_ds_zt(:pverp) = thlm_in(:pverp) & - + latvap*rcm_inout(:pverp)*invrs_exner_zt(:pverp)/cpair - thv_ds_zt(:pverp) = thv_ds_zt(:pverp) & - * (1._r8+zvir*(rtm_in(:pverp)-rcm_inout(:pverp)) - rcm_inout(:pverp)) - thv_ds_zm = zt2zm_api( thv_ds_zt ) - end if - - mf_ztopm1 = ztopma(i) - mf_ddcp = ddcp(i) - mf_cbm1 = cbm1(i) - - rhinv = 0._r8 - if (rhlev(i) >= 1._r8) rhlev(i) = 0.990_r8 - if (rhlev(i) > 0._r8) rhinv = 1._r8 / ( (1._r8/rhlev(i)) - 1._r8 ) - - call integrate_mf( pverp, & ! input - rho_zm, dzm, zi_g, p_in_Pa_zm, invrs_exner_zm, & ! input - rho_zt, dzt, zt_g, p_in_Pa, invrs_exner_zt, & ! input - um_in, vm_in, thlm_in, rtm_in, thv_ds_zt, & ! input - th_zt, qv_zt, qc_zt, & ! input - thlm_zm_in, rtm_zm_in, thv_ds_zm, & ! input - th_zm, qv_zm, qc_zm, & ! input - ustar, th_sfc, wpthlp_sfc, wprtp_sfc, pblh(i), & ! input - wpthlp_in, tke_in, tpert(i), mf_ztopm1, rhinv, & ! input - mf_cape_output(i), mf_ddcp, mf_cbm1, & ! output - plume diagnostics - mf_upa, mf_dna, & ! output - plume diagnostics - mf_upw, mf_dnw, & ! output - plume diagnostics - mf_upmf, & ! output - plume diagnostics - mf_upqt, mf_dnqt, & ! output - plume diagnostics - mf_upthl, mf_dnthl, & ! output - plume diagnostics - mf_upthv, mf_dnthv, & ! output - plume diagnostics - mf_upth, mf_dnth, & ! output - plume diagnostics - mf_upqc, mf_dnqc, & ! output - plume diagnostics - mf_upbuoy, & ! output - plume diagnostics - mf_upent, & ! output - plume diagnostics - mf_updet, & ! output - plume diagnostics - mf_dry_a, mf_moist_a, & ! output - plume diagnostics - mf_dry_w, mf_moist_w, & ! output - plume diagnostics - mf_dry_qt, mf_moist_qt, & ! output - plume diagnostics - mf_dry_thl,mf_moist_thl, & ! output - plume diagnostics - mf_dry_u, mf_moist_u, & ! output - plume diagnostics - mf_dry_v, mf_moist_v, & ! output - plume diagnostics - mf_moist_qc, & ! output - plume diagnostics - s_ae, & ! output - plume diagnostics - s_ac, s_aup, s_adn, & ! output - plume diagnostics - s_aw, s_awup, s_awdn, & ! output - plume diagnostics - s_aww, s_awwup, s_awwdn, & ! output - plume diagnostics - s_awthlup, s_awqtup, s_awuup, s_awvup, & ! output - plume diagnostics - s_awthldn, s_awqtdn, s_awudn, s_awvdn, & ! output - plume diagnostics - s_awthl, s_awqt, & ! output - plume diagnostics - s_awu, s_awv, & ! output - plume diagnostics - mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & ! output - plume diagnostics - mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & ! output - plume diagnostics - mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & ! output - variables needed for solver - mf_thvflx, & ! output - plume diagnostics - mf_sqtup, mf_sthlup, & ! output - plume diagnostics - mf_sqtdn, mf_sthldn, & ! output - plume diagnostics - mf_sqt, mf_sthl, & ! output - variables needed for solver - mf_precc, & ! output - plume diagnostics - mf_ztop, mf_L0 ) - - ! CFL limiter - s_aw(1) = 0._r8 - max_cfl = 0._r8 - do k=2,pverp - max_cfl = max(max_cfl,dtime*invrs_dzt(k)*max(abs(s_aw(k-1)),abs(s_aw(k)))) - end do - cflfac = 1._r8 - cfllim = .true. - if (max_cfl.gt.cflval.and.cfllim) cflfac = cflval/max_cfl - - ! Scale microphys so it can't drive qt negative - do k=2,pverp - if ((-1._r8*mf_sqt(k)*dtime) > rtm_in(k)) then - lambda = -1._r8*rtm_in(k)/(mf_sqt(k)*dtime) - mf_sqt(k) = lambda*mf_sqt(k) - mf_sthl(k) = lambda*mf_sthl(k) - mf_sqtup(k) = lambda*mf_sqtup(k) - mf_sthlup(k) = lambda*mf_sthlup(k) - mf_sqtdn(k) = lambda*mf_sqtdn(k) - mf_sthldn(k) = lambda*mf_sthldn(k) - end if - end do - - ! Recalculate precip using new microphys forcing - mf_precc(:pverp) = 0._r8 - do k=pverp,2,-1 - mf_precc(k-1) = mf_precc(k) - rho_zt(k)*dzt(k)*mf_sqt(k) - end do - - ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing = 0._r8 - thlm_forcing = 0._r8 - mf_qtforcup = 0._r8 - mf_thlforcup = 0._r8 - mf_qtforcdn = 0._r8 - mf_thlforcdn = 0._r8 - - do k=2,pverp - - rtm_forcing(k) = rtm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflx(k)) - (rho_ds_zm(k-1) * mf_qtflx(k-1))) & - + mf_sqt(k) - - thlm_forcing(k) = thlm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflx(k)) - (rho_ds_zm(k-1) * mf_thlflx(k-1))) & - + mf_sthl(k) - - um_forcing(k) = um_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_uflx(k)) - (rho_ds_zm(k-1) * mf_uflx(k-1))) - - vm_forcing(k) = vm_forcing(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_vflx(k)) - (rho_ds_zm(k-1) * mf_vflx(k-1))) - - mf_qtforcup(k) = mf_qtforcup(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflxup(k)) - (rho_ds_zm(k-1) * mf_qtflxup(k-1))) & - + mf_sqtup(k) - - mf_thlforcup(k) = mf_thlforcup(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflxup(k)) - (rho_ds_zm(k-1) * mf_thlflxup(k-1))) & - + mf_sthlup(k) - - mf_qtforcdn(k) = mf_qtforcdn(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_qtflxdn(k)) - (rho_ds_zm(k-1) * mf_qtflxdn(k-1))) & - + mf_sqtdn(k) - - mf_thlforcdn(k) = mf_thlforcdn(k) - invrs_rho_ds_zt(k) * invrs_dzt(k) * cflfac * & - ((rho_ds_zm(k) * mf_thlflxdn(k)) - (rho_ds_zm(k-1) * mf_thlflxdn(k-1))) & - + mf_sthldn(k) - - end do - - ! compute ensemble cloud properties - mf_qc_nadv(:pverp) = mf_qc_nadv(:pverp) + mf_moist_qc(:pverp) - mf_rcm_nadv(:pverp) = mf_rcm_nadv(:pverp) + mf_moist_a(:pverp)*mf_moist_qc(:pverp) - mf_cloudfrac_nadv(:pverp) = mf_cloudfrac_nadv(:pverp) + mf_moist_a(:pverp) - - ! [kg/m2/s]->[m/s] - mf_precc_nadv = mf_precc_nadv + mf_precc(1)/1000._r8 - mf_snow_nadv = 0._r8 - - ! accumulate over nadv subcycles - mf_L0_nadv = mf_L0_nadv + mf_L0 - mf_ztop_nadv = mf_ztop_nadv + mf_ztop - mf_ztopm1_nadv = mf_ztopm1_nadv + mf_ztopm1 - mf_ddcp_nadv = mf_ddcp_nadv + mf_ddcp - mf_cbm1_nadv = mf_cbm1_nadv + mf_cbm1 - - if (mf_ztop > 0._r8) mf_freq_nadv = mf_freq_nadv + 1._r8 - - mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp) + mf_thlforcup(:pverp) - mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp) + mf_qtforcup(:pverp) - mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp) + mf_thlforcdn(:pverp) - mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp) + mf_qtforcdn(:pverp) - mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp) + thlm_forcing(:pverp) - mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp) + rtm_forcing(:pverp) - - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp) + s_awu(:pverp) - - max_cfl_nadv = MAX(max_cfl,max_cfl_nadv) -!+++ARH - if (t==1) then - - ztop_macmic1(i,macmic_it) = mf_ztopm1 - ddcp_macmic1(i,macmic_it) = mf_ddcp - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - up_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - dn_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - upa_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - dna_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - thlu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - qtu_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - thld_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - qtd_macmic1( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_forcing(k) - end do - dthl_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_forcing(k) - end do - dqt_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcup(k) - end do - dthlu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcup(k) - end do - dqtu_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcdn(k) - end do - dthld_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcdn(k) - end do - dqtd_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - else if (t==2) then - - ztop_macmic2(i,macmic_it) = mf_ztopm1 - ddcp_macmic2(i,macmic_it) = mf_ddcp - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - up_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - dn_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - upa_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dna(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - dna_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - thlu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - qtu_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - thld_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - flip(pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) - end do - - do k=1,clubb_mf_nup - qtd_macmic2( i, 1+pverp*(clubb_mf_nup*(macmic_it-1)+k-1):pverp*(clubb_mf_nup*(macmic_it-1)+k) ) = flip(:pverp,k) - end do - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_forcing(k) - end do - dthl_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_forcing(k) - end do - dqt_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcup(k) - end do - dthlu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcup(k) - end do - dqtu_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_thlforcdn(k) - end do - dthld_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = mf_qtforcdn(k) - end do - dqtd_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - end if -!---ARH - - end if !clubbmf - -!+++ARH - if (t==1) then - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic1(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - else if (t==2) then - - do k=1,nlev+1 - lilflip(pverp-k+1) = thlm_in(k) - end do - thlm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - do k=1,nlev+1 - lilflip(pverp-k+1) = rtm_in(k) - end do - qtm_macmic2(i,pverp*(macmic_it-1)+1:pverp*macmic_it) = lilflip(:pverp) - - end if -!---ARH -======= - ! Set stats output and increment equal to CLUBB and host dt - stats_tsamp = dtime - stats_tout = hdtime - - stats_nsamp = nint(stats_tsamp/dtime) - stats_nout = nint(stats_tout/dtime) - - ! Heights need to be set at each timestep. Therefore, recall - ! setup_grid and setup_parameters for this. - - ! Set-up CLUBB core at each CLUBB call because heights can change - ! Important note: do not make any calls that use CLUBB grid-height - ! operators (such as zt2zm_api, etc.) until AFTER the - ! call to setup_grid_heights_api. - call setup_grid_api( nlev+1, ncol, sfc_elevation, l_implemented, & ! intent(in) - grid_type, zi_g(:,2), zi_g(:,1), zi_g(:,nlev+1), & ! intent(in) - zi_g, zt_g, & ! intent(in) - gr, begin_height, end_height ) ! intent(out) - - call setup_parameters_api( zi_g(:,2), clubb_params, nlev+1, ncol, grid_type, & ! intent(in) - zi_g, zt_g, & ! intent(in) - clubb_config_flags%l_prescribed_avg_deltaz, & ! intent(in) - lmin, nu_vert_res_dep, err_code ) ! intent(out) - if ( err_code == clubb_fatal_error ) then - call endrun(subr//': Fatal error in CLUBB setup_parameters') - end if ->>>>>>> ESCOMP/cam_development - - -<<<<<<< HEAD -!+++ARH ! clip negative water - do k=1,pverp - if (rtm_in(k) < rcm_inout(k)) rtm_in(k) = rcm_inout(k) - end do -!---ARH -======= - ! Define forcings from CAM to CLUBB as zero for momentum and thermo, - ! forcings already applied through CAM - thlm_forcing(:,:) = 0._r8 - rtm_forcing(:,:) = 0._r8 - um_forcing(:,:) = 0._r8 - vm_forcing(:,:) = 0._r8 ->>>>>>> ESCOMP/cam_development - - - rtm_ref(:,:) = 0.0_r8 - thlm_ref(:,:) = 0.0_r8 - um_ref(:,:) = 0.0_r8 - vm_ref(:,:) = 0.0_r8 - ug(:,:) = 0.0_r8 - vg(:,:) = 0.0_r8 - - ! Add forcings for SILHS covariance contributions - rtp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtp2_mc_zt(1:ncol,:) ) - thlp2_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, thlp2_mc_zt(1:ncol,:) ) - wprtp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wprtp_mc_zt(1:ncol,:) ) - wpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, wpthlp_mc_zt(1:ncol,:) ) - rtpthlp_forcing = zt2zm_api( pverp+1-top_lev, ncol, gr, rtpthlp_mc_zt(1:ncol,:) ) - - ! Zero out SILHS covariance contribution terms - rtp2_mc_zt(:,:) = 0.0_r8 - thlp2_mc_zt(:,:) = 0.0_r8 - wprtp_mc_zt(:,:) = 0.0_r8 - wpthlp_mc_zt(:,:) = 0.0_r8 - rtpthlp_mc_zt(:,:) = 0.0_r8 - - -<<<<<<< HEAD - ! update turbulent moments based on rain evaporation - rtp2_in = rtp2_in + clubb_rnevap_effic * dum1 * rtp2_mc_out * dtime - thlp2_in = thlp2_in + clubb_rnevap_effic * dum1 * thlp2_mc_out * dtime - wprtp_in = wprtp_in + clubb_rnevap_effic * dum1 * wprtp_mc_out * dtime - wpthlp_in = wpthlp_in + clubb_rnevap_effic * dum1 * wpthlp_mc_out * dtime - endif - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(rcm_inout) - qrl_zm = zt2zm_api(qrl_clubb) - thlp2_rad_out(:) = 0._r8 - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm, thlprcp_out, qrl_zm, thlp2_rad_out) - thlp2_in = thlp2_in + thlp2_rad_out * dtime - thlp2_in = max(thl_tol**2,thlp2_in) - endif - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) call stats_end_timestep_clubb(i,out_zt,out_zm,& - out_radzt,out_radzm,out_sfc) - - enddo ! end time loop - - if (do_clubb_mf) then - ! average over nadv - mf_L0_nadv = mf_L0_nadv/REAL(nadv) - mf_ztop_nadv = mf_ztop_nadv/REAL(nadv) - mf_ztopm1_nadv = mf_ztopm1_nadv/REAL(nadv) - mf_ddcp_nadv = mf_ddcp_nadv/REAL(nadv) - mf_cbm1_nadv = mf_cbm1_nadv/REAL(nadv) - mf_freq_nadv = mf_freq_nadv/REAL(nadv) - - ! accumulate in buffer - ztopm1_macmic(i) = ztopm1_macmic(i) + mf_ztopm1_nadv - ddcp_macmic(i) = ddcp_macmic(i) + mf_ddcp_nadv - cbm1_macmic(i) = cbm1_macmic(i) + mf_cbm1_nadv - - if (macmic_it == cld_macmic_num_steps) then - - cbm1(i) = cbm1_macmic(i)/REAL(cld_macmic_num_steps) - - if (clubb_mf_up_ndt == 1) then - ztopma(i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - else - ztopmn(2:clubb_mf_up_ndt,i) = ztopmn(1:clubb_mf_up_ndt-1,i) - ztopmn(1,i) = ztopm1_macmic(i)/REAL(cld_macmic_num_steps) - ztopma(i) = 0._r8 - do t=1,clubb_mf_up_ndt - ztopma(i) = ztopma(i) + ztopmn(t,i) - end do - ztopma(i) = ztopma(i)/REAL(clubb_mf_up_ndt) - end if - - if (clubb_mf_cp_ndt == 1) then - ddcp(i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - else - ddcpmn(2:clubb_mf_cp_ndt,i) = ddcpmn(1:clubb_mf_cp_ndt-1,i) - ddcpmn(1,i) = ddcp_macmic(i)/REAL(cld_macmic_num_steps) - ddcp(i) = 0._r8 - do t=1,clubb_mf_cp_ndt - ddcp(i) = ddcp(i) + ddcpmn(t,i) - end do - ddcp(i) = ddcp(i)/REAL(clubb_mf_cp_ndt) - end if - - ddcp(i) = clubb_mf_ddalph*ddcp(i) - - end if - - mf_qc(:pverp) = mf_qc_nadv(:pverp)/REAL(nadv) - mf_rcm(:pverp) = mf_rcm_nadv(:pverp)/REAL(nadv) - mf_cloudfrac(:pverp) = mf_cloudfrac_nadv(:pverp)/REAL(nadv) - prec_sh(i) = mf_precc_nadv/REAL(nadv) - snow_sh(i) = mf_snow_nadv/REAL(nadv) - - mf_thlforcup_nadv(:pverp) = mf_thlforcup_nadv(:pverp)/REAL(nadv) - mf_qtforcup_nadv(:pverp) = mf_qtforcup_nadv(:pverp)/REAL(nadv) - mf_thlforcdn_nadv(:pverp) = mf_thlforcdn_nadv(:pverp)/REAL(nadv) - mf_qtforcdn_nadv(:pverp) = mf_qtforcdn_nadv(:pverp)/REAL(nadv) - mf_thlforc_nadv(:pverp) = mf_thlforc_nadv(:pverp)/REAL(nadv) - mf_qtforc_nadv(:pverp) = mf_qtforc_nadv(:pverp)/REAL(nadv) - - mf_ent_nadv(:pverp) = mf_ent_nadv(:pverp)/REAL(nadv) - end if - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp2_in=zm2zt_api(wp2_in) - wpthlp_in=zm2zt_api(wpthlp_in) - wprtp_in=zm2zt_api(wprtp_in) - up2_in=zm2zt_api(up2_in) - vp2_in=zm2zt_api(vp2_in) - thlp2_in=zm2zt_api(thlp2_in) - rtp2_in=zm2zt_api(rtp2_in) - rtpthlp_in=zm2zt_api(rtpthlp_in) - - do k=1,nlev+1 - thlp2_in(k)=max(thl_tol**2,thlp2_in(k)) - rtp2_in(k)=max(rt_tol**2,rtp2_in(k)) - wp2_in(k)=max(w_tol_sqd,wp2_in(k)) - up2_in(k)=max(w_tol_sqd,up2_in(k)) - vp2_in(k)=max(w_tol_sqd,vp2_in(k)) - enddo - endif - endif - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api(rtp2_in) - thl2_zt = zm2zt_api(thlp2_in) - wp2_zt = zm2zt_api(wp2_in) - - ! Need moist_qc and cloudfrac on thermo grid for output - mf_qc_zt = zm2zt_api(mf_qc) - mf_cloudfrac_zt = zm2zt_api(mf_cloudfrac) - - ! Arrays need to be "flipped" to CAM grid -======= - ! Compute some inputs from the thermodynamic grid - ! to the momentum grid - rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_ds_zt ) - rho_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, rho_zt ) - invrs_rho_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, invrs_rho_ds_zt ) - thv_ds_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, thv_ds_zt ) - wm_zm = zt2zm_api( pverp+1-top_lev, ncol, gr, wm_zt ) - - ! Surface fluxes provided by host model - do i=1,ncol - wpthlp_sfc(i) = cam_in%shf(i)/(cpairv(i,pver,lchnk)*rho_ds_zm(i,1)) ! Sensible heat flux - wpthlp_sfc(i) = wpthlp_sfc(i)*inv_exner_clubb_surf(i) ! Potential temperature flux - wprtp_sfc(i) = cam_in%cflx(i,1)/rho_ds_zm(i,1) ! Moisture flux - end do - - ! Implementation after Thomas Toniazzo (NorESM) and Colin Zarzycki (PSU) - ! Other Surface fluxes provided by host model - if( (cld_macmic_num_steps > 1) .and. clubb_l_intr_sfc_flux_smooth ) then - ! Adjust surface stresses using winds from the prior macmic iteration - do i=1,ncol - ubar = sqrt(state1%u(i,pver)**2+state1%v(i,pver)**2) - if (ubar < 0.25_r8) ubar = 0.25_r8 - - call calc_ustar( state1%t(i,pver), state1%pmid(i,pver), cam_in%wsx(i), cam_in%wsy(i), & - rrho(i), ustar ) - - upwp_sfc(i) = -state1%u(i,pver)*ustar**2/ubar - vpwp_sfc(i) = -state1%v(i,pver)*ustar**2/ubar - end do - else - do i=1,ncol - upwp_sfc(i) = cam_in%wsx(i)/rho_ds_zm(i,1) ! Surface meridional momentum flux - vpwp_sfc(i) = cam_in%wsy(i)/rho_ds_zm(i,1) ! Surface zonal momentum flux - end do - endif ->>>>>>> ESCOMP/cam_development - - ! Perturbed winds are not used in CAM - upwp_sfc_pert = 0.0_r8 - vpwp_sfc_pert = 0.0_r8 - - ! Need to flip arrays around for CLUBB core - do k=1,nlev+1 - do i=1,ncol - um_in(i,k) = um(i,pverp-k+1) - vm_in(i,k) = vm(i,pverp-k+1) - upwp_in(i,k) = upwp(i,pverp-k+1) - vpwp_in(i,k) = vpwp(i,pverp-k+1) - wpthvp_in(i,k) = wpthvp(i,pverp-k+1) - wp2thvp_in(i,k) = wp2thvp(i,pverp-k+1) - rtpthvp_in(i,k) = rtpthvp(i,pverp-k+1) - thlpthvp_in(i,k)= thlpthvp(i,pverp-k+1) - up2_in(i,k) = up2(i,pverp-k+1) - vp2_in(i,k) = vp2(i,pverp-k+1) - up3_in(i,k) = up3(i,pverp-k+1) - vp3_in(i,k) = vp3(i,pverp-k+1) - wp2_in(i,k) = wp2(i,pverp-k+1) - wp3_in(i,k) = wp3(i,pverp-k+1) - rtp2_in(i,k) = rtp2(i,pverp-k+1) - thlp2_in(i,k) = thlp2(i,pverp-k+1) - rtp3_in(i,k) = rtp3(i,pverp-k+1) - thlp3_in(i,k) = thlp3(i,pverp-k+1) - thlm_in(i,k) = thlm(i,pverp-k+1) - rtm_in(i,k) = rtm(i,pverp-k+1) - rvm_in(i,k) = rvm(i,pverp-k+1) - wprtp_in(i,k) = wprtp(i,pverp-k+1) - wpthlp_in(i,k) = wpthlp(i,pverp-k+1) - rtpthlp_in(i,k) = rtpthlp(i,pverp-k+1) - cloud_frac_inout(i,k) = cloud_frac(i,pverp-k+1) - if (k>1) then - rcm_inout(i,k) = state1%q(i,pverp-k+1,ixcldliq) - end if - -<<<<<<< HEAD - if (do_clubb_mf) then - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(k) - - s_ae_output(i,pverp-k+1) = s_ae(k) - s_aw_output(i,pverp-k+1) = s_aw(k) - - s_awthlup_output(i,pverp-k+1) = s_awthlup(k) - s_awqtup_output(i,pverp-k+1) = s_awqtup(k) - s_awthldn_output(i,pverp-k+1) = s_awthldn(k) - s_awqtdn_output(i,pverp-k+1) = s_awqtdn(k) - s_awthl_output(i,pverp-k+1) = s_awthl(k) - s_awqt_output(i,pverp-k+1) = s_awqt(k) - - s_awuup_output(i,pverp-k+1) = s_awuup(k) - s_awvup_output(i,pverp-k+1) = s_awvup(k) - s_awudn_output(i,pverp-k+1) = s_awudn(k) - s_awvdn_output(i,pverp-k+1) = s_awvdn(k) - - s_awu_output(i,pverp-k+1) = s_awu(k) - s_awv_output(i,pverp-k+1) = s_awv(k) - s_aww_output(i,pverp-k+1) = s_aww(k) - - mf_thlflxup_output(i,pverp-k+1) = mf_thlflxup(k) - mf_qtflxup_output(i,pverp-k+1) = mf_qtflxup(k) - mf_thlflxdn_output(i,pverp-k+1) = mf_thlflxdn(k) - mf_qtflxdn_output(i,pverp-k+1) = mf_qtflxdn(k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(k) - mf_thvflx_output(i,pverp-k+1) = mf_thvflx(k) - - mf_uflxup_output(i,pverp-k+1) = mf_uflxup(k) - mf_vflxup_output(i,pverp-k+1) = mf_vflxup(k) - mf_uflxdn_output(i,pverp-k+1) = mf_uflxdn(k) - mf_vflxdn_output(i,pverp-k+1) = mf_vflxdn(k) - mf_uflx_output(i,pverp-k+1) = mf_uflx(k) - mf_vflx_output(i,pverp-k+1) = mf_vflx(k) - - mf_rcm_output(i,pverp-k+1) = mf_rcm(k) - mf_precc_output(i,pverp-k+1) = mf_precc(k) - - if (k.ne.1) then - mf_thlforcup_output(i,pverp-k+1) = mf_thlforcup_nadv(k) - mf_qtforcup_output(i,pverp-k+1) = mf_qtforcup_nadv(k) - mf_thlforcdn_output(i,pverp-k+1) = mf_thlforcdn_nadv(k) - mf_qtforcdn_output(i,pverp-k+1) = mf_qtforcdn_nadv(k) - mf_thlforc_output(i,pverp-k+1) = mf_thlforc_nadv(k) - mf_qtforc_output(i,pverp-k+1) = mf_qtforc_nadv(k) - mf_sqtup_output(i,pverp-k+1) = mf_sqtup(k) - mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(k) - - mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(k) - mf_ent_output(i,pverp-k+1) = mf_ent_nadv(k) - mf_qc_output(i,pverp-k+1) = mf_qc_zt(k) - end if - - mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(k,:clubb_mf_nup) - mf_upw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upw(k,:clubb_mf_nup) - mf_upmf_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upmf(k,:clubb_mf_nup) - mf_upqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqt(k,:clubb_mf_nup) - mf_upthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthl(k,:clubb_mf_nup) - mf_upthv_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upthv(k,:clubb_mf_nup) - mf_upth_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upth(k,:clubb_mf_nup) - mf_upqc_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upqc(k,:clubb_mf_nup) - mf_upent_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upent(k,:clubb_mf_nup) - mf_updet_flip(i,pverp-k+1,:clubb_mf_nup) = mf_updet(k,:clubb_mf_nup) - mf_upbuoy_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upbuoy(k,:clubb_mf_nup) - mf_dnw_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnw(k,:clubb_mf_nup) - mf_dnthl_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnthl(k,:clubb_mf_nup) - mf_dnqt_flip(i,pverp-k+1,:clubb_mf_nup) = mf_dnqt(k,:clubb_mf_nup) - end if -======= - ! We only need to copy pdf_params from pbuf if this is a restart and - ! we're calling pdf_closure at the end of advance_clubb_core - if ( is_first_restart_step() & - .and. clubb_config_flags%ipdf_call_placement .eq. ipdf_post_advance_fields ) then - pdf_params_zm_chnk(lchnk)%w_1(i,k) = pdf_zm_w_1(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%w_2(i,k) = pdf_zm_w_2(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%varnce_w_1(i,k) = pdf_zm_varnce_w_1(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%varnce_w_2(i,k) = pdf_zm_varnce_w_2(i,pverp-k+1) - pdf_params_zm_chnk(lchnk)%mixt_frac(i,k) = pdf_zm_mixt_frac(i,pverp-k+1) - end if ->>>>>>> ESCOMP/cam_development - - sclrpthvp_inout(i,k,:) = 0._r8 - wp2rtp_inout(i,k) = wp2rtp(i,pverp-k+1) - wp2thlp_inout(i,k) = wp2thlp(i,pverp-k+1) - uprcp_inout(i,k) = uprcp(i,pverp-k+1) - vprcp_inout(i,k) = vprcp(i,pverp-k+1) - rc_coef_inout(i,k) = rc_coef(i,pverp-k+1) - wp4_inout(i,k) = wp4(i,pverp-k+1) - wpup2_inout(i,k) = wpup2(i,pverp-k+1) - wpvp2_inout(i,k) = wpvp2(i,pverp-k+1) - wp2up2_inout(i,k) = wp2up2(i,pverp-k+1) - wp2vp2_inout(i,k) = wp2vp2(i,pverp-k+1) - ice_supersat_frac_inout(i,k) = ice_supersat_frac(i,pverp-k+1) - end do - end do - -<<<<<<< HEAD - if (do_clubb_mf) then -!+++ARH - ! these fillvalues won't average correctly - !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue - !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue - - !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv - mf_ztop_output(i) = mf_ztop_nadv - - mf_L0_output(i) = mf_L0_nadv - mf_cfl_output(i) = max_cfl_nadv - - !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) - mf_ddcp_output(i) = mf_ddcp_nadv - - mf_freq_output(i) = mf_freq_nadv -!---ARH - do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) - mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) - mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) - mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) - mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) - end do - end if - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - upwp(i,:top_lev-1) = 0._r8 - vpwp(i,:top_lev-1) = 0._r8 - rcm(i,:top_lev-1) = 0._r8 - wprcp(i,:top_lev-1) = 0._r8 - cloud_frac(i,:top_lev-1) = 0._r8 - rcm_in_layer(i,:top_lev-1) = 0._r8 - zt_out(i,:top_lev-1) = 0._r8 - zi_out(i,:top_lev-1) = 0._r8 - khzm(i,:top_lev-1) = 0._r8 - qclvar(i,:top_lev-1) = 2._r8 - - - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - edsclr_out(:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end if - enddo -======= - ! Perturbed winds are not used in CAM - um_pert_inout = 0.0_r8 - vm_pert_inout = 0.0_r8 - upwp_pert_inout = 0.0_r8 - vpwp_pert_inout = 0.0_r8 - - do k=2,nlev+1 - do i=1,ncol - pre_in(i,k) = prer_evap(i,pverp-k+1) - end do - end do - - do i=1,ncol - pre_in(i,1) = pre_in(i,2) - end do ->>>>>>> ESCOMP/cam_development - - do i=1,ncol - rcm_inout(i,1) = rcm_inout(i,2) - end do - - ! Initialize these to prevent crashing behavior - do k=1,nlev+1 - do i=1,ncol - wprcp_out(i,k) = 0._r8 - rcm_in_layer_out(i,k) = 0._r8 - cloud_cover_out(i,k) = 0._r8 - edsclr_in(i,k,:) = 0._r8 - khzm_out(i,k) = 0._r8 - khzt_out(i,k) = 0._r8 - end do - end do - - ! higher order scalar stuff, put to zero - do ixind=1, sclr_dim - do k=1, nlev+1 - do i=1, ncol - sclrm(i,k,ixind) = 0._r8 - wpsclrp(i,k,ixind) = 0._r8 - sclrp2(i,k,ixind) = 0._r8 - sclrp3(i,k,ixind) = 0._r8 - sclrprtp(i,k,ixind) = 0._r8 - sclrpthlp(i,k,ixind) = 0._r8 - wpsclrp_sfc(i,ixind) = 0._r8 - end do - end do - end do - - do ixind=1, hydromet_dim - do k=1, nlev+1 - do i=1, ncol - hydromet(i,k,ixind) = 0._r8 - wphydrometp(i,k,ixind) = 0._r8 - wp2hmp(i,k,ixind) = 0._r8 - rtphmp_zt(i,k,ixind) = 0._r8 - thlphmp_zt(i,k,ixind) = 0._r8 - end do - end do - end do - - ! pressure,exner on momentum grid needed for mass flux calc. - if (do_clubb_mf) then - - do k=1,pver - do i=1,ncol - kappa_zt(i,k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) - qc_zt(i,k+1) = state1%q(i,pver-k+1,ixcldliq) - invrs_exner_zt(i,k+1) = inv_exner_clubb(i,pver-k+1) - end do - end do - - do i=1,ncol - kappa_zt(i,1) = kappa_zt(i,2) - qc_zt(i,1) = qc_zt(i,2) - invrs_exner_zt(i,1) = invrs_exner_zt(i,2) - end do - - kappa_zm(1:ncol,:) = zt2zm_api(pverp+1-top_lev, ncol, gr, kappa_zt(1:ncol,:)) - - do k=1,pverp - do i=1,ncol - p_in_Pa_zm(i,k) = state1%pint(i,pverp-k+1) - invrs_exner_zm(i,k) = 1._r8/((p_in_Pa_zm(i,k)/p0_clubb)**(kappa_zm(i,k))) - end do - end do - - end if - - - if (clubb_do_adv) then - if (macmic_it == 1) then - - wp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wp2_in ) - wpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wpthlp_in ) - wprtp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, wprtp_in ) - up2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, up2_in ) - vp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, vp2_in ) - thlp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, thlp2_in ) - rtp2_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtp2_in ) - rtpthlp_in = zt2zm_api(pverp+1-top_lev, ncol, gr, rtpthlp_in ) - - do k=1,nlev+1 - do i=1,ncol - thlp2_in(i,k) = max(thl_tol**2,thlp2_in(i,k)) - rtp2_in(i,k) = max(rt_tol**2,rtp2_in(i,k)) - wp2_in(i,k) = max(w_tol_sqd,wp2_in(i,k)) - up2_in(i,k) = max(w_tol_sqd,up2_in(i,k)) - vp2_in(i,k) = max(w_tol_sqd,vp2_in(i,k)) - end do - end do - - end if - end if - - ! Do the same for tracers - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - - icnt = icnt+1 - - do k=1,nlev - do i=1,ncol - edsclr_in(i,k+1,icnt) = state1%q(i,pver-k+1,ixind) - end do - end do - - do i=1,ncol - edsclr_in(i,1,icnt) = edsclr_in(i,2,icnt) - end do - - end if - end do - - - if (clubb_l_do_expldiff_rtm_thlm) then - do k=1,nlev - do i=1, ncol - edsclr_in(i,k+1,icnt+1) = thlm(i,pver-k+1) - edsclr_in(i,k+1,icnt+2) = rtm(i,pver-k+1) - end do - end do - - do i=1, ncol - edsclr_in(i,1,icnt+1) = edsclr_in(i,2,icnt+1) - edsclr_in(i,1,icnt+2) = edsclr_in(i,2,icnt+2) - end do - - endif - - - do t=1,nadv ! do needed number of "sub" timesteps for each CAM step - - ! Increment the statistics then being stats timestep - if (l_stats) then - call stats_begin_timestep_api(t, stats_nsamp, stats_nout) - endif - - !####################################################################### - !###################### CALL MF DIAGNOSTIC PLUMES ###################### - !####################################################################### - if (do_clubb_mf) then - - do k=2,pverp - do i=1, ncol - dzt(i,k) = zi_g(i,k) - zi_g(i,k-1) - end do - end do - - do i=1, ncol - dzt(i,1) = dzt(i,2) - invrs_dzt(i,:) = 1._r8/dzt(i,:) - end do - - rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) - thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) - - do i=1, ncol - call integrate_mf( pverp, dzt(i,:), zi_g(i,:), p_in_Pa_zm(i,:), invrs_exner_zm(i,:), & ! input - p_in_Pa(i,:), invrs_exner_zt(i,:), & ! input - um_in(i,:), vm_in(i,:), thlm_in(i,:), rtm_in(i,:), thv(i,:), & ! input - thlm_zm_in(i,:), rtm_zm_in(i,:), & ! input - wpthlp_sfc(i), wprtp_sfc(i), pblh(i), & ! input - mf_dry_a(i,:), mf_moist_a(i,:), & ! output - plume diagnostics - mf_dry_w(i,:), mf_moist_w(i,:), & ! output - plume diagnostics - mf_dry_qt(i,:), mf_moist_qt(i,:), & ! output - plume diagnostics - mf_dry_thl(i,:), mf_moist_thl(i,:), & ! output - plume diagnostics - mf_dry_u(i,:), mf_moist_u(i,:), & ! output - plume diagnostics - mf_dry_v(i,:), mf_moist_v(i,:), & ! output - plume diagnostics - mf_moist_qc(i,:), & ! output - plume diagnostics - s_ae(i,:), s_aw(i,:), & ! output - plume diagnostics - s_awthl(i,:), s_awqt(i,:), & ! output - plume diagnostics - s_awql(i,:), s_awqi(i,:), & ! output - plume diagnostics - s_awu(i,:), s_awv(i,:), & ! output - plume diagnostics - mf_thlflx(i,:), mf_qtflx(i,:) ) ! output - variables needed for solver - end do - - ! pass MF turbulent advection term as CLUBB explicit forcing term - do i=1, ncol - rtm_forcing(i,1) = 0._r8 - thlm_forcing(i,1)= 0._r8 - end do - - do k=2,pverp - do i=1, ncol - rtm_forcing(i,k) = rtm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_qtflx(i,k)) - (rho_ds_zm(i,k-1) * mf_qtflx(i,k-1))) - - thlm_forcing(i,k) = thlm_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * & - ((rho_ds_zm(i,k) * mf_thlflx(i,k)) - (rho_ds_zm(i,k-1) * mf_thlflx(i,k-1))) - end do - end do - - end if - - ! Advance CLUBB CORE one timestep in the future - call advance_clubb_core_api( gr, pverp+1-top_lev, ncol, & - l_implemented, dtime, fcor, sfc_elevation, hydromet_dim, & - thlm_forcing, rtm_forcing, um_forcing, vm_forcing, & - sclrm_forcing, edsclrm_forcing, wprtp_forcing, & - wpthlp_forcing, rtp2_forcing, thlp2_forcing, & - rtpthlp_forcing, wm_zm, wm_zt, & - wpthlp_sfc, wprtp_sfc, upwp_sfc, vpwp_sfc, & - wpsclrp_sfc, wpedsclrp_sfc, & - upwp_sfc_pert, vpwp_sfc_pert, & - rtm_ref, thlm_ref, um_ref, vm_ref, ug, vg, & - p_in_Pa, rho_zm, rho_zt, exner, & - rho_ds_zm, rho_ds_zt, invrs_rho_ds_zm, & - invrs_rho_ds_zt, thv_ds_zm, thv_ds_zt, hydromet, & - rfrzm, radf, & - wphydrometp, wp2hmp, rtphmp_zt, thlphmp_zt, & - grid_dx, grid_dy, & - clubb_params, nu_vert_res_dep, lmin, & - clubb_config_flags, & - stats_zt(:ncol), stats_zm(:ncol), stats_sfc(:ncol), & - um_in, vm_in, upwp_in, vpwp_in, up2_in, vp2_in, up3_in, vp3_in, & - thlm_in, rtm_in, wprtp_in, wpthlp_in, & - wp2_in, wp3_in, rtp2_in, rtp3_in, thlp2_in, thlp3_in, rtpthlp_in, & - sclrm, & - sclrp2, sclrp3, sclrprtp, sclrpthlp, & - wpsclrp, edsclr_in, err_code, & - rcm_inout, cloud_frac_inout, & - wpthvp_in, wp2thvp_in, rtpthvp_in, thlpthvp_in, & - sclrpthvp_inout, & - wp2rtp_inout, wp2thlp_inout, uprcp_inout, & - vprcp_inout, rc_coef_inout, & - wp4_inout, wpup2_inout, wpvp2_inout, & - wp2up2_inout, wp2vp2_inout, ice_supersat_frac_inout, & - um_pert_inout, vm_pert_inout, upwp_pert_inout, vpwp_pert_inout, & - pdf_params_chnk(lchnk), pdf_params_zm_chnk(lchnk), & - pdf_implicit_coefs_terms_chnk(lchnk), & - khzm_out, khzt_out, & - qclvar_out, thlprcp_out, & - wprcp_out, w_up_in_cloud_out, w_down_in_cloud_out, & - cloudy_updraft_frac_out, cloudy_downdraft_frac_out, & - rcm_in_layer_out, cloud_cover_out, invrs_tau_zm_out ) - - ! Note that CLUBB does not produce an error code specific to any column, and - ! one value only for the entire chunk - if ( err_code == clubb_fatal_error ) then - write(fstderr,*) "Fatal error in CLUBB: at timestep ", get_nstep() - write(fstderr,*) "LAT Range: ", state1%lat(1), " -- ", state1%lat(ncol) - write(fstderr,*) "LON: Range:", state1%lon(1), " -- ", state1%lon(ncol) - call endrun(subr//': Fatal error in CLUBB library') - end if - - if (do_rainturb) then - - do k=1,nlev+1 - do i=1,ncol - rvm_in(i,k) = rtm_in(i,k) - rcm_inout(i,k) - end do - end do - - call update_xp2_mc_api( gr, nlev+1, ncol, dtime, cloud_frac_inout, & - rcm_inout, rvm_in, thlm_in, wm_zt, & - exner, pre_in, pdf_params_chnk(lchnk), & - rtp2_mc_out, thlp2_mc_out, & - wprtp_mc_out, wpthlp_mc_out, & - rtpthlp_mc_out) - - do k=1,nlev+1 - do i=1,ncol - dum1 = (1._r8 - cam_in%landfrac(i)) - - ! update turbulent moments based on rain evaporation - rtp2_in(i,k) = rtp2_in(i,k) + clubb_rnevap_effic * dum1 * rtp2_mc_out(i,k) * dtime - thlp2_in(i,k) = thlp2_in(i,k) + clubb_rnevap_effic * dum1 * thlp2_mc_out(i,k) * dtime - wprtp_in(i,k) = wprtp_in(i,k) + clubb_rnevap_effic * dum1 * wprtp_mc_out(i,k) * dtime - wpthlp_in(i,k) = wpthlp_in(i,k) + clubb_rnevap_effic * dum1 * wpthlp_mc_out(i,k) * dtime - end do - end do - - end if - - - if (do_cldcool) then - - rcm_out_zm = zt2zm_api(pverp+1-top_lev, ncol, gr, rcm_inout ) - qrl_zm = zt2zm_api(pverp+1-top_lev, ncol, gr, qrl_clubb ) - thlp2_rad_out(:,:) = 0._r8 - - do i=1, ncol - call calculate_thlp2_rad_api(nlev+1, rcm_out_zm(i,:), thlprcp_out(i,:), qrl_zm(i,:), clubb_params, & - thlp2_rad_out(i,:)) - end do - - do i=1, ncol - thlp2_in(i,:) = thlp2_in(i,:) + thlp2_rad_out(i,:) * dtime - thlp2_in(i,:) = max(thl_tol**2,thlp2_in(i,:)) - end do - - end if - - ! Check to see if stats should be output, here stats are read into - ! output arrays to make them conformable to CAM output - if (l_stats) then - do i=1, ncol - call stats_end_timestep_clubb(i, stats_zt(i), stats_zm(i), stats_rad_zt(i), stats_rad_zm(i), stats_sfc(i), & - out_zt, out_zm, out_radzt, out_radzm, out_sfc) - end do - end if - - enddo ! end time loop - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - - wp2_in = zm2zt_api( pverp+1-top_lev, ncol, gr, wp2_in ) - wpthlp_in = zm2zt_api( pverp+1-top_lev, ncol, gr, wpthlp_in ) - wprtp_in = zm2zt_api( pverp+1-top_lev, ncol, gr, wprtp_in ) - up2_in = zm2zt_api( pverp+1-top_lev, ncol, gr, up2_in ) - vp2_in = zm2zt_api( pverp+1-top_lev, ncol, gr, vp2_in ) - thlp2_in = zm2zt_api( pverp+1-top_lev, ncol, gr, thlp2_in ) - rtp2_in = zm2zt_api( pverp+1-top_lev, ncol, gr, rtp2_in ) - rtpthlp_in = zm2zt_api( pverp+1-top_lev, ncol, gr, rtpthlp_in ) - - do k=1,nlev+1 - do i=1, ncol - thlp2_in(i,k) = max(thl_tol**2, thlp2_in(i,k)) - rtp2_in(i,k) = max(rt_tol**2, rtp2_in(i,k)) - wp2_in(i,k) = max(w_tol_sqd, wp2_in(i,k)) - up2_in(i,k) = max(w_tol_sqd, up2_in(i,k)) - vp2_in(i,k) = max(w_tol_sqd, vp2_in(i,k)) - end do - end do - - end if - end if - - ! Convert RTP2 and THLP2 to thermo grid for output - rtp2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, rtp2_in ) - thl2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, thlp2_in ) - wp2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, wp2_in ) - - ! Arrays need to be "flipped" to CAM grid - do k=1, nlev+1 - do i=1, ncol - um(i,pverp-k+1) = um_in(i,k) - vm(i,pverp-k+1) = vm_in(i,k) - upwp(i,pverp-k+1) = upwp_in(i,k) - vpwp(i,pverp-k+1) = vpwp_in(i,k) - wpthvp(i,pverp-k+1) = wpthvp_in(i,k) - wp2thvp(i,pverp-k+1) = wp2thvp_in(i,k) - rtpthvp(i,pverp-k+1) = rtpthvp_in(i,k) - thlpthvp(i,pverp-k+1) = thlpthvp_in(i,k) - up2(i,pverp-k+1) = up2_in(i,k) - vp2(i,pverp-k+1) = vp2_in(i,k) - up3(i,pverp-k+1) = up3_in(i,k) - vp3(i,pverp-k+1) = vp3_in(i,k) - thlm(i,pverp-k+1) = thlm_in(i,k) - rtm(i,pverp-k+1) = rtm_in(i,k) - wprtp(i,pverp-k+1) = wprtp_in(i,k) - wpthlp(i,pverp-k+1) = wpthlp_in(i,k) - wp2(i,pverp-k+1) = wp2_in(i,k) - wp3(i,pverp-k+1) = wp3_in(i,k) - rtp2(i,pverp-k+1) = rtp2_in(i,k) - thlp2(i,pverp-k+1) = thlp2_in(i,k) - rtp3(i,pverp-k+1) = rtp3_in(i,k) - thlp3(i,pverp-k+1) = thlp3_in(i,k) - rtpthlp(i,pverp-k+1) = rtpthlp_in(i,k) - rcm(i,pverp-k+1) = rcm_inout(i,k) - wprcp(i,pverp-k+1) = wprcp_out(i,k) - cloud_frac(i,pverp-k+1) = min(cloud_frac_inout(i,k),1._r8) - pdf_zm_w_1(i,pverp-k+1) = pdf_params_zm_chnk(lchnk)%w_1(i,k) - pdf_zm_w_2(i,pverp-k+1) = pdf_params_zm_chnk(lchnk)%w_2(i,k) - pdf_zm_varnce_w_1(i,pverp-k+1) = pdf_params_zm_chnk(lchnk)%varnce_w_1(i,k) - pdf_zm_varnce_w_2(i,pverp-k+1) = pdf_params_zm_chnk(lchnk)%varnce_w_2(i,k) - pdf_zm_mixt_frac(i,pverp-k+1) = pdf_params_zm_chnk(lchnk)%mixt_frac(i,k) - rcm_in_layer(i,pverp-k+1) = rcm_in_layer_out(i,k) - cloud_cover(i,pverp-k+1) = min(cloud_cover_out(i,k),1._r8) - zt_out(i,pverp-k+1) = zt_g(i,k) - zi_out(i,pverp-k+1) = zi_g(i,k) - khzm(i,pverp-k+1) = khzm_out(i,k) - qclvar(i,pverp-k+1) = min(1._r8,qclvar_out(i,k)) - wm_zt_out(i,pverp-k+1) = wm_zt(i,k) - wp2rtp(i,pverp-k+1) = wp2rtp_inout(i,k) - wp2thlp(i,pverp-k+1) = wp2thlp_inout(i,k) - uprcp(i,pverp-k+1) = uprcp_inout(i,k) - vprcp(i,pverp-k+1) = vprcp_inout(i,k) - rc_coef(i,pverp-k+1) = rc_coef_inout(i,k) - wp4(i,pverp-k+1) = wp4_inout(i,k) - wpup2(i,pverp-k+1) = wpup2_inout(i,k) - wpvp2(i,pverp-k+1) = wpvp2_inout(i,k) - wp2up2(i,pverp-k+1) = wp2up2_inout(i,k) - wp2vp2(i,pverp-k+1) = wp2vp2_inout(i,k) - ice_supersat_frac(i,pverp-k+1) = ice_supersat_frac_inout(i,k) - - rtp2_zt_out(i,pverp-k+1) = rtp2_zt(i,k) - thl2_zt_out(i,pverp-k+1) = thl2_zt(i,k) - wp2_zt_out(i,pverp-k+1) = wp2_zt(i,k) - - end do - end do - - do k=1, nlev+1 - do i=1, ncol - - mean_rt = pdf_params_chnk(lchnk)%mixt_frac(i,k) & - * pdf_params_chnk(lchnk)%rt_1(i,k) & - + ( 1.0_r8 - pdf_params_chnk(lchnk)%mixt_frac(i,k) ) & - * pdf_params_chnk(lchnk)%rt_2(i,k) - - pdfp_rtp2(i,pverp-k+1) = pdf_params_chnk(lchnk)%mixt_frac(i,k) & - * ( ( pdf_params_chnk(lchnk)%rt_1(i,k) - mean_rt )**2 & - + pdf_params_chnk(lchnk)%varnce_rt_1(i,k) ) & - + ( 1.0_r8 - pdf_params_chnk(lchnk)%mixt_frac(i,k) ) & - * ( ( pdf_params_chnk(lchnk)%rt_2(i,k) - mean_rt )**2 & - + pdf_params_chnk(lchnk)%varnce_rt_2(i,k) ) - end do - end do - - do ixind=1,edsclr_dim - do k=1, nlev+1 - do i=1, ncol - edsclr_out(i,pverp-k+1,ixind) = edsclr_in(i,k,ixind) - end do - end do - end do - - if (do_clubb_mf) then - do k=1, nlev+1 - do i=1, ncol - mf_dry_a_output(i,pverp-k+1) = mf_dry_a(i,k) - mf_moist_a_output(i,pverp-k+1) = mf_moist_a(i,k) - mf_dry_w_output(i,pverp-k+1) = mf_dry_w(i,k) - mf_moist_w_output(i,pverp-k+1) = mf_moist_w(i,k) - mf_dry_qt_output(i,pverp-k+1) = mf_dry_qt(i,k) - mf_moist_qt_output(i,pverp-k+1) = mf_moist_qt(i,k) - mf_dry_thl_output(i,pverp-k+1) = mf_dry_thl(i,k) - mf_moist_thl_output(i,pverp-k+1) = mf_moist_thl(i,k) - mf_dry_u_output(i,pverp-k+1) = mf_dry_u(i,k) - mf_moist_u_output(i,pverp-k+1) = mf_moist_u(i,k) - mf_dry_v_output(i,pverp-k+1) = mf_dry_v(i,k) - mf_moist_v_output(i,pverp-k+1) = mf_moist_v(i,k) - mf_moist_qc_output(i,pverp-k+1) = mf_moist_qc(i,k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(i,k) - s_ae_output(i,pverp-k+1) = s_ae(i,k) - s_aw_output(i,pverp-k+1) = s_aw(i,k) - s_awthl_output(i,pverp-k+1) = s_awthl(i,k) - s_awqt_output(i,pverp-k+1) = s_awqt(i,k) - s_awql_output(i,pverp-k+1) = s_awql(i,k) - s_awqi_output(i,pverp-k+1) = s_awqi(i,k) - s_awu_output(i,pverp-k+1) = s_awu(i,k) - s_awv_output(i,pverp-k+1) = s_awv(i,k) - mf_thlflx_output(i,pverp-k+1) = mf_thlflx(i,k) - mf_qtflx_output(i,pverp-k+1) = mf_qtflx(i,k) - end do - end do - end if - - ! Values to use above top_lev, for variables that have not already been - ! set up there. These are mostly fill values that should not actually be - ! used in the run, but may end up in diagnostic output. - do k=1, top_lev-1 - do i=1, ncol - upwp(i,k) = 0._r8 - vpwp(i,k) = 0._r8 - rcm(i,k) = 0._r8 - wprcp(i,k) = 0._r8 - cloud_frac(i,k) = 0._r8 - rcm_in_layer(i,k) = 0._r8 - zt_out(i,k) = 0._r8 - zi_out(i,k) = 0._r8 - khzm(i,k) = 0._r8 - qclvar(i,k) = 2._r8 - end do - end do - - ! enforce zero tracer tendencies above the top_lev level -- no change - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - - do i=1, ncol - edsclr_out(i,:top_lev-1,icnt) = state1%q(i,:top_lev-1,ixind) - end do - - end if - end do - - ! Fill up arrays needed for McICA. Note we do not want the ghost point, - ! thus why the second loop is needed. - zi_out(:,1) = 0._r8 - - ! Compute static energy using CLUBB's variables - do k=1,pver - do i=1, ncol - clubb_s(i,k) = cpairv(i,k,lchnk) * thlm(i,k) / inv_exner_clubb(i,k) & - + latvap * rcm(i,k) & - + gravit * state1%zm(i,k) + state1%phis(i) - end do - end do - - ! Section below is concentrated on energy fixing for conservation. - ! because CLUBB and CAM's thermodynamic variables are different. - - ! Initialize clubbtop to top_lev, for finding the highlest level CLUBB is - ! active for informing where to apply the energy fixer. - do i=1, ncol - clubbtop(i) = top_lev - do while ((rtp2(i,clubbtop(i)) <= 1.e-15_r8 .and. rcm(i,clubbtop(i)) == 0._r8) .and. clubbtop(i) < pver) - clubbtop(i) = clubbtop(i) + 1 - end do - end do - - ! Compute integrals for static energy, kinetic energy, water vapor, and liquid water - ! after CLUBB is called. This is for energy conservation purposes. - se_a(:) = 0._r8 - ke_a(:) = 0._r8 - wv_a(:) = 0._r8 - wl_a(:) = 0._r8 - - do k=1,pver - do i=1, ncol - se_a(i) = se_a(i) + clubb_s(i,k)*state1%pdel(i,k)*rga - ke_a(i) = ke_a(i) + 0.5_r8*(um(i,k)**2+vm(i,k)**2)*state1%pdel(i,k)*rga - wv_a(i) = wv_a(i) + (rtm(i,k)-rcm(i,k))*state1%pdeldry(i,k)*rga - wl_a(i) = wl_a(i) + (rcm(i,k))*state1%pdeldry(i,k)*rga - end do - end do - - ! Do the same as above, but for before CLUBB was called. - se_b(:) = 0._r8 - ke_b(:) = 0._r8 - wv_b(:) = 0._r8 - wl_b(:) = 0._r8 - - do k=1, pver - do i=1, ncol - se_b(i) = se_b(i) + state1%s(i,k)*state1%pdel(i,k)*rga - ke_b(i) = ke_b(i) + 0.5_r8*(state1%u(i,k)**2+state1%v(i,k)**2)*state1%pdel(i,k)*rga - wv_b(i) = wv_b(i) + state1%q(i,k,ixq)*state1%pdeldry(i,k)*rga - wl_b(i) = wl_b(i) + state1%q(i,k,ixcldliq)*state1%pdeldry(i,k)*rga - end do - end do - - - do i=1, ncol - ! Based on these integrals, compute the total energy before and after CLUBB call - te_a(i) = se_a(i) + ke_a(i) + (latvap+latice) * wv_a(i) + latice * wl_a(i) - te_b(i) = se_b(i) + ke_b(i) + (latvap+latice) * wv_b(i) + latice * wl_b(i) - - ! Take into account the surface fluxes of heat and moisture - ! Use correct qflux from cam_in, not lhf/latvap as was done previously - te_b(i) = te_b(i) + (cam_in%shf(i)+cam_in%cflx(i,1)*(latvap+latice)) * hdtime - - ! subtract enthalpy of falling precip from tb - te_b(i) = te_b(i) - prec_sh(i)*1000._r8*latice*hdtime - - ! Compute the disbalance of total energy, over depth where CLUBB is active -<<<<<<< HEAD - se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop+1)) - - ! Fix the total energy coming out of CLUBB so it achieves enery conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do k=clubbtop+1,pver - clubb_s(k) = clubb_s(k) - se_dis(i)*gravit - enddo - endif - ! convert to units of +ve [K] - se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) -======= - se_dis(i) = (te_a(i) - te_b(i))/(state1%pint(i,pverp)-state1%pint(i,clubbtop(i))) - end do ->>>>>>> ESCOMP/cam_development - - ! Fix the total energy coming out of CLUBB so it achieves energy conservation. - ! Apply this fixer throughout the column evenly, but only at layers where - ! CLUBB is active. - ! - ! NOTE: The energy fixer seems to cause the climate to change significantly - ! when using specified dynamics, so allow this to be turned off via a namelist - ! variable. - if (clubb_do_energyfix) then - do i=1, ncol - do k=clubbtop(i),pver - clubb_s(i,k) = clubb_s(i,k) - se_dis(i)*gravit - end do - ! convert to units of +ve [K] - se_dis(i) = -1._r8*se_dis(i)*gravit/cpairv(i,pver,lchnk) - end do - endif - - - ! Now compute the tendencies of CLUBB to CAM, note that pverp is the ghost point - ! for all variables and therefore is never called in this loop - do k=1, pver - do i=1, ncol - - ptend_loc%u(i,k) = (um(i,k) - state1%u(i,k)) / hdtime ! east-west wind - ptend_loc%v(i,k) = (vm(i,k) - state1%v(i,k)) / hdtime ! north-south wind - ptend_loc%q(i,k,ixq) = (rtm(i,k) - rcm(i,k)-state1%q(i,k,ixq)) / hdtime ! water vapor - ptend_loc%q(i,k,ixcldliq) = (rcm(i,k) - state1%q(i,k,ixcldliq)) / hdtime ! Tendency of liquid water - ptend_loc%s(i,k) = (clubb_s(i,k) - state1%s(i,k)) / hdtime ! Tendency of static energy - -<<<<<<< HEAD - ! dte / hdtime = [kg/s2]/[s] = W/m2 - eleak(:ncol) = (te_a(:ncol) - te_b(:ncol))/hdtime - call outfld('ELEAK_CLUBB', eleak, pcols, lchnk) - - call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) -======= - end do - end do - - - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - - do k=1, pver - do i=1, ncol - - ! Here add a constant to moments which can be either positive or - ! negative. This is to prevent clipping when dynamics tries to - ! make all constituents positive - wp3(i,k) = wp3(i,k) + wp3_const - rtpthlp(i,k) = rtpthlp(i,k) + rtpthlp_const - wpthlp(i,k) = wpthlp(i,k) + wpthlp_const - wprtp(i,k) = wprtp(i,k) + wprtp_const - - ptend_loc%q(i,k,ixthlp2) = (thlp2(i,k) - state1%q(i,k,ixthlp2)) / hdtime ! THLP Variance - ptend_loc%q(i,k,ixrtp2) = (rtp2(i,k) - state1%q(i,k,ixrtp2)) / hdtime ! RTP Variance - ptend_loc%q(i,k,ixrtpthlp) = (rtpthlp(i,k) - state1%q(i,k,ixrtpthlp)) / hdtime ! RTP THLP covariance - ptend_loc%q(i,k,ixwpthlp) = (wpthlp(i,k) - state1%q(i,k,ixwpthlp)) / hdtime ! WPTHLP - ptend_loc%q(i,k,ixwprtp) = (wprtp(i,k) - state1%q(i,k,ixwprtp)) / hdtime ! WPRTP - ptend_loc%q(i,k,ixwp2) = (wp2(i,k) - state1%q(i,k,ixwp2)) / hdtime ! WP2 - ptend_loc%q(i,k,ixwp3) = (wp3(i,k) - state1%q(i,k,ixwp3)) / hdtime ! WP3 - ptend_loc%q(i,k,ixup2) = (up2(i,k) - state1%q(i,k,ixup2)) / hdtime ! UP2 - ptend_loc%q(i,k,ixvp2) = (vp2(i,k) - state1%q(i,k,ixvp2)) / hdtime ! VP2 - - end do - end do - - else - - do k=1, pver - do i=1, ncol - ptend_loc%q(i,k,ixthlp2) = 0._r8 - ptend_loc%q(i,k,ixrtp2) = 0._r8 - ptend_loc%q(i,k,ixrtpthlp) = 0._r8 - ptend_loc%q(i,k,ixwpthlp) = 0._r8 - ptend_loc%q(i,k,ixwprtp) = 0._r8 - ptend_loc%q(i,k,ixwp2) = 0._r8 - ptend_loc%q(i,k,ixwp3) = 0._r8 - ptend_loc%q(i,k,ixup2) = 0._r8 - ptend_loc%q(i,k,ixvp2) = 0._r8 - end do - end do - - end if - end if - ->>>>>>> ESCOMP/cam_development - - ! Apply tendencies to ice mixing ratio, liquid and ice number, and aerosol constituents. - ! Loading up this array doesn't mean the tendencies are applied. - ! edsclr_out is compressed with just the constituents being used, ptend and state are not compressed - icnt=0 - do ixind=1,pcnst - if (lq(ixind)) then - icnt=icnt+1 - if ((ixind /= ixq) .and. (ixind /= ixcldliq) .and.& - (ixind /= ixthlp2) .and. (ixind /= ixrtp2) .and.& - (ixind /= ixrtpthlp) .and. (ixind /= ixwpthlp) .and.& - (ixind /= ixwprtp) .and. (ixind /= ixwp2) .and.& - (ixind /= ixwp3) .and. (ixind /= ixup2) .and. (ixind /= ixvp2) ) then - - do k=1, pver - do i=1, ncol - ptend_loc%q(i,k,ixind) = (edsclr_out(i,k,icnt)-state1%q(i,k,ixind))/hdtime ! transported constituents - end do - end do - - end if - end if - end do - - call t_stopf("clubb_tend_cam_i_loop") - - call outfld('KVH_CLUBB', khzm, pcols, lchnk) - - eleak(:ncol) = (te_a(:ncol) - te_b(:ncol))/hdtime - call outfld('ELEAK_CLUBB', eleak, pcols, lchnk) - call outfld('TFIX_CLUBB', se_dis, pcols, lchnk) - - ! Add constant to ghost point so that output is not corrupted - if (clubb_do_adv) then - if (macmic_it == cld_macmic_num_steps) then - wp3(:,pverp) = wp3(:,pverp) + wp3_const - rtpthlp(:,pverp) = rtpthlp(:,pverp) + rtpthlp_const - wpthlp(:,pverp) = wpthlp(:,pverp) + wpthlp_const - wprtp(:,pverp) = wprtp(:,pverp) + wprtp_const - end if - end if - - ! ------------------------------------------------- ! - ! End column computation of CLUBB, begin to apply ! - ! and compute output, etc ! - ! ------------------------------------------------- ! - - ! Output CLUBB tendencies (convert dry basis to wet for consistency with history variable definition) - temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'RVMTEND_CLUBB', temp2d, pcols, lchnk) - -<<<<<<< HEAD - ! Output CLUBB tendencies - call outfld( 'RVMTEND_CLUBB', ptend_loc%q(:,:,ixq), pcols, lchnk) - call outfld( 'RCMTEND_CLUBB', ptend_loc%q(:,:,ixcldliq), pcols, lchnk) - call outfld( 'RIMTEND_CLUBB', ptend_loc%q(:,:,ixcldice), pcols, lchnk) - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) -======= - temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldliq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'RCMTEND_CLUBB', temp2d, pcols, lchnk) - - temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldice)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'RIMTEND_CLUBB', temp2d, pcols, lchnk) ->>>>>>> ESCOMP/cam_development - - call outfld( 'STEND_CLUBB', ptend_loc%s,pcols, lchnk) - call outfld( 'UTEND_CLUBB', ptend_loc%u,pcols, lchnk) - call outfld( 'VTEND_CLUBB', ptend_loc%v,pcols, lchnk) - - cmeliq(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldliq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'CMELIQ', cmeliq, pcols, lchnk) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! Due to the order of operation of CLUBB, which closes on liquid first, - ! then advances it's predictive equations second, this can lead to - ! RHliq > 1 directly before microphysics is called. Therefore, we use - ! ice_macro_tend to enforce RHliq <= 1 everywhere before microphysics is called. - - if (clubb_do_liqsupersat) then - - ! -------------------------------------- ! - ! Ice Saturation Adjustment Computation ! - ! -------------------------------------- ! - - latsub = latvap + latice - - lq2(:) = .FALSE. - lq2(ixq) = .TRUE. - lq2(ixcldliq) = .TRUE. - lq2(ixnumliq) = .TRUE. - - call physics_ptend_init(ptend_loc, state%psetcols, 'iceadj', ls=.true., lq=lq2 ) - - stend(:ncol,:)=0._r8 - qvtend(:ncol,:)=0._r8 - qctend(:ncol,:)=0._r8 - inctend(:ncol,:)=0._r8 - - call liquid_macro_tend(npccn(1:ncol,top_lev:pver), state1%t(1:ncol,top_lev:pver), & - state1%pmid(1:ncol,top_lev:pver), state1%q(1:ncol,top_lev:pver,ixq), & - state1%q(1:ncol,top_lev:pver,ixcldliq), state1%q(1:ncol,top_lev:pver,ixnumliq), & - latvap, hdtime, stend(1:ncol,top_lev:pver),qvtend(1:ncol,top_lev:pver), & - qctend(1:ncol,top_lev:pver), inctend(1:ncol,top_lev:pver), ncol*(pver-top_lev+1)) - - ! update local copy of state with the tendencies - ptend_loc%q(:ncol,top_lev:pver,ixq)=qvtend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixcldliq)=qctend(:ncol,top_lev:pver) - ptend_loc%q(:ncol,top_lev:pver,ixnumliq)=inctend(:ncol,top_lev:pver) - ptend_loc%s(:ncol,top_lev:pver)=stend(:ncol,top_lev:pver) - - ! Add the ice tendency to the output tendency - call physics_ptend_sum(ptend_loc, ptend_all, ncol) - - ! ptend_loc is reset to zero by this call - call physics_update(state1, ptend_loc, hdtime) - - ! Write output for tendencies: - ! oufld: QVTENDICE,QCTENDICE,NCTENDICE,FQTENDICE - temp2d(:ncol,:pver) = stend(:ncol,:pver)/cpairv(:ncol,:pver,lchnk) - call outfld( 'TTENDICE', temp2d, pcols, lchnk ) - call outfld( 'QVTENDICE', qvtend, pcols, lchnk ) - call outfld( 'QCTENDICE', qctend, pcols, lchnk ) - call outfld( 'NCTENDICE', inctend, pcols, lchnk ) - - where(qctend .ne. 0._r8) - fqtend = 1._r8 - elsewhere - fqtend = 0._r8 - end where - - call outfld( 'FQTENDICE', fqtend, pcols, lchnk ) - end if - - ! ------------------------------------------------------------ ! - ! The rest of the code deals with diagnosing variables ! - ! for microphysics/radiation computation and macrophysics ! - ! ------------------------------------------------------------ ! - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD DETRAINMENT ! - ! Detrainment of convective condensate into the environment or stratiform cloud ! - ! --------------------------------------------------------------------------------- ! - - ! Initialize the shallow convective detrainment rate, will always be zero - dlf2(:,:) = 0.0_r8 - dlf_liq_out(:,:) = 0.0_r8 - dlf_ice_out(:,:) = 0.0_r8 - - lqice(:) = .false. - lqice(ixcldliq) = .true. - lqice(ixcldice) = .true. - lqice(ixnumliq) = .true. - lqice(ixnumice) = .true. - - call physics_ptend_init(ptend_loc,state%psetcols, 'clubb', ls=.true., lq=lqice) - - if (zmconv_microp) then - call pbuf_get_field(pbuf, dlfzm_idx, dlfzm) - call pbuf_get_field(pbuf, difzm_idx, difzm) - call pbuf_get_field(pbuf, dnlfzm_idx, dnlfzm) - call pbuf_get_field(pbuf, dnifzm_idx, dnifzm) - end if - - do k=1,pver - do i=1,ncol - if( state1%t(i,k) > meltpt_temp ) then - dum1 = 0.0_r8 - elseif ( state1%t(i,k) < dt_low ) then - dum1 = 1.0_r8 - else - dum1 = ( meltpt_temp - state1%t(i,k) ) / ( meltpt_temp - dt_low ) - endif - - if (zmconv_microp) then - ptend_loc%q(i,k,ixcldliq) = dlfzm(i,k) + dlf2(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = difzm(i,k) + dlf2(i,k) * dum1 - - ptend_loc%q(i,k,ixnumliq) = dnlfzm(i,k) + 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*dl_rad**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = dnifzm(i,k) + 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*di_rad**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf2(i,k) * dum1 * latice - else - - ptend_loc%q(i,k,ixcldliq) = dlf(i,k) * ( 1._r8 - dum1 ) - ptend_loc%q(i,k,ixcldice) = dlf(i,k) * dum1 - ptend_loc%q(i,k,ixnumliq) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*dl_rad**3*997._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * ( 1._r8 - dum1 ) ) & - / (4._r8*3.14_r8*10.e-6_r8**3*997._r8) ! Shallow Convection - ptend_loc%q(i,k,ixnumice) = 3._r8 * ( max(0._r8, ( dlf(i,k) - dlf2(i,k) )) * dum1 ) & - / (4._r8*3.14_r8*di_rad**3*500._r8) + & ! Deep Convection - 3._r8 * ( dlf2(i,k) * dum1 ) & - / (4._r8*3.14_r8*50.e-6_r8**3*500._r8) ! Shallow Convection - ptend_loc%s(i,k) = dlf(i,k) * dum1 * latice - - dlf_liq_out(i,k) = dlf(i,k) * ( 1._r8 - dum1 ) - dlf_ice_out(i,k) = dlf(i,k) * dum1 - end if - ! convert moist dlf tendencies to dry - ptend_loc%q(i,k,ixcldliq) = ptend_loc%q(i,k,ixcldliq)*state1%pdel(i,k)/state1%pdeldry(i,k) - ptend_loc%q(i,k,ixcldice) = ptend_loc%q(i,k,ixcldice)*state1%pdel(i,k)/state1%pdeldry(i,k) - - ! Only rliq is saved from deep convection, which is the reserved liquid. We need to keep - ! track of the integrals of ice and static energy that is effected from conversion to ice - ! so that the energy checker doesn't complain. - det_s(i) = det_s(i) + ptend_loc%s(i,k)*state1%pdel(i,k)*rga - det_ice(i) = det_ice(i) - ptend_loc%q(i,k,ixcldice)*state1%pdeldry(i,k)*rga - enddo - enddo - - det_ice(:ncol) = det_ice(:ncol)/1000._r8 ! divide by density of water - - ! output moist basis to be consistent with history variable definition - temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldliq)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'DPDLFLIQ', temp2d, pcols, lchnk) - - ! output moist basis to be consistent with history variable definition - temp2d(:ncol,:pver) = ptend_loc%q(:ncol,:pver,ixcldice)*state1%pdeldry(:ncol,:pver)/state1%pdel(:ncol,:pver) - call outfld( 'DPDLFICE', temp2d, pcols, lchnk) - - temp2d(:ncol,:pver) = ptend_loc%s(:ncol,:pver)/cpairv(:ncol,:pver, lchnk) - call outfld( 'DPDLFT', temp2d, pcols, lchnk) - - call outfld( 'DETNLIQTND', ptend_loc%q(:,:,ixnumliq),pcols, lchnk ) - - call physics_ptend_sum(ptend_loc,ptend_all,ncol) - call physics_update(state1,ptend_loc,hdtime) - - ! ptend_all now has all accumulated tendencies. Convert the tendencies for the - ! wet constituents to wet air basis. - do ixind = 1, pcnst - if (lq(ixind) .and. cnst_type(ixind) == 'wet') then - do k = 1, pver - do i = 1, ncol - ptend_all%q(i,k,ixind) = ptend_all%q(i,k,ixind)*state1%pdeldry(i,k)/state1%pdel(i,k) - end do - end do - end if - end do - - ! ------------------------------------------------- ! - ! Diagnose relative cloud water variance ! - ! ------------------------------------------------- ! - - if (deep_scheme == 'CLUBB_SGS') then - relvarmax = 2.0_r8 - else - relvarmax = 10.0_r8 - endif - - relvar(:,:) = relvarmax ! default - - if (deep_scheme .ne. 'CLUBB_SGS') then - where (rcm(:ncol,:pver) /= 0 .and. qclvar(:ncol,:pver) /= 0) & - relvar(:ncol,:pver) = min(relvarmax,max(0.001_r8,rcm(:ncol,:pver)**2/qclvar(:ncol,:pver))) - endif - - ! ------------------------------------------------- ! - ! Optional Accretion enhancement factor ! - ! ------------------------------------------------- ! - accre_enhan(:ncol,:pver) = 1._r8 - - ! ------------------------------------------------- ! - ! Diagnose some output variables ! - ! ------------------------------------------------- ! - - ! density - rho(1:ncol,1:pver) = rga*state1%pdel(1:ncol,1:pver)/(state1%zi(1:ncol,1:pver)-state1%zi(1:ncol,2:pverp)) - rho(1:ncol,pverp) = rho(1:ncol,pver) - - wpthvp_diag(:,:) = 0.0_r8 - do k=1,pver - do i=1,ncol - eps = rairv(i,k,lchnk)*inv_rh2o - ! buoyancy flux - wpthvp_diag(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))+((1._r8-eps)/eps)*theta0* & - (wprtp(i,k)-(apply_const*wprtp_const))+((latvap/cpairv(i,k,lchnk))* & - state1%exner(i,k)-(1._r8/eps)*theta0)*wprcp(i,k) - - ! total water mixing ratio - qt_output(i,k) = state1%q(i,k,ixq)+state1%q(i,k,ixcldliq)+state1%q(i,k,ixcldice) - ! liquid water potential temperature - thetal_output(i,k) = (state1%t(i,k)*state1%exner(i,k))-(latvap/cpairv(i,k,lchnk))*state1%q(i,k,ixcldliq) - ! liquid water static energy - sl_output(i,k) = cpairv(i,k,lchnk)*state1%t(i,k)+gravit*state1%zm(i,k)-latvap*state1%q(i,k,ixcldliq) - enddo - enddo - - do k=1,pverp - do i=1,ncol -<<<<<<< HEAD -!+++ARH - !wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - !wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - wpthlp_output(i,k) = wpthlp(i,k) - wprtp_output(i,k) = wprtp(i,k) -!+++ARH - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - if (do_clubb_mf) then - ! comment out for kinemtatic fluxes -!+++ARH - !mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - !mf_thvflx_output(i,k) = mf_thvflx_output(i,k)*rho(i,k)*cpair - !mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap -!---ARH - mf_precc_output(i,k) = mf_precc_output(i,k)/rhoh2o - end if -======= - wpthlp_output(i,k) = (wpthlp(i,k)-(apply_const*wpthlp_const))*rho(i,k)*cpair ! liquid water potential temperature flux - wprtp_output(i,k) = (wprtp(i,k)-(apply_const*wprtp_const))*rho(i,k)*latvap ! total water mixig ratio flux - rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output - wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - if (do_clubb_mf) then - mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair - mf_qtflx_output(i,k) = mf_qtflx_output(i,k)*rho(i,k)*latvap - end if ->>>>>>> ESCOMP/cam_development - enddo - enddo - -<<<<<<< HEAD - rcm_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = rcm(:ncol,:pverp) - cldfrac_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = cloud_frac(:ncol,:pverp) - wpthlp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthlp_output(:ncol,:pverp) - wprtp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wprtp_output(:ncol,:pverp) - wpthvp_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = wpthvp(:ncol,:pverp) - if (do_clubb_mf) then - mf_thlflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thlflx_output(:ncol,:pverp) - mf_qtflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_qtflx_output(:ncol,:pverp) - mf_thvflx_macmic(:ncol,pverp*(macmic_it-1)+1:pverp*macmic_it) = mf_thvflx_output(:ncol,:pverp) - end if - - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! -======= - ! --------------------------------------------------------------------------------- ! - ! Diagnose some quantities that are computed in macrop_tend here. ! - ! These are inputs required for the microphysics calculation. ! - ! ! - ! FIRST PART COMPUTES THE STRATIFORM CLOUD FRACTION FROM CLUBB CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! ->>>>>>> ESCOMP/cam_development - - ! initialize variables - alst(:,:) = 0.0_r8 - qlst(:,:) = 0.0_r8 - - do k=1,pver - do i=1,ncol - alst(i,k) = cloud_frac(i,k) - qlst(i,k) = rcm(i,k)/max(0.01_r8,alst(i,k)) ! Incloud stratus condensate mixing ratio - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES CONVECTIVE AND DEEP CONVECTIVE CLOUD FRACTION ! - ! --------------------------------------------------------------------------------- ! - -<<<<<<< HEAD - deepcu = 0.0_r8 - shalcu = 0.0_r8 -======= - deepcu(:,:) = 0.0_r8 - shalcu(:,:) = 0.0_r8 ->>>>>>> ESCOMP/cam_development - - do k=1,pver-1 - do i=1,ncol -<<<<<<< HEAD - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(dp1*log(1.0_r8+dp2*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - - if (do_clubb_mf_rad) then - shalcu(i,k) = mf_cloudfrac_output(i,k) - sh_icwmr(i,k) = mf_qc_output(i,k) - end if - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - if (shalcu(i,k) <= frac_limit .or. sh_icwmr(i,k) < ic_limit) then - shalcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k)+shalcu(i,k),0.80_r8) -======= - ! diagnose the deep convective cloud fraction, as done in macrophysics based on the - ! deep convective mass flux, read in from pbuf. Since shallow convection is never - ! called, the shallow convective mass flux will ALWAYS be zero, ensuring that this cloud - ! fraction is purely from deep convection scheme. - deepcu(i,k) = max(0.0_r8,min(dp1*log(1.0_r8+dp2*(cmfmc(i,k+1)-cmfmc_sh(i,k+1))),0.6_r8)) - shalcu(i,k) = 0._r8 - - if (deepcu(i,k) <= frac_limit .or. dp_icwmr(i,k) < ic_limit) then - deepcu(i,k) = 0._r8 - endif - - ! using the deep convective cloud fraction, and CLUBB cloud fraction (variable - ! "cloud_frac"), compute the convective cloud fraction. This follows the formulation - ! found in macrophysics code. Assumes that convective cloud is all nonstratiform cloud - ! from CLUBB plus the deep convective cloud fraction - concld(i,k) = min(cloud_frac(i,k)-alst(i,k)+deepcu(i,k),0.80_r8) ->>>>>>> ESCOMP/cam_development - enddo - enddo - - if (single_column) then - if (trim(scm_clubb_iop_name) == 'ATEX_48hr' .or. & - trim(scm_clubb_iop_name) == 'BOMEX_5day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf01_4day' .or. & - trim(scm_clubb_iop_name) == 'DYCOMSrf02_06hr' .or. & - trim(scm_clubb_iop_name) == 'RICO_3day' .or. & - trim(scm_clubb_iop_name) == 'ARM_CC') then - - deepcu(:,:) = 0.0_r8 - concld(:,:) = 0.0_r8 - - endif - endif - - ! --------------------------------------------------------------------------------- ! - ! COMPUTE THE ICE CLOUD FRACTION PORTION ! - ! use the aist_vector function to compute the ice cloud fraction ! - ! --------------------------------------------------------------------------------- ! - - aist(:,:top_lev-1) = 0._r8 - qsatfac(:, :) = 0._r8 ! Zero out entire profile in case qsatfac is left undefined in aist_vector below - - do k = top_lev, pver - - ! For Type II PSC and for thin cirrus, the clouds can be thin, but - ! extensive and they should start forming when the gridbox mean saturation - ! reaches 1.0. - ! - ! For now, use the tropopause diagnostic to determine where the Type II - ! PSC should be, but in the future wold like a better metric that can also - ! identify the level for thin cirrus. Include the tropopause level so that - ! the cold point tropopause will use the stratospheric values. - where (k <= troplev) - rhmini = rhminis_const - rhmaxi = rhmaxis_const - elsewhere - rhmini = rhmini_const - rhmaxi = rhmaxi_const - end where - - if ( trim(subcol_scheme) == 'SILHS' ) then - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol ) - else - call aist_vector(state1%q(:,k,ixq),state1%t(:,k),state1%pmid(:,k),state1%q(:,k,ixcldice), & - state1%q(:,k,ixnumice), cam_in%landfrac(:),cam_in%snowhland(:),aist(:,k),ncol,& - qsatfac_out=qsatfac(:,k), rhmini_in=rhmini, rhmaxi_in=rhmaxi) - endif - enddo - - ! --------------------------------------------------------------------------------- ! - ! THIS PART COMPUTES THE LIQUID STRATUS FRACTION ! - ! ! - ! For now leave the computation of ice stratus fraction from macrop_driver intact ! - ! because CLUBB does nothing with ice. Here I simply overwrite the liquid stratus ! - ! fraction that was coded in macrop_driver ! - ! --------------------------------------------------------------------------------- ! - - ! Recompute net stratus fraction using maximum over-lapping assumption, as done - ! in macrophysics code, using alst computed above and aist read in from physics buffer - - do k=1,pver - do i=1,ncol - ast(i,k) = max(alst(i,k),aist(i,k)) - qist(i,k) = state1%q(i,k,ixcldice)/max(0.01_r8,aist(i,k)) - enddo - enddo - - ! Probably need to add deepcu cloud fraction to the cloud fraction array, else would just - ! be outputting the shallow convective cloud fraction - do k=1,pver - do i=1,ncol -<<<<<<< HEAD - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k)+shalcu(i,k),1.0_r8) -======= - cloud_frac(i,k) = min(ast(i,k)+deepcu(i,k),1.0_r8) ->>>>>>> ESCOMP/cam_development - enddo - enddo - - ! --------------------------------------------------------------------------------- ! - ! DIAGNOSE THE PBL DEPTH ! - ! this is needed for aerosol code ! - ! --------------------------------------------------------------------------------- ! - do i=1,ncol - do k=1,pver - !use local exner since state%exner is not a proper exner - th(i,k) = state1%t(i,k)*inv_exner_clubb(i,k) - !thv should have condensate loading to be consistent with earlier def's in this module - thv(i,k) = th(i,k)*(1.0_r8+zvir*state1%q(i,k,ixq) - state1%q(i,k,ixcldliq)) - enddo - enddo - - ! diagnose surface friction and obukhov length (inputs to diagnose PBL depth) - rrho(1:ncol) = (rga)*(state1%pdel(1:ncol,pver)/dz_g(1:ncol,pver)) - call calc_ustar( ncol, state1%t(1:ncol,pver), state1%pmid(1:ncol,pver), cam_in%wsx(1:ncol), cam_in%wsy(1:ncol), & - rrho(1:ncol), ustar2(1:ncol)) - ! use correct qflux from coupler - call calc_obklen( ncol, th(1:ncol,pver), thv(1:ncol,pver), cam_in%cflx(1:ncol,1), cam_in%shf(1:ncol), & - rrho(1:ncol), ustar2(1:ncol), kinheat(1:ncol), kinwat(1:ncol), kbfs(1:ncol), & - obklen(1:ncol)) - - dummy2(:) = 0._r8 - dummy3(:) = 0._r8 - - where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 - - ! Compute PBL depth according to Holtslag-Boville Scheme - call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & - ustar2, obklen, kbfs, pblh, dummy2, & - state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) - - ! Output the PBL depth - call outfld('PBLH', pblh, pcols, lchnk) - - ! Assign the first pver levels of cloud_frac back to cld - cld(:,1:pver) = cloud_frac(:,1:pver) - - ! --------------------------------------------------------------------------------- ! - ! END CLOUD FRACTION DIAGNOSIS, begin to store variables back into buffer ! - ! --------------------------------------------------------------------------------- ! - -<<<<<<< HEAD - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho, pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output, pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rtp2(:ncol,:)*1.0e6_r8 - call outfld( 'RTP2_CLUBB', temp2dp, pcols, lchnk ) - - rtpthlp_output(:ncol,:) = rtpthlp_output(:ncol,:) * 1000._r8 - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm(:ncol,:) * 1000._r8 - call outfld( 'RCM_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) - call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = rcm_in_layer(:ncol,:) * 1000._r8 - call outfld( 'RCMINLAYER_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:)*rho(:ncol,:)*cpair - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'PRECSH' , prec_sh(:ncol) , pcols, lchnk ) - - call outfld( 'TKE_CLUBB', tke, pcols, lchnk ) - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out, pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out, pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out, pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac, pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out, pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um, pcols, lchnk ) - call outfld( 'VM_CLUBB', vm, pcols, lchnk ) - call outfld( 'THETAL', thetal_output, pcols, lchnk ) - call outfld( 'QT', qt_output, pcols, lchnk ) - call outfld( 'SL', sl_output, pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_precc' , mf_precc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWW' , s_aww_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlforcup', mf_thlforcup_output, pcols, lchnk ) - call outfld( 'edmf_qtforcup' , mf_qtforcup_output, pcols, lchnk ) - call outfld( 'edmf_thlforcdn', mf_thlforcdn_output, pcols, lchnk ) - call outfld( 'edmf_qtforcdn' , mf_qtforcdn_output, pcols, lchnk ) - call outfld( 'edmf_thlforc' , mf_thlforc_output, pcols, lchnk ) - call outfld( 'edmf_qtforc' , mf_qtforc_output, pcols, lchnk ) - call outfld( 'edmf_thlflxup' , mf_thlflxup_output, pcols, lchnk ) - call outfld( 'edmf_qtflxup' , mf_qtflxup_output, pcols, lchnk ) - call outfld( 'edmf_thlflxdn' , mf_thlflxdn_output, pcols, lchnk ) - call outfld( 'edmf_qtflxdn' , mf_qtflxdn_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - call outfld( 'edmf_thvflx' , mf_thvflx_output, pcols, lchnk ) - call outfld( 'edmf_rcm' , mf_rcm_output, pcols, lchnk ) - call outfld( 'edmf_uflxup' , mf_uflxup_output, pcols, lchnk ) - call outfld( 'edmf_vflxup' , mf_vflxup_output, pcols, lchnk ) - call outfld( 'edmf_uflxdn' , mf_uflxdn_output, pcols, lchnk ) - call outfld( 'edmf_vflxdn' , mf_vflxdn_output, pcols, lchnk ) - call outfld( 'edmf_uflx' , mf_uflx_output, pcols, lchnk ) - call outfld( 'edmf_vflx' , mf_vflx_output, pcols, lchnk ) - call outfld( 'edmf_cloudfrac', mf_cloudfrac_output, pcols, lchnk ) - call outfld( 'edmf_ent' , mf_ent_output, pcols, lchnk ) - call outfld( 'edmf_upa' , mf_upa_output, pcols, lchnk ) - call outfld( 'edmf_upw' , mf_upw_output, pcols, lchnk ) - call outfld( 'edmf_upmf' , mf_upmf_output, pcols, lchnk ) - call outfld( 'edmf_upqt' , mf_upqt_output, pcols, lchnk ) - call outfld( 'edmf_upthl' , mf_upthl_output, pcols, lchnk ) - call outfld( 'edmf_upthv' , mf_upthv_output, pcols, lchnk ) - call outfld( 'edmf_upth' , mf_upth_output, pcols, lchnk ) - call outfld( 'edmf_upqc' , mf_upqc_output, pcols, lchnk ) - call outfld( 'edmf_upbuoy' , mf_upbuoy_output, pcols, lchnk ) - call outfld( 'edmf_upent' , mf_upent_output, pcols, lchnk ) - call outfld( 'edmf_updet' , mf_updet_output, pcols, lchnk ) - call outfld( 'edmf_dnw' , mf_dnw_output, pcols, lchnk ) - call outfld( 'edmf_dnthl' , mf_dnthl_output, pcols, lchnk ) - call outfld( 'edmf_dnqt' , mf_dnqt_output, pcols, lchnk ) - call outfld( 'edmf_sqtup' , mf_sqtup_output, pcols, lchnk ) - call outfld( 'edmf_sqtdn' , mf_sqtdn_output, pcols, lchnk ) -!+++ARH - ! macmic_it==1 ensures that this is ddcp aeraged over the prior time-steps - if (macmic_it==1) call outfld( 'edmf_ztop' , mf_ztop_output, pcols, lchnk ) - if (macmic_it==1) call outfld( 'edmf_ddcp' , mf_ddcp_output, pcols, lchnk ) -!---ARH - call outfld( 'edmf_L0' , mf_L0_output, pcols, lchnk ) - call outfld( 'edmf_freq' , mf_freq_output, pcols, lchnk ) - call outfld( 'edmf_cape' , mf_cape_output, pcols, lchnk ) - call outfld( 'edmf_cfl' , mf_cfl_output, pcols, lchnk ) - call outfld( 'ICWMRSH' , sh_icwmr, pcols, lchnk ) - end if - - if (macmic_it==cld_macmic_num_steps) then -!+++ARH - call outfld( 'qtm_macmic1' , qtm_macmic1, pcols, lchnk ) - call outfld( 'qtm_macmic2' , qtm_macmic2, pcols, lchnk ) - call outfld( 'thlm_macmic1' , thlm_macmic1, pcols, lchnk ) - call outfld( 'thlm_macmic2' , thlm_macmic2, pcols, lchnk ) -!---ARH - call outfld( 'RCM_CLUBB_macmic' , rcm_macmic, pcols, lchnk ) - call outfld( 'CLDFRAC_CLUBB_macmic' , cldfrac_macmic, pcols, lchnk ) - - call outfld( 'WPTHLP_CLUBB_macmic' , wpthlp_macmic, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB_macmic' , wprtp_macmic, pcols, lchnk ) - call outfld( 'WPTHVP_CLUBB_macmic' , wpthvp_macmic, pcols, lchnk ) - if (do_clubb_mf) then - call outfld( 'edmf_thlflx_macmic' , mf_thlflx_macmic, pcols, lchnk ) - call outfld( 'edmf_qtflx_macmic' , mf_qtflx_macmic, pcols, lchnk ) - call outfld( 'edmf_thvflx_macmic' , mf_thvflx_macmic, pcols, lchnk ) -!+++ARH - call outfld( 'up_macmic1' , up_macmic1, pcols, lchnk ) - call outfld( 'up_macmic2' , up_macmic2, pcols, lchnk ) - call outfld( 'dn_macmic1' , dn_macmic1, pcols, lchnk ) - call outfld( 'dn_macmic2' , dn_macmic2, pcols, lchnk ) - call outfld( 'upa_macmic1' , upa_macmic1, pcols, lchnk ) - call outfld( 'upa_macmic2' , upa_macmic2, pcols, lchnk ) - call outfld( 'dna_macmic1' , dna_macmic1, pcols, lchnk ) - call outfld( 'dna_macmic2' , dna_macmic2, pcols, lchnk ) - call outfld( 'thlu_macmic1' , thlu_macmic1, pcols, lchnk ) - call outfld( 'thlu_macmic2' , thlu_macmic2, pcols, lchnk ) - call outfld( 'qtu_macmic1' , qtu_macmic1, pcols, lchnk ) - call outfld( 'qtu_macmic2' , qtu_macmic2, pcols, lchnk ) - call outfld( 'thld_macmic1' , thld_macmic1, pcols, lchnk ) - call outfld( 'thld_macmic2' , thld_macmic2, pcols, lchnk ) - call outfld( 'qtd_macmic1' , qtd_macmic1, pcols, lchnk ) - call outfld( 'qtd_macmic2' , qtd_macmic2, pcols, lchnk ) - call outfld( 'dthl_macmic1' , dthl_macmic1, pcols, lchnk ) - call outfld( 'dthl_macmic2' , dthl_macmic2, pcols, lchnk ) - call outfld( 'dqt_macmic1' , dqt_macmic1, pcols, lchnk ) - call outfld( 'dqt_macmic2' , dqt_macmic2, pcols, lchnk ) - call outfld( 'dthlu_macmic1' , dthlu_macmic1, pcols, lchnk ) - call outfld( 'dthlu_macmic2' , dthlu_macmic2, pcols, lchnk ) - call outfld( 'dqtu_macmic1' , dqtu_macmic1, pcols, lchnk ) - call outfld( 'dqtu_macmic2' , dqtu_macmic2, pcols, lchnk ) - call outfld( 'dthld_macmic1' , dthld_macmic1, pcols, lchnk ) - call outfld( 'dthld_macmic2' , dthld_macmic2, pcols, lchnk ) - call outfld( 'dqtd_macmic1' , dqtd_macmic1, pcols, lchnk ) - call outfld( 'dqtd_macmic2' , dqtd_macmic2, pcols, lchnk ) - call outfld( 'ztop_macmic1' , ztop_macmic1, pcols, lchnk ) - call outfld( 'ztop_macmic2' , ztop_macmic2, pcols, lchnk ) - call outfld( 'ddcp_macmic1' , ddcp_macmic1, pcols, lchnk ) - call outfld( 'ddcp_macmic2' , ddcp_macmic2, pcols, lchnk ) -!---ARH - end if - end if -======= - ! Output calls of variables goes here - call outfld( 'RELVAR', relvar, pcols, lchnk ) - call outfld( 'RHO_CLUBB', rho(:,1:pver), pcols, lchnk ) - call outfld( 'WP2_CLUBB', wp2, pcols, lchnk ) - call outfld( 'UP2_CLUBB', up2, pcols, lchnk ) - call outfld( 'VP2_CLUBB', vp2, pcols, lchnk ) - call outfld( 'WP3_CLUBB', wp3_output(:,1:pver), pcols, lchnk ) - call outfld( 'UPWP_CLUBB', upwp, pcols, lchnk ) - call outfld( 'VPWP_CLUBB', vpwp, pcols, lchnk ) - call outfld( 'WPTHLP_CLUBB', wpthlp_output, pcols, lchnk ) - call outfld( 'WPRTP_CLUBB', wprtp_output, pcols, lchnk ) - call outfld( 'RTP2_CLUBB', rtp2, pcols, lchnk ) - call outfld( 'RTPTHLP_CLUBB', rtpthlp_output, pcols, lchnk ) - call outfld( 'RCM_CLUBB', rcm(:,1:pver), pcols, lchnk ) - call outfld( 'RTM_CLUBB', rtm(:,1:pver), pcols, lchnk ) - call outfld( 'THLM_CLUBB', thlm(:,1:pver), pcols, lchnk ) - - temp2dp(:ncol,:) = wprcp(:ncol,:) * latvap - call outfld( 'WPRCP_CLUBB', temp2dp, pcols, lchnk ) - - temp2dp(:ncol,:) = wpthvp(:ncol,:) * cpair - call outfld( 'WPTHVP_CLUBB', temp2dp, pcols, lchnk ) - - call outfld( 'RTP2_ZT_CLUBB', rtp2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'THLP2_ZT_CLUBB', thl2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'WP2_ZT_CLUBB', wp2_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'PDFP_RTP2_CLUBB', pdfp_rtp2, pcols, lchnk ) - call outfld( 'THLP2_CLUBB', thlp2, pcols, lchnk ) - call outfld( 'RCMINLAYER_CLUBB', rcm_in_layer(:,1:pver), pcols, lchnk ) - call outfld( 'CLOUDFRAC_CLUBB', alst, pcols, lchnk ) - call outfld( 'CLOUDCOVER_CLUBB', cloud_frac(:,1:pver), pcols, lchnk ) - call outfld( 'ZT_CLUBB', zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'ZM_CLUBB', zi_out, pcols, lchnk ) - call outfld( 'UM_CLUBB', um(:,1:pver), pcols, lchnk ) - call outfld( 'VM_CLUBB', vm(:,1:pver), pcols, lchnk ) - call outfld( 'WM_ZT_CLUBB', wm_zt_out(:,1:pver), pcols, lchnk ) - call outfld( 'CONCLD', concld, pcols, lchnk ) - call outfld( 'DP_CLD', deepcu, pcols, lchnk ) - call outfld( 'ZMDLF', dlf_liq_out, pcols, lchnk ) - call outfld( 'ZMDLFI', dlf_ice_out, pcols, lchnk ) - call outfld( 'CLUBB_GRID_SIZE', grid_dx, pcols, lchnk ) - call outfld( 'QSATFAC', qsatfac, pcols, lchnk) - - - ! --------------------------------------------------------------- ! - ! Writing state variables after EDMF scheme for detailed analysis ! - ! --------------------------------------------------------------- ! - if (do_clubb_mf) then - call outfld( 'edmf_DRY_A' , mf_dry_a_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_A' , mf_moist_a_output, pcols, lchnk ) - call outfld( 'edmf_DRY_W' , mf_dry_w_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_W' , mf_moist_w_output, pcols, lchnk ) - call outfld( 'edmf_DRY_QT' , mf_dry_qt_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QT' , mf_moist_qt_output, pcols, lchnk ) - call outfld( 'edmf_DRY_THL' , mf_dry_thl_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_THL', mf_moist_thl_output, pcols, lchnk ) - call outfld( 'edmf_DRY_U' , mf_dry_u_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_U' , mf_moist_u_output, pcols, lchnk ) - call outfld( 'edmf_DRY_V' , mf_dry_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_V' , mf_moist_v_output, pcols, lchnk ) - call outfld( 'edmf_MOIST_QC' , mf_moist_qc_output, pcols, lchnk ) - call outfld( 'edmf_S_AE' , s_ae_output, pcols, lchnk ) - call outfld( 'edmf_S_AW' , s_aw_output, pcols, lchnk ) - call outfld( 'edmf_S_AWTHL' , s_awthl_output, pcols, lchnk ) - call outfld( 'edmf_S_AWQT' , s_awqt_output, pcols, lchnk ) - call outfld( 'edmf_S_AWU' , s_awu_output, pcols, lchnk ) - call outfld( 'edmf_S_AWV' , s_awv_output, pcols, lchnk ) - call outfld( 'edmf_thlflx' , mf_thlflx_output, pcols, lchnk ) - call outfld( 'edmf_qtflx' , mf_qtflx_output, pcols, lchnk ) - end if ->>>>>>> ESCOMP/cam_development - - ! Output CLUBB history here - if (l_stats) then - - do j=1,stats_zt(1)%num_output_fields - - temp1 = trim(stats_zt(1)%file%grid_avg_var(j)%name) - sub = temp1 - if (len(temp1) > max_fieldname_len) sub = temp1(1:max_fieldname_len) - - call outfld(trim(sub), out_zt(:,:,j), pcols, lchnk ) - enddo - - do j=1,stats_zm(1)%num_output_fields - - temp1 = trim(stats_zm(1)%file%grid_avg_var(j)%name) - sub = temp1 - if (len(temp1) > max_fieldname_len) sub = temp1(1:max_fieldname_len) - - call outfld(trim(sub),out_zm(:,:,j), pcols, lchnk) - enddo - - if (l_output_rad_files) then - do j=1,stats_rad_zt(1)%num_output_fields - call outfld(trim(stats_rad_zt(1)%file%grid_avg_var(j)%name), out_radzt(:,:,j), pcols, lchnk) - enddo - - do j=1,stats_rad_zm(1)%num_output_fields - call outfld(trim(stats_rad_zm(1)%file%grid_avg_var(j)%name), out_radzm(:,:,j), pcols, lchnk) - enddo - endif - - do j=1,stats_sfc(1)%num_output_fields - call outfld(trim(stats_sfc(1)%file%grid_avg_var(j)%name), out_sfc(:,:,j), pcols, lchnk) - enddo - - endif - - call t_stopf("clubb_tend_cam") - - return -#endif - end subroutine clubb_tend_cam - - subroutine clubb_emissions_cam (state, cam_in, ptend) - - !------------------------------------------------------------------------------- - ! Description: Apply surface fluxes of constituents to lowest model level - ! except water vapor (applied in clubb_tend_cam) - ! - ! Author: Adam Herrington, November 2022 - ! Origin: Based on E3SM's clubb_surface subroutine - ! References: - ! None - !------------------------------------------------------------------------------- - use physics_types, only: physics_ptend, physics_ptend_init, physics_state - use constituents, only: cnst_type - use camsrfexch, only: cam_in_t - - ! --------------- ! - ! Input Arguments ! - ! --------------- ! - type(physics_state), intent(in) :: state ! Physics state variables - type(cam_in_t), intent(in) :: cam_in ! Surface inputs - - ! ---------------------- ! - ! Output Arguments ! - ! ---------------------- ! - type(physics_ptend), intent(out) :: ptend ! Individual parameterization tendencies - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - integer :: m, ncol - logical :: lq(pcnst) - - ! ----------------------- ! - ! Main Computation Begins ! - ! ----------------------- ! - ncol = state%ncol - - lq(1) = .false. - lq(2:) = .true. - call physics_ptend_init(ptend,state%psetcols, "clubb emissions", lq=lq) - - ! Apply tracer fluxes to lowest model level (except water vapor) - do m = 2,pcnst - ptend%q(:ncol,pver,m) = cam_in%cflx(:ncol,m)*state%rpdel(:ncol,pver)*gravit - end do - - ! Convert tendencies of dry constituents to dry basis. - do m = 2,pcnst - if (cnst_type(m).eq.'dry') then - ptend%q(:ncol,pver,m) = ptend%q(:ncol,pver,m)*state%pdel(:ncol,pver)*state%rpdeldry(:ncol,pver) - endif - end do - - end subroutine clubb_emissions_cam - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -! Saturation adjustment for ice -! Add ice mass if supersaturated -subroutine ice_macro_tend(naai,t,p,qv,qi,ni,xxls,deltat,stend,qvtend,qitend,nitend,vlen) - - use wv_sat_methods, only: wv_sat_qsat_ice - - integer, intent(in) :: vlen - real(r8), dimension(vlen), intent(in) :: naai !Activated number of ice nuclei - real(r8), dimension(vlen), intent(in) :: t !temperature (k) - real(r8), dimension(vlen), intent(in) :: p !pressure (pa) - real(r8), dimension(vlen), intent(in) :: qv !water vapor mixing ratio - real(r8), dimension(vlen), intent(in) :: qi !ice mixing ratio - real(r8), dimension(vlen), intent(in) :: ni !ice number concentration - real(r8), intent(in) :: xxls !latent heat of freezing - real(r8), intent(in) :: deltat !timestep - real(r8), dimension(vlen), intent(out) :: stend ! 'temperature' tendency - real(r8), dimension(vlen), intent(out) :: qvtend !vapor tendency - real(r8), dimension(vlen), intent(out) :: qitend !ice mass tendency - real(r8), dimension(vlen), intent(out) :: nitend !ice number tendency - - real(r8) :: ESI(vlen) - real(r8) :: QSI(vlen) - integer :: i - - do i = 1, vlen - stend(i) = 0._r8 - qvtend(i) = 0._r8 - qitend(i) = 0._r8 - nitend(i) = 0._r8 - end do - -! calculate qsati from t,p,q - do i = 1, vlen - call wv_sat_qsat_ice(t(i), p(i), ESI(i), QSI(i)) - end do - - do i = 1, vlen - if (naai(i) > 1.e-18_r8 .and. qv(i) > QSI(i)) then - - qitend(i) = (qv(i)-QSI(i))/deltat - qvtend(i) = 0._r8 - qitend(i) - stend(i) = qitend(i) * xxls ! moist static energy tend...[J/kg/s] ! - - ! if ice exists (more than 1 L-1) and there is condensation, do not add to number (= growth), else, add 10um ice - if (ni(i) < 1.e3_r8 .and. (qi(i)+qitend(i)*deltat) > 1.e-18_r8) then - nitend(i) = nitend(i) + 3._r8 * qitend(i)/(4._r8*3.14_r8* 10.e-6_r8**3*997._r8) - end if - - end if - end do - -end subroutine ice_macro_tend - -#ifdef CLUBB_SGS -! ---------------------------------------------------------------------- -! -! DISCLAIMER : this code appears to be correct but has not been -! very thouroughly tested. If you do notice any -! anomalous behaviour then please contact Andy and/or -! Bjorn -! -! Function diag_ustar: returns value of ustar using the below -! similarity functions and a specified buoyancy flux (bflx) given in -! kinematic units -! -! phi_m (zeta > 0) = (1 + am * zeta) -! phi_m (zeta < 0) = (1 - bm * zeta)^(-1/4) -! -! where zeta = z/lmo and lmo = (theta_rev/g*vonk) * (ustar^2/tstar) -! -! Ref: Businger, 1973, Turbulent Transfer in the Atmospheric Surface -! Layer, in Workshop on Micormeteorology, pages 67-100. -! -! Code writen March, 1999 by Bjorn Stevens -! - -real(r8) function diag_ustar( z, bflx, wnd, z0 ) - -use shr_const_mod, only : shr_const_karman, shr_const_pi, shr_const_g - -implicit none - -real(r8), parameter :: am = 4.8_r8 ! " " " -real(r8), parameter :: bm = 19.3_r8 ! " " " - -real(r8), parameter :: grav = shr_const_g -real(r8), parameter :: vonk = shr_const_karman -real(r8), parameter :: pi = shr_const_pi - -real(r8), intent (in) :: z ! height where u locates -real(r8), intent (in) :: bflx ! surface buoyancy flux (m^2/s^3) -real(r8), intent (in) :: wnd ! wind speed at z -real(r8), intent (in) :: z0 ! momentum roughness height - - -integer :: iterate -real(r8) :: lnz, klnz, c1, x, psi1, zeta, lmo, ustar - -lnz = log( z / z0 ) -klnz = vonk/lnz -c1 = pi / 2.0_r8 - 3.0_r8*log( 2.0_r8 ) - -ustar = wnd*klnz -if (abs(bflx) > 1.e-6_r8) then - do iterate=1,4 - - if (ustar > 1.e-6_r8) then - lmo = -ustar**3 / ( vonk * bflx ) - zeta = z/lmo - if (zeta > 0._r8) then - ustar = vonk*wnd /(lnz + am*zeta) - else - x = sqrt( sqrt( 1.0_r8 - bm*zeta ) ) - psi1 = 2._r8*log( 1.0_r8+x ) + log( 1.0_r8+x*x ) - 2._r8*atan( x ) + c1 - ustar = wnd*vonk/(lnz - psi1) - end if - - endif - - end do -end if - - -diag_ustar = ustar - -return - - -end function diag_ustar -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - subroutine stats_init_clubb( l_stats_in, stats_tsamp_in, stats_tout_in, & - nnzp, nnrad_zt,nnrad_zm, delt, & - stats_zt, stats_zm, stats_sfc, & - stats_rad_zt, stats_rad_zm) - ! - ! Description: Initializes the statistics saving functionality of - ! the CLUBB model. This is for purpose of CAM-CLUBB interface. Here - ! the traditional stats_init of CLUBB is not called, as it is not compatible - ! with CAM output. - - !----------------------------------------------------------------------- - - - use clubb_api_module, only: & - ztscr01, & - ztscr02, & - ztscr03, & - ztscr04, & - ztscr05, & - ztscr06, & - ztscr07, & - ztscr08, & - ztscr09, & - ztscr10, & - ztscr11, & - ztscr12, & - ztscr13, & - ztscr14, & - ztscr15, & - ztscr16, & - ztscr17, & - ztscr18, & - ztscr19, & - ztscr20, & - ztscr21 - - use clubb_api_module, only: & - zmscr01, & - zmscr02, & - zmscr03, & - zmscr04, & - zmscr05, & - zmscr06, & - zmscr07, & - zmscr08, & - zmscr09, & - zmscr10, & - zmscr11, & - zmscr12, & - zmscr13, & - zmscr14, & - zmscr15, & - zmscr16, & - zmscr17, & - l_stats, & - l_output_rad_files, & - stats_tsamp, & - stats_tout, & - l_stats_samp, & - l_stats_last, & - l_netcdf, & - l_grads - - use clubb_api_module, only: time_precision, & ! - nvarmax_zm, stats_init_zm_api, & ! - nvarmax_zt, stats_init_zt_api, & ! - nvarmax_rad_zt, stats_init_rad_zt_api, & ! - nvarmax_rad_zm, stats_init_rad_zm_api, & ! - nvarmax_sfc, stats_init_sfc_api, & ! - fstderr, var_length ! - use cam_abortutils, only: endrun - use cam_history, only: addfld, horiz_only - use namelist_utils, only: find_group_name - use units, only: getunit, freeunit - use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_character - - implicit none - - ! Input Variables - - logical, intent(in) :: l_stats_in ! Stats on? T/F - - real(kind=time_precision), intent(in) :: & - stats_tsamp_in, & ! Sampling interval [s] - stats_tout_in ! Output interval [s] - - integer, intent(in) :: nnzp ! Grid points in the vertical [count] - integer, intent(in) :: nnrad_zt ! Grid points in the radiation grid [count] - integer, intent(in) :: nnrad_zm ! Grid points in the radiation grid [count] - - real(kind=time_precision), intent(in) :: delt ! Timestep (dtmain in CLUBB) [s] - - ! Output Variables - type (stats), intent(out) :: stats_zt, & ! stats_zt grid - stats_zm, & ! stats_zm grid - stats_rad_zt, & ! stats_rad_zt grid - stats_rad_zm, & ! stats_rad_zm grid - stats_sfc ! stats_sfc - - - ! Local Variables - - ! Namelist Variables - - character(len=*), parameter :: subr = 'stats_init_clubb' - - character(len=var_length), dimension(nvarmax_zt) :: clubb_vars_zt ! Variables on the thermodynamic levels - character(len=var_length), dimension(nvarmax_zm) :: clubb_vars_zm ! Variables on the momentum levels - character(len=var_length), dimension(nvarmax_rad_zt) :: clubb_vars_rad_zt ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_rad_zm) :: clubb_vars_rad_zm ! Variables on the radiation levels - character(len=var_length), dimension(nvarmax_sfc) :: clubb_vars_sfc ! Variables at the model surface - - namelist /clubb_stats_nl/ & - clubb_vars_zt, & - clubb_vars_zm, & - clubb_vars_rad_zt, & - clubb_vars_rad_zm, & - clubb_vars_sfc - - ! Local Variables - - logical :: l_error, & - first_call = .false. - - character(len=200) :: temp1, sub - - integer :: i, ntot, read_status - integer :: iunit, ierr - - ! Initialize - l_error = .false. - - ! Set stats_variables variables with inputs from calling subroutine - l_stats = l_stats_in - - stats_tsamp = stats_tsamp_in - stats_tout = stats_tout_in - - if ( .not. l_stats ) then - l_stats_samp = .false. - l_stats_last = .false. - return - end if - - ! Initialize namelist variables - - clubb_vars_zt = '' - clubb_vars_zm = '' - clubb_vars_rad_zt = '' - clubb_vars_rad_zm = '' - clubb_vars_sfc = '' - - ! Read variables to compute from the namelist - if (masterproc) then - iunit= getunit() - open(unit=iunit,file="atm_in",status='old') - call find_group_name(iunit, 'clubb_stats_nl', status=read_status) - if (read_status == 0) then - read(unit=iunit, nml=clubb_stats_nl, iostat=read_status) - if (read_status /= 0) then - call endrun('stats_init_clubb: error reading namelist') - end if - end if - close(unit=iunit) - call freeunit(iunit) - end if - - ! Broadcast namelist variables - call mpi_bcast(clubb_vars_zt, var_length*nvarmax_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zt") - call mpi_bcast(clubb_vars_zm, var_length*nvarmax_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_zm") - call mpi_bcast(clubb_vars_rad_zt, var_length*nvarmax_rad_zt, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zt") - call mpi_bcast(clubb_vars_rad_zm, var_length*nvarmax_rad_zm, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_rad_zm") - call mpi_bcast(clubb_vars_sfc, var_length*nvarmax_sfc, mpi_character, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(subr//": FATAL: mpi_bcast: clubb_vars_sfc") - - ! Hardcode these for use in CAM-CLUBB, don't want either - l_netcdf = .false. - l_grads = .false. - - ! Check sampling and output frequencies - - ! The model time step length, delt (which is dtmain), should multiply - ! evenly into the statistical sampling time step length, stats_tsamp. - if ( abs( stats_tsamp/delt - floor(stats_tsamp/delt) ) > 1.e-8_r8 ) then - l_error = .true. ! This will cause the run to stop. - write(fstderr,*) 'Error: stats_tsamp should be an even multiple of ', & - 'delt (which is dtmain). Check the appropriate ', & - 'model.in file.' - write(fstderr,*) 'stats_tsamp = ', stats_tsamp - write(fstderr,*) 'delt = ', delt - endif - - ! Initialize zt (mass points) - - i = 1 - do while ( ichar(clubb_vars_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zt(i)) /= 0 .and. & - i <= nvarmax_zt ) - i = i + 1 - enddo - ntot = i - 1 - if ( ntot == nvarmax_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zt than allowed for by nvarmax_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zt ", & - "in the stats namelist, or change nvarmax_zt." - write(fstderr,*) "nvarmax_zt = ", nvarmax_zt - call endrun ("stats_init_clubb: number of zt statistical variables exceeds limit") - endif - - stats_zt%num_output_fields = ntot - stats_zt%kk = nnzp - - allocate( stats_zt%z( stats_zt%kk ) ) - - allocate( stats_zt%accum_field_values( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%accum_num_samples( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - allocate( stats_zt%l_in_update( 1, 1, stats_zt%kk, stats_zt%num_output_fields ) ) - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - - allocate( stats_zt%file%grid_avg_var( stats_zt%num_output_fields ) ) - allocate( stats_zt%file%z( stats_zt%kk ) ) - - first_call = (.not. allocated(ztscr01)) - - ! Allocate scratch space - if (first_call) allocate( ztscr01(stats_zt%kk) ) - if (first_call) allocate( ztscr02(stats_zt%kk) ) - if (first_call) allocate( ztscr03(stats_zt%kk) ) - if (first_call) allocate( ztscr04(stats_zt%kk) ) - if (first_call) allocate( ztscr05(stats_zt%kk) ) - if (first_call) allocate( ztscr06(stats_zt%kk) ) - if (first_call) allocate( ztscr07(stats_zt%kk) ) - if (first_call) allocate( ztscr08(stats_zt%kk) ) - if (first_call) allocate( ztscr09(stats_zt%kk) ) - if (first_call) allocate( ztscr10(stats_zt%kk) ) - if (first_call) allocate( ztscr11(stats_zt%kk) ) - if (first_call) allocate( ztscr12(stats_zt%kk) ) - if (first_call) allocate( ztscr13(stats_zt%kk) ) - if (first_call) allocate( ztscr14(stats_zt%kk) ) - if (first_call) allocate( ztscr15(stats_zt%kk) ) - if (first_call) allocate( ztscr16(stats_zt%kk) ) - if (first_call) allocate( ztscr17(stats_zt%kk) ) - if (first_call) allocate( ztscr18(stats_zt%kk) ) - if (first_call) allocate( ztscr19(stats_zt%kk) ) - if (first_call) allocate( ztscr20(stats_zt%kk) ) - if (first_call) allocate( ztscr21(stats_zt%kk) ) - - ztscr01 = 0.0_r8 - ztscr02 = 0.0_r8 - ztscr03 = 0.0_r8 - ztscr04 = 0.0_r8 - ztscr05 = 0.0_r8 - ztscr06 = 0.0_r8 - ztscr07 = 0.0_r8 - ztscr08 = 0.0_r8 - ztscr09 = 0.0_r8 - ztscr10 = 0.0_r8 - ztscr11 = 0.0_r8 - ztscr12 = 0.0_r8 - ztscr13 = 0.0_r8 - ztscr14 = 0.0_r8 - ztscr15 = 0.0_r8 - ztscr16 = 0.0_r8 - ztscr17 = 0.0_r8 - ztscr18 = 0.0_r8 - ztscr19 = 0.0_r8 - ztscr20 = 0.0_r8 - ztscr21 = 0.0_r8 - - ! Default initialization for array indices for zt - if (first_call) then - call stats_init_zt_api( clubb_vars_zt, l_error, & - stats_zt ) - end if - - ! Initialize zm (momentum points) - - i = 1 - do while ( ichar(clubb_vars_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_zm(i)) /= 0 .and. & - i <= nvarmax_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_zm than allowed for by nvarmax_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_zm ", & - "in the stats namelist, or change nvarmax_zm." - write(fstderr,*) "nvarmax_zm = ", nvarmax_zm - call endrun ("stats_init_clubb: number of zm statistical variables exceeds limit") - endif - - stats_zm%num_output_fields = ntot - stats_zm%kk = nnzp - - allocate( stats_zm%z( stats_zm%kk ) ) - - allocate( stats_zm%accum_field_values( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%accum_num_samples( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - allocate( stats_zm%l_in_update( 1, 1, stats_zm%kk, stats_zm%num_output_fields ) ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - - allocate( stats_zm%file%grid_avg_var( stats_zm%num_output_fields ) ) - allocate( stats_zm%file%z( stats_zm%kk ) ) - - ! Allocate scratch space - - if (first_call) allocate( zmscr01(stats_zm%kk) ) - if (first_call) allocate( zmscr02(stats_zm%kk) ) - if (first_call) allocate( zmscr03(stats_zm%kk) ) - if (first_call) allocate( zmscr04(stats_zm%kk) ) - if (first_call) allocate( zmscr05(stats_zm%kk) ) - if (first_call) allocate( zmscr06(stats_zm%kk) ) - if (first_call) allocate( zmscr07(stats_zm%kk) ) - if (first_call) allocate( zmscr08(stats_zm%kk) ) - if (first_call) allocate( zmscr09(stats_zm%kk) ) - if (first_call) allocate( zmscr10(stats_zm%kk) ) - if (first_call) allocate( zmscr11(stats_zm%kk) ) - if (first_call) allocate( zmscr12(stats_zm%kk) ) - if (first_call) allocate( zmscr13(stats_zm%kk) ) - if (first_call) allocate( zmscr14(stats_zm%kk) ) - if (first_call) allocate( zmscr15(stats_zm%kk) ) - if (first_call) allocate( zmscr16(stats_zm%kk) ) - if (first_call) allocate( zmscr17(stats_zm%kk) ) - - zmscr01 = 0.0_r8 - zmscr02 = 0.0_r8 - zmscr03 = 0.0_r8 - zmscr04 = 0.0_r8 - zmscr05 = 0.0_r8 - zmscr06 = 0.0_r8 - zmscr07 = 0.0_r8 - zmscr08 = 0.0_r8 - zmscr09 = 0.0_r8 - zmscr10 = 0.0_r8 - zmscr11 = 0.0_r8 - zmscr12 = 0.0_r8 - zmscr13 = 0.0_r8 - zmscr14 = 0.0_r8 - zmscr15 = 0.0_r8 - zmscr16 = 0.0_r8 - zmscr17 = 0.0_r8 - - if (first_call) then - call stats_init_zm_api( clubb_vars_zm, l_error, & - stats_zm ) - end if - - ! Initialize rad_zt (radiation points) - - if (l_output_rad_files) then - - i = 1 - do while ( ichar(clubb_vars_rad_zt(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zt(i)) /= 0 .and. & - i <= nvarmax_rad_zt ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zt ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zt than allowed for by nvarmax_rad_zt." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zt ", & - "in the stats namelist, or change nvarmax_rad_zt." - write(fstderr,*) "nvarmax_rad_zt = ", nvarmax_rad_zt - call endrun ("stats_init_clubb: number of rad_zt statistical variables exceeds limit") - endif - - stats_rad_zt%num_output_fields = ntot - stats_rad_zt%kk = nnrad_zt - - allocate( stats_rad_zt%z( stats_rad_zt%kk ) ) - - allocate( stats_rad_zt%accum_field_values( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%accum_num_samples( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%l_in_update( 1, 1, stats_rad_zt%kk, stats_rad_zt%num_output_fields ) ) - - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - - allocate( stats_rad_zt%file%grid_avg_var( stats_rad_zt%num_output_fields ) ) - allocate( stats_rad_zt%file%z( stats_rad_zt%kk ) ) - - call stats_init_rad_zt_api( clubb_vars_rad_zt, l_error, & - stats_rad_zt ) - - ! Initialize rad_zm (radiation points) - - i = 1 - do while ( ichar(clubb_vars_rad_zm(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_rad_zm(i)) /= 0 .and. & - i <= nvarmax_rad_zm ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_rad_zm ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_rad_zm than allowed for by nvarmax_rad_zm." - write(fstderr,*) "Check the number of variables listed for clubb_vars_rad_zm ", & - "in the stats namelist, or change nvarmax_rad_zm." - write(fstderr,*) "nvarmax_rad_zm = ", nvarmax_rad_zm - call endrun ("stats_init_clubb: number of rad_zm statistical variables exceeds limit") - endif - - stats_rad_zm%num_output_fields = ntot - stats_rad_zm%kk = nnrad_zm - - allocate( stats_rad_zm%z( stats_rad_zm%kk ) ) - - allocate( stats_rad_zm%accum_field_values( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%accum_num_samples( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%l_in_update( 1, 1, stats_rad_zm%kk, stats_rad_zm%num_output_fields ) ) - - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - - allocate( stats_rad_zm%file%grid_avg_var( stats_rad_zm%num_output_fields ) ) - allocate( stats_rad_zm%file%z( stats_rad_zm%kk ) ) - - call stats_init_rad_zm_api( clubb_vars_rad_zm, l_error, & - stats_rad_zm ) - end if ! l_output_rad_files - - - ! Initialize sfc (surface point) - - i = 1 - do while ( ichar(clubb_vars_sfc(i)(1:1)) /= 0 .and. & - len_trim(clubb_vars_sfc(i)) /= 0 .and. & - i <= nvarmax_sfc ) - i = i + 1 - end do - ntot = i - 1 - if ( ntot == nvarmax_sfc ) then - write(fstderr,*) "There are more statistical variables listed in ", & - "clubb_vars_sfc than allowed for by nvarmax_sfc." - write(fstderr,*) "Check the number of variables listed for clubb_vars_sfc ", & - "in the stats namelist, or change nvarmax_sfc." - write(fstderr,*) "nvarmax_sfc = ", nvarmax_sfc - call endrun ("stats_init_clubb: number of sfc statistical variables exceeds limit") - endif - - stats_sfc%num_output_fields = ntot - stats_sfc%kk = 1 - - allocate( stats_sfc%z( stats_sfc%kk ) ) - - allocate( stats_sfc%accum_field_values( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%accum_num_samples( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - allocate( stats_sfc%l_in_update( 1, 1, stats_sfc%kk, stats_sfc%num_output_fields ) ) - - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - allocate( stats_sfc%file%grid_avg_var( stats_sfc%num_output_fields ) ) - allocate( stats_sfc%file%z( stats_sfc%kk ) ) - - if (first_call) then - call stats_init_sfc_api( clubb_vars_sfc, l_error, & - stats_sfc ) - end if - - ! Check for errors - - if ( l_error ) then - call endrun ('stats_init: errors found') - endif - -! Now call add fields - if (first_call) then - - do i = 1, stats_zt%num_output_fields - - temp1 = trim(stats_zt%file%grid_avg_var(i)%name) - sub = temp1 - if (len(temp1) > max_fieldname_len) sub = temp1(1:max_fieldname_len) - - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zt%file%grid_avg_var(i)%units),trim(stats_zt%file%grid_avg_var(i)%description)) - enddo - - do i = 1, stats_zm%num_output_fields - - temp1 = trim(stats_zm%file%grid_avg_var(i)%name) - sub = temp1 - if (len(temp1) > max_fieldname_len) sub = temp1(1:max_fieldname_len) - - call addfld(trim(sub),(/ 'ilev' /),& - 'A',trim(stats_zm%file%grid_avg_var(i)%units),trim(stats_zm%file%grid_avg_var(i)%description)) - enddo - - if (l_output_rad_files) then - - do i = 1, stats_rad_zt%num_output_fields - call addfld(trim(stats_rad_zt%file%grid_avg_var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zt%file%grid_avg_var(i)%units),trim(stats_rad_zt%file%grid_avg_var(i)%description)) - enddo - - do i = 1, stats_rad_zm%num_output_fields - call addfld(trim(stats_rad_zm%file%grid_avg_var(i)%name),(/ 'ilev' /),& - 'A',trim(stats_rad_zm%file%grid_avg_var(i)%units),trim(stats_rad_zm%file%grid_avg_var(i)%description)) - enddo - endif - - do i = 1, stats_sfc%num_output_fields - call addfld(trim(stats_sfc%file%grid_avg_var(i)%name),horiz_only,& - 'A',trim(stats_sfc%file%grid_avg_var(i)%units),trim(stats_sfc%file%grid_avg_var(i)%description)) - enddo - - end if - - return - - end subroutine stats_init_clubb - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - subroutine stats_end_timestep_clubb(thecol, stats_zt, stats_zm, stats_rad_zt, stats_rad_zm, stats_sfc, & - out_zt, out_zm, out_radzt, out_radzm, out_sfc) - !----------------------------------------------------------------------- - ! Description: Called when the stats timestep has ended. This subroutine - ! is responsible for calling statistics to be written to the output - ! format. - !----------------------------------------------------------------------- - - - - use shr_infnan_mod, only: is_nan => shr_infnan_isnan - - use clubb_api_module, only: & - fstderr, & ! Constant(s) - l_stats_last, & - stats_tsamp, & - stats_tout, & - l_output_rad_files, & - clubb_at_least_debug_level_api ! Procedure(s) - - use cam_abortutils, only: endrun - - implicit none - - integer :: thecol - - ! Input Variables - type (stats), intent(inout) :: stats_zt, & ! stats_zt grid - stats_zm, & ! stats_zm grid - stats_rad_zt, & ! stats_rad_zt grid - stats_rad_zm, & ! stats_rad_zm grid - stats_sfc ! stats_sfc - - ! Inout variables - real(r8), intent(inout) :: out_zt(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_zm(:,:,:) ! (pcols,pverp,stats_zt%num_output_fields) - real(r8), intent(inout) :: out_radzt(:,:,:) ! (pcols,pverp,stats_rad_zt%num_output_fields) - real(r8), intent(inout) :: out_radzm(:,:,:) ! (pcols,pverp,rad_zm%num_output_fields) - real(r8), intent(inout) :: out_sfc(:,:,:) ! (pcols,1,sfc%num_output_fields) - - ! Local Variables - - integer :: i, k - logical :: l_error - - ! Check if it is time to write to file - - if ( .not. l_stats_last ) return - - ! Initialize - l_error = .false. - - ! Compute averages - call stats_avg( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, stats_zt%accum_num_samples ) - call stats_avg( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, stats_zm%accum_num_samples ) - if (l_output_rad_files) then - call stats_avg( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples ) - call stats_avg( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples ) - end if - call stats_avg( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, stats_sfc%accum_num_samples ) - - ! Here we are not outputting the data, rather reading the stats into - ! arrays which are conformable to CAM output. Also, the data is "flipped" - ! in the vertical level to be the same as CAM output. - do i = 1, stats_zt%num_output_fields - do k = 1, stats_zt%kk - out_zt(thecol,pverp-k+1,i) = stats_zt%accum_field_values(1,1,k,i) - if(is_nan(out_zt(thecol,k,i))) out_zt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_zm%num_output_fields - do k = 1, stats_zt%kk - out_zm(thecol,pverp-k+1,i) = stats_zm%accum_field_values(1,1,k,i) - if(is_nan(out_zm(thecol,k,i))) out_zm(thecol,k,i) = 0.0_r8 - enddo - enddo - - if (l_output_rad_files) then - do i = 1, stats_rad_zt%num_output_fields - do k = 1, stats_rad_zt%kk - out_radzt(thecol,pverp-k+1,i) = stats_rad_zt%accum_field_values(1,1,k,i) - if(is_nan(out_radzt(thecol,k,i))) out_radzt(thecol,k,i) = 0.0_r8 - enddo - enddo - - do i = 1, stats_rad_zm%num_output_fields - do k = 1, stats_rad_zm%kk - out_radzm(thecol,pverp-k+1,i) = stats_rad_zm%accum_field_values(1,1,k,i) - if(is_nan(out_radzm(thecol,k,i))) out_radzm(thecol,k,i) = 0.0_r8 - enddo - enddo - - ! Fill in values above the CLUBB top. - out_zt(thecol,:top_lev-1,:) = 0.0_r8 - out_zm(thecol,:top_lev-1,:) = 0.0_r8 - out_radzt(thecol,:top_lev-1,:) = 0.0_r8 - out_radzm(thecol,:top_lev-1,:) = 0.0_r8 - - endif ! l_output_rad_files - - do i = 1, stats_sfc%num_output_fields - out_sfc(thecol,1,i) = stats_sfc%accum_field_values(1,1,1,i) - if(is_nan(out_sfc(thecol,1,i))) out_sfc(thecol,1,i) = 0.0_r8 - enddo - - ! Reset sample fields - call stats_zero( stats_zt%kk, stats_zt%num_output_fields, stats_zt%accum_field_values, & - stats_zt%accum_num_samples, stats_zt%l_in_update ) - call stats_zero( stats_zm%kk, stats_zm%num_output_fields, stats_zm%accum_field_values, & - stats_zm%accum_num_samples, stats_zm%l_in_update ) - if (l_output_rad_files) then - call stats_zero( stats_rad_zt%kk, stats_rad_zt%num_output_fields, stats_rad_zt%accum_field_values, & - stats_rad_zt%accum_num_samples, stats_rad_zt%l_in_update ) - call stats_zero( stats_rad_zm%kk, stats_rad_zm%num_output_fields, stats_rad_zm%accum_field_values, & - stats_rad_zm%accum_num_samples, stats_rad_zm%l_in_update ) - end if - call stats_zero( stats_sfc%kk, stats_sfc%num_output_fields, stats_sfc%accum_field_values, & - stats_sfc%accum_num_samples, stats_sfc%l_in_update ) - - return - - end subroutine stats_end_timestep_clubb -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - -#ifdef CLUBB_SGS - - !----------------------------------------------------------------------- - subroutine stats_zero( kk, num_output_fields, x, n, l_in_update ) - - ! Description: - ! Initialize stats to zero - !----------------------------------------------------------------------- - - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - - implicit none - - ! Input - integer, intent(in) :: kk, num_output_fields - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(out) :: x - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(out) :: n - logical, dimension(1,1,kk,num_output_fields), intent(out) :: l_in_update - - ! Zero out arrays - - if ( num_output_fields > 0 ) then - x(:,:,:,:) = 0.0_r8 - n(:,:,:,:) = 0 - l_in_update(:,:,:,:) = .false. - end if - - return - - end subroutine stats_zero - -#endif - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - -#ifdef CLUBB_SGS - !----------------------------------------------------------------------- - subroutine stats_avg( kk, num_output_fields, x, n ) - - ! Description: - ! Compute the average of stats fields - !----------------------------------------------------------------------- - use clubb_api_module, only: & - stat_rknd, & ! Variable(s) - stat_nknd - - implicit none - - ! Input - integer, intent(in) :: num_output_fields, kk - integer(kind=stat_nknd), dimension(1,1,kk,num_output_fields), intent(in) :: n - - ! Output - real(kind=stat_rknd), dimension(1,1,kk,num_output_fields), intent(inout) :: x - - ! Internal - - integer k,m - - ! Compute averages - - do m=1,num_output_fields - do k=1,kk - - if ( n(1,1,k,m) > 0 ) then - x(1,1,k,m) = x(1,1,k,m) / real( n(1,1,k,m) ) - end if - - end do - end do - - return - - end subroutine stats_avg - - subroutine grid_size(state, grid_dx, grid_dy) - ! Determine the size of the grid for each of the columns in state - - use phys_grid, only: get_area_p - use shr_const_mod, only: shr_const_pi - use physics_types, only: physics_state - - - type(physics_state), intent(in) :: state - real(r8), intent(out) :: grid_dx(state%ncol), grid_dy(state%ncol) ! CAM grid [m] - - real(r8), parameter :: earth_ellipsoid1 = 111132.92_r8 ! first coefficient, meters per degree longitude at equator - real(r8), parameter :: earth_ellipsoid2 = 559.82_r8 ! second expansion coefficient for WGS84 ellipsoid - real(r8), parameter :: earth_ellipsoid3 = 1.175_r8 ! third expansion coefficient for WGS84 ellipsoid - - real(r8) :: mpdeglat, column_area, degree - integer :: i - - ! determine the column area in radians - do i=1,state%ncol - column_area = get_area_p(state%lchnk,i) - degree = sqrt(column_area)*(180._r8/shr_const_pi) - - ! Now find meters per degree latitude - ! Below equation finds distance between two points on an ellipsoid, derived from expansion - ! taking into account ellipsoid using World Geodetic System (WGS84) reference - mpdeglat = earth_ellipsoid1 - earth_ellipsoid2 * cos(2._r8*state%lat(i)) + earth_ellipsoid3 * cos(4._r8*state%lat(i)) - grid_dx(i) = mpdeglat * degree - grid_dy(i) = grid_dx(i) ! Assume these are the same - enddo - - end subroutine grid_size - -#endif - -end module clubb_intr diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index d916fe31a3..8f4b2a1d6c 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -391,8 +391,10 @@ subroutine radiation_init(pbuf2d) call rad_data_init(pbuf2d) ! initialize output fields for offline driver call radsw_init() call radlw_init() - call cloud_rad_props_init(pbuf2d) - +!+++ARH + !call cloud_rad_props_init(pbuf2d) + call cloud_rad_props_init() +!---ARH cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err) cldfgrau_idx = pbuf_get_index('CLDFGRAU',errcode=err) From c72b8871e7e6a15b60aeb9fd0a1e1f7c85d28a4b Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 12 Jul 2023 13:43:23 -0600 Subject: [PATCH 158/466] fix flip arrays --- src/physics/cam/clubb_intr.F90 | 28 ++++++++++++++-------------- src/physics/cam/clubb_mf.F90 | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 2201913694..6ff2b95a42 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4947,20 +4947,20 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_freq_output(:ncol) = mf_freq_nadv(:ncol) do k=1,clubb_mf_nup - mf_upa_output(i,pverp*(k-1)+1:pverp*k) = mf_upa_flip(i,:pverp,k) - mf_upw_output(i,pverp*(k-1)+1:pverp*k) = mf_upw_flip(i,:pverp,k) - mf_upmf_output(i,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(i,:pverp,k) - mf_upqt_output(i,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(i,:pverp,k) - mf_upthl_output(i,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(i,:pverp,k) - mf_upthv_output(i,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(i,:pverp,k) - mf_upth_output(i,pverp*(k-1)+1:pverp*k) = mf_upth_flip(i,:pverp,k) - mf_upqc_output(i,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(i,:pverp,k) - mf_upent_output(i,pverp*(k-1)+1:pverp*k) = mf_upent_flip(i,:pverp,k) - mf_updet_output(i,pverp*(k-1)+1:pverp*k) = mf_updet_flip(i,:pverp,k) - mf_upbuoy_output(i,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(i,:pverp,k) - mf_dnw_output(i,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(i,:pverp,k) - mf_dnthl_output(i,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(i,:pverp,k) - mf_dnqt_output(i,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(i,:pverp,k) + mf_upa_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upa_flip(:ncol,:pverp,k) + mf_upw_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upw_flip(:ncol,:pverp,k) + mf_upmf_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upmf_flip(:ncol,:pverp,k) + mf_upqt_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upqt_flip(:ncol,:pverp,k) + mf_upthl_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upthl_flip(:ncol,:pverp,k) + mf_upthv_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upthv_flip(:ncol,:pverp,k) + mf_upth_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upth_flip(:ncol,:pverp,k) + mf_upqc_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upqc_flip(:ncol,:pverp,k) + mf_upent_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_upent_flip(:ncol,:pverp,k) + mf_updet_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_updet_flip(:ncol,:pverp,k) + mf_upbuoy_output(:ncol,pverp*(k-1)+1:pverp*k)= mf_upbuoy_flip(:ncol,:pverp,k) + mf_dnw_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_dnw_flip(:ncol,:pverp,k) + mf_dnthl_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_dnthl_flip(:ncol,:pverp,k) + mf_dnqt_output(:ncol,pverp*(k-1)+1:pverp*k) = mf_dnqt_flip(:ncol,:pverp,k) end do end if !clubbmf diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7fa13b1664..7b8ec4ce68 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1360,10 +1360,10 @@ subroutine integrate_mf( nz, ! end do ! + ddcp = 0._r8 if (do_clubb_mf_coldpool .and. clubb_mf_fdd > 0._r8) then ! use single level for cold pool param. ! reset ddcp - ddcp = 0._r8 do i=1,clubb_mf_nup if (ddbot(i) == 0) then continue From 7280f65d89cc035347a5a183cafe949065c49f9a Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 16 Aug 2023 12:15:10 -0600 Subject: [PATCH 159/466] added some array intiailzaitons that resolves some of the issues --- .../testmods_dirs/cam/outfrq9s/shell_commands | 1 + .../cam/outfrq9s_clubbmf/shell_commands | 1 + .../cam/outfrq9s_clubbmf/user_nl_cam | 25 +++++----- src/control/cam_snapshot_common.F90 | 5 +- src/cpl/nuopc/atm_comp_nuopc.F90 | 34 ++++++++++++++ src/physics/cam/clubb_intr.F90 | 47 ++++++++++++++++--- src/physics/cam/clubb_mf.F90 | 15 ++++++ 7 files changed, 109 insertions(+), 19 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq9s/shell_commands index eb40ad83e0..483d64f2a8 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s/shell_commands @@ -1,2 +1,3 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange CAM_CONFIG_OPTS='-phys cam_dev -microphys mg2' --append diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands index eb40ad83e0..c8762f7cbf 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands @@ -1,2 +1,3 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange CAM_CONFIG_OPTS='-phys cam6 -microphys mg2' --append diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index e93e310f68..1e043665d9 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -1,7 +1,9 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 nhtfrq=9,9,9,9,9,9 +!nhtfrq=1,1,1,1,1,1 inithist='ENDOFRUN' + do_clubb_mf=.true. do_clubb_mf_diag=.true. do_clubb_mf_rad=.true. @@ -10,15 +12,16 @@ deep_scheme='off' clubb_mf_nup = 25 -clubb_mf_Lopt = 6 -clubb_mf_up_ndt = 1 -clubb_mf_a0 = 2.0D0 -clubb_mf_b0 = 0.5D0 -clubb_mf_alphturb = 0.0D0 -clubb_mf_max_L0 = 733.34D0 +!clubb_mf_Lopt = 6 +!clubb_mf_up_ndt = 1 +!clubb_mf_a0 = 2.0D0 +!clubb_mf_b0 = 0.5D0 +!clubb_mf_max_L0 = 1000.0D0 +!clubb_mf_alphturb = 3.0D0 +!do_clubb_mf_rhtke = .true. -clubb_mf_fdd = 0.5 -do_clubb_mf_coldpool = .true. -clubb_mf_cp_ndt = 1 -clubb_mf_ddalph = 250. -clubb_mf_ddbeta = 1.0 +!clubb_mf_fdd = 0.5 +!do_clubb_mf_coldpool = .true. +!clubb_mf_cp_ndt = 1 +!clubb_mf_ddalph = 500. +!clubb_mf_ddbeta = 1.0 diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index f2a4780619..25d790a7dc 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -86,7 +86,10 @@ 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) +!+++ARH +!type (snapshot_type_nd) :: pbuf_snapshot(250) +type (snapshot_type_nd) :: pbuf_snapshot(350) +!---ARH contains diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index 8b2ba903d0..3462e2b7c5 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -910,6 +910,14 @@ subroutine DataInitialize(gcomp, rc) call export_fields( gcomp, model_mesh, model_clock, cam_out, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return else +!+++ARH + if (masterproc) then + write(iam+1000,*) '--------------' + write(iam+1000,*) 'DataInitialize' + write(iam+1000,*) ' cam_run1 sets cam_out' + write(iam+1000,*) ' nstep=',get_nstep() + end if +!---ARH call cam_read_srfrest( gcomp, clock, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return call import_fields( gcomp, cam_in, restart_init=.true., rc=rc ) @@ -1093,6 +1101,14 @@ subroutine ModelAdvance(gcomp, rc) call import_fields( gcomp, cam_in, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('CAM_import') +!+++ARH + if (masterproc) then + write(iam+1000,*) '--------------' + write(iam+1000,*) 'Model Advance' + write(iam+1000,*) ' CAM_import sets cam_in' + write(iam+1000,*) ' nstep=',get_nstep() + end if +!---ARH end if dosend = .false. @@ -1145,6 +1161,15 @@ subroutine ModelAdvance(gcomp, rc) yr_spec=yr_sync, mon_spec=mon_sync, day_spec=day_sync, sec_spec=tod_sync) call t_stopf ('CAM_run4') +!+++ARH + if (masterproc) then + write(iam+1000,*) '--------------' + write(iam+1000,*) 'ModelAdvance' + write(iam+1000,*) ' cam_run2,cam_run3,cam_run4' + write(iam+1000,*) ' nstep=',get_nstep() + end if +!---ARH + ! Advance cam time step call t_startf ('CAM_adv_timestep') @@ -1157,6 +1182,15 @@ subroutine ModelAdvance(gcomp, rc) call cam_run1 ( cam_in, cam_out ) call t_stopf ('CAM_run1') +!+++ARH + if (masterproc) then + write(iam+1000,*) '--------------' + write(iam+1000,*) 'ModelAdvance' + write(iam+1000,*) ' CAM_adv_timestep,cam_run1' + write(iam+1000,*) ' nstep=',get_nstep() + end if +!---ARH + end do if (mediator_present) then diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 6ff2b95a42..1ea457c5f5 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2128,10 +2128,12 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_uflx' , 1, ' ') call add_default( 'edmf_vflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') +!+++ARH - not bfb call add_default( 'edmf_thlforcup', 1, ' ') call add_default( 'edmf_qtforcup' , 1, ' ') call add_default( 'edmf_thlforcdn', 1, ' ') call add_default( 'edmf_qtforcdn' , 1, ' ') +!---ARH call add_default( 'edmf_thlforc' , 1, ' ') call add_default( 'edmf_qtforc' , 1, ' ') call add_default( 'edmf_sqtup' , 1, ' ') @@ -3941,6 +3943,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! pressure,exner on momentum grid needed for mass flux calc. if (do_clubb_mf) then + kappa_zt(:,:) = 0._r8 + qc_zt(:,:) = 0._r8 + invrs_exner_zt(:,:) = 0._r8 do k=1,pver do i=1,ncol kappa_zt(i,k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) @@ -3953,8 +3958,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & qc_zt(:ncol,1) = qc_zt(:ncol,2) invrs_exner_zt(:ncol,1) = invrs_exner_zt(:ncol,2) + kappa_zm(:,:) = 0._r8 kappa_zm(1:ncol,:) = zt2zm_api(pverp+1-top_lev, ncol, gr, kappa_zt(1:ncol,:)) + p_in_Pa_zm(:,:) = 0._r8 + invrs_exner_zm(:,:) = 0._r8 do k=1,pverp do i=1,ncol p_in_Pa_zm(i,k) = state1%pint(i,pverp-k+1) @@ -3962,6 +3970,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do end do + th_sfc(:) = 0._r8 th_sfc(1:ncol) = cam_in%ts(1:ncol)*invrs_exner_zm(1:ncol,1) call calc_ustar( ncol, state1%t(:ncol,pver), state1%pmid(:ncol,pver), cam_in%wsx(:ncol), cam_in%wsy(:ncol), & @@ -4121,6 +4130,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (do_clubb_mf) then + dzt(:,:) = 0._r8 do k=2,pverp do i=1, ncol dzt(i,k) = zi_g(i,k) - zi_g(i,k-1) @@ -4128,8 +4138,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & end do dzt(:ncol,1) = dzt(:ncol,2) + + invrs_dzt(:,:) = 0._r8 invrs_dzt(:ncol,:) = 1._r8/dzt(:ncol,:) + rtm_zm_in(:,:) = 0._r8 + thlm_zm_in(:,:) = 0._r8 + th_zm(:,:) = 0._r8 + qv_zm(:,:) = 0._r8 + qc_zm(:,:) = 0._r8 rtm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, rtm_in(1:ncol,:) ) thlm_zm_in(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, thlm_in(1:ncol,:) ) th_zm(1:ncol,:) = zt2zm_api( pverp+1-top_lev, ncol, gr, th_zt(1:ncol,:) ) @@ -4243,12 +4260,18 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! pass MF turbulent advection term as CLUBB explicit forcing term - rtm_forcing(:ncol,1) = 0._r8 - thlm_forcing(:ncol,1) = 0._r8 - mf_qtforcup(:ncol,1) = 0._r8 - mf_thlforcup(:ncol,1) = 0._r8 - mf_qtforcdn(:ncol,1) = 0._r8 - mf_thlforcdn(:ncol,1) = 0._r8 + !rtm_forcing(:ncol,1) = 0._r8 + !thlm_forcing(:ncol,1) = 0._r8 + !mf_qtforcup(:ncol,1) = 0._r8 + !mf_thlforcup(:ncol,1) = 0._r8 + !mf_qtforcdn(:ncol,1) = 0._r8 + !mf_thlforcdn(:ncol,1) = 0._r8 + rtm_forcing(:ncol,:) = 0._r8 + thlm_forcing(:ncol,:) = 0._r8 + mf_qtforcup(:ncol,:) = 0._r8 + mf_thlforcup(:ncol,:) = 0._r8 + mf_qtforcdn(:ncol,:) = 0._r8 + mf_thlforcdn(:ncol,:) = 0._r8 do k=2,pverp do i=1, ncol @@ -4756,6 +4779,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wp2_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, wp2_in ) ! Need moist_qc and cloudfrac on thermo grid for output + mf_qc_zt(:,:) = 0._r8 + mf_cloudfrac_zt(:,:) = 0._r8 mf_qc_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_qc) mf_cloudfrac_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_cloudfrac) @@ -4908,9 +4933,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqtup_output(i,pverp-k+1) = mf_sqtup(i,k) mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(i,k) +!+++ARH not bfb mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(i,k) + !mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(i,k) + mf_ent_output(i,pverp-k+1) = mf_ent_nadv(i,k) + +!+++ARH not bfb mf_qc_output(i,pverp-k+1) = mf_qc_zt(i,k) + !mf_qc_output(i,pverp-k+1) = mf_qc(i,k) end if mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(i,k,:clubb_mf_nup) @@ -5486,7 +5517,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & deepcu(:,:) = 0.0_r8 shalcu(:,:) = 0.0_r8 - +!+++ARH + sh_icwmr(:,:) = 0.0_r8 +!---ARH do k=1,pver-1 do i=1,ncol ! diagnose the deep convective cloud fraction, as done in macrophysics based on the diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 7b8ec4ce68..2d35b506a9 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -567,6 +567,12 @@ subroutine integrate_mf( nz, dynamic_L0 = 0._r8 ztop = 0._r8 +!+++ARH - uncomment to recover bgb restarts +! ddcp = 0._r8 +! ztopm1 = zm(1) +! return +!---ARH + if (bsort) then niter_xc = 3 limarea = .true. @@ -1424,6 +1430,15 @@ subroutine integrate_mf( nz, vflx(k) = vflxup(k) + vflxdn(k) enddo +!+++ARH - uncomment bfb restarts (state only, clubb+mf diags still not bfb) +! thlflx = 0._r8 +! qtflx = 0._r8 +! sqt = 0_r8 +! sthl = 0._r8 +! moist_a = 0._r8 +! moist_qc = 0._r8 +!---ARH + else ddcp = 0._r8 ztopm1 = zm(1) From cdbd9a63070a802aab8f4c13b8e9add7f94c7fb2 Mon Sep 17 00:00:00 2001 From: Adam Herrington Date: Thu, 17 Aug 2023 09:38:12 -0600 Subject: [PATCH 160/466] fixes for running with nag on izumi --- src/physics/cam/clubb_intr.F90 | 96 +++++++++++++++++----------------- src/physics/cam/clubb_mf.F90 | 4 +- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 1ea457c5f5..d40f1ffdd3 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -18,9 +18,7 @@ module clubb_intr !----------------------------------------------------------------------------------------------------- ! use shr_kind_mod, only: r8=>shr_kind_r8 -!+++ARH use shr_const_mod, only: shr_const_pi -!---ARH use ppgrid, only: pver, pverp, pcols, begchunk, endchunk use phys_control, only: phys_getopts use physconst, only: cpair, gravit, rga, latvap, latice, zvir, rh2o, karman, rhoh2o @@ -434,7 +432,6 @@ module clubb_intr dnifzm_idx = -1 ! ZM detrained convective cloud ice num concen. integer :: & -!+++ARH qtm_macmic1_idx, & qtm_macmic2_idx, & thlm_macmic1_idx, & @@ -479,7 +476,6 @@ module clubb_intr ztop_macmic2_idx, & ddcp_macmic1_idx, & ddcp_macmic2_idx -!---ARH integer :: & prec_sh_idx, & @@ -644,12 +640,10 @@ subroutine clubb_register_cam( ) call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') -!+++ARH call pbuf_add_field('qtm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic1_idx) call pbuf_add_field('qtm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), qtm_macmic2_idx) call pbuf_add_field('thlm_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic1_idx) call pbuf_add_field('thlm_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), thlm_macmic2_idx) -!---ARH call pbuf_add_field('RCM_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), rcm_macmic_idx) call pbuf_add_field('CLDFRAC_CLUBB_macmic','physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), cldfrac_macmic_idx) call pbuf_add_field('WPTHLP_CLUBB_macmic' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), wpthlp_macmic_idx) @@ -667,7 +661,6 @@ subroutine clubb_register_cam( ) call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols/), ddcpmn_idx) call pbuf_add_field('CBM1' ,'global' , dtype_r8, (/pcols/), cbm1_idx) call pbuf_add_field('CBM1_MACMIC' ,'physpkg', dtype_r8, (/pcols/), cbm1_macmic_idx) -!+++ARH call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) call pbuf_add_field('dn_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) @@ -700,7 +693,6 @@ subroutine clubb_register_cam( ) call pbuf_add_field('ztop_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) call pbuf_add_field('ddcp_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) call pbuf_add_field('ddcp_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) -!---ARH end if #endif @@ -1938,12 +1930,10 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_dnthl' , (/ 'ilev', 'nens' /), 'A', 'K' , 'Plume downdraft liquid potential temperature (EDMF)' ) call addfld ( 'edmf_dnqt' , (/ 'ilev', 'nens' /), 'A', 'kg/kg' , 'Plume downdraft total water mixing ratio (EDMF)' ) end if -!+++ARH call addfld ('qtm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') call addfld ('qtm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'QT at macro/micro substep') call addfld ('thlm_macmic1' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') call addfld ('thlm_macmic2' , (/ 'ilev', 'ncyc' /), 'A', 'K' , 'THETAL at macro/micro substep') -!---ARH call addfld ('RCM_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg' , 'RCM CLUBB at macro/micro substep') call addfld ('CLDFRAC_CLUBB_macmic', (/ 'ilev', 'ncyc' /), 'A', 'fraction', 'CLDFRAC CLUBB at macro/micro substep') call addfld ('WPTHLP_CLUBB_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'W/m2' , 'Heat Flux at macro/micro substep') @@ -1953,7 +1943,6 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'edmf_thlflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thl flux (EDMF) at macro/micro substep' ) call addfld ( 'edmf_thvflx_macmic', (/ 'ilev', 'ncyc' /), 'A', 'K m/s' , 'thv flux (EDMF) at macro/micro substep' ) call addfld ( 'edmf_qtflx_macmic' , (/ 'ilev', 'ncyc' /), 'A', 'kg/kg m/s' , 'qt flux (EDMF) at macro/micro substep' ) -!+++ARH call addfld ( 'up_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) call addfld ( 'up_macmic2', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'up' ) call addfld ( 'dn_macmic1', (/ 'ilev', 'nens', 'ncyc' /), 'I', 'm/s' , 'dn' ) @@ -1986,7 +1975,6 @@ subroutine clubb_ini_cam(pbuf2d) call addfld ( 'ztop_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ztop' ) call addfld ( 'ddcp_macmic1', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) call addfld ( 'ddcp_macmic2', (/ 'ncyc' /), 'I', 'm/s' , 'ddcp' ) -!---ARH end if ! Initialize statistics, below are dummy variables @@ -2086,10 +2074,8 @@ subroutine clubb_ini_cam(pbuf2d) call add_default('ZM_CLUBB', 1, ' ') call add_default('UM_CLUBB', 1, ' ') call add_default('VM_CLUBB', 1, ' ') -!+++ARH !call add_default('SL', 1, ' ') !call add_default('QT', 1, ' ') -!---ARH call add_default('CONCLD', 1, ' ') if (do_clubb_mf_diag) then @@ -2128,12 +2114,13 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_uflx' , 1, ' ') call add_default( 'edmf_vflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') -!+++ARH - not bfb + +!+++ARH - not bfb (initialized them to zero -- fixed?) call add_default( 'edmf_thlforcup', 1, ' ') call add_default( 'edmf_qtforcup' , 1, ' ') call add_default( 'edmf_thlforcdn', 1, ' ') call add_default( 'edmf_qtforcdn' , 1, ' ') -!---ARH + call add_default( 'edmf_thlforc' , 1, ' ') call add_default( 'edmf_qtforc' , 1, ' ') call add_default( 'edmf_sqtup' , 1, ' ') @@ -2148,12 +2135,10 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_cape' , 1, ' ') call add_default( 'edmf_cfl' , 1, ' ') end if -!+++ARH !call add_default( 'qtm_macmic1' , 1, ' ') !call add_default( 'qtm_macmic2' , 1, ' ') !call add_default( 'thlm_macmic1' , 1, ' ') !call add_default( 'thlm_macmic2' , 1, ' ') -!---ARH call add_default( 'RCM_CLUBB_macmic' , 1, ' ') call add_default( 'CLDFRAC_CLUBB_macmic', 1, ' ') call add_default( 'WPTHLP_CLUBB_macmic' , 1, ' ') @@ -2163,7 +2148,6 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_thlflx_macmic' , 1, ' ') call add_default( 'edmf_qtflx_macmic' , 1, ' ') call add_default( 'edmf_thvflx_macmic' , 1, ' ') -!+++ARH !call add_default( 'up_macmic1' , 1, ' ') !call add_default( 'up_macmic2' , 1, ' ') !call add_default( 'dn_macmic1' , 1, ' ') @@ -2196,7 +2180,6 @@ subroutine clubb_ini_cam(pbuf2d) !call add_default( 'ztop_macmic2' , 1, ' ') !call add_default( 'ddcp_macmic1' , 1, ' ') !call add_default( 'ddcp_macmic2' , 1, ' ') -!---ARH end if end if @@ -2287,12 +2270,11 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, wp2vp2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ice_supersat_idx, 0.0_r8) -!+++ARH call pbuf_set_field(pbuf2d, thlm_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlm_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, qtm_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, qtm_macmic2_idx, 0.0_r8) -!---ARH + ! Initialize SILHS covariance contributions call pbuf_set_field(pbuf2d, rtp2_mc_zt_idx, 0.0_r8) call pbuf_set_field(pbuf2d, thlp2_mc_zt_idx, 0.0_r8) @@ -2309,7 +2291,6 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, ddcpmn_idx, 0.0_r8) call pbuf_set_field(pbuf2d, cbm1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, cbm1_macmic_idx, 0.0_r8) -!+++ARH call pbuf_set_field(pbuf2d, up_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, up_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, dn_macmic1_idx, 0.0_r8) @@ -2342,7 +2323,6 @@ subroutine clubb_ini_cam(pbuf2d) call pbuf_set_field(pbuf2d, ztop_macmic2_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcp_macmic1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, ddcp_macmic2_idx, 0.0_r8) -!---ARH end if call pbuf_set_field(pbuf2d, pdf_zm_w_1_idx, 0.0_r8) call pbuf_set_field(pbuf2d, pdf_zm_w_2_idx, 0.0_r8) @@ -2938,10 +2918,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & mf_thvflx_output, & mf_rcm_output, mf_precc_output - +!+++ARH ! MF Plume ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines - real(r8), dimension(pcols,pverp) :: mf_dry_a, mf_moist_a, & + !real(r8), dimension(pcols,pverp) :: mf_dry_a, mf_moist_a, & + real(r8), dimension(state%ncol,pverp) :: mf_dry_a, mf_moist_a, & mf_dry_w, mf_moist_w, & mf_dry_qt, mf_moist_qt, & mf_dry_thl, mf_moist_thl, & @@ -2962,8 +2943,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqtdn, mf_sthldn, & mf_sqt, mf_sthl, & mf_precc - - real(r8), dimension(pcols,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & +!+++ARH + !real(r8), dimension(pcols,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & + real(r8), dimension(state%ncol,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & mf_thvflx, & @@ -2977,9 +2959,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_qc_zt, mf_cloudfrac_zt, & mf_rcm, mf_rcm_nadv, & mf_ent_nadv - +!+++ARH ! MF plume level - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + !real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + real(r8), dimension(state%ncol,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & mf_upw, mf_dnw, & mf_upmf, & mf_upqt, mf_dnqt, & @@ -2993,31 +2976,50 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend - real(r8), dimension(pcols,pverp,clubb_mf_nup) :: flip - real(r8), dimension(pcols,pverp) :: lilflip +!+++ARH + !real(r8), dimension(pcols,pverp,clubb_mf_nup) :: flip + real(r8), dimension(state%ncol,pverp,clubb_mf_nup) :: flip + +!+++ARH + !real(r8), dimension(pcols,pverp) :: lilflip + real(r8), dimension(state%ncol,pverp) :: lilflip ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 real(r8) :: lambda - real(r8), dimension(pcols) :: cflfac, max_cfl, & + +!+++ARH + !real(r8), dimension(pcols) :: cflfac, max_cfl, & + real(r8), dimension(state%ncol) :: cflfac, max_cfl, & th_sfc, max_cfl_nadv logical :: cfllim - real(r8), dimension(pcols) :: mf_ztop, mf_ztop_nadv, & +!+++ARH + !real(r8), dimension(pcols) :: mf_ztop, mf_ztop_nadv, & + real(r8), dimension(state%ncol) :: mf_ztop, mf_ztop_nadv, & mf_ztopm1, mf_ztopm1_nadv, & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & mf_ddcp, mf_ddcp_nadv, & mf_cbm1, mf_cbm1_nadv, & mf_freq_nadv +!+++ARH + !real(r8), dimension(pcols,pver) :: esat, rh + real(r8), dimension(state%ncol,pver) :: esat, rh + +!+++ARH + !real(r8), dimension(pcols,pver) :: mq, mqsat + real(r8), dimension(state%ncol,pver) :: mq, mqsat - real(r8), dimension(pcols,pver) :: esat, rh - real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(pcols) :: rhlev, rhinv +!+++ARH + !real(r8), dimension(pcols) :: rhlev, rhinv + real(r8), dimension(state%ncol) :: rhlev, rhinv +!+++ARH ! MF local vars - real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid + !real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid + real(r8), dimension(state%ncol,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid invrs_exner_zt,& ! thermodynamic grid kappa_zt, qc_zt, & ! thermodynamic grid @@ -3193,12 +3195,11 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) call pbuf_get_field(pbuf, snow_sh_idx, snow_sh ) -!+++ARH call pbuf_get_field(pbuf, qtm_macmic1_idx, qtm_macmic1) call pbuf_get_field(pbuf, qtm_macmic2_idx, qtm_macmic2) call pbuf_get_field(pbuf, thlm_macmic1_idx, thlm_macmic1) call pbuf_get_field(pbuf, thlm_macmic2_idx, thlm_macmic2) -!---ARH + call pbuf_get_field(pbuf, rcm_macmic_idx, rcm_macmic) call pbuf_get_field(pbuf, cldfrac_macmic_idx, cldfrac_macmic) call pbuf_get_field(pbuf, wpthlp_macmic_idx, wpthlp_macmic) @@ -3220,7 +3221,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, cbm1_idx, cbm1) call pbuf_get_field(pbuf, cbm1_macmic_idx, cbm1_macmic) -!+++ARH + call pbuf_get_field(pbuf, up_macmic1_idx, up_macmic1) call pbuf_get_field(pbuf, up_macmic2_idx, up_macmic2) call pbuf_get_field(pbuf, dn_macmic1_idx, dn_macmic1) @@ -3253,7 +3254,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & call pbuf_get_field(pbuf, ztop_macmic2_idx, ztop_macmic2) call pbuf_get_field(pbuf, ddcp_macmic1_idx, ddcp_macmic1) call pbuf_get_field(pbuf, ddcp_macmic2_idx, ddcp_macmic2) -!---ARH ! SVP do k = 1, pver @@ -3849,6 +3849,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rvm_in(i,k) = rvm(i,pverp-k+1) wprtp_in(i,k) = wprtp(i,pverp-k+1) wpthlp_in(i,k) = wpthlp(i,pverp-k+1) +!+++ARH + tke_in(i,k) = tke(i,pverp-k+1) rtpthlp_in(i,k) = rtpthlp(i,pverp-k+1) cloud_frac_inout(i,k) = cloud_frac(i,pverp-k+1) if (k>1) then @@ -4094,7 +4096,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (is_first_step() .and. macmic_it==1) then ddcp(:ncol) = 0._r8 end if -!---ARH mf_precc_nadv(:ncol) = 0._r8 mf_snow_nadv(:ncol) = 0._r8 @@ -4625,7 +4626,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (rtm_in(i,k) < rcm_inout(i,k)) rtm_in(i,k) = rcm_inout(i,k) end do end do -!---ARH if (do_rainturb) then @@ -4783,6 +4783,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_cloudfrac_zt(:,:) = 0._r8 mf_qc_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_qc) mf_cloudfrac_zt = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_cloudfrac) + !mf_qc_zt(1:ncol,:) = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_qc(1:ncol,:)) + !mf_cloudfrac_zt(1:ncol,:) = zm2zt_api( pverp+1-top_lev, ncol, gr, mf_cloudfrac(1:ncol,:)) ! Arrays need to be "flipped" to CAM grid do k=1, nlev+1 @@ -4933,13 +4935,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqtup_output(i,pverp-k+1) = mf_sqtup(i,k) mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(i,k) -!+++ARH not bfb +!+++ARH not bfb (fixed?) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(i,k) !mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(i,k) mf_ent_output(i,pverp-k+1) = mf_ent_nadv(i,k) -!+++ARH not bfb +!+++ARH not bfb (fixed?) mf_qc_output(i,pverp-k+1) = mf_qc_zt(i,k) !mf_qc_output(i,pverp-k+1) = mf_qc(i,k) end if @@ -5519,7 +5521,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & shalcu(:,:) = 0.0_r8 !+++ARH sh_icwmr(:,:) = 0.0_r8 -!---ARH + do k=1,pver-1 do i=1,ncol ! diagnose the deep convective cloud fraction, as done in macrophysics based on the diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 2d35b506a9..544e7b377c 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -566,6 +566,7 @@ subroutine integrate_mf( nz, dynamic_L0 = 0._r8 ztop = 0._r8 + ddbot= 0 !+++ARH - uncomment to recover bgb restarts ! ddcp = 0._r8 @@ -981,7 +982,6 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup ! find cloud base - ddbot(i) = 0 do k = 1,nz if (upqc(k,i) > 0._r8) then ddbot(i) = k @@ -1374,7 +1374,7 @@ subroutine integrate_mf( nz, if (ddbot(i) == 0) then continue else - ddcp = ddcp + -1._r8*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) + ddcp = ddcp + (-1._r8)*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) end if end do end if From ccfdfec791864bfeb8edc2c4c8c94417ff55d033 Mon Sep 17 00:00:00 2001 From: adamrher Date: Tue, 5 Sep 2023 16:42:55 -0600 Subject: [PATCH 161/466] updated to modified clubb externals, implement cmt --- Externals_CAM.cfg | 6 ++++-- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 ++++++ src/physics/cam/clubb_intr.F90 | 20 +++++++++++++------- src/physics/cam/clubb_mf.F90 | 8 ++++++-- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index cc99360e56..980e021d65 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -22,8 +22,10 @@ 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 +#repo_url = https://github.com/larson-group/clubb_release/tags/ +#tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag/src/CLUBB_core +repo_url = https://github.com/adamrher/clubb_release/branches/ +branch = clubb_4ncar_20221129_59cb19f_20230330.clubbmf/src/CLUBB_core required = True [silhs] diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 6a5172fbc3..820d8b4ac9 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2184,6 +2184,7 @@ 1 1 .false. + .false. .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 8dda5277e9..6010e9bfa4 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4404,6 +4404,12 @@ If .true. use relative humidity thresholds to turn off TKE enhanced entrainment Default: .false. + +If .true. turn on convective momentum transport +Default: .false. + + Date: Thu, 21 Sep 2023 16:45:52 -0600 Subject: [PATCH 162/466] fixed bug in vertintrp call; fixed LBA (moved it over a land point) --- .../cam/outfrq9s_clubbmf/user_nl_cam | 24 ++--- .../usermods_dirs/scam_LBA/shell_commands | 3 +- .../usermods_dirs/scam_LBA/user_nl_cam | 3 +- src/physics/cam/clubb_intr.F90 | 95 +++++-------------- 4 files changed, 42 insertions(+), 83 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index 1e043665d9..b70d0e8205 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -12,16 +12,16 @@ deep_scheme='off' clubb_mf_nup = 25 -!clubb_mf_Lopt = 6 -!clubb_mf_up_ndt = 1 -!clubb_mf_a0 = 2.0D0 -!clubb_mf_b0 = 0.5D0 -!clubb_mf_max_L0 = 1000.0D0 -!clubb_mf_alphturb = 3.0D0 -!do_clubb_mf_rhtke = .true. +clubb_mf_Lopt = 6 +clubb_mf_up_ndt = 1 +clubb_mf_a0 = 2.0D0 +clubb_mf_b0 = 0.5D0 +clubb_mf_max_L0 = 1000.0D0 +clubb_mf_alphturb = 3.0D0 +do_clubb_mf_rhtke = .true. -!clubb_mf_fdd = 0.5 -!do_clubb_mf_coldpool = .true. -!clubb_mf_cp_ndt = 1 -!clubb_mf_ddalph = 500. -!clubb_mf_ddbeta = 1.0 +clubb_mf_fdd = 0.5 +do_clubb_mf_coldpool = .true. +clubb_mf_cp_ndt = 1 +clubb_mf_ddalph = 500. +clubb_mf_ddbeta = 1.0 diff --git a/cime_config/usermods_dirs/scam_LBA/shell_commands b/cime_config/usermods_dirs/scam_LBA/shell_commands index 64bdbe5dbc..9f032524f3 100755 --- a/cime_config/usermods_dirs/scam_LBA/shell_commands +++ b/cime_config/usermods_dirs/scam_LBA/shell_commands @@ -1,6 +1,7 @@ # setup SCAM lon and lat for this iop # this should correspond to the forcing IOP coordinates -./xmlchange PTS_LON=0.0 +#./xmlchange PTS_LON=0.0 +./xmlchange PTS_LON=295. ./xmlchange PTS_LAT=0.0 # Specify the starting/ending time for the IOP diff --git a/cime_config/usermods_dirs/scam_LBA/user_nl_cam b/cime_config/usermods_dirs/scam_LBA/user_nl_cam index fdd7c895f9..2a0ef1e895 100644 --- a/cime_config/usermods_dirs/scam_LBA/user_nl_cam +++ b/cime_config/usermods_dirs/scam_LBA/user_nl_cam @@ -3,7 +3,8 @@ iopfile='/glade/u/home/storer/scam_iop_nc/iop_LBA_precip_halfhour.nc' !ncdata='$DIN_LOC_ROOT/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' - ncdata='/glade/work/aherring/grids/vertical-res/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + !ncdata='/glade/work/aherring/grids/vertical-res/CESM2.F2000climo.IOP_SITES_L128.cam.i.0003-06-01-00000.nc' + ncdata="$DIN_LOC_ROOT/atm/cam/scam/iop/CESM2.F2000climo.IOP_SITES.cam.i.0003-06-01-00000.nc" nhtfrq = 1 mfilt = 720 diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 06f806b959..ee8e8bf8c7 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -637,6 +637,7 @@ subroutine clubb_register_cam( ) call pbuf_add_field('pdf_zm_var_w_2', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_varnce_w_2_idx) call pbuf_add_field('pdf_zm_mixt_frac', 'global', dtype_r8, (/pcols,pverp,dyn_time_lvls/), pdf_zm_mixt_frac_idx) + ! these extrra coord vars don't seem to work for interpolate_output=.true. call add_hist_coord('ncyc', cld_macmic_num_steps, 'macro/micro cycle index') call add_hist_coord('nens', clubb_mf_nup, 'clubb+mf ensemble size') @@ -2115,7 +2116,6 @@ subroutine clubb_ini_cam(pbuf2d) call add_default( 'edmf_vflx' , 1, ' ') call add_default( 'edmf_qtflx' , 1, ' ') -!+++ARH - not bfb (initialized them to zero -- fixed?) call add_default( 'edmf_thlforcup', 1, ' ') call add_default( 'edmf_qtforcup' , 1, ' ') call add_default( 'edmf_thlforcdn', 1, ' ') @@ -2918,11 +2918,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_thlflx_output, mf_qtflx_output, mf_uflx_output, mf_vflx_output, & mf_thvflx_output, & mf_rcm_output, mf_precc_output -!+++ARH - ! MF Plume - ! NOTE: Arrays of size PCOLS (all possible columns) can be used to access State, PBuf and History Subroutines - !real(r8), dimension(pcols,pverp) :: mf_dry_a, mf_moist_a, & - real(r8), dimension(state%ncol,pverp) :: mf_dry_a, mf_moist_a, & + ! MF work arrays (of size NCOL) + real(r8), dimension(state%ncol,pverp):: mf_dry_a, mf_moist_a, & mf_dry_w, mf_moist_w, & mf_dry_qt, mf_moist_qt, & mf_dry_thl, mf_moist_thl, & @@ -2943,9 +2940,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqtdn, mf_sthldn, & mf_sqt, mf_sthl, & mf_precc -!+++ARH - !real(r8), dimension(pcols,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & - real(r8), dimension(state%ncol,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & + + real(r8), dimension(state%ncol,pverp) :: mf_thlflxup, mf_qtflxup, mf_uflxup, mf_vflxup, & mf_thlflxdn, mf_qtflxdn, mf_uflxdn, mf_vflxdn, & mf_thlflx, mf_qtflx, mf_uflx, mf_vflx, & mf_thvflx, & @@ -2959,67 +2955,44 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_qc_zt, mf_cloudfrac_zt, & mf_rcm, mf_rcm_nadv, & mf_ent_nadv -!+++ARH - ! MF plume level - !real(r8), dimension(pcols,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & + real(r8), dimension(state%ncol,pverp,clubb_mf_nup) :: mf_upa, mf_dna, & - mf_upw, mf_dnw, & - mf_upmf, & - mf_upqt, mf_dnqt, & - mf_upthl, mf_dnthl, & - mf_upthv, mf_dnthv, & - mf_upth, mf_dnth, & - mf_upqc, mf_dnqc, & - mf_upbuoy, & - mf_updet, & - mf_upent + mf_upw, mf_dnw, & + mf_upmf, & + mf_upqt, mf_dnqt, & + mf_upthl, mf_dnthl, & + mf_upthv, mf_dnthv, & + mf_upth, mf_dnth, & + mf_upqc, mf_dnqc, & + mf_upbuoy, & + mf_updet, & + mf_upent real(r8) :: inv_rh2o ! To reduce the number of divisions in clubb_tend -!+++ARH - !real(r8), dimension(pcols,pverp,clubb_mf_nup) :: flip real(r8), dimension(state%ncol,pverp,clubb_mf_nup) :: flip - -!+++ARH - !real(r8), dimension(pcols,pverp) :: lilflip real(r8), dimension(state%ncol,pverp) :: lilflip ! CFL limiter vars real(r8), parameter :: cflval = 1._r8 real(r8) :: lambda - -!+++ARH - !real(r8), dimension(pcols) :: cflfac, max_cfl, & - real(r8), dimension(state%ncol) :: cflfac, max_cfl, & + real(r8), dimension(state%ncol) :: cflfac, max_cfl, & th_sfc, max_cfl_nadv - logical :: cfllim -!+++ARH - !real(r8), dimension(pcols) :: mf_ztop, mf_ztop_nadv, & - real(r8), dimension(state%ncol) :: mf_ztop, mf_ztop_nadv, & + real(r8), dimension(state%ncol) :: mf_ztop, mf_ztop_nadv, & mf_ztopm1, mf_ztopm1_nadv, & mf_precc_nadv, mf_snow_nadv,& mf_L0, mf_L0_nadv, & mf_ddcp, mf_ddcp_nadv, & mf_cbm1, mf_cbm1_nadv, & mf_freq_nadv -!+++ARH - !real(r8), dimension(pcols,pver) :: esat, rh - real(r8), dimension(state%ncol,pver) :: esat, rh - -!+++ARH - !real(r8), dimension(pcols,pver) :: mq, mqsat - real(r8), dimension(state%ncol,pver) :: mq, mqsat - -!+++ARH - !real(r8), dimension(pcols) :: rhlev, rhinv - real(r8), dimension(state%ncol) :: rhlev, rhinv - -!+++ARH - ! MF local vars - !real(r8), dimension(pcols,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid - real(r8), dimension(state%ncol,pverp) :: rtm_zm_in, thlm_zm_in, & ! momentum grid + + real(r8), dimension(state%ncol,pver) :: esat, rh + real(r8), dimension(state%ncol,pver) :: mq, mqsat + real(r8), dimension(state%ncol) :: rhlev, rhinv + + real(r8), dimension(state%ncol,pverp):: rtm_zm_in, thlm_zm_in, & ! momentum grid dzt, invrs_dzt, & ! thermodynamic grid invrs_exner_zt,& ! thermodynamic grid kappa_zt, qc_zt, & ! thermodynamic grid @@ -3264,8 +3237,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (clubb_mf_Lopt==7 .or. clubb_mf_Lopt==6) then ! Interpolate RH to 500 hPa rh(:ncol,:) = state%q(:ncol,:,1)/rh(:ncol,:) - call vertinterp(ncol, pcols, pver, state%pmid, 50000._r8, rh, rhlev, & - extrapolate='Z', ln_interp=.true., ps=state%ps, phis=state%phis, tbot=state%t(:,pver)) + call vertinterp(ncol, ncol, pver, state%pmid(:ncol,:), 50000._r8, rh, rhlev, & + extrapolate='Z', ln_interp=.true., ps=state%ps(:ncol), phis=state%phis(:ncol), tbot=state%t(:ncol,pver)) else if (clubb_mf_Lopt==8) then ! Mass of q, by layer and vertically integrated mq(:ncol,:) = state%q(:ncol,:,1) * state%pdel(:ncol,:) * rga @@ -3849,7 +3822,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rvm_in(i,k) = rvm(i,pverp-k+1) wprtp_in(i,k) = wprtp(i,pverp-k+1) wpthlp_in(i,k) = wpthlp(i,pverp-k+1) -!+++ARH tke_in(i,k) = tke(i,pverp-k+1) rtpthlp_in(i,k) = rtpthlp(i,pverp-k+1) cloud_frac_inout(i,k) = cloud_frac(i,pverp-k+1) @@ -4261,14 +4233,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! pass MF turbulent advection term as CLUBB explicit forcing term - !rtm_forcing(:ncol,1) = 0._r8 - !thlm_forcing(:ncol,1) = 0._r8 - !mf_qtforcup(:ncol,1) = 0._r8 - !mf_thlforcup(:ncol,1) = 0._r8 - !mf_qtforcdn(:ncol,1) = 0._r8 - !mf_thlforcdn(:ncol,1) = 0._r8 - rtm_forcing(:ncol,:) = 0._r8 - thlm_forcing(:ncol,:) = 0._r8 mf_qtforcup(:ncol,:) = 0._r8 mf_thlforcup(:ncol,:) = 0._r8 mf_qtforcdn(:ncol,:) = 0._r8 @@ -4941,15 +4905,9 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_sqtup_output(i,pverp-k+1) = mf_sqtup(i,k) mf_sqtdn_output(i,pverp-k+1) = mf_sqtdn(i,k) -!+++ARH not bfb (fixed?) mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac_zt(i,k) - !mf_cloudfrac_output(i,pverp-k+1) = mf_cloudfrac(i,k) - mf_ent_output(i,pverp-k+1) = mf_ent_nadv(i,k) - -!+++ARH not bfb (fixed?) mf_qc_output(i,pverp-k+1) = mf_qc_zt(i,k) - !mf_qc_output(i,pverp-k+1) = mf_qc(i,k) end if mf_upa_flip(i,pverp-k+1,:clubb_mf_nup) = mf_upa(i,k,:clubb_mf_nup) @@ -5525,7 +5483,6 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & deepcu(:,:) = 0.0_r8 shalcu(:,:) = 0.0_r8 -!+++ARH sh_icwmr(:,:) = 0.0_r8 do k=1,pver-1 From 4aae7f46910ec47da3865ae42a458bd12960c9f6 Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 29 Sep 2023 14:40:04 -0600 Subject: [PATCH 163/466] fixed bug introduced recently, zero arrays for plume members terminating k<3 --- src/physics/cam/clubb_intr.F90 | 4 ++++ src/physics/cam/clubb_mf.F90 | 36 ++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index bca7dbd73d..6e9e117e2f 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4227,6 +4227,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & ! pass MF turbulent advection term as CLUBB explicit forcing term + rtm_forcing(:ncol,:) = 0._r8 + thlm_forcing(:ncol,:) = 0._r8 mf_qtforcup(:ncol,:) = 0._r8 mf_thlforcup(:ncol,:) = 0._r8 mf_qtforcdn(:ncol,:) = 0._r8 @@ -4263,6 +4265,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (do_clubb_mf_cmt) then ! convective momentum transport + um_forcing(:ncol,:) = 0._r8 + vm_forcing(:ncol,:) = 0._r8 do k=2,pverp do i=1, ncol um_forcing(i,k) = um_forcing(i,k) - invrs_rho_ds_zt(i,k) * invrs_dzt(i,k) * cflfac(i) * & diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index b20edde60c..6fddc16546 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -624,10 +624,10 @@ subroutine integrate_mf( nz, qstar = wqt / wstar thvstar = wthv / wstar end if - - sigmaw = alphw * wstar * cpfac - sigmaqt = alphqt * abs(qstar) * cpfac - sigmathv = alphthv * abs(thvstar) * cpfac +!+++ARH + sigmaw = alphw * wstar !* cpfac + sigmaqt = alphqt * abs(qstar) !* cpfac + sigmathv = alphthv * abs(thvstar) !* cpfac wmin = sigmaw * pwmin wmax = sigmaw * pwmax @@ -943,7 +943,35 @@ subroutine integrate_mf( nz, updet(k+1,i) = detn else + ! zero out plumes that terminate at k<3 + if (k<3) then + supqt(:,i) = 0._r8 + upauto(:,i)= 0._r8 + supthl(:,i)= 0._r8 + + upa(:,i) = 0._r8 + upbuoy(:,i)= 0._r8 + upw(:,i) = 0._r8 + upmf(:,i) = 0._r8 + upent(:,i) = 0._r8 + updet(:,i) = 0._r8 + + upthv(:,i) = 0._r8 + upthl(:,i) = 0._r8 + upqt(:,i) = 0._r8 + upqc(:,i) = 0._r8 + upqs(:,i) = 0._r8 + upu(:,i) = 0._r8 + upv(:,i) = 0._r8 + upql(:,i) = 0._r8 + upqi(:,i) = 0._r8 + upqv(:,i) = 0._r8 + uplmix(:,i)= 0._r8 + upth(:,i) = 0._r8 + end if + ! exit updraft integration exit + ! end if enddo enddo From e9d7cada8cfb42c7c4101db9872fe45df57e773a Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 29 Sep 2023 15:24:27 -0600 Subject: [PATCH 164/466] remove comments --- src/physics/cam/clubb_mf.F90 | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 6fddc16546..a3929275bb 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -572,12 +572,6 @@ subroutine integrate_mf( nz, ztop = 0._r8 ddbot= 0 -!+++ARH - uncomment to recover bgb restarts -! ddcp = 0._r8 -! ztopm1 = zm(1) -! return -!---ARH - if (bsort) then niter_xc = 3 limarea = .true. @@ -1461,16 +1455,7 @@ subroutine integrate_mf( nz, uflx(k) = uflxup(k) + uflxdn(k) vflx(k) = vflxup(k) + vflxdn(k) enddo - -!+++ARH - uncomment bfb restarts (state only, clubb+mf diags still not bfb) -! thlflx = 0._r8 -! qtflx = 0._r8 -! sqt = 0_r8 -! sthl = 0._r8 -! moist_a = 0._r8 -! moist_qc = 0._r8 -!---ARH - + ! else ddcp = 0._r8 ztopm1 = zm(1) From 11237f41e336589d81e084dcdaba2fbcd81dfacf Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 17 Nov 2023 13:40:08 -0700 Subject: [PATCH 165/466] add per plume entrainment mods --- bld/build-namelist | 4 + bld/namelist_files/namelist_defaults_cam.xml | 4 + bld/namelist_files/namelist_definition.xml | 24 +++ src/physics/cam/clubb_intr.F90 | 127 ++++++++------- src/physics/cam/clubb_mf.F90 | 160 ++++++++++++------- 5 files changed, 199 insertions(+), 120 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 9bf304c5a1..84f4645294 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3403,6 +3403,10 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'clubb_mf_cp_ndt'); add_default($nl, 'do_clubb_mf_rhtke'); add_default($nl, 'do_clubb_mf_cmt'); + add_default($nl, 'clubb_mf_kseed'); + add_default($nl, 'do_clubb_mf_lscale_perplume'); + add_default($nl, 'do_clubb_mf_coldpool_perplume'); + add_default($nl, 'do_clubb_mf_coldpool_init'); } # Force exit if running cam_dev and CLUBB is off diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index e4302a3eaf..2f39c675de 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2191,6 +2191,10 @@ 1 .false. .false. + .false. + .false. + .false. + 1 .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 22c37bdf70..b712043158 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4410,6 +4410,30 @@ If .true. turn on convective momentum transport Default: .false. + +If .true. set unique entrainment length scale for each plume member +Default: .false. + + + +If .true. let cold pool feedback impact plume intialization +Default: .false. + + + +If .true. set cold pool feedback to unique to each plume member +Default: .false. + + + +Real: level position of state used to seed the random number generator +Default: 1 + + 0._r8) mf_freq_nadv(i) = mf_freq_nadv(i) + 1._r8 + if (ANY(mf_ztop(i,:) > 0._r8)) mf_freq_nadv(i) = mf_freq_nadv(i) + 1._r8 mf_thlforcup_nadv(i,:pverp) = mf_thlforcup_nadv(i,:pverp) + mf_thlforcup(i,:pverp) mf_qtforcup_nadv(i,:pverp) = mf_qtforcup_nadv(i,:pverp) + mf_qtforcup(i,:pverp) @@ -4311,8 +4311,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & if (t==1) then - ztop_macmic1(:ncol,macmic_it) = mf_ztopm1(:ncol) - ddcp_macmic1(:ncol,macmic_it) = mf_ddcp(:ncol) + do i=1,ncol + ztop_macmic1(i,macmic_it) = MAXVAL(mf_ztopm1(i,:)) + ddcp_macmic1(i,macmic_it) = MAXVAL(mf_ddcp(i,:)) + end do do k=1,nlev+1 flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upw(:ncol,k,:clubb_mf_nup) @@ -4410,8 +4412,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & else if (t==2) then - ztop_macmic2(:ncol,macmic_it) = mf_ztopm1(:ncol) - ddcp_macmic2(:ncol,macmic_it) = mf_ddcp(:ncol) + do i=1,ncol + ztop_macmic2(i,macmic_it) = MAXVAL(mf_ztopm1(i,:)) + ddcp_macmic2(i,macmic_it) = MAXVAL(mf_ddcp(i,:)) + end do do k=1,nlev+1 flip(:ncol,pverp-k+1,:clubb_mf_nup) = mf_upw(:ncol,k,:clubb_mf_nup) @@ -4663,8 +4667,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & mf_freq_nadv = mf_freq_nadv/REAL(nadv) ! accumulate in buffer - ztopm1_macmic(:ncol) = ztopm1_macmic(:ncol) + mf_ztopm1_nadv(:ncol) - ddcp_macmic(:ncol) = ddcp_macmic(:ncol) + mf_ddcp_nadv(:ncol) + ztopm1_macmic(:ncol,:) = ztopm1_macmic(:ncol,:) + mf_ztopm1_nadv(:ncol,:) + ddcp_macmic(:ncol,:) = ddcp_macmic(:ncol,:) + mf_ddcp_nadv(:ncol,:) cbm1_macmic(:ncol) = cbm1_macmic(:ncol) + mf_cbm1_nadv(:ncol) if (macmic_it == cld_macmic_num_steps) then @@ -4672,30 +4676,30 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & cbm1(:ncol) = cbm1_macmic(:ncol)/REAL(cld_macmic_num_steps) if (clubb_mf_up_ndt == 1) then - ztopma(:ncol) = ztopm1_macmic(:ncol)/REAL(cld_macmic_num_steps) + ztopma(:ncol,:) = ztopm1_macmic(:ncol,:)/REAL(cld_macmic_num_steps) else - ztopmn(2:clubb_mf_up_ndt,:ncol) = ztopmn(1:clubb_mf_up_ndt-1,:ncol) - ztopmn(1,:ncol) = ztopm1_macmic(:ncol)/REAL(cld_macmic_num_steps) - ztopma(:ncol) = 0._r8 + ztopmn(2:clubb_mf_up_ndt,:ncol,:) = ztopmn(1:clubb_mf_up_ndt-1,:ncol,:) + ztopmn(1,:ncol,:) = ztopm1_macmic(:ncol,:)/REAL(cld_macmic_num_steps) + ztopma(:ncol,:) = 0._r8 do t=1,clubb_mf_up_ndt - ztopma(:ncol) = ztopma(:ncol) + ztopmn(t,:ncol) + ztopma(:ncol,:) = ztopma(:ncol,:) + ztopmn(t,:ncol,:) end do - ztopma(:ncol) = ztopma(:ncol)/REAL(clubb_mf_up_ndt) + ztopma(:ncol,:) = ztopma(:ncol,:)/REAL(clubb_mf_up_ndt) end if if (clubb_mf_cp_ndt == 1) then - ddcp(:ncol) = ddcp_macmic(:ncol)/REAL(cld_macmic_num_steps) + ddcp(:ncol,:) = ddcp_macmic(:ncol,:)/REAL(cld_macmic_num_steps) else - ddcpmn(2:clubb_mf_cp_ndt,:ncol) = ddcpmn(1:clubb_mf_cp_ndt-1,:ncol) - ddcpmn(1,:ncol) = ddcp_macmic(:ncol)/REAL(cld_macmic_num_steps) - ddcp(:ncol) = 0._r8 + ddcpmn(2:clubb_mf_cp_ndt,:ncol,:) = ddcpmn(1:clubb_mf_cp_ndt-1,:ncol,:) + ddcpmn(1,:ncol,:) = ddcp_macmic(:ncol,:)/REAL(cld_macmic_num_steps) + ddcp(:ncol,:) = 0._r8 do t=1,clubb_mf_cp_ndt - ddcp(:ncol) = ddcp(:ncol) + ddcpmn(t,:ncol) + ddcp(:ncol,:) = ddcp(:ncol,:) + ddcpmn(t,:ncol,:) end do - ddcp(:ncol) = ddcp(:ncol)/REAL(clubb_mf_cp_ndt) + ddcp(:ncol,:) = ddcp(:ncol,:)/REAL(clubb_mf_cp_ndt) end if - ddcp(:ncol) = clubb_mf_ddalph*ddcp(:ncol) + ddcp(:ncol,:) = clubb_mf_ddalph*ddcp(:ncol,:) end if @@ -4931,14 +4935,15 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & !if (mf_ztop_nadv == 0._r8) mf_ztop_nadv = fillvalue !if (mf_L0_nadv == 0._r8) mf_L0_nadv = fillvalue - !mf_ztop_output(i) = ztopma(i) !mf_ztop_nadv - mf_ztop_output(:ncol) = mf_ztop_nadv(:ncol) + do i=1,ncol + mf_ztop_output(i) = MAXVAL(ztopma(i,:)) + !mf_ztop_output(i) = MAXVAL(mf_ztop_nadv(i,:)) + mf_ddcp_output(i) = MAXVAL(ddcp(i,:)) + !mf_ddcp_output(i) = MAXVAL(mf_ddcp_nadv(i,:)) + mf_L0_output(i) = MAXVAL(mf_L0_nadv(i,:)) + end do - mf_L0_output(:ncol) = mf_L0_nadv(:ncol) mf_cfl_output(:ncol) = max_cfl_nadv(:ncol) - - !mf_ddcp_output(i) = ddcp(i) !mf_ddcp_nadv !ddcp(i) - mf_ddcp_output(:ncol) = mf_ddcp_nadv(:ncol) mf_freq_output(:ncol) = mf_freq_nadv(:ncol) do k=1,clubb_mf_nup diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index a3929275bb..5da4cf73d9 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -54,6 +54,7 @@ module clubb_mf real(r8) :: clubb_mf_ddexp = 0._r8 integer :: clubb_mf_up_ndt = 1 integer :: clubb_mf_cp_ndt = 1 + integer :: clubb_mf_kseed = 1 integer, protected :: clubb_mf_nup = 0 logical, protected :: do_clubb_mf = .false. logical, protected :: do_clubb_mf_diag = .false. @@ -64,6 +65,9 @@ module clubb_mf logical, protected :: do_clubb_mf_precip = .false. logical, protected :: do_clubb_mf_rhtke = .false. logical, protected :: do_clubb_mf_cmt = .false. + logical, protected :: do_clubb_mf_coldpool_init = .false. + logical, protected :: do_clubb_mf_coldpool_perplume = .false. + logical, protected :: do_clubb_mf_lscale_perplume = .false. logical :: tht_tweaks = .true. integer :: mf_num_cin = 5 @@ -88,7 +92,8 @@ subroutine clubb_mf_readnl(nlfile) namelist /clubb_mf_nl/ clubb_mf_Lopt, clubb_mf_a0, clubb_mf_b0, clubb_mf_L0, clubb_mf_ent0, clubb_mf_alphturb, & clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & - clubb_mf_ddexp, do_clubb_mf_mixd, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_rhtke, do_clubb_mf_cmt + clubb_mf_ddexp, do_clubb_mf_mixd, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_rhtke, do_clubb_mf_cmt, & + do_clubb_mf_coldpool_init, do_clubb_mf_coldpool_perplume, do_clubb_mf_lscale_perplume, clubb_mf_kseed if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -150,6 +155,14 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_rhtke") call mpi_bcast(do_clubb_mf_cmt, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_cmt") + call mpi_bcast(clubb_mf_kseed, 1, mpi_integer, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_kseed") + call mpi_bcast(do_clubb_mf_coldpool_init, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_coldpool_init") + call mpi_bcast(do_clubb_mf_coldpool_perplume, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_coldpool_perplume") + call mpi_bcast(do_clubb_mf_lscale_perplume, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_lscae_perplume") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') @@ -250,7 +263,9 @@ subroutine integrate_mf( nz, real(r8), intent(in) :: pblh,tpert real(r8), intent(in) :: rhinv real(r8), intent(in) :: ths,ustar - real(r8), intent(inout) :: ztopm1,ddcp,cbm1 + real(r8), intent(inout) :: cbm1 + + real(r8),dimension(clubb_mf_nup), intent(inout) :: ztopm1,ddcp real(r8),dimension(nz,clubb_mf_nup), intent(out) :: upa, & ! momentum grid upw, & ! momentum grid @@ -297,8 +312,7 @@ subroutine integrate_mf( nz, sqt, sthl, & ! thermodynamic grid precc - real(r8), intent(out) :: ztop, dynamic_L0, & - mcape + real(r8),dimension(clubb_mf_nup), intent(out) :: ztop, dynamic_L0, mcape ! =============================================================================== ! ! INTERNAL VARIABLES ! @@ -333,8 +347,8 @@ subroutine integrate_mf( nz, ! other variables integer :: k,i,kstart,ddtop,kcb integer, dimension(clubb_mf_nup) :: ddbot,kcbarr - real(r8), dimension(clubb_mf_nup) :: zcb - real(r8) :: zcb_unset, cpfac, & + real(r8), dimension(clubb_mf_nup) :: zcb,cpfac + real(r8) :: zcb_unset, & wthv, ddint, iddcp, & wstar, qstar, thvstar, & sigmaw, sigmaqt, sigmathv,& @@ -453,6 +467,9 @@ subroutine integrate_mf( nz, ! ! limiter on cold pool effects real(r8),parameter :: max_cpfac = 5._r8 + ! + ! max limiter on cold pool init effects + real(r8),parameter :: max_cpinit = 0.5_r8 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!! BEGIN CODE !!!!!!!!!!!!!!!!!!!!!!! @@ -603,9 +620,13 @@ subroutine integrate_mf( nz, ! Compute cold pool feedback parameter ! ! --------------------------------------------------------- ! - cpfac = 1._r8 - if (do_clubb_mf_coldpool) cpfac = min( (max(ddcp/wstar,1._r8))**clubb_mf_ddbeta, max_cpfac ) - + cpfac(:) = 1._r8 + if (do_clubb_mf_coldpool) then + do i=1,clubb_mf_nup + cpfac(i) = min( (max(ddcp(i)/wstar,1._r8))**clubb_mf_ddbeta, max_cpfac ) + end do + end if + ! --------------------------------------------------------- ! ! Construct tri-variate PDF at the surface from wstar ! ! and initialize plume thv, qt, w ! @@ -618,15 +639,22 @@ subroutine integrate_mf( nz, qstar = wqt / wstar thvstar = wthv / wstar end if -!+++ARH - sigmaw = alphw * wstar !* cpfac - sigmaqt = alphqt * abs(qstar) !* cpfac - sigmathv = alphthv * abs(thvstar) !* cpfac - - wmin = sigmaw * pwmin - wmax = sigmaw * pwmax do i=1,clubb_mf_nup + + if (do_clubb_mf_coldpool_init) then + sigmaw = alphw * wstar * (1._r8 + max_cpinit*cpfac(i)/max_cpfac) + sigmaqt = alphqt * abs(qstar) * (1._r8 + max_cpinit*cpfac(i)/max_cpfac) + sigmathv = alphthv * abs(thvstar) * (1._r8 + max_cpinit*cpfac(i)/max_cpfac) + else + sigmaw = alphw * wstar + sigmaqt = alphqt * abs(qstar) + sigmathv = alphthv * abs(thvstar) + end if + + wmin = sigmaw * pwmin + wmax = sigmaw * pwmax + wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) @@ -688,34 +716,37 @@ subroutine integrate_mf( nz, end if end do - ! --------------------------------------------------------- ! - ! Calculate ztop and dynamic_L based on value of namelist ! - ! --------------------------------------------------------- ! - call get_Lscale (nz, zm, tke, wpthlp_env, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, th, & - wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, wa, wb, & - do_condensation, qv, p_zt, zt, tpert, pblh, convh, rhinv, ztopm1, dynamic_L0, ztop, mcape) - - ! cold pool feedback on the entrainmnet length scale - dynamic_L0 = dynamic_L0 * cpfac - - ! limit max/min - dynamic_L0 = max(min_L0,dynamic_L0) - dynamic_L0 = min(clubb_mf_max_L0,dynamic_L0) - - ! --------------------------------------------------------- ! - ! Stochastic entrainmnet calculation ! - ! From Suselj et al 2019, after Romps and Kuang 2010 ! - ! (ideally we wouldn't fill the entire arrray w/ the RNG, ! - ! but the RNG doesn't work properly when it operates on ! - ! the entire array. I'm not sure why this is happening.) ! - ! --------------------------------------------------------- ! - do k=1,nz-1 - ! get entrainment coefficient, dz/L0 - entf(k,:) = dzt(k) / dynamic_L0 + do i=1,clubb_mf_nup + ! --------------------------------------------------------- ! + ! Calculate ztop and dynamic_L based on value of namelist ! + ! --------------------------------------------------------- ! + call get_Lscale (nz, zm, tke, wpthlp_env, dzt, iexner_zm, iexner_zt, p_zm, qt, thv, thl, th, & + wmax, wmin, sigmaw, sigmaqt, sigmathv, cwqt, cwthv, zcb_unset, wa, wb, & + do_condensation, qv, p_zt, zt, tpert, pblh, convh, rhinv, ztopm1(i), dynamic_L0(i), ztop(i), mcape(i)) + + ! cold pool feedback on the entrainmnet length scale + dynamic_L0(i) = dynamic_L0(i) * cpfac(i) + + ! limit max/min + dynamic_L0(i) = max(min_L0,dynamic_L0(i)) + dynamic_L0(i) = min(clubb_mf_max_L0,dynamic_L0(i)) + + ! --------------------------------------------------------- ! + ! Stochastic entrainmnet calculation ! + ! From Suselj et al 2019, after Romps and Kuang 2010 ! + ! (ideally we wouldn't fill the entire arrray w/ the RNG, ! + ! but the RNG doesn't work properly when it operates on ! + ! the entire array. I'm not sure why this is happening.) ! + ! --------------------------------------------------------- ! + do k=1,nz-1 + ! get entrainment coefficient, dz/L0 + entf(k,i) = dzt(k) / dynamic_L0(i) + end do + ! end do ! get poisson, P(dz/L0) - call poisson( nz, clubb_mf_nup, entf, enti, u(2:5)) + call poisson( nz, clubb_mf_nup, entf, enti, u(clubb_mf_kseed+1:clubb_mf_kseed+4)) ! --------------------------------------------------------- ! ! Main upward sweep to compute updraft properties ! @@ -778,7 +809,7 @@ subroutine integrate_mf( nz, thvn, qcn, thn, qln, qin, qsn, lmixn) ! critical stopping distance - cridis = rle*ztopm1 + cridis = rle*ztopm1(i) ! ----------------------------------------------------------------- ! ! Case 1 : When both cumulus and env. are unsaturated or saturated. ! @@ -857,7 +888,7 @@ subroutine integrate_mf( nz, rh_L0 = 50._r8*(rhinv**3._r8) if (rh_L0 >= 733.34_r8) eturb = 1._r8 else - if (dynamic_L0 >= clubb_mf_max_L0) eturb = 1._r8 + if (dynamic_L0(i) >= clubb_mf_max_L0) eturb = 1._r8 end if entn = entn * eturb @@ -1044,7 +1075,7 @@ subroutine integrate_mf( nz, entn = fixent_ent else ! use deterministic mean entrainment - entn = clubb_mf_ent0/dynamic_L0 + entn = clubb_mf_ent0/dynamic_L0(i) end if ! downdraft qsat @@ -1316,17 +1347,23 @@ subroutine integrate_mf( nz, ! --------------------------------------------------------- ! ! ztopm1 calculation ! ! --------------------------------------------------------- ! - do k=1,nz - ! retrun if no convection at k=2 - if (k == 2 .and. ac(k) == 0._r8) then - sqt(k) = 0_r8 - sthl(k) = 0._r8 - ztopm1 = zm(1) - ddcp = 0._r8 - return - end if - ! height of the plume ensemble - if (ac(k) > 0._r8) ztopm1 = zm(k) + do i=1,clubb_mf_nup + do k=1,nz + ! return if no convection at k=2 + if (k == 2 .and. ac(k) == 0._r8) then + sqt(k) = 0_r8 + sthl(k) = 0._r8 + ztopm1(:) = zm(1) + ddcp(:) = 0._r8 + return + end if + ! height of the plume ensemble + if (do_clubb_mf_lscale_perplume) then + if ((upa(k,i)+dna(k,i)) > 0._r8) ztopm1(i) = zm(k) + else + if (ac(k) > 0._r8) ztopm1(:) = zm(k) + end if + end do end do ! --------------------------------------------------------- ! @@ -1392,7 +1429,7 @@ subroutine integrate_mf( nz, ! end do ! - ddcp = 0._r8 + ddcp(:) = 0._r8 if (do_clubb_mf_coldpool .and. clubb_mf_fdd > 0._r8) then ! use single level for cold pool param. ! reset ddcp @@ -1400,9 +1437,14 @@ subroutine integrate_mf( nz, if (ddbot(i) == 0) then continue else - ddcp = ddcp + (-1._r8)*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) + if (do_clubb_mf_coldpool_perplume) then + ddcp(i) = -1._r8*dnw(ddbot(i)+1,i) + else + ddcp(:) = ddcp(:) + -1._r8*dna(ddbot(i)+1,i)*dnw(ddbot(i)+1,i) + end if end if end do + ! end if !---ARH @@ -1457,8 +1499,8 @@ subroutine integrate_mf( nz, enddo ! else - ddcp = 0._r8 - ztopm1 = zm(1) + ddcp(:) = 0._r8 + ztopm1(:) = zm(1) end if ! ( wthv > 0.0 ) end subroutine integrate_mf From 81a9081c871d3daaf2b572dab299bc5f0b79b4ee Mon Sep 17 00:00:00 2001 From: adamrher Date: Fri, 17 Nov 2023 15:33:49 -0700 Subject: [PATCH 166/466] add addtke namelist --- bld/build-namelist | 1 + bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 ++++++ src/physics/cam/clubb_intr.F90 | 11 ++++++++--- src/physics/cam/clubb_mf.F90 | 11 ++++++++--- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 275507acb1..897943d5d3 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3384,6 +3384,7 @@ if ($clubb_sgs =~ /$TRUE/io) { add_default($nl, 'do_clubb_mf_diag'); add_default($nl, 'do_clubb_mf_rad'); add_default($nl, 'do_clubb_mf_precip'); + add_default($nl, 'do_clubb_mf_addtke'); add_default($nl, 'clubb_mf_L0'); add_default($nl, 'clubb_mf_ent0'); add_default($nl, 'clubb_mf_alphturb'); diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 19f2e86578..f6f6b7da5b 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2172,6 +2172,7 @@ .false. .false. .false. + .false. 50.0 0.2 0.0 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 9c0ae7437e..3fad6ad352 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4318,6 +4318,12 @@ If .true. couple MF plumes to radiation Default: .false. + +If .true. add MF contribution to TKE pbuf variable +Default: .false. + + Entrainment length scale in meters for individual plumes. Not used if diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d670cdd904..809287c4ce 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -34,10 +34,9 @@ module clubb_intr use clubb_api_module, only: pdf_parameter, implicit_coefs_terms use clubb_api_module, only: clubb_config_flags_type, grid, stats, nu_vertical_res_dep use clubb_api_module, only: nparams - use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag use cloud_fraction, only: dp1, dp2 use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad, clubb_mf_Lopt, & - clubb_mf_ddalph, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_cmt + clubb_mf_ddalph, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_cmt, do_clubb_mf_addtke use cam_history_support, only: add_hist_coord #endif @@ -5446,7 +5445,13 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wprtp_output(i,k) = wprtp(i,k) rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy + + if (do_clubb_mf_addtke) then + tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)+s_aww_output(i,k)) ! turbulent kinetic energy + else + tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy + end if + if (do_clubb_mf) then ! comment out for kinemtatic fluxes !mf_thlflx_output(i,k) = mf_thlflx_output(i,k)*rho(i,k)*cpair diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 5da4cf73d9..86973a515a 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -28,7 +28,8 @@ module clubb_mf clubb_mf_ddalph, & clubb_mf_up_ndt, & clubb_mf_cp_ndt, & - do_clubb_mf_cmt + do_clubb_mf_cmt, & + do_clubb_mf_addtke ! ! Lopt 0 = fixed L0 @@ -59,6 +60,7 @@ module clubb_mf logical, protected :: do_clubb_mf = .false. logical, protected :: do_clubb_mf_diag = .false. logical, protected :: do_clubb_mf_rad = .false. + logical, protected :: do_clubb_mf_addtke = .false. logical, protected :: do_clubb_mf_coldpool = .false. logical, protected :: do_clubb_mf_ustar = .false. logical, protected :: do_clubb_mf_mixd = .false. @@ -93,7 +95,8 @@ subroutine clubb_mf_readnl(nlfile) clubb_mf_nup, clubb_mf_max_L0, do_clubb_mf, do_clubb_mf_diag, do_clubb_mf_precip, do_clubb_mf_rad, & clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & clubb_mf_ddexp, do_clubb_mf_mixd, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_rhtke, do_clubb_mf_cmt, & - do_clubb_mf_coldpool_init, do_clubb_mf_coldpool_perplume, do_clubb_mf_lscale_perplume, clubb_mf_kseed + do_clubb_mf_coldpool_init, do_clubb_mf_coldpool_perplume, do_clubb_mf_lscale_perplume, clubb_mf_kseed, & + do_clubb_mf_addtke if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -162,7 +165,9 @@ subroutine clubb_mf_readnl(nlfile) call mpi_bcast(do_clubb_mf_coldpool_perplume, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_coldpool_perplume") call mpi_bcast(do_clubb_mf_lscale_perplume, 1, mpi_logical, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_lscae_perplume") + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_lscale_perplume") + call mpi_bcast(do_clubb_mf_addtke, 1, mpi_logical, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_addtke") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') From 74216f2466efc60ea16f0f4dd7f5d6e8e99553d1 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 9 May 2024 18:51:49 -0600 Subject: [PATCH 167/466] addtke change (not complete, needs kvh mods too) --- .../usermods_dirs/scam_LBA/shell_commands | 4 +- src/cpl/nuopc/atm_comp_nuopc.F90 | 48 +++++++++---------- src/physics/cam/clubb_intr.F90 | 14 +++--- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/cime_config/usermods_dirs/scam_LBA/shell_commands b/cime_config/usermods_dirs/scam_LBA/shell_commands index 9f032524f3..7a8a485cbf 100755 --- a/cime_config/usermods_dirs/scam_LBA/shell_commands +++ b/cime_config/usermods_dirs/scam_LBA/shell_commands @@ -1,7 +1,7 @@ # setup SCAM lon and lat for this iop # this should correspond to the forcing IOP coordinates -#./xmlchange PTS_LON=0.0 -./xmlchange PTS_LON=295. +./xmlchange PTS_LON=0.0 +#./xmlchange PTS_LON=295. ./xmlchange PTS_LAT=0.0 # Specify the starting/ending time for the IOP diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index 3462e2b7c5..6b57a3610d 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -911,12 +911,12 @@ subroutine DataInitialize(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return else !+++ARH - if (masterproc) then - write(iam+1000,*) '--------------' - write(iam+1000,*) 'DataInitialize' - write(iam+1000,*) ' cam_run1 sets cam_out' - write(iam+1000,*) ' nstep=',get_nstep() - end if +! if (masterproc) then +! write(iam+1000,*) '--------------' +! write(iam+1000,*) 'DataInitialize' +! write(iam+1000,*) ' cam_run1 sets cam_out' +! write(iam+1000,*) ' nstep=',get_nstep() +! end if !---ARH call cam_read_srfrest( gcomp, clock, rc=rc ) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -1102,12 +1102,12 @@ subroutine ModelAdvance(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return call t_stopf ('CAM_import') !+++ARH - if (masterproc) then - write(iam+1000,*) '--------------' - write(iam+1000,*) 'Model Advance' - write(iam+1000,*) ' CAM_import sets cam_in' - write(iam+1000,*) ' nstep=',get_nstep() - end if +! if (masterproc) then +! write(iam+1000,*) '--------------' +! write(iam+1000,*) 'Model Advance' +! write(iam+1000,*) ' CAM_import sets cam_in' +! write(iam+1000,*) ' nstep=',get_nstep() +! end if !---ARH end if @@ -1162,12 +1162,12 @@ subroutine ModelAdvance(gcomp, rc) call t_stopf ('CAM_run4') !+++ARH - if (masterproc) then - write(iam+1000,*) '--------------' - write(iam+1000,*) 'ModelAdvance' - write(iam+1000,*) ' cam_run2,cam_run3,cam_run4' - write(iam+1000,*) ' nstep=',get_nstep() - end if +! if (masterproc) then +! write(iam+1000,*) '--------------' +! write(iam+1000,*) 'ModelAdvance' +! write(iam+1000,*) ' cam_run2,cam_run3,cam_run4' +! write(iam+1000,*) ' nstep=',get_nstep() +! end if !---ARH ! Advance cam time step @@ -1183,12 +1183,12 @@ subroutine ModelAdvance(gcomp, rc) call t_stopf ('CAM_run1') !+++ARH - if (masterproc) then - write(iam+1000,*) '--------------' - write(iam+1000,*) 'ModelAdvance' - write(iam+1000,*) ' CAM_adv_timestep,cam_run1' - write(iam+1000,*) ' nstep=',get_nstep() - end if +! if (masterproc) then +! write(iam+1000,*) '--------------' +! write(iam+1000,*) 'ModelAdvance' +! write(iam+1000,*) ' CAM_adv_timestep,cam_run1' +! write(iam+1000,*) ' nstep=',get_nstep() +! end if !---ARH end do diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 809287c4ce..716ee86c1e 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4776,7 +4776,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & rtm(i,pverp-k+1) = rtm_in(i,k) wprtp(i,pverp-k+1) = wprtp_in(i,k) wpthlp(i,pverp-k+1) = wpthlp_in(i,k) - wp2(i,pverp-k+1) = wp2_in(i,k) +!+++ARH This where wp2 pbuf is set + if (do_clubb_mf_addtke) then + wp2(i,pverp-k+1) = wp2_in(i,k) + s_aww(i,k) + else + wp2(i,pverp-k+1) = wp2_in(i,k) + end if wp3(i,pverp-k+1) = wp3_in(i,k) rtp2(i,pverp-k+1) = rtp2_in(i,k) thlp2(i,pverp-k+1) = thlp2_in(i,k) @@ -5445,12 +5450,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & wprtp_output(i,k) = wprtp(i,k) rtpthlp_output(i,k) = rtpthlp(i,k)-(apply_const*rtpthlp_const) ! rtpthlp output wp3_output(i,k) = wp3(i,k) - (apply_const*wp3_const) ! wp3 output - - if (do_clubb_mf_addtke) then - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)+s_aww_output(i,k)) ! turbulent kinetic energy - else - tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy - end if + tke(i,k) = 0.5_r8*(up2(i,k)+vp2(i,k)+wp2(i,k)) ! turbulent kinetic energy if (do_clubb_mf) then ! comment out for kinemtatic fluxes From c60c3317c8544d8feb7e3f5f7f8ee816a82250d4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 9 May 2024 20:55:16 -0600 Subject: [PATCH 168/466] fixed merge conflict w/ externals --- Externals_CAM.cfg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Externals_CAM.cfg b/Externals_CAM.cfg index 8be017d091..98872f4b97 100644 --- a/Externals_CAM.cfg +++ b/Externals_CAM.cfg @@ -23,11 +23,11 @@ required = True [clubb] local_path = src/physics/clubb protocol = git -#repo_url = https://github.com/larson-group/clubb_release/tags/ -#tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag/src/CLUBB_core -repo_url = https://github.com/adamrher/clubb_release/branches/ +#repo_url = https://github.com/larson-group/clubb_release +repo_url = https://github.com/adamrher/clubb_release sparse = ../.clubb_sparse_checkout -branch = clubb_4ncar_20221129_59cb19f_20230330.clubbmf/src/CLUBB_core +#tag = clubb_4ncar_20221129_59cb19f_20230330_branchtag +branch = clubb_4ncar_20221129_59cb19f_20230330.clubbmf required = True [pumas] From 3d7e9654eee130f5eb39aa216832c0b180048a39 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 25 Sep 2024 13:36:53 -0600 Subject: [PATCH 169/466] remove Julio's scam mods --- src/dynamics/eul/get_ana_dynfrc_4scam.F90 | 1634 --------------------- 1 file changed, 1634 deletions(-) delete mode 100644 src/dynamics/eul/get_ana_dynfrc_4scam.F90 diff --git a/src/dynamics/eul/get_ana_dynfrc_4scam.F90 b/src/dynamics/eul/get_ana_dynfrc_4scam.F90 deleted file mode 100644 index 312402cdbe..0000000000 --- a/src/dynamics/eul/get_ana_dynfrc_4scam.F90 +++ /dev/null @@ -1,1634 +0,0 @@ -module get_ana_dynfrc_4scam - - use spmd_utils, only: masterproc - use cam_logfile, only: iulog - use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8, & - cs=>SHR_KIND_CS,cl=>SHR_KIND_CL - use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - pi => shr_const_pi , & - OOmega => shr_const_omega , & - rdair => shr_const_rdair , & - cpair => shr_const_cpdair - - use scamMod, only: use_scm_ana_frc, & - scm_ana_frc_path, & - scm_ana_frc_file_template, & - scm_ana_x_plevels, & - scm_ana_direct_omega, & - scm_ana_t_react, & - scm_ana_q_react, & - scm_ana_u_react, & - scm_ana_v_react, & - scm_ana_upwind, & - scm_ana_direct_ttend - - - - ! shr_const_mod is in ${CESMROOT}/cime/src/share/util/ - - implicit none - private - save - - public get_ana_dynfrc_fv -! -! Private module data -! - - real(r8) , save , allocatable :: T_1(:,:,:) , U_1(:,:,:), V_1(:,:,:), Q_1(:,:,:),PS_1(:,:),PHIS_1(:,:) - real(r8) , save , allocatable :: T_2(:,:,:) , U_2(:,:,:), V_2(:,:,:), Q_2(:,:,:),PS_2(:,:),PHIS_2(:,:) - real(r8) , save , allocatable :: UTCORE_1(:,:,:) , UTCORE_2(:,:,:) - real(r8) , save , allocatable :: VTCORE_1(:,:,:) , VTCORE_2(:,:,:) - real(r8) , save , allocatable :: TTCORE_1(:,:,:) , TTCORE_2(:,:,:) - real(r8) , save , allocatable :: OGCORE_1(:,:,:) , OGCORE_2(:,:,:) - real(r8) , save , allocatable :: lat_ana(:),lon_ana(:),lev_ana(:) - integer , save :: nlev_ana, nlon_ana, nlat_ana - - real(r8) , save , allocatable :: To_1(:,:,:) , Uo_1(:,:,:), Vo_1(:,:,:), Qo_1(:,:,:),PSo_1(:,:),PHISo_1(:,:) - real(r8) , save , allocatable :: To_2(:,:,:) , Uo_2(:,:,:), Vo_2(:,:,:), Qo_2(:,:,:),PSo_2(:,:),PHISo_2(:,:) - real(r8) , save , allocatable :: UTCOREo_1(:,:,:) , UTCOREo_2(:,:,:), UTCOREo_X(:,:,:) - real(r8) , save , allocatable :: VTCOREo_1(:,:,:) , VTCOREo_2(:,:,:), VTCOREo_X(:,:,:) - real(r8) , save , allocatable :: TTCOREo_1(:,:,:) , TTCOREo_2(:,:,:), TTCOREo_X(:,:,:) - real(r8) , save , allocatable :: OGCOREo_1(:,:,:) , OGCOREo_2(:,:,:), OGCOREo_X(:,:,:) - - - - real(r8) , save , allocatable :: ETAD_X(:,:,:) , OMG_X(:,:,:) - real(r8) , save , allocatable :: ZETA_X(:) - real(r8) , save , allocatable :: KEh_X(:,:,:) - real(r8) , save , allocatable :: Tv_X(:,:,:) - - real(r8) , save , allocatable :: pke_X(:,:,:),pko_X(:,:,:),phik_X(:,:,:),Thv_X(:,:,:) - real(r8) , save , allocatable :: ple_X(:,:,:) , plo_X(:,:,:), phi_X(:,:,:) - - real(r8) , save , allocatable :: To_X(:,:,:) , Uo_X(:,:,:), Vo_X(:,:,:), Qo_X(:,:,:),PSo_X(:,:),PHISo_X(:,:) - - -!======================================================================= -contains -!======================================================================= - -subroutine get_ana_dynfrc_fv ( scmlon, scmlat , & - omega_ana, etad_ana, zeta_ana, & - t_ana , tv_ana , & - q_ana , & - u_ana , & - v_ana , & - ps_ana , & - uten_hadv_ana , & - vten_hadv_ana , & - uten_pfrc_ana , & - vten_pfrc_ana , & - uten_vort_ana , & - vten_vort_ana , & - qten_hadv_ana , & - tten_hadv_ana , & - uten_vadv_ana , & - vten_vadv_ana , & - tten_vadv_ana , & - qten_vadv_ana , & - tten_comp_ana , & - uten_keg_ana , & - uten_phig_ana , & - uten_prg_ana , & - uten_dycore_ana , & - vten_dycore_ana , & - tten_dycore_ana , & - omega_dycore_ana , & - omega_recalc_ana , & - u_scm, v_scm, t_scm, q_scm, & - u_ana_diag, v_ana_diag, t_ana_diag, q_ana_diag ) - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! US and VS are input (D-grid velocities) -!-------------------------------------------- -! ub(i,j,L)= 0.5*(us(i-1,j,L) + us(i,j,L)) -! vb(i,j,L)= 0.5*(vs(i,j,L) + vs(i,j+1,L)) -! -! uc(i,j,L)= 0.5*(ub(i,j,L) + ub(i,j-1,L)) -! vc(i,j,L)= 0.5*(vb(i,j-1,L) + vb(i+1,j-1,L)) -!--------------------------------------------- -! Grid arrangement in FV latlon h,i-files -!--------------------------------------------- -! J=NY -! ... -! -! ub,vb(I,J) us(I,J),vc(I,J+1) -! -! -! vs(I,J),uc(I,J) ua,va,T,p(I,J) vs(I+1,J),uc(I+1,J) -! -! -! vc(I,J) -! -! -! ua,va,T,p(I,J-1) -! -! ... -! J=1 ... -!---------------------------------------------- - - use pmgrid, only : plev, plat, plevp, plon - use hycoef, only: hyai, hybi, ps0, hyam, hybm - use filenames, only: interpret_filename_spec - use time_manager, only: timemgr_time_ge,timemgr_time_inc,get_curr_date,get_step_size,is_first_step - use netcdf - use cam_abortutils, only: endrun - use ref_pres, only: pref_mid ! In Pascal - - real(r8), intent(in) :: scmlon, scmlat - real(r8), intent(out) :: omega_ana( plev ) - real(r8), intent(out) :: etad_ana(plev) - real(r8), intent(out) :: t_ana(plev) , tv_ana(plev) - real(r8), intent(out) :: zeta_ana(plev) - real(r8), intent(out) :: u_ana(plev) - real(r8), intent(out) :: v_ana(plev) - real(r8), intent(out) :: q_ana(plev) - real(r8), intent(out) :: ps_ana - real(r8), intent(out) :: uten_hadv_ana( plev ) - real(r8), intent(out) :: vten_hadv_ana( plev ) - real(r8), intent(out) :: uten_pfrc_ana( plev ) - real(r8), intent(out) :: vten_pfrc_ana( plev ) - real(r8), intent(out) :: qten_hadv_ana( plev ) - real(r8), intent(out) :: tten_hadv_ana( plev ) - real(r8), intent(out) :: qten_vadv_ana( plev ) - real(r8), intent(out) :: tten_vadv_ana( plev ) - real(r8), intent(out) :: uten_vadv_ana( plev ) - real(r8), intent(out) :: vten_vadv_ana( plev ) - - real(r8), intent(out) :: tten_comp_ana( plev ) - - real(r8), intent(out) :: uten_keg_ana( plev ) - real(r8), intent(out) :: uten_prg_ana( plev ) - real(r8), intent(out) :: uten_phig_ana( plev ) - real(r8), intent(out) :: uten_vort_ana( plev ) - real(r8), intent(out) :: vten_vort_ana( plev ) - real(r8), intent(out) :: uten_dycore_ana( plev ) - real(r8), intent(out) :: vten_dycore_ana( plev ) - real(r8), intent(out) :: tten_dycore_ana( plev ) - real(r8), intent(out) :: omega_recalc_ana( plev ) - real(r8), intent(out) :: omega_dycore_ana( plev ) - - real(r8), intent(in) :: u_scm(plev) - real(r8), intent(in) :: v_scm(plev) - real(r8), intent(in) :: t_scm(plev) - real(r8), intent(in) :: q_scm(plev) - - real(r8), intent(out) :: u_ana_diag(plev) - real(r8), intent(out) :: v_ana_diag(plev) - real(r8), intent(out) :: t_ana_diag(plev) - real(r8), intent(out) :: q_ana_diag(plev) - - integer, save :: iax, jax - integer, save :: Read_year2, Read_month2, Read_day2, Read_sec2, Read_YMD2 - integer, save :: nlev_alc, nlon_alc, nlat_alc - - !!logical , parameter :: l_vectinv = .FALSE. - !!real(r8) :: tv_ana(plev) - real(r8) :: rho_ana( plev ), plo_ana(plev) - - - - real(r8) :: scmlonx - - real(r8) :: ana_wgt1 , ana_wgt2 , dx0, dy, darea - - integer :: nx, ny,i,j,k,L,LM, iav(1),jav(1),iac,jac - - real(r8) , allocatable :: rlats(:),rlons(:) - real(r8) :: zeta(plev),absvo(plev) - ! Horz. gradient profiles (1=X, 2=Y) - real(r8) :: kehg_ana(plev,2),kehg_X(plev,2) - real(r8) :: phig_ana(plev,2),phig_X(plev,2) - real(r8) :: plog_ana(plev,2),plog_X(plev,2) - real(r8) :: teg_ana(plev,2), teg_X(plev,2) - real(r8) :: qg_ana(plev,2), qg_X(plev,2) - real(r8) :: ug_ana(plev,2), ug_X(plev,2) - real(r8) :: vg_ana(plev,2), vg_X(plev,2) - real(r8) :: lin_pfc_ana(plev,2) , lin_pfc_X(plev,2) - - real(r8) :: omega_ana_x(plev) - real(r8) :: alpha_react(plev) - - real(r8) :: lat_alc(3) , lon_alc(3) - real(r8) :: aalc(3,3,plev) - - - character(len=CL):: Ana_File_Template,Ana_file1,Ana_file2,Ana_Path - - - integer :: dyn_year,dyn_month,dyn_day,dyn_sec,year,month,day,sec - integer :: dyn_step,ymd1,ymd2,curr_sec,next_sec,curr_year,curr_month,curr_day,curr_ymd - - integer :: analysis_step - integer :: ana_year1, ana_month1, ana_day1, ana_sec1 - integer :: ana_year2, ana_month2, ana_day2, ana_sec2 - - logical :: l_Read_next_Ana, Alarm_Read_ana, Alarm_Bump_ana, initialize - - write(iulog,*) " version 07 of get_ana_dynfrc_4scam ... " - - - Alarm_Read_Ana = .FALSE. - Alarm_Bump_Ana = .FALSE. - - if ( scmlon < 0 ) then - scmlonx = scmlon + 360._r8 - else - scmlonx = scmlon - end if - - ! Default to 6 hour steps between ana - analysis_step = 6 * 3600 - - - Ana_path = trim(scm_ana_frc_path) - Ana_File_Template = trim(Ana_path)//trim(scm_ana_frc_file_template) - - - call get_curr_date(Year,Month,Day,Sec) - - curr_ymd = (Year*10000) + (Month*100) + Day - curr_sec = Sec - - ana_sec1 = ( Sec / analysis_step ) * analysis_step - ana_day1 = Day - ana_month1 = Month - ana_year1 = Year - - YMD1=(Ana_Year1*10000) + (Ana_Month1*100) + Ana_Day1 - - - call timemgr_time_inc(YMD1,Ana_Sec1, & - YMD2,Ana_Sec2,Analysis_Step,0,0) - - Ana_Year2 = YMD2 / 10000 - Ana_Month2 = (YMD2 - Ana_Year2*10000)/100 - Ana_Day2 = YMD2 - Ana_Year2*10000 - Ana_Month2*100 - - Ana_File1 = interpret_filename_spec(Ana_File_Template , & - yr_spec=Ana_Year1 , & - mon_spec=Ana_Month1, & - day_spec=Ana_Day1 , & - sec_spec=Ana_Sec1 ) - - Ana_File2 = interpret_filename_spec(Ana_File_Template , & - yr_spec=Ana_Year2 , & - mon_spec=Ana_Month2, & - day_spec=Ana_Day2 , & - sec_spec=Ana_Sec2 ) - - - l_Read_next_Ana = .FALSE. - ! On first time step, read in 2 analysis files - if (is_first_step().and.masterproc) then - write(iulog,*) " It's now (First time step):" , curr_YMD, curr_sec - write(iulog,*) "Read Initial ana files " - write(iulog,*) Ana_file1 - write(iulog,*) Ana_file2 - Alarm_Read_Ana = .TRUE. - Alarm_Bump_Ana = .FALSE. - else - ! On subsequent steps test to see if "Curr" date is later or same as "Read". - ! If it is, then l_read_next_ana=.TRUE. - call timemgr_time_ge(Read_ymd2, Read_Sec2, curr_YMD, curr_Sec, l_Read_next_ana ) - endif - - if (l_Read_next_Ana) then - Alarm_Read_Ana = .TRUE. - Alarm_Bump_Ana = .TRUE. - endif - - ! Aloocate space for analysis fields. - ! Read in both Initial Analysis files. Nothing to bump yet - if ( (Alarm_Read_Ana ) .AND. .NOT.(Alarm_Bump_Ana) ) then - initialize=.TRUE. - call read_netcdf_ana_fv_ini ( Ana_File1, nlon_ana, nlat_ana, nlev_ana ,iax, jax ) - - if ( plev /= nlev_ana) then - call endrun ("SCAM plev NE nlev_ana") - end if - - ! Full global fields - allocate( lat_ana(nlat_ana) , lon_ana(nlon_ana), lev_ana(nlev_ana) ) - allocate( U_1(nlon_ana, nlat_ana, nlev_ana), V_1(nlon_ana, nlat_ana, nlev_ana), T_1(nlon_ana, nlat_ana, nlev_ana), & - Q_1(nlon_ana, nlat_ana, nlev_ana), PS_1 (nlon_ana, nlat_ana ), PHIS_1 (nlon_ana, nlat_ana ) ) - allocate( U_2(nlon_ana, nlat_ana, nlev_ana), V_2(nlon_ana, nlat_ana, nlev_ana), T_2(nlon_ana, nlat_ana, nlev_ana), & - Q_2(nlon_ana, nlat_ana, nlev_ana), PS_2 (nlon_ana, nlat_ana ), PHIS_2 (nlon_ana, nlat_ana ) ) - - allocate( UTCORE_1(nlon_ana, nlat_ana, nlev_ana), UTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) - allocate( VTCORE_1(nlon_ana, nlat_ana, nlev_ana), VTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) - allocate( TTCORE_1(nlon_ana, nlat_ana, nlev_ana), TTCORE_2(nlon_ana, nlat_ana, nlev_ana) ) - allocate( OGCORE_1(nlon_ana, nlat_ana, nlev_ana), OGCORE_2(nlon_ana, nlat_ana, nlev_ana) ) - - ! SCM "patches" - nlon_alc=3 - nlat_alc=3 - nlev_alc=nlev_ana - - - - ! Patches of full global fields - allocate( Uo_1(nlon_alc, nlat_alc, nlev_alc), Vo_1(nlon_alc, nlat_alc, nlev_alc), To_1(nlon_alc, nlat_alc, nlev_alc), & - Qo_1(nlon_alc, nlat_alc, nlev_alc), PSo_1 (nlon_alc, nlat_alc ), PHISo_1 (nlon_alc, nlat_alc ) ) - allocate( Uo_2(nlon_alc, nlat_alc, nlev_alc), Vo_2(nlon_alc, nlat_alc, nlev_alc), To_2(nlon_alc, nlat_alc, nlev_alc), & - Qo_2(nlon_alc, nlat_alc, nlev_alc), PSo_2 (nlon_alc, nlat_alc ), PHISo_2 (nlon_alc, nlat_alc ) ) - - allocate( UTCOREo_1(nlon_alc, nlat_alc, nlev_alc), UTCOREo_2(nlon_alc, nlat_alc, nlev_alc), UTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) - allocate( VTCOREo_1(nlon_alc, nlat_alc, nlev_alc), VTCOREo_2(nlon_alc, nlat_alc, nlev_alc), VTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) - allocate( TTCOREo_1(nlon_alc, nlat_alc, nlev_alc), TTCOREo_2(nlon_alc, nlat_alc, nlev_alc), TTCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) - allocate( OGCOREo_1(nlon_alc, nlat_alc, nlev_alc), OGCOREo_2(nlon_alc, nlat_alc, nlev_alc), OGCOREo_X(nlon_alc, nlat_alc, nlev_alc) ) - - allocate( Uo_X(nlon_alc, nlat_alc, nlev_alc), Vo_X(nlon_alc, nlat_alc, nlev_alc), To_X(nlon_alc, nlat_alc, nlev_alc), & - Qo_X(nlon_alc, nlat_alc, nlev_alc), PSo_X (nlon_alc, nlat_alc ), PHISo_X (nlon_alc, nlat_alc ) ) - allocate( ETAD_X(nlon_alc,nlat_alc,nlev_alc) ) - allocate( OMG_X(nlon_alc,nlat_alc,nlev_alc) ) - allocate( ple_X(nlon_alc, nlat_alc, nlev_alc+1), plo_X(nlon_alc, nlat_alc, nlev_alc), phi_X(nlon_alc, nlat_alc, nlev_alc+1) ) - allocate( pke_X(nlon_alc, nlat_alc, nlev_alc+1), pko_X(nlon_alc, nlat_alc, nlev_alc), phik_X(nlon_alc, nlat_alc, nlev_alc+1) ) - allocate( THv_X(nlon_alc, nlat_alc, nlev_alc ) ) - allocate( zeta_X(nlev_alc) ) - allocate( KEh_X(nlon_alc, nlat_alc, nlev_alc ) ) - allocate( Tv_X(nlon_alc, nlat_alc, nlev_alc ) ) - - call read_netcdf_ana_fv ( Ana_File1, nlon_ana, nlat_ana, nlev_ana, & - U_1, V_1, & - T_1, Q_1, PS_1, PHIS_1, & - lon_ana, lat_ana, lev_ana & - , utcore_1, vtcore_1, ttcore_1, ogcore_1 & - ) - write(*,*) " checks ... " - write(*,*) iax, jax - - call read_netcdf_ana_fv ( Ana_File2, nlon_ana, nlat_ana, nlev_ana, & - U_2, V_2, & - T_2, Q_2, PS_2, PHIS_2, & - lon_ana, lat_ana, lev_ana & - , utcore_2, vtcore_2, ttcore_2, ogcore_2 & - ) - - ! Make patches - Uo_1 = U_1(iax-1:iax+1,jax-1:jax+1,:) - Vo_1 = V_1(iax-1:iax+1,jax-1:jax+1,:) - To_1 = T_1(iax-1:iax+1,jax-1:jax+1,:) - Qo_1 = Q_1(iax-1:iax+1,jax-1:jax+1,:) - PSo_1 = PS_1(iax-1:iax+1,jax-1:jax+1 ) - PHISo_1 = PHIS_1(iax-1:iax+1,jax-1:jax+1 ) - UTCOREo_1 = UTCORE_1(iax-1:iax+1,jax-1:jax+1,:) - VTCOREo_1 = VTCORE_1(iax-1:iax+1,jax-1:jax+1,:) - TTCOREo_1 = TTCORE_1(iax-1:iax+1,jax-1:jax+1,:) - OGCOREo_1 = OGCORE_1(iax-1:iax+1,jax-1:jax+1,:) - - Uo_2 = U_2(iax-1:iax+1,jax-1:jax+1,:) - Vo_2 = V_2(iax-1:iax+1,jax-1:jax+1,:) - To_2 = T_2(iax-1:iax+1,jax-1:jax+1,:) - Qo_2 = Q_2(iax-1:iax+1,jax-1:jax+1,:) - PSo_2 = PS_2(iax-1:iax+1,jax-1:jax+1 ) - PHISo_2 = PHIS_2(iax-1:iax+1,jax-1:jax+1 ) - UTCOREo_2 = UTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - VTCOREo_2 = VTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - TTCOREo_2 = TTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - OGCOREo_2 = OGCORE_2(iax-1:iax+1,jax-1:jax+1,:) - - - ! Mark Ana date as read - Read_year2 = Ana_year2 - Read_month2 = Ana_month2 - Read_day2 = Ana_day2 - Read_sec2 = Ana_sec2 - Read_YMD2 =(Ana_Year2*10000) + (Ana_Month2*100) + Ana_Day2 - - end if - - ! Bump second analysis to first postion, and read in next analysis - if ( (Alarm_Read_Ana ) .AND. (Alarm_Bump_Ana) ) then - - Uo_1 = Uo_2 - Vo_1 = Vo_2 - To_1 = To_2 - Qo_1 = Qo_2 - PSo_1 = PSo_2 - PHISo_1 = PHISo_2 - UTCOREo_1 = UTCOREo_2 - VTCOREo_1 = VTCOREo_2 - TTCOREo_1 = TTCOREo_2 - - call read_netcdf_ana_fv ( Ana_File2, nlon_ana, nlat_ana, nlev_ana, & - U_2, V_2, & - T_2, Q_2, PS_2, PHIS_2, & - lon_ana, lat_ana, lev_ana & - , utcore_2, vtcore_2, ttcore_2, ogcore_2 & - ) - - ! Make patches - Uo_2 = U_2(iax-1:iax+1,jax-1:jax+1,:) - Vo_2 = V_2(iax-1:iax+1,jax-1:jax+1,:) - To_2 = T_2(iax-1:iax+1,jax-1:jax+1,:) - Qo_2 = Q_2(iax-1:iax+1,jax-1:jax+1,:) - PSo_2 = PS_2(iax-1:iax+1,jax-1:jax+1 ) - PHISo_2 = PHIS_2(iax-1:iax+1,jax-1:jax+1 ) - UTCOREo_2 = UTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - VTCOREo_2 = VTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - TTCOREo_2 = TTCORE_2(iax-1:iax+1,jax-1:jax+1,:) - OGCOREo_2 = OGCORE_2(iax-1:iax+1,jax-1:jax+1,:) - - - ! Mark Ana date as read - Read_year2 = Ana_year2 - Read_month2 = Ana_month2 - Read_day2 = Ana_day2 - Read_sec2 = Ana_sec2 - Read_YMD2=(Ana_Year2*10000) + (Ana_Month2*100) + Ana_Day2 - end if - - Alarm_Read_Ana = .FALSE. - Alarm_Bump_Ana = .FALSE. - - - - -#if 0 - call dynfrc_timewgts( & - (/ Ana_Year1, Ana_Month1, Ana_day1, Ana_sec1 /) , & - (/ Ana_Year2, Ana_Month2, Ana_day2, Ana_sec2 /) , & - ana_wgt1 , ana_wgt2 ) -#else - ana_wgt1 = 0._r8 ! 0=all weight on t+1 - ana_wgt2 = 1._r8 - ana_wgt1 -#endif - if (masterproc) write(iulog,*) " Ana forcing time wgts ",ana_wgt1,ana_wgt2 - - iac=2 - jac=2 - - - - Uo_X = ana_wgt1 * Uo_1 + ana_wgt2 * Uo_2 - Vo_X = ana_wgt1 * Vo_1 + ana_wgt2 * Vo_2 - To_X = ana_wgt1 * To_1 + ana_wgt2 * To_2 - Qo_X = ana_wgt1 * Qo_1 + ana_wgt2 * Qo_2 - PSo_X = ana_wgt1 * PSo_1 + ana_wgt2 * PSo_2 - PHISo_X = ana_wgt1 * PHISo_1 + ana_wgt2 * PHISo_2 - - UTCOREo_X = ana_wgt1 * UTCOREo_1 + ana_wgt2 * UTCOREo_2 - VTCOREo_X = ana_wgt1 * VTCOREo_1 + ana_wgt2 * VTCOREo_2 - TTCOREo_X = ana_wgt1 * TTCOREo_1 + ana_wgt2 * TTCOREo_2 - OGCOREo_X = ana_wgt1 * OGCOREo_1 + ana_wgt2 * OGCOREo_2 - - lon_alc = lon_ana(iax-1:iax+1) - lat_alc = lat_ana(jax-1:jax+1) - - if(masterproc) write(iulog,*) " SCM lon lat: ",scmlonx,scmlat - if(masterproc) write(iulog,*) " Closest Ana lon lat: ",lon_ana( iax ) , lat_ana( jax ) - - - ! Save off analysis fields for diagnostics and - ! other purposes - T_ana_diag(:) = To_X( iac, jac, :) - Q_ana_diag(:) = Qo_X( iac, jac, :) - U_ana_diag(:) = Uo_X( iac, jac, :) - V_ana_diag(:) = Vo_X( iac, jac, :) - - !================================================ - ! Patch in SCM profiles here if wanted. - ! This acts as "dynamical nudging", since - ! horizontal advective tendencies will become - ! stronger if SCM state drifts away from re-ana. - ! Note, this will only be effective w/ upwind - ! scheme, since 2nd order cntrd skips over central - ! point in stencil. - !---- - ! For stability it turns out may be good to scale - ! with pressure so that high-velocity strato winds - ! don't lead to CFL violations. So, as a bad, dirty, - ! dirty short term solution, weight "reaction" by - ! pref_mid. Clearly, better soln would be to - ! sub-step this part of the dynamics as is done - ! for the other "dycores". - !================================================= - ! Calculate "reaction coefficient" - !--------------------------------- - alpha_react(:)=1.0_r8 !1._r8 - - ! Adjust central profiles in stencils - !------------------------------------ - if (scm_ana_t_react) then - To_X( iac, jac, :) = alpha_react(:) * T_scm(:) & - + ( 1._r8-alpha_react(:) ) * To_X( iac, jac, :) - if(masterproc) write(iulog,*) " REACTING to SCM T-state ..... " - else - if(masterproc) write(iulog,*) " No reaction to SCM T-state ..... " - endif - if (scm_ana_q_react) then - Qo_X( iac, jac, :) = alpha_react(:) * Q_scm(:) & - + ( 1._r8-alpha_react(:) ) * Qo_X( iac, jac, :) - if(masterproc) write(iulog,*) " REACTING to SCM Q-state ..... " - else - if(masterproc) write(iulog,*) " No reaction to SCM Q-state ..... " - endif - if (scm_ana_u_react) then - Uo_X( iac, jac, :) = alpha_react(:) * U_scm(:) & - + ( 1._r8-alpha_react(:) ) * Uo_X( iac, jac, :) - if(masterproc) write(iulog,*) " REACTING to SCM U-state ..... " - else - if(masterproc) write(iulog,*) " No reaction to SCM U-state ..... " - endif - if (scm_ana_v_react) then - Vo_X( iac, jac, :) = alpha_react(:) * V_scm(:) & - + ( 1._r8-alpha_react(:) ) * Vo_X( iac, jac, :) - if(masterproc) write(iulog,*) " REACTING to SCM V-state ..... " - else - if(masterproc) write(iulog,*) " No reaction to SCM V-state ..... " - endif - - - - !========================================= - - call virtual_t( nlon_alc,nlat_alc,nlev_alc, & - To_X , Qo_X , Tv_X ) - - call makepr_fv( nlon_alc,nlat_alc,nlev_alc, & - tv_X , pso_X , phiso_X , & - plo_X, ple_X, phi_X ) - call etadot_fv ( nlon_alc , nlat_alc , nlev_alc , lon_alc , lat_alc , & - uo_X , & - vo_X , & - plo_X, ple_X , etad_X , omg_X ) - call zeta_fv( nlon_alc,nlat_alc,nlev_alc, & - lon_alc ,lat_alc , & - uo_X , vo_X , zeta_X ) - - call makepk_fv( nlon_alc,nlat_alc,nlev_alc, & - To_X , Qo_X , & - pso_X , phiso_X , & - pko_X, pke_X, phik_X, thv_X ) - - KEh_X = 0.5 * ( Uo_X**2 + Vo_X**2 ) - - - if (scm_ana_x_plevels) then - call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & - iac, jac, uo_X , plo_X ) - call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & - iac, jac, vo_X , plo_X ) - call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & - iac, jac, to_X , plo_X ) - call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & - iac, jac, qo_X , plo_X ) - call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc, & - iac, jac, tv_X , plo_X ) - !Retain p-frc calculation on eta??? - !call patch_eta_x_plv ( nlon_alc , nlat_alc , nlev_alc+1, & - ! iac, jac, phi_X , ple_X ) - if(masterproc) write(iulog,*) " calcs on PRESSURE levels " - else - if(masterproc) write(iulog,*) " calcs on ETA levels " - end if - - - zeta_ana = zeta_X - omega_recalc_ana = omg_X( iac,jac,:) - etad_ana = etad_X( iac,jac,:) - plo_ana = plo_X( iac,jac,:) - t_ana = To_X( iac,jac,:) - tv_ana = Tv_X( iac,jac,:) - q_ana = Qo_X( iac,jac,:) - ps_ana = PSo_X( iac,jac ) - - u_ana = Uo_X( iac,jac,:) - v_ana = Vo_X( iac,jac,:) - - rho_ana = plo_ana / ( Rdair * tv_ana ) - - uten_dycore_ana = UTCOREo_X( iac,jac,:) - vten_dycore_ana = VTCOREo_X( iac,jac,:) - tten_dycore_ana = TTCOREo_X( iac,jac,:) - omega_dycore_ana = OGCOREo_X( iac,jac,:) - - - ! Horz. gradient calcs - - kehg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, KEh_X ) - - ! T_x, T_y should be straight T (not virtual) - !!teg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, To_X ) - teg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Tv_X ) !test 05-31-21 - - qg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Qo_X ) - - ug_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Uo_X ) - - vg_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, Vo_X ) - - aalc = 0.5*( PHI_X( :, :, 2:nlev_alc+1) + PHI_X(: , : ,1:nlev_alc) ) - !!aalc = PHI_X( :, :, 2:nlev_alc+1) - !!aalc = PHI_X(: , : ,1:nlev_alc) - phig_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, aalc ) - - !Retain p-frc calculation on eta??? - !if (scm_ana_x_plevels) then ! No horz. p-gradient in p-coords - ! plog_X(:,1:2) = 0._r8 - !else - plog_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, plo_X(:,:,1:nlev_alc) ) - !plog_X = grad_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, ple_X(:,:,1:nlev_alc) ) - !end if - - - -#if 1 - lin_pfc_X = lin_pfc_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, ple_X, phi_X ) -#else - lin_pfc_X = lin_pfc_fv( nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, pke_X, phik_X ) -#endif - - kehg_ana = kehg_X - plog_ana = plog_X - phig_ana = phig_X - teg_ana = teg_X - qg_ana = qg_X - ug_ana = ug_X - vg_ana = vg_X - lin_pfc_ana = lin_pfc_X - - !put together pieces for u*grad(u) form of U and V adv tendencies - - if ( scm_ana_upwind .OR. scm_ana_u_react ) then - uten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Uo_X ) - else - uten_hadv_ana = -u_ana * ug_ana(:,1) - v_ana * ug_ana(:,2) - end if - if ( scm_ana_upwind .OR. scm_ana_v_react ) then - vten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Vo_X ) - else - vten_hadv_ana = -u_ana * vg_ana(:,1) - v_ana * vg_ana(:,2) - end if - - ! Coriolis terms - !====================================== - absvo = 2._r8 * OOmega * sin( lat_ana(jax) * PI/180._r8 ) - !Allow Coriolis to react to SCM winds - uten_vort_ana = absvo * v_ana - vten_vort_ana = -absvo * u_ana - ! Force Coriolis to ALWAYS be calc w/ analysis winds - !!uten_vort_ana = absvo * v_ana_diag - !!vten_vort_ana = -absvo * u_ana_diag - ! ----- Diags for VI form (0-out) - uten_keg_ana = 0._r8 ! fill with 0 - - !!if (scm_ana_x_plevels) then ! No horz. p-gradient in p-coords - if (.FALSE.) then ! No horz. p-gradient in p-coords - uten_pfrc_ana = - phig_ana(:,1) - vten_pfrc_ana = - phig_ana(:,2) - else -#if 1 - !put together pieces for Pressure and Phi gradient tencency terms - uten_pfrc_ana = -(1._r8/rho_ana) * plog_ana(:,1) - phig_ana(:,1) - vten_pfrc_ana = -(1._r8/rho_ana) * plog_ana(:,2) - phig_ana(:,2) -#else - !Lin(1997) QJRMS pfrc tendency terms - uten_pfrc_ana = lin_pfc_ana(:,1) - vten_pfrc_ana = lin_pfc_ana(:,2) -#endif - end if - - - if ( scm_ana_upwind .OR. scm_ana_t_react ) then - tten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Tv_X ) - else - tten_hadv_ana = -u_ana * teg_ana(:,1) - v_ana * teg_ana(:,2) ! should be straight T (not virtual) - end if - if ( scm_ana_upwind .OR. scm_ana_q_react ) then - qten_hadv_ana = upwind_hadv(nlon_alc,nlat_alc,nlev_alc,iac,jac,lon_alc,lat_alc, u_ana, v_ana, Qo_X ) - else - qten_hadv_ana = -u_ana * qg_ana(:,1) - v_ana * qg_ana(:,2) - end if - - if (.not.(scm_ana_direct_omega)) then - omega_ana = omega_recalc_ana ! use reconstructed omega - if(masterproc) write(iulog,*) " Omega recalc from ana U,V etc." - else - omega_ana = omega_dycore_ana ! use direct omega from dycore/ana - if(masterproc) write(iulog,*) " Omega direct from ana" - end if - - - if (.not.(scm_ana_x_plevels)) then - !Tendencies due to vertical advection (etadot * D_eta ... ) - uten_vadv_ana = vadv_fv( nlev_alc, etad_ana, u_ana ) - vten_vadv_ana = vadv_fv( nlev_alc, etad_ana, v_ana ) - tten_vadv_ana = vadv_fv( nlev_alc, etad_ana, tv_ana ) ! should be straight T (not virtual) - qten_vadv_ana = vadv_fv( nlev_alc, etad_ana, q_ana ) - else - !Tendencies due to vertical advection (Omega * D_p ... ) - uten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, u_ana ) - vten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, v_ana ) - tten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, t_ana ) ! should be straight T (not virtual) - qten_vadv_ana = vadv_fv_press( nlev_alc, omega_ana, plo_ana, q_ana ) - end if - - tten_comp_ana = (1./cpair)*( omega_ana / rho_ana ) - - !DIags for pressure/geop grad forces - uten_phig_ana = - phig_ana(:,1) - uten_prg_ana = - (1._r8/rho_ana) * plog_ana(:,1) - - end subroutine get_ana_dynfrc_fv - -!----------------------------------------------------- -! Stuff ... useful ojala -!----------------------------------------------------- - !------------------------- - function vadv_fv( nlev, etad, aa ) result( tend ) - use hycoef, only: hyai, hybi, ps0, hyam, hybm - integer, intent(in) :: nlev - real(r8), intent(in) :: etad(nlev) , aa(nlev) - real(r8) :: tend(nlev) - real(r8) :: eta(nlev) - integer :: L - - eta = hybm+hyam - - do L=2,nlev-1 - tend(L) = etad(L)* ( aa(L+1) - aa(L-1) ) / ( eta(L+1) - eta(L-1) ) - end do - L=1 - tend(L) = etad(L)* ( aa(L+1) - aa(L) ) / ( eta(L+1) - eta(L) ) - L=nlev - tend(L) = etad(L)* ( aa(L) - aa(L-1) ) / ( eta(L) - eta(L-1) ) - - tend = -1.*tend ! for RHS consistency - - end function vadv_fv -!--------------------------- - !------------------------- - function vadv_fv_press( nlev, omega, plo, aa ) result( tend ) - integer, intent(in) :: nlev - real(r8), intent(in) :: omega(nlev) , aa(nlev),plo(nlev) - real(r8) :: tend(nlev) - integer :: L - - do L=2,nlev-1 - tend(L) = omega(L)* ( aa(L+1) - aa(L-1) ) / ( plo(L+1) - plo(L-1) ) - end do - L=1 - tend(L) = omega(L)* ( aa(L+1) - aa(L) ) / ( plo(L+1) - plo(L) ) - L=nlev - tend(L) = omega(L)* ( aa(L) - aa(L-1) ) / ( plo(L) - plo(L-1) ) - - tend = -1.*tend ! for RHS consistency - - end function vadv_fv_press -!--------------------------- - function lin_pfc_fv( nlon,nlat,nlev,iax,jax,lons,lats, pre, phi ) result( pfc ) - !use shr_kind_mod, only: r8 => shr_kind_r8 - !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - ! pi => shr_const_pi , & - ! omega => shr_const_omega - - integer, intent(in) :: nlon,nlat,nlev,iax,jax - real(r8), intent(in) :: pre(nlon,nlat,nlev+1),phi(nlon,nlat,nlev+1) - real(r8), intent(in) :: lats(nlat),lons(nlon) - real(r8) :: pfc(nlev,2) - real(r8) :: pfxW(nlev) , pfxE(nlev) - real(r8) :: pfyS(nlev) , pfyN(nlev) - real(r8) :: rlats(nlat),rlons(nlon),dx,dy,ds - real(r8) :: pr1,pr2,pr3,pr4, ph1,ph2,ph3,ph4 - integer :: L , igg - - ! Begin - rlons(:) = lons(:) * PI/180._r8 - rlats(:) = lats(:) * PI/180._r8 - - dx=( rlons(2)-rlons(1) ) * Rearth - dy=( rlats(2)-rlats(1) ) * Rearth - - ds = MAX( dx*cos(rlats(jax)) , .1 ) - igg = iax - do L=1,nlev - pr1 = pre(igg-1,jax,L+1) - pr2 = pre(igg ,jax,L+1) - pr3 = pre(igg ,jax,L ) - pr4 = pre(igg-1,jax,L ) - ph1 = phi(igg-1,jax,L+1) - ph2 = phi(igg ,jax,L+1) - ph3 = phi(igg ,jax,L ) - ph4 = phi(igg-1,jax,L ) - pfxW(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) - end do - igg = iax +1 - do L=1,nlev - pr1 = pre(igg-1,jax,L+1) - pr2 = pre(igg ,jax,L+1) - pr3 = pre(igg ,jax,L ) - pr4 = pre(igg-1,jax,L ) - ph1 = phi(igg-1,jax,L+1) - ph2 = phi(igg ,jax,L+1) - ph3 = phi(igg ,jax,L ) - ph4 = phi(igg-1,jax,L ) - pfxE(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) - end do - ds = dy - igg = jax - do L=1,nlev - pr1 = pre(iax,igg-1,L+1) - pr2 = pre(iax,igg ,L+1) - pr3 = pre(iax,igg ,L ) - pr4 = pre(iax,igg-1,L ) - ph1 = phi(iax,igg-1,L+1) - ph2 = phi(iax,igg ,L+1) - ph3 = phi(iax,igg ,L ) - ph4 = phi(iax,igg-1,L ) - pfyS(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) - end do - igg = jax +1 - do L=1,nlev - pr1 = pre(iax,igg-1,L+1) - pr2 = pre(iax,igg ,L+1) - pr3 = pre(iax,igg ,L ) - pr4 = pre(iax,igg-1,L ) - ph1 = phi(iax,igg-1,L+1) - ph2 = phi(iax,igg ,L+1) - ph3 = phi(iax,igg ,L ) - ph4 = phi(iax,igg-1,L ) - pfyN(L) = ( (pr2-pr4)*(ph1-ph3) + (pr1-pr3)*(ph4-ph2) ) /( ds * ( (pr2-pr4) + (pr1-pr3) ) ) - end do - - - do L=1,nlev - pfc(L,1) = 0.5*( pfxW(L) + pfxE(L) ) - pfc(L,2) = 0.5*( pfyS(L) + pfyN(L) ) - end do - - - - end function lin_pfc_fv - !------------------------- - function grad_fv( nlon,nlat,nlev,iax,jax,lons,lats, aa ) result( ga ) - !use shr_kind_mod, only: r8 => shr_kind_r8 - !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - ! pi => shr_const_pi , & - ! omega => shr_const_omega - - integer, intent(in) :: nlon,nlat,nlev,iax,jax - real(r8), intent(in) :: aa(nlon,nlat,nlev) - real(r8), intent(in) :: lats(nlat),lons(nlon) - real(r8) :: ga(nlev,2) - real(r8) :: rlats(nlat),rlons(nlon),dx,dy - integer :: L - - ! Begin - rlons(:) = lons(:) * PI/180._r8 - rlats(:) = lats(:) * PI/180._r8 - - dx=( rlons(2)-rlons(1) ) * Rearth - dy=( rlats(2)-rlats(1) ) * Rearth - - do L=1,nlev - ga(L,1) = (aa(iax+1,jax,L) - aa(iax-1,jax,L))/( 2.*dx*cos(rlats(jax)) + 0.1 ) - ga(L,2) = (aa(iax,jax+1,L) - aa(iax,jax-1,L))/( 2.*dy ) - end do - - - - end function grad_fv - !------------------------- - function upwind_hadv( nlon,nlat,nlev,iax,jax,lons,lats,u,v, aa ) result( hadv_tend ) - !use shr_kind_mod, only: r8 => shr_kind_r8 - !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - ! pi => shr_const_pi , & - ! omega => shr_const_omega - - integer, intent(in) :: nlon,nlat,nlev,iax,jax - real(r8), intent(in) :: aa(nlon,nlat,nlev) - real(r8), intent(in) :: lats(nlat),lons(nlon),u(nlev),v(nlev) - real(r8) :: hadv_tend(nlev) - real(r8) :: rlats(nlat),rlons(nlon),dx,dy,xten(nlev),yten(nlev) - integer :: L - - ! Begin - rlons(:) = lons(:) * PI/180._r8 - rlats(:) = lats(:) * PI/180._r8 - - dx=( rlons(2)-rlons(1) ) * Rearth - dy=( rlats(2)-rlats(1) ) * Rearth - - do L=1,nlev - if ( u(L) >= 0._r8 ) then - xten(L) = u(L) * ( aa(iax,jax,L) - aa(iax-1,jax,L))/( dx*cos(rlats(jax)) + 0.1 ) - else - xten(L) = u(L) * ( aa(iax+1,jax,L) - aa(iax,jax,L))/( dx*cos(rlats(jax)) + 0.1 ) - end if - end do - do L=1,nlev - if ( v(L) >= 0._r8 ) then - yten(L) = v(L) * ( aa(iax,jax,L) - aa(iax,jax-1,L))/( dy ) - else - yten(L) = v(L) * ( aa(iax,jax+1,L) - aa(iax,jax,L))/( dy ) - end if - end do - - hadv_tend(:) = -1._r8 * ( xten(:) + yten(:) ) - - - end function upwind_hadv -!========================================= - subroutine makepk_fv( nlon,nlat,nlev, t, q, ps, phis, pko, pke, phi, th ) - use hycoef, only: hyai, hybi, ps0, hyam, hybm - !!use shr_const_mod, only: rdair => shr_const_rdair, cpair => shr_const_cpdair, - integer, intent(in) :: nlon,nlat,nlev - real(r8), intent(in) :: t(nlon,nlat,nlev),q(nlon,nlat,nlev),ps(nlon,nlat),phis(nlon,nlat) - real(r8), intent(out) :: pko(nlon,nlat,nlev),th(nlon,nlat,nlev),pke(nlon,nlat,nlev+1), phi(nlon,nlat,nlev+1) - real(r8) :: ple(nlon,nlat,nlev+1),plo(nlon,nlat,nlev+1),rv(nlon,nlat,nlev+1) - real(r8) :: kappa, p00 - integer :: L - - do L=1,nlev+1 - ple(:,:,L) = hyai(L)*ps0 + hybi(L)*ps(:,:) - end do - do L=1,nlev - plo(:,:,L) = hyam(L)*ps0 + hybm(L)*ps(:,:) - end do - - kappa=rdair/cpair - - pko = plo**kappa - pke = ple**kappa - - p00 = 100000._r8 - th = ( ( p00 / plo)**kappa ) * t - - rv = 1._r8/(1._r8 - q) - 1._r8 - th = th*(1._r8 + 0.61_r8 * rv ) - - phi(:,:,nlev+1) = phis(:,:) - do L=nlev,1,-1 - phi(:,:,L) = phi(:,:,L+1) - ( CpAir * Th(:,:,L) ) * ( pke(:,:,L) - pke(:,:,L+1) ) / (p00**kappa ) - end do - - - end subroutine makepk_fv - -!============================================================================= - subroutine makepr_fv( nlon,nlat,nlev, t, ps, phis, plo, ple, phi ) - use hycoef, only: hyai, hybi, ps0, hyam, hybm - use shr_const_mod, only: rdair => shr_const_rdair - integer, intent(in) :: nlon,nlat,nlev - real(r8), intent(in) :: t(nlon,nlat,nlev),ps(nlon,nlat),phis(nlon,nlat) - real(r8), intent(out) :: plo(nlon,nlat,nlev), ple(nlon,nlat,nlev+1), phi(nlon,nlat,nlev+1) - real(r8) :: lnple(nlon,nlat,nlev+1) - integer :: L - - do L=1,nlev+1 - ple(:,:,L) = hyai(L)*ps0 + hybi(L)*ps(:,:) - end do - do L=1,nlev - plo(:,:,L) = hyam(L)*ps0 + hybm(L)*ps(:,:) - end do - - lnple = log( ple ) - phi(:,:,nlev+1) = phis(:,:) - do L=nlev,1,-1 - phi(:,:,L) = phi(:,:,L+1) - (RdAir * T(:,:,L) ) * ( lnple(:,:,L) - lnple(:,:,L+1) ) - !phi(:,:,L) = phi(:,:,L+1) - (RdAir * T(:,:,L) / plo(:,:,L) ) * ( ple(:,:,L) - ple(:,:,L+1) ) - end do - - end subroutine makepr_fv - -!============================================================================= - subroutine virtual_t( nlon,nlat,nlev, t, q, tv ) - use hycoef, only: hyai, hybi, ps0, hyam, hybm - use shr_const_mod, only: rdair => shr_const_rdair - integer, intent(in) :: nlon,nlat,nlev - real(r8), intent(in) :: t(nlon,nlat,nlev),q(nlon,nlat,nlev) - real(r8), intent(out) :: tv(nlon,nlat,nlev) - real(r8) :: rv(nlon,nlat,nlev) - integer :: L - - - rv = 1._r8/(1._r8 - q) - 1._r8 - tv = t*(1._r8 + 0.61_r8 * rv ) - - - end subroutine virtual_t - - !------------------------- - subroutine zeta_fv( nlon,nlat,nlev,lons,lats, u,v, zeta ) - !use shr_kind_mod, only: r8 => shr_kind_r8 - !use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - ! pi => shr_const_pi , & - ! omega => shr_const_omega - - integer, intent(in) :: nlon,nlat,nlev - real(r8), intent(in) :: u(nlon,nlat,nlev),v(nlon,nlat,nlev) - real(r8), intent(out) :: zeta(nlev) - !real(r8), intent(in) :: u(iax-1:iax+1,jax-1:jax+1,nlev) - !real(r8), intent(in) :: v(iax-1:iax+1,jax-1:jax+1,nlev) - real(r8), intent(in) :: lats(nlat),lons(nlon) - real(r8) :: rlats(nlat),rlons(nlon) - real(r8) :: dy,dx0,dx,darea,voo,voo2 - - integer :: iap,jap,iam,jam,i,j,L,iax,jax - - iax=2 - jax=2 - write(*,*) " we're in subr. zeta_fv Lon Lat: " - write(*,*) lons(iax),lats(jax) - - rlons(:) = lons(:) * PI/180._r8 - rlats(:) = lats(:) * PI/180._r8 - - dx0 = rearth* ( rlons(2)-rlons(1) ) - dy = rearth* ( rlats(2)-rlats(1) ) - - darea = dy*dx0*cos( rlats(jax) ) - - write(*,*) dx0,dy,cos( rlats(jax) ) - - do L =1,nlev - zeta(L) = & - ( V(iax+1,jax, L) - V(iax-1,jax,L) ) / ( 2*dx0*cos( rlats(jax) ) ) & - - ( U(iax,jax+1, L) - U(iax,jax-1,L) ) / ( 2*dy ) - end do - - write(*,*) " vorticity est. ",zeta(nlev) - - end subroutine zeta_fv -!================================================================ - subroutine etadot_fv ( nlon, nlat, nlev, lons, lats, u, v, plo, ple, etadot , omega ) - use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 - use shr_const_mod, only: rearth => shr_const_rearth , & ! =6.37122e6_R8 meters - pi => shr_const_pi - use hycoef, only: hyai, hybi, ps0, hyam, hybm - - integer, intent(in) :: nlon,nlat,nlev - real(r8), intent(in) :: lons(nlon),lats(nlat) - real(r8), intent(in) :: u(nlon,nlat,nlev) , v(nlon,nlat,nlev) , plo( nlon,nlat,nlev) , ple( nlon,nlat,nlev+1) - real(r8), intent(out) :: etadot( nlon,nlat,nlev) ,omega(nlon,nlat,nlev) - !real(r8), intent(in) :: uc(:,:,:) , vc(:,:,:) , ple(:,:,:) - - ! Local variables - real(r8),allocatable :: div(:,:,:) - real(r8),allocatable :: mass(:,:,:), fuc(:,:,:),fvc(:,:,:) - real(r8) :: rlats(nlat), rlons(nlon), rcos1, eta(nlev+1) , dx,dy! radians - real(r8), allocatable :: etadot_t1(:,:), etadot_t2(:,:,:) - integer :: i,j,L,im1,jm1,ip1,jp1 - real :: uc_ijL , vc_ijL - - allocate ( div(nlon,nlat,nlev) ) - allocate ( mass(nlon,nlat,nlev), fuc(nlon,nlat,nlev),fvc(nlon,nlat+1,nlev) ) - allocate ( etadot_t1(nlon,nlat), etadot_t2(nlon,nlat,nlev) ) - - div = 0._r8 - fuc = 0._r8 - fvc = 0._r8 - mass = 0._r8 - etadot = 0._r8 - etadot_t1 = 0._r8 - etadot_t2 = 0._r8 - - rlons(:) = lons(:) * PI/180._r8 - rlats(:) = lats(:) * PI/180._r8 - - do L=1,nlev+1 - eta(L) = hyai(L) + hybi(L) ! 1._r8*L/(nlev+1) - end do - do L=1,nlev - mass(:,:,L) = ( ple(:,:,L+1)-ple(:,:,L) )/( eta(L+1)-eta(L) ) - end do - - ! calculate mass fluxes at gridbox edges, using upwind algorithm - do L=1,nlev - do j=1,nlat - do i=2,nlon - im1=i-1 - !if ( i == 1) im1=nlon - uc_ijL = 0.5*( u(im1,j,L) + u(i,j,L) ) - if ( uc_ijL < 0. ) fuc(i,j,L)= uc_ijL * mass(i,j,L) - if ( uc_ijL >= 0. ) fuc(i,j,L)= uc_ijL * mass(im1,j,L) - end do - end do - end do - ! Note: cos(lat) term incorporated into fluxes - do L=1,nlev - do j=2,nlat - do i=1,nlon - jm1=j-1 - vc_ijL = 0.5 * ( v(i,jm1,L)+v(i,j,L) ) - if ( vc_ijL < 0. ) fvc(i,j,L)= vc_ijL * mass(i,j,L) *cos( rlats(j) ) - if ( vc_ijL >= 0. ) fvc(i,j,L)= vc_ijL * mass(i,jm1,L) *cos( rlats(jm1) ) - end do - end do - end do - - - ! now calculate HORZ divergence of (FUC,FVC). Note coslat term already - ! incorporated in FVC. - do L=1,nlev - do j=1,nlat-1 - do i=1,nlon-1 - ip1=i+1 - jp1=j+1 - rcos1 = 1. /( Rearth*cos( rlats(j) ) ) - div(i,j,L) = rcos1 * ( FUC(ip1,j,L)-FUC(i,j,L) ) / (rlons(ip1)-rlons(i) ) & - + rcos1 * ( FVC(i,jp1,L)-FVC(i,j,L) ) / (rlats(jp1)-rlats(j) ) - end do - end do - end do - - - etadot_t1(:,:)=0._r8 - etadot_t2(:,:,:)=0._r8 - do L=1,nlev - etadot_t1(:,:) = etadot_t1(:,:) + div(:,:,L)*(eta(L+1)-eta(L)) - end do - do L=2,nlev - etadot_t2(:,:,L) = etadot_t2(:,:,L-1) + div(:,:,L)*(eta(L+1)-eta(L)) - end do - do L=1,nlev - etadot(:,:,L) = ( hybm(L)*etadot_t1(:,:) - etadot_t2(:,:,L) ) / mass(:,:,L) - end do - - dx=( rlons(2)-rlons(1) ) * Rearth - dy=( rlats(2)-rlats(1) ) * Rearth - omega = 0._r8 - -#if 1 - do L=1,nlev - do j=2,nlat-1 - do i=2,nlon-1 - omega(i,j,L) = u(i,j,L) * (plo(i+1,j,L)-plo(i-1,j,L))/( 2.*dx*cos(rlats(j)) + 0.1 ) & - + v(i,j,L) * (plo(i,j+1,L)-plo(i,j-1,L))/( 2.*dy ) & - - etadot_t2(i,j,L) - end do - end do - end do -#else - do L=1,nlev - do j=2,nlat-1 - do i=2,nlon-1 - omega(i,j,L) = etadot(i,j,L)*mass(i,j,L) - end do - end do - end do -#endif - - -end subroutine etadot_fv - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! Reading netcdf files -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!================================================================ - subroutine read_netcdf_ana_fv_ini( anal_file , nlon, nlat, nlev,lonidx,latidx ) - ! - ! READ_NETCDF_ANAL_INI: - ! Open the given analyses data file. Query dimesnisons. - ! Close. - !=============================================================== - use cam_abortutils, only : endrun - use netcdf - use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 - use hycoef, only: hyai, hybi, ps0, hyam, hybm - use shr_const_mod, only: rdair => shr_const_rdair - use scammod, only: scmlon,scmlat - use shr_scam_mod, only: shr_scam_getCloseLatLon ! Standardized system subroutines - - !------------- - character(len=*),intent(in):: anal_file - - integer, intent(out) :: nlon,nlat,nlev,latidx,lonidx - - ! Local values - !------------- - integer :: ncid,varid,istat - integer :: ilat,ilon,ilev - integer :: i,j,L - - real(r8) :: closelon,closelat - - logical :: l_have_us , l_have_vs - - l_have_us = .FALSE. - l_have_vs = .FALSE. - - ! masterporc does all of the work here - !----------------------------------------- - if(masterproc) then - - ! Open the given file - !----------------------- - istat=nf90_open(trim(anal_file),NF90_NOWRITE,ncid) - if(istat.ne.NF90_NOERR) then - write(iulog,*)'NF90_OPEN: failed for file ',trim(anal_file) - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - ! Read in Dimensions - !-------------------- - istat=nf90_inq_dimid(ncid,'lon',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_inquire_dimension(ncid,varid,len=nlon) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - istat=nf90_inq_dimid(ncid,'lat',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_inquire_dimension(ncid,varid,len=nlat) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - istat=nf90_inq_dimid(ncid,'lev',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_inquire_dimension(ncid,varid,len=nlev) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - call shr_scam_getCloseLatLon(ncid ,scmlat,scmlon,closelat,closelon,latidx,lonidx) - - ! Close the analyses file and exit - !----------------------- - istat=nf90_close(ncid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_EUL') - endif - - endif ! (masterproc) then - - - end subroutine read_netcdf_ana_fv_ini - -!================================================================ - subroutine read_netcdf_ana_fv( anal_file , nlon, nlat, nlev, & - u, v, & - t, q, ps, phis, & - lons, lats, levs & - , utcore, vtcore, ttcore, ogcore & - ) - ! - ! READ_NETCDF_ANAL : - ! Open the given analyses data file, read in - ! U,V,T,Q, and PS values as well as Lons, Lats. - !=============================================================== - use cam_abortutils, only : endrun - use netcdf - use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 - use hycoef, only: hyai, hybi, ps0, hyam, hybm - use shr_const_mod, only: rdair => shr_const_rdair - ! Arguments - !------------- - character(len=*),intent(in):: anal_file - - integer, intent(in ) :: nlon,nlat,nlev - real(r8), intent(out) :: U(nlon,nlat,nlev), V(nlon,nlat,nlev) - real(r8), intent(out) :: T(nlon,nlat,nlev), Q(nlon,nlat,nlev) - real(r8), intent(out) :: PS(nlon,nlat), PHIS(nlon,nlat) - !real(r8), intent(out) :: PHI(nlon,nlat,nlev+1),PLE(nlon,nlat,nlev+1),PLO(nlon,nlat,nlev) - real(r8), intent(out) :: Lats(nlat),Lons(nlon),Levs(nlev) - - real(r8), intent(out) :: UTCORE(nlon,nlat,nlev), VTCORE(nlon,nlat,nlev), TTCORE(nlon,nlat,nlev) - real(r8), intent(out) :: OGCORE(nlon,nlat,nlev) - - ! Local values - !------------- - integer :: ncid,varid,istat - integer :: ilat,ilon,ilev - integer :: i,j,L - - logical :: l_have_us , l_have_vs - - l_have_us = .FALSE. - l_have_vs = .FALSE. - - ! masterporc does all of the work here - !----------------------------------------- - if(masterproc) then - - ! Open the given file - !----------------------- - istat=nf90_open(trim(anal_file),NF90_NOWRITE,ncid) - if(istat.ne.NF90_NOERR) then - write(iulog,*)'NF90_OPEN: failed for file ',trim(anal_file) - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - end if - end if - - - - if(masterproc) then - - istat=nf90_inq_varid(ncid,'lon',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid,Lons) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - istat=nf90_inq_varid(ncid,'lat',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid,Lats) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - - istat=nf90_inq_varid(ncid,'lev',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid,Levs) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - - if(masterproc) then - ! Read in, transpose lat/lev indices, - ! and scatter data arrays - !---------------------------------- - ! First block reads U - !---------------------------------- - istat=nf90_inq_varid(ncid,'U',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid, U ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'V',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid, V ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - - - -!!!!!!!!!!!!!! - if(masterproc) then - istat=nf90_inq_varid(ncid,'T',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid, T ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'Q',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid, Q ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'PS',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - istat=nf90_get_var(ncid,varid,PS ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'PHIS',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_SE') - endif - istat=nf90_get_var(ncid,varid,PHIS ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - endif - endif ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'UTEND_CORE',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) "No UTEND_CORE on file: " - write(iulog,*) trim(anal_file) - utcore(:,:,:)=-9999._r8 - else - istat=nf90_get_var(ncid,varid,utcore ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - end if - end if - end if ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'VTEND_CORE',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) "No VTEND_CORE on file: " - write(iulog,*) trim(anal_file) - vtcore(:,:,:)=-9999._r8 - else - istat=nf90_get_var(ncid,varid,vtcore ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - end if - end if - end if ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'DTCORE',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) "No TTEND_CORE on file: " - write(iulog,*) trim(anal_file) - ttcore(:,:,:)=-9999._r8 - else - istat=nf90_get_var(ncid,varid,ttcore ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - end if - end if - end if ! (masterproc) then - - if(masterproc) then - istat=nf90_inq_varid(ncid,'OMEGA',varid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) "No OMEGA (core) on file: " - write(iulog,*) trim(anal_file) - ogcore(:,:,:)=-9999._r8 - else - istat=nf90_get_var(ncid,varid,ogcore ) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_FV') - end if - end if - end if ! (masterproc) then - - - if(masterproc) then - ! Close the analysis file - !----------------------- - istat=nf90_close(ncid) - if(istat.ne.NF90_NOERR) then - write(iulog,*) nf90_strerror(istat) - call endrun ('UPDATE_ANALYSES_EUL') - endif - end if - !------------ - - - write(*,*) "In read_netcdf_anal " - write(*,*) "Reading: ",anal_file - write(*,*) "Lons ..." - write(*,*) "Shape: ",shape(Lons) - write(*,*) "MinMax: ",minval(Lons),maxval(Lons) - write(*,*) "US and VS are presnt on file: ",l_have_us, l_have_vs - - - return - end subroutine read_netcdf_ana_fv -!================================================================ -!================================================================ - subroutine dynfrc_timewgts ( & - ana_prev_date, ana_next_date, & - wgt1 , wgt2 ) - - - use shr_kind_mod, only: r8 => shr_kind_r8, i8 => shr_kind_i8 - use ESMF - use time_manager, only:timemgr_time_ge,timemgr_time_inc,get_curr_date,get_step_size - - integer, intent(in) :: ana_prev_date(4), ana_next_date(4) - real(r8) , intent(out) :: wgt1,wgt2 - - type(ESMF_Time) :: Date1,Date2,Date0 - type(ESMF_TimeInterval) :: DateDiff2,DateDiff0,DateDiff, AnaDiff - integer :: DeltaT0, DeltaT2 , YMD, Year,Month,Day,Sec, Ana_interval, rc - - call get_curr_date(Year,Month,Day,Sec) - YMD=(Year*10000) + (Month*100) + Day - - call ESMF_TimeSet(Date0,YY=Ana_prev_date(1), MM=Ana_prev_date(2) , & - DD= Ana_prev_date(3) , S= Ana_prev_date(4) ) - call ESMF_TimeSet(Date1,YY=Year,MM=Month,DD=Day,S=Sec) - - call ESMF_TimeSet(Date2,YY=Ana_next_date(1), MM=Ana_next_date(2) , & - DD= Ana_next_date(3) , S= Ana_next_date(4) ) - AnaDiff =Date2-Date0 - call ESMF_TimeIntervalGet(AnaDiff,S=Ana_interval ,rc=rc) - - DateDiff2 =Date2-Date1 - call ESMF_TimeIntervalGet(DateDiff2,S=DeltaT2,rc=rc) - DateDiff0 =Date1-Date0 - call ESMF_TimeIntervalGet(DateDiff0,S=DeltaT0,rc=rc) - - wgt1 = 1._r8 - ( 1._r8 * DeltaT0 ) / Ana_interval - wgt2 = 1._r8 - ( 1._r8 * DeltaT2 ) / Ana_interval - -end subroutine dynfrc_timewgts - - -!!!!!!!!!!!!!!!!!!!!!!!!!! - subroutine patch_eta_x_plv ( nx , ny, nL,ix, jx, aa, plo ) - integer, intent(in) :: nx,ny,nl,ix,jx - real(r8), intent(in) :: plo(nx,ny,nL) - real(r8), intent(inout) :: aa(nx,ny,nL) - - real(r8) :: plx(nL),plq(nL),aax(nL),aaq(nL),aat(nx,ny,nL) - real(r8) :: dp,dpk,dpk1,wtk,wtk1 - integer :: i,j,L,k - - - plx(:) = plo(ix,jx,:) ! target pressures - - do j=1,ny - do i=1,nx - plq(:) = plo(i,j,:) - aaq(:) = aa(i,j,:) - !if (plq(1) <= MINVAL(plx) ) aax(1) = aaq(1) - !if (plq(nl) > MAXVAL(plx) ) aax(nl) = aaq(nl) - do L=1,nl - do k=2,nl - if ( ( plx(L) <= plq(k) ).AND.(plx(L) > plq(k-1) ) ) then - dp = plq(k)-plq(k-1) - dpk1 = plx(L)-plq(k-1) - dpk = plq(k)-plx(L) - wtk1 = 1._r8 - dpk1 / dp - wtk = 1._r8 - dpk / dp - aax(L) = wtk * aaq(k) + wtk1 * aaq(k-1) - end if - end do - if ( plx(L) <= plq(1) ) aax(L)=aaq(1) - if ( plx(L) > plq(NL) ) aax(L)=aaq(NL) - end do - - aat(i,j,:)=aax(:) - end do - end do - - aa=aat - -!write(*,*) " mod " -!write(411) nx,ny,nL -!write(411) plo,aa,aat -!PAUSE - - - end subroutine patch_eta_x_plv - - -end module get_ana_dynfrc_4scam From a5cf7c71226f34ffbfd4f5f67becde3df5299273 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 25 Sep 2024 14:44:39 -0600 Subject: [PATCH 170/466] point gitmodule to modified clubb external --- .gitmodules | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index d8a34d6ce1..c2b9bebf08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -93,11 +93,15 @@ [submodule "clubb"] path = src/physics/clubb - url = https://github.com/larson-group/clubb_release - fxrequired = AlwaysRequired +# url = https://github.com/larson-group/clubb_release + url = https://github.com/adamrher/clubb_release + fxrequired = AlwaysRequired fxsparse = ../.clubb_sparse_checkout - fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf - fxDONOTUSEurl = https://github.com/larson-group/clubb_release +# fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf +# fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf.mf + fxtag = 556f574401882accbc431792e09c94fe0e70d233 +# fxDONOTUSEurl = https://github.com/larson-group/clubb_release + fxDONOTUSEurl = https://github.com/adamrher/clubb_release [submodule "cism"] path = components/cism From 64da882a3b5406bd7b823117c0d61754e31b0681 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 26 Sep 2024 11:43:06 -0600 Subject: [PATCH 171/466] update clubb submodule, implement aloft trigger --- .gitmodules | 3 +- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 6 + src/physics/cam/clubb_intr.F90 | 28 ++- src/physics/cam/clubb_mf.F90 | 194 +++++++++++++++---- src/physics/clubb | 2 +- 6 files changed, 183 insertions(+), 51 deletions(-) diff --git a/.gitmodules b/.gitmodules index c2b9bebf08..0f20704b75 100644 --- a/.gitmodules +++ b/.gitmodules @@ -98,8 +98,7 @@ fxrequired = AlwaysRequired fxsparse = ../.clubb_sparse_checkout # fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf -# fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf.mf - fxtag = 556f574401882accbc431792e09c94fe0e70d233 + fxtag = d224307f798b654f5312a9f035568c8a99ca400c # fxDONOTUSEurl = https://github.com/larson-group/clubb_release fxDONOTUSEurl = https://github.com/adamrher/clubb_release diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index cbe0e9d6bf..ed6fa70b52 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2327,6 +2327,7 @@ .false. .false. 1 + .false. .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 250827dc7d..2b854bc966 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4626,6 +4626,12 @@ Real: level position of state used to seed the random number generator Default: 1 + +If .true. turn on elevated convective initiliazation +Default: .false. + + 600.E2_r8) + kmid = kmid+1 + end do + + kstart = maxloc(wpthvp_env(kpbl:kmid),DIM=1) + kstart = kstart + kpbl - 1 + + wthv = wpthvp_env(kstart) + wqt = wpqtp_env(kstart) + + if (kstart == nz) then + wthv = 0._r8 + wqt = 0._r8 + end if + + else + aloft = .false. + kstart = 1 + wthv = wthv_sfc + wqt = wqt_sfc + end if ! if surface buoyancy is positive then do mass-flux - if ( wthv > 0._r8 ) then + !if ( wthv > 0._r8 ) then + if ( wthv > 0._r8 .and. wqt > 0._r8) then if (do_clubb_mf_mixd) then convh = max(cbm1,pblhmin) @@ -619,7 +664,7 @@ subroutine integrate_mf( nz, ! Initialize using Deardorff convective velocity scale ! ! --------------------------------------------------------- ! - wstar = max( wstarmin, (gravit/thv(1)*wthv*convh)**(1._r8/3._r8) ) + wstar = max( wstarmin, (gravit/thv(kstart)*wthv*convh)**(1._r8/3._r8) ) ! --------------------------------------------------------- ! ! Compute cold pool feedback parameter ! @@ -663,17 +708,17 @@ subroutine integrate_mf( nz, wlv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * (real(i-1, r8)) wtv = wmin + (wmax-wmin) / (real(clubb_mf_nup,r8)) * real(i,r8) - upw(1,i) = 0.5_r8 * (wlv+wtv) - upa(1,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & + upw(kstart,i) = 0.5_r8 * (wlv+wtv) + upa(kstart,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) - upmf(1,i)= rho_zm(1)*upa(1,i)*upw(1,i) + !upmf(kstart,i)= rho_zm(kstart)*upa(kstart,i)*upw(kstart,i) - upu(1,i) = u(1) - upv(1,i) = v(1) + upu(kstart,i) = u(kstart) + upv(kstart,i) = v(kstart) - upqt(1,i) = cwqt * upw(1,i) * sigmaqt/sigmaw - upthv(1,i) = cwthv * upw(1,i) * sigmathv/sigmaw + upqt(kstart,i) = cwqt * upw(kstart,i) * sigmaqt/sigmaw + upthv(kstart,i) = cwthv * upw(kstart,i) * sigmathv/sigmaw enddo facqtu=1._r8 @@ -685,9 +730,9 @@ subroutine integrate_mf( nz, srfwthvu = 0._r8 srfarea = 0._r8 do i=1,clubb_mf_nup - srfwqtu=srfwqtu+upqt(1,i)*upw(1,i)*upa(1,i) - srfwthvu=srfwthvu+upthv(1,i)*upw(1,i)*upa(1,i) - srfarea = srfarea+upa(1,i) + srfwqtu=srfwqtu+upqt(kstart,i)*upw(kstart,i)*upa(kstart,i) + srfwthvu=srfwthvu+upthv(kstart,i)*upw(kstart,i)*upa(kstart,i) + srfarea = srfarea+upa(kstart,i) end do facqtu=srfarea*wqt/srfwqtu facthvu=srfarea*wthv/srfwthvu @@ -695,32 +740,85 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup - betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) - betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + !betaqt = (qt(4)-qt(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + !betathl = (thv(4)-thv(2))/(0.5_r8*(dzt(4)+2._r8*dzt(3)+dzt(2))) + betaqt = (qt(kstart+3)-qt(kstart+1))/(0.5_r8*(dzt(kstart+3)+2._r8*dzt(kstart+2)+dzt(kstart+1))) + betathl = (thv(kstart+3)-thv(kstart+1))/(0.5_r8*(dzt(kstart+3)+2._r8*dzt(kstart+2)+dzt(kstart+1))) - upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) - upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + !upqt(1,i)= qt(2)-betaqt*0.5_r8*(dzt(2)+dzt(1))+facqtu*upqt(1,i) + !upthv(1,i)= thv(2)-betathl*0.5_r8*(dzt(2)+dzt(1))+facthvu*upthv(1,i) + if (.not.aloft) then + upqt(kstart,i)= qt(kstart+1)-betaqt*0.5_r8*(dzt(kstart+1)+dzt(kstart))+facqtu*upqt(kstart,i) + upthv(kstart,i)= thv(kstart+1)-betathl*0.5_r8*(dzt(kstart+1)+dzt(kstart))+facthvu*upthv(kstart,i) + else + upqt(kstart,i)= qt(kstart)+upqt(kstart,i) + upthv(kstart,i)= thv(kstart)+upthv(kstart,i) + if (w(kstart) > 0._r8) upw(kstart,i)= w(kstart)+upw(kstart,i) + end if - upthl(1,i) = upthv(1,i) / (1._r8+zvir*upqt(1,i)) - upth(1,i) = upthl(1,i) + upthl(kstart,i) = upthv(kstart,i) / (1._r8+zvir*upqt(kstart,i)) + upth(kstart,i) = upthl(kstart,i) + upmf(kstart,i) = rho_zm(kstart)*upa(kstart,i)*upw(kstart,i) ! get cloud, lowest momentum level if (do_condensation) then - call condensation_mf(upqt(1,i), upthl(1,i), p_zm(1), iexner_zm(1), & + call condensation_mf(upqt(kstart,i), upthl(kstart,i), p_zm(kstart), iexner_zm(kstart), & thvn, qcn, thn, qln, qin, qsn, lmixn) - upthv(1,i) = thvn - upqc(1,i) = qcn - upql(1,i) = qln - upqi(1,i) = qin - upqs(1,i) = qsn - upth(1,i) = thn - if (qcn > 0._r8) zcb(i) = zm(1) + upthv(kstart,i) = thvn + upqc(kstart,i) = qcn + upql(kstart,i) = qln + upqi(kstart,i) = qin + upqs(kstart,i) = qsn + upth(kstart,i) = thn + if (qcn > 0._r8) zcb(i) = zm(kstart) else ! assume no cldliq - upqc(1,i) = 0._r8 + upqc(kstart,i) = 0._r8 end if end do + ! if aloft extend the mass flux plume below kstart nbot levels + if (aloft) then + zsub = zm(kstart) + dzext = 1000._r8 + !if greater than dzext above the surface + if (zsub > dzext) then + ! find nbot levs below kstart + nbot = 0 + do k=kstart-1,nz,-1 + if ((zm(kstart)-zm(k)) < dzext) then + nbot = nbot + 1 + end if + end do + else + !else set dxext to height above the suface + dzext = zm(kstart) - zm(nz) + nbot = kstart-nz + end if + + zsub = zm(kstart) + do i=1,clubb_mf_nup + wcb = upw(kstart,i) + do k=kstart-1,kstart-nbot,-1 + !upw(k,i) = wcb - (wcb/(zsub**clubb_mf_ddexp))*(zsub - zm(k))**clubb_mf_ddexp + upw(k,i) = wcb - (wcb/(dzext**clubb_mf_ddexp))*(zsub - zm(k))**clubb_mf_ddexp + upa(k,i) = upa(kstart,i) + upmf(k,i) = rho_zm(k)*upa(k,i)*upw(k,i) + + upu(k,i) = upu(kstart,i) + upv(k,i) = upv(kstart,i) + upqt(k,i) = upqt(kstart,i) + upthv(k,i) = upthv(kstart,i) + upthl(k,i) = upthl(kstart,i) + upth(k,i) = upth(kstart,i) + upqc(k,i) = upqc(kstart,i) + upql(k,i) = upql(kstart,i) + upqi(k,i) = upqi(kstart,i) + upqs(k,i) = upqs(kstart,i) + end do + end do + end if + do i=1,clubb_mf_nup ! --------------------------------------------------------- ! ! Calculate ztop and dynamic_L based on value of namelist ! @@ -758,7 +856,7 @@ subroutine integrate_mf( nz, ! ! ! --------------------------------------------------------- ! do i=1,clubb_mf_nup - do k=1,nz-1 + do k=kstart,nz-1 ! get microphysics, autoconversion if (do_clubb_mf_precip .and. upqc(k,i) > 0._r8) then @@ -941,7 +1039,8 @@ subroutine integrate_mf( nz, end do !iter_xc - if (wn>0._r8) then +!+++arh - limit convection to within troposphere + if (wn>0._r8 .and. (k+1) Date: Tue, 1 Oct 2024 17:44:27 -0600 Subject: [PATCH 172/466] bug fixes qv_zt,th_zt, kstart for ztopm1 calc --- src/physics/cam/clubb_intr.F90 | 6 ++++++ src/physics/cam/clubb_mf.F90 | 11 ++++------- src/physics/clubb | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index e50910cc08..7b4b95275d 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -4099,12 +4099,16 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & kappa_zt(:,:) = 0._r8 qc_zt(:,:) = 0._r8 + qv_zt(:,:) = 0._r8 + th_zt(:,:) = 0._r8 invrs_exner_zt(:,:) = 0._r8 do k=1,pver do i=1,ncol kappa_zt(i,k+1) = (rairv(i,pver-k+1,lchnk)/cpairv(i,pver-k+1,lchnk)) qc_zt(i,k+1) = state1%q(i,pver-k+1,ixcldliq) + qv_zt(i,k+1) = state1%q(i,pver-k+1,ixq) + th_zt(i,k+1) = state1%t(i,pver-k+1)*inv_exner_clubb(i,pver-k+1) invrs_exner_zt(i,k+1) = inv_exner_clubb(i,pver-k+1) end do end do @@ -4112,6 +4116,8 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & do i=1,ncol kappa_zt(i,1) = kappa_zt(i,2) qc_zt(i,1) = qc_zt(i,2) + qv_zt(i,1) = qv_zt(i,2) + th_zt(i,1) = th_zt(i,2) invrs_exner_zt(i,1) = invrs_exner_zt(i,2) end do diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index accb4d238f..4f5d816081 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -628,7 +628,7 @@ subroutine integrate_mf( nz, kmid = 1 !+++arh !do while (zm(kmid) < 9.E3_r8) - do while (p_zm(kmid) > 600.E2_r8) + do while (p_zm(kmid) > 500.E2_r8) kmid = kmid+1 end do @@ -712,8 +712,6 @@ subroutine integrate_mf( nz, upa(kstart,i) = 0.5_r8 * erf( wtv/(sqrt(2._r8)*sigmaw) ) & - 0.5_r8 * erf( wlv/(sqrt(2._r8)*sigmaw) ) - !upmf(kstart,i)= rho_zm(kstart)*upa(kstart,i)*upw(kstart,i) - upu(kstart,i) = u(kstart) upv(kstart,i) = v(kstart) @@ -800,7 +798,6 @@ subroutine integrate_mf( nz, do i=1,clubb_mf_nup wcb = upw(kstart,i) do k=kstart-1,kstart-nbot,-1 - !upw(k,i) = wcb - (wcb/(zsub**clubb_mf_ddexp))*(zsub - zm(k))**clubb_mf_ddexp upw(k,i) = wcb - (wcb/(dzext**clubb_mf_ddexp))*(zsub - zm(k))**clubb_mf_ddexp upa(k,i) = upa(kstart,i) upmf(k,i) = rho_zm(k)*upa(k,i)*upw(k,i) @@ -1455,7 +1452,7 @@ subroutine integrate_mf( nz, ! ztopm1 calculation ! ! --------------------------------------------------------- ! do i=1,clubb_mf_nup - do k=1,nz + do k=kstart,nz ! return if no convection at k=2 if (k == 2 .and. ac(k) == 0._r8 .and. .not.aloft) then sqt(k) = 0_r8 @@ -1487,7 +1484,7 @@ subroutine integrate_mf( nz, cbm1 = 0._r8 do i=1,clubb_mf_nup kcbarr(i) = 0 - do k=1,nz + do k=kstart,nz if (upqc(k,i) > 0._r8) then kcbarr(i) = k exit @@ -1496,7 +1493,7 @@ subroutine integrate_mf( nz, ! find height of dry plumes if (kcbarr(i) == 0) then - do k=1,nz + do k=kstart,nz if (upw(k,i) <= 0._r8) then kcbarr(i) = k exit diff --git a/src/physics/clubb b/src/physics/clubb index 1da8b285e1..d224307f79 160000 --- a/src/physics/clubb +++ b/src/physics/clubb @@ -1 +1 @@ -Subproject commit 1da8b285e1b438be4db8cea6e13734520d07d02e +Subproject commit d224307f798b654f5312a9f035568c8a99ca400c From af3b17c0d7cff5d5d80c428f570cebc00e920eb1 Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 30 Oct 2024 08:26:11 -0600 Subject: [PATCH 173/466] enforce 4dz min and remove ktropo limiter --- src/physics/cam/clubb_mf.F90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 4f5d816081..e688cdebd6 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1037,7 +1037,8 @@ subroutine integrate_mf( nz, end do !iter_xc !+++arh - limit convection to within troposphere - if (wn>0._r8 .and. (k+1)0._r8 .and. (k+1)0._r8) then upthv(k+1,i) = thvn upthl(k+1,i) = thln @@ -1070,7 +1071,7 @@ subroutine integrate_mf( nz, else ! zero out plumes that terminate at k<3 - if (k<3) then + if ((k-kstart+1)<4) then supqt(:,i) = 0._r8 upauto(:,i)= 0._r8 supthl(:,i)= 0._r8 From a2850fab896feb13eebf0698aaba559d8b2f3c0e Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 30 Oct 2024 08:28:46 -0600 Subject: [PATCH 174/466] remove global scope from diagnostic pbuf vars --- src/physics/cam/clubb_intr.F90 | 64 +++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 7b4b95275d..c1b3bf8ec6 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -726,38 +726,38 @@ subroutine clubb_register_cam( ) call pbuf_add_field('DDCPMN' ,'global' , dtype_r8, (/clubb_mf_cp_ndt,pcols,clubb_mf_nup/), ddcpmn_idx) call pbuf_add_field('CBM1' ,'global' , dtype_r8, (/pcols/), cbm1_idx) call pbuf_add_field('CBM1_MACMIC' ,'physpkg', dtype_r8, (/pcols/), cbm1_macmic_idx) - call pbuf_add_field('up_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) - call pbuf_add_field('up_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) - call pbuf_add_field('dn_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) - call pbuf_add_field('dn_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic2_idx) - call pbuf_add_field('upa_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic1_idx) - call pbuf_add_field('upa_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic2_idx) - call pbuf_add_field('dna_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic1_idx) - call pbuf_add_field('dna_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic2_idx) - call pbuf_add_field('thlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic1_idx) - call pbuf_add_field('thlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic2_idx) - call pbuf_add_field('qtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic1_idx) - call pbuf_add_field('qtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic2_idx) - call pbuf_add_field('thld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic1_idx) - call pbuf_add_field('thld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic2_idx) - call pbuf_add_field('qtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic1_idx) - call pbuf_add_field('qtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic2_idx) - call pbuf_add_field('dthl_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic1_idx) - call pbuf_add_field('dthl_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic2_idx) - call pbuf_add_field('dqt_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic1_idx) - call pbuf_add_field('dqt_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic2_idx) - call pbuf_add_field('dthlu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic1_idx) - call pbuf_add_field('dthlu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic2_idx) - call pbuf_add_field('dqtu_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic1_idx) - call pbuf_add_field('dqtu_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic2_idx) - call pbuf_add_field('dthld_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic1_idx) - call pbuf_add_field('dthld_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic2_idx) - call pbuf_add_field('dqtd_macmic1' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic1_idx) - call pbuf_add_field('dqtd_macmic2' ,'global', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic2_idx) - call pbuf_add_field('ztop_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic1_idx) - call pbuf_add_field('ztop_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) - call pbuf_add_field('ddcp_macmic1' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) - call pbuf_add_field('ddcp_macmic2' ,'global', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) + call pbuf_add_field('up_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic1_idx) + call pbuf_add_field('up_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), up_macmic2_idx) + call pbuf_add_field('dn_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic1_idx) + call pbuf_add_field('dn_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dn_macmic2_idx) + call pbuf_add_field('upa_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic1_idx) + call pbuf_add_field('upa_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), upa_macmic2_idx) + call pbuf_add_field('dna_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic1_idx) + call pbuf_add_field('dna_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dna_macmic2_idx) + call pbuf_add_field('thlu_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic1_idx) + call pbuf_add_field('thlu_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thlu_macmic2_idx) + call pbuf_add_field('qtu_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic1_idx) + call pbuf_add_field('qtu_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtu_macmic2_idx) + call pbuf_add_field('thld_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic1_idx) + call pbuf_add_field('thld_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), thld_macmic2_idx) + call pbuf_add_field('qtd_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic1_idx) + call pbuf_add_field('qtd_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), qtd_macmic2_idx) + call pbuf_add_field('dthl_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic1_idx) + call pbuf_add_field('dthl_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dthl_macmic2_idx) + call pbuf_add_field('dqt_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic1_idx) + call pbuf_add_field('dqt_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps*clubb_mf_nup/), dqt_macmic2_idx) + call pbuf_add_field('dthlu_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic1_idx) + call pbuf_add_field('dthlu_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthlu_macmic2_idx) + call pbuf_add_field('dqtu_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic1_idx) + call pbuf_add_field('dqtu_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtu_macmic2_idx) + call pbuf_add_field('dthld_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic1_idx) + call pbuf_add_field('dthld_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dthld_macmic2_idx) + call pbuf_add_field('dqtd_macmic1' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic1_idx) + call pbuf_add_field('dqtd_macmic2' ,'physpkg', dtype_r8, (/pcols,pverp*cld_macmic_num_steps/), dqtd_macmic2_idx) + call pbuf_add_field('ztop_macmic1' ,'physpkg', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic1_idx) + call pbuf_add_field('ztop_macmic2' ,'physpkg', dtype_r8, (/pcols,cld_macmic_num_steps/), ztop_macmic2_idx) + call pbuf_add_field('ddcp_macmic1' ,'physpkg', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic1_idx) + call pbuf_add_field('ddcp_macmic2' ,'physpkg', dtype_r8, (/pcols,cld_macmic_num_steps/), ddcp_macmic2_idx) end if #endif From 268aa23c8723b6510542fd56839c337e3ae02806 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 13 Mar 2025 11:47:47 -0600 Subject: [PATCH 175/466] update rrtmgp external version; update radiation.F90 to match --- .gitmodules | 2 +- src/physics/rrtmgp/ext | 2 +- src/physics/rrtmgp/radiation.F90 | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8734952824..ac99d734fa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -79,7 +79,7 @@ path = src/physics/rrtmgp/ext url = https://github.com/earth-system-radiation/rte-rrtmgp.git fxrequired = AlwaysRequired - fxtag = v1.7 + fxtag = v1.9.1 fxDONOTUSEurl = https://github.com/earth-system-radiation/rte-rrtmgp.git [submodule "rrtmgp-data"] diff --git a/src/physics/rrtmgp/ext b/src/physics/rrtmgp/ext index 4d8c5df4c6..2d4a355473 160000 --- a/src/physics/rrtmgp/ext +++ b/src/physics/rrtmgp/ext @@ -1 +1 @@ -Subproject commit 4d8c5df4c63434aaab854afd1b02f5986d41dfb3 +Subproject commit 2d4a355473b632c7f6314714a70f5ddd759461f7 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 11a0db5413..a9df299096 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -54,6 +54,7 @@ module radiation use mo_source_functions, only: ty_source_func_lw use mo_fluxes, only: ty_fluxes_broadband use mo_fluxes_byband, only: ty_fluxes_byband +use mo_rte_kind, only: wl use string_utils, only: to_lower use cam_abortutils, only: endrun, handle_allocate_error @@ -1208,7 +1209,7 @@ subroutine radiation_tend( & ! Compute clear-sky fluxes. errmsg = rte_sw(& - atm_optics_sw, top_at_1, coszrs_day, toa_flux, & + atm_optics_sw, coszrs_day, toa_flux, & alb_dir, alb_dif, fswc) call stop_on_err(errmsg, sub, 'clear-sky rte_sw') @@ -1218,7 +1219,7 @@ subroutine radiation_tend( & ! Compute all-sky fluxes. errmsg = rte_sw(& - atm_optics_sw, top_at_1, coszrs_day, toa_flux, & + atm_optics_sw, coszrs_day, toa_flux, & alb_dir, alb_dif, fsw) call stop_on_err(errmsg, sub, 'all-sky rte_sw') !$acc end data @@ -1306,7 +1307,7 @@ subroutine radiation_tend( & call stop_on_err(errmsg, sub, 'aer_lw%increment') ! Compute clear-sky LW fluxes - errmsg = rte_lw(atm_optics_lw, top_at_1, sources_lw, emis_sfc, flwc) + errmsg = rte_lw(atm_optics_lw, sources_lw, emis_sfc, flwc) call stop_on_err(errmsg, sub, 'clear-sky rte_lw') ! Increment the gas+aerosol optics by the cloud optics. @@ -1314,7 +1315,7 @@ subroutine radiation_tend( & call stop_on_err(errmsg, sub, 'cloud_lw%increment') ! Compute all-sky LW fluxes - errmsg = rte_lw(atm_optics_lw, top_at_1, sources_lw, emis_sfc, flw) + errmsg = rte_lw(atm_optics_lw, sources_lw, emis_sfc, flw) call stop_on_err(errmsg, sub, 'all-sky rte_lw') !$acc end data @@ -1850,9 +1851,9 @@ subroutine coefs_init(coefs_file, available_gases, kdist) minor_limits_gpt_upper ! Send these to RRTMGP as logicals, ! but they have to be read from the netCDF as integers - logical, dimension(:), allocatable :: minor_scales_with_density_lower, & + logical(wl), dimension(:), allocatable :: minor_scales_with_density_lower, & minor_scales_with_density_upper - logical, dimension(:), allocatable :: scale_by_complement_lower, & + logical(wl), dimension(:), allocatable :: scale_by_complement_lower, & scale_by_complement_upper integer, dimension(:), allocatable :: int2log ! use this to convert integer-to-logical. integer, dimension(:), allocatable :: kminor_start_lower, kminor_start_upper From bbd3c3e6f44d2f2cd180d04a08588bce463fc97c Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Fri, 4 Apr 2025 17:27:40 -0600 Subject: [PATCH 176/466] update cloud chemistry --- src/chemistry/aerosol/mo_setsox.F90 | 236 +++++++++++++----------- src/chemistry/bulk_aero/aero_model.F90 | 1 - src/chemistry/carma_aero/aero_model.F90 | 1 - src/chemistry/modal_aero/aero_model.F90 | 1 - 4 files changed, 132 insertions(+), 107 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 0c0f990583..0b5582061d 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -14,13 +14,16 @@ module mo_setsox integer :: id_msa integer :: id_so2, id_nh3, id_hno3, id_h2o2, id_o3, id_ho2 - integer :: id_so4, id_h2so4 + integer :: id_so4, id_h2so4, id_co2 logical :: has_sox = .true. - logical :: inv_so2, inv_nh3, inv_hno3, inv_h2o2, inv_ox, inv_nh4no3, inv_ho2 + logical :: inv_so2, inv_nh3, inv_hno3, inv_h2o2, inv_ox, inv_nh4no3, inv_ho2, inv_co2 logical :: cloud_borne = .false. + ! Inidices for species in the shared array of Henry's Law constant parameters + integer :: heff_id_hno3, heff_id_so2, heff_id_nh3, heff_id_co2, heff_id_h2o2, heff_id_o3 + contains !----------------------------------------------------------------------- @@ -100,13 +103,33 @@ subroutine sox_inti id_ho2 = get_spc_ndx( 'HO2' ) endif - has_sox = (id_so2>0) .and. (id_h2o2>0) .and. (id_o3>0) .and. (id_ho2>0) + id_co2 = get_inv_ndx( 'CO2' ) + inv_co2 = id_co2 > 0 + if ( .not. inv_co2 ) then + id_co2 = get_spc_ndx( 'CO2' ) + endif + + has_sox = (id_so2>0) .and. (id_h2o2>0) .and. (id_o3>0) .and. (id_ho2>0) & + .and. (id_co2>0) if (cloud_borne) then has_sox = has_sox .and. (id_h2so4>0) else has_sox = has_sox .and. (id_so4>0) .and. (id_nh3>0) endif + ! Lookup Effective Henry's Law Constant parameters from the common + ! data file read in the shared code. + heff_id_hno3 = get_heff_index( 'HNO3' ) + heff_id_so2 = get_heff_index( 'SO2' ) + heff_id_nh3 = get_heff_index( 'NH3' ) + heff_id_co2 = get_heff_index( 'CO2' ) + heff_id_h2o2 = get_heff_index( 'H2O2' ) + heff_id_o3 = get_heff_index( 'OX' ) + + has_sox = has_sox .and. (heff_id_hno3 > 0) .and. (heff_id_so2 > 0) & + .and. (heff_id_nh3 > 0) .and. (heff_id_co2 > 0) & + .and. (heff_id_h2o2 > 0) .and. (heff_id_o3 > 0) + if (masterproc) then write(iulog,*) 'sox_inti: has_sox = ',has_sox endif @@ -144,7 +167,6 @@ subroutine setsox( state, & lwc, & cldfrc, & cldnum, & - xhnm, & invariants, & qcw, & qin, & @@ -171,6 +193,8 @@ subroutine setsox( state, & ! (b) PARTIONING ! (c) REACTION rates ! (d) PREDICTION + ! + ! NOTE: This routine assumes an Ideal Gas. !----------------------------------------------------------------------- ! use ppgrid, only : pcols, pver @@ -180,6 +204,7 @@ subroutine setsox( state, & use mo_constants, only : pi use sox_cldaero_mod, only : sox_cldaero_update, sox_cldaero_create_obj, sox_cldaero_destroy_obj use cldaero_mod, only : cldaero_conc_t + use shr_drydep_mod, only : dheff ! !----------------------------------------------------------------------- @@ -197,7 +222,6 @@ subroutine setsox( state, & real(r8), target, intent(in) :: lwc(:,:) ! cloud liquid water content (kg/kg) real(r8), target, intent(in) :: cldfrc(:,:) ! cloud fraction real(r8), intent(in) :: cldnum(:,:) ! droplet number concentration (#/kg) - real(r8), intent(in) :: xhnm(:,:) ! total atms density ( /cm**3) real(r8), intent(in) :: invariants(:,:,:) real(r8), target, intent(inout) :: qcw(:,:,:) ! cloud-borne aerosol (vmr) real(r8), intent(inout) :: qin(:,:,:) ! transported species ( vmr ) @@ -218,7 +242,13 @@ subroutine setsox( state, & !----------------------------------------------------------------------- integer, parameter :: itermax = 20 real(r8), parameter :: ph0 = 5.0_r8 ! INITIAL PH VALUES - real(r8), parameter :: const0 = 1.e3_r8/6.023e23_r8 + real(r8), parameter :: AVOGADRO = 6.02214076e23_r8 ! mol-1 + real(r8), parameter :: BOLTZMANN = 1.380649e-23_r8 ! J K-1 + real(r8), parameter :: PASCAL_TO_ATM = 1.0_r8 / 101325.0_r8 ! atm Pa-1 + real(r8), parameter :: M3_TO_L = 1.0e3_r8 ! L m-3 + real(r8), parameter :: M3_TO_CM3 = 1.0e6_r8 ! cm3 m-3 + real(r8), parameter :: SMALL_NUMBER = 1.0e-30_r8 + real(r8), parameter :: const0 = 1.e3_r8/AVOGADRO real(r8), parameter :: xa0 = 11._r8 real(r8), parameter :: xb0 = -.1_r8 real(r8), parameter :: xa1 = 1.053_r8 @@ -232,18 +262,18 @@ subroutine setsox( state, & real(r8), parameter :: kh1 = 2.05e-5_r8 ! HO2(a) -> H+ + O2- real(r8), parameter :: kh2 = 8.6e5_r8 ! HO2(a) + ho2(a) -> h2o2(a) + o2 real(r8), parameter :: kh3 = 1.e8_r8 ! HO2(a) + o2- -> h2o2(a) + o2 - real(r8), parameter :: Ra = 8314._r8/101325._r8 ! universal constant (atm)/(M-K) - real(r8), parameter :: xkw = 1.e-14_r8 ! water acidity + real(r8), parameter :: Ra = BOLTZMANN * AVOGADRO * M3_TO_L * PASCAL_TO_ATM ! universal constant (atm)/(M-K) ! real(r8) :: xdelso4hp(ncol,pver) + real(r8) :: xhnm(ncol,pver) ! air number density (molecules cm-3) integer :: k, i, iter, file real(r8) :: wrk, delta real(r8) :: xph0, aden, xk, xe, x2 - real(r8) :: tz, xl, px, qz, pz, es, qs, patm + real(r8) :: tz, xl, px, qz, es, qs, patm real(r8) :: Eso2, Eso4, Ehno3, Eco2, Eh2o, Enh3 - real(r8) :: so2g, h2o2g, co2g, o3g + real(r8) :: so2g, h2o2g, o3g real(r8) :: hno3a, nh3a, so2a, h2o2a, co2a, o3a real(r8) :: rah2o2, rao3, pso4, ccc real(r8) :: cnh3, chno3, com, com1, com2, xra @@ -261,7 +291,7 @@ subroutine setsox( state, & real(r8) :: r2h2o2 ! prod(h2o2) by ho2 in mix/s real(r8), dimension(ncol,pver) :: & - xhno3, xh2o2, xso2, xso4, xno3, & + xhno3, xh2o2, xso2, xso4, xno3, xco2, & xnh3, xnh4, xo3, & cfact, & xph, xho2, & @@ -272,8 +302,6 @@ subroutine setsox( state, & henh3, & ! henry law const for nh3 heo3 !!, & ! henry law const for o3 - real(r8) :: patm_x - real(r8), dimension(ncol) :: work1 logical :: converged @@ -285,6 +313,7 @@ subroutine setsox( state, & real(r8) :: fact1_hno3, fact2_hno3, fact3_hno3 real(r8) :: fact1_so2, fact2_so2, fact3_so2, fact4_so2 real(r8) :: fact1_nh3, fact2_nh3, fact3_nh3 + real(r8) :: fact1_co2, fact2_co2, fact3_co2, fact4_co2 real(r8) :: tmp_hp, tmp_hso3, tmp_hco3, tmp_nh4, tmp_no3 real(r8) :: tmp_oh, tmp_so3, tmp_so4 real(r8) :: tmp_neg, tmp_pos @@ -301,12 +330,13 @@ subroutine setsox( state, & ! ... Initial values ! The values of so2, so4 are after (1) SLT, and CHEM !----------------------------------------------------------------- + xhnm(:,:) = press(:,:) / (tfld(:,:) * M3_TO_CM3 * BOLTZMANN) ! air number density (molecules cm-3) xph0 = 10._r8**(-ph0) ! initial PH value do k = 1,pver cfact(:,k) = xhnm(:,k) & ! /cm3(a) * 1.e6_r8 & ! /m3(a) - * 1.38e-23_r8/287._r8 & ! Kg(a)/m3(a) + * BOLTZMANN/287._r8 & ! Kg(a)/m3(a) * 1.e-3_r8 ! Kg(a)/L(a) end do @@ -357,6 +387,12 @@ subroutine setsox( state, & xho2 (:,k) = qin(:,k,id_ho2) ! mixing ratio endif + if ( inv_co2 ) then + xco2 (:,k) = invariants(:,k,id_co2)/xhnm(:,k) ! mixing ratio + else + xco2 (:,k) = qin(:,k,id_co2) ! mixing ratio + endif + if (cloud_borne) then xh2so4(:,k) = qin(:,k,id_h2so4) else @@ -396,10 +432,9 @@ subroutine setsox( state, & !----------------------------------------------------------------- !----------------------------------------------------------------- - pz = .01_r8*press(i,k) !! pressure in mb tz = tfld(i,k) - patm = pz/1013._r8 - xam = press(i,k)/(1.38e-23_r8*tz) !air density /M3 + patm = press(i,k) * PASCAL_TO_ATM ! atm + xam = press(i,k)/(BOLTZMANN*tz) ! air density /M3 !----------------------------------------------------------------- ! ... hno3 @@ -418,8 +453,8 @@ subroutine setsox( state, & ! = xk*xe*patm*xhno3/(1 + xk*ra*tz*xl*(1 + xe/hplus) ! = ( fact1_hno3 )/(1 + fact2_hno3 *(1 + fact3_hno3/hplus) ! [hno3-] = ehno3/hplus - xk = 2.1e5_r8 *EXP( 8700._r8*work1(i) ) - xe = 15.4_r8 + xk = dheff(1,heff_id_hno3) * exp( dheff(2,heff_id_hno3) * work1(i) ) + xe = dheff(3,heff_id_hno3) * exp( dheff(4,heff_id_hno3) * work1(i) ) fact1_hno3 = xk*xe*patm*xhno3(i,k) fact2_hno3 = xk*ra*tz*xl fact3_hno3 = xe @@ -441,9 +476,9 @@ subroutine setsox( state, & ! = xk*xe*patm*xso2/(1 + xk*ra*tz*xl*(1 + (xe/hplus)*(1 + x2/hplus)) ! = ( fact1_so2 )/(1 + fact2_so2 *(1 + (fact3_so2/hplus)*(1 + fact4_so2/hplus) ! [hso3-] + 2*[so3--] = (eso2/hplus)*(1 + 2*x2/hplus) - xk = 1.23_r8 *EXP( 3120._r8*work1(i) ) - xe = 1.7e-2_r8*EXP( 2090._r8*work1(i) ) - x2 = 6.0e-8_r8*EXP( 1120._r8*work1(i) ) + xk = dheff(1,heff_id_so2) * exp( dheff(2,heff_id_so2) * work1(i) ) + xe = dheff(3,heff_id_so2) * exp( dheff(4,heff_id_so2) * work1(i) ) + x2 = dheff(5,heff_id_so2) * exp( dheff(6,heff_id_so2) * work1(i) ) fact1_so2 = xk*xe*patm*xso2(i,k) fact2_so2 = xk*ra*tz*xl fact3_so2 = xe @@ -466,25 +501,38 @@ subroutine setsox( state, & ! = ((xk*xe*patm/xkw)*xnh34)/(1 + xk*ra*tz*xl*(1 + xe*hplus/xkw) ! = ( fact1_nh3 )/(1 + fact2_nh3 *(1 + fact3_nh3*hplus) ! [nh4+] = enh3*hplus - xk = 58._r8 *EXP( 4085._r8*work1(i) ) - xe = 1.7e-5_r8*EXP( -4325._r8*work1(i) ) - - fact1_nh3 = (xk*xe*patm/xkw)*(xnh3(i,k)+xnh4(i,k)) + ! NOTE: Algorithm modified to follow that used in wet deposition. + ! This essentially replaces xkw (1.0e-14) with a temperature + ! dependent value for the water dissociation constant, x2. + xk = dheff(1,heff_id_nh3) * exp( dheff(2,heff_id_nh3) * work1(i) ) + xe = dheff(3,heff_id_nh3) * exp( dheff(4,heff_id_nh3) * work1(i) ) + x2 = dheff(5,heff_id_nh3) * exp( dheff(6,heff_id_nh3) * work1(i) ) + fact1_nh3 = (xk*xe*patm/x2)*(xnh3(i,k)+xnh4(i,k)) fact2_nh3 = xk*ra*tz*xl - fact3_nh3 = xe/xkw + fact3_nh3 = xe/x2 !----------------------------------------------------------------- ! ... h2o effects + ! NOTE: Algorithm modified to follow that used in wet deposition. + ! This essentially replaces xkw (1.0e-14) with a temperature + ! dependent value for the water dissociation constant, x2 + ! (calculated above with NH4 Heff terms). !----------------------------------------------------------------- - Eh2o = xkw + Eh2o = x2 !----------------------------------------------------------------- ! ... co2 effects + ! NOTE: Algorithm modified to follow that used in wet deposition. + ! This now applies the same algorithm for diprotic acids used + ! for SO2. !----------------------------------------------------------------- - co2g = 330.e-6_r8 !330 ppm = 330.e-6 atm - xk = 3.1e-2_r8*EXP( 2423._r8*work1(i) ) - xe = 4.3e-7_r8*EXP(-913._r8 *work1(i) ) - Eco2 = xk*xe*co2g *patm + xk = dheff(1,heff_id_co2) * exp( dheff(2,heff_id_co2) * work1(i) ) + xe = dheff(3,heff_id_co2) * exp( dheff(4,heff_id_co2) * work1(i) ) + x2 = dheff(5,heff_id_co2) * exp( dheff(6,heff_id_co2) * work1(i) ) + fact1_co2 = xk*xe*patm*xco2(i,k) + fact2_co2 = xk*ra*tz*xl + fact3_co2 = xe + fact4_co2 = x2 !----------------------------------------------------------------- ! ... so4 effect @@ -543,6 +591,12 @@ subroutine setsox( state, & !----------------------------------------------------------------- Enh3 = fact1_nh3/(1.0_r8 + fact2_nh3*(1.0_r8 + fact3_nh3*xph(i,k))) + !----------------------------------------------------------------- + ! ... co2 + !----------------------------------------------------------------- + Eco2 = fact1_co2/(1.0_r8 + fact2_co2*(1.0_r8 + (fact3_co2/xph(i,k)) & + *(1.0_r8 + fact4_co2/xph(i,k)))) + tmp_nh4 = Enh3 * xph(i,k) tmp_hso3 = Eso2 / xph(i,k) tmp_so3 = tmp_hso3 * 2.0_r8*fact4_so2/xph(i,k) @@ -635,29 +689,29 @@ subroutine setsox( state, & xl = cldconc%xlwc(i,k) - patm = press(i,k)/101300._r8 ! press is in pascal - xam = press(i,k)/(1.38e-23_r8*tz) ! air density /M3 + patm = press(i,k) * PASCAL_TO_ATM ! atm + xam = press(i,k)/(BOLTZMANN*tz) ! air density /M3 !----------------------------------------------------------------------- ! ... hno3 !----------------------------------------------------------------------- - xk = 2.1e5_r8 *EXP( 8700._r8*work1(i) ) - xe = 15.4_r8 + xk = dheff(1,heff_id_hno3) * exp( dheff(2,heff_id_hno3) * work1(i) ) + xe = dheff(3,heff_id_hno3) * exp( dheff(4,heff_id_hno3) * work1(i) ) hehno3(i,k) = xk*(1._r8 + xe/xph(i,k)) !----------------------------------------------------------------- ! ... h2o2 !----------------------------------------------------------------- - xk = 7.4e4_r8 *EXP( 6621._r8*work1(i) ) - xe = 2.2e-12_r8 *EXP(-3730._r8*work1(i) ) + xk = dheff(1,heff_id_co2) * exp( dheff(2,heff_id_co2) * work1(i) ) + xe = dheff(3,heff_id_co2) * exp( dheff(4,heff_id_co2) * work1(i) ) heh2o2(i,k) = xk*(1._r8 + xe/xph(i,k)) !----------------------------------------------------------------- ! ... so2 !----------------------------------------------------------------- - xk = 1.23_r8 *EXP( 3120._r8*work1(i) ) - xe = 1.7e-2_r8*EXP( 2090._r8*work1(i) ) - x2 = 6.0e-8_r8*EXP( 1120._r8*work1(i) ) + xk = dheff(1,heff_id_so2) * exp( dheff(2,heff_id_so2) * work1(i) ) + xe = dheff(3,heff_id_so2) * exp( dheff(4,heff_id_so2) * work1(i) ) + x2 = dheff(5,heff_id_so2) * exp( dheff(6,heff_id_so2) * work1(i) ) wrk = xe/xph(i,k) heso2(i,k) = xk*(1._r8 + wrk*(1._r8 + x2/xph(i,k))) @@ -665,14 +719,15 @@ subroutine setsox( state, & !----------------------------------------------------------------- ! ... nh3 !----------------------------------------------------------------- - xk = 58._r8 *EXP( 4085._r8*work1(i) ) - xe = 1.7e-5_r8*EXP(-4325._r8*work1(i) ) - henh3(i,k) = xk*(1._r8 + xe*xph(i,k)/xkw) + xk = dheff(1,heff_id_nh3) * exp( dheff(2,heff_id_nh3) * work1(i) ) + xe = dheff(3,heff_id_nh3) * exp( dheff(4,heff_id_nh3) * work1(i) ) + x2 = dheff(5,heff_id_nh3) * exp( dheff(6,heff_id_nh3) * work1(i) ) + henh3(i,k) = xk*(1._r8 + xe*xph(i,k)/x2) !----------------------------------------------------------------- ! ... o3 !----------------------------------------------------------------- - xk = 1.15e-2_r8 *EXP( 2560._r8*work1(i) ) + xk = dheff(1,heff_id_o3) * exp( dheff(2,heff_id_o3) * work1(i) ) heo3(i,k) = xk !------------------------------------------------------------------------ @@ -773,18 +828,12 @@ subroutine setsox( state, & IF (XL .ge. 1.e-8_r8) THEN !! WHEN CLOUD IS PRESENTED if (cloud_borne) then - patm_x = patm - else - patm_x = 1._r8 - endif - if (cloud_borne) then - - pso4 = rah2o2 * 7.4e4_r8*EXP(6621._r8*work1(i)) * h2o2g * patm_x & - * 1.23_r8 *EXP(3120._r8*work1(i)) * so2g * patm_x + pso4 = rah2o2 * 7.4e4_r8*EXP(6621._r8*work1(i)) * h2o2g * patm & + * 1.23_r8 *EXP(3120._r8*work1(i)) * so2g * patm else - pso4 = rah2o2 * heh2o2(i,k) * h2o2g * patm_x & - * heso2(i,k) * so2g * patm_x ! [M/s] + pso4 = rah2o2 * heh2o2(i,k) * h2o2g * patm & + * heso2(i,k) * so2g * patm ! [M/s] endif @@ -793,66 +842,30 @@ subroutine setsox( state, & / const0 & ! [/L(a)/s] / xhnm(i,k) + ! estimate the net production of so4, without exceeding reactant concentrations + xso4_init(i,k) = xso4(i,k) + ccc = max(min(pso4*dtime, min(xh2o2(i,k) - SMALL_NUMBER, xso2(i,k) - SMALL_NUMBER)), 0.0_r8) + xso4(i,k) = xso4(i,k) + ccc + xh2o2(i,k) = xh2o2(i,k) - ccc + xso2(i,k) = xso2(i,k) - ccc + xdelso4hp(i,k) = ccc - ccc = pso4*dtime - ccc = max(ccc, 1.e-30_r8) - - xso4_init(i,k)=xso4(i,k) - - IF (xh2o2(i,k) .gt. xso2(i,k)) THEN - if (ccc .gt. xso2(i,k)) then - xso4(i,k)=xso4(i,k)+xso2(i,k) - if (cloud_borne) then - xh2o2(i,k)=xh2o2(i,k)-xso2(i,k) - xso2(i,k)=1.e-20_r8 - else ! ???? bug ???? - xso2(i,k)=1.e-20_r8 - xh2o2(i,k)=xh2o2(i,k)-xso2(i,k) - endif - else - xso4(i,k) = xso4(i,k) + ccc - xh2o2(i,k) = xh2o2(i,k) - ccc - xso2(i,k) = xso2(i,k) - ccc - end if - - ELSE - if (ccc .gt. xh2o2(i,k)) then - xso4(i,k)=xso4(i,k)+xh2o2(i,k) - xso2(i,k)=xso2(i,k)-xh2o2(i,k) - xh2o2(i,k)=1.e-20_r8 - else - xso4(i,k) = xso4(i,k) + ccc - xh2o2(i,k) = xh2o2(i,k) - ccc - xso2(i,k) = xso2(i,k) - ccc - end if - END IF - - if (cloud_borne) then - xdelso4hp(i,k) = xso4(i,k) - xso4_init(i,k) - endif !........................... ! S(IV) + O3 = S(VI) !........................... - pso4 = rao3 * heo3(i,k)*o3g*patm_x * heso2(i,k)*so2g*patm_x ! [M/s] + pso4 = rao3 * heo3(i,k)*o3g*patm * heso2(i,k)*so2g*patm ! [M/s] pso4 = pso4 & ! [M/s] = [mole/L(w)/s] * xl & ! [mole/L(a)/s] / const0 & ! [/L(a)/s] / xhnm(i,k) ! [mixing ratio/s] - ccc = pso4*dtime - ccc = max(ccc, 1.e-30_r8) - - xso4_init(i,k)=xso4(i,k) - - if (ccc .gt. xso2(i,k)) then - xso4(i,k) = xso4(i,k) + xso2(i,k) - xso2(i,k) = 1.e-20_r8 - else - xso4(i,k) = xso4(i,k) + ccc - xso2(i,k) = xso2(i,k) - ccc - end if + ! estimate the net production of so4, without exceeding reactant concentrations + xso4_init(i,k) = xso4(i,k) + ccc = max(min(pso4*dtime, xso2(i,k) - SMALL_NUMBER), 0.0_r8) + xso4(i,k) = xso4(i,k) + ccc + xso2(i,k) = xso2(i,k) - ccc END IF !! WHEN CLOUD IS PRESENTED @@ -877,4 +890,19 @@ subroutine setsox( state, & end subroutine setsox + !----------------------------------------------------------------- + ! ... looks up Effective Henry's Law Constant parameters + !----------------------------------------------------------------- + pure elemental integer function get_heff_index(species_name) result(index) + use shr_drydep_mod, only: species_name_table, dheff + + character(len=*), intent(in) :: species_name + + do index = 1, size(species_name_table) + if (trim(adjustl(species_name)) == & + trim(adjustl(species_name_table(index)))) return + end do + index = -1 + end function get_heff_index + end module mo_setsox diff --git a/src/chemistry/bulk_aero/aero_model.F90 b/src/chemistry/bulk_aero/aero_model.F90 index 51779bd1b4..dc3684aed8 100644 --- a/src/chemistry/bulk_aero/aero_model.F90 +++ b/src/chemistry/bulk_aero/aero_model.F90 @@ -1078,7 +1078,6 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re cwat, & cldfr, & cldnum, & - airdens, & invariants, & vmrcw, & vmr, & diff --git a/src/chemistry/carma_aero/aero_model.F90 b/src/chemistry/carma_aero/aero_model.F90 index b50e1e8934..d409ad2df2 100644 --- a/src/chemistry/carma_aero/aero_model.F90 +++ b/src/chemistry/carma_aero/aero_model.F90 @@ -689,7 +689,6 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re cwat, & cldfr, & cldnum, & - airdens, & invariants, & vmrcw, & vmr, & diff --git a/src/chemistry/modal_aero/aero_model.F90 b/src/chemistry/modal_aero/aero_model.F90 index 593f1c83f5..3250eb27d2 100644 --- a/src/chemistry/modal_aero/aero_model.F90 +++ b/src/chemistry/modal_aero/aero_model.F90 @@ -1071,7 +1071,6 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re cwat, & cldfr, & cldnum, & - airdens, & invariants, & vmrcw, & vmr, & From 706359975a0999242208ed442b474bd1d8aeadc7 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 8 Apr 2025 10:33:43 -0600 Subject: [PATCH 177/466] update CO2 access --- src/chemistry/aerosol/mo_setsox.F90 | 34 ++++++++++++------------- src/chemistry/bulk_aero/aero_model.F90 | 1 + src/chemistry/carma_aero/aero_model.F90 | 1 + src/chemistry/modal_aero/aero_model.F90 | 1 + 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 0b5582061d..5645639690 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -14,10 +14,10 @@ module mo_setsox integer :: id_msa integer :: id_so2, id_nh3, id_hno3, id_h2o2, id_o3, id_ho2 - integer :: id_so4, id_h2so4, id_co2 + integer :: id_so4, id_h2so4 logical :: has_sox = .true. - logical :: inv_so2, inv_nh3, inv_hno3, inv_h2o2, inv_ox, inv_nh4no3, inv_ho2, inv_co2 + logical :: inv_so2, inv_nh3, inv_hno3, inv_h2o2, inv_ox, inv_nh4no3, inv_ho2 logical :: cloud_borne = .false. @@ -103,14 +103,7 @@ subroutine sox_inti id_ho2 = get_spc_ndx( 'HO2' ) endif - id_co2 = get_inv_ndx( 'CO2' ) - inv_co2 = id_co2 > 0 - if ( .not. inv_co2 ) then - id_co2 = get_spc_ndx( 'CO2' ) - endif - - has_sox = (id_so2>0) .and. (id_h2o2>0) .and. (id_o3>0) .and. (id_ho2>0) & - .and. (id_co2>0) + has_sox = (id_so2>0) .and. (id_h2o2>0) .and. (id_o3>0) .and. (id_ho2>0) if (cloud_borne) then has_sox = has_sox .and. (id_h2so4>0) else @@ -156,6 +149,7 @@ end subroutine sox_inti !----------------------------------------------------------------------- !----------------------------------------------------------------------- subroutine setsox( state, & + pbuf, & ncol, & lchnk, & loffset,& @@ -205,12 +199,14 @@ subroutine setsox( state, & use sox_cldaero_mod, only : sox_cldaero_update, sox_cldaero_create_obj, sox_cldaero_destroy_obj use cldaero_mod, only : cldaero_conc_t use shr_drydep_mod, only : dheff + use physics_buffer, only : physics_buffer_desc ! !----------------------------------------------------------------------- ! ... Dummy arguments !----------------------------------------------------------------------- - type(physics_state), intent(in) :: state ! Physics state variables + type(physics_state), intent(in) :: state ! Physics state variables + type(physics_buffer_desc), intent(in) :: pbuf ! Physics buffer integer, intent(in) :: ncol ! num of columns in chunk integer, intent(in) :: lchnk ! chunk id integer, intent(in) :: loffset ! offset of chem tracers in the advected tracers array @@ -249,6 +245,8 @@ subroutine setsox( state, & real(r8), parameter :: M3_TO_CM3 = 1.0e6_r8 ! cm3 m-3 real(r8), parameter :: SMALL_NUMBER = 1.0e-30_r8 real(r8), parameter :: const0 = 1.e3_r8/AVOGADRO + real(r8), parameter :: MOLECULAR_WEIGHT_DRY_AIR = 0.028966_r8 ! kg mol-1 + real(r8), parameter :: MOLECULAR_WEIGHT_CO2 = 0.044009_r8 ! kg mol-1 real(r8), parameter :: xa0 = 11._r8 real(r8), parameter :: xb0 = -.1_r8 real(r8), parameter :: xa1 = 1.053_r8 @@ -302,6 +300,8 @@ subroutine setsox( state, & henh3, & ! henry law const for nh3 heo3 !!, & ! henry law const for o3 + real(r8), pointer :: co2_mass_mixing_ratio(:,:) ! kg kg-1 + real(r8), dimension(ncol) :: work1 logical :: converged @@ -331,6 +331,9 @@ subroutine setsox( state, & ! The values of so2, so4 are after (1) SLT, and CHEM !----------------------------------------------------------------- xhnm(:,:) = press(:,:) / (tfld(:,:) * M3_TO_CM3 * BOLTZMANN) ! air number density (molecules cm-3) + + call rad_cnst_get_gas(0, 'CO2', state, pbuf, co2_mass_mixing_ratio) + xph0 = 10._r8**(-ph0) ! initial PH value do k = 1,pver @@ -352,6 +355,9 @@ subroutine setsox( state, & do k = 1,pver xph(:,k) = xph0 ! initial PH value + xco2(:,k) = co2_mass_mixing_ratio(:,k) & + * (MOLECULAR_WEIGHT_DRY_AIR / MOLECULAR_WEIGHT_CO2) ! mixing ratio + if ( inv_so2 ) then xso2 (:,k) = invariants(:,k,id_so2)/xhnm(:,k) ! mixing ratio else @@ -387,12 +393,6 @@ subroutine setsox( state, & xho2 (:,k) = qin(:,k,id_ho2) ! mixing ratio endif - if ( inv_co2 ) then - xco2 (:,k) = invariants(:,k,id_co2)/xhnm(:,k) ! mixing ratio - else - xco2 (:,k) = qin(:,k,id_co2) ! mixing ratio - endif - if (cloud_borne) then xh2so4(:,k) = qin(:,k,id_h2so4) else diff --git a/src/chemistry/bulk_aero/aero_model.F90 b/src/chemistry/bulk_aero/aero_model.F90 index dc3684aed8..1d71dd3216 100644 --- a/src/chemistry/bulk_aero/aero_model.F90 +++ b/src/chemistry/bulk_aero/aero_model.F90 @@ -1067,6 +1067,7 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re if( has_sox ) then call setsox( state, & + pbuf, & ncol, & lchnk, & loffset, & diff --git a/src/chemistry/carma_aero/aero_model.F90 b/src/chemistry/carma_aero/aero_model.F90 index d409ad2df2..211090f1c1 100644 --- a/src/chemistry/carma_aero/aero_model.F90 +++ b/src/chemistry/carma_aero/aero_model.F90 @@ -678,6 +678,7 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re if( has_sox ) then call setsox( state, & + pbuf, & ncol, & lchnk, & loffset, & diff --git a/src/chemistry/modal_aero/aero_model.F90 b/src/chemistry/modal_aero/aero_model.F90 index 3250eb27d2..08afce3bf2 100644 --- a/src/chemistry/modal_aero/aero_model.F90 +++ b/src/chemistry/modal_aero/aero_model.F90 @@ -1060,6 +1060,7 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re if( has_sox ) then call setsox( state, & + pbuf, & ncol, & lchnk, & loffset, & From 91257ba7523566cc222365ed61244091b67b9e8d Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 15 Apr 2025 16:57:52 -0600 Subject: [PATCH 178/466] update h2o2 production --- src/chemistry/aerosol/mo_setsox.F90 | 33 ++++++++------------ src/chemistry/modal_aero/sox_cldaero_mod.F90 | 10 +++--- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 5645639690..3f111ed41b 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -200,13 +200,14 @@ subroutine setsox( state, & use cldaero_mod, only : cldaero_conc_t use shr_drydep_mod, only : dheff use physics_buffer, only : physics_buffer_desc + use rad_constituents, only : rad_cnst_get_gas ! !----------------------------------------------------------------------- ! ... Dummy arguments !----------------------------------------------------------------------- - type(physics_state), intent(in) :: state ! Physics state variables - type(physics_buffer_desc), intent(in) :: pbuf ! Physics buffer + type(physics_state), intent(in) :: state ! Physics state variables + type(physics_buffer_desc), pointer, intent(inout) :: pbuf(:) ! Physics buffer integer, intent(in) :: ncol ! num of columns in chunk integer, intent(in) :: lchnk ! chunk id integer, intent(in) :: loffset ! offset of chem tracers in the advected tracers array @@ -330,7 +331,7 @@ subroutine setsox( state, & ! ... Initial values ! The values of so2, so4 are after (1) SLT, and CHEM !----------------------------------------------------------------- - xhnm(:,:) = press(:,:) / (tfld(:,:) * M3_TO_CM3 * BOLTZMANN) ! air number density (molecules cm-3) + xhnm(:ncol,:) = press(:ncol,:) / (tfld(:ncol,:) * M3_TO_CM3 * BOLTZMANN) ! air number density (molecules cm-3) call rad_cnst_get_gas(0, 'CO2', state, pbuf, co2_mass_mixing_ratio) @@ -355,7 +356,7 @@ subroutine setsox( state, & do k = 1,pver xph(:,k) = xph0 ! initial PH value - xco2(:,k) = co2_mass_mixing_ratio(:,k) & + xco2(:ncol,k) = co2_mass_mixing_ratio(:ncol,k) & * (MOLECULAR_WEIGHT_DRY_AIR / MOLECULAR_WEIGHT_CO2) ! mixing ratio if ( inv_so2 ) then @@ -736,22 +737,14 @@ subroutine setsox( state, & !------------------------------------------------------------------------ kh4 = (kh2 + kh3*kh1/xph(i,k)) / ((1._r8 + kh1/xph(i,k))**2) ho2s = kh0*xho2(i,k)*patm*(1._r8 + kh1/xph(i,k)) ! ho2s = ho2(a)+o2- - r1h2o2 = kh4*ho2s*ho2s ! prod(h2o2) in mole/L(w)/s - - if ( cloud_borne ) then - r2h2o2 = r1h2o2*xl & ! mole/L(w)/s * L(w)/fm3(a) = mole/fm3(a)/s - / const0*1.e+6_r8 & ! correct a bug here ???? - / xam - else - r2h2o2 = r1h2o2*xl & ! mole/L(w)/s * L(w)/fm3(a) = mole/fm3(a)/s - * const0 & ! mole/fm3(a)/s * 1.e-3 = mole/cm3(a)/s - / xam ! /cm3(a)/s / air-den = mix-ratio/s - endif - - if ( .not. cloud_borne) then ! this seems to be specific to aerosols that are not cloud borne - xh2o2(i,k) = xh2o2(i,k) + r2h2o2*dtime ! updated h2o2 by het production - endif - + r1h2o2 = kh4*ho2s*ho2s ! prod(h2o2) in mole/L(w)/s + r2h2o2 = r1h2o2 * xl & ! (mole(h2o2)/L(w)/s) * (L(w)/L(a)) + / xam & ! / (molecule(a)/m3(a)) + * AVOGADRO & ! * (molecule(a)/mole(a)) + * M3_TO_L ! * (L(a)/m3(a)) = mole(h2o2)/mole(a)/s + + xh2o2(i,k) = xh2o2(i,k) + r2h2o2*dtime ! updated h2o2 by het production + !----------------------------------------------- ! ... Partioning !----------------------------------------------- diff --git a/src/chemistry/modal_aero/sox_cldaero_mod.F90 b/src/chemistry/modal_aero/sox_cldaero_mod.F90 index 42cb7c51f6..ccd5d50381 100644 --- a/src/chemistry/modal_aero/sox_cldaero_mod.F90 +++ b/src/chemistry/modal_aero/sox_cldaero_mod.F90 @@ -448,11 +448,11 @@ subroutine sox_cldaero_update( & end do - qin(:,k,id_so2) = MAX( qin(:,k,id_so2), small_value ) - - if ( id_nh3 > 0 ) then - qin(:,k,id_nh3) = MAX( qin(:,k,id_nh3), small_value ) - endif + qin(:,k,id_so2) = MAX( qin(:,k,id_so2), small_value ) + qin(:,k,id_h2o2) = MAX( qin(:,k,id_h2o2), small_value ) + qin(:,k,id_h2so4) = MAX( qin(:,k,id_h2so4), small_value ) + if ( id_msa > 0 ) qin(:,k,id_msa) = MAX( qin(:,k,id_msa), small_value ) + if ( id_nh3 > 0 ) qin(:,k,id_nh3) = MAX( qin(:,k,id_nh3), small_value ) end do From 3ff691fb1411f0b5a0c8864ba91c118b03a1c8e1 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Thu, 17 Apr 2025 11:40:09 -0600 Subject: [PATCH 179/466] update HLC and reaction rate parameters and algorithms --- src/chemistry/aerosol/mo_setsox.F90 | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 3f111ed41b..2ed9867115 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -257,10 +257,10 @@ subroutine setsox( state, & real(r8), parameter :: xa3 = .816e-32_r8 real(r8), parameter :: xb3 = .259_r8 - real(r8), parameter :: kh0 = 9.e3_r8 ! HO2(g) -> Ho2(a) - real(r8), parameter :: kh1 = 2.05e-5_r8 ! HO2(a) -> H+ + O2- - real(r8), parameter :: kh2 = 8.6e5_r8 ! HO2(a) + ho2(a) -> h2o2(a) + o2 - real(r8), parameter :: kh3 = 1.e8_r8 ! HO2(a) + o2- -> h2o2(a) + o2 + real(r8), parameter :: kh0 = 690.0_r8 ! HO2(g) -> Ho2(a) Reference: JPL 19-5 + real(r8), parameter :: kh1 = 1.6e-5_r8 ! HO2(a) -> H+ + O2- Reference: JPL 19-5 + real(r8), parameter :: kh2 = 8.3e5_r8 ! HO2(a) + ho2(a) -> h2o2(a) + o2 Reference: JPL; Bielski et al. 1985 + real(r8), parameter :: kh3 = 9.7e7_r8 ! HO2(a) + o2- -> h2o2(a) + o2 Reference: JPL; Bielski et al. 1985 real(r8), parameter :: Ra = BOLTZMANN * AVOGADRO * M3_TO_L * PASCAL_TO_ATM ! universal constant (atm)/(M-K) ! @@ -276,6 +276,8 @@ subroutine setsox( state, & real(r8) :: hno3a, nh3a, so2a, h2o2a, co2a, o3a real(r8) :: rah2o2, rao3, pso4, ccc real(r8) :: cnh3, chno3, com, com1, com2, xra + real(r8) :: f_hso3 ! fraction of aqueous S(IV) that's HSO3- + real(r8) :: f_so3 ! fraction of aqueous S(IV) that's SO3= real(r8) :: hno3g(ncol,pver), nh3g(ncol,pver) ! @@ -717,6 +719,11 @@ subroutine setsox( state, & wrk = xe/xph(i,k) heso2(i,k) = xk*(1._r8 + wrk*(1._r8 + x2/xph(i,k))) + ! Calculate fraction of total aqueous S(IV) that is HSO3- and SO3= + wrk = xe/(xph(i,k)*xph(i,k) + xe*xph(i,k) + xe*x2) + f_hso3 = wrk*xph(i,k) ! [HSO3-]/[S(IV)] + f_so3 = wrk*x2 ! [SO3=]/[S(IV)] + !----------------------------------------------------------------- ! ... nh3 !----------------------------------------------------------------- @@ -791,15 +798,19 @@ subroutine setsox( state, & !------------------------------------------------------------------------ ! ... S(IV) (HSO3) + H2O2 + ! Reference: Seinfeld and Pandis textbook (chapter 6); + ! original source: Hoffmann and Calvert (1985) !------------------------------------------------------------------------ - rah2o2 = 8.e4_r8 * EXP( -3650._r8*work1(i) ) & - / (.1_r8 + xph(i,k)) + rah2o2 = 7.45e7_r8 * EXP( -4430.0_r8*work1(i) ) * xph(i,k) & + / (1.0_r8 + 13.0_r8*xph(i,k)) !------------------------------------------------------------------------ ! ... S(IV)+ O3 + ! Reference: Seinfeld and Pandis textbook (chapter 6); + ! original source: Hoffmann and Calvert (1985) !------------------------------------------------------------------------ - rao3 = 4.39e11_r8 * EXP(-4131._r8/tz) & - + 2.56e3_r8 * EXP(-996._r8 /tz) /xph(i,k) + rao3 = 3.75e5_r8 * EXP(-5530.0_r8*work1(i)) * f_hso3 & + + 1.59e9_r8 * EXP(-5280.0_r8*work1(i)) * f_so3 !----------------------------------------------------------------- ! ... Prediction after aqueous phase @@ -820,15 +831,8 @@ subroutine setsox( state, & IF (XL .ge. 1.e-8_r8) THEN !! WHEN CLOUD IS PRESENTED - if (cloud_borne) then - - pso4 = rah2o2 * 7.4e4_r8*EXP(6621._r8*work1(i)) * h2o2g * patm & - * 1.23_r8 *EXP(3120._r8*work1(i)) * so2g * patm - else - pso4 = rah2o2 * heh2o2(i,k) * h2o2g * patm & - * heso2(i,k) * so2g * patm ! [M/s] - - endif + pso4 = rah2o2 * heh2o2(i,k) * h2o2g * patm & + * f_hso3 * heso2(i,k) * so2g * patm ! [M/s] pso4 = pso4 & ! [M/s] = [mole/L(w)/s] * xl & ! [mole/L(a)/s] From 4bff5dbba2eaf8d44adb475fd61789d982a68885 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Wed, 30 Apr 2025 08:19:15 -0600 Subject: [PATCH 180/466] fix indices for h2o2 params --- src/chemistry/aerosol/mo_setsox.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 2ed9867115..0d4bfc98f6 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -705,8 +705,8 @@ subroutine setsox( state, & !----------------------------------------------------------------- ! ... h2o2 !----------------------------------------------------------------- - xk = dheff(1,heff_id_co2) * exp( dheff(2,heff_id_co2) * work1(i) ) - xe = dheff(3,heff_id_co2) * exp( dheff(4,heff_id_co2) * work1(i) ) + xk = dheff(1,heff_id_h2o2) * exp( dheff(2,heff_id_h2o2) * work1(i) ) + xe = dheff(3,heff_id_h2o2) * exp( dheff(4,heff_id_h2o2) * work1(i) ) heh2o2(i,k) = xk*(1._r8 + xe/xph(i,k)) !----------------------------------------------------------------- @@ -802,7 +802,7 @@ subroutine setsox( state, & ! original source: Hoffmann and Calvert (1985) !------------------------------------------------------------------------ rah2o2 = 7.45e7_r8 * EXP( -4430.0_r8*work1(i) ) * xph(i,k) & - / (1.0_r8 + 13.0_r8*xph(i,k)) + / (1.0_r8 + 13.0_r8*xph(i,k)) * f_hso3 !------------------------------------------------------------------------ ! ... S(IV)+ O3 @@ -832,7 +832,7 @@ subroutine setsox( state, & IF (XL .ge. 1.e-8_r8) THEN !! WHEN CLOUD IS PRESENTED pso4 = rah2o2 * heh2o2(i,k) * h2o2g * patm & - * f_hso3 * heso2(i,k) * so2g * patm ! [M/s] + * heso2(i,k) * so2g * patm ! [M/s] pso4 = pso4 & ! [M/s] = [mole/L(w)/s] * xl & ! [mole/L(a)/s] From 6571690a3df8d703c3f1f7ba8e1ddbfff3cd5eca Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 8 May 2025 18:14:46 -0400 Subject: [PATCH 181/466] Initial move of hb_diff code into atmos_phys. --- bld/configure | 1 + src/physics/cam/clubb_intr.F90 | 37 +- src/physics/cam/diffusion_solver.F90 | 2 - src/physics/cam/hb_diff.F90 | 792 ------------------------- src/physics/cam/vertical_diffusion.F90 | 395 ++++++++++-- 5 files changed, 366 insertions(+), 861 deletions(-) delete mode 100644 src/physics/cam/hb_diff.F90 diff --git a/bld/configure b/bld/configure index acde5f496d..d881a61267 100755 --- a/bld/configure +++ b/bld/configure @@ -2179,6 +2179,7 @@ sub write_filepath print $fh "$camsrcdir/src/atmos_phys/schemes/rayleigh_friction\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/cloud_fraction\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/holtslag_boville\n"; # Dynamics package and test utilities print $fh "$camsrcdir/src/dynamics/$dyn\n"; diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index d45655f31b..df35928f3e 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2105,7 +2105,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & use perf_mod, only: t_startf, t_stopf #ifdef CLUBB_SGS - use hb_diff, only: pblintd + use holtslag_boville_diff, only: hb_pbl_dependent_coefficients_run use clubb_api_module, only: & nparams, & setup_parameters_api, & @@ -4699,16 +4699,37 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & kbfs (1:ncol) = calc_kinematic_buoyancy_flux(kinheat(1:ncol), zvir, th(1:ncol,pver), kinwat(1:ncol)) obklen (1:ncol) = calc_obukhov_length(thv(1:ncol,pver), ustar2(1:ncol), gravit, karman, kbfs(1:ncol)) - dummy2(:) = 0._r8 - dummy3(:) = 0._r8 where (kbfs(:ncol) == -0.0_r8) kbfs(:ncol) = 0.0_r8 - ! Compute PBL depth according to Holtslag-Boville Scheme - call pblintd(ncol, thv, state1%zm, state1%u, state1%v, & - ustar2, obklen, kbfs, pblh, dummy2, & - state1%zi, cloud_frac(:,1:pver), 1._r8-cam_in%landfrac, dummy3) - + ! Compute PBL depth according to Holtslag-Boville Scheme -- only pblh is needed here + ! and other outputs are discarded + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + pblh(:) = 0._r8 + dummy2(:) = 0._r8 + dummy3(:) = 0._r8 + !REMOVECAM_END + call hb_pbl_dependent_coefficients_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + gravit = gravit, & + z = state%zm(:ncol,:pver), & + zi = state%zi(:ncol,:pverp), & + u = state%u(:ncol,:pver), & + v = state%v(:ncol,:pver), & + cldn = cldn(:ncol,:pver), & + ! Inputs from CLUBB (and not HB) + thv = thv(:ncol,:pver), & + ustar = ustar2(:ncol), & + kbfs = kbfs(:ncol), & + obklen = obklen(:ncol), & + ! Output variables + pblh = pblh(:ncol), & + wstar = dummy2(:ncol), & + bge = dummy3(:ncol), & + errmsg = errmsg, & + errflg = errflg) ! Assign the first pver levels of cloud_frac back to cld cld(:,1:pver) = cloud_frac(:,1:pver) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index 2a715596ea..2560e630c4 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -165,8 +165,6 @@ subroutine compute_vdiff( lchnk , use beljaars_drag_cam, only : do_beljaars ! FIXME: This should not be needed use air_composition, only: rairv - - use phys_control, only : phys_getopts ! Modification : Ideally, we should diffuse 'liquid-ice static energy' (sl), not the dry static energy. ! Also, vertical diffusion of cloud droplet number concentration and aerosol number diff --git a/src/physics/cam/hb_diff.F90 b/src/physics/cam/hb_diff.F90 deleted file mode 100644 index 81ad8ff7bf..0000000000 --- a/src/physics/cam/hb_diff.F90 +++ /dev/null @@ -1,792 +0,0 @@ -module hb_diff - !--------------------------------------------------------------------------------- - ! Module to compute mixing coefficients associated with turbulence in the - ! planetary boundary layer and elsewhere. PBL coefficients are based on Holtslag - ! and Boville, 1991. - ! - ! Public interfaces: - ! init_hb_diff initializes time independent coefficients - ! compute_hb_diff computes eddy diffusivities and counter-gradient fluxes - ! - ! Private methods: - ! trbintd initializes time dependent variables - ! pblintd initializes time dependent variables that depend pbl depth - ! austausch_pbl computes pbl exchange coefficients - ! - !---------------------------Code history-------------------------------- - ! Standardized: J. Rosinski, June 1992 - ! Reviewed: P. Rasch, B. Boville, August 1992 - ! Reviewed: P. Rasch, April 1996 - ! Reviewed: B. Boville, April 1996 - ! rewritten: B. Boville, May 2000 - ! rewritten: B. Stevens, August 2000 - ! modularized: J. McCaa, September 2004 - !--------------------------------------------------------------------------------- - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmd_utils, only: masterproc ! output from hb_init should be eliminated - use ppgrid, only: pver, pverp, pcols ! these should be passed in - use cam_logfile, only: iulog - - implicit none - private - save - - ! Public interfaces - public init_hb_diff - public compute_hb_diff - public compute_hb_free_atm_diff - public pblintd - ! - ! PBL limits - ! - real(r8), parameter :: pblmaxp = 4.e4_r8 ! pbl max depth in pressure units - real(r8), parameter :: zkmin = 0.01_r8 ! Minimum kneutral*f(ri) - ! - ! PBL Parameters - ! - real(r8), parameter :: onet = 1._r8/3._r8 ! 1/3 power in wind gradient expression - real(r8), parameter :: betam = 15.0_r8 ! Constant in wind gradient expression - real(r8), parameter :: betas = 5.0_r8 ! Constant in surface layer gradient expression - real(r8), parameter :: betah = 15.0_r8 ! Constant in temperature gradient expression - real(r8), parameter :: fakn = 7.2_r8 ! Constant in turbulent prandtl number - real(r8), parameter :: fak = 8.5_r8 ! Constant in surface temperature excess - real(r8), parameter :: ricr = 0.3_r8 ! Critical richardson number - real(r8), parameter :: sffrac= 0.1_r8 ! Surface layer fraction of boundary layer - real(r8), parameter :: binm = betam*sffrac ! betam * sffrac - real(r8), parameter :: binh = betah*sffrac ! betah * sffrac - - ! Pbl constants set using values from other parts of code - - real(r8) :: cpair ! Specific heat of dry air - real(r8) :: g ! Gravitational acceleration - real(r8) :: ml2(pverp) ! Mixing lengths squared - real(r8) :: vk ! Von Karman's constant - real(r8) :: ccon ! fak * sffrac * vk - - integer :: npbl ! Maximum number of levels in pbl from surface - integer :: ntop_turb ! Top level to which turbulent vertical diffusion is applied. - integer :: nbot_turb ! Bottom level to which turbulent vertical diff is applied. - -!=============================================================================== -CONTAINS -!=============================================================================== - -subroutine init_hb_diff(gravx, cpairx, ntop_eddy, nbot_eddy, pref_mid, & - vkx, eddy_scheme) - - !----------------------------------------------------------------------- - ! - ! Initialize time independent variables of turbulence/pbl package. - ! - !----------------------------------------------------------------------- - - !------------------------------Arguments-------------------------------- - real(r8), intent(in) :: gravx ! acceleration of gravity - real(r8), intent(in) :: cpairx ! specific heat of dry air - real(r8), intent(in) :: pref_mid(pver)! reference pressures at midpoints - real(r8), intent(in) :: vkx ! Von Karman's constant - integer, intent(in) :: ntop_eddy ! Top level to which eddy vert diff is applied. - integer, intent(in) :: nbot_eddy ! Bottom level to which eddy vert diff is applied. - character(len=16), intent(in) :: eddy_scheme - - !---------------------------Local workspace----------------------------- - integer :: k ! vertical loop index - !----------------------------------------------------------------------- - - ! Basic constants - cpair = cpairx - g = gravx - vk = vkx - ccon = fak*sffrac*vk - ntop_turb = ntop_eddy - nbot_turb = nbot_eddy - - ! Set the square of the mixing lengths. - ml2(ntop_turb) = 0._r8 - do k = ntop_turb+1, nbot_turb - ml2(k) = 30.0_r8**2 ! HB scheme: length scale = 30m - if ( eddy_scheme .eq. 'HBR' ) then - ml2(k) = 1.0_r8**2 ! HBR scheme: length scale = 1m - end if - end do - ml2(nbot_turb+1) = 0._r8 - - ! Limit pbl height to regions below 400 mb - ! npbl = max number of levels (from bottom) in pbl - - npbl = 0 - do k=nbot_turb,ntop_turb,-1 - if (pref_mid(k) >= pblmaxp) then - npbl = npbl + 1 - end if - end do - npbl = max(npbl,1) - - if (masterproc) then - write(iulog,*)'INIT_HB_DIFF: PBL height will be limited to bottom ',npbl, & - ' model levels. Top is ',pref_mid(pverp-npbl),' pascals' - end if - -end subroutine init_hb_diff - -!=============================================================================== - - subroutine compute_hb_diff(ncol , & - th ,t ,q ,z ,zi , & - pmid ,u ,v ,taux ,tauy , & - shflx ,qflx ,obklen ,ustar ,pblh , & - kvm ,kvh ,kvq ,cgh ,cgs , & - tpert ,qpert ,cldn ,ocnfrac ,tke , & - ri , & - eddy_scheme) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Interface routines for calcualtion and diatnostics of turbulence related - ! coefficients - ! - ! Author: B. Stevens (rewrite August 2000) - ! - !----------------------------------------------------------------------- - - use atmos_phys_pbl_utils, only: calc_virtual_temperature, calc_friction_velocity, calc_obukhov_length, & - calc_eddy_flux_coefficient, calc_ideal_gas_rrho, calc_kinematic_heat_flux, calc_kinematic_water_vapor_flux, & - calc_kinematic_buoyancy_flux - use physconst, only: zvir, rair, gravit, karman - - !------------------------------Arguments-------------------------------- - ! - ! Input arguments - ! - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: th(pcols,pver) ! potential temperature [K] - real(r8), intent(in) :: t(pcols,pver) ! temperature (used for density) - real(r8), intent(in) :: q(pcols,pver) ! specific humidity [kg/kg] - real(r8), intent(in) :: z(pcols,pver) ! height above surface [m] - real(r8), intent(in) :: zi(pcols,pverp) ! height above surface [m] - real(r8), intent(in) :: u(pcols,pver) ! zonal velocity - real(r8), intent(in) :: v(pcols,pver) ! meridional velocity - real(r8), intent(in) :: taux(pcols) ! zonal stress [N/m2] - real(r8), intent(in) :: tauy(pcols) ! meridional stress [N/m2] - real(r8), intent(in) :: shflx(pcols) ! sensible heat flux - real(r8), intent(in) :: qflx(pcols) ! water vapor flux - real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures - real(r8), intent(in) :: cldn(pcols,pver) ! new cloud fraction - real(r8), intent(in) :: ocnfrac(pcols) ! Land fraction - character(len=16), intent(in) :: eddy_scheme - - ! - ! Output arguments - ! - real(r8), intent(out) :: kvm(pcols,pverp) ! eddy diffusivity for momentum [m2/s] - real(r8), intent(out) :: kvh(pcols,pverp) ! eddy diffusivity for heat [m2/s] - real(r8), intent(out) :: kvq(pcols,pverp) ! eddy diffusivity for constituents [m2/s] - real(r8), intent(out) :: cgh(pcols,pverp) ! counter-gradient term for heat [J/kg/m] - real(r8), intent(out) :: cgs(pcols,pverp) ! counter-gradient star (cg/flux) - real(r8), intent(out) :: tpert(pcols) ! convective temperature excess - real(r8), intent(out) :: qpert(pcols) ! convective humidity excess - real(r8), intent(out) :: ustar(pcols) ! surface friction velocity [m/s] - real(r8), intent(out) :: obklen(pcols) ! Obukhov length - real(r8), intent(out) :: pblh(pcols) ! boundary-layer height [m] - real(r8), intent(out) :: tke(pcols,pverp) ! turbulent kinetic energy (estimated) - real(r8), intent(out) :: ri(pcols,pver) ! richardson number: n2/s2 - ! - !---------------------------Local workspace----------------------------- - ! - real(r8) :: thv(pcols,pver) ! virtual temperature - real(r8) :: rrho(pcols) ! 1./bottom level density - real(r8) :: wstar(pcols) ! convective velocity scale [m/s] - real(r8) :: kqfs(pcols) ! kinematic surf constituent flux (kg/m2/s) - real(r8) :: khfs(pcols) ! kinimatic surface heat flux - real(r8) :: kbfs(pcols) ! surface buoyancy flux - real(r8) :: kvf(pcols,pverp) ! free atmospheric eddy diffsvty [m2/s] - real(r8) :: s2(pcols,pver) ! shear squared - real(r8) :: n2(pcols,pver) ! brunt vaisaila frequency - real(r8) :: bge(pcols) ! buoyancy gradient enhancment - integer :: ktopbl(pcols) ! index of first midpoint inside pbl - integer :: i,k - ! - ! Initialize time dependent variables that do not depend on pbl height - ! - - ! virtual temperature - thv(:ncol,ntop_turb:) = calc_virtual_temperature(th(:ncol,ntop_turb:),q(:ncol,ntop_turb:), zvir) - - ! Compute ustar, Obukhov length, and kinematic surface fluxes. - rrho(:ncol) = calc_ideal_gas_rrho(rair, t(:ncol,pver), pmid(:ncol,pver)) - ustar(:ncol) = calc_friction_velocity(taux(:ncol),tauy(:ncol), rrho(:ncol)) - khfs(:ncol) = calc_kinematic_heat_flux(shflx(:ncol), rrho(:ncol), cpair) - kqfs(:ncol) = calc_kinematic_water_vapor_flux(qflx(:ncol), rrho(:ncol)) - kbfs(:ncol) = calc_kinematic_buoyancy_flux(khfs(:ncol), zvir, th(:ncol,pver), kqfs(:ncol)) - obklen(:ncol) = calc_obukhov_length(thv(:ncol,pver), ustar(:ncol), gravit, karman, kbfs(:ncol)) - - ! Calculate s2, n2, and Richardson number. - call trbintd(ncol , & - thv ,z ,u ,v , & - s2 ,n2 ,ri ) - ! - ! Initialize time dependent variables that do depend on pbl height - ! - call pblintd(ncol , & - thv ,z ,u ,v , & - ustar ,obklen ,kbfs ,pblh ,wstar , & - zi ,cldn ,ocnfrac ,bge ) - ! - ! Get atmosphere exchange coefficients - ! - kvf(:ncol,:) = 0.0_r8 - do k = ntop_turb, nbot_turb-1 - do i = 1, ncol - kvf(i,k+1) = calc_eddy_flux_coefficient(ml2(k), ri(i, k), s2(i, k)) - end do - end do - - ! - ! Get pbl exchange coefficients - ! - call austausch_pbl(ncol , & - z ,kvf ,kqfs ,khfs ,kbfs , & - obklen ,ustar ,wstar ,pblh ,kvm , & - kvh ,cgh ,cgs ,tpert ,qpert , & - ktopbl ,tke ,bge ,eddy_scheme) - ! - - kvq(:ncol,:) = kvh(:ncol,:) - end subroutine compute_hb_diff - - subroutine compute_hb_free_atm_diff(ncol, & - th ,t ,q ,z , & - pmid ,u ,v ,taux ,tauy , & - shflx ,qflx ,obklen ,ustar , & - kvm ,kvh ,kvq ,cgh ,cgs , & - ri ) - !----------------------------------------------------------------------- - ! - ! This is a version of compute_hb_diff that only computes free - ! atmosphere exchange (no PBL computations) - ! - ! Author: B. Stevens (rewrite August 2000) - ! Modified by Thomas Toniazzo and Peter H. Lauritzen (June 2023) - ! - !----------------------------------------------------------------------- - - use atmos_phys_pbl_utils, only: calc_virtual_temperature, calc_friction_velocity, calc_obukhov_length, & - calc_free_atm_eddy_flux_coefficient, calc_ideal_gas_rrho, calc_kinematic_heat_flux, calc_kinematic_water_vapor_flux, & - calc_kinematic_buoyancy_flux - use physconst, only: zvir, rair, gravit, karman - - !------------------------------Arguments-------------------------------- - ! - ! Input arguments - ! - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: th(pcols,pver) ! potential temperature [K] - real(r8), intent(in) :: t(pcols,pver) ! temperature (used for density) - real(r8), intent(in) :: q(pcols,pver) ! specific humidity [kg/kg] - real(r8), intent(in) :: z(pcols,pver) ! height above surface [m] - real(r8), intent(in) :: u(pcols,pver) ! zonal velocity - real(r8), intent(in) :: v(pcols,pver) ! meridional velocity - real(r8), intent(in) :: taux(pcols) ! zonal stress [N/m2] - real(r8), intent(in) :: tauy(pcols) ! meridional stress [N/m2] - real(r8), intent(in) :: shflx(pcols) ! sensible heat flux - real(r8), intent(in) :: qflx(pcols) ! water vapor flux - real(r8), intent(in) :: pmid(pcols,pver) ! midpoint pressures - ! - ! Output arguments - ! - real(r8), intent(out) :: kvm(pcols,pverp) ! eddy diffusivity for momentum [m2/s] - real(r8), intent(out) :: kvh(pcols,pverp) ! eddy diffusivity for heat [m2/s] - real(r8), intent(out) :: kvq(pcols,pverp) ! eddy diffusivity for constituents [m2/s] - real(r8), intent(out) :: cgh(pcols,pverp) ! counter-gradient term for heat [J/kg/m] - real(r8), intent(out) :: cgs(pcols,pverp) ! counter-gradient star (cg/flux) - real(r8), intent(out) :: ustar(pcols) ! surface friction velocity [m/s] - real(r8), intent(out) :: obklen(pcols) ! Obukhov length - real(r8), intent(out) :: ri(pcols,pver) ! richardson number: n2/s2 - ! - !---------------------------Local workspace----------------------------- - ! - real(r8) :: thv(pcols,pver) ! virtual potential temperature - real(r8) :: rrho(pcols) ! 1./bottom level density - real(r8) :: kqfs(pcols) ! kinematic surf constituent flux (kg/m2/s) - real(r8) :: khfs(pcols) ! kinimatic surface heat flux - real(r8) :: kbfs(pcols) ! surface buoyancy flux - real(r8) :: kvf(pcols,pverp) ! free atmospheric eddy diffsvty [m2/s] - real(r8) :: s2(pcols,pver) ! shear squared - real(r8) :: n2(pcols,pver) ! brunt vaisaila frequency - integer :: i, k - - ! virtual potential temperature - thv(:ncol,ntop_turb:) = calc_virtual_temperature(th(:ncol,ntop_turb:),q(:ncol,ntop_turb:), zvir) - - ! Compute ustar, Obukhov length, and kinematic surface fluxes. - rrho(:ncol) = calc_ideal_gas_rrho(rair, t(:ncol,pver), pmid(:ncol,pver)) - ustar(:ncol) = calc_friction_velocity(taux(:ncol),tauy(:ncol), rrho(:ncol)) - khfs(:ncol) = calc_kinematic_heat_flux(shflx(:ncol), rrho(:ncol), cpair) - kqfs(:ncol) = calc_kinematic_water_vapor_flux(qflx(:ncol), rrho(:ncol)) - kbfs(:ncol) = calc_kinematic_buoyancy_flux(khfs(:ncol), zvir, th(:ncol,pver), kqfs(:ncol)) - obklen(:ncol) = calc_obukhov_length(thv(:ncol,pver), ustar(:ncol), gravit, karman, kbfs(:ncol)) - ! Calculate s2, n2, and Richardson number. - call trbintd(ncol , & - thv ,z ,u ,v , & - s2 ,n2 ,ri ) - ! - ! Get free atmosphere exchange coefficients - ! - kvf(:ncol,:) = 0.0_r8 - do k = ntop_turb, nbot_turb - 1 - do i = 1, ncol - kvf(i,k+1) = calc_free_atm_eddy_flux_coefficient(ml2(k), ri(i, k), s2(i, k)) - end do - end do - - kvq(:ncol,:) = kvf(:ncol,:) - kvm(:ncol,:) = kvf(:ncol,:) - kvh(:ncol,:) = kvf(:ncol,:) - cgh(:ncol,:) = 0._r8 - cgs(:ncol,:) = 0._r8 - - end subroutine compute_hb_free_atm_diff - - - ! - !=============================================================================== - subroutine trbintd(ncol , & - thv ,z ,u ,v , & - s2 ,n2 ,ri ) - - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Time dependent initialization - ! - ! Method: - ! Diagnosis of variables that do not depend on mixing assumptions or - ! PBL depth - ! - ! Author: B. Stevens (extracted from pbldiff, August, 2000) - ! - !----------------------------------------------------------------------- - !------------------------------Arguments-------------------------------- - ! - ! Input arguments - ! - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: thv(pcols,pver) ! virtual temperature - real(r8), intent(in) :: z(pcols,pver) ! height above surface [m] - real(r8), intent(in) :: u(pcols,pver) ! windspeed x-direction [m/s] - real(r8), intent(in) :: v(pcols,pver) ! windspeed y-direction [m/s] - - ! - ! Output arguments - ! - real(r8), intent(out) :: s2(pcols,pver) ! shear squared - real(r8), intent(out) :: n2(pcols,pver) ! brunt vaisaila frequency - real(r8), intent(out) :: ri(pcols,pver) ! richardson number: n2/s2 - ! - !---------------------------Local workspace----------------------------- - ! - integer :: i ! longitude index - integer :: k ! level index - - real(r8) :: vvk ! velocity magnitude squared - real(r8) :: dvdz2 ! velocity shear squared - real(r8) :: dz ! delta z between midpoints - ! - ! Compute shear squared (s2), brunt vaisaila frequency (n2) and related richardson - ! number (ri). Use virtual temperature to compute n2. - ! - - do k=ntop_turb,nbot_turb-1 - do i=1,ncol - dvdz2 = (u(i,k)-u(i,k+1))**2 + (v(i,k)-v(i,k+1))**2 - dvdz2 = max(dvdz2,1.e-36_r8) - dz = z(i,k) - z(i,k+1) - s2(i,k) = dvdz2/(dz**2) - n2(i,k) = g*2.0_r8*( thv(i,k) - thv(i,k+1))/((thv(i,k) + thv(i,k+1))*dz) - ri(i,k) = n2(i,k)/s2(i,k) - end do - end do - - return - end subroutine trbintd - ! - !=============================================================================== - subroutine pblintd(ncol , & - thv ,z ,u ,v , & - ustar ,obklen ,kbfs ,pblh ,wstar , & - zi ,cldn ,ocnfrac ,bge ) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Diagnose standard PBL variables - ! - ! Method: - ! Diagnosis of PBL depth and related variables. In this case only wstar. - ! The PBL depth follows: - ! Holtslag, A.A.M., and B.A. Boville, 1993: - ! Local versus Nonlocal Boundary-Layer Diffusion in a Global Climate - ! Model. J. Clim., vol. 6., p. 1825--1842. - ! - ! Updated by Holtslag and Hack to exclude the surface layer from the - ! definition of the boundary layer Richardson number. Ri is now defined - ! across the outer layer of the pbl (between the top of the surface - ! layer and the pbl top) instead of the full pbl (between the surface and - ! the pbl top). For simiplicity, the surface layer is assumed to be the - ! region below the first model level (otherwise the boundary layer depth - ! determination would require iteration). - ! - ! Modified for boundary layer height diagnosis: Bert Holtslag, june 1994 - ! >>>>>>>>> (Use ricr = 0.3 in this formulation) - ! - ! Author: B. Stevens (extracted from pbldiff, August 2000) - ! - !----------------------------------------------------------------------- - !------------------------------Arguments-------------------------------- - ! - ! Input arguments - ! - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: thv(pcols,pver) ! virtual temperature - real(r8), intent(in) :: z(pcols,pver) ! height above surface [m] - real(r8), intent(in) :: u(pcols,pver) ! windspeed x-direction [m/s] - real(r8), intent(in) :: v(pcols,pver) ! windspeed y-direction [m/s] - real(r8), intent(in) :: ustar(pcols) ! surface friction velocity [m/s] - real(r8), intent(in) :: obklen(pcols) ! Obukhov length - real(r8), intent(in) :: kbfs(pcols) ! sfc kinematic buoyancy flux [m^2/s^3] - real(r8), intent(in) :: zi(pcols,pverp) ! height above surface [m] - real(r8), intent(in) :: cldn(pcols,pver) ! new cloud fraction - real(r8), intent(in) :: ocnfrac(pcols) ! Land fraction - - ! - ! Output arguments - ! - real(r8), intent(out) :: wstar(pcols) ! convective sclae velocity [m/s] - real(r8), intent(out) :: pblh(pcols) ! boundary-layer height [m] - real(r8), intent(out) :: bge(pcols) ! buoyancy gradient enhancment - ! - !---------------------------Local parameters---------------------------- - ! - real(r8), parameter :: tiny = 1.e-36_r8 ! lower bound for wind magnitude - real(r8), parameter :: fac = 100._r8 ! ustar parameter in height diagnosis - ! - !---------------------------Local workspace----------------------------- - ! - integer :: i ! longitude index - integer :: k ! level index - - real(r8) :: phiminv(pcols) ! inverse phi function for momentum - real(r8) :: phihinv(pcols) ! inverse phi function for heat - real(r8) :: rino(pcols,pver) ! bulk Richardson no. from level to ref lev - real(r8) :: tlv(pcols) ! ref. level pot tmp + tmp excess - real(r8) :: vvk ! velocity magnitude squared - - logical :: unstbl(pcols) ! pts w/unstbl pbl (positive virtual ht flx) - logical :: check(pcols) ! True=>chk if Richardson no.>critcal - logical :: ocncldcheck(pcols) ! True=>if ocean surface and cloud in lowest layer - ! - ! Compute Obukhov length virtual temperature flux and various arrays for use later: - ! - do i=1,ncol - check(i) = .true. - rino(i,pver) = 0.0_r8 - pblh(i) = z(i,pver) - end do - ! - ! - ! PBL height calculation: Scan upward until the Richardson number between - ! the first level and the current level exceeds the "critical" value. - ! - do k=pver-1,pver-npbl+1,-1 - do i=1,ncol - if (check(i)) then - vvk = (u(i,k) - u(i,pver))**2 + (v(i,k) - v(i,pver))**2 + fac*ustar(i)**2 - vvk = max(vvk,tiny) - rino(i,k) = g*(thv(i,k) - thv(i,pver))*(z(i,k)-z(i,pver))/(thv(i,pver)*vvk) - if (rino(i,k) >= ricr) then - pblh(i) = z(i,k+1) + (ricr - rino(i,k+1))/(rino(i,k) - rino(i,k+1)) * & - (z(i,k) - z(i,k+1)) - check(i) = .false. - end if - end if - end do - end do - ! - ! Estimate an effective surface temperature to account for surface fluctuations - ! - do i=1,ncol - if (check(i)) pblh(i) = z(i,pverp-npbl) - unstbl(i) = (kbfs(i) > 0._r8) - check(i) = (kbfs(i) > 0._r8) - if (check(i)) then - phiminv(i) = (1._r8 - binm*pblh(i)/obklen(i))**onet - rino(i,pver) = 0.0_r8 - tlv(i) = thv(i,pver) + kbfs(i)*fak/( ustar(i)*phiminv(i) ) - end if - end do - ! - ! Improve pblh estimate for unstable conditions using the convective temperature excess: - ! - do i = 1,ncol - bge(i) = 1.e-8_r8 - end do - do k=pver-1,pver-npbl+1,-1 - do i=1,ncol - if (check(i)) then - vvk = (u(i,k) - u(i,pver))**2 + (v(i,k) - v(i,pver))**2 + fac*ustar(i)**2 - vvk = max(vvk,tiny) - rino(i,k) = g*(thv(i,k) - tlv(i))*(z(i,k)-z(i,pver))/(thv(i,pver)*vvk) - if (rino(i,k) >= ricr) then - pblh(i) = z(i,k+1) + (ricr - rino(i,k+1))/(rino(i,k) - rino(i,k+1))* & - (z(i,k) - z(i,k+1)) - bge(i) = 2._r8*g/(thv(i,k)+thv(i,k+1))*(thv(i,k)-thv(i,k+1))/(z(i,k)-z(i,k+1))*pblh(i) - if (bge(i).lt.0._r8) then - bge(i) = 1.e-8_r8 - endif - check(i) = .false. - end if - end if - end do - end do - ! - ! PBL height must be greater than some minimum mechanical mixing depth - ! Several investigators have proposed minimum mechanical mixing depth - ! relationships as a function of the local friction velocity, u*. We - ! make use of a linear relationship of the form h = c u* where c=700. - ! The scaling arguments that give rise to this relationship most often - ! represent the coefficient c as some constant over the local coriolis - ! parameter. Here we make use of the experimental results of Koracin - ! and Berkowicz (1988) [BLM, Vol 43] for wich they recommend 0.07/f - ! where f was evaluated at 39.5 N and 52 N. Thus we use a typical mid - ! latitude value for f so that c = 0.07/f = 700. Also, do not allow - ! PBL to exceed some maximum (npbl) number of allowable points - ! - do i=1,ncol - if (check(i)) pblh(i) = z(i,pverp-npbl) - pblh(i) = max(pblh(i),700.0_r8*ustar(i)) - wstar(i) = (max(0._r8,kbfs(i))*g*pblh(i)/thv(i,pver))**onet - end do - ! - ! Final requirement on PBL heightis that it must be greater than the depth - ! of the lowest model level over ocean if there is any cloud diagnosed in - ! the lowest model level. This is to deal with the inadequacies of the - ! current "dry" formulation of the boundary layer, where this test is - ! used to identify circumstances where there is marine stratus in the - ! lowest level, and to provide a weak ventilation of the layer to avoid - ! a pathology in the cloud scheme (locking in low-level stratiform cloud) - ! If over an ocean surface, and any cloud is diagnosed in the - ! lowest level, set pblh to 50 meters higher than top interface of lowest level - ! - ! jrm This is being applied everywhere (not just ocean)! - do i=1,ncol - ocncldcheck(i) = .false. - if (cldn(i,pver).ge.0.0_r8) ocncldcheck(i) = .true. - if (ocncldcheck(i)) pblh(i) = max(pblh(i),zi(i,pver) + 50._r8) - end do - ! - return - end subroutine pblintd - ! - !=============================================================================== - subroutine austausch_pbl(ncol , & - z ,kvf ,kqfs ,khfs ,kbfs , & - obklen ,ustar ,wstar ,pblh ,kvm , & - kvh ,cgh ,cgs ,tpert ,qpert , & - ktopbl ,tke ,bge ,eddy_scheme) - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Atmospheric Boundary Layer Computation - ! - ! Method: - ! Nonlocal scheme that determines eddy diffusivities based on a - ! specified boundary layer height and a turbulent velocity scale; - ! also, countergradient effects for heat and moisture, and constituents - ! are included, along with temperature and humidity perturbations which - ! measure the strength of convective thermals in the lower part of the - ! atmospheric boundary layer. - ! - ! For more information, see Holtslag, A.A.M., and B.A. Boville, 1993: - ! Local versus Nonlocal Boundary-Layer Diffusion in a Global Climate - ! Model. J. Clim., vol. 6., p. 1825--1842. - ! - ! Updated by Holtslag and Hack to exclude the surface layer from the - ! definition of the boundary layer Richardson number. Ri is now defined - ! across the outer layer of the pbl (between the top of the surface - ! layer and the pbl top) instead of the full pbl (between the surface and - ! the pbl top). For simiplicity, the surface layer is assumed to be the - ! region below the first model level (otherwise the boundary layer depth - ! determination would require iteration). - ! - ! Author: B. Boville, B. Stevens (rewrite August 2000) - ! - !------------------------------Arguments-------------------------------- - ! - ! Input arguments - ! - integer, intent(in) :: ncol ! number of atmospheric columns - - real(r8), intent(in) :: z(pcols,pver) ! height above surface [m] - real(r8), intent(in) :: kvf(pcols,pverp) ! free atmospheric eddy diffsvty [m2/s] - real(r8), intent(in) :: kqfs(pcols) ! kinematic surf cnstituent flux (kg/m2/s) - real(r8), intent(in) :: khfs(pcols) ! kinimatic surface heat flux - real(r8), intent(in) :: kbfs(pcols) ! surface buoyancy flux - real(r8), intent(in) :: pblh(pcols) ! boundary-layer height [m] - real(r8), intent(in) :: obklen(pcols) ! Obukhov length - real(r8), intent(in) :: ustar(pcols) ! surface friction velocity [m/s] - real(r8), intent(in) :: wstar(pcols) ! convective velocity scale [m/s] - real(r8), intent(in) :: bge(pcols) ! buoyancy gradient enhancment - character(len=16), intent(in) :: eddy_scheme - - ! - ! Output arguments - ! - real(r8), intent(out) :: kvm(pcols,pverp) ! eddy diffusivity for momentum [m2/s] - real(r8), intent(out) :: kvh(pcols,pverp) ! eddy diffusivity for heat [m2/s] - real(r8), intent(out) :: cgh(pcols,pverp) ! counter-gradient term for heat [J/kg/m] - real(r8), intent(out) :: cgs(pcols,pverp) ! counter-gradient star (cg/flux) - real(r8), intent(out) :: tpert(pcols) ! convective temperature excess - real(r8), intent(out) :: qpert(pcols) ! convective humidity excess - - integer, intent(out) :: ktopbl(pcols) ! index of first midpoint inside pbl - real(r8), intent(out) :: tke(pcols,pverp) ! turbulent kinetic energy (estimated) - ! - !---------------------------Local workspace----------------------------- - ! - integer :: i ! longitude index - integer :: k ! level index - - real(r8) :: phiminv(pcols) ! inverse phi function for momentum - real(r8) :: phihinv(pcols) ! inverse phi function for heat - real(r8) :: wm(pcols) ! turbulent velocity scale for momentum - real(r8) :: zp(pcols) ! current level height + one level up - real(r8) :: fak1(pcols) ! k*ustar*pblh - real(r8) :: fak2(pcols) ! k*wm*pblh - real(r8) :: fak3(pcols) ! fakn*wstar/wm - real(r8) :: pblk(pcols) ! level eddy diffusivity for momentum - real(r8) :: pr(pcols) ! Prandtl number for eddy diffusivities - real(r8) :: zl(pcols) ! zmzp / Obukhov length - real(r8) :: zh(pcols) ! zmzp / pblh - real(r8) :: zzh(pcols) ! (1-(zmzp/pblh))**2 - real(r8) :: zmzp ! level height halfway between zm and zp - real(r8) :: term ! intermediate calculation - real(r8) :: kve ! diffusivity at entrainment layer in unstable cases - - logical :: unstbl(pcols) ! pts w/unstbl pbl (positive virtual ht flx) - logical :: pblpt(pcols) ! pts within pbl - ! - ! Initialize height independent arrays - ! - - !drb initialize variables for runtime error checking - kvm = 0._r8 - kvh = 0._r8 - kve = 0._r8 - cgh = 0._r8 - cgs = 0._r8 - tpert = 0._r8 - qpert = 0._r8 - ktopbl = 0._r8 - tke = 0._r8 - - do i=1,ncol - unstbl(i) = (kbfs(i) > 0._r8) - pblk(i) = 0.0_r8 - fak1(i) = ustar(i)*pblh(i)*vk - if (unstbl(i)) then - phiminv(i) = (1._r8 - binm*pblh(i)/obklen(i))**onet - phihinv(i) = sqrt(1._r8 - binh*pblh(i)/obklen(i)) - wm(i) = ustar(i)*phiminv(i) - fak2(i) = wm(i)*pblh(i)*vk - fak3(i) = fakn*wstar(i)/wm(i) - tpert(i) = max(khfs(i)*fak/wm(i),0._r8) - qpert(i) = max(kqfs(i)*fak/wm(i),0._r8) - else - tpert(i) = max(khfs(i)*fak/ustar(i),0._r8) - qpert(i) = max(kqfs(i)*fak/ustar(i),0._r8) - end if - end do - ! - ! Initialize output arrays with free atmosphere values - ! - do k=1,pverp - do i=1,ncol - kvm(i,k) = kvf(i,k) - kvh(i,k) = kvf(i,k) - cgh(i,k) = 0.0_r8 - cgs(i,k) = 0.0_r8 - end do - end do - ! - ! Main level loop to compute the diffusivities and counter-gradient terms. These terms are - ! only calculated at points determined to be in the interior of the pbl (pblpt(i)==.true.), - ! and then calculations are directed toward regime: stable vs unstable, surface vs outer - ! layer. - ! - do k=pver,pver-npbl+2,-1 - do i=1,ncol - pblpt(i) = (z(i,k) < pblh(i)) - if (pblpt(i)) then - ktopbl(i) = k - zp(i) = z(i,k-1) - if (zkmin == 0.0_r8 .and. zp(i) > pblh(i)) zp(i) = pblh(i) - zmzp = 0.5_r8*(z(i,k) + zp(i)) ! we think this is an approximation to the interface height (where KVs are calculated) - zh(i) = zmzp/pblh(i) - zl(i) = zmzp/obklen(i) - zzh(i) = zh(i)*max(0._r8,(1._r8 - zh(i)))**2 - if (unstbl(i)) then - if (zh(i) < sffrac) then - term = (1._r8 - betam*zl(i))**onet - pblk(i) = fak1(i)*zzh(i)*term - pr(i) = term/sqrt(1._r8 - betah*zl(i)) - else - pblk(i) = fak2(i)*zzh(i) - pr(i) = phiminv(i)/phihinv(i) + ccon*fak3(i)/fak - cgs(i,k) = fak3(i)/(pblh(i)*wm(i)) - cgh(i,k) = khfs(i)*cgs(i,k)*cpair - end if - else - if (zl(i) <= 1._r8) then - pblk(i) = fak1(i)*zzh(i)/(1._r8 + betas*zl(i)) - else - pblk(i) = fak1(i)*zzh(i)/(betas + zl(i)) - end if - pr(i) = 1._r8 - end if - kvm(i,k) = max(pblk(i),kvf(i,k)) - kvh(i,k) = max(pblk(i)/pr(i),kvf(i,k)) - end if - end do - end do - - ! - ! Check whether last allowed midpoint is within pbl - ! - - if ( eddy_scheme .eq. 'HBR' ) then - ! apply new diffusivity at entrainment zone - do i = 1,ncol - if (bge(i) > 1.e-7_r8) then - k = ktopbl(i) - kve = 0.2_r8*(wstar(i)**3+5._r8*ustar(i)**3)/bge(i) - kvm(i,k) = kve - kvh(i,k) = kve - end if - end do - end if - - ! Crude estimate of tke (tke=0 above boundary layer) - do k = max(pverp-npbl,2),pverp - do i = 1, ncol - if (z(i,k-1) < pblh(i)) then - tke(i,k) = ( kvm(i,k) / pblh(i) ) ** 2 - endif - end do - end do - return - end subroutine austausch_pbl - -end module hb_diff diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 545031573d..2aad26ed4e 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -110,6 +110,7 @@ module vertical_diffusion character(len=fieldname_len) :: vdiffnam(pcnst) ! Names of vertical diffusion tendencies integer :: ixcldice, ixcldliq ! Constituent indices for cloud liquid and ice water integer :: ixnumice, ixnumliq +integer :: ixq integer :: pblh_idx, tpert_idx, qpert_idx @@ -213,22 +214,22 @@ subroutine vd_register() ! Add fields to physics buffer ! kvt is used by gw_drag. only needs physpkg scope. - call pbuf_add_field('kvt', 'physpkg', dtype_r8, (/pcols,pverp/), kvt_idx) + call pbuf_add_field('kvt', 'physpkg', dtype_r8, (/pcols,pverp/), kvt_idx) ! molecular_kinematic_temperature_conductivity_at_interfaces if (eddy_scheme /= 'CLUBB_SGS') then - call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) + call pbuf_add_field('kvh', 'global', dtype_r8, (/pcols, pverp/), kvh_idx) ! eddy_heat_diffusivity_at_interfaces end if - call pbuf_add_field('kvm', 'global', dtype_r8, (/pcols, pverp/), kvm_idx ) - call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) - call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) + call pbuf_add_field('kvm', 'global', dtype_r8, (/pcols, pverp/), kvm_idx ) ! eddy_momentum_diffusivity_at_interfaces + call pbuf_add_field('pblh', 'global', dtype_r8, (/pcols/), pblh_idx) ! atmosphere_boundary_layer_thickness + call pbuf_add_field('tke', 'global', dtype_r8, (/pcols, pverp/), tke_idx) ! specific_turbulent_kinetic_energy_at_interfaces - call pbuf_add_field('tauresx', 'global', dtype_r8, (/pcols/), tauresx_idx) - call pbuf_add_field('tauresy', 'global', dtype_r8, (/pcols/), tauresy_idx) + call pbuf_add_field('tauresx', 'global', dtype_r8, (/pcols/), tauresx_idx) ! eastward_reserved_stress_at_surface_on_previous_timestep + call pbuf_add_field('tauresy', 'global', dtype_r8, (/pcols/), tauresy_idx) ! northward_reserved_stress_at_surface_on_previous_timestep - call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) - call pbuf_add_field('qpert', 'global', dtype_r8, (/pcols/), qpert_idx) + call pbuf_add_field('tpert', 'global', dtype_r8, (/pcols/), tpert_idx) ! convective_temperature_perturbation_due_to_pbl_eddies + call pbuf_add_field('qpert', 'global', dtype_r8, (/pcols/), qpert_idx) ! convective_water_vapor_wrt_moist_air_and_condensed_water_perturbation_due_to_pbl_eddies if (trim(shallow_scheme) == 'UNICON') then call pbuf_add_field('qtl_flx', 'global', dtype_r8, (/pcols, pverp/), qtl_flx_idx) @@ -262,7 +263,7 @@ subroutine vertical_diffusion_init(pbuf2d) use cam_history, only : addfld, add_default, horiz_only use cam_history, only : register_vector_field use eddy_diff_cam, only : eddy_diff_init - use hb_diff, only : init_hb_diff + use holtslag_boville_diff, only : holtslag_boville_diff_init use molec_diff, only : init_molec_diff use diffusion_solver, only : init_vdiff, new_fieldlist_vdiff, vdiff_select use constituents, only : cnst_get_ind, cnst_get_type_byind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed @@ -291,6 +292,9 @@ subroutine vertical_diffusion_init(pbuf2d) integer :: history_budget_histfile_num ! output history file number for budget fields logical :: history_waccm ! output variables of interest for WACCM runs + character(len=512) :: errmsg + integer :: errflg + ! ! add sponge layer vertical diffusion ! @@ -351,6 +355,8 @@ subroutine vertical_diffusion_init(pbuf2d) call cnst_get_ind( 'NUMLIQ', ixnumliq, abort=.false. ) call cnst_get_ind( 'NUMICE', ixnumice, abort=.false. ) + call cnst_get_ind( 'Q', ixq ) ! water vapor index in const array. + ! Initialize upper boundary condition module call ubc_init() @@ -400,12 +406,32 @@ subroutine vertical_diffusion_init(pbuf2d) call eddy_diff_init(pbuf2d, ntop_eddy, nbot_eddy) case ( 'HB', 'HBR') if( masterproc ) write(iulog,*) 'vertical_diffusion_init: eddy_diffusivity scheme: Holtslag and Boville' - call init_hb_diff(gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, & - karman, eddy_scheme) + + call holtslag_boville_diff_init( & + amIRoot = masterproc, & + iulog = iulog, & + pver = pver, & + karman = karman, & + pref_mid = pref_mid, & + is_hbr_pbl_scheme = (eddy_scheme .eq. 'HBR'), & + ntop_turb_in = ntop_eddy, & + errmsg = errmsg, & + errflg = errflg) + call addfld('HB_ri', (/ 'lev' /), 'A', 'no', 'Richardson Number (HB Scheme), I' ) case ( 'CLUBB_SGS' ) do_pbl_diags = .true. - call init_hb_diff(gravit, cpair, ntop_eddy, nbot_eddy, pref_mid, karman, eddy_scheme) + + call holtslag_boville_diff_init( & + amIRoot = masterproc, & + iulog = iulog, & + pver = pver, & + karman = karman, & + pref_mid = pref_mid, & + is_hbr_pbl_scheme = (eddy_scheme .eq. 'HBR'), & + ntop_turb_in = ntop_eddy, & + errmsg = errmsg, & + errflg = errflg) ! ! run HB scheme where CLUBB is not active when running cam7 or cam6 physics ! else init_hb_diff is called just for diagnostic purposes @@ -671,7 +697,15 @@ subroutine vertical_diffusion_tend( & use trb_mtn_stress_cam, only : trb_mtn_stress_tend use beljaars_drag_cam, only : beljaars_drag_tend use eddy_diff_cam, only : eddy_diff_tend - use hb_diff, only : compute_hb_diff, compute_hb_free_atm_diff + + ! CCPP-ized HB scheme + use holtslag_boville_diff, only: hb_pbl_independent_coefficients_run + use holtslag_boville_diff, only: hb_pbl_dependent_coefficients_run + use holtslag_boville_diff, only: hb_diff_exchange_coefficients_run + + ! CCPP-ized HB (free atmosphere) scheme + use holtslag_boville_diff, only : hb_diff_free_atm_exchange_coefficients_run + use wv_saturation, only : qsat use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type @@ -856,6 +890,14 @@ subroutine vertical_diffusion_tend( & logical :: lq(pcnst) + ! Temporaries for CCPP-ized HB + real(r8) :: s2(pcols,pver) ! shear squared (HB output) [s-2] + real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] + real(r8) :: wstar(pcols) ! convective scale velocity [m s-1] + real(r8) :: bge(pcols) ! buoyancy gradient enhancement + character(len=512) :: errmsg + integer :: errflg + ! ----------------------- ! ! Main Computation Begins ! ! ----------------------- ! @@ -989,15 +1031,116 @@ subroutine vertical_diffusion_tend( & ! Modification : We may need to use 'taux' instead of 'tautotx' here, for ! consistency with the previous HB scheme. - - call compute_hb_diff(ncol , & - th , state%t , state%q , state%zm , state%zi , & - state%pmid, state%u , state%v , tautotx , tautoty , & - cam_in%shf, cam_in%cflx(:,1), obklen , ustar , pblh , & - kvm , kvh , kvq , cgh , cgs , & - tpert , qpert , cldn , cam_in%ocnfrac , tke , & - ri , & - eddy_scheme) + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + thv(:,:) = 0._r8 + ustar(:) = 0._r8 + khfs(:) = 0._r8 + kqfs(:) = 0._r8 + kbfs(:) = 0._r8 + obklen(:) = 0._r8 + ri(:,:) = 0._r8 + s2(:,:) = 0._r8 + !REMOVECAM_END + ! call CCPP-ized HB scheme (piecewise) + call hb_pbl_independent_coefficients_run( & + ncol = ncol, & + pver = pver, & + zvir = zvir, & + rair = rair, & + cpair = cpair, & + gravit = gravit, & + karman = karman, & + exner = state%exner(:ncol,:pver), & + t = state%t(:ncol,:pver), & + q_wv = state%q(:ncol,:pver,ixq), & + z = state%zm(:ncol,:pver), & + pmid = state%pmid(:ncol,:pver), & + u = state%u(:ncol,:pver), & + v = state%v(:ncol,:pver), & + taux = tautotx(:ncol), & + tauy = tautoty(:ncol), & + shflx = cam_in%shf(:ncol), & + q_wv_flx = cam_in%cflx(:ncol,ixq), & + ! Output variables + thv = thv(:ncol,:pver), & + ustar = ustar(:ncol), & + khfs = khfs(:ncol), & + kqfs = kqfs(:ncol), & + kbfs = kbfs(:ncol), & + obklen = obklen(:ncol), & + s2 = s2(:ncol,:pver), & + ri = ri(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) + + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + pblh(:) = 0._r8 + wstar(:) = 0._r8 + bge(:) = 0._r8 + !REMOVECAM_END + call hb_pbl_dependent_coefficients_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + gravit = gravit, & + z = state%zm(:ncol,:pver), & + zi = state%zi(:ncol,:pverp), & + u = state%u(:ncol,:pver), & + v = state%v(:ncol,:pver), & + cldn = cldn(:ncol,:pver), & + ! Inputs from pbl_independent_coefficients + thv = thv(:ncol,:pver), & + ustar = ustar(:ncol), & + kbfs = kbfs(:ncol), & + obklen = obklen(:ncol), & + ! Output variables + pblh = pblh(:ncol), & + wstar = wstar(:ncol), & + bge = bge(:ncol), & + errmsg = errmsg, & + errflg = errflg) + + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + kvm(:,:) = 0._r8 + kvh(:,:) = 0._r8 + kvq(:,:) = 0._r8 + cgh(:,:) = 0._r8 + cgs(:,:) = 0._r8 + tpert(:) = 0._r8 + qpert(:) = 0._r8 + tke(:,:) = 0._r8 + !REMOVECAM_END + call hb_diff_exchange_coefficients_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + karman = karman, & + cpair = cpair, & + z = state%zm(:ncol,:pver), & + is_hbr_pbl_scheme = (eddy_scheme .eq. 'HBR'), & + ! Input from hb_pbl_independent_coefficients + kqfs = kqfs(:ncol), & + khfs = khfs(:ncol), & + kbfs = kbfs(:ncol), & + ustar = ustar(:ncol), & + obklen = obklen(:ncol), & + s2 = s2(:ncol,:pver), & + ri = ri(:ncol,:pver), & + ! Input from hb_pbl_dependent_coefficients + pblh = pblh(:ncol), & + wstar = wstar(:ncol), & + bge = bge(:ncol), & + ! Output variables + kvm = kvm(:ncol,:pver), & + kvh = kvh(:ncol,:pver), & + kvq = kvq(:ncol,:pver), & + cgh = cgh(:ncol,:pver), & + cgs = cgs(:ncol,:pver), & + tpert = tpert(:ncol), & + qpert = qpert(:ncol), & + tke = tke(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) call outfld( 'HB_ri', ri, pcols, lchnk ) @@ -1006,12 +1149,70 @@ subroutine vertical_diffusion_tend( & ! run HB scheme where CLUBB is not active when running cam7 ! if (do_hb_above_clubb) then - call compute_hb_free_atm_diff( ncol , & - th , state%t , state%q , state%zm , & - state%pmid, state%u , state%v , tautotx , tautoty , & - cam_in%shf, cam_in%cflx(:,1), obklen , ustar , & - kvm , kvh , kvq , cgh , cgs , & - ri ) + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + thv(:,:) = 0._r8 + ustar(:) = 0._r8 + khfs(:) = 0._r8 + kqfs(:) = 0._r8 + kbfs(:) = 0._r8 + obklen(:) = 0._r8 + s2(:,:) = 0._r8 + ri(:,:) = 0._r8 + !REMOVECAM_END + ! call CCPP-ized HB scheme (piecewise) + call hb_pbl_independent_coefficients_run( & + ncol = ncol, & + pver = pver, & + zvir = zvir, & + rair = rair, & + cpair = cpair, & + gravit = gravit, & + karman = karman, & + exner = state%exner(:ncol,:pver), & + t = state%t(:ncol,:pver), & + q_wv = state%q(:ncol,:pver,1), & ! FIXME: assumes wv at 1 (need to change to ixq) + z = state%zm(:ncol,:pver), & + pmid = state%pmid(:ncol,:pver), & + u = state%u(:ncol,:pver), & + v = state%v(:ncol,:pver), & + taux = tautotx(:ncol), & + tauy = tautoty(:ncol), & + shflx = cam_in%shf(:ncol), & + q_wv_flx = cam_in%cflx(:ncol,1), & ! FIXME: assumes wv at 1 (need to change to ixq) + ! Output variables + thv = thv(:ncol,:pver), & + ustar = ustar(:ncol), & + khfs = khfs(:ncol), & + kqfs = kqfs(:ncol), & + kbfs = kbfs(:ncol), & + obklen = obklen(:ncol), & + s2 = s2(:ncol,:pver), & + ri = ri(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) + + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + kvm(:,:) = 0._r8 + kvh(:,:) = 0._r8 + kvq(:,:) = 0._r8 + cgh(:,:) = 0._r8 + cgs(:,:) = 0._r8 + !REMOVECAM_END + call hb_diff_free_atm_exchange_coefficients_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ! Input from hb_pbl_independent_coefficients + s2 = s2(:ncol,:pver), & + ri = ri(:ncol,:pver), & + ! Output variables + kvm = kvm(:ncol,:pver), & + kvh = kvh(:ncol,:pver), & + kvq = kvq(:ncol,:pver), & + cgh = cgh(:ncol,:pver), & + cgs = cgs(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) call pbuf_get_field(pbuf, clubbtop_idx, clubbtop) ! @@ -1161,21 +1362,59 @@ subroutine vertical_diffusion_tend( & mw_fac, nbot_molec) end if - call compute_vdiff( state%lchnk , & - pcols , pver , pcnst , ncol , tint , & - p , state%t , rhoi, ztodt , taux , & - tauy , shflux , cflux , & - kvh , kvm , kvq , cgs , cgh , & - state%zi , ksrftms , dragblj , & - qmincg , fieldlist_wet , fieldlist_molec,& - u_tmp , v_tmp , q_tmp , s_tmp , & - tautmsx , tautmsy , dtk , topflx , errstring , & - tauresx , tauresy , 1 , cpairv(:,:,state%lchnk), dse_top, & - do_molec_diff, waccmx_mode, & - vd_lu_qdecomp, & - ubc_mmr, ubc_flux, kvt, state%pmid, & - cnst_mw, cnst_fixed_ubc, cnst_fixed_ubflx, nbot_molec, & - kq_scal, mw_fac) + call compute_vdiff( & + lchnk = state%lchnk, & + pcols = pcols, & + pver = pver, & + ncnst = pcnst, & + ncol = ncol, & + tint = tint, & + p = p, & + t = state%t, & + rhoi = rhoi, & + ztodt = ztodt, & + taux = taux, & + tauy = tauy, & + shflx = shflux, & + cflx = cflux, & + kvh = kvh, & + kvm = kvm, & + kvq = kvq, & + cgs = cgs, & + cgh = cgh, & + zi = state%zi, & + ksrftms = ksrftms, & + dragblj = dragblj, & + qmincg = qmincg, & + fieldlist = fieldlist_wet, & + fieldlistm = fieldlist_molec, & + u = u_tmp, & + v = v_tmp, & + q = q_tmp, & + dse = s_tmp, & + tautmsx = tautmsx, & + tautmsy = tautmsy, & + dtk = dtk, & + topflx = topflx, & + errstring = errstring, & + tauresx = tauresx, & + tauresy = tauresy, & + itaures = 1, & + cpairv = cpairv(:,:,state%lchnk), & + dse_top = dse_top, & + do_molec_diff = do_molec_diff, & + use_temperature_molec_diff = waccmx_mode, & + vd_lu_qdecomp = vd_lu_qdecomp, & + ubc_mmr = ubc_mmr, & + ubc_flux = ubc_flux, & + kvt = kvt, & + pmid = state%pmid, & + cnst_mw = cnst_mw, & + cnst_fixed_ubc = cnst_fixed_ubc, & + cnst_fixed_ubflx = cnst_fixed_ubflx, & + nbot_molec = nbot_molec, & + kq_scal = kq_scal, & + mw_fac = mw_fac) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="Error in fieldlist_wet call from vertical_diffusion.") @@ -1194,21 +1433,59 @@ subroutine vertical_diffusion_tend( & mw_fac, nbot_molec) end if - call compute_vdiff( state%lchnk , & - pcols , pver , pcnst , ncol , tint , & - p_dry , state%t , rhoi_dry, ztodt , taux , & - tauy , shflux , cflux , & - kvh , kvm , kvq , cgs , cgh , & - state%zi , ksrftms , dragblj , & - qmincg , fieldlist_dry , fieldlist_molec,& - u_tmp , v_tmp , q_tmp , s_tmp , & - tautmsx_temp , tautmsy_temp , dtk_temp , topflx_temp , errstring , & - tauresx , tauresy , 1 , cpairv(:,:,state%lchnk), dse_top, & - do_molec_diff , waccmx_mode, & - vd_lu_qdecomp, & - ubc_mmr, ubc_flux, kvt, state%pmiddry, & - cnst_mw, cnst_fixed_ubc, cnst_fixed_ubflx, nbot_molec, & - kq_scal, mw_fac) + call compute_vdiff( & + lchnk = state%lchnk, & + pcols = pcols, & + pver = pver, & + ncnst = pcnst, & + ncol = ncol, & + tint = tint, & + p = p_dry, & + t = state%t, & + rhoi = rhoi_dry, & + ztodt = ztodt, & + taux = taux, & + tauy = tauy, & + shflx = shflux, & + cflx = cflux, & + kvh = kvh, & + kvm = kvm, & + kvq = kvq, & + cgs = cgs, & + cgh = cgh, & + zi = state%zi, & + ksrftms = ksrftms, & + dragblj = dragblj, & + qmincg = qmincg, & + fieldlist = fieldlist_dry, & + fieldlistm = fieldlist_molec, & + u = u_tmp, & + v = v_tmp, & + q = q_tmp, & + dse = s_tmp, & + tautmsx = tautmsx_temp, & + tautmsy = tautmsy_temp, & + dtk = dtk_temp, & + topflx = topflx_temp, & + errstring = errstring, & + tauresx = tauresx, & + tauresy = tauresy, & + itaures = 1, & + cpairv = cpairv(:,:,state%lchnk), & + dse_top = dse_top, & + do_molec_diff = do_molec_diff, & + use_temperature_molec_diff = waccmx_mode, & + vd_lu_qdecomp = vd_lu_qdecomp, & + ubc_mmr = ubc_mmr, & + ubc_flux = ubc_flux, & + kvt = kvt, & + pmid = state%pmiddry, & + cnst_mw = cnst_mw, & + cnst_fixed_ubc = cnst_fixed_ubc, & + cnst_fixed_ubflx = cnst_fixed_ubflx, & + nbot_molec = nbot_molec, & + kq_scal = kq_scal, & + mw_fac = mw_fac) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="Error in fieldlist_dry call from vertical_diffusion.") From 07a57a5cb9632c8ce000d4e8daeb5902e7c4ed80 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 9 May 2025 18:06:16 -0400 Subject: [PATCH 182/466] Dechunkize, remove pcols from compute_vdiff; general cleanup of compute_vdiff for future CCPPization --- src/physics/cam/clubb_intr.F90 | 16 +- src/physics/cam/diffusion_solver.F90 | 318 ++++++++++++------------- src/physics/cam/eddy_diff_cam.F90 | 73 ++++-- src/physics/cam/molec_diff.F90 | 33 ++- src/physics/cam/vertical_diffusion.F90 | 211 ++++++++-------- 5 files changed, 349 insertions(+), 302 deletions(-) diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index df35928f3e..d1cfa8efeb 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -2599,6 +2599,10 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & edsclr, & n + ! dummy outputs for CCPP-ized subroutines + character(len=512) :: errmsg + integer :: errflg + #endif call t_startf('clubb_tend_cam') @@ -4714,12 +4718,12 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & pver = pver, & pverp = pverp, & gravit = gravit, & - z = state%zm(:ncol,:pver), & - zi = state%zi(:ncol,:pverp), & - u = state%u(:ncol,:pver), & - v = state%v(:ncol,:pver), & - cldn = cldn(:ncol,:pver), & - ! Inputs from CLUBB (and not HB) + z = state1%zm(:ncol,:pver), & + zi = state1%zi(:ncol,:pverp), & + u = state1%u(:ncol,:pver), & + v = state1%v(:ncol,:pver), & + cldn = cloud_frac(:ncol,:pver), & + ! Inputs from CLUBB (not HB coefficients) thv = thv(:ncol,:pver), & ustar = ustar2(:ncol), & kbfs = kbfs(:ncol), & diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index 2560e630c4..81e1eef262 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -130,16 +130,17 @@ end function new_fieldlist_vdiff ! ! ! =============================================================================== ! - subroutine compute_vdiff( lchnk , & - pcols , pver , ncnst , ncol , tint , & + subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & p , t , rhoi , ztodt , taux , & tauy , shflx , cflx , & kvh , kvm , kvq , cgs , cgh , & zi , ksrftms , dragblj , & qmincg , fieldlist , fieldlistm , & u , v , q , dse , & - tautmsx , tautmsy , dtk , topflx , errstring , & - tauresx , tauresy , itaures , cpairv , dse_top, & + tautmsx , tautmsy , dtk , topflx , errmsg , & + tauresx , tauresy , itaures , & + cpairv, rairv, mbarv, & + dse_top, & do_molec_diff , use_temperature_molec_diff, vd_lu_qdecomp, & ubc_mmr, ubc_flux, kvt, pmid, & cnst_mw, cnst_fixed_ubc, cnst_fixed_ubflx, nbot_molec, & @@ -163,87 +164,73 @@ subroutine compute_vdiff( lchnk , use vdiff_lu_solver, only : fin_vol_lu_decomp use vertical_diffusion_solver, only : fin_vol_solve use beljaars_drag_cam, only : do_beljaars - ! FIXME: This should not be needed - use air_composition, only: rairv ! Modification : Ideally, we should diffuse 'liquid-ice static energy' (sl), not the dry static energy. ! Also, vertical diffusion of cloud droplet number concentration and aerosol number ! concentration should be done very carefully in the future version. - ! --------------- ! - ! Input Arguments ! - ! --------------- ! + ! Input Arguments + integer, intent(in) :: ncol ! Number of atmospheric columns + integer, intent(in) :: pver + integer, intent(in) :: pverp + integer, intent(in) :: ncnst ! # of constituents to diffuse. In eddy_diff, only wv. Others, pcnst. + real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] - integer, intent(in) :: lchnk - integer, intent(in) :: pcols - integer, intent(in) :: pver - integer, intent(in) :: ncnst - integer, intent(in) :: ncol ! Number of atmospheric columns - integer, intent(in) :: itaures ! Indicator determining whether 'tauresx,tauresy' - ! is updated (1) or non-updated (0) in this subroutine. - - type(Coords1D), intent(in) :: p ! Pressure coordinates [ Pa ] - real(r8), intent(in) :: tint(pcols,pver+1) ! Temperature [ K ] - real(r8), intent(in) :: t(pcols,pver) ! Temperature [ K ] - real(r8), intent(in) :: rhoi(pcols,pver+1) ! Density of air at interfaces [ kg/m3 ] - real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] - real(r8), intent(in) :: taux(pcols) ! Surface zonal stress. - ! Input u-momentum per unit time per unit area into the atmosphere [ N/m2 ] - real(r8), intent(in) :: tauy(pcols) ! Surface meridional stress. - ! Input v-momentum per unit time per unit area into the atmosphere [ N/m2 ] - real(r8), intent(in) :: shflx(pcols) ! Surface sensible heat flux [ W/m2 ] - real(r8), intent(in) :: cflx(pcols,ncnst) ! Surface constituent flux [ kg/m2/s ] - real(r8), intent(in) :: zi(pcols,pver+1) ! Interface heights [ m ] - real(r8), intent(in) :: ksrftms(pcols) ! Surface drag coefficient for turbulent mountain stress. > 0. [ kg/s/m2 ] - real(r8), intent(in) :: dragblj(pcols,pver) ! Drag profile from Beljaars SGO form drag > 0. [ 1/s ] - real(r8), intent(in) :: qmincg(ncnst) ! Minimum constituent mixing ratios from cg fluxes - real(r8), intent(in) :: cpairv(pcols,pver) ! Specific heat at constant pressure - real(r8), intent(in) :: kvh(pcols,pver+1) ! Eddy diffusivity for heat [ m2/s ] + type(vdiff_selector), intent(in) :: fieldlist ! Array of flags selecting which fields to diffuse + type(vdiff_selector), intent(in) :: fieldlistm ! Array of flags selecting which fields for molecular diffusion + logical, intent(in) :: itaures ! Whether 'tauresx,tauresy' is updated in this subroutine. + + type(Coords1D), intent(in) :: p ! Pressure coordinates [ Pa ] + real(r8), intent(in) :: t(:,:) ! Temperature [ K ] + real(r8), intent(in) :: tint(:,:) ! Temperature at interfaces [ K ] + real(r8), intent(in) :: rhoi(:,:) ! Density of air at interfaces [ kg/m3 ] + real(r8), intent(in) :: taux(:) ! Surface zonal stress. + ! Input u-momentum per unit time per unit area into the atmosphere [ N/m2 ] + real(r8), intent(in) :: tauy(:) ! Surface meridional stress. + ! Input v-momentum per unit time per unit area into the atmosphere [ N/m2 ] + real(r8), intent(in) :: shflx(:) ! Surface sensible heat flux [ W/m2 ] + real(r8), intent(in) :: cflx(:,:) ! Surface constituent flux [ kg/m2/s ] (ncol,ncnst) + real(r8), intent(in) :: zi(:,:) ! Interface heights [ m ] + real(r8), intent(in) :: ksrftms(:) ! Surface drag coefficient for turbulent mountain stress. > 0. [ kg/s/m2 ] + real(r8), intent(in) :: dragblj(:,:) ! Drag profile from Beljaars SGO form drag > 0. [ 1/s ] + real(r8), intent(in) :: qmincg(:) ! Minimum constituent mixing ratios from cg fluxes, (ncnst) + real(r8), intent(in) :: dse_top(:) ! Dry static energy top boundary condition. + real(r8), intent(in) :: kvh(:,:) ! Eddy diffusivity for heat [ m2/s ], interfaces + real(r8), intent(in) :: kvm(:,:) ! Eddy viscosity ( Eddy diffusivity for momentum ) [ m2/s ], interfaces + real(r8), intent(in) :: kvq(:,:) ! Eddy diffusivity for constituents, interfaces + real(r8), intent(in) :: cgs(:,:) ! Counter-gradient star [ cg/flux ], interfaces + real(r8), intent(in) :: cgh(:,:) ! Counter-gradient term for heat, interfaces + + ! Input-Output Arguments + real(r8), intent(inout) :: u(:,:) ! U wind. This input is the 'raw' input wind to + ! PBL scheme without iterative provisional update. [ m/s ] + real(r8), intent(inout) :: v(:,:) ! V wind. This input is the 'raw' input wind to PBL scheme + ! without iterative provisional update. [ m/s ] + real(r8), intent(inout) :: q(:,:,:) ! Moisture and trace constituents [ kg/kg, #/kg ? ] + real(r8), intent(inout) :: dse(:,:) ! Dry static energy [ J/kg ] + + ! Input: Reserved surface stress at previous time step + ! Output: Reserved surface stress at current time step + real(r8), intent(inout) :: tauresx(:) + real(r8), intent(inout) :: tauresy(:) + + ! Output Arguments + real(r8), intent(out) :: dtk(:,:) ! T tendency from KE dissipation + real(r8), intent(out) :: tautmsx(:) ! Implicit zonal turbulent mountain surface stress + ! [ N/m2 = kg m/s /s/m2 ] + real(r8), intent(out) :: tautmsy(:) ! Implicit meridional turbulent mountain surface stress + ! [ N/m2 = kg m/s /s/m2 ] + real(r8), intent(out) :: topflx(:) ! Molecular heat flux at the top interface + character(128), intent(out) :: errmsg ! Output status + + ! Molecular Diffusion Arguments - mostly optional logical, intent(in) :: do_molec_diff ! Flag indicating multiple constituent diffusivities logical, intent(in) :: use_temperature_molec_diff! Flag indicating that molecular diffusion should apply to temperature, not ! dry static energy. - - type(vdiff_selector), intent(in) :: fieldlist ! Array of flags selecting which fields to diffuse - type(vdiff_selector), intent(in) :: fieldlistm ! Array of flags selecting which fields for molecular diffusion - - ! Dry static energy top boundary condition. - real(r8), intent(in) :: dse_top(pcols) - - real(r8), intent(in) :: kvm(pcols,pver+1) ! Eddy viscosity ( Eddy diffusivity for momentum ) [ m2/s ] - real(r8), intent(in) :: kvq(pcols,pver+1) ! Eddy diffusivity for constituents - real(r8), intent(in) :: cgs(pcols,pver+1) ! Counter-gradient star [ cg/flux ] - real(r8), intent(in) :: cgh(pcols,pver+1) ! Counter-gradient term for heat - - ! ---------------------- ! - ! Input-Output Arguments ! - ! ---------------------- ! - - real(r8), intent(inout) :: u(pcols,pver) ! U wind. This input is the 'raw' input wind to - ! PBL scheme without iterative provisional update. [ m/s ] - real(r8), intent(inout) :: v(pcols,pver) ! V wind. This input is the 'raw' input wind to PBL scheme - ! without iterative provisional update. [ m/s ] - real(r8), intent(inout) :: q(pcols,pver,ncnst) ! Moisture and trace constituents [ kg/kg, #/kg ? ] - real(r8), intent(inout) :: dse(pcols,pver) ! Dry static energy [ J/kg ] - - real(r8), intent(inout) :: tauresx(pcols) ! Input : Reserved surface stress at previous time step - real(r8), intent(inout) :: tauresy(pcols) ! Output : Reserved surface stress at current time step - - ! ---------------- ! - ! Output Arguments ! - ! ---------------- ! - - real(r8), intent(out) :: dtk(pcols,pver) ! T tendency from KE dissipation - real(r8), intent(out) :: tautmsx(pcols) ! Implicit zonal turbulent mountain surface stress - ! [ N/m2 = kg m/s /s/m2 ] - real(r8), intent(out) :: tautmsy(pcols) ! Implicit meridional turbulent mountain surface stress - ! [ N/m2 = kg m/s /s/m2 ] - real(r8), intent(out) :: topflx(pcols) ! Molecular heat flux at the top interface - character(128), intent(out) :: errstring ! Output status - - ! ------------------ ! - ! Optional Arguments ! - ! ------------------ ! + real(r8), intent(in) :: cpairv(:,:) ! Specific heat at constant pressure + real(r8), intent(in) :: rairv(:,:) ! Composition dependent gas "constant" + real(r8), intent(in) :: mbarv(:,:) ! Composition dependent atmosphere mean mass ! The molecular diffusion module will likely change significantly in ! the future, and this module may directly depend on it after that. @@ -253,60 +240,59 @@ subroutine compute_vdiff( lchnk , interface function vd_lu_qdecomp( & - pcols , pver , ncol , fixed_ubc , mw , & - kv , kq_scal, mw_facm , dpidz_sq , coords , & + ncol , pver, fixed_ubc , mw , & + kv , kq_scal, mw_facm , dpidz_sq , p , & interface_boundary, molec_boundary, & tint , ztodt , nbot_molec , & - lchnk , t , m , no_molec_decomp) result(decomp) + t, m, no_molec_decomp, mbarv) result(decomp) import - integer, intent(in) :: pcols - integer, intent(in) :: pver integer, intent(in) :: ncol + integer, intent(in) :: pver integer, intent(in) :: nbot_molec logical, intent(in) :: fixed_ubc - real(r8), intent(in) :: kv(pcols,pver+1) - real(r8), intent(in) :: kq_scal(pcols,pver+1) + real(r8), intent(in) :: kv(:,:) ! interfaces + real(r8), intent(in) :: kq_scal(:,:) ! interfaces real(r8), intent(in) :: mw - real(r8), intent(in) :: mw_facm(pcols,pver+1) - real(r8), intent(in) :: dpidz_sq(ncol,pver+1) - type(Coords1D), intent(in) :: coords + real(r8), intent(in) :: mw_facm(:,:) ! interfaces + real(r8), intent(in) :: dpidz_sq(:,:) ! interfaces + type(Coords1D), intent(in) :: p type(BoundaryType), intent(in) :: interface_boundary type(BoundaryType), intent(in) :: molec_boundary - real(r8), intent(in) :: tint(pcols,pver+1) + real(r8), intent(in) :: tint(:,:) ! interfaces real(r8), intent(in) :: ztodt - integer, intent(in) :: lchnk - real(r8), intent(in) :: t(pcols,pver) + real(r8), intent(in) :: t(:,:) integer, intent(in) :: m type(TriDiagDecomp), intent(in) :: no_molec_decomp + real(r8), intent(in) :: mbarv(:,:) type(TriDiagDecomp) :: decomp end function vd_lu_qdecomp end interface - real(r8), intent(in), optional :: ubc_mmr(pcols,ncnst) ! Upper boundary mixing ratios [ kg/kg ] - real(r8), intent(in), optional :: ubc_flux(pcols,ncnst) ! Upper boundary flux [ kg/s/m^2 ] + real(r8), intent(in), optional :: ubc_mmr(:,:) ! Upper boundary mixing ratios [ kg/kg ] + real(r8), intent(in), optional :: ubc_flux(:,:) ! Upper boundary flux [ kg/s/m^2 ] - real(r8), intent(in), optional :: kvt(pcols,pver+1) ! Kinematic molecular conductivity + real(r8), intent(in), optional :: kvt(:,:) ! Kinematic molecular conductivity ! FIXME: This input should not be needed (and should not be passed in in vertical_diffusion). - real(r8), intent(in), optional :: pmid(pcols,pver) + real(r8), intent(in), optional :: pmid(:,:) - real(r8), intent(in), optional :: cnst_mw(ncnst) ! Molecular weight [ kg/kmole ] - logical, intent(in), optional :: cnst_fixed_ubc(ncnst) ! Whether upper boundary condition is fixed - logical, intent(in), optional :: cnst_fixed_ubflx(ncnst) ! Whether upper boundary flux is a fixed non-zero value + real(r8), intent(in), optional :: cnst_mw(:) ! Molecular weight [ kg/kmole ] + logical, intent(in), optional :: cnst_fixed_ubc(:) ! Whether upper boundary condition is fixed + logical, intent(in), optional :: cnst_fixed_ubflx(:) ! Whether upper boundary flux is a fixed non-zero value - integer, intent(in), optional :: nbot_molec ! Bottom level where molecular diffusivity is applied + integer, intent(in), optional :: nbot_molec ! Bottom level where molecular diffusivity is applied ! kq_fac*sqrt(T)*m_d/rho for molecular diffusivity - real(r8), intent(in), optional :: kq_scal(pcols,pver+1) + real(r8), intent(in), optional :: kq_scal(:,:) ! Local sqrt(1/M_q + 1/M_d) for each constituent - real(r8), intent(in), optional :: mw_fac(pcols,pver+1,ncnst) + real(r8), intent(in), optional :: mw_fac(:,:,:) ! --------------- ! ! Local Variables ! ! --------------- ! integer :: i, k, m ! Longitude, level, constituent indices - logical :: lqtst(pcols) ! Adjust vertical profiles + logical :: lqtst(ncol) ! Adjust vertical profiles ! LU decomposition information. type(TriDiagDecomp) :: decomp @@ -322,55 +308,55 @@ end function vd_lu_qdecomp type(BoundaryType) :: interface_boundary type(BoundaryType) :: molec_boundary - real(r8) :: tmp1(pcols) ! Temporary storage - real(r8) :: tmpi1(pcols,pver+1) ! Interface KE dissipation - real(r8) :: tmpi2(pcols,pver+1) ! dt*(g*rho)**2/dp at interfaces - real(r8) :: keg_in(pcols,pver) ! KE on entry to subroutine - real(r8) :: keg_out(pcols,pver) ! KE after U and V dissipation/diffusion - real(r8) :: rrho(pcols) ! 1./bottom level density - - real(r8) :: tautotx(pcols) ! Total surface stress ( zonal ) - real(r8) :: tautoty(pcols) ! Total surface stress ( meridional ) - - real(r8) :: dinp_u(pcols,pver+1) ! Vertical difference at interfaces, input u - real(r8) :: dinp_v(pcols,pver+1) ! Vertical difference at interfaces, input v - real(r8) :: dout_u ! Vertical difference at interfaces, output u - real(r8) :: dout_v ! Vertical difference at interfaces, output v - - real(r8) :: qtm(pcols,pver) ! Temporary copy of q - - real(r8) :: ws(pcols) ! Lowest-level wind speed [ m/s ] - real(r8) :: tau(pcols) ! Turbulent surface stress ( not including mountain stress ) - real(r8) :: ksrfturb(pcols) ! Surface drag coefficient of 'normal' stress. > 0. - ! Virtual mass input per unit time per unit area [ kg/s/m2 ] - real(r8) :: ksrf(pcols) ! Surface drag coefficient of 'normal' stress + - ! Surface drag coefficient of 'tms' stress. > 0. [ kg/s/m2 ] - real(r8) :: usum_in(pcols) ! Vertical integral of input u-momentum. Total zonal - ! momentum per unit area in column [ sum of u*dp/g = kg m/s m-2 ] - real(r8) :: vsum_in(pcols) ! Vertical integral of input v-momentum. Total meridional - ! momentum per unit area in column [ sum of v*dp/g = kg m/s m-2 ] - real(r8) :: usum_mid(pcols) ! Vertical integral of u-momentum after adding explicit residual stress - real(r8) :: vsum_mid(pcols) ! Vertical integral of v-momentum after adding explicit residual stress - real(r8) :: usum_out(pcols) ! Vertical integral of u-momentum after doing implicit diffusion - real(r8) :: vsum_out(pcols) ! Vertical integral of v-momentum after doing implicit diffusion - real(r8) :: tauimpx(pcols) ! Actual net stress added at the current step other than mountain stress - real(r8) :: tauimpy(pcols) ! Actual net stress added at the current step other than mountain stress - real(r8) :: ramda ! dt/timeres [ no unit ] - - real(r8) :: taubljx(pcols) ! recomputed explicit/residual beljaars stress - real(r8) :: taubljy(pcols) ! recomputed explicit/residual beljaars stress + real(r8) :: tmp1(ncol) ! Temporary storage + real(r8) :: tmpi1(ncol,pverp) ! Interface KE dissipation + real(r8) :: tmpi2(ncol,pverp) ! dt*(g*rho)**2/dp at interfaces + real(r8) :: keg_in(ncol,pver) ! KE on entry to subroutine + real(r8) :: keg_out(ncol,pver) ! KE after U and V dissipation/diffusion + real(r8) :: rrho(ncol) ! 1./bottom level density + + real(r8) :: tautotx(ncol) ! Total surface stress ( zonal ) + real(r8) :: tautoty(ncol) ! Total surface stress ( meridional ) + + real(r8) :: dinp_u(ncol,pverp) ! Vertical difference at interfaces, input u + real(r8) :: dinp_v(ncol,pverp) ! Vertical difference at interfaces, input v + real(r8) :: dout_u ! Vertical difference at interfaces, output u + real(r8) :: dout_v ! Vertical difference at interfaces, output v + + real(r8) :: qtm(ncol,pver) ! Temporary copy of q + + real(r8) :: ws(ncol) ! Lowest-level wind speed [ m/s ] + real(r8) :: tau(ncol) ! Turbulent surface stress ( not including mountain stress ) + real(r8) :: ksrfturb(ncol) ! Surface drag coefficient of 'normal' stress. > 0. + ! Virtual mass input per unit time per unit area [ kg/s/m2 ] + real(r8) :: ksrf(ncol) ! Surface drag coefficient of 'normal' stress + + ! Surface drag coefficient of 'tms' stress. > 0. [ kg/s/m2 ] + real(r8) :: usum_in(ncol) ! Vertical integral of input u-momentum. Total zonal + ! momentum per unit area in column [ sum of u*dp/g = kg m/s m-2 ] + real(r8) :: vsum_in(ncol) ! Vertical integral of input v-momentum. Total meridional + ! momentum per unit area in column [ sum of v*dp/g = kg m/s m-2 ] + real(r8) :: usum_mid(ncol) ! Vertical integral of u-momentum after adding explicit residual stress + real(r8) :: vsum_mid(ncol) ! Vertical integral of v-momentum after adding explicit residual stress + real(r8) :: usum_out(ncol) ! Vertical integral of u-momentum after doing implicit diffusion + real(r8) :: vsum_out(ncol) ! Vertical integral of v-momentum after doing implicit diffusion + real(r8) :: tauimpx(ncol) ! Actual net stress added at the current step other than mountain stress + real(r8) :: tauimpy(ncol) ! Actual net stress added at the current step other than mountain stress + real(r8) :: ramda ! dt/timeres [ no unit ] + + real(r8) :: taubljx(ncol) ! recomputed explicit/residual beljaars stress + real(r8) :: taubljy(ncol) ! recomputed explicit/residual beljaars stress ! Rate at which external (surface) stress damps wind speeds (1/s). real(r8) :: tau_damp_rate(ncol, pver) ! Combined molecular and eddy diffusion. - real(r8) :: kv_total(pcols,pver+1) + real(r8) :: kv_total(ncol,pverp) !-------------------------------- ! Variables needed for WACCM-X !-------------------------------- - real(r8) :: ttemp(ncol,pver) ! temporary temperature array - real(r8) :: ttemp0(ncol,pver) ! temporary temperature array + real(r8) :: ttemp(ncol,pver) ! temporary temperature array + real(r8) :: ttemp0(ncol,pver) ! temporary temperature array ! ------------------------------------------------ ! ! Parameters for implicit surface stress treatment ! @@ -385,9 +371,9 @@ end function vd_lu_qdecomp ! Main Computation Begins ! ! ----------------------- ! - errstring = '' + errmsg = '' if( ( diffuse(fieldlist,'u') .or. diffuse(fieldlist,'v') ) .and. .not. diffuse(fieldlist,'s') ) then - errstring = 'diffusion_solver.compute_vdiff: must diffuse s if diffusing u or v' + errmsg = 'diffusion_solver.compute_vdiff: must diffuse s if diffusing u or v' return end if @@ -401,7 +387,7 @@ end function vd_lu_qdecomp if( (.not.present(vd_lu_qdecomp)) .or. (.not.present(kvt)) & .or. (.not. present(ubc_mmr)) .or. (.not. present(ubc_flux)) ) then - errstring = 'compute_vdiff: do_molec_diff true but vd_lu_qdecomp or kvt missing' + errmsg = 'compute_vdiff: do_molec_diff true but vd_lu_qdecomp or kvt missing' return endif @@ -423,11 +409,12 @@ end function vd_lu_qdecomp tmpi2(:ncol,1) = ztodt * dpidz_sq(:,1) / ( p%mid(:,1) - p%ifc(:,1) ) tmpi2(:ncol,2:pver) = ztodt * dpidz_sq(:,2:pver) * p%rdst - ! FIXME: The following four lines are kept in only to preserve answers; + ! FIXME: The following five lines are kept in only to preserve answers; ! they really should be taken out completely. - if (do_molec_diff) & - tmpi2(:ncol,1) = ztodt * (gravit * rhoi(:ncol,1))**2 / ( pmid(:ncol,1) - p%ifc(:,1) ) - dpidz_sq(:,1) = gravit*(p%ifc(:,1) / (rairv(:ncol,1,lchnk)*t(:ncol,1))) + if (do_molec_diff) then + tmpi2(:ncol,1) = ztodt * (gravit * rhoi(:ncol,1))**2 / ( pmid(:ncol,1) - p%ifc(:,1) ) + endif + dpidz_sq(:,1) = gravit*(p%ifc(:,1) / (rairv(:ncol,1)*t(:ncol,1))) dpidz_sq(:,1) = dpidz_sq(:,1)*dpidz_sq(:,1) tmp1(:ncol) = ztodt * gravit * p%rdel(:,pver) @@ -567,11 +554,11 @@ end function vd_lu_qdecomp v(:ncol,:) = fin_vol_solve(ztodt, p, v(:ncol,:), ncol, pver, & coef_q=tau_damp_rate, & - coef_q_diff=kvm(:ncol,:)*dpidz_sq) + coef_q_diff=kvm(:ncol,:)*dpidz_sq(:ncol,:)) u(:ncol,:) = fin_vol_solve(ztodt, p, u(:ncol,:), ncol, pver, & coef_q=tau_damp_rate, & - coef_q_diff=kvm(:ncol,:)*dpidz_sq) + coef_q_diff=kvm(:ncol,:)*dpidz_sq(:ncol,:)) @@ -628,7 +615,7 @@ end function vd_lu_qdecomp ! Note that the total stress we should have added at the current step is ! the sum of 'taux(i) - ksrftms(i)*u(i,pver) + tauresx(i)'. - if( itaures .eq. 1 ) then + if( itaures ) then tauresx(i) = taux(i) + tautmsx(i) + taubljx(i) + tauresx(i)- tauimpx(i) tauresy(i) = tauy(i) + tautmsy(i) + taubljy(i) + tauresy(i)- tauimpy(i) endif @@ -739,7 +726,7 @@ end function vd_lu_qdecomp ! condition is defined directly on the top interface. dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, & - coef_q_diff=kvh(:ncol,:)*dpidz_sq, & + coef_q_diff=kvh(:ncol,:)*dpidz_sq(:ncol,:), & upper_bndry=interface_boundary, & l_cond=BoundaryData(dse_top(:ncol))) @@ -755,7 +742,7 @@ end function vd_lu_qdecomp ! upper boundary is zero flux for extended model ttemp = fin_vol_solve(ztodt, p, ttemp, ncol, pver, & - coef_q_diff=kvt(:ncol,:)*dpidz_sq, & + coef_q_diff=kvt(:ncol,:)*dpidz_sq(:ncol,:),& coef_q_weight=cpairv(:ncol,:)) @@ -778,7 +765,7 @@ end function vd_lu_qdecomp ! Boundary layer thickness of "0._r8" signifies that the boundary ! condition is defined directly on the top interface. dse(:ncol,:) = fin_vol_solve(ztodt, p, dse(:ncol,:), ncol, pver, & - coef_q_diff=kv_total(:ncol,:)*dpidz_sq, & + coef_q_diff=kv_total(:ncol,:)*dpidz_sq(:ncol,:), & upper_bndry=interface_boundary, & l_cond=BoundaryData(dse_top(:ncol))) @@ -807,7 +794,7 @@ end function vd_lu_qdecomp ! Loop through constituents no_molec_decomp = fin_vol_lu_decomp(ztodt, p, & - coef_q_diff=kvq(:ncol,:)*dpidz_sq) + coef_q_diff=kvq(:ncol,:)*dpidz_sq(:ncol,:)) do m = 1, ncnst @@ -842,12 +829,25 @@ end function vd_lu_qdecomp ! Major species diffusion is calculated separately. -Hanli Liu if( do_molec_diff .and. diffuse(fieldlistm,'q',m)) then - - decomp = vd_lu_qdecomp( pcols , pver , ncol , cnst_fixed_ubc(m), cnst_mw(m), & - kvq , kq_scal, mw_fac(:,:,m) ,dpidz_sq , p_molec, & - interface_boundary, molec_boundary, & - tint , ztodt , nbot_molec , & - lchnk , t , m , no_molec_decomp) + decomp = vd_lu_qdecomp( & + ncol = ncol, & + pver = pver, & + m = m, & ! constituent index + fixed_ubc = cnst_fixed_ubc(m), & + mw = cnst_mw(m), & + kv = kvq(:ncol,:), & ! eddy diffusivity at interfaces + kq_scal = kq_scal(:ncol,:), & ! molecular diffusivity at interfaces + mw_facm = mw_fac(:ncol,:,m), & ! composition dependent sqrt(1/M_q + 1/M_d), at interfaces, this constituent + dpidz_sq = dpidz_sq(:ncol,:), & ! square of vertical derivative of pint + p = p_molec, & + interface_boundary = interface_boundary, & + molec_boundary = molec_boundary, & + t = t(:ncol,:), & ! temperature, midpoints + tint = tint(:ncol,:), & ! temperature, interfaces + mbarv = mbarv(:ncol,:), & ! composition dependent atmosphere mean mass + ztodt = ztodt, & + nbot_molec = nbot_molec, & + no_molec_decomp = no_molec_decomp) ! This to calculate the upper boundary flux of H. -Hanli Liu if ((cnst_fixed_ubflx(m))) then diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index 05ff18d9cd..b4faffe223 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -427,7 +427,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , use diffusion_solver, only: compute_vdiff use cam_history, only: outfld use phys_debug_util, only: phys_debug_col - use air_composition, only: cpairv + use air_composition, only: cpairv, rairv, mbarv use atmos_phys_pbl_utils, only: calc_eddy_flux_coefficient, calc_ideal_gas_rrho, calc_friction_velocity use error_messages, only: handle_errmsg use coords_1d, only: Coords1D @@ -464,7 +464,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , real(r8), intent(in) :: taux(pcols) ! Zonal wind stress at surface [ N/m2 ] real(r8), intent(in) :: tauy(pcols) ! Meridional wind stress at surface [ N/m2 ] real(r8), intent(in) :: shflx(pcols) ! Sensible heat flux at surface [ unit ? ] - real(r8), intent(in) :: qflx(pcols) ! Water vapor flux at surface [ unit ? ] + real(r8), intent(in) :: qflx(pcols,1) ! Water vapor flux at surface [ unit ? ] real(r8), intent(in) :: kvm_in(pcols,pver+1) ! kvm saved from last timestep [ m2/s ] real(r8), intent(in) :: kvh_in(pcols,pver+1) ! kvh saved from last timestep [ m2/s ] real(r8), intent(in) :: ksrftms(pcols) ! Surface drag coefficient of turbulent mountain stress [ unit ? ] @@ -546,7 +546,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , real(r8) :: qvfd(pcols,pver) ! Specific humidity for diffusion [ kg/kg ] real(r8) :: tfd(pcols,pver) ! Temperature for diffusion [ K ] real(r8) :: slfd(pcols,pver) ! Liquid static energy [ J/kg ] - real(r8) :: qtfd(pcols,pver) ! Total specific humidity [ kg/kg ] + real(r8) :: qtfd(pcols,pver,1) ! Total specific humidity [ kg/kg ] real(r8) :: qlfd(pcols,pver) ! Liquid water specific humidity for diffusion [ kg/kg ] real(r8) :: ufd(pcols,pver) ! U-wind for diffusion [ m/s ] real(r8) :: vfd(pcols,pver) ! V-wind for diffusion [ m/s ] @@ -689,7 +689,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , ! Only necessary for (qt,sl) not (u,v) because (qt,sl) are newly calculated variables. if( iturb == 1 ) then - qt(:ncol,:) = qtfd(:ncol,:) + qt(:ncol,:) = qtfd(:ncol,:,1) sl(:ncol,:) = slfd(:ncol,:) endif @@ -790,24 +790,59 @@ subroutine compute_eddy_diff( pbuf, lchnk , ! Each time we diffuse the original state slfd(:ncol,:) = sl(:ncol,:) - qtfd(:ncol,:) = qt(:ncol,:) + qtfd(:ncol,:,1)= qt(:ncol,:) ufd(:ncol,:) = u(:ncol,:) vfd(:ncol,:) = v(:ncol,:) ! Diffuse initial profile of each time step using a given (kvh_out,kvm_out) ! In the below 'compute_vdiff', (slfd,qtfd,ufd,vfd) are 'inout' variables. - call compute_vdiff( lchnk , & - pcols , pver , 1 , ncol , tint, & - p , t , rhoi, ztodt , taux , & - tauy , shflx , qflx , & - kvh_out , kvm_out , kvh_out , cgs , cgh , & - zi , ksrftms , dragblj , & - zero , fieldlist_wet, fieldlist_molec, & - ufd , vfd , qtfd , slfd , & - jnk1d , jnk1d , jnk2d , jnk1d , errstring , & - tauresx , tauresy , 0 , cpairv(:,:,lchnk), zero, & - .false., .false. ) + call compute_vdiff( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ncnst = 1, & + ztodt = ztodt, & + fieldlist = fieldlist_wet, & + fieldlistm = fieldlist_molec, & + itaures = .false., & + t = t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p, & + rhoi = rhoi(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflx(:ncol), & + cflx = qflx(:ncol,:1), & ! ncnst = 1 + dse_top = zero, & + kvh = kvh_out(:ncol,:pverp), & + kvm = kvm_out(:ncol,:pverp), & + kvq = kvh_out(:ncol,:pverp), & ! [sic] kvh_out is assigned to kvh, kvq + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + zi = zi(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = zero, & + ! input/output + u = ufd(:ncol,:pver), & + v = vfd(:ncol,:pver), & + q = qtfd(:ncol,:pver,:1), & ! ncnst = 1 + dse = slfd(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = jnk2d(:ncol,:pver), & + tautmsx = jnk1d(:ncol), & + tautmsy = jnk1d(:ncol), & + topflx = jnk1d(:ncol), & + errmsg = errstring, & + ! arguments for molecular diffusion only. + do_molec_diff = .false., & + use_temperature_molec_diff = .false., & + cpairv = cpairv(:ncol,:,lchnk), & + rairv = rairv(:ncol,:,lchnk), & + mbarv = mbarv(:ncol,:,lchnk)) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="compute_vdiff called from eddy_diff_cam") @@ -827,16 +862,16 @@ subroutine compute_eddy_diff( pbuf, lchnk , templ = ( slfd(i,k) - gravit*z(i,k) ) / cpair call qsat( templ, pmid(i,k), es, qs) ep2 = .622_r8 - temps = templ + ( qtfd(i,k) - qs ) / ( cpair / latvap + latvap * qs / ( rair * templ**2 ) ) + temps = templ + ( qtfd(i,k,1) - qs ) / ( cpair / latvap + latvap * qs / ( rair * templ**2 ) ) call qsat( temps, pmid(i,k), es, qs) - qlfd(i,k) = max( qtfd(i,k) - qi(i,k) - qs ,0._r8 ) + qlfd(i,k) = max( qtfd(i,k,1) - qi(i,k) - qs ,0._r8 ) ! Option.2 : Assume condensate is not diffused by the moist turbulence scheme. ! This should bs used if 'pseudodiff = .true.' in vertical_diffusion.F90. ! qlfd(i,k) = ql(i,k) ! ----------------------------- ! ! Compute the other 'qvfd, tfd' ! ! ----------------------------- ! - qvfd(i,k) = max( 0._r8, qtfd(i,k) - qi(i,k) - qlfd(i,k) ) + qvfd(i,k) = max( 0._r8, qtfd(i,k,1) - qi(i,k) - qlfd(i,k) ) tfd(i,k) = ( slfd(i,k) + latvap * qlfd(i,k) + (latvap+latice) * qi(i,k) - gravit*z(i,k)) / cpair end do end do diff --git a/src/physics/cam/molec_diff.F90 b/src/physics/cam/molec_diff.F90 index 1877b8f594..f54330dad8 100644 --- a/src/physics/cam/molec_diff.F90 +++ b/src/physics/cam/molec_diff.F90 @@ -214,11 +214,11 @@ end subroutine compute_molec_diff !============================================================================ ! function vd_lu_qdecomp( & - pcols , pver , ncol , fixed_ubc , mw , & + ncol, pver, fixed_ubc , mw , & kv , kq_scal, mw_facm , dpidz_sq , p , & interface_boundary, molec_boundary, & tint , ztodt , nbot_molec , & - lchnk , t , m , no_molec_decomp) result(decomp) + t , m , no_molec_decomp, mbarv) result(decomp) use coords_1d, only: Coords1D use linear_1d_operators, only: BoundaryType, TriDiagDecomp @@ -234,27 +234,26 @@ function vd_lu_qdecomp( & ! Input-Output Arguments ! ! ---------------------- ! - integer, intent(in) :: pcols - integer, intent(in) :: pver integer, intent(in) :: ncol ! Number of atmospheric columns + integer, intent(in) :: pver integer, intent(in) :: nbot_molec logical, intent(in) :: fixed_ubc ! Fixed upper boundary condition flag - real(r8), intent(in) :: kv(pcols,pver+1) ! Eddy diffusivity - real(r8), intent(in) :: kq_scal(pcols,pver+1) ! Molecular diffusivity ( kq_fac*sqrt(T)*m_d/rho ) + real(r8), intent(in) :: kv(:,:) ! Eddy diffusivity, interfaces + real(r8), intent(in) :: kq_scal(:,:) ! Molecular diffusivity ( kq_fac*sqrt(T)*m_d/rho ), interfaces real(r8), intent(in) :: mw ! Molecular weight for this constituent - real(r8), intent(in) :: mw_facm(pcols,pver+1) ! composition dependent sqrt(1/M_q + 1/M_d) for this constituent - real(r8), intent(in) :: dpidz_sq(ncol,pver+1) ! (g*rho)**2 (square of vertical derivative of pint) + real(r8), intent(in) :: mw_facm(:,:) ! composition dependent sqrt(1/M_q + 1/M_d) for this constituent, interfaces + real(r8), intent(in) :: dpidz_sq(:,:) ! (g*rho)**2 (square of vertical derivative of pint), interfaces type(Coords1D), intent(in) :: p ! Pressure coordinates type(BoundaryType), intent(in) :: interface_boundary ! Boundary on grid edge. type(BoundaryType), intent(in) :: molec_boundary ! Boundary at edge of molec_diff region. - real(r8), intent(in) :: tint(pcols,pver+1) ! Interface temperature [ K ] + real(r8), intent(in) :: tint(:,:) ! Interface temperature [ K ], interfaces real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] - integer, intent(in) :: lchnk ! Chunk number - real(r8), intent(in) :: t(pcols,pver) ! temperature + real(r8), intent(in) :: t(:,:) ! temperature integer, intent(in) :: m ! cnst index + real(r8), intent(in) :: mbarv(:,:) ! composition dependent atmosphere mean mass ! Decomposition covering levels without vertical diffusion. type(TriDiagDecomp), intent(in) :: no_molec_decomp @@ -312,12 +311,12 @@ function vd_lu_qdecomp( & ! Top level first. k = 1 - mbarvi = .75_r8*mbarv(:ncol,k,lchnk)+0.5_r8*mbarv(:ncol,k+1,lchnk) & - -.25_r8*mbarv(:ncol,k+2,lchnk) + mbarvi = .75_r8*mbarv(:ncol,k)+0.5_r8*mbarv(:ncol,k+1) & + -.25_r8*mbarv(:ncol,k+2) mw_term(:,k) = (mw/mbarvi - 1._r8) / p%ifc(:,k) - gradm(:,k) = (mbarv(:ncol,k,lchnk)-mbarvi)/ & + gradm(:,k) = (mbarv(:ncol,k)-mbarvi)/ & (p%mid(:,k)-p%ifc(:,k))/ & - (mbarv(:ncol,k,lchnk)+mbarvi)*2._r8 + (mbarv(:ncol,k)+mbarvi)*2._r8 if (alphath(m) /= 0._r8) then gradt(:,k) = alphath(m)*(t(:ncol,k)-tint(:ncol,k))/ & @@ -327,9 +326,9 @@ function vd_lu_qdecomp( & ! Interior of molecular diffusion region. do k = 2, nbot_molec - mbarvi = 0.5_r8 * (mbarv(:ncol,k-1,lchnk)+mbarv(:ncol,k,lchnk)) + mbarvi = 0.5_r8 * (mbarv(:ncol,k-1)+mbarv(:ncol,k)) mw_term(:,k) = (mw/mbarvi - 1._r8) / p%ifc(:,k) - gradm(:,k) = (mbarv(:ncol,k,lchnk)-mbarv(:ncol,k-1,lchnk)) * & + gradm(:,k) = (mbarv(:ncol,k)-mbarv(:ncol,k-1)) * & p%rdst(:,k-1)/mbarvi enddo diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 2aad26ed4e..fee691f546 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -711,6 +711,7 @@ subroutine vertical_diffusion_tend( & use constituents, only : qmincg, qmin, cnst_type use diffusion_solver, only : compute_vdiff, any, operator(.not.) use air_composition, only : cpairv, rairv !Needed for calculation of upward H flux + use air_composition, only : mbarv use time_manager, only : get_nstep use constituents, only : cnst_get_type_byind, cnst_name, & cnst_mw, cnst_fixed_ubc, cnst_fixed_ubflx, cnst_ndropmixed @@ -815,8 +816,8 @@ subroutine vertical_diffusion_tend( & ! for obklen calculation outside HB real(r8) :: thvs(pcols) ! Virtual potential temperature at surface real(r8) :: rrho(pcols) ! Reciprocal of density at surface - real(r8) :: khfs(pcols) ! sfc kinematic heat flux [mK/s] - real(r8) :: kqfs(pcols) ! sfc kinematic water vapor flux [m/s] + real(r8) :: khfs(pcols) ! sfc kinematic heat flux [K m s-1] + real(r8) :: kqfs(pcols) ! sfc kinematic water vapor flux [kg kg-1 m s-1] real(r8) :: kbfs(pcols) ! sfc kinematic buoyancy flux [m^2/s^3] real(r8) :: ftem(pcols,pver) ! Saturation vapor pressure before PBL @@ -1131,14 +1132,14 @@ subroutine vertical_diffusion_tend( & wstar = wstar(:ncol), & bge = bge(:ncol), & ! Output variables - kvm = kvm(:ncol,:pver), & - kvh = kvh(:ncol,:pver), & - kvq = kvq(:ncol,:pver), & - cgh = cgh(:ncol,:pver), & - cgs = cgs(:ncol,:pver), & + kvm = kvm(:ncol,:pverp), & + kvh = kvh(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & tpert = tpert(:ncol), & qpert = qpert(:ncol), & - tke = tke(:ncol,:pver), & + tke = tke(:ncol,:pverp), & errmsg = errmsg, & errflg = errflg) @@ -1170,7 +1171,7 @@ subroutine vertical_diffusion_tend( & karman = karman, & exner = state%exner(:ncol,:pver), & t = state%t(:ncol,:pver), & - q_wv = state%q(:ncol,:pver,1), & ! FIXME: assumes wv at 1 (need to change to ixq) + q_wv = state%q(:ncol,:pver,1), & ! NOTE: assumes wv at 1 (need to change to ixq?) z = state%zm(:ncol,:pver), & pmid = state%pmid(:ncol,:pver), & u = state%u(:ncol,:pver), & @@ -1178,7 +1179,7 @@ subroutine vertical_diffusion_tend( & taux = tautotx(:ncol), & tauy = tautoty(:ncol), & shflx = cam_in%shf(:ncol), & - q_wv_flx = cam_in%cflx(:ncol,1), & ! FIXME: assumes wv at 1 (need to change to ixq) + q_wv_flx = cam_in%cflx(:ncol,1), & ! NOTE: assumes wv at 1 (need to change to ixq?) ! Output variables thv = thv(:ncol,:pver), & ustar = ustar(:ncol), & @@ -1206,11 +1207,11 @@ subroutine vertical_diffusion_tend( & s2 = s2(:ncol,:pver), & ri = ri(:ncol,:pver), & ! Output variables - kvm = kvm(:ncol,:pver), & - kvh = kvh(:ncol,:pver), & - kvq = kvq(:ncol,:pver), & - cgh = cgh(:ncol,:pver), & - cgs = cgs(:ncol,:pver), & + kvm = kvm(:ncol,:pverp), & + kvh = kvh(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & errmsg = errmsg, & errflg = errflg) @@ -1363,58 +1364,62 @@ subroutine vertical_diffusion_tend( & end if call compute_vdiff( & - lchnk = state%lchnk, & - pcols = pcols, & + ncol = ncol, & pver = pver, & + pverp = pverp, & ncnst = pcnst, & - ncol = ncol, & - tint = tint, & - p = p, & - t = state%t, & - rhoi = rhoi, & ztodt = ztodt, & - taux = taux, & - tauy = tauy, & - shflx = shflux, & - cflx = cflux, & - kvh = kvh, & - kvm = kvm, & - kvq = kvq, & - cgs = cgs, & - cgh = cgh, & - zi = state%zi, & - ksrftms = ksrftms, & - dragblj = dragblj, & - qmincg = qmincg, & fieldlist = fieldlist_wet, & fieldlistm = fieldlist_molec, & - u = u_tmp, & - v = v_tmp, & - q = q_tmp, & - dse = s_tmp, & - tautmsx = tautmsx, & - tautmsy = tautmsy, & - dtk = dtk, & - topflx = topflx, & - errstring = errstring, & - tauresx = tauresx, & - tauresy = tauresy, & - itaures = 1, & - cpairv = cpairv(:,:,state%lchnk), & - dse_top = dse_top, & + itaures = .true., & + t = state%t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflux(:ncol), & + cflx = cflux(:ncol,:pcnst), & + dse_top = dse_top(:ncol), & + kvh = kvh(:ncol,:pverp), & + kvm = kvm(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + zi = state%zi(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = qmincg(:pcnst), & + ! input/output + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + dse = s_tmp(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = dtk(:ncol,:), & + tautmsx = tautmsx(:ncol), & + tautmsy = tautmsy(:ncol), & + topflx = topflx(:ncol), & + errmsg = errstring, & + ! arguments for molecular diffusion only. do_molec_diff = do_molec_diff, & use_temperature_molec_diff = waccmx_mode, & + cpairv = cpairv(:ncol,:,state%lchnk), & + rairv = rairv(:ncol,:,state%lchnk), & + mbarv = mbarv(:ncol,:,state%lchnk), & vd_lu_qdecomp = vd_lu_qdecomp, & - ubc_mmr = ubc_mmr, & - ubc_flux = ubc_flux, & - kvt = kvt, & - pmid = state%pmid, & - cnst_mw = cnst_mw, & - cnst_fixed_ubc = cnst_fixed_ubc, & - cnst_fixed_ubflx = cnst_fixed_ubflx, & + ubc_mmr = ubc_mmr(:ncol,:pcnst), & + ubc_flux = ubc_flux(:ncol,:pcnst), & + kvt = kvt(:ncol,:pverp), & + pmid = state%pmid(:ncol,:pver), & + cnst_mw = cnst_mw(:pcnst), & + cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & nbot_molec = nbot_molec, & - kq_scal = kq_scal, & - mw_fac = mw_fac) + kq_scal = kq_scal(:ncol,:pverp), & + mw_fac = mw_fac(:ncol,:pverp,:pcnst)) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="Error in fieldlist_wet call from vertical_diffusion.") @@ -1434,58 +1439,62 @@ subroutine vertical_diffusion_tend( & end if call compute_vdiff( & - lchnk = state%lchnk, & - pcols = pcols, & + ncol = ncol, & pver = pver, & + pverp = pverp, & ncnst = pcnst, & - ncol = ncol, & - tint = tint, & - p = p_dry, & - t = state%t, & - rhoi = rhoi_dry, & ztodt = ztodt, & - taux = taux, & - tauy = tauy, & - shflx = shflux, & - cflx = cflux, & - kvh = kvh, & - kvm = kvm, & - kvq = kvq, & - cgs = cgs, & - cgh = cgh, & - zi = state%zi, & - ksrftms = ksrftms, & - dragblj = dragblj, & - qmincg = qmincg, & fieldlist = fieldlist_dry, & fieldlistm = fieldlist_molec, & - u = u_tmp, & - v = v_tmp, & - q = q_tmp, & - dse = s_tmp, & - tautmsx = tautmsx_temp, & - tautmsy = tautmsy_temp, & - dtk = dtk_temp, & - topflx = topflx_temp, & - errstring = errstring, & - tauresx = tauresx, & - tauresy = tauresy, & - itaures = 1, & - cpairv = cpairv(:,:,state%lchnk), & - dse_top = dse_top, & + itaures = .true., & + t = state%t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p_dry, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi_dry(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflux(:ncol), & + cflx = cflux(:ncol,:pcnst), & + dse_top = dse_top(:ncol), & + kvh = kvh(:ncol,:pverp), & + kvm = kvm(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + zi = state%zi(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = qmincg(:pcnst), & + ! input/output + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + dse = s_tmp(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = dtk_temp(:ncol,:), & + tautmsx = tautmsx_temp(:ncol), & + tautmsy = tautmsy_temp(:ncol), & + topflx = topflx_temp(:ncol), & + errmsg = errstring, & + ! arguments for molecular diffusion only. do_molec_diff = do_molec_diff, & use_temperature_molec_diff = waccmx_mode, & + cpairv = cpairv(:ncol,:,state%lchnk), & + rairv = rairv(:ncol,:,state%lchnk), & + mbarv = mbarv(:ncol,:,state%lchnk), & vd_lu_qdecomp = vd_lu_qdecomp, & - ubc_mmr = ubc_mmr, & - ubc_flux = ubc_flux, & - kvt = kvt, & - pmid = state%pmiddry, & - cnst_mw = cnst_mw, & - cnst_fixed_ubc = cnst_fixed_ubc, & - cnst_fixed_ubflx = cnst_fixed_ubflx, & + ubc_mmr = ubc_mmr(:ncol,:pcnst), & + ubc_flux = ubc_flux(:ncol,:pcnst), & + kvt = kvt(:ncol,:pverp), & + pmid = state%pmiddry(:ncol,:pver), & + cnst_mw = cnst_mw(:pcnst), & + cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & nbot_molec = nbot_molec, & - kq_scal = kq_scal, & - mw_fac = mw_fac) + kq_scal = kq_scal(:ncol,:pverp), & + mw_fac = mw_fac(:ncol,:pverp,:pcnst)) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="Error in fieldlist_dry call from vertical_diffusion.") From 434aa932d0919c19c79dbf9663bf2839450e3fd4 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 12 May 2025 17:13:23 -0400 Subject: [PATCH 183/466] Clean up compute_vdiff unused arguments; use dependencies --- src/physics/cam/diffusion_solver.F90 | 8 +++++--- src/physics/cam/eddy_diff_cam.F90 | 8 ++++++-- src/physics/cam/vertical_diffusion.F90 | 13 +++++++------ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index 81e1eef262..f42d60751e 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -134,13 +134,14 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & p , t , rhoi , ztodt , taux , & tauy , shflx , cflx , & kvh , kvm , kvq , cgs , cgh , & - zi , ksrftms , dragblj , & + ksrftms , dragblj , & qmincg , fieldlist , fieldlistm , & u , v , q , dse , & tautmsx , tautmsy , dtk , topflx , errmsg , & tauresx , tauresy , itaures , & cpairv, rairv, mbarv, & dse_top, & + do_beljaars, & do_molec_diff , use_temperature_molec_diff, vd_lu_qdecomp, & ubc_mmr, ubc_flux, kvt, pmid, & cnst_mw, cnst_fixed_ubc, cnst_fixed_ubflx, nbot_molec, & @@ -163,7 +164,6 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & BoundaryData, BoundaryFlux, TriDiagDecomp use vdiff_lu_solver, only : fin_vol_lu_decomp use vertical_diffusion_solver, only : fin_vol_solve - use beljaars_drag_cam, only : do_beljaars ! Modification : Ideally, we should diffuse 'liquid-ice static energy' (sl), not the dry static energy. ! Also, vertical diffusion of cloud droplet number concentration and aerosol number @@ -191,7 +191,6 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & ! Input v-momentum per unit time per unit area into the atmosphere [ N/m2 ] real(r8), intent(in) :: shflx(:) ! Surface sensible heat flux [ W/m2 ] real(r8), intent(in) :: cflx(:,:) ! Surface constituent flux [ kg/m2/s ] (ncol,ncnst) - real(r8), intent(in) :: zi(:,:) ! Interface heights [ m ] real(r8), intent(in) :: ksrftms(:) ! Surface drag coefficient for turbulent mountain stress. > 0. [ kg/s/m2 ] real(r8), intent(in) :: dragblj(:,:) ! Drag profile from Beljaars SGO form drag > 0. [ 1/s ] real(r8), intent(in) :: qmincg(:) ! Minimum constituent mixing ratios from cg fluxes, (ncnst) @@ -224,6 +223,9 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & real(r8), intent(out) :: topflx(:) ! Molecular heat flux at the top interface character(128), intent(out) :: errmsg ! Output status + ! Enable Beljaars drag? + logical, intent(in) :: do_beljaars ! Flag indicating Beljaars drag + ! Molecular Diffusion Arguments - mostly optional logical, intent(in) :: do_molec_diff ! Flag indicating multiple constituent diffusivities logical, intent(in) :: use_temperature_molec_diff! Flag indicating that molecular diffusion should apply to temperature, not diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index b4faffe223..06bd624f1b 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -434,6 +434,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , use wv_saturation, only: qsat use eddy_diff, only: trbintd, caleddy use physics_buffer, only: pbuf_get_field + use beljaars_drag_cam, only: do_beljaars ! --------------- ! ! Input Variables ! @@ -794,9 +795,11 @@ subroutine compute_eddy_diff( pbuf, lchnk , ufd(:ncol,:) = u(:ncol,:) vfd(:ncol,:) = v(:ncol,:) + ! TODO (hplin, 5/9/2025): after these are subset to ncol check if we + ! need to initialize some outs to 0; compute_vdiff did not do this before + ! Diffuse initial profile of each time step using a given (kvh_out,kvm_out) ! In the below 'compute_vdiff', (slfd,qtfd,ufd,vfd) are 'inout' variables. - call compute_vdiff( & ncol = ncol, & pver = pver, & @@ -820,7 +823,6 @@ subroutine compute_eddy_diff( pbuf, lchnk , kvq = kvh_out(:ncol,:pverp), & ! [sic] kvh_out is assigned to kvh, kvq cgs = cgs(:ncol,:pverp), & cgh = cgh(:ncol,:pverp), & - zi = zi(:ncol,:pverp), & ksrftms = ksrftms(:ncol), & dragblj = dragblj(:ncol,:pver), & qmincg = zero, & @@ -837,6 +839,8 @@ subroutine compute_eddy_diff( pbuf, lchnk , tautmsy = jnk1d(:ncol), & topflx = jnk1d(:ncol), & errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & ! arguments for molecular diffusion only. do_molec_diff = .false., & use_temperature_molec_diff = .false., & diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index fee691f546..791b013670 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -50,7 +50,7 @@ module vertical_diffusion ! S. Park : Aug. 2006, Dec. 2008. Jan. 2010 ! !----------------------------------------------------------------------------------------------------- ! -use shr_kind_mod, only : r8 => shr_kind_r8, i4=> shr_kind_i4 +use shr_kind_mod, only : r8 => shr_kind_r8 use ppgrid, only : pcols, pver, pverp use constituents, only : pcnst use diffusion_solver, only : vdiff_selector @@ -284,7 +284,7 @@ subroutine vertical_diffusion_init(pbuf2d) real(r8), parameter :: ntop_eddy_pres = 1.e-7_r8 ! Pressure below which eddy diffusion is not done in WACCM-X. (Pa) - integer :: im, l, m, nmodes, nspec, ierr + integer :: ierr logical :: history_amwg ! output the variables used by the AMWG diag package logical :: history_eddy ! output the eddy variables @@ -695,7 +695,7 @@ subroutine vertical_diffusion_tend( & use cam_history, only : outfld use trb_mtn_stress_cam, only : trb_mtn_stress_tend - use beljaars_drag_cam, only : beljaars_drag_tend + use beljaars_drag_cam, only : beljaars_drag_tend, do_beljaars use eddy_diff_cam, only : eddy_diff_tend ! CCPP-ized HB scheme @@ -723,7 +723,6 @@ subroutine vertical_diffusion_tend( & use upper_bc, only : ubc_get_flxs use coords_1d, only : Coords1D use phys_control, only : cam_physpkg_is - use ref_pres, only : ptop_ref ! --------------- ! ! Input Arguments ! @@ -1386,7 +1385,6 @@ subroutine vertical_diffusion_tend( & kvq = kvq(:ncol,:pverp), & cgs = cgs(:ncol,:pverp), & cgh = cgh(:ncol,:pverp), & - zi = state%zi(:ncol,:pverp), & ksrftms = ksrftms(:ncol), & dragblj = dragblj(:ncol,:pver), & qmincg = qmincg(:pcnst), & @@ -1403,6 +1401,8 @@ subroutine vertical_diffusion_tend( & tautmsy = tautmsy(:ncol), & topflx = topflx(:ncol), & errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & ! arguments for molecular diffusion only. do_molec_diff = do_molec_diff, & use_temperature_molec_diff = waccmx_mode, & @@ -1461,7 +1461,6 @@ subroutine vertical_diffusion_tend( & kvq = kvq(:ncol,:pverp), & cgs = cgs(:ncol,:pverp), & cgh = cgh(:ncol,:pverp), & - zi = state%zi(:ncol,:pverp), & ksrftms = ksrftms(:ncol), & dragblj = dragblj(:ncol,:pver), & qmincg = qmincg(:pcnst), & @@ -1478,6 +1477,8 @@ subroutine vertical_diffusion_tend( & tautmsy = tautmsy_temp(:ncol), & topflx = topflx_temp(:ncol), & errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & ! arguments for molecular diffusion only. do_molec_diff = do_molec_diff, & use_temperature_molec_diff = waccmx_mode, & From 1227c11feaf289e4d8245bf68523f1b3c60521a1 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 16 May 2025 11:12:10 -0400 Subject: [PATCH 184/466] Reword comment for readability --- src/physics/cam/ref_pres.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/ref_pres.F90 b/src/physics/cam/ref_pres.F90 index 1630072d3e..19781a6ab7 100644 --- a/src/physics/cam/ref_pres.F90 +++ b/src/physics/cam/ref_pres.F90 @@ -43,8 +43,8 @@ module ref_pres ! Top level for MAM processes that impact climate integer, protected :: clim_modal_aero_top_lev -! Molecular diffusion is calculated only if the model top is below this -! pressure (Pa). +! Molecular diffusion is calculated only if the model top pressure +! is less than do_molec_press (Pa): real(r8), protected :: do_molec_press = 0.1_r8 ! Pressure used to set bottom of molecular diffusion region (Pa). real(r8), protected :: molec_diff_bot_press = 50._r8 From 06f5aee4cbc3248d5cedf80c546ad689020893df Mon Sep 17 00:00:00 2001 From: peverwhee Date: Sat, 17 May 2025 21:19:50 -0600 Subject: [PATCH 185/466] update radiation interface and bring in pio reader --- src/physics/rrtmgp/radiation.F90 | 45 +- src/utils/cam_ccpp/pio_reader.F90 | 2802 +++++++++++++++++++++++++++++ 2 files changed, 2826 insertions(+), 21 deletions(-) create mode 100644 src/utils/cam_ccpp/pio_reader.F90 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 0f8a073e96..48dd6dd0d5 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -411,10 +411,11 @@ end function radiation_do !================================================================================================ subroutine radiation_init(pbuf2d) - use rrtmgp_pre, only: rrtmgp_pre_init - use rrtmgp_inputs, only: rrtmgp_inputs_init - use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init - use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init + use rrtmgp_pre, only: rrtmgp_pre_init + use rrtmgp_inputs, only: rrtmgp_inputs_init + use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init + use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init + use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -463,7 +464,10 @@ subroutine radiation_init(pbuf2d) ! Read RRTMGP coefficients files and initialize kdist objects. call coefs_init(coefs_sw_file, available_gases, kdist_sw) - call coefs_init(coefs_lw_file, available_gases, kdist_lw) + call rrtmgp_lw_gas_optics_data_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if ! Set up inputs to RRTMGP call rrtmgp_inputs_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & @@ -1820,7 +1824,6 @@ end subroutine radiation_output_lw !=============================================================================== subroutine coefs_init(coefs_file, available_gases, kdist) - use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init ! Read data from coefficients file. Initialize the kdist object. ! available_gases object provides the gas names that CAM provides. @@ -2300,21 +2303,21 @@ subroutine coefs_init(coefs_file, available_gases, kdist) ! Initialize the gas optics object with data. The calls are slightly different depending ! on whether the radiation sources are internal to the atmosphere (longwave) or external (shortwave) - if (allocated(totplnk) .and. allocated(planck_frac)) then - call rrtmgp_lw_gas_optics_data_init(kdist, available_gases, gas_names, & - key_species, band2gpt, band_lims_wavenum, press_ref, press_ref_trop, & - temp_ref, temp_ref_p, temp_ref_t, vmr_ref, kmajor, kminor_lower, & - kminor_upper, gas_minor, identifier_minor, minor_gases_lower, & - minor_gases_upper, minor_limits_gpt_lower, minor_limits_gpt_upper, & - minor_scales_with_density_lower, minor_scales_with_density_upper, & - scaling_gas_lower, scaling_gas_upper, scale_by_complement_lower, & - scale_by_complement_upper, kminor_start_lower, kminor_start_upper, & - totplnk, planck_frac, rayl_lower, rayl_upper, optimal_angle_fit, & - errmsg, ierr) - if (ierr /= 0) then - call endrun(sub//': '//errmsg) - end if - else if (allocated(solar_src_quiet)) then + !if (allocated(totplnk) .and. allocated(planck_frac)) then + ! call rrtmgp_lw_gas_optics_data_init(kdist, available_gases, gas_names, & + ! key_species, band2gpt, band_lims_wavenum, press_ref, press_ref_trop, & + ! temp_ref, temp_ref_p, temp_ref_t, vmr_ref, kmajor, kminor_lower, & + ! kminor_upper, gas_minor, identifier_minor, minor_gases_lower, & + ! minor_gases_upper, minor_limits_gpt_lower, minor_limits_gpt_upper, & + ! minor_scales_with_density_lower, minor_scales_with_density_upper, & + ! scaling_gas_lower, scaling_gas_upper, scale_by_complement_lower, & + ! scale_by_complement_upper, kminor_start_lower, kminor_start_upper, & + ! totplnk, planck_frac, rayl_lower, rayl_upper, optimal_angle_fit, & + ! errmsg, ierr) + ! if (ierr /= 0) then + ! call endrun(sub//': '//errmsg) + ! end if + if (allocated(solar_src_quiet)) then error_msg = kdist%gas_props%load( & available_gases%gas_concs, gas_names, key_species, & band2gpt, band_lims_wavenum, & diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 new file mode 100644 index 0000000000..b0fcf4cee9 --- /dev/null +++ b/src/utils/cam_ccpp/pio_reader.F90 @@ -0,0 +1,2802 @@ +module pio_reader + use pio, only: file_desc_t + use ccpp_io_reader, only: abstract_netcdf_reader_t + use shr_kind_mod, only: cl=>shr_kind_cl + + implicit none + private + + public :: pio_reader_t + + !Error code parameters + integer, parameter :: pio_inq_dim_id_err = 1 + integer, parameter :: pio_inq_dim_len_err = 2 + integer, parameter :: pio_inq_var_id_err = 3 + integer, parameter :: pio_inq_var_info_err = 4 + integer, parameter :: bad_var_rank_err = 5 + integer, parameter :: too_high_rank_err = 6 + integer, parameter :: pio_get_var_err = 7 + integer, parameter :: not_char_type_err = 8 + integer, parameter :: file_not_open_err = 9 + integer, parameter :: pio_get_msg_err = 10 + + type :: file_handle_t + logical :: is_file_open = .false. !Is NetCDF file currently open? + type(file_desc_t) :: pio_fh !PIO File handle type + character(len=cl) :: file_path = '' !Local path to NetCDF file + end type + + type, extends(abstract_netcdf_reader_t) :: pio_reader_t + private + type(file_handle_t) :: sima_pio_fh !PIO File handle type + contains + procedure :: open_file => open_netcdf_file + procedure :: close_file => close_netcdf_file + procedure :: get_var_int_0d => get_netcdf_var_int_0d + procedure :: get_var_int_1d => get_netcdf_var_int_1d + procedure :: get_var_int_2d => get_netcdf_var_int_2d + procedure :: get_var_int_3d => get_netcdf_var_int_3d + procedure :: get_var_int_4d => get_netcdf_var_int_4d + procedure :: get_var_int_5d => get_netcdf_var_int_5d + procedure :: get_var_real_0d => get_netcdf_var_real_0d + procedure :: get_var_real_1d => get_netcdf_var_real_1d + procedure :: get_var_real_2d => get_netcdf_var_real_2d + procedure :: get_var_real_3d => get_netcdf_var_real_3d + procedure :: get_var_real_4d => get_netcdf_var_real_4d + procedure :: get_var_real_5d => get_netcdf_var_real_5d + procedure :: get_var_char_0d => get_netcdf_var_char_0d + procedure :: get_var_char_1d => get_netcdf_var_char_1d + procedure :: get_var_char_2d => get_netcdf_var_char_2d + procedure :: get_var_char_3d => get_netcdf_var_char_3d + procedure :: get_var_char_4d => get_netcdf_var_char_4d + procedure :: get_var_char_5d => get_netcdf_var_char_5d + end type pio_reader_t + +contains + + subroutine open_netcdf_file(this, file_path, errmsg, errcode) + use ioFileMod, only: cam_get_file + use cam_pio_utils, only: cam_pio_openfile + use pio, only: PIO_NOWRITE + + class(pio_reader_t), intent(inout) :: this + character(len=*), intent(in) :: file_path + integer, intent(out) :: errcode + character(len=*), intent(out) :: errmsg + + character(len=cl) :: local_file_path !NetCDF file path on local file system + + if(this%sima_pio_fh%is_file_open) then + errcode = 1 + errmsg = "Trying to reuse pio_reader already used for: '"//this%sima_pio_fh%file_path + return + end if + + if(file_path == 'UNSET_PATH') then + errcode = 1 + errmsg = "Found UNSET_PATH trying to open file" + return + end if + + call cam_get_file(file_path, local_file_path) + call cam_pio_openfile(this%sima_pio_fh%pio_fh, local_file_path, PIO_NOWRITE) + + !Set file handle metadata + this%sima_pio_fh%file_path = local_file_path + this%sima_pio_fh%is_file_open = .true. + + !File was successfully opened + errcode = 0 + errmsg = '' + end subroutine open_netcdf_file + + subroutine close_netcdf_file(this, errmsg, errcode) + use pio, only: pio_closefile + + class(pio_reader_t), intent(inout) :: this + integer, intent(out) :: errcode + character(len=*), intent(out) :: errmsg + + if(.not.this%sima_pio_fh%is_file_open) then + !File is already closed, so just exit + !quietly. + errcode = 0 + errmsg = '' + return + end if + + !Close NetCDF File: + call pio_closefile(this%sima_pio_fh%pio_fh) + + !Inidcate that file handle array id is no longer in use: + this%sima_pio_fh%is_file_open = .false. + this%sima_pio_fh%file_path = '' + + !File was successfully closed + errcode = 0 + errmsg = '' + end subroutine close_netcdf_file + + ! ------------------------------------------------------------------ + ! Integer interfaces + ! ------------------------------------------------------------------ + + subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 0) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + var = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_0d + + subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var(:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 1) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension size + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:) = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var(:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_1d + + subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var(:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 2) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:) = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_2d + + subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var(:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 3) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:) = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_3d + + subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var(:,:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 4) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:) = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_4d + + subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, pointer, intent(out) :: var(:,:,:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 5) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & + stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:,:) = huge(1) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_int_5d + + ! ------------------------------------------------------------------ + ! Real interfaces + ! ------------------------------------------------------------------ + + subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 0) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + var = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_0d + + subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var(:) !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 1) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_1d + + subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var(:,:) !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 2) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_2d + + subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var(:,:,:) !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 3) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_3d + + subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var(:,:,:,:) !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 4) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_4d + + subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) + use ccpp_kinds, only: kind_phys + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + real(kind_phys), pointer, intent(out) :: var(:,:,:,:,:) !Real variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + + integer :: i !loop control variable + !---------------------- + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= 5) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & + stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:,:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_real_5d + + ! ------------------------------------------------------------------ + ! Character interfaces + ! ------------------------------------------------------------------ + + subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 1) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var, stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_0d + + subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var(:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 2) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var(dim_sizes(2)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:) = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var(:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_1d + + subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var(:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 3) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:) = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_2d + + subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var(:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 4) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:) = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_3d + + subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var(:,:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 5) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & + stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:) = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_4d + + subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) + use pio, only: pio_inq_varid + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: pio_seterrorhandling + use pio, only: pio_get_var + use pio, only: PIO_NOERR + use pio, only: PIO_BCAST_ERROR + use pio_types, only: PIO_CHAR + + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), pointer, intent(out) :: var(:,:,:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + type(file_desc_t) :: pio_file_handle !File handle type used by PIO + character(len=cl) :: file_path !Path to NetCDF file + integer :: err_handling !PIO error handling code + integer :: var_id !NetCDF variable ID + integer :: nc_type !NetCDF variable type + integer :: ndims !Number of variable dimensions on NetCDF file + integer, allocatable :: dim_ids(:) !Variable dimension IDs + integer, allocatable :: dim_sizes(:) !Variable dimension sizes + integer :: i !loop control variable + + !Check if file is open: + if(.not.this%sima_pio_fh%is_file_open) then + !File isn't actually open, so throw an error + errcode = file_not_open_err + errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + return + end if + + !Extract open file information: + pio_file_handle = this%sima_pio_fh%pio_fh + file_path = this%sima_pio_fh%file_path + + !Force PIO to send an error code instead of dying: + call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) + + !Look for variable on file: + errcode = pio_inq_varid(pio_file_handle, varname, var_id) + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable type and number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that variable is a character array + !(as we cannot currently handle string-type variables): + if(nc_type /= PIO_CHAR) then + errcode = not_char_type_err + errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just assume a character array + !and check for ndims = rank+1 + errcode = 0 + if(ndims /= 6) then + errcode = bad_var_rank_err + errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + end do + + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data. Note that the first dimenstion + !is the length of the character array, so need to start + !the dim_sizes allocation count at index two: + allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5), dim_sizes(6)), & + stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + var(:,:,:,:,:) = 'UNSET' + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if + + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + + !Variable was successfully read, so properly set the error + !code and message: + errcode = 0 + errmsg = '' + end subroutine get_netcdf_var_char_5d + + subroutine get_pio_errmsg(caller_errcode, errcode, errmsg) + !Set error message based off PIO error code, + !and then reset PIO error code to caller-specified + !error code. + + !Note that if an internal error occurs when + !attempting to grab the error message both + !the error code and error message will be + !updated. + + use pio, only: pio_strerror + use pio, only: PIO_NOERR + + !Input/output arguments: + integer, intent(in) :: caller_errcode !New error code caller wants. + integer, intent(inout) :: errcode !Error code + character(len=*), intent(inout) :: errmsg !Error message + + !Local variables: + integer :: strerr !Error code returned if pio_strerror fails + + strerr = pio_strerror(errcode, errmsg) + if(strerr /= PIO_NOERR) then + write(errmsg, *) "Failed to get error message for PIO code: ", errcode + errcode = pio_get_msg_err + else + errcode = caller_errcode + end if + end subroutine get_pio_errmsg + +end module pio_reader From 995643ce088a8963136c60e15783a5bcb134865b Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 16 May 2025 11:46:07 -0400 Subject: [PATCH 186/466] Remove oop fieldlist in compute_vdiff and replace with logical array --- src/physics/cam/diffusion_solver.F90 | 239 +++++++------------------ src/physics/cam/eddy_diff_cam.F90 | 119 ++++++------ src/physics/cam/vertical_diffusion.F90 | 73 ++++---- 3 files changed, 153 insertions(+), 278 deletions(-) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index f42d60751e..226ddf6aa2 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -9,10 +9,6 @@ module diffusion_solver ! Public interfaces : ! ! init_vdiff initializes time independent coefficients ! ! compute_vdiff solves diffusion equations ! - ! vdiff_selector type for storing fields selected to be diffused ! - ! vdiff_select selects fields to be diffused ! - ! operator(.not.) extends .not. to operate on type vdiff_selector ! - ! any provides functionality of intrinsic any for type vdiff_selector ! ! ! !------------------------------------ Code History ---------------------------------- ! ! Initial subroutines : B. Boville and others, 1991-2004 ! @@ -30,32 +26,8 @@ module diffusion_solver ! Public interfaces ! ! ----------------- ! - public init_vdiff ! Initialization - public new_fieldlist_vdiff ! Returns an empty fieldlist - public compute_vdiff ! Full routine - public vdiff_selector ! Type for storing fields selected to be diffused - public vdiff_select ! Selects fields to be diffused - public operator(.not.) ! Extends .not. to operate on type vdiff_selector - public any ! Provides functionality of intrinsic any for type vdiff_selector - - ! Below stores logical array of fields to be diffused - - type vdiff_selector - private - logical, allocatable, dimension(:) :: fields - end type vdiff_selector - - ! Below extends .not. to operate on type vdiff_selector - - interface operator(.not.) - module procedure not - end interface - - ! Below provides functionality of intrinsic any for type vdiff_selector - - interface any - module procedure my_any - end interface + public :: init_vdiff ! Initialization + public :: compute_vdiff ! Full routine ! ------------ ! ! Private data ! @@ -113,29 +85,15 @@ subroutine init_vdiff( kind, iulog_in, rair_in, cpair_in, gravit_in, do_iss_in, end subroutine init_vdiff - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - type(vdiff_selector) pure function new_fieldlist_vdiff(ncnst) - - integer, intent(in) :: ncnst ! Number of constituents - - allocate( new_fieldlist_vdiff%fields( 3 + ncnst ) ) - new_fieldlist_vdiff%fields = .false. - - end function new_fieldlist_vdiff - - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & p , t , rhoi , ztodt , taux , & tauy , shflx , cflx , & kvh , kvm , kvq , cgs , cgh , & - ksrftms , dragblj , & - qmincg , fieldlist , fieldlistm , & + ksrftms , dragblj , & + qmincg , & + do_diffusion_u_v, do_diffusion_s, & + do_diffusion_const, & + do_molecular_diffusion_const, & u , v , q , dse , & tautmsx , tautmsy , dtk , topflx , errmsg , & tauresx , tauresy , itaures , & @@ -155,19 +113,19 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & ! obtained from the turbulence module. ! !-------------------------------------------------------------------------- ! -! Used for CAM debugging. -! use phys_debug_util, only : phys_debug_col -! use time_manager, only : is_first_step, get_nstep + ! Used for CAM debugging. + ! use phys_debug_util, only : phys_debug_col + ! use time_manager, only : is_first_step, get_nstep use coords_1d, only: Coords1D use linear_1d_operators, only : BoundaryType, BoundaryFixedLayer, & BoundaryData, BoundaryFlux, TriDiagDecomp use vdiff_lu_solver, only : fin_vol_lu_decomp use vertical_diffusion_solver, only : fin_vol_solve - - ! Modification : Ideally, we should diffuse 'liquid-ice static energy' (sl), not the dry static energy. - ! Also, vertical diffusion of cloud droplet number concentration and aerosol number - ! concentration should be done very carefully in the future version. + + ! Modification : Ideally, we should diffuse 'liquid-ice static energy' (sl), not the dry static energy. + ! Also, vertical diffusion of cloud droplet number concentration and aerosol number + ! concentration should be done very carefully in the future version. ! Input Arguments integer, intent(in) :: ncol ! Number of atmospheric columns @@ -176,8 +134,10 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & integer, intent(in) :: ncnst ! # of constituents to diffuse. In eddy_diff, only wv. Others, pcnst. real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] - type(vdiff_selector), intent(in) :: fieldlist ! Array of flags selecting which fields to diffuse - type(vdiff_selector), intent(in) :: fieldlistm ! Array of flags selecting which fields for molecular diffusion + logical, intent(in) :: do_diffusion_u_v ! diffuse horizontal winds [flag] + logical, intent(in) :: do_diffusion_s ! diffuse dry static energy [flag] + logical, intent(in) :: do_diffusion_const(:) ! diffuse constituents (size ncnst) [flag] + logical, intent(in) :: do_molecular_diffusion_const(:) ! molecular diffusion of constituents (size ncnst) [flag] logical, intent(in) :: itaures ! Whether 'tauresx,tauresy' is updated in this subroutine. @@ -374,16 +334,29 @@ end function vd_lu_qdecomp ! ----------------------- ! errmsg = '' - if( ( diffuse(fieldlist,'u') .or. diffuse(fieldlist,'v') ) .and. .not. diffuse(fieldlist,'s') ) then - errmsg = 'diffusion_solver.compute_vdiff: must diffuse s if diffusing u or v' - return + if( do_diffusion_u_v .and. (.not. do_diffusion_s) ) then + errmsg = 'compute_vdiff: must diffuse s if diffusing horizontal winds' + return end if + ! Check if logical array is of the expected size + if ( size(do_diffusion_const) .ne. ncnst ) then + write(errmsg,*) 'compute_vdiff: do_diffusion_const size ', size(do_diffusion_const), ' is not equal to ncnst ', ncnst + return + endif + + if ( size(do_molecular_diffusion_const) .ne. ncnst ) then + write(errmsg,*) 'compute_vdiff: do_molecular_diffusion_const size ', size(do_molecular_diffusion_const), ' is not equal to ncnst ', ncnst + return + endif + + + !--------------------------------------- ! ! Computation of Molecular Diffusivities ! !--------------------------------------- ! - ! Modification : Why 'kvq' is not changed by molecular diffusion ? + ! Modification : Why 'kvq' is not changed by molecular diffusion ? if( do_molec_diff ) then @@ -431,7 +404,7 @@ end function vd_lu_qdecomp end do end do - if( diffuse(fieldlist,'u') .or. diffuse(fieldlist,'v') ) then + if( do_diffusion_u_v ) then ! Compute the vertical upward differences of the input u,v for KE dissipation ! at each interface. @@ -692,16 +665,16 @@ end function vd_lu_qdecomp end if - end if ! End of diffuse horizontal momentum, diffuse(fieldlist,'u') routine + end if ! End of diffuse horizontal momentum routine !-------------------------- ! ! Diffuse Dry Static Energy ! !-------------------------- ! - ! Modification : In future, we should diffuse the fully conservative - ! moist static energy,not the dry static energy. + ! Modification : In future, we should diffuse the fully conservative + ! moist static energy,not the dry static energy. - if( diffuse(fieldlist,'s') ) then + if( do_diffusion_s ) then ! Add counter-gradient to input static energy profiles do k = 1, pver @@ -713,7 +686,7 @@ end function vd_lu_qdecomp ! Add the explicit surface fluxes to the lowest layer dse(:ncol,pver) = dse(:ncol,pver) + tmp1(:ncol) * shflx(:ncol) - ! Diffuse dry static energy + ! Diffuse dry static energy !--------------------------------------------------- ! Solve for temperature using thermal conductivity @@ -790,8 +763,8 @@ end function vd_lu_qdecomp ! Diffuse Water Vapor Tracers ! !---------------------------- ! - ! Modification : For aerosols, I need to use separate treatment - ! for aerosol mass and aerosol number. + ! Modification : For aerosols, I need to use separate treatment + ! for aerosol mass and aerosol number. ! Loop through constituents @@ -799,9 +772,7 @@ end function vd_lu_qdecomp coef_q_diff=kvq(:ncol,:)*dpidz_sq(:ncol,:)) do m = 1, ncnst - - if( diffuse(fieldlist,'q',m) ) then - + if( do_diffusion_const(m) ) then ! Add the nonlocal transport terms to constituents in the PBL. ! Check for neg q's in each constituent and put the original vertical ! profile back if a neg value is found. A neg value implies that the @@ -821,16 +792,15 @@ end function vd_lu_qdecomp q(:ncol,k,m) = merge( q(:ncol,k,m), qtm(:ncol,k), lqtst(:ncol) ) end do - ! Add the explicit surface fluxes to the lowest layer - - q(:ncol,pver,m) = q(:ncol,pver,m) + tmp1(:ncol) * cflx(:ncol,m) - - ! Diffuse constituents. + ! Add the explicit surface fluxes to the lowest layer + q(:ncol,pver,m) = q(:ncol,pver,m) + tmp1(:ncol) * cflx(:ncol,m) - ! This is for solving molecular diffusion of minor species, thus, for WACCM-X, bypass O and O2 (major species) - ! Major species diffusion is calculated separately. -Hanli Liu + if( do_molec_diff ) then + ! do molecular diffusion - if( do_molec_diff .and. diffuse(fieldlistm,'q',m)) then + ! This is for solving molecular diffusion of minor species, thus, for WACCM-X, bypass O and O2 (major species) + ! Major species diffusion is calculated separately. -Hanli Liu + if( do_molecular_diffusion_const(m) ) then decomp = vd_lu_qdecomp( & ncol = ncol, & pver = pver, & @@ -853,37 +823,30 @@ end function vd_lu_qdecomp ! This to calculate the upper boundary flux of H. -Hanli Liu if ((cnst_fixed_ubflx(m))) then - ! ubc_flux is a flux of mass density through space, i.e.: ! ubc_flux = rho_i * dz/dt = q_i * rho * dz/dt ! For flux of mmr through pressure level, multiply by g: ! q_i * rho * gravit * dz/dt = q_i * dp/dt - call decomp%left_div(q(:ncol,:,m), & l_cond=BoundaryFlux( & -gravit*ubc_flux(:ncol,m), ztodt, & p%del(:,1))) - else call decomp%left_div(q(:ncol,:,m), & l_cond=BoundaryData(ubc_mmr(:ncol,m))) end if - call decomp%finalize() - - else - - if (present(cnst_fixed_ubc)) then - ! explicitly set mmr in top layer for cases where molecular diffusion is not active - if (cnst_fixed_ubc(m)) then - q(:ncol,1,m) = ubc_mmr(:ncol,m) - endif - end if - - call no_molec_decomp%left_div(q(:ncol,:,m)) - - end if - + endif + else + ! not doing molecular diffusion + if (present(cnst_fixed_ubc)) then + ! explicitly set mmr in top layer for cases where molecular diffusion is not active + if (cnst_fixed_ubc(m)) then + q(:ncol,1,m) = ubc_mmr(:ncol,m) + endif + end if + call no_molec_decomp%left_div(q(:ncol,:,m)) + end if end if end do @@ -891,82 +854,4 @@ end function vd_lu_qdecomp end subroutine compute_vdiff - ! =============================================================================== ! - ! ! - ! =============================================================================== ! - - character(128) function vdiff_select( fieldlist, name, qindex ) - ! --------------------------------------------------------------------- ! - ! This function sets the field with incoming name as one to be diffused ! - ! --------------------------------------------------------------------- ! - type(vdiff_selector), intent(inout) :: fieldlist - character(*), intent(in) :: name - integer, intent(in), optional :: qindex - - vdiff_select = '' - select case (name) - case ('u','U') - fieldlist%fields(1) = .true. - case ('v','V') - fieldlist%fields(2) = .true. - case ('s','S') - fieldlist%fields(3) = .true. - case ('q','Q') - if( present(qindex) ) then - fieldlist%fields(3 + qindex) = .true. - else - fieldlist%fields(4) = .true. - endif - case default - write(vdiff_select,*) 'Bad argument to vdiff_index: ', name - end select - return - - end function vdiff_select - - type(vdiff_selector) function not(a) - ! ------------------------------------------------------------- ! - ! This function extends .not. to operate on type vdiff_selector ! - ! ------------------------------------------------------------- ! - type(vdiff_selector), intent(in) :: a - allocate(not%fields(size(a%fields))) - not%fields = .not. a%fields - end function not - - logical function my_any(a) - ! -------------------------------------------------- ! - ! This function extends the intrinsic function 'any' ! - ! to operate on type vdiff_selector ! - ! -------------------------------------------------- ! - type(vdiff_selector), intent(in) :: a - my_any = any(a%fields) - end function my_any - - logical function diffuse(fieldlist,name,qindex) - ! ---------------------------------------------------------------------------- ! - ! This function reports whether the field with incoming name is to be diffused ! - ! ---------------------------------------------------------------------------- ! - type(vdiff_selector), intent(in) :: fieldlist - character(*), intent(in) :: name - integer, intent(in), optional :: qindex - - select case (name) - case ('u','U') - diffuse = fieldlist%fields(1) - case ('v','V') - diffuse = fieldlist%fields(2) - case ('s','S') - diffuse = fieldlist%fields(3) - case ('q','Q') - if( present(qindex) ) then - diffuse = fieldlist%fields(3 + qindex) - else - diffuse = fieldlist%fields(4) - endif - case default - diffuse = .false. - end select - return - end function diffuse - end module diffusion_solver diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index 06bd624f1b..30d18e659f 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -5,7 +5,6 @@ module eddy_diff_cam use cam_logfile, only: iulog use cam_abortutils, only: endrun use physconst, only: gravit, cpair, rair, zvir, latvap, latice, karman -use diffusion_solver, only: vdiff_selector use eddy_diff, only: ncvmax use time_manager, only: is_first_step use physics_buffer, only: physics_buffer_desc @@ -27,10 +26,9 @@ module eddy_diff_cam integer, parameter :: nturb = 5 ! Logical switches for moist mixing ratio diffusion -type(vdiff_selector) :: fieldlist_wet -! Logical switches for molecular diffusion -! (Molecular diffusion is not done here.) -type(vdiff_selector) :: fieldlist_molec +! (molecular diffusion is not done here) +logical :: do_diffusion_const_wet(1) +logical :: do_molecular_diffusion_const(1) integer :: ntop_eddy, nbot_eddy @@ -152,7 +150,6 @@ subroutine eddy_diff_init(pbuf2d, ntop_eddy_in, nbot_eddy_in) use cam_history, only: addfld, add_default, horiz_only use constituents, only: cnst_get_ind use ref_pres, only: pref_mid - use diffusion_solver, only: new_fieldlist_vdiff, vdiff_select use eddy_diff, only: init_eddy_diff use physics_buffer, only: pbuf_set_field, pbuf_get_index @@ -200,18 +197,10 @@ subroutine eddy_diff_init(pbuf2d, ntop_eddy_in, nbot_eddy_in) end do ml2(nbot_eddy+1:pver+1) = 0._r8 - ! Get fieldlists to pass to diffusion solver. - fieldlist_wet = new_fieldlist_vdiff(1) - fieldlist_molec = new_fieldlist_vdiff(1) - - call handle_errmsg(vdiff_select(fieldlist_wet,'s'), & - subname="vdiff_select") - call handle_errmsg(vdiff_select(fieldlist_wet,'q',1), & - subname="vdiff_select") - call handle_errmsg(vdiff_select(fieldlist_wet,'u'), & - subname="vdiff_select") - call handle_errmsg(vdiff_select(fieldlist_wet,'v'), & - subname="vdiff_select") + ! Only diffuse constituent 1 and disable molecular diffusion + do_diffusion_const_wet(:) = .false. + do_molecular_diffusion_const(:) = .false. + do_diffusion_const_wet(1) = .true. ! Cloud mass constituents call cnst_get_ind('CLDLIQ', ixcldliq) @@ -801,52 +790,54 @@ subroutine compute_eddy_diff( pbuf, lchnk , ! Diffuse initial profile of each time step using a given (kvh_out,kvm_out) ! In the below 'compute_vdiff', (slfd,qtfd,ufd,vfd) are 'inout' variables. call compute_vdiff( & - ncol = ncol, & - pver = pver, & - pverp = pverp, & - ncnst = 1, & - ztodt = ztodt, & - fieldlist = fieldlist_wet, & - fieldlistm = fieldlist_molec, & - itaures = .false., & - t = t(:ncol,:pver), & - tint = tint(:ncol,:pverp), & - p = p, & - rhoi = rhoi(:ncol,:pverp), & - taux = taux(:ncol), & - tauy = tauy(:ncol), & - shflx = shflx(:ncol), & - cflx = qflx(:ncol,:1), & ! ncnst = 1 - dse_top = zero, & - kvh = kvh_out(:ncol,:pverp), & - kvm = kvm_out(:ncol,:pverp), & - kvq = kvh_out(:ncol,:pverp), & ! [sic] kvh_out is assigned to kvh, kvq - cgs = cgs(:ncol,:pverp), & - cgh = cgh(:ncol,:pverp), & - ksrftms = ksrftms(:ncol), & - dragblj = dragblj(:ncol,:pver), & - qmincg = zero, & - ! input/output - u = ufd(:ncol,:pver), & - v = vfd(:ncol,:pver), & - q = qtfd(:ncol,:pver,:1), & ! ncnst = 1 - dse = slfd(:ncol,:pver), & - tauresx = tauresx(:ncol), & - tauresy = tauresy(:ncol), & - ! below output - dtk = jnk2d(:ncol,:pver), & - tautmsx = jnk1d(:ncol), & - tautmsy = jnk1d(:ncol), & - topflx = jnk1d(:ncol), & - errmsg = errstring, & - ! arguments for Beljaars - do_beljaars = do_beljaars, & - ! arguments for molecular diffusion only. - do_molec_diff = .false., & - use_temperature_molec_diff = .false., & - cpairv = cpairv(:ncol,:,lchnk), & - rairv = rairv(:ncol,:,lchnk), & - mbarv = mbarv(:ncol,:,lchnk)) + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ncnst = 1, & + ztodt = ztodt, & + do_diffusion_u_v= .true., & ! horizontal winds and + do_diffusion_s = .true., & ! dry static energy are diffused + do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituent + do_molecular_diffusion_const = do_molecular_diffusion_const, & + itaures = .false., & + t = t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p, & + rhoi = rhoi(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflx(:ncol), & + cflx = qflx(:ncol,:1), & ! ncnst = 1 + dse_top = zero, & + kvh = kvh_out(:ncol,:pverp), & + kvm = kvm_out(:ncol,:pverp), & + kvq = kvh_out(:ncol,:pverp), & ! [sic] kvh_out is assigned to kvh, kvq + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = zero, & + ! input/output + u = ufd(:ncol,:pver), & + v = vfd(:ncol,:pver), & + q = qtfd(:ncol,:pver,:1), & ! ncnst = 1 + dse = slfd(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = jnk2d(:ncol,:pver), & + tautmsx = jnk1d(:ncol), & + tautmsy = jnk1d(:ncol), & + topflx = jnk1d(:ncol), & + errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & + ! arguments for molecular diffusion only. + do_molec_diff = .false., & + use_temperature_molec_diff = .false., & + cpairv = cpairv(:ncol,:,lchnk), & + rairv = rairv(:ncol,:,lchnk), & + mbarv = mbarv(:ncol,:,lchnk)) call handle_errmsg(errstring, subname="compute_vdiff", & extra_msg="compute_vdiff called from eddy_diff_cam") diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 791b013670..7bae9848e8 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -53,7 +53,6 @@ module vertical_diffusion use shr_kind_mod, only : r8 => shr_kind_r8 use ppgrid, only : pcols, pver, pverp use constituents, only : pcnst -use diffusion_solver, only : vdiff_selector use cam_abortutils, only : endrun use error_messages, only : handle_errmsg use physconst, only : & @@ -100,9 +99,12 @@ module vertical_diffusion character(len=16) :: shallow_scheme ! Shallow convection scheme -type(vdiff_selector) :: fieldlist_wet ! Logical switches for moist mixing ratio diffusion -type(vdiff_selector) :: fieldlist_dry ! Logical switches for dry mixing ratio diffusion -type(vdiff_selector) :: fieldlist_molec ! Logical switches for molecular diffusion +logical :: do_diffusion_const_dry(pcnst)! Do vertical diffusion (as dry) for this constituent? +logical :: do_diffusion_const_wet(pcnst)! Do vertical diffusion (as wet) for this constituent? +logical :: do_molecular_diffusion_const(pcnst) ! Do molecular diffusion for this constituent? + ! In compute_vdiff, both do_diffusion_const and molecular_diffusion_const + ! have to be true for molec diff to happen + integer :: tke_idx, kvh_idx, kvm_idx ! TKE and eddy diffusivity indices for fields in the physics buffer integer :: kvt_idx ! Index for kinematic molecular conductivity integer :: tauresx_idx, tauresy_idx ! Redisual stress for implicit surface stress @@ -265,7 +267,7 @@ subroutine vertical_diffusion_init(pbuf2d) use eddy_diff_cam, only : eddy_diff_init use holtslag_boville_diff, only : holtslag_boville_diff_init use molec_diff, only : init_molec_diff - use diffusion_solver, only : init_vdiff, new_fieldlist_vdiff, vdiff_select + use diffusion_solver, only : init_vdiff use constituents, only : cnst_get_ind, cnst_get_type_byind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed use spmd_utils, only : masterproc use ref_pres, only : press_lim_idx, pref_mid @@ -358,7 +360,6 @@ subroutine vertical_diffusion_init(pbuf2d) call cnst_get_ind( 'Q', ixq ) ! water vapor index in const array. ! Initialize upper boundary condition module - call ubc_init() ! ---------------------------------------------------------------------------------------- ! @@ -464,33 +465,27 @@ subroutine vertical_diffusion_init(pbuf2d) call init_vdiff(r8, iulog, rair, cpair, gravit, do_iss, fv_am_correction, errstring) call handle_errmsg(errstring, subname="init_vdiff") - ! Use fieldlist_wet to select the fields which will be diffused using moist mixing ratios ( all by default ) - ! Use fieldlist_dry to select the fields which will be diffused using dry mixing ratios. - - fieldlist_wet = new_fieldlist_vdiff( pcnst) - fieldlist_dry = new_fieldlist_vdiff( pcnst) - fieldlist_molec = new_fieldlist_vdiff( pcnst) - - if( vdiff_select( fieldlist_wet, 'u' ) .ne. '' ) call endrun( vdiff_select( fieldlist_wet, 'u' ) ) - if( vdiff_select( fieldlist_wet, 'v' ) .ne. '' ) call endrun( vdiff_select( fieldlist_wet, 'v' ) ) - if( vdiff_select( fieldlist_wet, 's' ) .ne. '' ) call endrun( vdiff_select( fieldlist_wet, 's' ) ) + ! Set which fields will be diffused using dry or moist mixing ratios. + ! All fields are diffused using moist mixing ratios by default. + do_diffusion_const_dry(:) = .false. + do_diffusion_const_wet(:) = .false. + do_molecular_diffusion_const(:) = .false. - constit_loop: do k = 1, pcnst + const_loop: do k = 1, pcnst + ! If constituent is treated in dropmixnuc (vertically mixed by ndrop activation process) + ! then do not handle vertical diffusion in this module. + if (cnst_ndropmixed(k)) then + cycle const_loop + endif - ! Do not diffuse tracer -- treated in dropmixnuc - if (cnst_ndropmixed(k)) cycle constit_loop - - ! Convert all constituents to wet before doing diffusion. - if( vdiff_select( fieldlist_wet, 'q', k ) .ne. '' ) call endrun( vdiff_select( fieldlist_wet, 'q', k ) ) - - ! ----------------------------------------------- ! - ! Select constituents for molecular diffusion ! - ! ----------------------------------------------- ! - if ( cnst_get_molec_byind(k) .eq. 'minor' ) then - if( vdiff_select(fieldlist_molec,'q',k) .ne. '' ) call endrun( vdiff_select( fieldlist_molec,'q',k ) ) - endif + ! Convert all constituents to wet before doing diffusion. + do_diffusion_const_wet(k) = .true. - end do constit_loop + ! Select constituents for molecular diffusion + if (cnst_get_molec_byind(k) .eq. 'minor') then + do_molecular_diffusion_const(k) = .true. + endif + end do const_loop ! ------------------------ ! ! Diagnostic output fields ! @@ -709,7 +704,7 @@ subroutine vertical_diffusion_tend( & use wv_saturation, only : qsat use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type - use diffusion_solver, only : compute_vdiff, any, operator(.not.) + use diffusion_solver, only : compute_vdiff use air_composition, only : cpairv, rairv !Needed for calculation of upward H flux use air_composition, only : mbarv use time_manager, only : get_nstep @@ -1354,7 +1349,7 @@ subroutine vertical_diffusion_tend( & cflux = cam_in%cflx end select - if( any(fieldlist_wet) ) then + if( any(do_diffusion_const_wet) ) then if (do_molec_diff) then call compute_molec_diff(state%lchnk, pcols, pver, pcnst, ncol, & @@ -1368,8 +1363,10 @@ subroutine vertical_diffusion_tend( & pverp = pverp, & ncnst = pcnst, & ztodt = ztodt, & - fieldlist = fieldlist_wet, & - fieldlistm = fieldlist_molec, & + do_diffusion_u_v= .true., & ! horizontal winds and + do_diffusion_s = .true., & ! dry static energy are diffused + do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. + do_molecular_diffusion_const = do_molecular_diffusion_const, & itaures = .true., & t = state%t(:ncol,:pver), & tint = tint(:ncol,:pverp), & @@ -1426,7 +1423,7 @@ subroutine vertical_diffusion_tend( & end if - if( any( fieldlist_dry ) ) then + if( any( do_diffusion_const_dry ) ) then if( do_molec_diff ) then ! kvm is unused in the output here (since it was assigned @@ -1444,8 +1441,10 @@ subroutine vertical_diffusion_tend( & pverp = pverp, & ncnst = pcnst, & ztodt = ztodt, & - fieldlist = fieldlist_dry, & - fieldlistm = fieldlist_molec, & + do_diffusion_u_v= .false., & + do_diffusion_s = .false., & + do_diffusion_const = do_diffusion_const_dry, & + do_molecular_diffusion_const = do_molecular_diffusion_const, & itaures = .true., & t = state%t(:ncol,:pver), & tint = tint(:ncol,:pverp), & From 9f896a5d0cd86d2b0bf1a6bb25d048d36f4cdfd9 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 19 May 2025 10:31:57 -0600 Subject: [PATCH 187/466] update pio reader and rad interface --- .gitmodules | 2 +- src/physics/rrtmgp/radiation.F90 | 28 ++++++++++++++++++++-------- src/utils/cam_ccpp/pio_reader.F90 | 4 ++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2a027bd9a3..398fad0e1e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 90ffd79eb8410cd5387e86e0ef01f9306de8998c + fxtag = 4e628d799238600cc0385d724e6d639f3e9dd9c3 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 48dd6dd0d5..bf6f9568ec 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -416,6 +416,7 @@ subroutine radiation_init(pbuf2d) use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init + use rrtmgp_sw_gas_optics_data, only: rrtmgp_sw_gas_optics_data_init ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -462,9 +463,20 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': '//errmsg) end if + call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & + g_mu, g_lambda, g_d_eff, tiny) + + call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & + abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & + g_d_eff, tiny, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if + ! Read RRTMGP coefficients files and initialize kdist objects. call coefs_init(coefs_sw_file, available_gases, kdist_sw) call rrtmgp_lw_gas_optics_data_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) + call rrtmgp_sw_gas_optics_data_init(kdist_sw, coefs_sw_file, available_gases, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if @@ -492,15 +504,15 @@ subroutine radiation_init(pbuf2d) ! initialize output fields for offline driver call rad_data_init(pbuf2d) - call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & - g_mu, g_lambda, g_d_eff, tiny) +! call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & +! g_mu, g_lambda, g_d_eff, tiny) - call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & - abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & - g_d_eff, tiny, errmsg, errflg) - if (errflg /= 0) then - call endrun(sub//': '//errmsg) - end if +! call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & +! abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & +! g_d_eff, tiny, errmsg, errflg) +! if (errflg /= 0) then +! call endrun(sub//': '//errmsg) +! end if cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW', errcode=ierr) diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 index b0fcf4cee9..113e2d2217 100644 --- a/src/utils/cam_ccpp/pio_reader.F90 +++ b/src/utils/cam_ccpp/pio_reader.F90 @@ -55,7 +55,7 @@ module pio_reader contains subroutine open_netcdf_file(this, file_path, errmsg, errcode) - use ioFileMod, only: cam_get_file + use ioFileMod, only: getfil use cam_pio_utils, only: cam_pio_openfile use pio, only: PIO_NOWRITE @@ -78,7 +78,7 @@ subroutine open_netcdf_file(this, file_path, errmsg, errcode) return end if - call cam_get_file(file_path, local_file_path) + call getfil(file_path, local_file_path) call cam_pio_openfile(this%sima_pio_fh%pio_fh, local_file_path, PIO_NOWRITE) !Set file handle metadata From 88a37fbd7ff523d48d1bfd592789b347bce9c289 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Tue, 20 May 2025 10:41:39 -0600 Subject: [PATCH 188/466] fixes for pio reader --- src/physics/rrtmgp/radiation.F90 | 87 ++++++++------ src/utils/cam_ccpp/pio_reader.F90 | 191 ++++++++++++++++-------------- 2 files changed, 151 insertions(+), 127 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index bf6f9568ec..258d378499 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -415,8 +415,8 @@ subroutine radiation_init(pbuf2d) use rrtmgp_inputs, only: rrtmgp_inputs_init use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init - use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init - use rrtmgp_sw_gas_optics_data, only: rrtmgp_sw_gas_optics_data_init +! use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init +! use rrtmgp_sw_gas_optics_data, only: rrtmgp_sw_gas_optics_data_init ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -463,23 +463,30 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': '//errmsg) end if - call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & - g_mu, g_lambda, g_d_eff, tiny) +! call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & +! g_mu, g_lambda, g_d_eff, tiny) +! +! call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & +! abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & +! g_d_eff, tiny, errmsg, errflg) +! if (errflg /= 0) then +! call endrun(sub//': '//errmsg) +! end if - call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & - abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & - g_d_eff, tiny, errmsg, errflg) - if (errflg /= 0) then - call endrun(sub//': '//errmsg) - end if +! write(iulog,*) 'peverwhee - reading in data from file!' ! Read RRTMGP coefficients files and initialize kdist objects. +! call rrtmgp_lw_gas_optics_data_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) +! if (errflg /= 0) then +! call endrun(sub//': lw '//errmsg) +! end if +! call rrtmgp_sw_gas_optics_data_init(kdist_sw, coefs_sw_file, available_gases, errmsg, errflg) +! if (errflg /= 0) then +! call endrun(sub//': sw '//errmsg) +! end if +! write(iulog,*) 'peverwhee - done reading in data from file!' call coefs_init(coefs_sw_file, available_gases, kdist_sw) - call rrtmgp_lw_gas_optics_data_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) - call rrtmgp_sw_gas_optics_data_init(kdist_sw, coefs_sw_file, available_gases, errmsg, errflg) - if (errflg /= 0) then - call endrun(sub//': '//errmsg) - end if + call coefs_init(coefs_lw_file, available_gases, kdist_lw) ! Set up inputs to RRTMGP call rrtmgp_inputs_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & @@ -504,15 +511,14 @@ subroutine radiation_init(pbuf2d) ! initialize output fields for offline driver call rad_data_init(pbuf2d) -! call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & -! g_mu, g_lambda, g_d_eff, tiny) - -! call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & -! abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & -! g_d_eff, tiny, errmsg, errflg) -! if (errflg /= 0) then -! call endrun(sub//': '//errmsg) -! end if + call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & + g_mu, g_lambda, g_d_eff, tiny) + call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & + abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & + g_d_eff, tiny, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW', errcode=ierr) @@ -2315,21 +2321,24 @@ subroutine coefs_init(coefs_file, available_gases, kdist) ! Initialize the gas optics object with data. The calls are slightly different depending ! on whether the radiation sources are internal to the atmosphere (longwave) or external (shortwave) - !if (allocated(totplnk) .and. allocated(planck_frac)) then - ! call rrtmgp_lw_gas_optics_data_init(kdist, available_gases, gas_names, & - ! key_species, band2gpt, band_lims_wavenum, press_ref, press_ref_trop, & - ! temp_ref, temp_ref_p, temp_ref_t, vmr_ref, kmajor, kminor_lower, & - ! kminor_upper, gas_minor, identifier_minor, minor_gases_lower, & - ! minor_gases_upper, minor_limits_gpt_lower, minor_limits_gpt_upper, & - ! minor_scales_with_density_lower, minor_scales_with_density_upper, & - ! scaling_gas_lower, scaling_gas_upper, scale_by_complement_lower, & - ! scale_by_complement_upper, kminor_start_lower, kminor_start_upper, & - ! totplnk, planck_frac, rayl_lower, rayl_upper, optimal_angle_fit, & - ! errmsg, ierr) - ! if (ierr /= 0) then - ! call endrun(sub//': '//errmsg) - ! end if - if (allocated(solar_src_quiet)) then + if (allocated(totplnk) .and. allocated(planck_frac)) then + error_msg = kdist%gas_props%load( & + available_gases%gas_concs, gas_names, key_species, & + band2gpt, band_lims_wavenum, & + press_ref, press_ref_trop, temp_ref, & + temp_ref_p, temp_ref_t, vmr_ref, & + kmajor, kminor_lower, kminor_upper, & + gas_minor, identifier_minor, & + minor_gases_lower, minor_gases_upper, & + minor_limits_gpt_lower, minor_limits_gpt_upper, & + minor_scales_with_density_lower, & + minor_scales_with_density_upper, & + scaling_gas_lower, scaling_gas_upper, & + scale_by_complement_lower, scale_by_complement_upper, & + kminor_start_lower, kminor_start_upper, & + totplnk, planck_frac, rayl_lower, rayl_upper, & + optimal_angle_fit) + else if (allocated(solar_src_quiet)) then error_msg = kdist%gas_props%load( & available_gases%gas_concs, gas_names, key_species, & band2gpt, band_lims_wavenum, & diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 index 113e2d2217..c3e4a38732 100644 --- a/src/utils/cam_ccpp/pio_reader.F90 +++ b/src/utils/cam_ccpp/pio_reader.F90 @@ -167,7 +167,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -178,7 +178,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -198,12 +198,18 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: + allocate(var, stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if var = huge(1) errcode = pio_get_var(pio_file_handle, var_id, var) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -265,7 +271,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -276,7 +282,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -307,7 +313,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -327,7 +333,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -348,7 +354,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -410,7 +416,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -421,7 +427,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -452,7 +458,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -472,7 +478,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -493,7 +499,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -555,7 +561,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -566,7 +572,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -597,7 +603,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -617,7 +623,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -638,7 +644,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -700,7 +706,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -711,7 +717,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -742,7 +748,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -762,7 +768,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -783,7 +789,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -845,7 +851,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -856,7 +862,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -887,7 +893,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -907,7 +913,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -929,7 +935,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -995,7 +1001,7 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1006,7 +1012,7 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1026,12 +1032,18 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: + allocate(var, stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + !Reset PIO back to original error handling method: + call pio_seterrorhandling(pio_file_handle, err_handling) + return + end if var = huge(1._kind_phys) errcode = pio_get_var(pio_file_handle, var_id, var) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1093,7 +1105,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1104,7 +1116,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1135,7 +1147,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1155,7 +1167,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1176,7 +1188,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1238,7 +1250,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1249,7 +1261,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1280,7 +1292,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1300,7 +1312,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1321,7 +1333,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1383,7 +1395,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1394,7 +1406,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1425,7 +1437,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1445,7 +1457,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1466,7 +1478,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1528,7 +1540,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1539,7 +1551,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1570,7 +1582,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1590,7 +1602,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1611,7 +1623,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1673,7 +1685,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1684,7 +1696,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1715,7 +1727,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1735,7 +1747,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1757,7 +1769,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1823,7 +1835,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1834,7 +1846,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1883,7 +1895,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1903,7 +1915,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1926,7 +1938,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1988,7 +2000,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -1999,7 +2011,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2048,7 +2060,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2068,7 +2080,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2091,7 +2103,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2153,7 +2165,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2164,7 +2176,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2213,7 +2225,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2233,7 +2245,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2256,7 +2268,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2318,7 +2330,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2329,7 +2341,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2378,7 +2390,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2398,7 +2410,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2421,7 +2433,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2483,7 +2495,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2494,7 +2506,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2543,7 +2555,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2563,7 +2575,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2587,7 +2599,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2649,7 +2661,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_varid(pio_file_handle, varname, var_id) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2660,7 +2672,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2709,7 +2721,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2729,7 +2741,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) if(errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, errcode, errmsg) + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2753,7 +2765,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) if (errcode /= PIO_NOERR) then !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, errcode, errmsg) + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) @@ -2769,7 +2781,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_5d - subroutine get_pio_errmsg(caller_errcode, errcode, errmsg) + subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg) !Set error message based off PIO error code, !and then reset PIO error code to caller-specified !error code. @@ -2784,13 +2796,16 @@ subroutine get_pio_errmsg(caller_errcode, errcode, errmsg) !Input/output arguments: integer, intent(in) :: caller_errcode !New error code caller wants. + character(len=*), intent(in) :: varname integer, intent(inout) :: errcode !Error code character(len=*), intent(inout) :: errmsg !Error message !Local variables: integer :: strerr !Error code returned if pio_strerror fails + character(len=256) :: pio_error - strerr = pio_strerror(errcode, errmsg) + strerr = pio_strerror(errcode, pio_error) + write(errmsg, '(a,a,a,a)') 'Error for variable "', varname, '" - message: ', pio_error if(strerr /= PIO_NOERR) then write(errmsg, *) "Failed to get error message for PIO code: ", errcode errcode = pio_get_msg_err From d2500cb585953c093607b6a4659e1de40fd6ccce Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 20 May 2025 17:44:13 -0400 Subject: [PATCH 189/466] Add comments --- src/physics/cam/diffusion_solver.F90 | 6 +----- src/physics/cam/vertical_diffusion.F90 | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index 226ddf6aa2..f9ba1ab631 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -113,10 +113,6 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & ! obtained from the turbulence module. ! !-------------------------------------------------------------------------- ! - ! Used for CAM debugging. - ! use phys_debug_util, only : phys_debug_col - ! use time_manager, only : is_first_step, get_nstep - use coords_1d, only: Coords1D use linear_1d_operators, only : BoundaryType, BoundaryFixedLayer, & BoundaryData, BoundaryFlux, TriDiagDecomp @@ -160,6 +156,7 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & real(r8), intent(in) :: kvq(:,:) ! Eddy diffusivity for constituents, interfaces real(r8), intent(in) :: cgs(:,:) ! Counter-gradient star [ cg/flux ], interfaces real(r8), intent(in) :: cgh(:,:) ! Counter-gradient term for heat, interfaces + real(r8), intent(in) :: rairv(:,:) ! Composition dependent gas "constant" ! Input-Output Arguments real(r8), intent(inout) :: u(:,:) ! U wind. This input is the 'raw' input wind to @@ -191,7 +188,6 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & logical, intent(in) :: use_temperature_molec_diff! Flag indicating that molecular diffusion should apply to temperature, not ! dry static energy. real(r8), intent(in) :: cpairv(:,:) ! Specific heat at constant pressure - real(r8), intent(in) :: rairv(:,:) ! Composition dependent gas "constant" real(r8), intent(in) :: mbarv(:,:) ! Composition dependent atmosphere mean mass ! The molecular diffusion module will likely change significantly in diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 7bae9848e8..5e2c957696 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1471,10 +1471,10 @@ subroutine vertical_diffusion_tend( & tauresx = tauresx(:ncol), & tauresy = tauresy(:ncol), & ! below output - dtk = dtk_temp(:ncol,:), & - tautmsx = tautmsx_temp(:ncol), & - tautmsy = tautmsy_temp(:ncol), & - topflx = topflx_temp(:ncol), & + dtk = dtk_temp(:ncol,:), & ! unused dummy + tautmsx = tautmsx_temp(:ncol), & ! unused dummy + tautmsy = tautmsy_temp(:ncol), & ! unused dummy + topflx = topflx_temp(:ncol), & ! unused dummy errmsg = errstring, & ! arguments for Beljaars do_beljaars = do_beljaars, & From 3d1261e0ba76d8e43c5662e59ec948ff12ce4f8f Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 20 May 2025 22:22:47 -0400 Subject: [PATCH 190/466] Fix wxie sms test diff due to wrong if and clause --- src/physics/cam/diffusion_solver.F90 | 145 +++++++++++++-------------- 1 file changed, 72 insertions(+), 73 deletions(-) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index f9ba1ab631..3e4260b2cd 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -767,84 +767,83 @@ end function vd_lu_qdecomp no_molec_decomp = fin_vol_lu_decomp(ztodt, p, & coef_q_diff=kvq(:ncol,:)*dpidz_sq(:ncol,:)) - do m = 1, ncnst - if( do_diffusion_const(m) ) then - ! Add the nonlocal transport terms to constituents in the PBL. - ! Check for neg q's in each constituent and put the original vertical - ! profile back if a neg value is found. A neg value implies that the - ! quasi-equilibrium conditions assumed for the countergradient term are - ! strongly violated. - - qtm(:ncol,:pver) = q(:ncol,:pver,m) + const_diffuse_loop: do m = 1, ncnst + if( .not. do_diffusion_const(m) ) then + cycle const_diffuse_loop + endif - do k = 1, pver - q(:ncol,k,m) = q(:ncol,k,m) + & - ztodt * p%rdel(:,k) * gravit * ( cflx(:ncol,m) * rrho(:ncol) ) * & - ( rhoi(:ncol,k+1) * kvh(:ncol,k+1) * cgs(:ncol,k+1) & - - rhoi(:ncol,k ) * kvh(:ncol,k ) * cgs(:ncol,k ) ) - end do - lqtst(:ncol) = all(q(:ncol,1:pver,m) >= qmincg(m), 2) - do k = 1, pver - q(:ncol,k,m) = merge( q(:ncol,k,m), qtm(:ncol,k), lqtst(:ncol) ) - end do + ! Add the nonlocal transport terms to constituents in the PBL. + ! Check for neg q's in each constituent and put the original vertical + ! profile back if a neg value is found. A neg value implies that the + ! quasi-equilibrium conditions assumed for the countergradient term are + ! strongly violated. + qtm(:ncol,:pver) = q(:ncol,:pver,m) - ! Add the explicit surface fluxes to the lowest layer - q(:ncol,pver,m) = q(:ncol,pver,m) + tmp1(:ncol) * cflx(:ncol,m) + do k = 1, pver + q(:ncol,k,m) = q(:ncol,k,m) + & + ztodt * p%rdel(:,k) * gravit * ( cflx(:ncol,m) * rrho(:ncol) ) * & + ( rhoi(:ncol,k+1) * kvh(:ncol,k+1) * cgs(:ncol,k+1) & + - rhoi(:ncol,k ) * kvh(:ncol,k ) * cgs(:ncol,k ) ) + end do + lqtst(:ncol) = all(q(:ncol,1:pver,m) >= qmincg(m), 2) + do k = 1, pver + q(:ncol,k,m) = merge( q(:ncol,k,m), qtm(:ncol,k), lqtst(:ncol) ) + end do - if( do_molec_diff ) then - ! do molecular diffusion - - ! This is for solving molecular diffusion of minor species, thus, for WACCM-X, bypass O and O2 (major species) - ! Major species diffusion is calculated separately. -Hanli Liu - if( do_molecular_diffusion_const(m) ) then - decomp = vd_lu_qdecomp( & - ncol = ncol, & - pver = pver, & - m = m, & ! constituent index - fixed_ubc = cnst_fixed_ubc(m), & - mw = cnst_mw(m), & - kv = kvq(:ncol,:), & ! eddy diffusivity at interfaces - kq_scal = kq_scal(:ncol,:), & ! molecular diffusivity at interfaces - mw_facm = mw_fac(:ncol,:,m), & ! composition dependent sqrt(1/M_q + 1/M_d), at interfaces, this constituent - dpidz_sq = dpidz_sq(:ncol,:), & ! square of vertical derivative of pint - p = p_molec, & - interface_boundary = interface_boundary, & - molec_boundary = molec_boundary, & - t = t(:ncol,:), & ! temperature, midpoints - tint = tint(:ncol,:), & ! temperature, interfaces - mbarv = mbarv(:ncol,:), & ! composition dependent atmosphere mean mass - ztodt = ztodt, & - nbot_molec = nbot_molec, & - no_molec_decomp = no_molec_decomp) - - ! This to calculate the upper boundary flux of H. -Hanli Liu - if ((cnst_fixed_ubflx(m))) then - ! ubc_flux is a flux of mass density through space, i.e.: - ! ubc_flux = rho_i * dz/dt = q_i * rho * dz/dt - ! For flux of mmr through pressure level, multiply by g: - ! q_i * rho * gravit * dz/dt = q_i * dp/dt - call decomp%left_div(q(:ncol,:,m), & - l_cond=BoundaryFlux( & - -gravit*ubc_flux(:ncol,m), ztodt, & - p%del(:,1))) - else - call decomp%left_div(q(:ncol,:,m), & - l_cond=BoundaryData(ubc_mmr(:ncol,m))) - end if - call decomp%finalize() + ! Add the explicit surface fluxes to the lowest layer + q(:ncol,pver,m) = q(:ncol,pver,m) + tmp1(:ncol) * cflx(:ncol,m) + + if( do_molec_diff .and. do_molecular_diffusion_const(m) ) then + ! do molecular diffusion + + ! This is for solving molecular diffusion of minor species, thus, for WACCM-X, bypass O and O2 (major species) + ! Major species diffusion is calculated separately. -Hanli Liu + decomp = vd_lu_qdecomp( & + ncol = ncol, & + pver = pver, & + m = m, & ! constituent index + fixed_ubc = cnst_fixed_ubc(m), & + mw = cnst_mw(m), & + kv = kvq(:ncol,:), & ! eddy diffusivity at interfaces + kq_scal = kq_scal(:ncol,:), & ! molecular diffusivity at interfaces + mw_facm = mw_fac(:ncol,:,m), & ! composition dependent sqrt(1/M_q + 1/M_d), at interfaces, this constituent + dpidz_sq = dpidz_sq(:ncol,:), & ! square of vertical derivative of pint + p = p_molec, & + interface_boundary = interface_boundary, & + molec_boundary = molec_boundary, & + t = t(:ncol,:), & ! temperature, midpoints + tint = tint(:ncol,:), & ! temperature, interfaces + mbarv = mbarv(:ncol,:), & ! composition dependent atmosphere mean mass + ztodt = ztodt, & + nbot_molec = nbot_molec, & + no_molec_decomp = no_molec_decomp) + + ! This to calculate the upper boundary flux of H. -Hanli Liu + if ((cnst_fixed_ubflx(m))) then + ! ubc_flux is a flux of mass density through space, i.e.: + ! ubc_flux = rho_i * dz/dt = q_i * rho * dz/dt + ! For flux of mmr through pressure level, multiply by g: + ! q_i * rho * gravit * dz/dt = q_i * dp/dt + call decomp%left_div(q(:ncol,:,m), & + l_cond=BoundaryFlux( & + -gravit*ubc_flux(:ncol,m), ztodt, & + p%del(:,1))) + else + call decomp%left_div(q(:ncol,:,m), & + l_cond=BoundaryData(ubc_mmr(:ncol,m))) + end if + call decomp%finalize() + else + ! not doing molecular diffusion + if (present(cnst_fixed_ubc)) then + ! explicitly set mmr in top layer for cases where molecular diffusion is not active + if (cnst_fixed_ubc(m)) then + q(:ncol,1,m) = ubc_mmr(:ncol,m) endif - else - ! not doing molecular diffusion - if (present(cnst_fixed_ubc)) then - ! explicitly set mmr in top layer for cases where molecular diffusion is not active - if (cnst_fixed_ubc(m)) then - q(:ncol,1,m) = ubc_mmr(:ncol,m) - endif - end if - call no_molec_decomp%left_div(q(:ncol,:,m)) - end if + end if + call no_molec_decomp%left_div(q(:ncol,:,m)) end if - end do + end do const_diffuse_loop call no_molec_decomp%finalize() From 75005d6a5c0065137b38df3b7ab691789b9b3e26 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 22 May 2025 11:20:53 -0400 Subject: [PATCH 191/466] Move diffusion solver for non-WACCM to atmos_phys --- bld/configure | 2 +- ...on_solver.F90 => diffusion_solver_cam.F90} | 14 +- src/physics/cam/eddy_diff_cam.F90 | 2 +- src/physics/cam/vertical_diffusion.F90 | 694 ++++++++++-------- 4 files changed, 410 insertions(+), 302 deletions(-) rename src/physics/cam/{diffusion_solver.F90 => diffusion_solver_cam.F90} (98%) diff --git a/bld/configure b/bld/configure index 7bdcf0923c..3dc20ad988 100755 --- a/bld/configure +++ b/bld/configure @@ -2180,8 +2180,8 @@ sub write_filepath print $fh "$camsrcdir/src/atmos_phys/schemes/rasch_kristjansson\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/utilities\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/rayleigh_friction\n"; - print $fh "$camsrcdir/src/atmos_phys/schemes/cloud_fraction\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/vertical_diffusion\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/holtslag_boville\n"; # Dynamics package and test utilities diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver_cam.F90 similarity index 98% rename from src/physics/cam/diffusion_solver.F90 rename to src/physics/cam/diffusion_solver_cam.F90 index 3e4260b2cd..63bbacfdc6 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver_cam.F90 @@ -1,5 +1,5 @@ - module diffusion_solver + module diffusion_solver_cam !------------------------------------------------------------------------------------ ! ! Module to solve vertical diffusion equations using a tri-diagonal solver. ! @@ -41,14 +41,6 @@ module diffusion_solver real(r8), private :: rair ! Gas constant for dry air logical, private :: do_iss ! Use implicit turbulent surface stress computation - - ! Parameters used for Turbulent Mountain Stress - - real(r8), parameter :: z0fac = 0.025_r8 ! Factor determining z_0 from orographic standard deviation - real(r8), parameter :: z0max = 100._r8 ! Max value of z_0 for orography - real(r8), parameter :: horomin = 10._r8 ! Min value of subgrid orographic height for mountain stress - real(r8), parameter :: dv2min = 0.01_r8 ! Minimum shear squared - logical :: am_correction ! logical switch for AM correction contains @@ -346,8 +338,6 @@ end function vd_lu_qdecomp return endif - - !--------------------------------------- ! ! Computation of Molecular Diffusivities ! !--------------------------------------- ! @@ -849,4 +839,4 @@ end function vd_lu_qdecomp end subroutine compute_vdiff -end module diffusion_solver +end module diffusion_solver_cam diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index 30d18e659f..d0f69f7d9a 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -413,7 +413,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , ! May. 2008. ! !-------------------------------------------------------------------- ! - use diffusion_solver, only: compute_vdiff + use diffusion_solver_cam, only: compute_vdiff use cam_history, only: outfld use phys_debug_util, only: phys_debug_col use air_composition, only: cpairv, rairv, mbarv diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 5e2c957696..5e90d5e108 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -41,9 +41,6 @@ module vertical_diffusion ! than the current combined version, and possibly also remove the need to use the fieldlist ! ! object at all. ! ! ! -! - The conditionals controlled by "do_pbl_diags" are somewhat scattered. It might be better to ! -! pull out these diagnostic calculations and outfld calls into separate functions. ! -! ! !---------------------------Code history-------------------------------------------------------------- ! ! J. Rosinski : Jun. 1992 ! ! J. McCaa : Sep. 2004 ! @@ -93,6 +90,12 @@ module vertical_diffusion ! 'HB' = Holtslag and Boville (default) ! 'HBR' = Holtslag and Boville and Rash ! 'diag_TKE' = Bretherton and Park ( UW Moist Turbulence Scheme ) +! 'CLUBB_SGS'= CLUBB; +! in this case, this module will only be used for: +! 1) applying non-water vapor constituent indices; +! 2) applying HB scheme above CLUBB (when do_hb_above_clubb = .true.) +! many PBL diagnostics are suppressed in this module via the logical is_clubb_scheme = .true. +! logical, parameter :: wstarent = .true. ! Use wstar (.true.) or TKE (.false.) entrainment closure ! ( when 'diag_TKE' scheme is selected ) logical :: do_pseudocon_diff = .false. ! If .true., do pseudo-conservative variables diffusion @@ -135,7 +138,7 @@ module vertical_diffusion logical :: diff_cnsrv_mass_check ! do mass conservation check logical :: do_iss ! switch for implicit turbulent surface stress -logical :: do_pbl_diags = .false. +logical :: is_clubb_scheme = .false. logical :: waccmx_mode = .false. logical :: do_hb_above_clubb = .false. @@ -265,9 +268,12 @@ subroutine vertical_diffusion_init(pbuf2d) use cam_history, only : addfld, add_default, horiz_only use cam_history, only : register_vector_field use eddy_diff_cam, only : eddy_diff_init - use holtslag_boville_diff, only : holtslag_boville_diff_init + + use holtslag_boville_diff, only: holtslag_boville_diff_init + use diffusion_solver, only: vertical_diffusion_compute_init + use molec_diff, only : init_molec_diff - use diffusion_solver, only : init_vdiff + use diffusion_solver_cam, only : init_vdiff use constituents, only : cnst_get_ind, cnst_get_type_byind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed use spmd_utils, only : masterproc use ref_pres, only : press_lim_idx, pref_mid @@ -421,7 +427,7 @@ subroutine vertical_diffusion_init(pbuf2d) call addfld('HB_ri', (/ 'lev' /), 'A', 'no', 'Richardson Number (HB Scheme), I' ) case ( 'CLUBB_SGS' ) - do_pbl_diags = .true. + is_clubb_scheme = .true. call holtslag_boville_diff_init( & amIRoot = masterproc, & @@ -465,6 +471,13 @@ subroutine vertical_diffusion_init(pbuf2d) call init_vdiff(r8, iulog, rair, cpair, gravit, do_iss, fv_am_correction, errstring) call handle_errmsg(errstring, subname="init_vdiff") + ! Initialize CCPP-ized diffusion solver module + call vertical_diffusion_compute_init(& + do_iss_in = do_iss, & + am_correction_in = fv_am_correction, & + errmsg = errmsg, & + errflg = errflg) + ! Set which fields will be diffused using dry or moist mixing ratios. ! All fields are diffused using moist mixing ratios by default. do_diffusion_const_dry(:) = .false. @@ -497,7 +510,7 @@ subroutine vertical_diffusion_init(pbuf2d) call addfld( vdiffnam(k), (/ 'lev' /), 'A', 'kg/kg/s', 'Vertical diffusion of '//cnst_name(k) ) end do - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then call addfld( 'PBLH' , horiz_only , 'A', 'm' , 'PBL height' ) call addfld( 'QT' , (/ 'lev' /) , 'A', 'kg/kg' , 'Total water mixing ratio' ) call addfld( 'SL' , (/ 'lev' /) , 'A', 'J/kg' , 'Liquid water static energy' ) @@ -511,24 +524,8 @@ subroutine vertical_diffusion_init(pbuf2d) call addfld( 'UFLX' , (/ 'ilev' /) , 'A', 'W/m2' , 'Zonal momentum flux' ) call addfld( 'VFLX' , (/ 'ilev' /) , 'A', 'W/m2' , 'Meridional momentm flux' ) call register_vector_field('UFLX', 'VFLX') - end if - - call addfld( 'USTAR' , horiz_only , 'A', 'm/s' , 'Surface friction velocity' ) - call addfld( 'KVH' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion diffusivities (heat/moisture)' ) - call addfld( 'KVM' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion diffusivities (momentum)' ) - call addfld( 'KVT' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion kinematic molecular conductivity') - call addfld( 'CGS' , (/ 'ilev' /) , 'A', 's/m2' , 'Counter-gradient coeff on surface kinematic fluxes' ) - call addfld( 'DTVKE' , (/ 'lev' /) , 'A', 'K/s' , 'dT/dt vertical diffusion KE dissipation' ) - call addfld( 'DTV' , (/ 'lev' /) , 'A', 'K/s' , 'T vertical diffusion' ) - call addfld( 'DUV' , (/ 'lev' /) , 'A', 'm/s2' , 'U vertical diffusion' ) - call addfld( 'DVV' , (/ 'lev' /) , 'A', 'm/s2' , 'V vertical diffusion' ) - - ! ---------------------------------------------------------------------------- ! - ! Below ( with '_PBL') are for detailed analysis of UW Moist Turbulence Scheme ! - ! ---------------------------------------------------------------------------- ! - - if (.not. do_pbl_diags) then + ! For detailed analysis of UW moist turbulence scheme call addfld( 'qt_pre_PBL', (/ 'lev' /) , 'A', 'kg/kg' , 'qt_prePBL' ) call addfld( 'sl_pre_PBL', (/ 'lev' /) , 'A', 'J/kg' , 'sl_prePBL' ) call addfld( 'slv_pre_PBL', (/ 'lev' /) , 'A', 'J/kg' , 'slv_prePBL' ) @@ -570,9 +567,18 @@ subroutine vertical_diffusion_init(pbuf2d) call addfld( 'qiten_PBL', (/ 'lev' /) , 'A', 'kg/kg/s', 'qi tendency by PBL' ) call addfld( 'tten_PBL', (/ 'lev' /) , 'A', 'K/s' , 'T tendency by PBL' ) call addfld( 'rhten_PBL', (/ 'lev' /) , 'A', '%/s' , 'RH tendency by PBL' ) - end if + call addfld( 'USTAR' , horiz_only , 'A', 'm/s' , 'Surface friction velocity' ) + call addfld( 'KVH' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion diffusivities (heat/moisture)' ) + call addfld( 'KVM' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion diffusivities (momentum)' ) + call addfld( 'KVT' , (/ 'ilev' /) , 'A', 'm2/s' , 'Vertical diffusion kinematic molecular conductivity') + call addfld( 'CGS' , (/ 'ilev' /) , 'A', 's/m2' , 'Counter-gradient coeff on surface kinematic fluxes' ) + call addfld( 'DTVKE' , (/ 'lev' /) , 'A', 'K/s' , 'dT/dt vertical diffusion KE dissipation' ) + call addfld( 'DTV' , (/ 'lev' /) , 'A', 'K/s' , 'T vertical diffusion' ) + call addfld( 'DUV' , (/ 'lev' /) , 'A', 'm/s2' , 'U vertical diffusion' ) + call addfld( 'DVV' , (/ 'lev' /) , 'A', 'm/s2' , 'V vertical diffusion' ) + call addfld ('ustar',horiz_only, 'A', ' ',' ') call addfld ('obklen',horiz_only, 'A', ' ',' ') @@ -589,13 +595,13 @@ subroutine vertical_diffusion_init(pbuf2d) if (history_amwg) then call add_default( vdiffnam(1), 1, ' ' ) call add_default( 'DTV' , 1, ' ' ) - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then call add_default( 'PBLH' , 1, ' ' ) end if endif if (history_eddy) then - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then call add_default( 'UFLX ', 1, ' ' ) call add_default( 'VFLX ', 1, ' ' ) end if @@ -699,12 +705,20 @@ subroutine vertical_diffusion_tend( & use holtslag_boville_diff, only: hb_diff_exchange_coefficients_run ! CCPP-ized HB (free atmosphere) scheme - use holtslag_boville_diff, only : hb_diff_free_atm_exchange_coefficients_run + use holtslag_boville_diff, only: hb_diff_free_atm_exchange_coefficients_run + + ! CCPP-ized vertical diffusion solver (for non-WACCM-X use) + ! to replace compute_vdiff + ! and interstitials that have been CCPP-ized + use diffusion_solver, only: vertical_diffusion_interpolate_to_interfaces_run + use diffusion_solver, only: vertical_diffusion_compute_run + use diffusion_solver, only: vertical_diffusion_tendencies_run + use ccpp_constituent_prop_mod, only: ccpp_const_props use wv_saturation, only : qsat use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type - use diffusion_solver, only : compute_vdiff + use diffusion_solver_cam, only : compute_vdiff use air_composition, only : cpairv, rairv !Needed for calculation of upward H flux use air_composition, only : mbarv use time_manager, only : get_nstep @@ -840,6 +854,7 @@ subroutine vertical_diffusion_tend( & real(r8) :: rairi(pcols,pver+1) ! Gas constant [ J/K/kg ] real(r8) :: rhoi(pcols,pver+1) ! Density of air [ kg/m^3 ] real(r8) :: rhoi_dry(pcols,pver+1) ! Density of air based on dry air pressure [ kg/m^3 ] + real(r8) :: t_toai(pcols) ! Temporary for temperature to use at interface above TOA [K] ! Upper boundary conditions real(r8) :: ubc_t(pcols) ! Temperature [ K ] @@ -907,59 +922,66 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, qpert_idx, qpert) call pbuf_get_field(pbuf, pblh_idx, pblh) - ! Interpolate temperature to interfaces. - do k = 2, pver - do i = 1, ncol - tint(i,k) = 0.5_r8 * ( state%t(i,k) + state%t(i,k-1) ) - end do - end do - tint(:ncol,pver+1) = state%t(:ncol,pver) + ! Set up pressure coordinates for solver calls. + p = Coords1D(state%pint(:ncol,:)) + p_dry = Coords1D(state%pintdry(:ncol,:)) ! Get upper boundary values call ubc_get_vals( state%lchnk, ncol, state%pint, state%zi, ubc_t, ubc_mmr ) - if (waccmx_mode) then - call ubc_get_flxs( state%lchnk, ncol, state%pint, state%zi, state%t, state%q, state%phis, ubc_flux ) - ! For WACCM-X, set ubc temperature to extrapolate from next two lower interface level temperatures - tint(:ncol,1) = 1.5_r8*tint(:ncol,2)-.5_r8*tint(:ncol,3) - else if(ubc_fixed_temp) then - tint(:ncol,1) = ubc_t(:ncol) - else - tint(:ncol,1) = state%t(:ncol,1) - end if - - ! Set up pressure coordinates for solver calls. - p = Coords1D(state%pint(:ncol,:)) - p_dry = Coords1D(state%pintdry(:ncol,:)) + if(waccmx_mode) then + call ubc_get_flxs( state%lchnk, ncol, state%pint, state%zi, state%t, state%q, state%phis, ubc_flux ) + endif - !------------------------------------------------------------------------ - ! Check to see if constituent dependent gas constant needed (WACCM-X) - !------------------------------------------------------------------------ + ! For WACCM-X or fixed upper boundary condition temperature + ! set temperature at TOA interface, otherwise use temperature at TOA if (waccmx_mode) then - rairi(:ncol,1) = rairv(:ncol,1,lchnk) - do k = 2, pver - do i = 1, ncol - rairi(i,k) = 0.5_r8 * (rairv(i,k,lchnk)+rairv(i,k-1,lchnk)) - end do - end do - rairi(:ncol,pver+1) = rairv(:ncol,pver,lchnk) + ! For WACCM-X, set ubc temperature to extrapolate from next two lower interface level temperatures + t_toai(:ncol) = 1.5_r8*state%t(:ncol,2)-.5_r8*state%t(:ncol,3) else - rairi(:ncol,:pver+1) = rair + if(ubc_fixed_temp) then + ! Fixed temperature at upper boundary condition + t_toai(:ncol) = ubc_t(:ncol) + else + ! Default + t_toai(:ncol) = state%t(:ncol,1) + endif endif - ! Compute rho at interfaces. - do k = 1, pver+1 - do i = 1, ncol - rhoi(i,k) = p%ifc(i,k) / (rairi(i,k)*tint(i,k)) - end do - end do - - ! Compute rho_dry at interfaces. - do k = 1, pver+1 - do i = 1, ncol - rhoi_dry(i,k) = p_dry%ifc(i,k) / (rairi(i,k)*tint(i,k)) - end do - end do + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists + tint(:,:) = 0._r8 + rairi(:,:) = 0._r8 + rhoi(:,:) = 0._r8 + rhoi_dry(:,:) = 0._r8 + !REMOVECAM_END + + ! Interpolate t, rho (moist and dry), and set rairi + ! to interfaces for use by vertical diffusion solver. + ! The CCPP-ized subroutine does not support WACCM-X which relies on + ! upper boundary condition values; these will be overwritten later. + call vertical_diffusion_interpolate_to_interfaces_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + rair = rair, & + rairv = rairv(:ncol,:pver,state%lchnk), & + ! only use constituent-dependent gas constant when in WACCM-X mode. + flag_for_constituent_dependent_gas_constant = waccmx_mode, & + t = state%t(:ncol,:pver), & + t_toai = t_toai(:ncol), & + pint = state%pint(:ncol,:pverp), & + pintdry = state%pintdry(:ncol,:pverp), & + ! below output + ti = tint(:ncol,:pverp), & + rairi = rairi(:ncol,:pverp), & + rhoi = rhoi(:ncol,:pverp), & + rhoi_dry = rhoi_dry(:ncol,:pverp), & + errmsg = errmsg, & + errflg = errflg) + + ! Initialize total surface stresses + tautotx(:ncol) = cam_in%wsx(:ncol) + tautoty(:ncol) = cam_in%wsy(:ncol) ! ---------------------------------------- ! ! Computation of turbulent mountain stress ! @@ -975,6 +997,8 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, tautmsx_idx, tautmsx) call pbuf_get_field(pbuf, tautmsy_idx, tautmsy) + ! TODO: check if changing this to accummulate to tautotx, tautoty would change b4b-ness hplin 5/21/25 + ! Add turbulent mountain stress to total surface stress tautotx(:ncol) = cam_in%wsx(:ncol) + tautmsx(:ncol) tautoty(:ncol) = cam_in%wsy(:ncol) + tautmsy(:ncol) @@ -988,8 +1012,7 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, taubljx_idx, taubljx) call pbuf_get_field(pbuf, taubljy_idx, taubljy) - ! Add Beljaars integrated drag - + ! Add Beljaars integrated drag to total surface stress tautotx(:ncol) = tautotx(:ncol) + taubljx(:ncol) tautoty(:ncol) = tautoty(:ncol) + taubljy(:ncol) @@ -1000,12 +1023,12 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, kvh_idx, kvh_in) call pbuf_get_field(pbuf, tke_idx, tke) - ! Get potential temperature. - th(:ncol,:pver) = state%t(:ncol,:pver) * state%exner(:ncol,:pver) - select case (eddy_scheme) case ( 'diag_TKE' ) + ! Get potential temperature. + th(:ncol,:pver) = state%t(:ncol,:pver) * state%exner(:ncol,:pver) + call eddy_diff_tend(state, pbuf, cam_in, & ztodt, p, tint, rhoi, cldn, wstarent, & kvm_in, kvh_in, ksrftms, dragblj, tauresx, tauresy, & @@ -1230,6 +1253,9 @@ subroutine vertical_diffusion_tend( & ! is only handling other things, e.g. some boundary conditions, tms, ! and molecular diffusion. + ! Get potential temperature. + th(:ncol,:pver) = state%t(:ncol,:pver) * state%exner(:ncol,:pver) + thvs (:ncol) = calc_virtual_temperature(th(:ncol,pver), state%q(:ncol,pver,1), zvir) rrho (:ncol) = calc_ideal_gas_rrho(rair, state%t(:ncol,pver), state%pmid(:ncol,pver)) ustar (:ncol) = calc_friction_velocity(cam_in%wsx(:ncol), cam_in%wsy(:ncol), rrho(:ncol)) @@ -1248,8 +1274,10 @@ subroutine vertical_diffusion_tend( & end if end select + ! Write diagnostic output after diffusion coefficients are calculated call outfld( 'ustar', ustar(:), pcols, lchnk ) call outfld( 'obklen', obklen(:), pcols, lchnk ) + ! ! add sponge layer vertical diffusion ! @@ -1268,6 +1296,9 @@ subroutine vertical_diffusion_tend( & ! are not included in the pbuf as these are not needed in the initial guess by compute_eddy_diff. call pbuf_set_field(pbuf, kvm_idx, kvm) + ! Get molecular_kinematic_temperature_conductivity_at_interfaces + call pbuf_get_field(pbuf, kvt_idx, kvt) + !------------------------------------ ! ! Application of diffusivities ! !------------------------------------ ! @@ -1282,7 +1313,7 @@ subroutine vertical_diffusion_tend( & ! Write profile output before applying diffusion scheme ! !------------------------------------------------------ ! - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then sl_prePBL(:ncol,:pver) = s_tmp(:ncol,:) - latvap * q_tmp(:ncol,:,ixcldliq) & - ( latvap + latice) * q_tmp(:ncol,:,ixcldice) qt_prePBL(:ncol,:pver) = q_tmp(:ncol,:,1) + q_tmp(:ncol,:,ixcldliq) & @@ -1318,18 +1349,9 @@ subroutine vertical_diffusion_tend( & ! the explicit 'tautotx, tautoty' computed above. ! Note that the output 'tauresx,tauresy' from below subroutines are fully implicit ones. - call pbuf_get_field(pbuf, kvt_idx, kvt) - - if (do_molec_diff .and. .not. waccmx_mode) then - ! Top boundary condition for dry static energy - dse_top(:ncol) = cpairv(:ncol,1,lchnk) * tint(:ncol,1) + & - gravit * state%zi(:ncol,1) - else - dse_top(:ncol) = 0._r8 - end if - - select case (eddy_scheme) - case ('CLUBB_SGS') + ! This will be converted to an interstitial in SIMA for setting + ! the necessary inputs for vertical_diffusion_compute_run + if(eddy_scheme .eq. 'CLUBB_SGS') then ! CLUBB applies some fluxes itself, but we still want constituent ! fluxes applied here (except water vapor). taux = 0._r8 @@ -1342,90 +1364,153 @@ subroutine vertical_diffusion_tend( & else cflux(:,2:) = cam_in%cflx(:,2:) end if - case default + else taux = cam_in%wsx tauy = cam_in%wsy shflux = cam_in%shf cflux = cam_in%cflx - end select + endif - if( any(do_diffusion_const_wet) ) then + if(.not. do_molec_diff) then + ! Dry static energy top boundary is zero if no molecular diffusion + dse_top(:ncol) = 0._r8 + + ! If molecular diffusion is not done, use the CCPP-ized subroutine + call vertical_diffusion_compute_run( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ncnst = pcnst, & + ztodt = ztodt, & + rair = rair, & + gravit = gravit, & + do_diffusion_u_v= .true., & ! horizontal winds and + do_diffusion_s = .true., & ! dry static energy are diffused + do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. + itaures = .true., & + t = state%t(:ncol,:pver), & + p = p, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflux(:ncol), & + cflx = cflux(:ncol,:pcnst), & + dse_top = dse_top(:ncol), & ! zero + kvh = kvh(:ncol,:pverp), & + kvm = kvm(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = qmincg(:pcnst), & + rairv = rairv(:ncol,:,state%lchnk), & + u0 = state%u(:ncol,:pver), & + v0 = state%v(:ncol,:pver), & + q0 = state%q(:ncol,:pver,:pcnst), & + dse0 = state%s(:ncol,:pver), & + ! input/output + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + dse = s_tmp(:ncol,:pver), & + dtk = dtk(:ncol,:), & + tautmsx = tautmsx(:ncol), & + tautmsy = tautmsy(:ncol), & + ! arguments for Beljaars + do_beljaars = do_beljaars, & + ! FIXME: I think ubc can be removed here + ! check from regression tests -- hplin 5/21/25 + ubc_mmr = ubc_mmr(:ncol,:pcnst), & + cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + errmsg = errmsg, & + errflg = errflg) + else + ! Molecular diffusion is active, use old compute_vdiff - if (do_molec_diff) then - call compute_molec_diff(state%lchnk, pcols, pver, pcnst, ncol, & - kvm, kvt, tint, rhoi, kq_scal, cnst_mw, & - mw_fac, nbot_molec) + ! Top boundary condition for dry static energy if molecular diffusion is active + ! but not in WACCM-X mode + if (.not. waccmx_mode) then + dse_top(:ncol) = cpairv(:ncol,1,lchnk) * tint(:ncol,1) + & + gravit * state%zi(:ncol,1) + else + dse_top(:ncol) = 0._r8 end if - call compute_vdiff( & - ncol = ncol, & - pver = pver, & - pverp = pverp, & - ncnst = pcnst, & - ztodt = ztodt, & - do_diffusion_u_v= .true., & ! horizontal winds and - do_diffusion_s = .true., & ! dry static energy are diffused - do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. - do_molecular_diffusion_const = do_molecular_diffusion_const, & - itaures = .true., & - t = state%t(:ncol,:pver), & - tint = tint(:ncol,:pverp), & - p = p, & ! Coords1D, pressure coordinates [Pa] - rhoi = rhoi(:ncol,:pverp), & - taux = taux(:ncol), & - tauy = tauy(:ncol), & - shflx = shflux(:ncol), & - cflx = cflux(:ncol,:pcnst), & - dse_top = dse_top(:ncol), & - kvh = kvh(:ncol,:pverp), & - kvm = kvm(:ncol,:pverp), & - kvq = kvq(:ncol,:pverp), & - cgs = cgs(:ncol,:pverp), & - cgh = cgh(:ncol,:pverp), & - ksrftms = ksrftms(:ncol), & - dragblj = dragblj(:ncol,:pver), & - qmincg = qmincg(:pcnst), & - ! input/output - u = u_tmp(:ncol,:pver), & - v = v_tmp(:ncol,:pver), & - q = q_tmp(:ncol,:pver,:pcnst), & - dse = s_tmp(:ncol,:pver), & - tauresx = tauresx(:ncol), & - tauresy = tauresy(:ncol), & - ! below output - dtk = dtk(:ncol,:), & - tautmsx = tautmsx(:ncol), & - tautmsy = tautmsy(:ncol), & - topflx = topflx(:ncol), & - errmsg = errstring, & - ! arguments for Beljaars - do_beljaars = do_beljaars, & - ! arguments for molecular diffusion only. - do_molec_diff = do_molec_diff, & - use_temperature_molec_diff = waccmx_mode, & - cpairv = cpairv(:ncol,:,state%lchnk), & - rairv = rairv(:ncol,:,state%lchnk), & - mbarv = mbarv(:ncol,:,state%lchnk), & - vd_lu_qdecomp = vd_lu_qdecomp, & - ubc_mmr = ubc_mmr(:ncol,:pcnst), & - ubc_flux = ubc_flux(:ncol,:pcnst), & - kvt = kvt(:ncol,:pverp), & - pmid = state%pmid(:ncol,:pver), & - cnst_mw = cnst_mw(:pcnst), & - cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & - cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & - nbot_molec = nbot_molec, & - kq_scal = kq_scal(:ncol,:pverp), & - mw_fac = mw_fac(:ncol,:pverp,:pcnst)) - - call handle_errmsg(errstring, subname="compute_vdiff", & - extra_msg="Error in fieldlist_wet call from vertical_diffusion.") - - end if - - if( any( do_diffusion_const_dry ) ) then + if( any(do_diffusion_const_wet) ) then + call compute_molec_diff(state%lchnk, pcols, pver, pcnst, ncol, & + kvm, kvt, tint, rhoi, kq_scal, cnst_mw, & + mw_fac, nbot_molec) + + call compute_vdiff( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ncnst = pcnst, & + ztodt = ztodt, & + do_diffusion_u_v= .true., & ! horizontal winds and + do_diffusion_s = .true., & ! dry static energy are diffused + do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. + do_molecular_diffusion_const = do_molecular_diffusion_const, & + itaures = .true., & + t = state%t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflux(:ncol), & + cflx = cflux(:ncol,:pcnst), & + dse_top = dse_top(:ncol), & + kvh = kvh(:ncol,:pverp), & + kvm = kvm(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = qmincg(:pcnst), & + ! input/output + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + dse = s_tmp(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = dtk(:ncol,:), & + tautmsx = tautmsx(:ncol), & + tautmsy = tautmsy(:ncol), & + topflx = topflx(:ncol), & + errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & + ! arguments for molecular diffusion only. + do_molec_diff = do_molec_diff, & + use_temperature_molec_diff = waccmx_mode, & + cpairv = cpairv(:ncol,:,state%lchnk), & + rairv = rairv(:ncol,:,state%lchnk), & + mbarv = mbarv(:ncol,:,state%lchnk), & + vd_lu_qdecomp = vd_lu_qdecomp, & + ubc_mmr = ubc_mmr(:ncol,:pcnst), & + ubc_flux = ubc_flux(:ncol,:pcnst), & + kvt = kvt(:ncol,:pverp), & + pmid = state%pmid(:ncol,:pver), & + cnst_mw = cnst_mw(:pcnst), & + cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & + nbot_molec = nbot_molec, & + kq_scal = kq_scal(:ncol,:pverp), & + mw_fac = mw_fac(:ncol,:pverp,:pcnst)) + + call handle_errmsg(errstring, subname="compute_vdiff", & + extra_msg="Error in fieldlist_wet call from vertical_diffusion.") + end if - if( do_molec_diff ) then + if( any( do_diffusion_const_dry ) ) then ! kvm is unused in the output here (since it was assigned ! above), so we use a temp kvm for the inout argument, and ! ignore the value output by compute_molec_diff. @@ -1433,76 +1518,76 @@ subroutine vertical_diffusion_tend( & call compute_molec_diff(state%lchnk, pcols, pver, pcnst, ncol, & kvm_temp, kvt, tint, rhoi_dry, kq_scal, cnst_mw, & mw_fac, nbot_molec) - end if - call compute_vdiff( & - ncol = ncol, & - pver = pver, & - pverp = pverp, & - ncnst = pcnst, & - ztodt = ztodt, & - do_diffusion_u_v= .false., & - do_diffusion_s = .false., & - do_diffusion_const = do_diffusion_const_dry, & - do_molecular_diffusion_const = do_molecular_diffusion_const, & - itaures = .true., & - t = state%t(:ncol,:pver), & - tint = tint(:ncol,:pverp), & - p = p_dry, & ! Coords1D, pressure coordinates [Pa] - rhoi = rhoi_dry(:ncol,:pverp), & - taux = taux(:ncol), & - tauy = tauy(:ncol), & - shflx = shflux(:ncol), & - cflx = cflux(:ncol,:pcnst), & - dse_top = dse_top(:ncol), & - kvh = kvh(:ncol,:pverp), & - kvm = kvm(:ncol,:pverp), & - kvq = kvq(:ncol,:pverp), & - cgs = cgs(:ncol,:pverp), & - cgh = cgh(:ncol,:pverp), & - ksrftms = ksrftms(:ncol), & - dragblj = dragblj(:ncol,:pver), & - qmincg = qmincg(:pcnst), & - ! input/output - u = u_tmp(:ncol,:pver), & - v = v_tmp(:ncol,:pver), & - q = q_tmp(:ncol,:pver,:pcnst), & - dse = s_tmp(:ncol,:pver), & - tauresx = tauresx(:ncol), & - tauresy = tauresy(:ncol), & - ! below output - dtk = dtk_temp(:ncol,:), & ! unused dummy - tautmsx = tautmsx_temp(:ncol), & ! unused dummy - tautmsy = tautmsy_temp(:ncol), & ! unused dummy - topflx = topflx_temp(:ncol), & ! unused dummy - errmsg = errstring, & - ! arguments for Beljaars - do_beljaars = do_beljaars, & - ! arguments for molecular diffusion only. - do_molec_diff = do_molec_diff, & - use_temperature_molec_diff = waccmx_mode, & - cpairv = cpairv(:ncol,:,state%lchnk), & - rairv = rairv(:ncol,:,state%lchnk), & - mbarv = mbarv(:ncol,:,state%lchnk), & - vd_lu_qdecomp = vd_lu_qdecomp, & - ubc_mmr = ubc_mmr(:ncol,:pcnst), & - ubc_flux = ubc_flux(:ncol,:pcnst), & - kvt = kvt(:ncol,:pverp), & - pmid = state%pmiddry(:ncol,:pver), & - cnst_mw = cnst_mw(:pcnst), & - cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & - cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & - nbot_molec = nbot_molec, & - kq_scal = kq_scal(:ncol,:pverp), & - mw_fac = mw_fac(:ncol,:pverp,:pcnst)) - - call handle_errmsg(errstring, subname="compute_vdiff", & - extra_msg="Error in fieldlist_dry call from vertical_diffusion.") + call compute_vdiff( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ncnst = pcnst, & + ztodt = ztodt, & + do_diffusion_u_v= .false., & + do_diffusion_s = .false., & + do_diffusion_const = do_diffusion_const_dry, & + do_molecular_diffusion_const = do_molecular_diffusion_const, & + itaures = .true., & + t = state%t(:ncol,:pver), & + tint = tint(:ncol,:pverp), & + p = p_dry, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi_dry(:ncol,:pverp), & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflx = shflux(:ncol), & + cflx = cflux(:ncol,:pcnst), & + dse_top = dse_top(:ncol), & + kvh = kvh(:ncol,:pverp), & + kvm = kvm(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + ksrftms = ksrftms(:ncol), & + dragblj = dragblj(:ncol,:pver), & + qmincg = qmincg(:pcnst), & + ! input/output + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + dse = s_tmp(:ncol,:pver), & + tauresx = tauresx(:ncol), & + tauresy = tauresy(:ncol), & + ! below output + dtk = dtk_temp(:ncol,:), & ! unused dummy + tautmsx = tautmsx_temp(:ncol), & ! unused dummy + tautmsy = tautmsy_temp(:ncol), & ! unused dummy + topflx = topflx_temp(:ncol), & ! unused dummy + errmsg = errstring, & + ! arguments for Beljaars + do_beljaars = do_beljaars, & + ! arguments for molecular diffusion only. + do_molec_diff = do_molec_diff, & + use_temperature_molec_diff = waccmx_mode, & + cpairv = cpairv(:ncol,:,state%lchnk), & + rairv = rairv(:ncol,:,state%lchnk), & + mbarv = mbarv(:ncol,:,state%lchnk), & + vd_lu_qdecomp = vd_lu_qdecomp, & + ubc_mmr = ubc_mmr(:ncol,:pcnst), & + ubc_flux = ubc_flux(:ncol,:pcnst), & + kvt = kvt(:ncol,:pverp), & + pmid = state%pmiddry(:ncol,:pver), & + cnst_mw = cnst_mw(:pcnst), & + cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + cnst_fixed_ubflx= cnst_fixed_ubflx(:pcnst), & + nbot_molec = nbot_molec, & + kq_scal = kq_scal(:ncol,:pverp), & + mw_fac = mw_fac(:ncol,:pverp,:pcnst)) + + call handle_errmsg(errstring, subname="compute_vdiff", & + extra_msg="Error in fieldlist_dry call from vertical_diffusion.") - end if + end if + end if - ! For species not diffused, so just add the explicit surface fluxes to the - ! lowest layer. **NOTE** This code assumes wet mmr. + ! For species not diffused, i.e., treated in dropmixnuc (vertically mixed by ndrop activation process) + ! Just add the explicit surface fluxes to the lowest layer. **NOTE** This code assumes wet mmr. tmp1(:ncol) = ztodt * gravit * state%rpdel(:ncol,pver) do l = 1, pcnst if (cnst_ndropmixed(l)) then @@ -1514,7 +1599,7 @@ subroutine vertical_diffusion_tend( & ! Diagnostics and output writing after applying PBL scheme ! ! -------------------------------------------------------- ! - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then sl(:ncol,:pver) = s_tmp(:ncol,:) - latvap * q_tmp(:ncol,:,ixcldliq) & - ( latvap + latice) * q_tmp(:ncol,:,ixcldice) @@ -1601,19 +1686,31 @@ subroutine vertical_diffusion_tend( & call physics_ptend_init(ptend,state%psetcols, "vertical diffusion", & ls=.true., lu=.true., lv=.true., lq=lq) - ptend%s(:ncol,:) = ( s_tmp(:ncol,:) - state%s(:ncol,:) ) * rztodt - ptend%u(:ncol,:) = ( u_tmp(:ncol,:) - state%u(:ncol,:) ) * rztodt - ptend%v(:ncol,:) = ( v_tmp(:ncol,:) - state%v(:ncol,:) ) * rztodt - ptend%q(:ncol,:pver,:) = ( q_tmp(:ncol,:pver,:) - state%q(:ncol,:pver,:) ) * rztodt - - ! Convert tendencies of dry constituents to dry basis. - do m = 1,pcnst - if (cnst_type(m).eq.'dry') then - ptend%q(:ncol,:pver,m) = ptend%q(:ncol,:pver,m)*state%pdel(:ncol,:pver)/state%pdeldry(:ncol,:pver) - endif - end do - - if (.not. do_pbl_diags) then + call vertical_diffusion_tendencies_run( & + ncol = ncol, & + pver = pver, & + pcnst = pcnst, & + const_props = ccpp_const_props, & + dt = ztodt, & + pdel = state%pdel(:ncol,:pver), & + pdeldry = state%pdeldry(:ncol,:pver), & + u0 = state%u(:ncol,:pver), & + v0 = state%v(:ncol,:pver), & + s0 = state%s(:ncol,:pver), & + q0 = state%q(:ncol,:pver,:pcnst), & + u = u_tmp(:ncol,:pver), & + v = v_tmp(:ncol,:pver), & + s = s_tmp(:ncol,:pver), & + q = q_tmp(:ncol,:pver,:pcnst), & + ! below output + tend_s = ptend%s(:ncol,:pver), & + tend_u = ptend%u(:ncol,:pver), & + tend_v = ptend%v(:ncol,:pver), & + tend_q = ptend%q(:ncol,:pver,:pcnst), & + errmsg = errmsg, & + errflg = errflg) + + if (.not. is_clubb_scheme) then slten(:ncol,:) = ( sl(:ncol,:) - sl_prePBL(:ncol,:) ) * rztodt qtten(:ncol,:) = ( qt(:ncol,:) - qt_prePBL(:ncol,:) ) * rztodt end if @@ -1630,7 +1727,7 @@ subroutine vertical_diffusion_tend( & ! ! ! ------------------------------------------------------------ ! - if( eddy_scheme .eq. 'diag_TKE' .and. do_pseudocon_diff ) then + if( eddy_scheme .eq. 'diag_TKE' .and. do_pseudocon_diff ) then ptend%q(:ncol,:pver,1) = qtten(:ncol,:pver) ptend%s(:ncol,:pver) = slten(:ncol,:pver) @@ -1649,11 +1746,26 @@ subroutine vertical_diffusion_tend( & end do end do - call positive_moisture( cpair, latvap, latvap+latice, ncol, pver, ztodt, qmin(1), qmin(ixcldliq), qmin(ixcldice), & - state%pdel(:ncol,pver:1:-1), qv_pro(:ncol,pver:1:-1), ql_pro(:ncol,pver:1:-1), & - qi_pro(:ncol,pver:1:-1), t_pro(:ncol,pver:1:-1), s_pro(:ncol,pver:1:-1), & - ptend%q(:ncol,pver:1:-1,1), ptend%q(:ncol,pver:1:-1,ixcldliq), & - ptend%q(:ncol,pver:1:-1,ixcldice), ptend%s(:ncol,pver:1:-1) ) + call positive_moisture( & + ncol = ncol, & + mkx = pver, & + dt = ztodt, & + cp = cpair, & + xlv = latvap, & + xls = latvap+latice, & + qvmin = qmin(1), & + qlmin = qmin(ixcldliq), & + qimin = qmin(ixcldice), & + dp = state%pdel(:ncol,pver:1:-1), & + qv = qv_pro(:ncol,pver:1:-1), & + ql = ql_pro(:ncol,pver:1:-1), & + qi = qi_pro(:ncol,pver:1:-1), & + t = t_pro(:ncol,pver:1:-1), & + s = s_pro(:ncol,pver:1:-1), & + qvten = ptend%q(:ncol,pver:1:-1,1), & + qlten = ptend%q(:ncol,pver:1:-1,ixcldliq), & + qiten = ptend%q(:ncol,pver:1:-1,ixcldice), & + sten = ptend%s(:ncol,pver:1:-1)) end if @@ -1661,7 +1773,7 @@ subroutine vertical_diffusion_tend( & ! Re-calculate diagnostic output variables after vertical diffusion ! ! ----------------------------------------------------------------- ! - if (.not. do_pbl_diags) then + if (.not. is_clubb_scheme) then qv_aft_PBL(:ncol,:pver) = state%q(:ncol,:pver,1) + ptend%q(:ncol,:pver,1) * ztodt ql_aft_PBL(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) + ptend%q(:ncol,:pver,ixcldliq) * ztodt @@ -1722,12 +1834,25 @@ subroutine vertical_diffusion_tend( & enddo endif - ! -------------------------------------------------------------- ! - ! Writing state variables after PBL scheme for detailed analysis ! - ! -------------------------------------------------------------- ! + ! ------------------------------------------- ! + ! Writing standard output variables ! + ! ------------------------------------------- ! + + if (.not. is_clubb_scheme) then + call outfld( 'QT' , qt, pcols, lchnk ) + call outfld( 'SL' , sl, pcols, lchnk ) + call outfld( 'SLV' , slv, pcols, lchnk ) + call outfld( 'SLFLX' , slflx, pcols, lchnk ) + call outfld( 'QTFLX' , qtflx, pcols, lchnk ) + call outfld( 'UFLX' , uflx, pcols, lchnk ) + call outfld( 'VFLX' , vflx, pcols, lchnk ) + call outfld( 'TKE' , tke, pcols, lchnk ) - if (.not. do_pbl_diags) then + call outfld( 'PBLH' , pblh, pcols, lchnk ) + call outfld( 'TPERT' , tpert, pcols, lchnk ) + call outfld( 'QPERT' , qpert, pcols, lchnk ) + ! State variables after PBL scheme for detailed analysis call outfld( 'sl_aft_PBL' , sl, pcols, lchnk ) call outfld( 'qt_aft_PBL' , qt, pcols, lchnk ) call outfld( 'slv_aft_PBL' , slv, pcols, lchnk ) @@ -1755,27 +1880,8 @@ subroutine vertical_diffusion_tend( & call outfld( 'qiten_PBL' , ptend%q(:,:,ixcldice), pcols, lchnk ) call outfld( 'tten_PBL' , tten, pcols, lchnk ) call outfld( 'rhten_PBL' , rhten, pcols, lchnk ) - end if - ! ------------------------------------------- ! - ! Writing the other standard output variables ! - ! ------------------------------------------- ! - - if (.not. do_pbl_diags) then - call outfld( 'QT' , qt, pcols, lchnk ) - call outfld( 'SL' , sl, pcols, lchnk ) - call outfld( 'SLV' , slv, pcols, lchnk ) - call outfld( 'SLFLX' , slflx, pcols, lchnk ) - call outfld( 'QTFLX' , qtflx, pcols, lchnk ) - call outfld( 'UFLX' , uflx, pcols, lchnk ) - call outfld( 'VFLX' , vflx, pcols, lchnk ) - call outfld( 'TKE' , tke, pcols, lchnk ) - - call outfld( 'PBLH' , pblh, pcols, lchnk ) - call outfld( 'TPERT' , tpert, pcols, lchnk ) - call outfld( 'QPERT' , qpert, pcols, lchnk ) - end if call outfld( 'USTAR' , ustar, pcols, lchnk ) call outfld( 'KVH' , kvh, pcols, lchnk ) call outfld( 'KVT' , kvt, pcols, lchnk ) @@ -1816,15 +1922,28 @@ subroutine positive_moisture( cp, xlv, xls, ncol, mkx, dt, qvmin, qlmin, qimin, ! input tendencies. ! ! Be careful the order of k : '1': near-surface layer, 'mkx' : top layer ! ! ------------------------------------------------------------------------------- ! - implicit none - integer, intent(in) :: ncol, mkx - real(r8), intent(in) :: cp, xlv, xls - real(r8), intent(in) :: dt, qvmin, qlmin, qimin - real(r8), intent(in) :: dp(ncol,mkx) - real(r8), intent(inout) :: qv(ncol,mkx), ql(ncol,mkx), qi(ncol,mkx), t(ncol,mkx), s(ncol,mkx) - real(r8), intent(inout) :: qvten(ncol,mkx), qlten(ncol,mkx), qiten(ncol,mkx), sten(ncol,mkx) - integer i, k - real(r8) dql, dqi, dqv, sum, aa, dum + integer, intent(in) :: ncol ! Number of atmospheric columns [count] + integer, intent(in) :: mkx ! Number of vertical levels [count] + real(r8), intent(in) :: cp ! Specific heat of dry air at constant pressure [J kg-1 K-1] + real(r8), intent(in) :: xlv ! Latent heat of vaporization [J kg-1] + real(r8), intent(in) :: xls ! Latent heat of sublimation [J kg-1] + real(r8), intent(in) :: dt ! Time step [s] + real(r8), intent(in) :: qvmin ! Minimum water vapor mixing ratio [kg kg-1] + real(r8), intent(in) :: qlmin ! Minimum liquid water mixing ratio [kg kg-1] + real(r8), intent(in) :: qimin ! Minimum ice water mixing ratio [kg kg-1] + real(r8), intent(in) :: dp(ncol,mkx) ! Pressure thickness of layers [Pa] + real(r8), intent(inout) :: qv(ncol,mkx) ! Water vapor mixing ratio [kg kg-1] + real(r8), intent(inout) :: ql(ncol,mkx) ! Cloud liquid water mixing ratio [kg kg-1] + real(r8), intent(inout) :: qi(ncol,mkx) ! Cloud ice water mixing ratio [kg kg-1] + real(r8), intent(inout) :: t(ncol,mkx) ! Temperature [K] + real(r8), intent(inout) :: s(ncol,mkx) ! Dry static energy [J kg-1] + real(r8), intent(inout) :: qvten(ncol,mkx) ! Water vapor tendency [kg kg-1 s-1] + real(r8), intent(inout) :: qlten(ncol,mkx) ! Liquid water tendency [kg kg-1 s-1] + real(r8), intent(inout) :: qiten(ncol,mkx) ! Ice water tendency [kg kg-1 s-1] + real(r8), intent(inout) :: sten(ncol,mkx) ! Dry static energy tendency [J kg-1 s-1] + + integer :: i, k + real(r8) :: dql, dqi, dqv, sum, aa, dum ! Modification : I should check whether this is exactly same as the one used in ! shallow convection and cloud macrophysics. @@ -1875,7 +1994,6 @@ subroutine positive_moisture( cp, xlv, xls, ncol, mkx, dt, qvmin, qlmin, qimin, endif endif end do - return end subroutine positive_moisture From 8a4ebe70222765dd0c4a51d2c570a9f4278acd55 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 22 May 2025 11:16:38 -0600 Subject: [PATCH 192/466] set default namelist ops and config nlevs for waccmx ne120 modified: bld/build-namelist modified: bld/configure modified: bld/namelist_files/namelist_defaults_cam.xml --- bld/build-namelist | 1 + bld/configure | 4 +++- bld/namelist_files/namelist_defaults_cam.xml | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index 4d1c61eb8a..66188ea07f 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3195,6 +3195,7 @@ if ($waccmx) { add_default($nl,'ionos_xport_nsplit'); add_default($nl,'steady_state_ion_elec_temp', 'val'=>'.false.'); add_default($nl,'oplus_ring_polar_filter'); + add_default($nl,'oplus_shapiro_const'); add_default($nl,'rxn_rate_sums'); } diff --git a/bld/configure b/bld/configure index 7f7e6a3f4c..2b7f5d2202 100755 --- a/bld/configure +++ b/bld/configure @@ -1227,7 +1227,9 @@ if ($phys_pkg eq 'cam7') { } } elsif ($waccmx) { - if ($phys_pkg eq 'cam6') { + if ($hgrid =~ /ne120/) { + $nlev = 273; + } elsif ($phys_pkg eq 'cam6') { $nlev = 130; } else { $nlev = 126; diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index a8be732e63..847c20678b 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -881,6 +881,8 @@ 30 90 .true. +3.d-2 +6.d-3 144,96 @@ -905,6 +907,7 @@ share/meshes/ne16pg3_ESMFmesh_cdf5_c20211018.nc atm/cam/coords/ne30np4_esmf_c210305.nc atm/cam/coords/ne30pg3_esmf_20200428.nc +share/meshes/ne120pg3_ESMFmesh_cdf5_c20211018.nc 1.00D0 @@ -3225,13 +3228,16 @@ 1.0 -1 + 3.0 -1 7.5 7.5 + 5.0 -1 30 30 30 + 100 1 2 From 11e8d6278996cfa3f3e603acde07be89513c132e Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 22 May 2025 14:03:47 -0400 Subject: [PATCH 193/466] Fix bit-for-bitness in toa interface temperature interpolation for waccm-x vertical diff. --- src/physics/cam/vertical_diffusion.F90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 5e90d5e108..dcf2647a64 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -937,7 +937,14 @@ subroutine vertical_diffusion_tend( & ! set temperature at TOA interface, otherwise use temperature at TOA if (waccmx_mode) then ! For WACCM-X, set ubc temperature to extrapolate from next two lower interface level temperatures - t_toai(:ncol) = 1.5_r8*state%t(:ncol,2)-.5_r8*state%t(:ncol,3) + ! the original formulation is: + ! t_toai(:ncol) = 1.5_r8*tint(:ncol,2)-.5_r8*tint(:ncol,3) + ! this appears to be: + ! = tint(:ncol,2) + 0.5_r8*(tint(:ncol,2) - tint(:ncol,3)) + ! assuming that the extrapolated gradient is 1/2 of the temperature gradient between the lower interfaces + ! because the interpolation will be done later in the CCPP-ized scheme, formulate this in terms of + ! the temperature (at midpoints): + t_toai(:ncol) = 1.5_r8*(state%t(:ncol,2)+state%t(:ncol,1))/2._r8-.5_r8*(state%t(:ncol,3)+state%t(:ncol,2))/2._r8 else if(ubc_fixed_temp) then ! Fixed temperature at upper boundary condition From f7df8593d59f0132477a339c8a91a87a5324ead7 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 22 May 2025 14:10:29 -0600 Subject: [PATCH 194/466] default IC file and pelayout on derecho modified: bld/namelist_files/namelist_defaults_cam.xml modified: cime_config/config_pes.xml --- bld/namelist_files/namelist_defaults_cam.xml | 1 + cime_config/config_pes.xml | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 847c20678b..b6569ff748 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -212,6 +212,7 @@ atm/cam/inic/se/ape_cam5_ne120np4_L30_c170419.nc atm/cam/inic/se/F2000climo_ne120pg3_mt13_01-01-00000_c200420.nc atm/cam/inic/se/ape_cam6_ne120np4_L32_c170908.nc +/glade/campaign/hao/itmodel/fvitt/hi_res_waccmx/fx2000_ne120pg3L273.001.cam.i.0002-01-01-00000.noBRCL_c250522.nc atm/cam/inic/homme/cami_1850-01-01_ne240np4_L26_c110314.nc atm/cam/inic/homme/cami_0000-09-01_ne240np4_L26_c061106.nc diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index fe5db44ecf..32c719dfce 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -542,6 +542,26 @@ + + + + -100 + -100 + -100 + -100 + -100 + -100 + + + 1 + 1 + 1 + 1 + 1 + 1 + + + none From 3a43669f43925f29e5ca6e31bc3d55b599226511 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 22 May 2025 15:13:52 -0600 Subject: [PATCH 195/466] add min temperature namelist option modified: bld/build-namelist modified: bld/namelist_files/namelist_definition.xml modified: src/dynamics/se/dycore/control_mod.F90 modified: src/dynamics/se/dycore/prim_advance_mod.F90 modified: src/dynamics/se/dyn_comp.F90 --- bld/build-namelist | 3 +++ bld/namelist_files/namelist_definition.xml | 11 ++++++++++- src/dynamics/se/dycore/control_mod.F90 | 6 ++++-- src/dynamics/se/dycore/prim_advance_mod.F90 | 14 +++++++++++++- src/dynamics/se/dyn_comp.F90 | 15 ++++++++++++++- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 66188ea07f..cdcd77ff50 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3197,6 +3197,9 @@ if ($waccmx) { add_default($nl,'oplus_ring_polar_filter'); add_default($nl,'oplus_shapiro_const'); add_default($nl,'rxn_rate_sums'); + if ($cfg->get('hgrid') =~ /ne120/) { + add_default($nl,'se_min_temperature', 'val'=>'105.D0'); + } } # Chemistry options diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index a2946cd243..f3b8dc77d1 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3226,7 +3226,7 @@ Default: .false. - The fraction of the boundary layer (PBL) depth, over which to mix the initial ZM convective parcel properties (fraction). + The fraction of the boundary layer (PBL) depth, over which to mix the initial ZM convective parcel properties (fraction). Default: 0.5 @@ -8191,6 +8191,15 @@ multiplied by a factor of se_molecular_diff. Default: 0. + +Used by SE dycore to apply floor to temperature..... + +NEEDS TO BE FILLED IN + +Default: 0. + + Number of hyperviscosity subcycles done in tracer advection code. diff --git a/src/dynamics/se/dycore/control_mod.F90 b/src/dynamics/se/dycore/control_mod.F90 index 92f9509d43..a5b2c95db0 100644 --- a/src/dynamics/se/dycore/control_mod.F90 +++ b/src/dynamics/se/dycore/control_mod.F90 @@ -121,11 +121,13 @@ module control_mod ! ! molecular diffusion - ! + ! real(r8), public :: molecular_diff = -1.0_r8 integer, public :: vert_remap_uvTq_alg, vert_remap_tracer_alg - integer, public :: pgf_formulation = -1 !PGF formulation - see prim_advance_mod.F90 + + real(r8), public :: min_temperature = 0._r8 + end module control_mod diff --git a/src/dynamics/se/dycore/prim_advance_mod.F90 b/src/dynamics/se/dycore/prim_advance_mod.F90 index 5d239b654e..25323df956 100644 --- a/src/dynamics/se/dycore/prim_advance_mod.F90 +++ b/src/dynamics/se/dycore/prim_advance_mod.F90 @@ -444,7 +444,7 @@ subroutine advance_hypervis_dp(edge3,elem,fvm,hybrid,deriv,nt,qn0,nets,nete,dt2, use dimensions_mod, only: nu_scale_top,nu_lev,kmvis_ref,kmcnd_ref,rho_ref,km_sponge_factor use dimensions_mod, only: nu_t_lev use control_mod, only: nu, nu_t, hypervis_subcycle,hypervis_subcycle_sponge, nu_p, nu_top - use control_mod, only: molecular_diff,sponge_del4_lev + use control_mod, only: molecular_diff,sponge_del4_lev, min_temperature use hybrid_mod, only: hybrid_t!, get_loop_ranges use element_mod, only: element_t use derivative_mod, only: derivative_t, laplace_sphere_wk, vlaplace_sphere_wk, vlaplace_sphere_wk_mol @@ -688,6 +688,18 @@ subroutine advance_hypervis_dp(edge3,elem,fvm,hybrid,deriv,nt,qn0,nets,nete,dt2, enddo enddo enddo + if (min_temperature>0._r8) then + ! apply floor to temperature + do ie=nets,nete + do k=sponge_del4_lev+2,nlev + do j=1,np + do i=1,np + elem(ie)%state%T(i,j,k,nt) = max(elem(ie)%state%T(i,j,k,nt),min_temperature) + end do + end do + end do + end do + end if call tot_energy_dyn(elem,fvm,nets,nete,nt,qn0,'dAH') end do diff --git a/src/dynamics/se/dyn_comp.F90 b/src/dynamics/se/dyn_comp.F90 index 53ff8b87df..bdddbf4df4 100644 --- a/src/dynamics/se/dyn_comp.F90 +++ b/src/dynamics/se/dyn_comp.F90 @@ -116,6 +116,7 @@ subroutine dyn_readnl(NLFileName) use control_mod, only: max_hypervis_courant, statediag_numtrac,refined_mesh use control_mod, only: molecular_diff, pgf_formulation, dribble_in_rsplit_loop use control_mod, only: sponge_del4_nu_div_fac, sponge_del4_nu_fac, sponge_del4_lev + use control_mod, only: min_temperature use dimensions_mod, only: ne, npart use dimensions_mod, only: large_Courant_incr use dimensions_mod, only: fvm_supercycling, fvm_supercycling_jet @@ -173,6 +174,8 @@ subroutine dyn_readnl(NLFileName) real(r8) :: se_molecular_diff integer :: se_pgf_formulation integer :: se_dribble_in_rsplit_loop + real(r8) :: se_min_temperature = 0.0_r8 + namelist /dyn_se_inparm/ & se_fine_ne, & ! For refined meshes se_ftype, & ! forcing type @@ -218,7 +221,8 @@ subroutine dyn_readnl(NLFileName) se_kmax_jet, & se_molecular_diff, & se_pgf_formulation, & - se_dribble_in_rsplit_loop + se_dribble_in_rsplit_loop, & + se_min_temperature !-------------------------------------------------------------------------- ! defaults for variables not set by build-namelist @@ -293,6 +297,8 @@ subroutine dyn_readnl(NLFileName) call MPI_bcast(se_molecular_diff, 1, mpi_real8, masterprocid, mpicom, ierr) call MPI_bcast(se_pgf_formulation, 1, mpi_integer, masterprocid, mpicom, ierr) call MPI_bcast(se_dribble_in_rsplit_loop, 1, mpi_integer, masterprocid, mpicom, ierr) + call MPI_bcast(se_min_temperature, 1, mpi_real8, masterprocid, mpicom, ierr) + if (se_npes <= 0) then call endrun('dyn_readnl: ERROR: se_npes must be > 0') end if @@ -361,6 +367,8 @@ subroutine dyn_readnl(NLFileName) molecular_diff = se_molecular_diff pgf_formulation = se_pgf_formulation dribble_in_rsplit_loop = se_dribble_in_rsplit_loop + min_temperature = se_min_temperature + if (fv_nphys > 0) then ! Use finite volume physics grid and CSLAM for tracer advection nphys_pts = fv_nphys*fv_nphys @@ -496,6 +504,11 @@ subroutine dyn_readnl(NLFileName) se_write_restart_unstruct write(iulog, '(a,e9.2)') 'dyn_readnl: se_molecular_diff = ', molecular_diff + + if (min_temperature>0._r8) then + write(iulog, '(a,e9.2)') 'dyn_readnl: se_min_temperature = ', min_temperature + end if + end if call native_mapping_readnl(NLFileName) From fc250fe90895535ea4c15e3e084fd10b6044b31c Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 22 May 2025 15:57:18 -0600 Subject: [PATCH 196/466] more default namelist settings modified: bld/namelist_files/namelist_defaults_cam.xml --- bld/namelist_files/namelist_defaults_cam.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index b6569ff748..99abbe1976 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -881,6 +881,7 @@ 30 30 90 +180 .true. 3.d-2 6.d-3 @@ -891,11 +892,13 @@ 288,192 288,192 576,384 + 576,384 80x97 160x193 160x193 320x385 +320x385 atm/cam/coords/fv0.47x0.63_esmf_c210305.nc From 1567665eff0d374a1a994e0f1bb59445145396b4 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 28 May 2025 11:09:42 -0400 Subject: [PATCH 197/466] Separate out vertical_diffusion_compute; tau_damp_rate --- src/physics/cam/vertical_diffusion.F90 | 128 ++++++++++++++++++++++--- 1 file changed, 113 insertions(+), 15 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index dcf2647a64..26e33d9b3e 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -711,7 +711,13 @@ subroutine vertical_diffusion_tend( & ! to replace compute_vdiff ! and interstitials that have been CCPP-ized use diffusion_solver, only: vertical_diffusion_interpolate_to_interfaces_run - use diffusion_solver, only: vertical_diffusion_compute_run + use diffusion_solver, only: implicit_surface_stress_add_drag_coefficient_run + use diffusion_stubs, only: turbulent_mountain_stress_add_drag_coefficient_run + use diffusion_solver, only: vertical_diffusion_wind_damping_rate_run + use diffusion_stubs, only: beljaars_add_wind_damping_rate_run + use diffusion_solver, only: vertical_diffusion_diffuse_horizontal_momentum_run + use diffusion_solver, only: vertical_diffusion_diffuse_dry_static_energy_run + use diffusion_solver, only: vertical_diffusion_diffuse_tracers_run use diffusion_solver, only: vertical_diffusion_tendencies_run use ccpp_constituent_prop_mod, only: ccpp_const_props @@ -905,6 +911,14 @@ subroutine vertical_diffusion_tend( & real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] real(r8) :: wstar(pcols) ! convective scale velocity [m s-1] real(r8) :: bge(pcols) ! buoyancy gradient enhancement + + ! Temporaries for CCPP-ized diffusion solver + real(r8) :: ksrf(pcols) ! total surface drag coefficient + real(r8) :: tau_damp_rate(pcols, pver) ! wind damping rate + real(r8) :: tautotx_ccpp(pcols) + real(r8) :: tautoty_ccpp(pcols) + real(r8) :: dpidz_sq(pcols, pverp) ! square of derivative of pressure with height + character(len=512) :: errmsg integer :: errflg @@ -960,6 +974,7 @@ subroutine vertical_diffusion_tend( & rairi(:,:) = 0._r8 rhoi(:,:) = 0._r8 rhoi_dry(:,:) = 0._r8 + dpidz_sq(:,:) = 0._r8 !REMOVECAM_END ! Interpolate t, rho (moist and dry), and set rairi @@ -970,6 +985,7 @@ subroutine vertical_diffusion_tend( & ncol = ncol, & pver = pver, & pverp = pverp, & + gravit = gravit, & rair = rair, & rairv = rairv(:ncol,:pver,state%lchnk), & ! only use constituent-dependent gas constant when in WACCM-X mode. @@ -983,6 +999,7 @@ subroutine vertical_diffusion_tend( & rairi = rairi(:ncol,:pverp), & rhoi = rhoi(:ncol,:pverp), & rhoi_dry = rhoi_dry(:ncol,:pverp), & + dpidz_sq = dpidz_sq(:ncol,:pverp), & errmsg = errmsg, & errflg = errflg) @@ -1382,39 +1399,80 @@ subroutine vertical_diffusion_tend( & ! Dry static energy top boundary is zero if no molecular diffusion dse_top(:ncol) = 0._r8 + ksrf(:) = 0._r8 + tau_damp_rate(:,:) = 0._r8 + tautotx_ccpp(:) = 0._r8 + tautoty_ccpp(:) = 0._r8 + + ! Calculate surface drag rate + call implicit_surface_stress_add_drag_coefficient_run( & + ncol = ncol, & + pver = pver, & + taux = taux(:ncol), & + tauy = tauy(:ncol), & + u0 = state%u(:ncol,:pver), & + v0 = state%v(:ncol,:pver), & + ! below input/output: + ksrf = ksrf(:ncol), & + errmsg = errmsg, & + errflg = errflg) + + ! Add TMS surface drag rate + call turbulent_mountain_stress_add_drag_coefficient_run( & + ncol = ncol, & + pver = pver, & + ksrftms = ksrftms(:ncol), & + ! below input/output: + ksrf = ksrf(:ncol), & + errmsg = errmsg, & + errflg = errflg) + + ! Based on the drag coefficients, calculate wind damping rates + call vertical_diffusion_wind_damping_rate_run( & + ncol = ncol, & + pver = pver, & + gravit = gravit, & + p = p, & ! Coords1D, pressure coordinates [Pa] + ksrf = ksrf(:ncol), & + ! below output: + tau_damp_rate = tau_damp_rate(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) + + ! Add Beljaars wind damping rate + call beljaars_add_wind_damping_rate_run( & + ncol = ncol, & + pver = pver, & + dragblj = dragblj(:ncol,:pver), & + ! below input/output: + tau_damp_rate = tau_damp_rate(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) + ! If molecular diffusion is not done, use the CCPP-ized subroutine - call vertical_diffusion_compute_run( & + call vertical_diffusion_diffuse_horizontal_momentum_run( & ncol = ncol, & pver = pver, & pverp = pverp, & - ncnst = pcnst, & ztodt = ztodt, & rair = rair, & gravit = gravit, & - do_diffusion_u_v= .true., & ! horizontal winds and - do_diffusion_s = .true., & ! dry static energy are diffused - do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. + do_diffusion_uvs= .true., & ! horizontal winds and dry static energy are diffused itaures = .true., & t = state%t(:ncol,:pver), & p = p, & ! Coords1D, pressure coordinates [Pa] rhoi = rhoi(:ncol,:pverp), & taux = taux(:ncol), & tauy = tauy(:ncol), & - shflx = shflux(:ncol), & - cflx = cflux(:ncol,:pcnst), & - dse_top = dse_top(:ncol), & ! zero - kvh = kvh(:ncol,:pverp), & + tau_damp_rate = tau_damp_rate(:ncol,:pver), & ! tau damp rate from above kvm = kvm(:ncol,:pverp), & - kvq = kvq(:ncol,:pverp), & cgs = cgs(:ncol,:pverp), & cgh = cgh(:ncol,:pverp), & ksrftms = ksrftms(:ncol), & dragblj = dragblj(:ncol,:pver), & - qmincg = qmincg(:pcnst), & - rairv = rairv(:ncol,:,state%lchnk), & + dpidz_sq = dpidz_sq(:ncol,:pverp), & ! moist u0 = state%u(:ncol,:pver), & v0 = state%v(:ncol,:pver), & - q0 = state%q(:ncol,:pver,:pcnst), & dse0 = state%s(:ncol,:pver), & ! input/output tauresx = tauresx(:ncol), & @@ -1422,17 +1480,57 @@ subroutine vertical_diffusion_tend( & ! below output u = u_tmp(:ncol,:pver), & v = v_tmp(:ncol,:pver), & - q = q_tmp(:ncol,:pver,:pcnst), & dse = s_tmp(:ncol,:pver), & dtk = dtk(:ncol,:), & tautmsx = tautmsx(:ncol), & tautmsy = tautmsy(:ncol), & ! arguments for Beljaars do_beljaars = do_beljaars, & + errmsg = errmsg, & + errflg = errflg) + + ! Diffuse dry static energy + call vertical_diffusion_diffuse_dry_static_energy_run( & + ncol = ncol, & + pver = pver, & + ztodt = ztodt, & + gravit = gravit, & + p = p, & ! Coords1D, pressure coordinates [Pa] + rhoi = rhoi(:ncol,:pverp), & + shflx = shflux(:ncol), & + dse_top = dse_top(:ncol), & ! zero + kvh = kvh(:ncol,:pverp), & + cgh = cgh(:ncol,:pverp), & + dpidz_sq = dpidz_sq(:ncol,:pverp), & ! moist + ! input/output + dse = s_tmp(:ncol,:pver), & + errmsg = errmsg, & + errflg = errflg) + + ! Diffuse tracers + call vertical_diffusion_diffuse_tracers_run( & + ncol = ncol, & + pver = pver, & + ncnst = pcnst, & + ztodt = ztodt, & + rair = rair, & + gravit = gravit, & + do_diffusion_const = do_diffusion_const_wet, & ! moist constituents to diffuse + p = p, & ! Coords1D, pressure coordinates [Pa] + t = state%t(:ncol,:pver), & + rhoi = rhoi(:ncol,:pverp), & + cflx = cflux(:ncol,:pcnst), & + kvh = kvh(:ncol,:pverp), & + kvq = kvq(:ncol,:pverp), & + cgs = cgs(:ncol,:pverp), & + qmincg = qmincg(:pcnst), & + dpidz_sq = dpidz_sq(:ncol,:pverp), & ! moist ! FIXME: I think ubc can be removed here ! check from regression tests -- hplin 5/21/25 ubc_mmr = ubc_mmr(:ncol,:pcnst), & cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & + q0 = state%q(:ncol,:pver,:pcnst), & + q = q_tmp(:ncol,:pver,:pcnst), & errmsg = errmsg, & errflg = errflg) else From 3474843293e1ad938855778fe50caf4dd3064086 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Sun, 1 Jun 2025 13:40:23 -0600 Subject: [PATCH 198/466] add high-res waccmx test; update namelist defaults modified: cime_config/testdefs/testlist_cam.xml modified: cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm new file: cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands new file: cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam new file: cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm --- bld/namelist_files/namelist_defaults_cam.xml | 5 ++++ cime_config/testdefs/testlist_cam.xml | 9 ++++++ .../cam/outfrq1h_wcmxhires/shell_commands | 1 + .../cam/outfrq1h_wcmxhires/user_nl_cam | 25 +++++++++++++++++ .../cam/outfrq1h_wcmxhires/user_nl_clm | 28 +++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 99abbe1976..82c1f4713d 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -1985,6 +1985,7 @@ atm/cam/chem/trop_mam/atmsrf_ne60np4_110920.nc atm/cam/chem/trop_mam/atmsrf_ne120np4_110920.nc atm/cam/chem/trop_mam/atmsrf_ne120np4.pg2_200109.nc +atm/cam/chem/trop_mam/atmsrf_ne120np4.pg3_c210324.nc atm/cam/chem/trop_mam/atmsrf_ne240np4_110920.nc atm/cam/chem/trop_mam/atmsrf_ne0np4conus30x8_161116.nc @@ -3185,6 +3186,7 @@ 18 18 18 + 30 1 3 @@ -3198,6 +3200,7 @@ 2 4 40 + 180 1 2 @@ -3268,6 +3271,7 @@ 10 7 + 10 3 2 @@ -3275,6 +3279,7 @@ 4 2 3 + 5 -1 -1 diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 7e1a969f62..9307a1901f 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -2332,6 +2332,15 @@ + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands new file mode 100644 index 0000000000..a371a33c20 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands @@ -0,0 +1 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam new file mode 100644 index 0000000000..c4dc484285 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam @@ -0,0 +1,25 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=-1,-1,-1,-1,-1,-1 +write_nstep0 = .true. + + avgflag_pertape= 'I', 'I', 'A', 'I', 'I' + + empty_htapes=.true. + fincl1= 'Z3GM', 'T', 'U', 'V', 'OMEGA', 'ElecColDens', 'PS', 'O', 'O2', 'H', + 'QRS_TOT', 'QRL_TOT', 'KVM', 'EKGW', 'TTGW', 'UTGW_TOTAL', 'VTGW_TOTAL' + fincl2= 'Z3GM', 'T', 'U', 'V', 'OMEGA', 'UI', 'VI', 'WI', 'EDens', 'PS', 'O', 'O2', 'H', + 'OH', 'NO', 'O3', 'SIGMAHAL', 'SIGMAPED' + fincl3 ='T_24_COS', 'T_24_SIN', 'T_12_COS', 'T_12_SIN', + 'U_24_COS', 'U_24_SIN', 'U_12_COS', 'U_12_SIN', + 'V_24_COS', 'V_24_SIN', 'V_12_COS', 'V_12_SIN', + 'QRS_TOT_12_SIN', 'QRS_TOT_12_COS' + fincl4 = 'ED1', 'ED2', 'PHIM2D', 'PHIHM', 'HALL_CONDUCTANCE', 'PED_CONDUCTANCE' + fincl5 = 'ElecColDens', 'PSL' + fincl6 = ' ' + fincl7 = ' ' + fincl8 = ' ' + fincl9 = ' ' + fincl10= ' ' + + ionos_npes = 3200 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm new file mode 100644 index 0000000000..6c044e9a7b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm @@ -0,0 +1,28 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = -1 +hist_mfilt = 1 +hist_ndens = 1 + +flanduse_timeseries = ' ' From 9e914d7fcb5ee5ad48d644c1c2a3b79638005ca7 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Mon, 2 Jun 2025 07:54:45 -0600 Subject: [PATCH 199/466] correct path of default IC file modified: bld/namelist_files/namelist_defaults_cam.xml --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 82c1f4713d..86e88d1dbb 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -212,7 +212,7 @@ atm/cam/inic/se/ape_cam5_ne120np4_L30_c170419.nc atm/cam/inic/se/F2000climo_ne120pg3_mt13_01-01-00000_c200420.nc atm/cam/inic/se/ape_cam6_ne120np4_L32_c170908.nc -/glade/campaign/hao/itmodel/fvitt/hi_res_waccmx/fx2000_ne120pg3L273.001.cam.i.0002-01-01-00000.noBRCL_c250522.nc +atm/waccm/ic/fx2000_ne120pg3L273.001.cam.i.0002-01-01-00000.noBRCL_c250522.nc atm/cam/inic/homme/cami_1850-01-01_ne240np4_L26_c110314.nc atm/cam/inic/homme/cami_0000-09-01_ne240np4_L26_c061106.nc From 32f6768acd394eadf89780a66621622dfc3d887f Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Mon, 16 Jun 2025 10:14:11 -0600 Subject: [PATCH 200/466] update namelist description modified: bld/namelist_files/namelist_definition.xml --- bld/namelist_files/namelist_definition.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index f3b8dc77d1..c427d1837d 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -8193,10 +8193,9 @@ Default: 0. -Used by SE dycore to apply floor to temperature..... - -NEEDS TO BE FILLED IN - +Used by spectral element dynamical core to apply floor to temperature. +If set to a value greater than zero the floor is applied. +Otherwise, no floor is applied. Default: 0. From f5c022d66ce4789eb675a78c8ea6d1eb6e356f89 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 25 Jun 2025 14:14:29 -0400 Subject: [PATCH 201/466] Add use of new set of vdiff interstitials --- src/physics/cam/vdiff_lu_solver.F90 | 207 ------------------------ src/physics/cam/vertical_diffusion.F90 | 214 ++++++++++++++----------- 2 files changed, 123 insertions(+), 298 deletions(-) delete mode 100644 src/physics/cam/vdiff_lu_solver.F90 diff --git a/src/physics/cam/vdiff_lu_solver.F90 b/src/physics/cam/vdiff_lu_solver.F90 deleted file mode 100644 index b482606007..0000000000 --- a/src/physics/cam/vdiff_lu_solver.F90 +++ /dev/null @@ -1,207 +0,0 @@ -module vdiff_lu_solver - -! This module provides a function returning the matrix decomposition for -! an implicit finite volume solver for vertical diffusion. It accepts -! diffusion coefficients, time/grid spacing, and boundary condition -! objects, and returns a TriDiagDecomp object that can be used to diffuse -! an array for one time step with the "left_div" method. - -use coords_1d, only: Coords1D -use linear_1d_operators, only: TriDiagOp, operator(+), TriDiagDecomp - -implicit none -private -save - -! Public interfaces -public :: vd_lu_decomp -public :: fin_vol_lu_decomp - -! 8-byte real. -integer, parameter :: r8 = selected_real_kind(12) - -contains - -! ========================================================================! - -! Designed to solve the equation: -! dq/dt = c1 q'' + c2 q' + c q - -function vd_lu_decomp(dt, dp, coef_q, coef_q_d, coef_q_d2, upper_bndry, & - lower_bndry) result(decomp) - - use linear_1d_operators, only: & - identity_operator, & - diagonal_operator, & - first_derivative, & - second_derivative, & - BoundaryType - - ! ---------------------- ! - ! Input-Output Arguments ! - ! ---------------------- ! - - ! Time step. - real(r8), intent(in) :: dt - ! Grid spacing (deltas). - real(r8), USE_CONTIGUOUS intent(in) :: dp(:,:) - - ! Coefficients for q, q', and q''. - real(r8), USE_CONTIGUOUS intent(in), optional :: coef_q(:,:), & - coef_q_d(:,:), coef_q_d2(:,:) - - ! Boundary conditions (optional, default to 0 flux through boundary). - class(BoundaryType), target, intent(in), optional :: & - upper_bndry, lower_bndry - - ! Output decomposition. - type(TriDiagDecomp) :: decomp - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - - ! Operator objects. - type(TriDiagOp) :: add_term - type(TriDiagOp) :: net_operator - - ! ----------------------- ! - ! Main Computation Begins ! - ! ----------------------- ! - - if (present(coef_q)) then - net_operator = diagonal_operator(1._r8 - dt*coef_q) - else - net_operator = identity_operator(size(dp, 1), size(dp, 2) + 1) - end if - - if (present(coef_q_d)) then - add_term = first_derivative(dp, upper_bndry, lower_bndry) - call add_term%lmult_as_diag(-dt*coef_q_d) - call net_operator%add(add_term) - end if - - if (present(coef_q_d2)) then - add_term = second_derivative(dp, upper_bndry, lower_bndry) - call add_term%lmult_as_diag(-dt*coef_q_d2) - call net_operator%add(add_term) - end if - - decomp = TriDiagDecomp(net_operator) - - call net_operator%finalize() - call add_term%finalize() - -end function vd_lu_decomp - -! ========================================================================! - -! Designed to solve the equation: -! -! w * dq/dt = d/dp (D q' - v q) + c q -! -! where q is a grid-cell average, and p is the vertical coordinate -! (presumably pressure). -! -! In this function, coef_q_weight == w, coef_q_diff == D, -! coef_q_adv == v, and coef_q == c. All these are optional; omitting a -! coefficient is equivalent to setting the entire array to 0. -! -! coef_q_diff and coef_q_adv are defined at the level interfaces, while -! coef_q and coef_q_weight are grid-cell averages. - -function fin_vol_lu_decomp(dt, p, coef_q, coef_q_diff, coef_q_adv, & - coef_q_weight, upper_bndry, lower_bndry, graft_decomp) result(decomp) - - use linear_1d_operators, only: & - zero_operator, & - diagonal_operator, & - diffusion_operator, & - advection_operator, & - BoundaryType - - ! ---------------------- ! - ! Input-Output Arguments ! - ! ---------------------- ! - - ! Time step. - real(r8), intent(in) :: dt - ! Grid spacings. - type(Coords1D), intent(in) :: p - - ! Coefficients for diffusion and advection. - ! - ! The sizes must be consistent among all the coefficients that are - ! actually present, i.e. coef_q_diff and coef_q_adv should be one level - ! bigger than coef_q and coef_q_weight, and have the same column number. - real(r8), USE_CONTIGUOUS intent(in), optional :: coef_q(:,:), & - coef_q_diff(:,:), coef_q_adv(:,:), coef_q_weight(:,:) - - ! Boundary conditions (optional, default to 0 flux through boundary). - class(BoundaryType), target, intent(in), optional :: & - upper_bndry, lower_bndry - - ! Decomposition to graft onto. If this is provided, you can pass in - ! smaller coefficients. - type(TriDiagDecomp), intent(in), optional :: graft_decomp - - ! Output decomposition. - type(TriDiagDecomp) :: decomp - - ! --------------- ! - ! Local Variables ! - ! --------------- ! - - ! Operator objects. - type(TriDiagOp) :: add_term - type(TriDiagOp) :: net_operator - - ! ----------------------- ! - ! Main Computation Begins ! - ! ----------------------- ! - - ! A diffusion term is probably present, so start with that. Otherwise - ! start with an operator of all 0s. - - if (present(coef_q_diff)) then - net_operator = diffusion_operator(p, coef_q_diff, & - upper_bndry, lower_bndry) - else - net_operator = zero_operator(p%n, p%d) - end if - - ! Constant term (damping). - if (present(coef_q)) then - add_term = diagonal_operator(coef_q) - call net_operator%add(add_term) - end if - - ! Effective advection. - if (present(coef_q_adv)) then - add_term = advection_operator(p, coef_q_adv, & - upper_bndry, lower_bndry) - call net_operator%add(add_term) - end if - - ! We want I-dt*(w^-1)*A for a single time step, implicit method, where - ! A is the right-hand-side operator (i.e. what net_operator is now). - if (present(coef_q_weight)) then - call net_operator%lmult_as_diag(-dt/coef_q_weight) - else - call net_operator%lmult_as_diag(-dt) - end if - call net_operator%add_to_diag(1._r8) - - ! Decompose, grafting on an optional input decomp. The graft is a way to - ! avoid re-calculating the ending (bottom) levels when the coefficients - ! have only changed at the beginning (top), e.g. for different - ! constituents in the molecular diffusion. - decomp = TriDiagDecomp(net_operator, graft_decomp=graft_decomp) - - ! Ensure local objects are deallocated. - call net_operator%finalize() - call add_term%finalize() - -end function fin_vol_lu_decomp - -end module vdiff_lu_solver diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 26e33d9b3e..1f081f19e3 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -142,8 +142,6 @@ module vertical_diffusion logical :: waccmx_mode = .false. logical :: do_hb_above_clubb = .false. -real(r8),allocatable :: kvm_sponge(:) - contains ! =============================================================================== ! @@ -271,12 +269,16 @@ subroutine vertical_diffusion_init(pbuf2d) use holtslag_boville_diff, only: holtslag_boville_diff_init use diffusion_solver, only: vertical_diffusion_compute_init + use vertical_diffusion_sponge_layer, only: vertical_diffusion_sponge_layer_init + + use holtslag_boville_diff_interstitials, only: hb_diff_set_vertical_diffusion_top_init + use holtslag_boville_diff_interstitials, only: hb_diff_set_vertical_diffusion_top_waccmx_init use molec_diff, only : init_molec_diff use diffusion_solver_cam, only : init_vdiff use constituents, only : cnst_get_ind, cnst_get_type_byind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed use spmd_utils, only : masterproc - use ref_pres, only : press_lim_idx, pref_mid + use ref_pres, only : pref_mid use physics_buffer, only : pbuf_set_field, pbuf_get_index, physics_buffer_desc use trb_mtn_stress_cam,only : trb_mtn_stress_init use beljaars_drag_cam, only : beljaars_drag_init @@ -290,8 +292,6 @@ subroutine vertical_diffusion_init(pbuf2d) integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) integer :: k ! Vertical loop index - real(r8), parameter :: ntop_eddy_pres = 1.e-7_r8 ! Pressure below which eddy diffusion is not done in WACCM-X. (Pa) - integer :: ierr logical :: history_amwg ! output the variables used by the AMWG diag package @@ -306,46 +306,12 @@ subroutine vertical_diffusion_init(pbuf2d) ! ! add sponge layer vertical diffusion ! - if (ptop_ref>1e-1_r8.and.ptop_ref<100.0_r8) then - ! - ! CAM7 FMT (but not CAM6 top (~225 Pa) or CAM7 low top or lower) - ! - allocate(kvm_sponge(4), stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'vertical_diffusion_init: kvm_sponge allocation error = ',ierr - call endrun('vertical_diffusion_init: failed to allocate kvm_sponge array') - end if - kvm_sponge(1) = 2E6_r8 - kvm_sponge(2) = 2E6_r8 - kvm_sponge(3) = 0.5E6_r8 - kvm_sponge(4) = 0.1E6_r8 - else if (ptop_ref>1e-4_r8) then - ! - ! WACCM and WACCM-x - ! - allocate(kvm_sponge(6), stat=ierr) - if( ierr /= 0 ) then - write(iulog,*) 'vertical_diffusion_init: kvm_sponge allocation error = ',ierr - call endrun('vertical_diffusion_init: failed to allocate kvm_sponge array') - end if - kvm_sponge(1) = 2E6_r8 - kvm_sponge(2) = 2E6_r8 - kvm_sponge(3) = 1.5E6_r8 - kvm_sponge(4) = 1.0E6_r8 - kvm_sponge(5) = 0.5E6_r8 - kvm_sponge(6) = 0.1E6_r8 - end if - - if (masterproc) then - write(iulog,*)'Initializing vertical diffusion (vertical_diffusion_init)' - if (allocated(kvm_sponge)) then - write(iulog,*)'Artificial sponge layer vertical diffusion added:' - do k=1,size(kvm_sponge(:),1) - write(iulog,'(a44,i2,a17,e7.2,a8)') 'vertical diffusion coefficient at interface',k,' is increased by ', & - kvm_sponge(k),' m2 s-2' - end do - end if !allocated - end if + call vertical_diffusion_sponge_layer_init( & + amIRoot = masterproc, & + iulog = iulog, & + ptop_ref = ptop_ref, & + errmsg = errmsg, & + errflg = errflg) ! Check to see if WACCM-X is on (currently we don't care whether the ! ionosphere is on or not, since this neutral diffusion code is the @@ -396,9 +362,9 @@ subroutine vertical_diffusion_init(pbuf2d) ! ntop_eddy must be 1 or <= nbot_molec ! Currently, it is always 1 except for WACCM-X. if ( waccmx_mode ) then - ntop_eddy = press_lim_idx(ntop_eddy_pres, top=.true.) + call hb_diff_set_vertical_diffusion_top_waccmx_init(ntop_eddy=ntop_eddy, errmsg=errmsg, errflg=errflg) else - ntop_eddy = 1 + call hb_diff_set_vertical_diffusion_top_init(ntop_eddy=ntop_eddy, errmsg=errmsg, errflg=errflg) end if nbot_eddy = pver @@ -707,9 +673,14 @@ subroutine vertical_diffusion_tend( & ! CCPP-ized HB (free atmosphere) scheme use holtslag_boville_diff, only: hb_diff_free_atm_exchange_coefficients_run + ! CCPP-ized sponge layer logic + use vertical_diffusion_sponge_layer, only: vertical_diffusion_sponge_layer_run + ! CCPP-ized vertical diffusion solver (for non-WACCM-X use) ! to replace compute_vdiff ! and interstitials that have been CCPP-ized + use holtslag_boville_diff_interstitials, only: hb_diff_prepare_vertical_diffusion_inputs_run + use holtslag_boville_diff_interstitials, only: hb_free_atm_diff_prepare_vertical_diffusion_inputs_run use diffusion_solver, only: vertical_diffusion_interpolate_to_interfaces_run use diffusion_solver, only: implicit_surface_stress_add_drag_coefficient_run use diffusion_stubs, only: turbulent_mountain_stress_add_drag_coefficient_run @@ -721,7 +692,9 @@ subroutine vertical_diffusion_tend( & use diffusion_solver, only: vertical_diffusion_tendencies_run use ccpp_constituent_prop_mod, only: ccpp_const_props + use wv_saturation, only : qsat + use diffusion_solver, only: vertical_diffusion_set_dry_static_energy_at_toa_molecdiff_run use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type use diffusion_solver_cam, only : compute_vdiff @@ -911,6 +884,7 @@ subroutine vertical_diffusion_tend( & real(r8) :: thv(pcols,pver) ! virtual potential temperature [K] real(r8) :: wstar(pcols) ! convective scale velocity [m s-1] real(r8) :: bge(pcols) ! buoyancy gradient enhancement + real(r8) :: q_wv_cflx(pcols)! water vapor surface upward flux for kinematic wv fluxes ! Temporaries for CCPP-ized diffusion solver real(r8) :: ksrf(pcols) ! total surface drag coefficient @@ -918,6 +892,8 @@ subroutine vertical_diffusion_tend( & real(r8) :: tautotx_ccpp(pcols) real(r8) :: tautoty_ccpp(pcols) real(r8) :: dpidz_sq(pcols, pverp) ! square of derivative of pressure with height + logical :: itaures + character(len=64) :: scheme_name character(len=512) :: errmsg integer :: errflg @@ -936,10 +912,6 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, qpert_idx, qpert) call pbuf_get_field(pbuf, pblh_idx, pblh) - ! Set up pressure coordinates for solver calls. - p = Coords1D(state%pint(:ncol,:)) - p_dry = Coords1D(state%pintdry(:ncol,:)) - ! Get upper boundary values call ubc_get_vals( state%lchnk, ncol, state%pint, state%zi, ubc_t, ubc_mmr ) @@ -1004,6 +976,9 @@ subroutine vertical_diffusion_tend( & errflg = errflg) ! Initialize total surface stresses + ! these are used for HB diffusion scheme and later PBL diagnostics but + ! not for the vertical diffusion solver, which uses surface stresses from the coupler + ! or just zero (in the case of CLUBB) tautotx(:ncol) = cam_in%wsx(:ncol) tautoty(:ncol) = cam_in%wsy(:ncol) @@ -1021,10 +996,11 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, tautmsx_idx, tautmsx) call pbuf_get_field(pbuf, tautmsy_idx, tautmsy) - ! TODO: check if changing this to accummulate to tautotx, tautoty would change b4b-ness hplin 5/21/25 ! Add turbulent mountain stress to total surface stress - tautotx(:ncol) = cam_in%wsx(:ncol) + tautmsx(:ncol) - tautoty(:ncol) = cam_in%wsy(:ncol) + tautmsy(:ncol) + ! tautotx(:ncol) = cam_in%wsx(:ncol) + tautmsx(:ncol) + ! tautoty(:ncol) = cam_in%wsy(:ncol) + tautmsy(:ncol) + tautotx(:ncol) = tautotx(:ncol) + tautmsx(:ncol) + tautoty(:ncol) = tautoty(:ncol) + tautmsy(:ncol) ! ------------------------------------- ! ! Computation of Beljaars SGO form drag ! @@ -1040,6 +1016,64 @@ subroutine vertical_diffusion_tend( & tautotx(:ncol) = tautotx(:ncol) + taubljx(:ncol) tautoty(:ncol) = tautoty(:ncol) + taubljy(:ncol) + ! ------------------------------------- + ! Preparation of HB/HB_free inputs to vertical diffusion + ! ------------------------------------- + + ! Use CCPPized interstitial schemes for setting + ! the necessary inputs (taux,tauy,shflux,cflux) for vertical_diffusion_compute_run from the coupler + ! as well as Coords1D (p) pressure coordinates used by the solver. + + !REMOVECAM: no longer needed when pcols no longer exists + q_wv_cflx(:) = 0._kind_phys + !END REMOVECAM + + if(eddy_scheme .eq. 'CLUBB_SGS') then + ! If running CLUBB_SGS, use the hb_free_atm CCPPized interstitial. + ! + ! In this case, vertical diffusion solver only applies constituent fluxes excluding water vapor + ! (before CAM7); no fluxes are applied in CAM7. + call hb_free_atm_diff_prepare_vertical_diffusion_inputs_run( & + ncol = ncol, & + pverp = pverp, & + pcnst = pcnst, & + const_props = ccpp_const_props, & + flag_for_cflux = cam_physpkg_is("cam7"), & ! does vertical diffusion apply ANY fluxes? + cflx_from_coupler = cam_in%cflx(:ncol,:pcnst), & + pint = state%pint(:ncol,:pverp), & + ! below output + taux = taux(:ncol), & ! these are zero since handled by CLUBB. + tauy = tauy(:ncol), & ! these are zero since handled by CLUBB. + shflux = shflux(:ncol), & ! these are zero since handled by CLUBB. + cflux = cflux(:ncol,:pcnst), & ! if flag_for_cflux, contains non-wv. fluxes, otherwise 0 + itaures = itaures, & + p = p, & + q_wv_cflx = q_wv_cflx(:ncol), & ! for use in HB for kinematic water vapor flux calc. + errmsg = errmsg, & + errflg = errflg) + else + call hb_diff_prepare_vertical_diffusion_inputs_run( & + ncol = ncol, & + pverp = pverp, & + pcnst = pcnst, & + const_props = ccpp_const_props, & + wsx_from_coupler = cam_in%wsx(:ncol), & + wsy_from_coupler = cam_in%wsy(:ncol), & + shf_from_coupler = cam_in%shf(:ncol), & + cflx_from_coupler = cam_in%cflx(:ncol,:pcnst), & + pint = state%pint(:ncol,:pverp), & + ! below output + taux = taux(:ncol), & + tauy = tauy(:ncol), & + shflux = shflux(:ncol), & + cflux = cflux(:ncol,:pcnst), & + itaures = itaures, & + p = p, & + q_wv_cflx = q_wv_cflx(:ncol), & ! for use in HB for kinematic water vapor flux calc. + errmsg = errmsg, & + errflg = errflg) + endif + !----------------------------------------------------------------------- ! ! Computation of eddy diffusivities - Select appropriate PBL scheme ! !----------------------------------------------------------------------- ! @@ -1053,6 +1087,9 @@ subroutine vertical_diffusion_tend( & ! Get potential temperature. th(:ncol,:pver) = state%t(:ncol,:pver) * state%exner(:ncol,:pver) + ! Set up pressure coordinates for solver calls. + p = Coords1D(state%pint(:ncol,:)) + call eddy_diff_tend(state, pbuf, cam_in, & ztodt, p, tint, rhoi, cldn, wstarent, & kvm_in, kvh_in, ksrftms, dragblj, tauresx, tauresy, & @@ -1102,7 +1139,7 @@ subroutine vertical_diffusion_tend( & taux = tautotx(:ncol), & tauy = tautoty(:ncol), & shflx = cam_in%shf(:ncol), & - q_wv_flx = cam_in%cflx(:ncol,ixq), & + q_wv_flx = q_wv_cflx(:ncol), & ! Output variables thv = thv(:ncol,:pver), & ustar = ustar(:ncol), & @@ -1220,7 +1257,7 @@ subroutine vertical_diffusion_tend( & taux = tautotx(:ncol), & tauy = tautoty(:ncol), & shflx = cam_in%shf(:ncol), & - q_wv_flx = cam_in%cflx(:ncol,1), & ! NOTE: assumes wv at 1 (need to change to ixq?) + q_wv_flx = q_wv_cflx(:ncol), & ! Output variables thv = thv(:ncol,:pver), & ustar = ustar(:ncol), & @@ -1305,11 +1342,12 @@ subroutine vertical_diffusion_tend( & ! ! add sponge layer vertical diffusion ! - if (allocated(kvm_sponge)) then - do k=1,size(kvm_sponge(:),1) - kvm(:ncol,1) = kvm(:ncol,1)+kvm_sponge(k) - end do - end if + call vertical_diffusion_sponge_layer_run( & + ncol = ncol, & + pverp = pverp, & + kvm = kvm, & ! in/out + errmsg = errmsg, & + errflg = errflg) ! kvh (in pbuf) is used by other physics parameterizations, and as an initial guess in compute_eddy_diff ! on the next timestep. It is not updated by the compute_vdiff call below. @@ -1373,28 +1411,6 @@ subroutine vertical_diffusion_tend( & ! the explicit 'tautotx, tautoty' computed above. ! Note that the output 'tauresx,tauresy' from below subroutines are fully implicit ones. - ! This will be converted to an interstitial in SIMA for setting - ! the necessary inputs for vertical_diffusion_compute_run - if(eddy_scheme .eq. 'CLUBB_SGS') then - ! CLUBB applies some fluxes itself, but we still want constituent - ! fluxes applied here (except water vapor). - taux = 0._r8 - tauy = 0._r8 - shflux = 0._r8 - cflux(:,1) = 0._r8 - if (cam_physpkg_is("cam7")) then - ! surface fluxes applied in clubb emissions module - cflux(:,2:) = 0._r8 - else - cflux(:,2:) = cam_in%cflx(:,2:) - end if - else - taux = cam_in%wsx - tauy = cam_in%wsy - shflux = cam_in%shf - cflux = cam_in%cflx - endif - if(.not. do_molec_diff) then ! Dry static energy top boundary is zero if no molecular diffusion dse_top(:ncol) = 0._r8 @@ -1408,6 +1424,7 @@ subroutine vertical_diffusion_tend( & call implicit_surface_stress_add_drag_coefficient_run( & ncol = ncol, & pver = pver, & + do_iss = do_iss, & taux = taux(:ncol), & tauy = tauy(:ncol), & u0 = state%u(:ncol,:pver), & @@ -1457,8 +1474,9 @@ subroutine vertical_diffusion_tend( & ztodt = ztodt, & rair = rair, & gravit = gravit, & - do_diffusion_uvs= .true., & ! horizontal winds and dry static energy are diffused - itaures = .true., & + do_iss = do_iss, & + am_correction = fv_am_correction, & + itaures = itaures, & t = state%t(:ncol,:pver), & p = p, & ! Coords1D, pressure coordinates [Pa] rhoi = rhoi(:ncol,:pverp), & @@ -1525,8 +1543,7 @@ subroutine vertical_diffusion_tend( & cgs = cgs(:ncol,:pverp), & qmincg = qmincg(:pcnst), & dpidz_sq = dpidz_sq(:ncol,:pverp), & ! moist - ! FIXME: I think ubc can be removed here - ! check from regression tests -- hplin 5/21/25 + ! upper boundary conditions from ubc module ubc_mmr = ubc_mmr(:ncol,:pcnst), & cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & q0 = state%q(:ncol,:pver,:pcnst), & @@ -1539,8 +1556,19 @@ subroutine vertical_diffusion_tend( & ! Top boundary condition for dry static energy if molecular diffusion is active ! but not in WACCM-X mode if (.not. waccmx_mode) then - dse_top(:ncol) = cpairv(:ncol,1,lchnk) * tint(:ncol,1) + & - gravit * state%zi(:ncol,1) + !REMOVECAM: no longer need this after pcols no longer exists + dse_top(:) = 0._r8 + !END REMOVECAM + + call vertical_diffusion_set_dry_static_energy_at_toa_molecdiff_run( & + ncol = ncol, & + gravit = gravit, & + cpairv = cpairv(:ncol,:,state%lchnk), & + zi = state%zi(:ncol,:), & + tint = tint(:ncol,:), & + dse_top = dse_top(:ncol), & + errmsg = errmsg, & + errflg = errflg) else dse_top(:ncol) = 0._r8 end if @@ -1560,7 +1588,7 @@ subroutine vertical_diffusion_tend( & do_diffusion_s = .true., & ! dry static energy are diffused do_diffusion_const = do_diffusion_const_wet, & ! together with moist constituents. do_molecular_diffusion_const = do_molecular_diffusion_const, & - itaures = .true., & + itaures = itaures, & t = state%t(:ncol,:pver), & tint = tint(:ncol,:pverp), & p = p, & ! Coords1D, pressure coordinates [Pa] @@ -1624,6 +1652,9 @@ subroutine vertical_diffusion_tend( & kvm_temp, kvt, tint, rhoi_dry, kq_scal, cnst_mw, & mw_fac, nbot_molec) + ! Set up dry pressure coordinates for solver call. + p_dry = Coords1D(state%pintdry(:ncol,:)) + call compute_vdiff( & ncol = ncol, & pver = pver, & @@ -1634,7 +1665,7 @@ subroutine vertical_diffusion_tend( & do_diffusion_s = .false., & do_diffusion_const = do_diffusion_const_dry, & do_molecular_diffusion_const = do_molecular_diffusion_const, & - itaures = .true., & + itaures = itaures, & t = state%t(:ncol,:pver), & tint = tint(:ncol,:pverp), & p = p_dry, & ! Coords1D, pressure coordinates [Pa] @@ -1812,6 +1843,7 @@ subroutine vertical_diffusion_tend( & tend_u = ptend%u(:ncol,:pver), & tend_v = ptend%v(:ncol,:pver), & tend_q = ptend%q(:ncol,:pver,:pcnst), & + scheme_name = scheme_name, & errmsg = errmsg, & errflg = errflg) From b139ced2b7ff04b3819d23a609c9a714caa0a437 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 25 Jun 2025 16:13:22 -0400 Subject: [PATCH 202/466] Update interface; fix build bugs --- src/physics/cam/vertical_diffusion.F90 | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 1f081f19e3..75f3900a58 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -268,7 +268,6 @@ subroutine vertical_diffusion_init(pbuf2d) use eddy_diff_cam, only : eddy_diff_init use holtslag_boville_diff, only: holtslag_boville_diff_init - use diffusion_solver, only: vertical_diffusion_compute_init use vertical_diffusion_sponge_layer, only: vertical_diffusion_sponge_layer_init use holtslag_boville_diff_interstitials, only: hb_diff_set_vertical_diffusion_top_init @@ -437,13 +436,6 @@ subroutine vertical_diffusion_init(pbuf2d) call init_vdiff(r8, iulog, rair, cpair, gravit, do_iss, fv_am_correction, errstring) call handle_errmsg(errstring, subname="init_vdiff") - ! Initialize CCPP-ized diffusion solver module - call vertical_diffusion_compute_init(& - do_iss_in = do_iss, & - am_correction_in = fv_am_correction, & - errmsg = errmsg, & - errflg = errflg) - ! Set which fields will be diffused using dry or moist mixing ratios. ! All fields are diffused using moist mixing ratios by default. do_diffusion_const_dry(:) = .false. @@ -658,6 +650,8 @@ subroutine vertical_diffusion_tend( & use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_set_field use physics_types, only : physics_state, physics_ptend, physics_ptend_init + use phys_control, only: fv_am_correction + use camsrfexch, only : cam_in_t use cam_history, only : outfld @@ -1025,7 +1019,7 @@ subroutine vertical_diffusion_tend( & ! as well as Coords1D (p) pressure coordinates used by the solver. !REMOVECAM: no longer needed when pcols no longer exists - q_wv_cflx(:) = 0._kind_phys + q_wv_cflx(:) = 0._r8 !END REMOVECAM if(eddy_scheme .eq. 'CLUBB_SGS') then @@ -1496,9 +1490,9 @@ subroutine vertical_diffusion_tend( & tauresx = tauresx(:ncol), & tauresy = tauresy(:ncol), & ! below output - u = u_tmp(:ncol,:pver), & - v = v_tmp(:ncol,:pver), & - dse = s_tmp(:ncol,:pver), & + u1 = u_tmp(:ncol,:pver), & + v1 = v_tmp(:ncol,:pver), & + dse1 = s_tmp(:ncol,:pver), & dtk = dtk(:ncol,:), & tautmsx = tautmsx(:ncol), & tautmsy = tautmsy(:ncol), & @@ -1834,10 +1828,10 @@ subroutine vertical_diffusion_tend( & v0 = state%v(:ncol,:pver), & s0 = state%s(:ncol,:pver), & q0 = state%q(:ncol,:pver,:pcnst), & - u = u_tmp(:ncol,:pver), & - v = v_tmp(:ncol,:pver), & - s = s_tmp(:ncol,:pver), & - q = q_tmp(:ncol,:pver,:pcnst), & + u1 = u_tmp(:ncol,:pver), & + v1 = v_tmp(:ncol,:pver), & + s1 = s_tmp(:ncol,:pver), & + q1 = q_tmp(:ncol,:pver,:pcnst), & ! below output tend_s = ptend%s(:ncol,:pver), & tend_u = ptend%u(:ncol,:pver), & From af73501b9befbfb46218e785e5b5e02110904990 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 26 Jun 2025 12:00:18 -0400 Subject: [PATCH 203/466] Write cam_in%cflx for all constituents, not just Q --- src/control/cam_snapshot_common.F90 | 42 ++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index 0f49d27a02..232265b406 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -433,9 +433,16 @@ subroutine cam_in_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num, ! This subroutine does the addfld calls for cam_in fields !-------------------------------------------------------- + use constituents, only: cnst_name + type(cam_in_t), intent(in) :: cam_in - integer,intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num + integer, intent(in) :: cam_snapshot_before_num, cam_snapshot_after_num + + ! for constituent loop. + integer :: mcnst + character(len=64) :: fname + character(len=128) :: lname ncam_in_var = 0 @@ -464,8 +471,18 @@ subroutine cam_in_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num, call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & 'cam_in%shf', 'cam_in_shf', 'unset', horiz_only) - call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & - 'cam_in%cflx', 'cam_in_cflx', 'unset', horiz_only) + ! cam_in%cflx is sized (pcols, pcnst); because the constituent indices at the model that reads this + ! data may not match the indices in the model outputting the snapshot, + ! cam_in%cflx is split into a series of snapshot variables cam_in_cflx_(constituent name). + do mcnst = 1, pcnst + fname = 'cam_in_cflx_'//trim(cnst_name(mcnst)) + lname = 'cam_in_cflx_'//trim(cnst_name(mcnst)) + call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & + fname, lname, 'kg m-2 s-1', horiz_only) + enddo + + ! call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & + ! 'cam_in%cflx', 'cam_in_cflx', 'unset', horiz_only) call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & 'cam_in%wsx', 'cam_in_wsx', 'unset', horiz_only) @@ -988,11 +1005,15 @@ end subroutine tend_snapshot_all_outfld subroutine cam_in_snapshot_all_outfld(lchnk, file_num, cam_in) + use constituents, only: cnst_name + integer, intent(in) :: lchnk integer, intent(in) :: file_num type(cam_in_t), intent(in) :: cam_in integer :: i + integer :: mcnst + character(len=64) :: fname do i=1, ncam_in_var @@ -1057,7 +1078,11 @@ subroutine cam_in_snapshot_all_outfld(lchnk, file_num, cam_in) call outfld(cam_in_snapshot(i)%standard_name, cam_in%dstflx, pcols, lchnk) case default - call endrun('ERROR in cam_in_snapshot_all_outfld: no match found for '//trim(cam_in_snapshot(i)%ddt_string)) + if (cam_in_snapshot(i)%ddt_string(1:12) == 'cam_in_cflx_') then + ! This case is handled below in a loop (not looked up here as it would be i*pcnst iterations) + else + call endrun('ERROR in cam_in_snapshot_all_outfld: no match found for '//trim(cam_in_snapshot(i)%ddt_string)) + endif end select @@ -1065,6 +1090,15 @@ subroutine cam_in_snapshot_all_outfld(lchnk, file_num, cam_in) end do + ! Handle cam_in%cflx constituent loop + do mcnst = 1, pcnst + fname = 'cam_in_cflx_'//trim(cnst_name(mcnst)) + + call cam_history_snapshot_activate(trim(fname), file_num) + call outfld(fname, cam_in%cflx(:,mcnst), pcols, lchnk) + call cam_history_snapshot_deactivate(trim(fname)) + end do + end subroutine cam_in_snapshot_all_outfld subroutine cam_out_snapshot_all_outfld(lchnk, file_num, cam_out) From 55a343e12f8212d83a258a9701a65fa86544ffa0 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 26 Jun 2025 20:22:28 -0400 Subject: [PATCH 204/466] Fix typo --- src/control/cam_history.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/cam_history.F90 b/src/control/cam_history.F90 index 5957ac7252..21080d3462 100644 --- a/src/control/cam_history.F90 +++ b/src/control/cam_history.F90 @@ -7023,7 +7023,7 @@ end subroutine cam_history_snapshot_deactivate subroutine cam_history_snapshot_activate(name, tape) - ! This subroutine activates (set aftflag to true) for the requested tape number + ! This subroutine activates (set actflag to true) for the requested tape number character(len=*), intent(in) :: name integer, intent(in) :: tape From d2d37c65a2342dfae6fd222eb899aad35eac2ce8 Mon Sep 17 00:00:00 2001 From: Kuan-Chih Wang Date: Wed, 25 Jun 2025 17:24:17 -0600 Subject: [PATCH 205/466] Add the "_mpas" suffix to MPAS-specific output variables --- src/dynamics/mpas/stepon.F90 | 72 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/dynamics/mpas/stepon.F90 b/src/dynamics/mpas/stepon.F90 index 6e83a3dc60..2367126f2d 100644 --- a/src/dynamics/mpas/stepon.F90 +++ b/src/dynamics/mpas/stepon.F90 @@ -52,26 +52,26 @@ subroutine stepon_init(dyn_in, dyn_out) !---------------------------------------------------------------------------- ! dycore state variables on MPAS grids - call addfld ('u', (/ 'lev' /), 'A', 'm/s', 'normal velocity at edges', gridname='mpas_edge') - call addfld ('w', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity', gridname='mpas_cell') - call addfld ('theta', (/ 'lev' /), 'A', 'K', 'potential temperature', gridname='mpas_cell') - call addfld ('rho', (/ 'lev' /), 'A', 'kg/m^3', 'dry air density', gridname='mpas_cell') - call addfld ('qv', (/ 'lev' /), 'A', 'kg/kg', 'water vapor dry mmr', gridname='mpas_cell') - call addfld ('uReconstructZonal', (/ 'lev' /), 'A', 'm/s', & + call addfld ('u_mpas', (/ 'lev' /), 'A', 'm/s', 'normal velocity at edges', gridname='mpas_edge') + call addfld ('w_mpas', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity', gridname='mpas_cell') + call addfld ('theta_mpas', (/ 'lev' /), 'A', 'K', 'potential temperature', gridname='mpas_cell') + call addfld ('rho_mpas', (/ 'lev' /), 'A', 'kg/m^3', 'dry air density', gridname='mpas_cell') + call addfld ('qv_mpas', (/ 'lev' /), 'A', 'kg/kg', 'water vapor dry mmr', gridname='mpas_cell') + call addfld ('uReconstructZonal_mpas', (/ 'lev' /), 'A', 'm/s', & 'zonal velocity at cell centers', gridname='mpas_cell') - call addfld ('uReconstructMeridional', (/ 'lev' /), 'A', 'm/s', & + call addfld ('uReconstructMeridional_mpas', (/ 'lev' /), 'A', 'm/s', & 'meridional velocity at cell centers', gridname='mpas_cell') - call addfld ('divergence', (/ 'lev' /), 'A', '1/s', & + call addfld ('divergence_mpas', (/ 'lev' /), 'A', '1/s', & 'Horizontal velocity divergence at cell center', gridname='mpas_cell') - call addfld ('vorticity', (/ 'lev' /), 'A', '1/s', & + call addfld ('vorticity_mpas', (/ 'lev' /), 'A', '1/s', & 'Relative vorticity at vertices', gridname='mpas_vertex') ! physics forcings on MPAS grids - call addfld ('ru_tend', (/ 'lev' /), 'A', 'kg/m^2/s', & + call addfld ('ru_tend_mpas', (/ 'lev' /), 'A', 'kg/m^2/s', & 'physics tendency of normal horizontal momentum', gridname='mpas_edge') - call addfld ('rtheta_tend', (/ 'lev' /), 'A', 'kg K/m^3/s', & + call addfld ('rtheta_tend_mpas', (/ 'lev' /), 'A', 'kg K/m^3/s', & 'physics tendency of rho*theta/zz', gridname='mpas_cell') - call addfld ('rho_tend', (/ 'lev' /), 'A', 'kg/m^3/s', & + call addfld ('rho_tend_mpas', (/ 'lev' /), 'A', 'kg/m^3/s', & 'physics tendency of dry air density', gridname='mpas_cell') ! get aerosol properties @@ -235,7 +235,7 @@ subroutine write_dynvar(dyn_out) nVerticesSolve = dyn_out%nVerticesSolve qv_idx = dyn_out%index_qv - if (hist_fld_active('u')) then + if (hist_fld_active('u_mpas')) then allocate(arr2d(nEdgesSolve,plev), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) do k = 1, plev @@ -244,11 +244,11 @@ subroutine write_dynvar(dyn_out) arr2d(i,k) = dyn_out%uperp(kk,i) end do end do - call outfld('u', arr2d, nEdgesSolve, 1) + call outfld('u_mpas', arr2d, nEdgesSolve, 1) deallocate(arr2d) end if - if (hist_fld_active('w')) then + if (hist_fld_active('w_mpas')) then allocate(arr2d(nCellsSolve,plevp), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) do k = 1, plevp @@ -257,76 +257,76 @@ subroutine write_dynvar(dyn_out) arr2d(i,k) = dyn_out%w(kk,i) end do end do - call outfld('w', arr2d, nCellsSolve, 1) + call outfld('w_mpas', arr2d, nCellsSolve, 1) deallocate(arr2d) end if allocate(arr2d(nCellsSolve,plev), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) - if (hist_fld_active('theta')) then + if (hist_fld_active('theta_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%theta(kk,i) end do end do - call outfld('theta', arr2d, nCellsSolve, 1) + call outfld('theta_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('rho')) then + if (hist_fld_active('rho_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%rho(kk,i) end do end do - call outfld('rho', arr2d, nCellsSolve, 1) + call outfld('rho_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('qv')) then + if (hist_fld_active('qv_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%tracers(qv_idx,kk,i) end do end do - call outfld('qv', arr2d, nCellsSolve, 1) + call outfld('qv_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('uReconstructZonal')) then + if (hist_fld_active('uReconstructZonal_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%ux(kk,i) end do end do - call outfld('uReconstructZonal', arr2d, nCellsSolve, 1) + call outfld('uReconstructZonal_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('uReconstructMeridional')) then + if (hist_fld_active('uReconstructMeridional_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%uy(kk,i) end do end do - call outfld('uReconstructMeridional', arr2d, nCellsSolve, 1) + call outfld('uReconstructMeridional_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('divergence')) then + if (hist_fld_active('divergence_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_out%divergence(kk,i) end do end do - call outfld('divergence', arr2d, nCellsSolve, 1) + call outfld('divergence_mpas', arr2d, nCellsSolve, 1) end if deallocate(arr2d) - if (hist_fld_active('vorticity')) then + if (hist_fld_active('vorticity_mpas')) then allocate(arr2d(nVerticesSolve,plev), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) do k = 1, plev @@ -335,7 +335,7 @@ subroutine write_dynvar(dyn_out) arr2d(i,k) = dyn_out%vorticity(kk,i) end do end do - call outfld('vorticity', arr2d, nVerticesSolve, 1) + call outfld('vorticity_mpas', arr2d, nVerticesSolve, 1) deallocate(arr2d) end if @@ -369,7 +369,7 @@ subroutine write_forcings(dyn_in) nCellsSolve = dyn_in%nCellsSolve nEdgesSolve = dyn_in%nEdgesSolve - if (hist_fld_active('ru_tend')) then + if (hist_fld_active('ru_tend_mpas')) then allocate(arr2d(nEdgesSolve,plev), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) do k = 1, plev @@ -378,31 +378,31 @@ subroutine write_forcings(dyn_in) arr2d(i,k) = dyn_in%ru_tend(kk,i) end do end do - call outfld('ru_tend', arr2d, nEdgesSolve, 1) + call outfld('ru_tend_mpas', arr2d, nEdgesSolve, 1) deallocate(arr2d) end if allocate(arr2d(nCellsSolve,plev), stat=ierr) if( ierr /= 0 ) call endrun(subname//':failed to allocate arr2d array at line:'//int2str(__LINE__)) - if (hist_fld_active('rtheta_tend')) then + if (hist_fld_active('rtheta_tend_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_in%rtheta_tend(kk,i) end do end do - call outfld('rtheta_tend', arr2d, nCellsSolve, 1) + call outfld('rtheta_tend_mpas', arr2d, nCellsSolve, 1) end if - if (hist_fld_active('rho_tend')) then + if (hist_fld_active('rho_tend_mpas')) then do k = 1, plev kk = plev - k + 1 do i = 1, nCellsSolve arr2d(i,k) = dyn_in%rho_tend(kk,i) end do end do - call outfld('rho_tend', arr2d, nCellsSolve, 1) + call outfld('rho_tend_mpas', arr2d, nCellsSolve, 1) end if deallocate(arr2d) From c3af4526baf22c9a4b8342a7be043c256b7716eb Mon Sep 17 00:00:00 2001 From: Kuan-Chih Wang Date: Wed, 25 Jun 2025 17:27:44 -0600 Subject: [PATCH 206/466] Change the dimension name of MPAS-specific output variables from "nCells" to "ncol" --- src/dynamics/mpas/stepon.F90 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dynamics/mpas/stepon.F90 b/src/dynamics/mpas/stepon.F90 index 2367126f2d..934f4a4377 100644 --- a/src/dynamics/mpas/stepon.F90 +++ b/src/dynamics/mpas/stepon.F90 @@ -53,16 +53,16 @@ subroutine stepon_init(dyn_in, dyn_out) ! dycore state variables on MPAS grids call addfld ('u_mpas', (/ 'lev' /), 'A', 'm/s', 'normal velocity at edges', gridname='mpas_edge') - call addfld ('w_mpas', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity', gridname='mpas_cell') - call addfld ('theta_mpas', (/ 'lev' /), 'A', 'K', 'potential temperature', gridname='mpas_cell') - call addfld ('rho_mpas', (/ 'lev' /), 'A', 'kg/m^3', 'dry air density', gridname='mpas_cell') - call addfld ('qv_mpas', (/ 'lev' /), 'A', 'kg/kg', 'water vapor dry mmr', gridname='mpas_cell') + call addfld ('w_mpas', (/ 'ilev' /), 'A', 'm/s', 'vertical velocity', gridname='cam_cell') + call addfld ('theta_mpas', (/ 'lev' /), 'A', 'K', 'potential temperature', gridname='cam_cell') + call addfld ('rho_mpas', (/ 'lev' /), 'A', 'kg/m^3', 'dry air density', gridname='cam_cell') + call addfld ('qv_mpas', (/ 'lev' /), 'A', 'kg/kg', 'water vapor dry mmr', gridname='cam_cell') call addfld ('uReconstructZonal_mpas', (/ 'lev' /), 'A', 'm/s', & - 'zonal velocity at cell centers', gridname='mpas_cell') + 'zonal velocity at cell centers', gridname='cam_cell') call addfld ('uReconstructMeridional_mpas', (/ 'lev' /), 'A', 'm/s', & - 'meridional velocity at cell centers', gridname='mpas_cell') + 'meridional velocity at cell centers', gridname='cam_cell') call addfld ('divergence_mpas', (/ 'lev' /), 'A', '1/s', & - 'Horizontal velocity divergence at cell center', gridname='mpas_cell') + 'Horizontal velocity divergence at cell center', gridname='cam_cell') call addfld ('vorticity_mpas', (/ 'lev' /), 'A', '1/s', & 'Relative vorticity at vertices', gridname='mpas_vertex') @@ -70,9 +70,9 @@ subroutine stepon_init(dyn_in, dyn_out) call addfld ('ru_tend_mpas', (/ 'lev' /), 'A', 'kg/m^2/s', & 'physics tendency of normal horizontal momentum', gridname='mpas_edge') call addfld ('rtheta_tend_mpas', (/ 'lev' /), 'A', 'kg K/m^3/s', & - 'physics tendency of rho*theta/zz', gridname='mpas_cell') + 'physics tendency of rho*theta/zz', gridname='cam_cell') call addfld ('rho_tend_mpas', (/ 'lev' /), 'A', 'kg/m^3/s', & - 'physics tendency of dry air density', gridname='mpas_cell') + 'physics tendency of dry air density', gridname='cam_cell') ! get aerosol properties aero_props_obj => aerosol_properties_object() From e0801a828085cfa89ae85d9496982e7ea75419da Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 30 Jun 2025 12:15:01 -0400 Subject: [PATCH 207/466] testing updates --- cime_config/testdefs/testlist_cam.xml | 54 +++---------- .../cam/ghgrmp_e8/shell_commands | 6 -- .../testmods_dirs/cam/ghgrmp_e8/user_nl_cpl | 2 - .../cam/lonlat_fv_diags/shell_commands | 2 + .../user_nl_cam | 11 ++- .../user_nl_clm | 0 .../cam/nuopc_cap/shell_commands | 6 -- .../testmods_dirs/cam/nuopc_cap/user_nl_cam | 6 -- .../testmods_dirs/cam/nuopc_cap/user_nl_clm | 24 ------ .../testmods_dirs/cam/nuopc_cap/user_nl_cpl | 25 ------- .../cam/outfrq3s_am/shell_commands | 6 -- .../testmods_dirs/cam/outfrq3s_am/user_nl_cam | 12 --- .../testmods_dirs/cam/outfrq3s_am/user_nl_clm | 27 ------- .../outfrq3s_co2cycle_usecase/shell_commands | 5 -- .../cam/outfrq3s_co2cycle_usecase/user_nl_cam | 5 -- .../cam/outfrq3s_co2cycle_usecase/user_nl_clm | 27 ------- .../cam/outfrq3s_ttrac_usecase/shell_commands | 4 - .../cam/outfrq3s_ttrac_usecase/user_nl_cam | 6 -- .../cam/outfrq3s_ttrac_usecase/user_nl_clm | 27 ------- .../cam/outfrq3s_ttrac_usecase/user_nl_cpl | 2 - .../cam/outfrq3s_unicon/shell_commands | 5 -- .../cam/outfrq3s_unicon/user_nl_cam | 5 -- .../cam/outfrq3s_unicon/user_nl_clm | 27 ------- .../cam/outfrq3s_unicon/user_nl_cpl | 2 - doc/ChangeLog | 75 +++++++++++++++++++ 25 files changed, 99 insertions(+), 272 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cpl create mode 100644 cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/shell_commands rename cime_config/testdefs/testmods_dirs/cam/{ghgrmp_e8 => lonlat_fv_diags}/user_nl_cam (90%) rename cime_config/testdefs/testmods_dirs/cam/{ghgrmp_e8 => lonlat_fv_diags}/user_nl_clm (100%) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/nuopc_cap/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cpl diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index e493df64fc..a9aeeec04b 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -9,7 +9,6 @@ - @@ -28,7 +27,6 @@ - @@ -53,6 +51,16 @@ + + + + + + + + + + @@ -319,16 +327,6 @@ - - - - - - - - - - @@ -449,16 +447,7 @@ - - - - - - - - - - + @@ -469,16 +458,6 @@ - - - - - - - - - - @@ -1173,16 +1152,7 @@ - - - - - - - - - - + diff --git a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/shell_commands b/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/shell_commands deleted file mode 100644 index 4aa3804a5b..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="1967-12-31" -./xmlchange START_TOD=82800 -./xmlchange CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" --append -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/shell_commands b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/shell_commands new file mode 100644 index 0000000000..eb40ad83e0 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/shell_commands @@ -0,0 +1,2 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL diff --git a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_cam similarity index 90% rename from cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cam rename to cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_cam index 579aff2cbc..9740f5b160 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_cam @@ -2,7 +2,15 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 nhtfrq=3,3,3,3,3,3 inithist='ENDOFRUN' -scenario_ghg='RAMPED' + +fv_am_fixer = .true. +fv_am_fix_lbl = .true. +fv_am_correction = .true. +fv_am_diag = .true. + +do_circulation_diags = .true. +fincl1='MSKtem','VTHzm','UVzm','UWzm','Uzm','Vzm','Wzm','THzm' + FINCL2LONLAT = '225e:247e_31n:53n' , '112e:135e_16s:9s' , '157e:179e_11.5s:11.5n', '290e:304e_21s:9s' , '240e:256e_51n:58n' , '160e:211e_30s:30n' , '0e_89s' , '180e_0s' , '0w_0n' , @@ -26,3 +34,4 @@ FINCL4 = 'T:I ','U:I ','V:I ','Q:I ','DTCOND:I ', 'PS:I ','PHIS:I ','FU ','FV ','RELHUM:I ', collect_column_output = .false.,.false.,.true.,.true. + diff --git a/cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm similarity index 100% rename from cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/user_nl_clm rename to cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/shell_commands b/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/shell_commands deleted file mode 100644 index 9cba7ba335..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -./xmlchange USE_ESMF_LIB=TRUE -comp_interface=`./xmlquery --value COMP_INTERFACE` -if [ $comp_interface == 'mct' ] -then - ./xmlchange COMPARE_TO_NUOPC=TRUE -fi diff --git a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cam deleted file mode 100644 index d81d627d06..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cam +++ /dev/null @@ -1,6 +0,0 @@ -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -nhtfrq = 1 -mfilt = 1 -ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_clm deleted file mode 100644 index 72a5b1455e..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_clm +++ /dev/null @@ -1,24 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig .true. setting -! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! or with CLM_FORCE_COLDSTART to do a cold start -! or set it with an explicit filename here. -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 1 -hist_mfilt = 1 -hist_ndens = 1 \ No newline at end of file diff --git a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cpl deleted file mode 100644 index 11030b037f..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/nuopc_cap/user_nl_cpl +++ /dev/null @@ -1,25 +0,0 @@ -!------------------------------------------------------------------------ -! Users should ONLY USE user_nl_cpl to change namelists variables -! for namelist variables in drv_in (except for the ones below) and -! any keyword/values in seq_maps.rc -! Users should add ALL user specific namelist and seq_maps.rc changes below -! using the following syntax -! namelist_var = new_namelist_value -! or -! mapname = new_map_name -! For example to change the default value of ocn2atm_fmapname to 'foo' use -! ocn2atm_fmapname = 'foo' -! -! Note that some namelist variables MAY NOT be changed in user_nl_cpl - -! they are defined in a $CASEROOT xml file and must be changed with -! xmlchange. -! -! For example, rather than set username to 'foo' in user_nl_cpl, call -! ./xmlchange USER=foo -!------------------------------------------------------------------------ -orb_eccen = 0. -orb_mvelp = 0. -orb_obliq = 0. -orb_mode = "fixed_parameters" -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/shell_commands deleted file mode 100644 index 317c3f8d78..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_NML_USE_CASE=UNSET -./xmlchange RUN_STARTDATE="19950101" -./xmlchange REST_OPTION=nsteps -./xmlchange REST_N=3 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_cam deleted file mode 100644 index 9d4e2d49ed..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_cam +++ /dev/null @@ -1,12 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -pbuf_global_allocate=.false. - -fv_am_fixer = .true. -fv_am_fix_lbl = .true. -fv_am_correction = .true. -fv_am_diag = .true. -do_circulation_diags = .true. -fincl1='MSKtem','VTHzm','UVzm','UWzm','Uzm','Vzm','Wzm','THzm' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/shell_commands deleted file mode 100644 index c6a6b0e6ba..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange -append CAM_CONFIG_OPTS="-co2_cycle" -./xmlchange RUN_STARTDATE="19950101" - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_cam deleted file mode 100644 index b8f943cd5f..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_cam +++ /dev/null @@ -1,5 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -pbuf_global_allocate=.false. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/shell_commands deleted file mode 100644 index f28dcffbc1..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange -append CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="19950101" diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cam deleted file mode 100644 index 2f9c80481d..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cam +++ /dev/null @@ -1,6 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -pbuf_global_allocate=.false. - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/shell_commands deleted file mode 100644 index 0133fc98e9..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ -./xmlchange --append CAM_CONFIG_OPTS="-unicon" -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_NML_USE_CASE=UNSET -./xmlchange RUN_STARTDATE="19950101" diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cam deleted file mode 100644 index b8f943cd5f..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cam +++ /dev/null @@ -1,5 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -pbuf_global_allocate=.false. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/doc/ChangeLog b/doc/ChangeLog index 07dab008a2..147bab8b2b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,80 @@ =============================================================== +Tag name: +Originator(s): eaton +Date: +One-line Summary: testing updates +Github PR URL: + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: + +List all files eliminated: + +cime_config/testdefs/testmods_dirs/cam/ghgrmp_e8/* +cime_config/testdefs/testmods_dirs/cam/nuopc_cap/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_am/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_co2cycle_usecase/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/* +. no longer needed - associated tests have been removed or refactored. + + +List all files added and what they do: + +cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* +. The limited area outputs are moved to here from ghgrmp_e8 +. The FV angular momentum fixer/diags and circulation diags are move here + from outfrq3s_am + + + +List all existing files that have been modified, and describe the changes: + +cime_config/testdefs/testslist_cam.xml +. remove these cam6 tests that are testing features covered by other tests. + ERP_Ln9.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s + ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s + ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase + SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase +. move the ERI test from nag to gnu, update mask, refactor testmods, and + change the compset to FHIST (there were no ERI tests for cam6 F-compsets). + replace + ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 and + ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am + by + ERI_D_Ln18.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: + +=============================================================== +=============================================================== + Tag name: cam6_4_099 Originator(s): eaton Date: 24 June 2025 From 07043efe9aa6df603c5e771287a1cf69bb334ec6 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 30 Jun 2025 15:16:58 -0400 Subject: [PATCH 208/466] Remove unused arguments --- src/physics/cam/vertical_diffusion.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 75f3900a58..42eec51d89 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1478,8 +1478,6 @@ subroutine vertical_diffusion_tend( & tauy = tauy(:ncol), & tau_damp_rate = tau_damp_rate(:ncol,:pver), & ! tau damp rate from above kvm = kvm(:ncol,:pverp), & - cgs = cgs(:ncol,:pverp), & - cgh = cgh(:ncol,:pverp), & ksrftms = ksrftms(:ncol), & dragblj = dragblj(:ncol,:pver), & dpidz_sq = dpidz_sq(:ncol,:pverp), & ! moist From e8e95031ad5bc2458533a680f97bd8f794a831a7 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 30 Jun 2025 15:19:02 -0400 Subject: [PATCH 209/466] Remove unused code from comment --- src/control/cam_snapshot_common.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index 232265b406..859295a4ba 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -481,9 +481,6 @@ subroutine cam_in_snapshot_init(cam_snapshot_before_num, cam_snapshot_after_num, fname, lname, 'kg m-2 s-1', horiz_only) enddo - ! call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & - ! 'cam_in%cflx', 'cam_in_cflx', 'unset', horiz_only) - call snapshot_addfld( ncam_in_var, cam_in_snapshot, cam_snapshot_before_num, cam_snapshot_after_num, & 'cam_in%wsx', 'cam_in_wsx', 'unset', horiz_only) From 3ce67c281299ff6cf7718014afa0e66675a14465 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 30 Jun 2025 14:34:12 -0600 Subject: [PATCH 210/466] fixes for file-io integration --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/cam/cloud_rad_props.F90 | 206 ++------- src/physics/rrtmg/radiation.F90 | 9 +- src/physics/rrtmgp/radiation.F90 | 638 ++------------------------ src/utils/cam_ccpp/pio_reader_sub.F90 | 8 + 6 files changed, 96 insertions(+), 769 deletions(-) create mode 100644 src/utils/cam_ccpp/pio_reader_sub.F90 diff --git a/.gitmodules b/.gitmodules index 5af4a6c4aa..3b830324f9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 71e4edc8ea0794ec0eb8e50d58a4b78e3c4ef341 + fxtag = e504efbd115b4b8da2037fa058139e221b0ae834 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 71e4edc8ea..e504efbd11 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 71e4edc8ea0794ec0eb8e50d58a4b78e3c4ef341 +Subproject commit e504efbd115b4b8da2037fa058139e221b0ae834 diff --git a/src/physics/cam/cloud_rad_props.F90 b/src/physics/cam/cloud_rad_props.F90 index 5d0151d0ed..f4eaf4a11a 100644 --- a/src/physics/cam/cloud_rad_props.F90 +++ b/src/physics/cam/cloud_rad_props.F90 @@ -78,22 +78,26 @@ module cloud_rad_props contains !============================================================================== -subroutine cloud_rad_props_init(nmu_out, nlambda_out, n_g_d_out, & - abs_lw_liq_out, abs_lw_ice_out, g_mu_out, g_lambda_out, & - g_d_eff_out, tiny_out) +subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out, & + ssa_sw_liq_out, asm_sw_liq_out, ext_sw_ice_out, ssa_sw_ice_out, & + asm_sw_ice_out, g_mu_out, g_lambda_out, g_d_eff_out, tiny_out) use netcdf - use spmd_utils, only: masterproc - use ioFileMod, only: getfil - use error_messages, only: handle_ncerr - use cam_abortutils, only: handle_allocate_error + use spmd_utils, only: masterproc + use ioFileMod, only: getfil + use error_messages, only: handle_ncerr + use cam_abortutils, only: handle_allocate_error + use rrtmgp_cloud_optics_setup, only: rrtmgp_cloud_optics_setup_init #if ( defined SPMD ) use mpishorthand #endif - integer, intent(out) :: nmu_out - integer, intent(out) :: nlambda_out - integer, intent(out) :: n_g_d_out real(r8), allocatable, intent(out) :: abs_lw_liq_out(:,:,:) + real(r8), allocatable, intent(out) :: ext_sw_liq_out(:,:,:) + real(r8), allocatable, intent(out) :: asm_sw_liq_out(:,:,:) + real(r8), allocatable, intent(out) :: ssa_sw_liq_out(:,:,:) real(r8), allocatable, intent(out) :: abs_lw_ice_out(:,:) + real(r8), allocatable, intent(out) :: ext_sw_ice_out(:,:) + real(r8), allocatable, intent(out) :: asm_sw_ice_out(:,:) + real(r8), allocatable, intent(out) :: ssa_sw_ice_out(:,:) real(r8), allocatable, intent(out) :: g_mu_out(:) real(r8), allocatable, intent(out) :: g_lambda_out(:,:) real(r8), allocatable, intent(out) :: g_d_eff_out(:) @@ -138,170 +142,42 @@ subroutine cloud_rad_props_init(nmu_out, nlambda_out, n_g_d_out, & call cnst_get_ind('CLDICE', ixcldice) call cnst_get_ind('CLDLIQ', ixcldliq) - ! read liquid cloud optics - if (masterproc) then - call getfil( trim(liquidfile), locfn, 0) - call handle_ncerr( nf90_open(locfn, NF90_NOWRITE, ncid), 'liquid optics file missing') - write(iulog,*)' reading liquid cloud optics from file ',locfn - - call handle_ncerr(nf90_inq_dimid( ncid, 'lw_band', dimid), 'getting lw_band dim') - call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nlwbands), 'getting n lw bands') - if (f_nlwbands /= nlwbands) call endrun(sub//': number of lw bands does not match') - - call handle_ncerr(nf90_inq_dimid( ncid, 'sw_band', dimid), 'getting sw_band_dim') - call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nswbands), 'getting n sw bands') - if (f_nswbands /= nswbands) call endrun(sub//': number of sw bands does not match') - - call handle_ncerr(nf90_inq_dimid( ncid, 'mu', mudimid), 'getting mu dim') - call handle_ncerr(nf90_inquire_dimension( ncid, mudimid, len=nmu), 'getting n mu samples') - - call handle_ncerr(nf90_inq_dimid( ncid, 'lambda_scale', lambdadimid), 'getting lambda dim') - call handle_ncerr(nf90_inquire_dimension( ncid, lambdadimid, len=nlambda), 'getting n lambda samples') - end if ! if (masterproc) - -#if ( defined SPMD ) - call mpibcast(nmu, 1, mpiint, 0, mpicom, ierr) - call mpibcast(nlambda, 1, mpiint, 0, mpicom, ierr) -#endif - - allocate(g_mu(nmu)) - allocate(g_lambda(nmu,nlambda)) - allocate(ext_sw_liq(nmu,nlambda,nswbands) ) - allocate(ssa_sw_liq(nmu,nlambda,nswbands)) - allocate(asm_sw_liq(nmu,nlambda,nswbands)) - allocate(abs_lw_liq(nmu,nlambda,nlwbands)) - - if (masterproc) then - call handle_ncerr( nf90_inq_varid(ncid, 'mu', mu_id),& - 'cloud optics mu get') - call handle_ncerr( nf90_get_var(ncid, mu_id, g_mu),& - 'read cloud optics mu values') - - call handle_ncerr( nf90_inq_varid(ncid, 'lambda', lambda_id),& - 'cloud optics lambda get') - call handle_ncerr( nf90_get_var(ncid, lambda_id, g_lambda),& - 'read cloud optics lambda values') - - call handle_ncerr( nf90_inq_varid(ncid, 'k_ext_sw', ext_sw_liq_id),& - 'cloud optics ext_sw_liq get') - call handle_ncerr( nf90_get_var(ncid, ext_sw_liq_id, ext_sw_liq),& - 'read cloud optics ext_sw_liq values') - - call handle_ncerr( nf90_inq_varid(ncid, 'ssa_sw', ssa_sw_liq_id),& - 'cloud optics ssa_sw_liq get') - call handle_ncerr( nf90_get_var(ncid, ssa_sw_liq_id, ssa_sw_liq),& - 'read cloud optics ssa_sw_liq values') - - call handle_ncerr( nf90_inq_varid(ncid, 'asm_sw', asm_sw_liq_id),& - 'cloud optics asm_sw_liq get') - call handle_ncerr( nf90_get_var(ncid, asm_sw_liq_id, asm_sw_liq),& - 'read cloud optics asm_sw_liq values') - - call handle_ncerr( nf90_inq_varid(ncid, 'k_abs_lw', abs_lw_liq_id),& - 'cloud optics abs_lw_liq get') - call handle_ncerr( nf90_get_var(ncid, abs_lw_liq_id, abs_lw_liq),& - 'read cloud optics abs_lw_liq values') - - call handle_ncerr( nf90_close(ncid), 'liquid optics file missing') - end if ! if masterproc - -#if ( defined SPMD ) - call mpibcast(g_mu, nmu, mpir8, 0, mpicom, ierr) - call mpibcast(g_lambda, nmu*nlambda, mpir8, 0, mpicom, ierr) - call mpibcast(ext_sw_liq, nmu*nlambda*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(ssa_sw_liq, nmu*nlambda*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(asm_sw_liq, nmu*nlambda*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(abs_lw_liq, nmu*nlambda*nlwbands, mpir8, 0, mpicom, ierr) -#endif - ! Convert kext from m^2/Volume to m^2/Kg - ext_sw_liq = ext_sw_liq / 0.9970449e3_r8 - abs_lw_liq = abs_lw_liq / 0.9970449e3_r8 - - ! read ice cloud optics - if (masterproc) then - call getfil( trim(icefile), locfn, 0) - call handle_ncerr( nf90_open(locfn, NF90_NOWRITE, ncid), 'ice optics file missing') - write(iulog,*)' reading ice cloud optics from file ',locfn - call handle_ncerr(nf90_inq_dimid( ncid, 'lw_band', dimid), 'getting lw_band dim') - call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nlwbands), 'getting n lw bands') - if (f_nlwbands /= nlwbands) then - call endrun(sub//': number of lw bands does not match') - end if - call handle_ncerr(nf90_inq_dimid( ncid, 'sw_band', dimid), 'getting sw_band_dim') - call handle_ncerr(nf90_inquire_dimension( ncid, dimid, len=f_nswbands), 'getting n sw bands') - if (f_nswbands /= nswbands) then - call endrun(sub//': number of sw bands does not match') - end if - call handle_ncerr(nf90_inq_dimid( ncid, 'd_eff', d_dimid), 'getting deff dim') - call handle_ncerr(nf90_inquire_dimension( ncid, d_dimid, len=n_g_d), 'getting n deff samples') - end if ! if (masterproc) - -#if ( defined SPMD ) - call mpibcast(n_g_d, 1, mpiint, 0, mpicom, ierr) -! call mpibcast(nswbands, 1, mpiint, 0, mpicom, ierr) -! call mpibcast(nlwbands, 1, mpiint, 0, mpicom, ierr) -#endif - - allocate(g_d_eff(n_g_d)) - allocate(ext_sw_ice(n_g_d,nswbands)) - allocate(ssa_sw_ice(n_g_d,nswbands)) - allocate(asm_sw_ice(n_g_d,nswbands)) - allocate(abs_lw_ice(n_g_d,nlwbands)) - - if (masterproc) then - call handle_ncerr( nf90_inq_varid(ncid, 'd_eff', d_id),& - 'cloud optics deff get') - call handle_ncerr( nf90_get_var(ncid, d_id, g_d_eff),& - 'read cloud optics deff values') - - call handle_ncerr( nf90_inq_varid(ncid, 'sw_ext', ext_sw_ice_id),& - 'cloud optics ext_sw_ice get') - call handle_ncerr(nf90_inquire_variable ( ncid, ext_sw_ice_id, ndims=ndims, dimids=vdimids),& - 'checking dimensions of ext_sw_ice') - call handle_ncerr(nf90_inquire_dimension( ncid, vdimids(1), len=templen),& - 'getting first dimension sw_ext') - call handle_ncerr(nf90_inquire_dimension( ncid, vdimids(2), len=templen),& - 'getting first dimension sw_ext') - call handle_ncerr( nf90_get_var(ncid, ext_sw_ice_id, ext_sw_ice),& - 'read cloud optics ext_sw_ice values') - - call handle_ncerr( nf90_inq_varid(ncid, 'sw_ssa', ssa_sw_ice_id),& - 'cloud optics ssa_sw_ice get') - call handle_ncerr( nf90_get_var(ncid, ssa_sw_ice_id, ssa_sw_ice),& - 'read cloud optics ssa_sw_ice values') - - call handle_ncerr( nf90_inq_varid(ncid, 'sw_asm', asm_sw_ice_id),& - 'cloud optics asm_sw_ice get') - call handle_ncerr( nf90_get_var(ncid, asm_sw_ice_id, asm_sw_ice),& - 'read cloud optics asm_sw_ice values') - - call handle_ncerr( nf90_inq_varid(ncid, 'lw_abs', abs_lw_ice_id),& - 'cloud optics abs_lw_ice get') - call handle_ncerr( nf90_get_var(ncid, abs_lw_ice_id, abs_lw_ice),& - 'read cloud optics abs_lw_ice values') - - call handle_ncerr( nf90_close(ncid), 'ice optics file missing') - end if ! if masterproc - -#if ( defined SPMD ) - call mpibcast(g_d_eff, n_g_d, mpir8, 0, mpicom, ierr) - call mpibcast(ext_sw_ice, n_g_d*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(ssa_sw_ice, n_g_d*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(asm_sw_ice, n_g_d*nswbands, mpir8, 0, mpicom, ierr) - call mpibcast(abs_lw_ice, n_g_d*nlwbands, mpir8, 0, mpicom, ierr) -#endif + call rrtmgp_cloud_optics_setup_init(liqopticsfile, iceopticsfile, abs_lw_liq, & + abs_lw_ice, ext_sw_liq, ext_sw_ice, ssa_sw_liq, ssa_sw_ice, asm_sw_liq, & + asm_sw_ice, g_lambda, g_mu, g_d_eff, errmsg, err) + if (err /= 0) then + call endrun(sub//': '//errmsg) + end if ! Set output variables + nmu = size(g_mu) + nlambda = size(g_lambda, 2) + n_g_d = size(g_d_eff) tiny_out = tiny - nmu_out = nmu - nlambda_out = nlambda - n_g_d_out = n_g_d allocate(abs_lw_liq_out(nmu,nlambda,nlwbands), stat=ierr) call handle_allocate_error(ierr, sub, 'abs_lw_liq_out') abs_lw_liq_out = abs_lw_liq + allocate(ext_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ext_sw_liq_out') + ext_sw_liq_out = ext_sw_liq + allocate(ssa_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ssa_sw_liq_out') + ssa_sw_liq_out = ssa_sw_liq + allocate(asm_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'asm_sw_liq_out') + asm_sw_liq_out = asm_sw_liq allocate(abs_lw_ice_out(n_g_d,nlwbands), stat=ierr) call handle_allocate_error(ierr, sub, 'abs_lw_ice_out') abs_lw_ice_out = abs_lw_ice + allocate(ext_sw_ice_out(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ext_sw_ice_out') + ext_sw_ice_out = ext_sw_ice + allocate(ssa_sw_ice_out(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ssa_sw_ice_out') + ssa_sw_ice_out = ssa_sw_ice + allocate(asm_sw_ice_out(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'asm_sw_ice_out') + asm_sw_ice_out = asm_sw_ice allocate(g_mu_out(nmu), stat=ierr) call handle_allocate_error(ierr, sub, 'g_mu_out') g_mu_out = g_mu diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index ff79c7dd71..9d7f130cc4 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -385,7 +385,13 @@ subroutine radiation_init(pbuf2d) ! Cloud optics variables integer :: nmu, n_g_d, nlambda real(kind=r8), allocatable :: abs_lw_ice(:,:) + real(kind=r8), allocatable :: ext_sw_ice(:,:) + real(kind=r8), allocatable :: ssa_sw_ice(:,:) + real(kind=r8), allocatable :: asm_sw_ice(:,:) real(kind=r8), allocatable :: abs_lw_liq(:,:,:) + real(kind=r8), allocatable :: ext_sw_liq(:,:,:) + real(kind=r8), allocatable :: ssa_sw_liq(:,:,:) + real(kind=r8), allocatable :: asm_sw_liq(:,:,:) real(kind=r8), allocatable :: g_lambda(:,:) real(kind=r8), allocatable :: g_mu(:) real(kind=r8), allocatable :: g_d_eff(:) @@ -400,7 +406,8 @@ subroutine radiation_init(pbuf2d) call radsw_init() call radlw_init() call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & - g_mu, g_lambda, g_d_eff, tiny) + ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & + asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 99b715973b..2274594277 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -26,8 +26,6 @@ module radiation gaslist, radconstants_init use rad_solar_var, only: rad_solar_var_init, get_variability -use cloud_rad_props, only: cloud_rad_props_init - use cospsimulator_intr, only: docosp, cospsimulator_intr_init, & cospsimulator_intr_run, cosp_nradsteps @@ -223,6 +221,20 @@ module radiation integer :: nlwgpts integer :: nswgpts +! Cloud optics variables +real(kind=r8), allocatable :: abs_lw_ice(:,:) +real(kind=r8), allocatable :: asm_sw_ice(:,:) +real(kind=r8), allocatable :: ssa_sw_ice(:,:) +real(kind=r8), allocatable :: ext_sw_ice(:,:) +real(kind=r8), allocatable :: abs_lw_liq(:,:,:) +real(kind=r8), allocatable :: ext_sw_liq(:,:,:) +real(kind=r8), allocatable :: ssa_sw_liq(:,:,:) +real(kind=r8), allocatable :: asm_sw_liq(:,:,:) +real(kind=r8), allocatable :: g_lambda(:,:) +real(kind=r8), allocatable :: g_mu(:) +real(kind=r8), allocatable :: g_d_eff(:) +real(kind=r8) :: tiny + ! Band indices for bands containing specific wavelengths integer :: idx_sw_diag integer :: idx_nir_diag @@ -411,11 +423,12 @@ end function radiation_do subroutine radiation_init(pbuf2d) use rrtmgp_pre, only: rrtmgp_pre_init - use rrtmgp_inputs, only: rrtmgp_inputs_init + use rrtmgp_inputs_setup, only: rrtmgp_inputs_setup_init use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init - use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init -! use rrtmgp_lw_gas_optics_data, only: rrtmgp_lw_gas_optics_data_init -! use rrtmgp_sw_gas_optics_data, only: rrtmgp_sw_gas_optics_data_init + use cloud_rad_props, only: cloud_rad_props_init + use rad_constituents, only: iceopticsfile, liqopticsfile + use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_init + use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_init ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -441,15 +454,7 @@ subroutine radiation_init(pbuf2d) ! liquid budgets. integer :: history_budget_histfile_num ! history file number for budget fields integer :: ierr, istat, errflg - - ! Cloud optics variables - integer :: nmu, n_g_d, nlambda - real(kind=r8), allocatable :: abs_lw_ice(:,:) - real(kind=r8), allocatable :: abs_lw_liq(:,:,:) - real(kind=r8), allocatable :: g_lambda(:,:) - real(kind=r8), allocatable :: g_mu(:) - real(kind=r8), allocatable :: g_d_eff(:) - real(kind=r8) :: tiny +! integer :: nmu, n_g_d, nlambda ! dimensions in optics files integer :: dtime @@ -462,37 +467,30 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': '//errmsg) end if -! call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & -! g_mu, g_lambda, g_d_eff, tiny) -! -! call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & -! abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & -! g_d_eff, tiny, errmsg, errflg) -! if (errflg /= 0) then -! call endrun(sub//': '//errmsg) -! end if - -! write(iulog,*) 'peverwhee - reading in data from file!' + ! Read ice and liquid optics files + call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, & + ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & + asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if ! Read RRTMGP coefficients files and initialize kdist objects. - call rrtmgp_lw_gas_optics_data_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) + call rrtmgp_lw_gas_optics_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': lw '//errmsg) end if - call rrtmgp_sw_gas_optics_data_init(kdist_sw, coefs_sw_file, available_gases, errmsg, errflg) + call rrtmgp_sw_gas_optics_init(kdist_sw, coefs_sw_file, available_gases, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': sw '//errmsg) end if -! write(iulog,*) 'peverwhee - done reading in data from file!' -! call coefs_init(coefs_sw_file, available_gases, kdist_sw) -! call coefs_init(coefs_lw_file, available_gases, kdist_lw) ! Set up inputs to RRTMGP - call rrtmgp_inputs_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & + call rrtmgp_inputs_setup_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & pref_edge, nlay, pver, pverp, kdist_sw, kdist_lw, qrl_unused, is_first_step(), use_rad_dt_cosz, & get_step_size(), get_nstep(), iradsw, dt_avg, irad_always, is_first_restart_step(), masterproc, & nlwbands, nradgas, gasnamelength, iulog, idx_sw_diag, idx_nir_diag, idx_uv_diag, & - idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, nswgpts, nlwgpts, nlayp, & + idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, gaslist, nswgpts, nlwgpts, nlayp, & nextsw_cday, get_curr_calday(), band2gpt_sw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) @@ -510,15 +508,6 @@ subroutine radiation_init(pbuf2d) ! initialize output fields for offline driver call rad_data_init(pbuf2d) - call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & - g_mu, g_lambda, g_d_eff, tiny) - call rrtmgp_lw_cloud_optics_init(nmu, nlambda, n_g_d, & - abs_lw_liq, abs_lw_ice, nlwbands, g_mu, g_lambda, & - g_d_eff, tiny, errmsg, errflg) - if (errflg /= 0) then - call endrun(sub//': '//errmsg) - end if - cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW', errcode=ierr) cldfgrau_idx = pbuf_get_index('CLDFGRAU', errcode=ierr) @@ -1303,11 +1292,12 @@ subroutine radiation_tend( & do_snow = associated(cldfsnow) ! Set cloud optical properties in cloud_lw object. - call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, nlaycam, cld(:ncol,:), cldfsnow_in, & - cldfgrau_in, cldfprime(:ncol,:), kdist_lw, cloud_lw, lambda(:ncol,:), & - mu(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), & - icgrauwp(:ncol,:), degrau(:ncol,:), nlwbands, do_snow, do_graupel, pver, & - ktopcam, tauc, cldf, cld_lw_abs, snow_lw_abs, grau_lw_abs, errmsg, errflg) + call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, nlaycam, cld(:ncol,:), cldfsnow_in, & + cldfgrau_in, cldfprime(:ncol,:), kdist_lw, cloud_lw, lambda(:ncol,:), mu(:ncol,:), & + iclwp(:ncol,:), iciwp(:ncol,:), abs_lw_liq, abs_lw_ice, g_mu, g_lambda, g_d_eff, & + tiny, dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), icgrauwp(:ncol,:), degrau(:ncol,:), & + nlwbands, do_snow, do_graupel, pver, ktopcam, tauc, cldf, cld_lw_abs, snow_lw_abs, & + grau_lw_abs, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if @@ -1848,560 +1838,6 @@ subroutine radiation_output_lw(lchnk, ncol, icall, rd, pbuf, cam_out) end subroutine radiation_output_lw -!=============================================================================== - -subroutine coefs_init(coefs_file, available_gases, kdist) - - ! Read data from coefficients file. Initialize the kdist object. - ! available_gases object provides the gas names that CAM provides. - - use mo_rte_kind, only: wl - - ! arguments - character(len=*), intent(in) :: coefs_file - class(ty_gas_concs_ccpp), intent(in) :: available_gases - class(ty_gas_optics_rrtmgp_ccpp), intent(inout) :: kdist - - ! local variables - type(file_desc_t) :: fh ! pio file handle - character(len=cl) :: locfn ! path to file on local storage - - ! File dimensions - integer :: & - absorber, & - atmos_layer, & - bnd, & - pressure, & - temperature, & - absorber_ext, & - pressure_interp, & - mixing_fraction, & - gpt, & - temperature_Planck - - integer :: i - integer :: did, vid - integer :: ierr, istat - - character(32), dimension(:), allocatable :: gas_names - integer, dimension(:,:,:), allocatable :: key_species - integer, dimension(:,:), allocatable :: band2gpt - real(r8), dimension(:,:), allocatable :: band_lims_wavenum - real(r8), dimension(:), allocatable :: press_ref, temp_ref - real(r8) :: press_ref_trop, temp_ref_t, temp_ref_p - real(r8), dimension(:,:,:), allocatable :: vmr_ref - real(r8), dimension(:,:,:,:), allocatable :: kmajor - real(r8), dimension(:,:,:), allocatable :: kminor_lower, kminor_upper - real(r8), dimension(:,:), allocatable :: totplnk - real(r8), dimension(:,:,:,:), allocatable :: planck_frac - real(r8), dimension(:), allocatable :: solar_src_quiet, solar_src_facular, solar_src_sunspot - real(r8) :: tsi_default - real(r8), dimension(:,:,:), allocatable :: rayl_lower, rayl_upper - character(len=32), dimension(:), allocatable :: gas_minor, & - identifier_minor, & - minor_gases_lower, & - minor_gases_upper, & - scaling_gas_lower, & - scaling_gas_upper - integer, dimension(:,:), allocatable :: minor_limits_gpt_lower, & - minor_limits_gpt_upper - ! Send these to RRTMGP as logicals, - ! but they have to be read from the netCDF as integers - logical(wl), dimension(:), allocatable :: minor_scales_with_density_lower, & - minor_scales_with_density_upper - logical(wl), dimension(:), allocatable :: scale_by_complement_lower, & - scale_by_complement_upper - integer, dimension(:), allocatable :: int2log ! use this to convert integer-to-logical. - integer, dimension(:), allocatable :: kminor_start_lower, kminor_start_upper - real(r8), dimension(:,:), allocatable :: optimal_angle_fit - real(r8) :: mg_default, sb_default - - integer :: pairs, & - minorabsorbers, & - minor_absorber_intervals_lower, & - minor_absorber_intervals_upper, & - contributors_lower, & - contributors_upper, & - fit_coeffs - - character(len=128) :: error_msg - character(len=512) :: errmsg - character(len=*), parameter :: sub = 'coefs_init' - !---------------------------------------------------------------------------- - - ! Open file - call getfil(coefs_file, locfn, 0) - call cam_pio_openfile(fh, locfn, PIO_NOWRITE) - - call pio_seterrorhandling(fh, PIO_BCAST_ERROR) - - ! Get dimensions - - ierr = pio_inq_dimid(fh, 'absorber', did) - if (ierr /= PIO_NOERR) call endrun(sub//': absorber not found') - ierr = pio_inq_dimlen(fh, did, absorber) - - ierr = pio_inq_dimid(fh, 'atmos_layer', did) - if (ierr /= PIO_NOERR) call endrun(sub//': atmos_layer not found') - ierr = pio_inq_dimlen(fh, did, atmos_layer) - - ierr = pio_inq_dimid(fh, 'bnd', did) - if (ierr /= PIO_NOERR) call endrun(sub//': bnd not found') - ierr = pio_inq_dimlen(fh, did, bnd) - - ierr = pio_inq_dimid(fh, 'pressure', did) - if (ierr /= PIO_NOERR) call endrun(sub//': pressure not found') - ierr = pio_inq_dimlen(fh, did, pressure) - - ierr = pio_inq_dimid(fh, 'temperature', did) - if (ierr /= PIO_NOERR) call endrun(sub//': temperature not found') - ierr = pio_inq_dimlen(fh, did, temperature) - - ierr = pio_inq_dimid(fh, 'absorber_ext', did) - if (ierr /= PIO_NOERR) call endrun(sub//': absorber_ext not found') - ierr = pio_inq_dimlen(fh, did, absorber_ext) - - ierr = pio_inq_dimid(fh, 'pressure_interp', did) - if (ierr /= PIO_NOERR) call endrun(sub//': pressure_interp not found') - ierr = pio_inq_dimlen(fh, did, pressure_interp) - - ierr = pio_inq_dimid(fh, 'mixing_fraction', did) - if (ierr /= PIO_NOERR) call endrun(sub//': mixing_fraction not found') - ierr = pio_inq_dimlen(fh, did, mixing_fraction) - - ierr = pio_inq_dimid(fh, 'gpt', did) - if (ierr /= PIO_NOERR) call endrun(sub//': gpt not found') - ierr = pio_inq_dimlen(fh, did, gpt) - - temperature_Planck = 0 - ierr = pio_inq_dimid(fh, 'temperature_Planck', did) - if (ierr == PIO_NOERR) then - ierr = pio_inq_dimlen(fh, did, temperature_Planck) - end if - ierr = pio_inq_dimid(fh, 'pair', did) - if (ierr /= PIO_NOERR) call endrun(sub//': pair not found') - ierr = pio_inq_dimlen(fh, did, pairs) - ierr = pio_inq_dimid(fh, 'minor_absorber', did) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_absorber not found') - ierr = pio_inq_dimlen(fh, did, minorabsorbers) - ierr = pio_inq_dimid(fh, 'minor_absorber_intervals_lower', did) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_absorber_intervals_lower not found') - ierr = pio_inq_dimlen(fh, did, minor_absorber_intervals_lower) - ierr = pio_inq_dimid(fh, 'minor_absorber_intervals_upper', did) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_absorber_intervals_upper not found') - ierr = pio_inq_dimlen(fh, did, minor_absorber_intervals_upper) - ierr = pio_inq_dimid(fh, 'contributors_lower', did) - if (ierr /= PIO_NOERR) call endrun(sub//': contributors_lower not found') - ierr = pio_inq_dimlen(fh, did, contributors_lower) - ierr = pio_inq_dimid(fh, 'contributors_upper', did) - if (ierr /= PIO_NOERR) call endrun(sub//': contributors_upper not found') - ierr = pio_inq_dimlen(fh, did, contributors_upper) - - ierr = pio_inq_dimid(fh, 'fit_coeffs', did) - if (ierr == PIO_NOERR) then - ierr = pio_inq_dimlen(fh, did, fit_coeffs) - end if - - ! Get variables - - ! names of absorbing gases - allocate(gas_names(absorber), stat=istat) - call handle_allocate_error(istat, sub, 'gas_names') - ierr = pio_inq_varid(fh, 'gas_names', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': gas_names not found') - ierr = pio_get_var(fh, vid, gas_names) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading gas_names') - - ! key species pair for each band - allocate(key_species(2,atmos_layer,bnd), stat=istat) - call handle_allocate_error(istat, sub, 'key_species') - ierr = pio_inq_varid(fh, 'key_species', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': key_species not found') - ierr = pio_get_var(fh, vid, key_species) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading key_species') - - ! beginning and ending gpoint for each band - allocate(band2gpt(2,bnd), stat=istat) - call handle_allocate_error(istat, sub, 'band2gpt') - ierr = pio_inq_varid(fh, 'bnd_limits_gpt', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': bnd_limits_gpt not found') - ierr = pio_get_var(fh, vid, band2gpt) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading bnd_limits_gpt') - - ! beginning and ending wavenumber for each band - allocate(band_lims_wavenum(2,bnd), stat=istat) - call handle_allocate_error(istat, sub, 'band_lims_wavenum') - ierr = pio_inq_varid(fh, 'bnd_limits_wavenumber', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': bnd_limits_wavenumber not found') - ierr = pio_get_var(fh, vid, band_lims_wavenum) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading bnd_limits_wavenumber') - - ! pressures [hPa] for reference atmosphere; press_ref(# reference layers) - allocate(press_ref(pressure), stat=istat) - call handle_allocate_error(istat, sub, 'press_ref') - ierr = pio_inq_varid(fh, 'press_ref', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': press_ref not found') - ierr = pio_get_var(fh, vid, press_ref) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading press_ref') - - ! reference pressure separating the lower and upper atmosphere - ierr = pio_inq_varid(fh, 'press_ref_trop', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': press_ref_trop not found') - ierr = pio_get_var(fh, vid, press_ref_trop) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading press_ref_trop') - - ! temperatures [K] for reference atmosphere; temp_ref(# reference layers) - allocate(temp_ref(temperature), stat=istat) - call handle_allocate_error(istat, sub, 'temp_ref') - ierr = pio_inq_varid(fh, 'temp_ref', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': temp_ref not found') - ierr = pio_get_var(fh, vid, temp_ref) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading temp_ref') - - ! standard spectroscopic reference temperature [K] - ierr = pio_inq_varid(fh, 'absorption_coefficient_ref_T', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': absorption_coefficient_ref_T not found') - ierr = pio_get_var(fh, vid, temp_ref_t) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading absorption_coefficient_ref_T') - - ! standard spectroscopic reference pressure [Pa] - ierr = pio_inq_varid(fh, 'absorption_coefficient_ref_P', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': absorption_coefficient_ref_P not found') - ierr = pio_get_var(fh, vid, temp_ref_p) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading absorption_coefficient_ref_P') - - ! volume mixing ratios for reference atmosphere - allocate(vmr_ref(atmos_layer, absorber_ext, temperature), stat=istat) - call handle_allocate_error(istat, sub, 'vmr_ref') - ierr = pio_inq_varid(fh, 'vmr_ref', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': vmr_ref not found') - ierr = pio_get_var(fh, vid, vmr_ref) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading vmr_ref') - - ! absorption coefficients due to major absorbing gases - allocate(kmajor(gpt,mixing_fraction,pressure_interp,temperature), stat=istat) - call handle_allocate_error(istat, sub, 'kmajor') - ierr = pio_inq_varid(fh, 'kmajor', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': kmajor not found') - ierr = pio_get_var(fh, vid, kmajor) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading kmajor') - - ! absorption coefficients due to minor absorbing gases in lower part of atmosphere - allocate(kminor_lower(contributors_lower, mixing_fraction, temperature), stat=istat) - call handle_allocate_error(istat, sub, 'kminor_lower') - ierr = pio_inq_varid(fh, 'kminor_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': kminor_lower not found') - ierr = pio_get_var(fh, vid, kminor_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading kminor_lower') - - ! absorption coefficients due to minor absorbing gases in upper part of atmosphere - allocate(kminor_upper(contributors_upper, mixing_fraction, temperature), stat=istat) - call handle_allocate_error(istat, sub, 'kminor_upper') - ierr = pio_inq_varid(fh, 'kminor_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': kminor_upper not found') - ierr = pio_get_var(fh, vid, kminor_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading kminor_upper') - - ! integrated Planck function by band - ierr = pio_inq_varid(fh, 'totplnk', vid) - if (ierr == PIO_NOERR) then - allocate(totplnk(temperature_Planck,bnd), stat=istat) - call handle_allocate_error(istat, sub, 'totplnk') - ierr = pio_get_var(fh, vid, totplnk) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading totplnk') - end if - - ! Planck fractions - ierr = pio_inq_varid(fh, 'plank_fraction', vid) - if (ierr == PIO_NOERR) then - allocate(planck_frac(gpt,mixing_fraction,pressure_interp,temperature), stat=istat) - call handle_allocate_error(istat, sub, 'planck_frac') - ierr = pio_get_var(fh, vid, planck_frac) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading plank_fraction') - end if - - ierr = pio_inq_varid(fh, 'optimal_angle_fit', vid) - if (ierr == PIO_NOERR) then - allocate(optimal_angle_fit(fit_coeffs, bnd), stat=istat) - call handle_allocate_error(istat, sub, 'optiman_angle_fit') - ierr = pio_get_var(fh, vid, optimal_angle_fit) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading optimal_angle_fit') - end if - - ierr = pio_inq_varid(fh, 'solar_source_quiet', vid) - if (ierr == PIO_NOERR) then - allocate(solar_src_quiet(gpt), stat=istat) - call handle_allocate_error(istat, sub, 'solar_src_quiet') - ierr = pio_get_var(fh, vid, solar_src_quiet) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading solar_source_quiet') - end if - - ierr = pio_inq_varid(fh, 'solar_source_facular', vid) - if (ierr == PIO_NOERR) then - allocate(solar_src_facular(gpt), stat=istat) - call handle_allocate_error(istat, sub, 'solar_src_facular') - ierr = pio_get_var(fh, vid, solar_src_facular) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading solar_source_facular') - end if - - ierr = pio_inq_varid(fh, 'solar_source_sunspot', vid) - if (ierr == PIO_NOERR) then - allocate(solar_src_sunspot(gpt), stat=istat) - call handle_allocate_error(istat, sub, 'solar_src_sunspot') - ierr = pio_get_var(fh, vid, solar_src_sunspot) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading solar_source_sunspot') - end if - - ierr = pio_inq_varid(fh, 'tsi_default', vid) - if (ierr == PIO_NOERR) then - ierr = pio_get_var(fh, vid, tsi_default) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading tsi_default') - end if - - ierr = pio_inq_varid(fh, 'mg_default', vid) - if (ierr == PIO_NOERR) then - ierr = pio_get_var(fh, vid, mg_default) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading mg_default') - end if - - ierr = pio_inq_varid(fh, 'sb_default', vid) - if (ierr == PIO_NOERR) then - ierr = pio_get_var(fh, vid, sb_default) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading sb_default') - end if - - ! rayleigh scattering contribution in lower part of atmosphere - ierr = pio_inq_varid(fh, 'rayl_lower', vid) - if (ierr == PIO_NOERR) then - allocate(rayl_lower(gpt,mixing_fraction,temperature), stat=istat) - call handle_allocate_error(istat, sub, 'rayl_lower') - ierr = pio_get_var(fh, vid, rayl_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading rayl_lower') - end if - - ! rayleigh scattering contribution in upper part of atmosphere - ierr = pio_inq_varid(fh, 'rayl_upper', vid) - if (ierr == PIO_NOERR) then - allocate(rayl_upper(gpt,mixing_fraction,temperature), stat=istat) - call handle_allocate_error(istat, sub, 'rayl_upper') - ierr = pio_get_var(fh, vid, rayl_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading rayl_upper') - end if - - allocate(gas_minor(minorabsorbers), stat=istat) - call handle_allocate_error(istat, sub, 'gas_minor') - ierr = pio_inq_varid(fh, 'gas_minor', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': gas_minor not found') - ierr = pio_get_var(fh, vid, gas_minor) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading gas_minor') - - allocate(identifier_minor(minorabsorbers), stat=istat) - call handle_allocate_error(istat, sub, 'identifier_minor') - ierr = pio_inq_varid(fh, 'identifier_minor', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': identifier_minor not found') - ierr = pio_get_var(fh, vid, identifier_minor) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading identifier_minor') - - allocate(minor_gases_lower(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'minor_gases_lower') - ierr = pio_inq_varid(fh, 'minor_gases_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_gases_lower not found') - ierr = pio_get_var(fh, vid, minor_gases_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_gases_lower') - - allocate(minor_gases_upper(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'minor_gases_upper') - ierr = pio_inq_varid(fh, 'minor_gases_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_gases_upper not found') - ierr = pio_get_var(fh, vid, minor_gases_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_gases_upper') - - allocate(minor_limits_gpt_lower(pairs,minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'minor_limits_gpt_lower') - ierr = pio_inq_varid(fh, 'minor_limits_gpt_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_limits_gpt_lower not found') - ierr = pio_get_var(fh, vid, minor_limits_gpt_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_limits_gpt_lower') - - allocate(minor_limits_gpt_upper(pairs,minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'minor_limits_gpt_upper') - ierr = pio_inq_varid(fh, 'minor_limits_gpt_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_limits_gpt_upper not found') - ierr = pio_get_var(fh, vid, minor_limits_gpt_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_limits_gpt_upper') - - ! Read as integer and convert to logical - allocate(int2log(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'int2log for lower') - - allocate(minor_scales_with_density_lower(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'minor_scales_with_density_lower') - ierr = pio_inq_varid(fh, 'minor_scales_with_density_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_scales_with_density_lower not found') - ierr = pio_get_var(fh, vid, int2log) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_scales_with_density_lower') - do i = 1,minor_absorber_intervals_lower - if (int2log(i) .eq. 0) then - minor_scales_with_density_lower(i) = .false. - else - minor_scales_with_density_lower(i) = .true. - end if - end do - - allocate(scale_by_complement_lower(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'scale_by_complement_lower') - ierr = pio_inq_varid(fh, 'scale_by_complement_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': scale_by_complement_lower not found') - ierr = pio_get_var(fh, vid, int2log) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading scale_by_complement_lower') - do i = 1,minor_absorber_intervals_lower - if (int2log(i) .eq. 0) then - scale_by_complement_lower(i) = .false. - else - scale_by_complement_lower(i) = .true. - end if - end do - - deallocate(int2log) - - ! Read as integer and convert to logical - allocate(int2log(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'int2log for upper') - - allocate(minor_scales_with_density_upper(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'minor_scales_with_density_upper') - ierr = pio_inq_varid(fh, 'minor_scales_with_density_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': minor_scales_with_density_upper not found') - ierr = pio_get_var(fh, vid, int2log) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading minor_scales_with_density_upper') - do i = 1,minor_absorber_intervals_upper - if (int2log(i) .eq. 0) then - minor_scales_with_density_upper(i) = .false. - else - minor_scales_with_density_upper(i) = .true. - end if - end do - - allocate(scale_by_complement_upper(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'scale_by_complement_upper') - ierr = pio_inq_varid(fh, 'scale_by_complement_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': scale_by_complement_upper not found') - ierr = pio_get_var(fh, vid, int2log) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading scale_by_complement_upper') - do i = 1,minor_absorber_intervals_upper - if (int2log(i) .eq. 0) then - scale_by_complement_upper(i) = .false. - else - scale_by_complement_upper(i) = .true. - end if - end do - - deallocate(int2log) - - allocate(scaling_gas_lower(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'scaling_gas_lower') - ierr = pio_inq_varid(fh, 'scaling_gas_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': scaling_gas_lower not found') - ierr = pio_get_var(fh, vid, scaling_gas_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading scaling_gas_lower') - - allocate(scaling_gas_upper(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'scaling_gas_upper') - ierr = pio_inq_varid(fh, 'scaling_gas_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': scaling_gas_upper not found') - ierr = pio_get_var(fh, vid, scaling_gas_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading scaling_gas_upper') - - allocate(kminor_start_lower(minor_absorber_intervals_lower), stat=istat) - call handle_allocate_error(istat, sub, 'kminor_start_lower') - ierr = pio_inq_varid(fh, 'kminor_start_lower', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': kminor_start_lower not found') - ierr = pio_get_var(fh, vid, kminor_start_lower) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading kminor_start_lower') - - allocate(kminor_start_upper(minor_absorber_intervals_upper), stat=istat) - call handle_allocate_error(istat, sub, 'kminor_start_upper') - ierr = pio_inq_varid(fh, 'kminor_start_upper', vid) - if (ierr /= PIO_NOERR) call endrun(sub//': kminor_start_upper not found') - ierr = pio_get_var(fh, vid, kminor_start_upper) - if (ierr /= PIO_NOERR) call endrun(sub//': error reading kminor_start_upper') - - ! Close file - call pio_closefile(fh) - - ! Initialize the gas optics object with data. The calls are slightly different depending - ! on whether the radiation sources are internal to the atmosphere (longwave) or external (shortwave) - - if (allocated(totplnk) .and. allocated(planck_frac)) then - error_msg = kdist%gas_props%load( & - available_gases%gas_concs, gas_names, key_species, & - band2gpt, band_lims_wavenum, & - press_ref, press_ref_trop, temp_ref, & - temp_ref_p, temp_ref_t, vmr_ref, & - kmajor, kminor_lower, kminor_upper, & - gas_minor, identifier_minor, & - minor_gases_lower, minor_gases_upper, & - minor_limits_gpt_lower, minor_limits_gpt_upper, & - minor_scales_with_density_lower, & - minor_scales_with_density_upper, & - scaling_gas_lower, scaling_gas_upper, & - scale_by_complement_lower, scale_by_complement_upper, & - kminor_start_lower, kminor_start_upper, & - totplnk, planck_frac, rayl_lower, rayl_upper, & - optimal_angle_fit) - else if (allocated(solar_src_quiet)) then - error_msg = kdist%gas_props%load( & - available_gases%gas_concs, gas_names, key_species, & - band2gpt, band_lims_wavenum, & - press_ref, press_ref_trop, temp_ref, & - temp_ref_p, temp_ref_t, vmr_ref, & - kmajor, kminor_lower, kminor_upper, & - gas_minor, identifier_minor, & - minor_gases_lower, minor_gases_upper, & - minor_limits_gpt_lower, minor_limits_gpt_upper, & - minor_scales_with_density_lower, & - minor_scales_with_density_upper, & - scaling_gas_lower, scaling_gas_upper, & - scale_by_complement_lower, & - scale_by_complement_upper, & - kminor_start_lower, & - kminor_start_upper, & - solar_src_quiet, solar_src_facular, solar_src_sunspot, & - tsi_default, mg_default, sb_default, & - rayl_lower, rayl_upper) - else - error_msg = 'must supply either totplnk and planck_frac, or solar_src_[*]' - end if - - call stop_on_err(error_msg, sub, 'kdist%gas_props%load') - - deallocate( & - gas_names, key_species, & - band2gpt, band_lims_wavenum, & - press_ref, temp_ref, vmr_ref, & - kmajor, kminor_lower, kminor_upper, & - gas_minor, identifier_minor, & - minor_gases_lower, minor_gases_upper, & - minor_limits_gpt_lower, & - minor_limits_gpt_upper, & - minor_scales_with_density_lower, & - minor_scales_with_density_upper, & - scale_by_complement_lower, & - scale_by_complement_upper, & - scaling_gas_lower, scaling_gas_upper, & - kminor_start_lower, kminor_start_upper) - - if (allocated(totplnk)) deallocate(totplnk) - if (allocated(planck_frac)) deallocate(planck_frac) - if (allocated(optimal_angle_fit)) deallocate(optimal_angle_fit) - if (allocated(solar_src_quiet)) deallocate(solar_src_quiet) - if (allocated(solar_src_facular)) deallocate(solar_src_facular) - if (allocated(solar_src_sunspot)) deallocate(solar_src_sunspot) - if (allocated(rayl_lower)) deallocate(rayl_lower) - if (allocated(rayl_upper)) deallocate(rayl_upper) - -end subroutine coefs_init - !========================================================================================= subroutine stop_on_err(errmsg, sub, info) diff --git a/src/utils/cam_ccpp/pio_reader_sub.F90 b/src/utils/cam_ccpp/pio_reader_sub.F90 new file mode 100644 index 0000000000..3ce3ec7305 --- /dev/null +++ b/src/utils/cam_ccpp/pio_reader_sub.F90 @@ -0,0 +1,8 @@ +submodule (ccpp_io_reader) pio_submodule +use pio_reader, only: pio_reader_t +implicit none +contains + module procedure create_netcdf_reader_t + allocate(pio_reader_t :: r) + end procedure create_netcdf_reader_t +end submodule pio_submodule From 767ec7b93fd069dfcd994d02a4da71a869c41811 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 30 Jun 2025 14:55:45 -0600 Subject: [PATCH 211/466] cleanup; fix rrtmg interface --- src/physics/rrtmg/radiation.F90 | 7 +++---- src/physics/rrtmgp/radiation.F90 | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index 9d7f130cc4..3e381bd695 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -383,7 +383,6 @@ subroutine radiation_init(pbuf2d) integer :: err ! Cloud optics variables - integer :: nmu, n_g_d, nlambda real(kind=r8), allocatable :: abs_lw_ice(:,:) real(kind=r8), allocatable :: ext_sw_ice(:,:) real(kind=r8), allocatable :: ssa_sw_ice(:,:) @@ -405,9 +404,9 @@ subroutine radiation_init(pbuf2d) call rad_data_init(pbuf2d) ! initialize output fields for offline driver call radsw_init() call radlw_init() - call cloud_rad_props_init(nmu, nlambda, n_g_d, abs_lw_liq, abs_lw_ice, & - ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & - asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) + call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, ext_sw_liq, ssa_sw_liq, & + asm_sw_liq, ext_sw_ice, ssa_sw_ice, asm_sw_ice, g_mu, & + g_lambda, g_d_eff, tiny) cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 2274594277..e0d37d861a 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -454,7 +454,6 @@ subroutine radiation_init(pbuf2d) ! liquid budgets. integer :: history_budget_histfile_num ! history file number for budget fields integer :: ierr, istat, errflg -! integer :: nmu, n_g_d, nlambda ! dimensions in optics files integer :: dtime From ac2ec23bd60fc1fb34d7431ba9b9298dadffd927 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 30 Jun 2025 16:36:14 -0600 Subject: [PATCH 212/466] move cloud back; new atmos phys module --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3b830324f9..bc0dfe07ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = e504efbd115b4b8da2037fa058139e221b0ae834 + fxtag = 9cfcb2eaca2c63a4a6f00799b226cd9893a38f64 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index e504efbd11..9cfcb2eaca 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit e504efbd115b4b8da2037fa058139e221b0ae834 +Subproject commit 9cfcb2eaca2c63a4a6f00799b226cd9893a38f64 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index e0d37d861a..7cc35d5fa5 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -466,14 +466,6 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': '//errmsg) end if - ! Read ice and liquid optics files - call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, & - ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & - asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) - if (errflg /= 0) then - call endrun(sub//': '//errmsg) - end if - ! Read RRTMGP coefficients files and initialize kdist objects. call rrtmgp_lw_gas_optics_init(kdist_lw, coefs_lw_file, available_gases, errmsg, errflg) if (errflg /= 0) then @@ -507,6 +499,14 @@ subroutine radiation_init(pbuf2d) ! initialize output fields for offline driver call rad_data_init(pbuf2d) + ! Read ice and liquid optics files + call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, & + ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & + asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if + cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW', errcode=ierr) cldfgrau_idx = pbuf_get_index('CLDFGRAU', errcode=ierr) From ce20029a5a07894aebf09695ee57e95d2cb6cab9 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Mon, 30 Jun 2025 16:51:49 -0600 Subject: [PATCH 213/466] initial changes modified: src/chemistry/aerosol/aero_convproc.F90 modified: src/chemistry/aerosol/aero_wetdep_cam.F90 --- src/chemistry/aerosol/aero_convproc.F90 | 2 +- src/chemistry/aerosol/aero_wetdep_cam.F90 | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/chemistry/aerosol/aero_convproc.F90 b/src/chemistry/aerosol/aero_convproc.F90 index 1915e295ad..017914d225 100644 --- a/src/chemistry/aerosol/aero_convproc.F90 +++ b/src/chemistry/aerosol/aero_convproc.F90 @@ -460,7 +460,7 @@ subroutine aero_convproc_intr( aero_props, aero_state, state, ptend, pbuf, ztodt ndx = aer_cnst_ndx(mm) - if (ndx>0) call outfld( trim(cnst_name_extd(1,mm))//'SFWET', aerdepwetis(:,ndx), pcols, lchnk ) + if (ndx>0) call outfld( trim(cnst_name_extd(1,mm))//'SFWETC', aerdepwetis(:,ndx), pcols, lchnk ) call outfld( trim(cnst_name_extd(1,mm))//'SFSIC', sflxic(:,mm), pcols, lchnk ) call outfld( trim(cnst_name_extd(1,mm))//'SFSEC', sflxec(:,mm), pcols, lchnk ) diff --git a/src/chemistry/aerosol/aero_wetdep_cam.F90 b/src/chemistry/aerosol/aero_wetdep_cam.F90 index bcfef0f28e..4f782d0b74 100644 --- a/src/chemistry/aerosol/aero_wetdep_cam.F90 +++ b/src/chemistry/aerosol/aero_wetdep_cam.F90 @@ -268,6 +268,8 @@ subroutine add_hist_fields(name,baseunits) call addfld (trim(name)//'SFWET', & horiz_only, 'A',baseunits//'/m2/s ','Wet deposition flux at surface') + call addfld (trim(name)//'SFWETC', & + horiz_only, 'A',baseunits//'/m2/s ','Wet deposition flux (convective) at surface') call addfld (trim(name)//'SFSIC', & horiz_only, 'A',baseunits//'/m2/s ','Wet deposition flux (incloud, convective) at surface') call addfld (trim(name)//'SFSIS', & @@ -666,8 +668,8 @@ subroutine aero_wetdep_tend( state, dt, dlf, cam_out, ptend, pbuf) call outfld( trim(name)//'SFWET', sflx, pcols, lchnk) if (ndx>0) aerdepwetcw(:ncol,ndx) = sflx(:ncol) else - if (.not.convproc_do_aer) call outfld( trim(name)//'SFWET', sflx, pcols, lchnk) if (ndx>0) aerdepwetis(:ncol,ndx) = aerdepwetis(:ncol,ndx) + sflx(:ncol) + call outfld( trim(name)//'SFWET', aerdepwetis(:ncol,ndx), ncol, lchnk) end if sflx(:)=0._r8 From e89bf7ebbd3fc284ef0fdbea96b3367c4fcd47c5 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 30 Jun 2025 16:56:26 -0600 Subject: [PATCH 214/466] remove unused argument --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 7cc35d5fa5..187d6540dd 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -481,7 +481,7 @@ subroutine radiation_init(pbuf2d) pref_edge, nlay, pver, pverp, kdist_sw, kdist_lw, qrl_unused, is_first_step(), use_rad_dt_cosz, & get_step_size(), get_nstep(), iradsw, dt_avg, irad_always, is_first_restart_step(), masterproc, & nlwbands, nradgas, gasnamelength, iulog, idx_sw_diag, idx_nir_diag, idx_uv_diag, & - idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, gaslist, nswgpts, nlwgpts, nlayp, & + idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, nswgpts, nlwgpts, nlayp, & nextsw_cday, get_curr_calday(), band2gpt_sw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) From 3d04b72d0222dd0fcb27b2a56e7beb1415312fdf Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 1 Jul 2025 13:29:50 -0400 Subject: [PATCH 215/466] update test --- cime_config/testdefs/testlist_cam.xml | 2 +- doc/ChangeLog | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index a9aeeec04b..2785f6ef23 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -51,7 +51,7 @@ - + diff --git a/doc/ChangeLog b/doc/ChangeLog index 147bab8b2b..916d1a272f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -33,7 +33,7 @@ List all files added and what they do: cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* . The limited area outputs are moved to here from ghgrmp_e8 -. The FV angular momentum fixer/diags and circulation diags are move here +. The FV angular momentum fixer/diags and circulation diags are moved here from outfrq3s_am @@ -52,7 +52,7 @@ cime_config/testdefs/testslist_cam.xml ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 and ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am by - ERI_D_Ln18.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags + ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags 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, From d835d2b0f60aee302904c7f0a8de4274d785d70d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 1 Jul 2025 15:17:42 -0400 Subject: [PATCH 216/466] Finalize ChangeLog. --- doc/ChangeLog | 58 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index c2c22669a0..27d34bf57c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,57 @@ =============================================================== +Tag name: cam6_4_101 +Originator(s): jimmielin +Date: July 1, 2025 +One-line Summary: Write cam_in%cflx for all constituents in snapshots, not just Q +Github PR URL: https://github.com/ESCOMP/CAM/pull/1336 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): +- For CAM snaphots, write cam_in%cflx for all constituents instead of just Q as it was declared horiz_only. Now write out as cam_in_cflx_(constituent name) - https://github.com/ESCOMP/CAM/issues/1335 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: cacraig + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M src/control/cam_snapshot_common.F90 + - fix #1335 +M src/control/cam_history.F90 + - fix typo in comment + +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: + +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) +- pre-existing failure due to build-namelist error requiring CLM/CTSM external update + +derecho/nvhpc/aux_cam: All PASS + +izumi/nag/aux_cam: All PASS + +izumi/gnu/aux_cam: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: B4B - only new fields to snapshots + +=============================================================== + Tag name: cam6_4_100 Originator(s): peverwhee, gdicker1 Date: 26 June 2025 @@ -69,7 +121,7 @@ Github PR URL: https://github.com/ESCOMP/CAM/pull/1331 Purpose of changes (include the issue number and title text for each relevant GitHub issue): -. Resolve #1329 - Create an F compset for CAM4 +. Resolve #1329 - Create an F compset for CAM4 - Add compset FHIST_C4 . Modify some MPAS tests. @@ -79,7 +131,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi . Resolve #1332 - ne0ARCTICne30x4 test fails with 1280 tasks and fixed CTSM, because of too few processors - increase pe count from 1280 to 1920. Make this the default in the - config_pes.xml file. + config_pes.xml file. . Resolve #1326 - Add MPAS-O and MPAS-SI from EarthWorksOrg/EarthWorks - add "mpaso" as a valid value in the configure definition file @@ -157,7 +209,7 @@ cime_config/testdefs/testlist_cam.xml ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_gnu.cam-outfrq3s_unicon . Increase PEs for ARCTIC test by modifying config_pes.xml and remove the specification from the test definition. - Replace + Replace SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s by SMS_D_Ln9.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s From d1a6d753a812f2bde390db2730cfa12f22e5949c Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Tue, 1 Jul 2025 16:38:39 -0600 Subject: [PATCH 217/466] wip; schemes build but need to update radiation interfaces --- src/physics/rrtmgp/radiation.F90 | 106 ++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 603a34976d..396f71246c 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -24,7 +24,6 @@ module radiation use radconstants, only: nradgas, gasnamelength, nswbands, nlwbands, & gaslist, radconstants_init -use rad_solar_var, only: rad_solar_var_init, get_variability use cloud_rad_props, only: cloud_rad_props_init @@ -415,6 +414,8 @@ subroutine radiation_init(pbuf2d) use rrtmgp_inputs, only: rrtmgp_inputs_init use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init + use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_init + use solar_irrad_data, only: do_spctrl_scaling, has_spectrum ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -483,7 +484,10 @@ subroutine radiation_init(pbuf2d) ! Set radconstants module-level index variables that we're setting in CCPP-ized scheme now call radconstants_init(idx_sw_diag, idx_nir_diag, idx_uv_diag, idx_lw_diag) - call rad_solar_var_init(nswbands) + call rrtmgp_sw_solar_var_init(nswbands, do_spctrl_scaling, has_spectrum, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if ! initialize output fields for offline driver call rad_data_init(pbuf2d) @@ -821,6 +825,9 @@ subroutine radiation_tend( & use rrtmgp_lw_main, only: rrtmgp_lw_main_run use rrtmgp_dry_static_energy_tendency, only: rrtmgp_dry_static_energy_tendency_run use rrtmgp_post, only: rrtmgp_post_run + use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_run + use rrtmgp_sw_mcica_subcol_gen, only: rrtmgp_sw_mcica_subcol_gen_run + use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & rrtmgp_set_gases_sw, rrtmgp_set_cloud_sw, & @@ -833,10 +840,12 @@ subroutine radiation_tend( & use radheat, only: radheat_tend use radiation_data, only: rad_data_write + use solar_irrad_data, only: sol_irrad, we, nbins, sol_tsi, do_spctrl_scaling use interpolate_data, only: vertinterp use tropopause, only: tropopause_find_cam, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE use cospsimulator_intr, only: docosp, cospsimulator_intr_run, cosp_nradsteps + use cam_history_support, only: fillvalue ! Arguments @@ -881,6 +890,12 @@ subroutine radiation_tend( & real(r8) :: cld_lw_abs(nlwbands,state%ncol,pver) ! Cloud absorption optics depth real(r8) :: snow_lw_abs(nlwbands,state%ncol,pver) ! Snow absorption optics depth real(r8) :: grau_lw_abs(nlwbands,state%ncol,pver) ! Graupel absorption optics depth + real(r8) :: cld_tau(nswbands,state%ncol,pver) ! Cloud absorption optics depth (sw) + real(r8) :: snow_tau(nlwbands,state%ncol,pver) ! Snow absorption optics depth (sw) + real(r8) :: grau_tau(nlwbands,state%ncol,pver) ! Graupel absorption optics depth (sw) + real(r8) :: c_cld_tau(nlwbands,state%ncol,pver) + real(r8) :: c_cld_tau_w(nlwbands,state%ncol,pver) + real(r8) :: c_cld_tau_w_g(nlwbands,state%ncol,pver) real(r8), pointer :: qrs(:,:) ! shortwave radiative heating rate adjusted by air pressure thickness real(r8), pointer :: qrl(:,:) ! longwave radiative heating rate adjusted by air pressure thickness real(r8) :: qrs_prime(pcols, pver) ! shortwave heating rate @@ -1127,6 +1142,33 @@ subroutine radiation_tend( & else cldfsnow_in => null() end if + ! Grab additional pbuf fields for LW cloud optics + dei_idx = pbuf_get_index('DEI',errcode=err) + mu_idx = pbuf_get_index('MU',errcode=err) + lambda_idx = pbuf_get_index('LAMBDAC',errcode=err) + iciwp_idx = pbuf_get_index('ICIWP',errcode=err) + iclwp_idx = pbuf_get_index('ICLWP',errcode=err) + des_idx = pbuf_get_index('DES',errcode=err) + icswp_idx = pbuf_get_index('ICSWP',errcode=err) + icgrauwp_idx = pbuf_get_index('ICGRAUWP',errcode=err) ! Available when using MG3 + degrau_idx = pbuf_get_index('DEGRAU',errcode=err) ! Available when using MG3 + call pbuf_get_field(pbuf, lambda_idx, lambda) + call pbuf_get_field(pbuf, mu_idx, mu) + call pbuf_get_field(pbuf, iclwp_idx, iclwp) + call pbuf_get_field(pbuf, iciwp_idx, iciwp) + call pbuf_get_field(pbuf, dei_idx, dei) + call pbuf_get_field(pbuf, icswp_idx, icswp) + call pbuf_get_field(pbuf, des_idx, des) + if (icgrauwp_idx > 0) then + call pbuf_get_field(pbuf, icgrauwp_idx, icgrauwp) + end if + if (degrau_idx > 0) then + call pbuf_get_field(pbuf, degrau_idx, degrau) + end if + + do_graupel = ((icgrauwp_idx > 0) .and. (degrau_idx > 0) .and. associated(cldfgrau)) .and. graupel_in_rad + do_snow = associated(cldfsnow) + ! Prepare state variables, daylit columns, albedos for RRTMGP ! Also calculate modified cloud fraction call rrtmgp_inputs_run(dosw, dolw, associated(cldfsnow), associated(cldfgrau), & @@ -1155,13 +1197,26 @@ subroutine radiation_tend( & if (dosw) then ! Set cloud optical properties in cloud_sw object. - call rrtmgp_set_cloud_sw( & - state, pbuf, nlay, nday, idxday, nswgpts, & - nnite, idxnite, pmid_day, cld, cldfsnow, & - cldfgrau, cldfprime, graupel_in_rad, kdist_sw, cloud_sw, & - rd%tot_cld_vistau, rd%tot_icld_vistau, rd%liq_icld_vistau, & - rd%ice_icld_vistau, rd%snow_icld_vistau, rd%grau_icld_vistau, & - cld_tau_cloudsim, snow_tau_cloudsim, grau_tau_cloudsim ) + call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & + fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:ncol,:), & + cldfgrau(:ncol,:), cldfprime(:,:,:), cld_tau(:,:,:), grau_tau(:,:,:), snow_tau(:,:), degrau(:ncol,:), & + dei(:ncol,:), des(:ncol,:), iclwpth, icswpth, icgrauwpth, ext_sw_liq, ssa_sw_liq, & + asm_sw_liq, ext_sw_ice, asm_sw_ice, ssa_sw_ice, g_mu, g_d_eff, g_lambda,& + idx_sw_diag, do_graupel, do_snow, kdist_sw, cloud_sw, c_cld_tau(:,:), & + c_cld_tau_w(:,:), c_cld_tau_w_g(:,:), rd%tot_cld_vistau, rd%tot_icld_vistau, rd%liq_icld_vistau, rd%ice_icld_vistau, & + rd%snow_icld_vistau, rd%grau_icld_vistau, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if + + ! Cloud optics for COSP + cld_tau_cloudsim = cld_tau(idx_sw_cloudsim,:,:) + snow_tau_cloudsim = snow_tau(idx_sw_cloudsim,:,:) + grau_tau_cloudsim = grau_tau(idx_sw_cloudsim,:,:) + + call rrtmgp_sw_mcica_subcol_gen_run(dosw, kdist_sw, nswbands, nswgpts, nday, nlay, & + pver, tiny, idxday, ktopcam, ktoprad, cldfprime, c_cld_tau, & + c_cld_tau_w, c_cld_tau_w_g, cloud_sw, state%pmid(:ncol,:), errmsg, errflg) if (write_output) then call radiation_output_cld(lchnk, rd) @@ -1190,7 +1245,11 @@ subroutine radiation_tend( & !$acc end data ! Scale the solar source - call get_variability(toa_flux, sfac, band2gpt_sw, nswbands) + call rrtmgp_sw_solar_var_run(toa_flux, band2gpt_sw, nswbands, sol_irrad, we, nbins, sol_tsi, & + do_spctrl_scaling, sfac, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if toa_flux = toa_flux * sfac * eccf end if @@ -1251,33 +1310,6 @@ subroutine radiation_tend( & if (dolw) then - ! Grab additional pbuf fields for LW cloud optics - dei_idx = pbuf_get_index('DEI',errcode=err) - mu_idx = pbuf_get_index('MU',errcode=err) - lambda_idx = pbuf_get_index('LAMBDAC',errcode=err) - iciwp_idx = pbuf_get_index('ICIWP',errcode=err) - iclwp_idx = pbuf_get_index('ICLWP',errcode=err) - des_idx = pbuf_get_index('DES',errcode=err) - icswp_idx = pbuf_get_index('ICSWP',errcode=err) - icgrauwp_idx = pbuf_get_index('ICGRAUWP',errcode=err) ! Available when using MG3 - degrau_idx = pbuf_get_index('DEGRAU',errcode=err) ! Available when using MG3 - call pbuf_get_field(pbuf, lambda_idx, lambda) - call pbuf_get_field(pbuf, mu_idx, mu) - call pbuf_get_field(pbuf, iclwp_idx, iclwp) - call pbuf_get_field(pbuf, iciwp_idx, iciwp) - call pbuf_get_field(pbuf, dei_idx, dei) - call pbuf_get_field(pbuf, icswp_idx, icswp) - call pbuf_get_field(pbuf, des_idx, des) - if (icgrauwp_idx > 0) then - call pbuf_get_field(pbuf, icgrauwp_idx, icgrauwp) - end if - if (degrau_idx > 0) then - call pbuf_get_field(pbuf, degrau_idx, degrau) - end if - - do_graupel = ((icgrauwp_idx > 0) .and. (degrau_idx > 0) .and. associated(cldfgrau)) .and. graupel_in_rad - do_snow = associated(cldfsnow) - ! Set cloud optical properties in cloud_lw object. call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, nlaycam, cld(:ncol,:), cldfsnow_in, & cldfgrau_in, cldfprime(:ncol,:), kdist_lw, cloud_lw, lambda(:ncol,:), & From b980e040d4090d4b49453e2cf5f61244a2dbb122 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 2 Jul 2025 09:25:00 -0400 Subject: [PATCH 218/466] test updates --- cime_config/config_component.xml | 3 --- cime_config/testdefs/testlist_cam.xml | 12 +----------- .../testmods_dirs/cam/lonlat_fv_diags/user_nl_clm | 1 + doc/ChangeLog | 8 ++++---- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 57b8fe74b0..8614b6f46a 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -271,9 +271,6 @@ waccm_sc_2010_cam6 2010_geoschem - 1850-2005_cam5 - 1850-2005_cam4 - 1850-2005_cam4 1850-2005_cam4_bgc 1950-2010_ccmi_refc1_waccmx_ma diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 2785f6ef23..f24c4533c9 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -51,7 +51,7 @@ - + @@ -448,16 +448,6 @@ - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm index f3ac27f1e6..c28e69e7e6 100644 --- a/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/user_nl_clm @@ -25,3 +25,4 @@ hist_nhtfrq = 3 hist_mfilt = 1 hist_ndens = 1 +check_finidat_year_consistency=.false. diff --git a/doc/ChangeLog b/doc/ChangeLog index b104a5876f..faa8294fb9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -35,7 +35,7 @@ cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* . The limited area outputs are moved to here from ghgrmp_e8 . The FV angular momentum fixer/diags and circulation diags are moved here from outfrq3s_am - +. Add check_finidat_year_consistency=.false. to user_nl_clm (for ERI test) List all existing files that have been modified, and describe the changes: @@ -46,13 +46,13 @@ cime_config/testdefs/testslist_cam.xml ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase -. move the ERI test from nag to gnu, update mask, refactor testmods, and - change the compset to FHIST (there were no ERI tests for cam6 F-compsets). +. combine testmods from ghgrmp_e8 and outfrq3s_am into lonlat_fv_diags; + use with FHIST compset; update the mask: replace ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 and ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am by - ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags + ERI_D_Ln18.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags 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, From 7d1f09428471967260fe692b1ec0f0c8c58f2ece Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 2 Jul 2025 14:03:39 -0400 Subject: [PATCH 219/466] update tests --- cime_config/testdefs/testlist_cam.xml | 20 +++++++++---------- .../cam/outfrq3s_cosp/shell_commands | 5 +---- .../cam/outfrq3s_cospsathist/shell_commands | 8 +------- .../cam/outfrq3s_cospsathist/user_nl_cam | 4 +++- doc/ChangeLog | 12 +++++++++++ 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index f24c4533c9..0078275d9d 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -61,6 +61,16 @@ + + + + + + + + + + @@ -396,16 +406,6 @@ - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands index 11a171a04e..4d31b04a7a 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands @@ -1,7 +1,4 @@ -CAM_CONFIG_OPTS=`./xmlquery CAM_CONFIG_OPTS --value` -if [[ $CAM_CONFIG_OPTS != *"-cosp"* ]]; then - ./xmlchange --append CAM_CONFIG_OPTS="-cosp" -fi +./xmlchange --append CAM_CONFIG_OPTS="-cosp" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL ./xmlchange RUN_STARTDATE="19950101" diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands index 2bd27b646f..28a3c869d5 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands @@ -1,10 +1,4 @@ -CAM_CONFIG_OPTS=`./xmlquery CAM_CONFIG_OPTS --value` -if [[ $CAM_CONFIG_OPTS != *"-cosp"* ]]; then - ./xmlchange -append CAM_CONFIG_OPTS="-cosp" -fi +./xmlchange --append CAM_CONFIG_OPTS="-cosp" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_NML_USE_CASE=UNSET ./xmlchange RUN_STARTDATE="20050101" -./xmlchange REST_OPTION="nsteps" -./xmlchange REST_N=3 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/user_nl_cam index e893c96525..86f039a611 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/user_nl_cam @@ -11,4 +11,6 @@ lcltod_stop = 0,0,10800,7200,0 avgflag_pertape = 'I',' ','L','L','S' do_circulation_diags=.true. - fexcl1='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS' + fexcl1='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP', + 'CS_PIA','CS_RAINPOSS','CS_RAINPROB','CS_RAINCERT','CS_RAINHARD','CS_SNOWCERT','CS_SNOWPOSS', + 'CS_UN' diff --git a/doc/ChangeLog b/doc/ChangeLog index faa8294fb9..0640ae156a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -53,6 +53,18 @@ cime_config/testdefs/testslist_cam.xml ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am by ERI_D_Ln18.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags +. run test with FHIST and update mask: + replace + ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist + by + ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist + + +cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands +. don't unset the use case +. don't write restart file every 3 steps +cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/user_nl_cam +. extend fexcl1 list of cloudsat fields that depend on task count 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, From db93e5ac16928502ed28f1bb805e05113b385875 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 3 Jul 2025 13:58:03 -0400 Subject: [PATCH 220/466] update tests --- cime_config/testdefs/testlist_cam.xml | 27 +++++++------------ .../cam/nochem_clubbmf/shell_commands | 3 +++ .../cam/nochem_clubbmf/user_nl_cam | 8 ++++++ .../cam/nochem_clubbmf/user_nl_clm | 26 ++++++++++++++++++ doc/ChangeLog | 10 +++++++ 5 files changed, 57 insertions(+), 17 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 0078275d9d..c55a87c26f 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -71,6 +71,16 @@ + + + + + + + + + + @@ -199,14 +209,6 @@ - - - - - - - - @@ -1018,15 +1020,6 @@ - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/shell_commands b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/shell_commands new file mode 100644 index 0000000000..7d5d0bf81d --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/shell_commands @@ -0,0 +1,3 @@ +./xmlchange -append CAM_CONFIG_OPTS="-chem none" +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL diff --git a/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_cam new file mode 100644 index 0000000000..8d611ff48f --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_cam @@ -0,0 +1,8 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9 +inithist='ENDOFRUN' + +do_clubb_mf=.true. +do_clubb_mf_diag=.true. +deep_scheme='off' diff --git a/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_clm new file mode 100644 index 0000000000..12d5a36d2b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/user_nl_clm @@ -0,0 +1,26 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 diff --git a/doc/ChangeLog b/doc/ChangeLog index 708c0e61c5..e1ee4db205 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -37,6 +37,10 @@ cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* from outfrq3s_am . Add check_finidat_year_consistency=.false. to user_nl_clm (for ERI test) +cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/* +. test '-chem none' and clubb mass fluxes (CLUBB+MF) + - combines testmods outfrq9s_clubbmf and outfrq3s_ba + List all existing files that have been modified, and describe the changes: @@ -58,6 +62,12 @@ cime_config/testdefs/testslist_cam.xml ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist by ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist +. combine testmods outfrq9s_clubbmf and outfrq3s_ba and + replace + ERP_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf + SMS_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_ba + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands From 8eb527b35a312d2cebb2f299498d73d883750c1c Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 4 Jul 2025 12:56:27 -0400 Subject: [PATCH 221/466] address review comments --- cime_config/testdefs/testlist_cam.xml | 14 +------ .../cam/cosp_rad_diags/shell_commands | 5 +-- doc/ChangeLog | 37 +++++++++++++++---- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index c55a87c26f..8a4edffef1 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -9,16 +9,6 @@ - - - - - - - - - - @@ -91,10 +81,9 @@ - + - @@ -105,7 +94,6 @@ - diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands index 2ccc02333a..888aa3e122 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands @@ -1,7 +1,4 @@ -CAM_CONFIG_OPTS=`./xmlquery CAM_CONFIG_OPTS --value` -if [[ $CAM_CONFIG_OPTS != *"-cosp"* ]]; then - ./xmlchange -append CAM_CONFIG_OPTS="-cosp" -fi +./xmlchange -append CAM_CONFIG_OPTS="-cosp" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL ./xmlchange RUN_STARTDATE="19950101" diff --git a/doc/ChangeLog b/doc/ChangeLog index e1ee4db205..1a91a33f3d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,20 +3,29 @@ Tag name: Originator(s): eaton Date: -One-line Summary: testing updates -Github PR URL: +One-line Summary: refactor some cam6 tests +Github PR URL: https://github.com/ESCOMP/CAM/pull/1341 Purpose of changes (include the issue number and title text for each relevant GitHub issue): -Describe any changes made to build system: +. Many cam6 tests are currently run in an aquaplanet mode which unsets the + use case. This results in a non-standard configuration. The focus of + these mods is to shift the aquaplanet tests to use F compsets which + result in a standard model configuration. Also reduce the number of + tests by combining testmods with the intention of reducing overall test + time. +. When a test is modified, update the mask from POP to MOM and update + ERP to ERC to eliminate an unnecessary build. -Describe any changes made to the namelist: +Describe any changes made to build system: none -List any changes to the defaults for the boundary datasets: +Describe any changes made to the namelist: none -Describe any substantial timing or memory changes: +List any changes to the defaults for the boundary datasets: none -Code reviewed by: +Describe any substantial timing or memory changes: none + +Code reviewed by: cacraig List all files eliminated: @@ -68,7 +77,21 @@ cime_config/testdefs/testslist_cam.xml SMS_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_ba by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf +. remove the categories aux_cam_short and aux_cam_one as they aren't being + used. +. update the mask and change ERP to ERC: + replace + ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s + by + ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s + +cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands +cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands +cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands +. remove the conditional logic around the xmlchange command that sets the + -cosp option. This logic is not needed because -cosp is never set by the + compset definition. The logic was failing on my linux desktop. cime_config/testdefs/testmods_dirs/cam/outfrq3s_cospsathist/shell_commands . don't unset the use case From 2cd640bcfac5bf8a23f9ccc587b31ccf541c3a86 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 4 Jul 2025 13:42:24 -0400 Subject: [PATCH 222/466] fix testlist_cam.xml --- cime_config/testdefs/testlist_cam.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 8a4edffef1..96903ccb4f 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -46,7 +46,7 @@ - + From 6890e0e67af9a129b42a1d282fb67d5374733dbc Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 7 Jul 2025 11:01:19 -0400 Subject: [PATCH 223/466] Reorder tautms/taublj add terms for future vertical diffusion refactoring --- src/physics/cam/diffusion_solver.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/physics/cam/diffusion_solver.F90 b/src/physics/cam/diffusion_solver.F90 index 2a715596ea..06d4f20236 100644 --- a/src/physics/cam/diffusion_solver.F90 +++ b/src/physics/cam/diffusion_solver.F90 @@ -631,14 +631,14 @@ end function vd_lu_qdecomp ! the sum of 'taux(i) - ksrftms(i)*u(i,pver) + tauresx(i)'. if( itaures .eq. 1 ) then - tauresx(i) = taux(i) + tautmsx(i) + taubljx(i) + tauresx(i)- tauimpx(i) - tauresy(i) = tauy(i) + tautmsy(i) + taubljy(i) + tauresy(i)- tauimpy(i) + tauresx(i) = taux(i) + tauresx(i) - tauimpx(i) + tautmsx(i) + taubljx(i) + tauresy(i) = tauy(i) + tauresy(i) - tauimpy(i) + tautmsy(i) + taubljy(i) endif else - tautotx(i) = tautmsx(i) + taux(i) - tautoty(i) = tautmsy(i) + tauy(i) + tautotx(i) = taux(i) + tautmsx(i) + tautoty(i) = tauy(i) + tautmsy(i) tauresx(i) = 0._r8 tauresy(i) = 0._r8 From 20142360cc3a37ac2f4b5b2b25baee53db05ad3e Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 7 Jul 2025 13:40:42 -0400 Subject: [PATCH 224/466] move ERI test --- cime_config/testdefs/testlist_cam.xml | 13 +++++++-- .../cam/outfrq9s_bwic/user_nl_clm | 28 +++++++++++++++++++ doc/ChangeLog | 7 +++-- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 96903ccb4f..9916233f0c 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -41,12 +41,12 @@ - + - + @@ -1531,6 +1531,15 @@ + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_clm new file mode 100644 index 0000000000..c06b5a7d0b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_clm @@ -0,0 +1,28 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + +check_finidat_year_consistency=.false. diff --git a/doc/ChangeLog b/doc/ChangeLog index 1a91a33f3d..00794ff9a7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -50,6 +50,8 @@ cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/* . test '-chem none' and clubb mass fluxes (CLUBB+MF) - combines testmods outfrq9s_clubbmf and outfrq3s_ba +cime_config/testdefs/testmods_dirs/cam/outfrq9s_bwic/user_nl_clm +. add check_finidat_year_consistency=.false. for ERI test List all existing files that have been modified, and describe the changes: @@ -65,7 +67,7 @@ cime_config/testdefs/testslist_cam.xml ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 and ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am by - ERI_D_Ln18.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags + ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags . run test with FHIST and update mask: replace ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist @@ -84,7 +86,8 @@ cime_config/testdefs/testslist_cam.xml ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s by ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s - +. add ERI test on derecho: + ERI_Ln18.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands From 3cffae9a465db1ee6c37491d853788d9df167ee4 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 7 Jul 2025 14:19:23 -0600 Subject: [PATCH 225/466] modify radiation.F90 --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 98f0375198..cb10647b97 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1356,7 +1356,7 @@ subroutine radiation_tend( & !$acc lw_ds) call rrtmgp_lw_main_run(dolw, dolw, .false., .false., .false., & 0, ncol, 1, ncol, atm_optics_lw, & - cloud_lw, top_at_1, sources_lw, emis_sfc, kdist_lw, & + cloud_lw, sources_lw, emis_sfc, kdist_lw, & aer_lw, fluxlwup_jac, lw_ds, flwc, flw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) From 04735edbba0442082c3edd0133b1bea5d993dabe Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 8 Jul 2025 11:17:27 -0400 Subject: [PATCH 226/466] back out last minute ERI test (not working) and update ChangeLog --- cime_config/testdefs/testlist_cam.xml | 9 --------- doc/ChangeLog | 27 ++++++++++++++++++++------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 9916233f0c..5f6b79d7aa 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -1531,15 +1531,6 @@ - - - - - - - - - diff --git a/doc/ChangeLog b/doc/ChangeLog index 00794ff9a7..24770727ee 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,8 +1,8 @@ =============================================================== -Tag name: +Tag name: cam6_4_102 Originator(s): eaton -Date: +Date: 8 July 2025 One-line Summary: refactor some cam6 tests Github PR URL: https://github.com/ESCOMP/CAM/pull/1341 @@ -37,7 +37,6 @@ cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac_usecase/* cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/* . no longer needed - associated tests have been removed or refactored. - List all files added and what they do: cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* @@ -86,8 +85,6 @@ cime_config/testdefs/testslist_cam.xml ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s by ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s -. add ERI test on derecho: - ERI_Ln18.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands cime_config/testdefs/testmods_dirs/cam/outfrq3s_cosp/shell_commands @@ -109,16 +106,32 @@ appropriate machine below. All failed tests must be justified. derecho/intel/aux_cam: -derecho/nvhpc/aux_cam: +ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) +- new test - no baseline + +ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) +- diffs from change in outfrq9s_bwic testmods which now produce clm output + +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: +- pre-existing failure due to build-namelist error requiring CLM/CTSM external update + +derecho/nvhpc/aux_cam: All PASS. izumi/nag/aux_cam: +ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) +- new test - no baseline + izumi/gnu/aux_cam: +ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf (Overall: DIFF) +- new tests - no baselines + CAM tag used for the baseline comparison tests if different than previous tag: -Summarize any changes to answers: +Summarize any changes to answers: All answers BFB. =============================================================== =============================================================== From 96c16f1a6d9d1e29234cfe0bafd1b2df8310d242 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Tue, 8 Jul 2025 09:24:34 -0600 Subject: [PATCH 227/466] update rrtmgp tag --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 04b8cfc4b9..08ddc85cce 100644 --- a/.gitmodules +++ b/.gitmodules @@ -79,7 +79,7 @@ path = src/physics/rrtmgp/ext url = https://github.com/earth-system-radiation/rte-rrtmgp.git fxrequired = AlwaysRequired - fxtag = 77ff83ccf645e5bc404c138ca4e7a6e3abf5d963 + fxtag = v1.9.2 fxDONOTUSEurl = https://github.com/earth-system-radiation/rte-rrtmgp.git [submodule "rrtmgp-data"] From d1358e4508d69ed394565433da8edc1c41a57fc3 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 8 Jul 2025 14:27:43 -0600 Subject: [PATCH 228/466] add diagnostic output for BAM cloud chemistry --- src/chemistry/bulk_aero/aero_model.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chemistry/bulk_aero/aero_model.F90 b/src/chemistry/bulk_aero/aero_model.F90 index 1d71dd3216..f65f4507f4 100644 --- a/src/chemistry/bulk_aero/aero_model.F90 +++ b/src/chemistry/bulk_aero/aero_model.F90 @@ -369,9 +369,13 @@ subroutine aero_model_init( pbuf2d ) if( has_sox ) then call addfld( 'XPH_LWC',(/ 'lev' /), 'A','kg/kg', 'pH value multiplied by lwc') + call addfld( 'AQSO4_H2O2', horiz_only, 'A', 'kg/m2/s', 'SO4 aqueous phase chemistry due to H2O2') + call addfld( 'AQSO4_O3', horiz_only, 'A', 'kg/m2/s', 'SO4 aqueous phase chemistry due to O3') if ( history_aerosol ) then call add_default ('XPH_LWC', 1, ' ') + call add_default ('AQSO4_H2O2', 1, ' ') + call add_default ('AQSO4_O3', 1, ' ') endif endif @@ -1088,7 +1092,9 @@ subroutine aero_model_gasaerexch( state, loffset, ncol, lchnk, troplev, delt, re aqso4_h2o2,& aqso4_o3 & ) - call outfld( 'XPH_LWC',xphlwc(:ncol,:), ncol , lchnk ) + call outfld( 'XPH_LWC', xphlwc(:ncol,:), ncol, lchnk ) + call outfld( 'AQSO4_H2O2', aqso4_h2o2(:ncol), ncol, lchnk ) + call outfld( 'AQSO4_O3', aqso4_o3(:ncol), ncol, lchnk ) endif if( has_soa ) then From 5ac20fcd45357b6a3fab705b88ad048983ae8347 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Tue, 8 Jul 2025 16:57:57 -0600 Subject: [PATCH 229/466] working cloud optics and mcica --- .gitmodules | 4 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 56 ++--- src/physics/rrtmgp/rrtmgp_inputs_cam.F90 | 284 +---------------------- 4 files changed, 34 insertions(+), 312 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2b0d2485fb..ba6dbbdaf3 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_14_001 + url = https://github.com/peverwhee/atmospheric_physics + fxtag = 6e4e4938126c872a5fde124138a32ad12bb4f9d9 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 9cfcb2eaca..6e4e493812 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 9cfcb2eaca2c63a4a6f00799b226cd9893a38f64 +Subproject commit 6e4e4938126c872a5fde124138a32ad12bb4f9d9 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 8a9cc76c14..f84839459a 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -421,16 +421,16 @@ end function radiation_do !================================================================================================ subroutine radiation_init(pbuf2d) - use rrtmgp_pre, only: rrtmgp_pre_init - use rrtmgp_inputs, only: rrtmgp_inputs_init - use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init - use rrtmgp_lw_cloud_optics, only: rrtmgp_lw_cloud_optics_init - use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_init - use solar_irrad_data, only: do_spctrl_scaling, has_spectrum - use cloud_rad_props, only: cloud_rad_props_init - use rad_constituents, only: iceopticsfile, liqopticsfile - use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_init - use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_init + use rrtmgp_pre, only: rrtmgp_pre_init + use rrtmgp_inputs_setup, only: rrtmgp_inputs_setup_init + use rrtmgp_inputs_cam, only: rrtmgp_inputs_cam_init + use rrtmgp_cloud_optics_setup, only: rrtmgp_cloud_optics_setup_init + use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_init + use solar_irrad_data, only: do_spctrl_scaling, has_spectrum + use cloud_rad_props, only: cloud_rad_props_init + use rad_constituents, only: iceopticsfile, liqopticsfile + use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_init + use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_init ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -840,8 +840,7 @@ subroutine radiation_tend( & use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & - rrtmgp_set_gases_sw, rrtmgp_set_cloud_sw, & - rrtmgp_set_aer_sw + rrtmgp_set_gases_sw, rrtmgp_set_aer_sw ! RRTMGP drivers for flux calculations. use mo_rte_lw, only: rte_lw @@ -901,11 +900,11 @@ subroutine radiation_tend( & real(r8) :: snow_lw_abs(nlwbands,state%ncol,pver) ! Snow absorption optics depth real(r8) :: grau_lw_abs(nlwbands,state%ncol,pver) ! Graupel absorption optics depth real(r8) :: cld_tau(nswbands,state%ncol,pver) ! Cloud absorption optics depth (sw) - real(r8) :: snow_tau(nlwbands,state%ncol,pver) ! Snow absorption optics depth (sw) - real(r8) :: grau_tau(nlwbands,state%ncol,pver) ! Graupel absorption optics depth (sw) - real(r8) :: c_cld_tau(nlwbands,state%ncol,pver) - real(r8) :: c_cld_tau_w(nlwbands,state%ncol,pver) - real(r8) :: c_cld_tau_w_g(nlwbands,state%ncol,pver) + real(r8) :: snow_tau(nswbands,state%ncol,pver) ! Snow absorption optics depth (sw) + real(r8) :: grau_tau(nswbands,state%ncol,pver) ! Graupel absorption optics depth (sw) + real(r8) :: c_cld_tau(nswbands,state%ncol,pver) + real(r8) :: c_cld_tau_w(nswbands,state%ncol,pver) + real(r8) :: c_cld_tau_w_g(nswbands,state%ncol,pver) real(r8), pointer :: qrs(:,:) ! shortwave radiative heating rate adjusted by air pressure thickness real(r8), pointer :: qrl(:,:) ! longwave radiative heating rate adjusted by air pressure thickness real(r8) :: qrs_prime(pcols, pver) ! shortwave heating rate @@ -1020,7 +1019,7 @@ subroutine radiation_tend( & real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables real(r8), target :: zero_variable(1,1) - character(len=128) :: errmsg + character(len=512) :: errmsg integer :: errflg, err character(len=*), parameter :: sub = 'radiation_tend' !-------------------------------------------------------------------------------------- @@ -1212,25 +1211,26 @@ subroutine radiation_tend( & ! Set cloud optical properties in cloud_sw object. call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & - fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:ncol,:), & - cldfgrau(:ncol,:), cldfprime(:,:,:), cld_tau(:,:,:), grau_tau(:,:,:), snow_tau(:,:), degrau(:ncol,:), & - dei(:ncol,:), des(:ncol,:), iclwpth, icswpth, icgrauwpth, ext_sw_liq, ssa_sw_liq, & + fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:,:), & + cldfgrau(:,:), cldfprime(:ncol,:), cld_tau(:,:ncol,:), grau_tau(:,:ncol,:), snow_tau(:,:ncol,:), degrau(:ncol,:), & + dei(:ncol,:), des(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), icswp(:ncol,:), icgrauwp(:ncol,:), tiny, ext_sw_liq, ssa_sw_liq, & asm_sw_liq, ext_sw_ice, asm_sw_ice, ssa_sw_ice, g_mu, g_d_eff, g_lambda,& - idx_sw_diag, do_graupel, do_snow, kdist_sw, cloud_sw, c_cld_tau(:,:), & - c_cld_tau_w(:,:), c_cld_tau_w_g(:,:), rd%tot_cld_vistau, rd%tot_icld_vistau, rd%liq_icld_vistau, rd%ice_icld_vistau, & - rd%snow_icld_vistau, rd%grau_icld_vistau, errmsg, errflg) + idx_sw_diag, do_graupel, do_snow, kdist_sw, c_cld_tau(:,:ncol,:), & + c_cld_tau_w(:,:ncol,:), c_cld_tau_w_g(:,:ncol,:), rd%tot_cld_vistau(:ncol,:), rd%tot_icld_vistau(:ncol,:), & + rd%liq_icld_vistau(:ncol,:), rd%ice_icld_vistau(:ncol,:), & + rd%snow_icld_vistau(:ncol,:), rd%grau_icld_vistau(:ncol,:), errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if ! Cloud optics for COSP - cld_tau_cloudsim = cld_tau(idx_sw_cloudsim,:,:) - snow_tau_cloudsim = snow_tau(idx_sw_cloudsim,:,:) - grau_tau_cloudsim = grau_tau(idx_sw_cloudsim,:,:) + cld_tau_cloudsim(:ncol,:) = cld_tau(idx_sw_cloudsim,:,:) + snow_tau_cloudsim(:ncol,:) = snow_tau(idx_sw_cloudsim,:,:) + grau_tau_cloudsim(:ncol,:) = grau_tau(idx_sw_cloudsim,:,:) call rrtmgp_sw_mcica_subcol_gen_run(dosw, kdist_sw, nswbands, nswgpts, nday, nlay, & pver, tiny, idxday, ktopcam, ktoprad, cldfprime, c_cld_tau, & - c_cld_tau_w, c_cld_tau_w_g, cloud_sw, state%pmid(:ncol,:), errmsg, errflg) + c_cld_tau_w, c_cld_tau_w_g, cloud_sw, pmid_day(:ncol,:), errmsg, errflg) if (write_output) then call radiation_output_cld(lchnk, rd) diff --git a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 index b104275715..33bef44923 100644 --- a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 +++ b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 @@ -10,6 +10,7 @@ module rrtmgp_inputs_cam use shr_kind_mod, only: r8=>shr_kind_r8 use ppgrid, only: pcols, pver, pverp +use cam_logfile, only: iulog use physconst, only: stebol, pi @@ -38,6 +39,8 @@ module rrtmgp_inputs_cam use cam_abortutils, only: endrun use error_messages, only: alloc_err use radiation_utils, only: get_sw_spectral_boundaries_ccpp +use spmd_utils, only: masterproc +use spmd_utils, only: iam implicit none private @@ -47,7 +50,6 @@ module rrtmgp_inputs_cam rrtmgp_inputs_cam_init, & rrtmgp_get_gas_mmrs, & rrtmgp_set_gases_sw, & - rrtmgp_set_cloud_sw, & rrtmgp_set_aer_lw, & rrtmgp_set_aer_sw @@ -321,286 +323,6 @@ end subroutine rrtmgp_set_gases_sw !================================================================================================== -subroutine rrtmgp_set_cloud_sw( & - state, pbuf, nlay, nday, idxday, nswgpts, & - nnite, idxnite, pmid, cld, cldfsnow, & - cldfgrau, cldfprime, graupel_in_rad, kdist_sw, cloud_sw, & - tot_cld_vistau, tot_icld_vistau, liq_icld_vistau, ice_icld_vistau, snow_icld_vistau, & - grau_icld_vistau, cld_tau_cloudsim, snow_tau_cloudsim, grau_tau_cloudsim) - - ! Compute combined cloud optical properties. - ! Create MCICA stochastic arrays for cloud SW optical properties. - ! Initialize optical properties object (cloud_sw) and load with MCICA columns. - - ! arguments - type(physics_state), target, intent(in) :: state - type(physics_buffer_desc), pointer :: pbuf(:) - integer, intent(in) :: nlay ! number of layers in radiation calculation (may include "extra layer") - integer, intent(in) :: nday ! number of daylight columns - integer, intent(in) :: idxday(pcols) ! indices of daylight columns in the chunk - integer, intent(in) :: nswgpts ! number of shortwave g-points - integer, intent(in) :: nnite ! number of night columns - integer, intent(in) :: idxnite(pcols) ! indices of night columns in the chunk - - real(r8), intent(in) :: pmid(nday,nlay)! pressure at layer midpoints (Pa) used to seed RNG. - - real(r8), pointer :: cld(:,:) ! cloud fraction (liq+ice) - real(r8), pointer :: cldfsnow(:,:) ! cloud fraction of just "snow clouds" - real(r8), pointer :: cldfgrau(:,:) ! cloud fraction of just "graupel clouds" - real(r8), intent(in) :: cldfprime(pcols,pver) ! combined cloud fraction - - logical, intent(in) :: graupel_in_rad ! graupel in radiation code - class(ty_gas_optics_rrtmgp_ccpp), intent(in) :: kdist_sw ! shortwave gas optics object - type(ty_optical_props_2str_ccpp), intent(out) :: cloud_sw ! SW cloud optical properties object - - ! Diagnostic outputs - real(r8), intent(out) :: tot_cld_vistau(pcols,pver) ! gbx total cloud optical depth - real(r8), intent(out) :: tot_icld_vistau(pcols,pver) ! in-cld total cloud optical depth - real(r8), intent(out) :: liq_icld_vistau(pcols,pver) ! in-cld liq cloud optical depth - real(r8), intent(out) :: ice_icld_vistau(pcols,pver) ! in-cld ice cloud optical depth - real(r8), intent(out) :: snow_icld_vistau(pcols,pver) ! snow in-cloud visible sw optical depth - real(r8), intent(out) :: grau_icld_vistau(pcols,pver) ! Graupel in-cloud visible sw optical depth - real(r8), intent(out) :: cld_tau_cloudsim(pcols,pver) ! in-cloud liq+ice optical depth (for COSP) - real(r8), intent(out) :: snow_tau_cloudsim(pcols,pver)! in-cloud snow optical depth (for COSP) - real(r8), intent(out) :: grau_tau_cloudsim(pcols,pver)! in-cloud Graupel optical depth (for COSP) - - ! Local variables - - integer :: i, k, ncol - integer :: igpt, nver - integer :: istat - integer, parameter :: changeseed = 1 - - ! cloud radiative parameters are "in cloud" not "in cell" - real(r8) :: ice_tau (nswbands,pcols,pver) ! ice extinction optical depth - real(r8) :: ice_tau_w (nswbands,pcols,pver) ! ice single scattering albedo * tau - real(r8) :: ice_tau_w_g(nswbands,pcols,pver) ! ice asymmetry parameter * tau * w - real(r8) :: liq_tau (nswbands,pcols,pver) ! liquid extinction optical depth - real(r8) :: liq_tau_w (nswbands,pcols,pver) ! liquid single scattering albedo * tau - real(r8) :: liq_tau_w_g(nswbands,pcols,pver) ! liquid asymmetry parameter * tau * w - real(r8) :: cld_tau (nswbands,pcols,pver) ! cloud extinction optical depth - real(r8) :: cld_tau_w (nswbands,pcols,pver) ! cloud single scattering albedo * tau - real(r8) :: cld_tau_w_g(nswbands,pcols,pver) ! cloud asymmetry parameter * w * tau - real(r8) :: snow_tau (nswbands,pcols,pver) ! snow extinction optical depth - real(r8) :: snow_tau_w (nswbands,pcols,pver) ! snow single scattering albedo * tau - real(r8) :: snow_tau_w_g(nswbands,pcols,pver) ! snow asymmetry parameter * tau * w - real(r8) :: grau_tau (nswbands,pcols,pver) ! graupel extinction optical depth - real(r8) :: grau_tau_w (nswbands,pcols,pver) ! graupel single scattering albedo * tau - real(r8) :: grau_tau_w_g(nswbands,pcols,pver) ! graupel asymmetry parameter * tau * w - real(r8) :: c_cld_tau (nswbands,pcols,pver) ! combined cloud extinction optical depth - real(r8) :: c_cld_tau_w (nswbands,pcols,pver) ! combined cloud single scattering albedo * tau - real(r8) :: c_cld_tau_w_g(nswbands,pcols,pver) ! combined cloud asymmetry parameter * w * tau - - ! RRTMGP does not use this property in its 2-stream calculations. - real(r8) :: sw_tau_w_f(nswbands,pcols,pver) ! Forward scattered fraction * tau * w. - - ! Arrays for converting from CAM chunks to RRTMGP inputs. - real(r8), allocatable :: cldf(:,:) - real(r8), allocatable :: tauc(:,:,:) - real(r8), allocatable :: ssac(:,:,:) - real(r8), allocatable :: asmc(:,:,:) - real(r8), allocatable :: taucmcl(:,:,:) - real(r8), allocatable :: ssacmcl(:,:,:) - real(r8), allocatable :: asmcmcl(:,:,:) - real(r8), allocatable :: day_cld_tau(:,:,:) - real(r8), allocatable :: day_cld_tau_w(:,:,:) - real(r8), allocatable :: day_cld_tau_w_g(:,:,:) - - character(len=128) :: errmsg - character(len=*), parameter :: sub = 'rrtmgp_set_cloud_sw' - !-------------------------------------------------------------------------------- - - ncol = state%ncol - - ! Combine the cloud optical properties. These calculations are done on CAM "chunks". - - ! gammadist liquid optics - call get_liquid_optics_sw(state, pbuf, liq_tau, liq_tau_w, liq_tau_w_g, sw_tau_w_f) - ! Mitchell ice optics - call get_ice_optics_sw(state, pbuf, ice_tau, ice_tau_w, ice_tau_w_g, sw_tau_w_f) - - cld_tau(:,:ncol,:) = liq_tau(:,:ncol,:) + ice_tau(:,:ncol,:) - cld_tau_w(:,:ncol,:) = liq_tau_w(:,:ncol,:) + ice_tau_w(:,:ncol,:) - cld_tau_w_g(:,:ncol,:) = liq_tau_w_g(:,:ncol,:) + ice_tau_w_g(:,:ncol,:) - - ! add in snow - if (associated(cldfsnow)) then - call get_snow_optics_sw(state, pbuf, snow_tau, snow_tau_w, snow_tau_w_g, sw_tau_w_f) - do i = 1, ncol - do k = 1, pver - if (cldfprime(i,k) > 0._r8) then - c_cld_tau(:,i,k) = ( cldfsnow(i,k)*snow_tau(:,i,k) & - + cld(i,k)*cld_tau(:,i,k) )/cldfprime(i,k) - c_cld_tau_w(:,i,k) = ( cldfsnow(i,k)*snow_tau_w(:,i,k) & - + cld(i,k)*cld_tau_w(:,i,k) )/cldfprime(i,k) - c_cld_tau_w_g(:,i,k) = ( cldfsnow(i,k)*snow_tau_w_g(:,i,k) & - + cld(i,k)*cld_tau_w_g(:,i,k) )/cldfprime(i,k) - else - c_cld_tau(:,i,k) = 0._r8 - c_cld_tau_w(:,i,k) = 0._r8 - c_cld_tau_w_g(:,i,k) = 0._r8 - end if - end do - end do - else - c_cld_tau(:,:ncol,:) = cld_tau(:,:ncol,:) - c_cld_tau_w(:,:ncol,:) = cld_tau_w(:,:ncol,:) - c_cld_tau_w_g(:,:ncol,:) = cld_tau_w_g(:,:ncol,:) - end if - - ! add in graupel - if (associated(cldfgrau) .and. graupel_in_rad) then - call get_grau_optics_sw(state, pbuf, grau_tau, grau_tau_w, grau_tau_w_g, sw_tau_w_f) - do i = 1, ncol - do k = 1, pver - if (cldfprime(i,k) > 0._r8) then - c_cld_tau(:,i,k) = ( cldfgrau(i,k)*grau_tau(:,i,k) & - + cld(i,k)*c_cld_tau(:,i,k) )/cldfprime(i,k) - c_cld_tau_w(:,i,k) = ( cldfgrau(i,k)*grau_tau_w(:,i,k) & - + cld(i,k)*c_cld_tau_w(:,i,k) )/cldfprime(i,k) - c_cld_tau_w_g(:,i,k) = ( cldfgrau(i,k)*grau_tau_w_g(:,i,k) & - + cld(i,k)*c_cld_tau_w_g(:,i,k) )/cldfprime(i,k) - else - c_cld_tau(:,i,k) = 0._r8 - c_cld_tau_w(:,i,k) = 0._r8 - c_cld_tau_w_g(:,i,k) = 0._r8 - end if - end do - end do - end if - - ! cloud optical properties need to be re-ordered from the RRTMG spectral bands - ! (assumed in the optics datasets) to RRTMGP's - ice_tau(:,:ncol,:) = ice_tau(rrtmg_to_rrtmgp_swbands,:ncol,:) - liq_tau(:,:ncol,:) = liq_tau(rrtmg_to_rrtmgp_swbands,:ncol,:) - c_cld_tau(:,:ncol,:) = c_cld_tau(rrtmg_to_rrtmgp_swbands,:ncol,:) - c_cld_tau_w(:,:ncol,:) = c_cld_tau_w(rrtmg_to_rrtmgp_swbands,:ncol,:) - c_cld_tau_w_g(:,:ncol,:) = c_cld_tau_w_g(rrtmg_to_rrtmgp_swbands,:ncol,:) - if (associated(cldfsnow)) then - snow_tau(:,:ncol,:) = snow_tau(rrtmg_to_rrtmgp_swbands,:ncol,:) - end if - if (associated(cldfgrau) .and. graupel_in_rad) then - grau_tau(:,:ncol,:) = grau_tau(rrtmg_to_rrtmgp_swbands,:ncol,:) - end if - - ! Set arrays for diagnostic output. - ! cloud optical depth fields for the visible band - tot_icld_vistau(:ncol,:) = c_cld_tau(idx_sw_diag,:ncol,:) - liq_icld_vistau(:ncol,:) = liq_tau(idx_sw_diag,:ncol,:) - ice_icld_vistau(:ncol,:) = ice_tau(idx_sw_diag,:ncol,:) - if (associated(cldfsnow)) then - snow_icld_vistau(:ncol,:) = snow_tau(idx_sw_diag,:ncol,:) - endif - if (associated(cldfgrau) .and. graupel_in_rad) then - grau_icld_vistau(:ncol,:) = grau_tau(idx_sw_diag,:ncol,:) - endif - - ! multiply by total cloud fraction to get gridbox value - tot_cld_vistau(:ncol,:) = c_cld_tau(idx_sw_diag,:ncol,:)*cldfprime(:ncol,:) - - ! overwrite night columns with fillvalue - do i = 1, Nnite - tot_cld_vistau(IdxNite(i),:) = fillvalue - tot_icld_vistau(IdxNite(i),:) = fillvalue - liq_icld_vistau(IdxNite(i),:) = fillvalue - ice_icld_vistau(IdxNite(i),:) = fillvalue - if (associated(cldfsnow)) then - snow_icld_vistau(IdxNite(i),:) = fillvalue - end if - if (associated(cldfgrau) .and. graupel_in_rad) then - grau_icld_vistau(IdxNite(i),:) = fillvalue - end if - end do - - ! Cloud optics for COSP - cld_tau_cloudsim = cld_tau(idx_sw_cloudsim,:,:) - snow_tau_cloudsim = snow_tau(idx_sw_cloudsim,:,:) - grau_tau_cloudsim = grau_tau(idx_sw_cloudsim,:,:) - - ! if no daylight columns the cloud_sw object isn't initialized - if (nday > 0) then - - ! number of CAM's layers in radiation calculation. Does not include the "extra layer". - nver = pver - ktopcam + 1 - - allocate( & - cldf(nday,nver), & - day_cld_tau(nswbands,nday,nver), & - day_cld_tau_w(nswbands,nday,nver), & - day_cld_tau_w_g(nswbands,nday,nver), & - tauc(nswbands,nday,nver), taucmcl(nswgpts,nday,nver), & - ssac(nswbands,nday,nver), ssacmcl(nswgpts,nday,nver), & - asmc(nswbands,nday,nver), asmcmcl(nswgpts,nday,nver), stat=istat) - call alloc_err(istat, sub, 'cldf,..,asmcmcl', 9*nswgpts*nday*nver) - - ! Subset "chunk" data so just the daylight columns, and the number of CAM layers in the - ! radiation calculation are used by MCICA to produce subcolumns. - cldf = cldfprime( idxday(1:nday), ktopcam:) - day_cld_tau = c_cld_tau( :, idxday(1:nday), ktopcam:) - day_cld_tau_w = c_cld_tau_w( :, idxday(1:nday), ktopcam:) - day_cld_tau_w_g = c_cld_tau_w_g(:, idxday(1:nday), ktopcam:) - - ! Compute the optical properties needed for the 2-stream calculations. These calculations - ! are the same as the RRTMG version. - - ! set cloud optical depth, clip @ zero - tauc = merge(day_cld_tau, 0.0_r8, day_cld_tau > 0.0_r8) - ! set value of asymmetry - asmc = merge(day_cld_tau_w_g / max(day_cld_tau_w, tiny), 0.0_r8, day_cld_tau_w > 0.0_r8) - ! set value of single scattering albedo - ssac = merge(max(day_cld_tau_w, tiny) / max(tauc, tiny), 1.0_r8 , tauc > 0.0_r8) - ! set asymmetry to zero when tauc = 0 - asmc = merge(asmc, 0.0_r8, tauc > 0.0_r8) - - ! MCICA uses spectral data (on bands) to construct subcolumns (one per g-point) - call mcica_subcol_sw( & - kdist_sw%gas_props, nswbands, nswgpts, nday, nlay, & - nver, changeseed, pmid, cldf, tauc, & - ssac, asmc, taucmcl, ssacmcl, asmcmcl) - - ! Initialize object for SW cloud optical properties. - errmsg = cloud_sw%optical_props%alloc_2str(nday, nlay, kdist_sw%gas_props) - if (len_trim(errmsg) > 0) then - call endrun(trim(sub)//': ERROR: cloud_sw%optical_props%alloc_2str: '//trim(errmsg)) - end if - - ! If there is an extra layer in the radiation then this initialization - ! will provide the optical properties there. - cloud_sw%optical_props%tau = 0.0_r8 - cloud_sw%optical_props%ssa = 1.0_r8 - cloud_sw%optical_props%g = 0.0_r8 - - ! Set the properties on g-points. - do igpt = 1,nswgpts - cloud_sw%optical_props%g (:,ktoprad:,igpt) = asmcmcl(igpt,:,:) - cloud_sw%optical_props%ssa(:,ktoprad:,igpt) = ssacmcl(igpt,:,:) - cloud_sw%optical_props%tau(:,ktoprad:,igpt) = taucmcl(igpt,:,:) - end do - - ! validate checks that: tau > 0, ssa is in range [0,1], and g is in range [-1,1]. - errmsg = cloud_sw%optical_props%validate() - if (len_trim(errmsg) > 0) then - call endrun(sub//': ERROR: cloud_sw%optical_props%validate: '//trim(errmsg)) - end if - - ! delta scaling adjusts for forward scattering - errmsg = cloud_sw%optical_props%delta_scale() - if (len_trim(errmsg) > 0) then - call endrun(sub//': ERROR: cloud_sw%optical_props%delta_scale: '//trim(errmsg)) - end if - - ! All information is in cloud_sw, now deallocate local vars. - deallocate( & - cldf, tauc, ssac, asmc, & - taucmcl, ssacmcl, asmcmcl,& - day_cld_tau, day_cld_tau_w, day_cld_tau_w_g ) - - end if - -end subroutine rrtmgp_set_cloud_sw - -!================================================================================================== - subroutine rrtmgp_set_aer_lw(icall, state, pbuf, aer_lw) ! Load LW aerosol optical properties into the RRTMGP object. From 5d9fb913bf84391f824a5f23c91928257c3c8164 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 9 Jul 2025 11:14:20 -0400 Subject: [PATCH 230/466] add ERI tests --- cime_config/testdefs/testlist_cam.xml | 19 +++++- .../cam/outfrq3s_eri/shell_commands | 2 + .../cam/outfrq3s_eri/user_nl_cam | 5 ++ .../cam/outfrq3s_eri/user_nl_clm | 28 +++++++++ doc/ChangeLog | 60 +++++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 5f6b79d7aa..5a32e7d8c8 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -31,6 +31,15 @@ + + + + + + + + + @@ -1496,7 +1505,6 @@ - @@ -1504,6 +1512,15 @@ + + + + + + + + + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/shell_commands new file mode 100644 index 0000000000..eb40ad83e0 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/shell_commands @@ -0,0 +1,2 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_cam new file mode 100644 index 0000000000..eff7cc148f --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_cam @@ -0,0 +1,5 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=3,3,3,3,3,3 +inithist='ENDOFRUN' + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_clm new file mode 100644 index 0000000000..c28e69e7e6 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/user_nl_clm @@ -0,0 +1,28 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 3 +hist_mfilt = 1 +hist_ndens = 1 + +check_finidat_year_consistency=.false. diff --git a/doc/ChangeLog b/doc/ChangeLog index 24770727ee..8a25d3841a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,65 @@ =============================================================== +Tag name: +Originator(s): eaton +Date: +One-line Summary: testing updates +Github PR URL: + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +. Add ERI tests for F compsets. Previously only aquaplanet configurations tested. + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: + +List all files eliminated: + +List all files added and what they do: + +cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/* +. testmods for ERI test - 3 step output frequency and set + check_finidat_year_consistency=.false. in user_nl_clm + +List all existing files that have been modified, and describe the changes: + +cime_config/testdefs/testlist_cam.xml +. add ERI tests for cam6 and cam7 F compsets: + replace + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s + by + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri + and add + ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: + +=============================================================== +=============================================================== + Tag name: cam6_4_102 Originator(s): eaton Date: 8 July 2025 From c6df94c2272f8c510058b8274c28f29fa77b5ba1 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 9 Jul 2025 11:40:02 -0400 Subject: [PATCH 231/466] add FHIST_C5 --- cime_config/config_component.xml | 12 ++++-------- cime_config/config_compsets.xml | 5 +++++ doc/ChangeLog | 7 +++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 8614b6f46a..fc37b307fc 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -9,10 +9,10 @@ =============== --> CAM cam7 physics: - CAM cam6 physics: - CAM cam5 physics: - CAM cam4 physics: - CAM simplified and non-versioned physics : + CAM cam6 physics: + CAM cam5 physics: + CAM cam4 physics: + CAM simplified and non-versioned physics : + + FHIST_C5 + HIST_CAM50_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + FHIST_C4 HIST_CAM40_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV diff --git a/doc/ChangeLog b/doc/ChangeLog index 8a25d3841a..e3197e5f2c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -30,6 +30,13 @@ cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/* List all existing files that have been modified, and describe the changes: +cime_config/config_compsets.xml +. add + FHIST_C5 = HIST_CAM50_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + +cime_config/config_component.xml +. remove unused (and untested) modifiers %CLB, %RCO2 + cime_config/testdefs/testlist_cam.xml . add ERI tests for cam6 and cam7 F compsets: replace From fd27362b8bbfb86bcd11e74b298710a971b92d51 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 9 Jul 2025 13:11:30 -0400 Subject: [PATCH 232/466] remove QPC5HIST --- cime_config/config_compsets.xml | 5 ---- .../testmods_dirs/cam/volc/shell_commands | 3 --- .../testmods_dirs/cam/volc/user_nl_cam | 4 --- .../testmods_dirs/cam/volc/user_nl_clm | 27 ------------------- .../testmods_dirs/cam/volc/user_nl_cpl | 2 -- .../cam/volc_usecase/shell_commands | 4 --- .../cam/volc_usecase/user_nl_cam | 4 --- .../cam/volc_usecase/user_nl_clm | 27 ------------------- doc/ChangeLog | 4 +++ 9 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc_usecase/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_clm diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 4ac1b7c7c2..625c61a803 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -222,11 +222,6 @@ 2000_CAM50_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC5HIST - HIST_CAM50_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC5M7 2000_CAM50%MAM7_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testmods_dirs/cam/volc/shell_commands b/cime_config/testdefs/testmods_dirs/cam/volc/shell_commands deleted file mode 100644 index 31cab77117..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc/shell_commands +++ /dev/null @@ -1,3 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cam deleted file mode 100644 index 28010fa538..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cam +++ /dev/null @@ -1,4 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=-24,-24,-24,-24,-24,-24 -inithist='ENDOFRUN' diff --git a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_clm deleted file mode 100644 index 5634334558..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = -24 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/shell_commands b/cime_config/testdefs/testmods_dirs/cam/volc_usecase/shell_commands deleted file mode 100644 index 7c59ebd600..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="18840101" - diff --git a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_cam deleted file mode 100644 index 28010fa538..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_cam +++ /dev/null @@ -1,4 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=-24,-24,-24,-24,-24,-24 -inithist='ENDOFRUN' diff --git a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_clm deleted file mode 100644 index 5634334558..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/volc_usecase/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = -24 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/doc/ChangeLog b/doc/ChangeLog index e3197e5f2c..f5cf5d8874 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -21,6 +21,9 @@ Describe any substantial timing or memory changes: Code reviewed by: List all files eliminated: +cime_config/testdefs/testmods_dirs/cam/volc/* +cime_config/testdefs/testmods_dirs/cam/volc_usecase/* +. remove unused testmods List all files added and what they do: @@ -33,6 +36,7 @@ List all existing files that have been modified, and describe the changes: cime_config/config_compsets.xml . add FHIST_C5 = HIST_CAM50_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV +. remove QPC5HIST cime_config/config_component.xml . remove unused (and untested) modifiers %CLB, %RCO2 From 48732335435a818719b7acad34750931dd946f34 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 10 Jul 2025 14:10:41 -0400 Subject: [PATCH 233/466] update cosp_rad_diags testmods --- .../testmods_dirs/cam/cosp_rad_diags/shell_commands | 5 +++-- .../testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands index 888aa3e122..fc4081bcf9 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands @@ -1,4 +1,5 @@ -./xmlchange -append CAM_CONFIG_OPTS="-cosp" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="19950101" +./xmlchange -append CAM_CONFIG_OPTS="-cosp" +./xmlchange RUN_STARTDATE="19951231" +./xmlchange START_TOD="82800" diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam index 29fefff578..51f664198e 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam @@ -1,9 +1,12 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 nhtfrq=9,9,9,9,9,9 -inithist='ENDOFRUN' -fexcl1='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP', +interpolate_output=.true.,.false.,.false. + +cosp_histfile_num=2 +cosp_histfile_aux=3 +fexcl2='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP', 'CS_PIA','CS_RAINPOSS','CS_RAINPROB','CS_RAINCERT','CS_RAINHARD','CS_SNOWCERT','CS_SNOWPOSS', 'CS_UN' From 16829773ec84e11b28977da4b8d0c82efd361a73 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 10 Jul 2025 14:43:13 -0400 Subject: [PATCH 234/466] fix cosp_rad_diags testmods --- .../testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands | 2 +- .../testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands index fc4081bcf9..b6ca639830 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands @@ -1,5 +1,5 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange -append CAM_CONFIG_OPTS="-cosp" +./xmlchange --append CAM_CONFIG_OPTS="-cosp" ./xmlchange RUN_STARTDATE="19951231" ./xmlchange START_TOD="82800" diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam index 51f664198e..1b6661b14a 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam @@ -5,7 +5,8 @@ nhtfrq=9,9,9,9,9,9 interpolate_output=.true.,.false.,.false. cosp_histfile_num=2 -cosp_histfile_aux=3 +cosp_histfile_aux=.true. +cosp_histfile_aux_num=3 fexcl2='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP', 'CS_PIA','CS_RAINPOSS','CS_RAINPROB','CS_RAINCERT','CS_RAINHARD','CS_SNOWCERT','CS_SNOWPOSS', 'CS_UN' From fde6a26a9c19a41d987d121f79849442cb261a9a Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Thu, 10 Jul 2025 14:15:46 -0600 Subject: [PATCH 235/466] working gas optics run phase --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index ba6dbbdaf3..678f65eda7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 6e4e4938126c872a5fde124138a32ad12bb4f9d9 + fxtag = 91358211a4390c05729dc994762f9e6b8641a614 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 6e4e493812..91358211a4 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 6e4e4938126c872a5fde124138a32ad12bb4f9d9 +Subproject commit 91358211a4390c05729dc994762f9e6b8641a614 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index f84839459a..31d78ba4a8 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -838,6 +838,7 @@ subroutine radiation_tend( & use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_run use rrtmgp_sw_mcica_subcol_gen, only: rrtmgp_sw_mcica_subcol_gen_run use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run + use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & rrtmgp_set_gases_sw, rrtmgp_set_aer_sw @@ -1252,19 +1253,19 @@ subroutine radiation_tend( & !$acc data copyin(kdist_sw%gas_props,pmid_day,pint_day,t_day,gas_concs_sw%gas_concs) & !$acc copy(atm_optics_sw%optical_props) & !$acc copyout(toa_flux) - errmsg = kdist_sw%gas_props%gas_optics( & - pmid_day, pint_day, t_day, gas_concs_sw%gas_concs, atm_optics_sw%optical_props, & - toa_flux) - call stop_on_err(errmsg, sub, 'kdist_sw%gas_props%gas_optics') + call rrtmgp_sw_gas_optics_run(dosw, 1, nday, nday, pmid_day, pint_day, t_day, & + gas_concs_sw, atm_optics_sw, kdist_sw, toa_flux, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if !$acc end data ! Scale the solar source call rrtmgp_sw_solar_var_run(toa_flux, band2gpt_sw, nswbands, sol_irrad, we, nbins, sol_tsi, & - do_spctrl_scaling, sfac, errmsg, errflg) + do_spctrl_scaling, sfac, eccf, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if - toa_flux = toa_flux * sfac * eccf end if From 1f737d38c7dc2fec2593807b46ebb495f6004543 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Fri, 11 Jul 2025 08:52:31 -0600 Subject: [PATCH 236/466] ChangeLog entries --- doc/ChangeLog | 101 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 24770727ee..bd25a52b28 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,96 @@ =============================================================== +Tag name: cam6_4_103 +Originator(s): fvitt +Date: 11 Jul 2025 +One-line Summary: High-resolution (ne120) WACCM-X +Github PR URL: https://github.com/ESCOMP/CAM/pull/1317 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + + Sets default namelist parameters for ne120 resolution WACCM-X. + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: + New namelist option: + . se_min_temperature + Used by spectral element dynamical core to apply floor to temperature. + If set to a value greater than zero the floor is applied. + Otherwise, no floor is applied. + Default: 0. + +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 + +List all files eliminated: +A cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/shell_commands +A cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_cam +A cime_config/testdefs/testmods_dirs/cam/outfrq1h_wcmxhires/user_nl_clm + - new regression test for ne120 waccmx + +List all files added and what they do: +M bld/build-namelist + - set the following default namelist parameters for waccm-x: + . oplus_shapiro_const + . se_min_temperature + +M bld/configure + - set nlev to 273 for ne120 waccmx + +M bld/namelist_files/namelist_defaults_cam.xml + - default namelist settings for ne120 waccmx + +M bld/namelist_files/namelist_definition.xml + - new se_min_temperature namelist option + +M cime_config/config_pes.xml + - default PE-layout for ne120 waccmx on derecho + +M cime_config/testdefs/testlist_cam.xml + - new regression test for ne120 waccmx + +M src/dynamics/se/dycore/control_mod.F90 +M src/dynamics/se/dycore/prim_advance_mod.F90 +M src/dynamics/se/dyn_comp.F90 + - apply optional floor to temperature + +List all existing files that have been modified, and describe the changes: + +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: + NLFAIL ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s + NLFAIL ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s + NLFAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem + NLFAIL SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s + NLFAIL SMS_D_Ln9.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s_amie + - expected namelist compare failures due to new oplus_shapiro_const namelist parameter + for waccm-x + + FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update + +derecho/nvhpc/aux_cam: All PASS + +izumi/nag/aux_cam: + NLFAIL SMS_D_Ln3.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s + - expected namelist compare failure due to new oplus_shapiro_const namelist parameter + for waccm-x + +izumi/gnu/aux_cam: All PASS + +Summarize any changes to answers: bit-for-bit + +=============================================================== +=============================================================== + Tag name: cam6_4_102 Originator(s): eaton Date: 8 July 2025 @@ -14,7 +105,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi result in a standard model configuration. Also reduce the number of tests by combining testmods with the intention of reducing overall test time. -. When a test is modified, update the mask from POP to MOM and update +. When a test is modified, update the mask from POP to MOM and update ERP to ERC to eliminate an unnecessary build. Describe any changes made to build system: none @@ -40,9 +131,9 @@ cime_config/testdefs/testmods_dirs/cam/outfrq3s_unicon/* List all files added and what they do: cime_config/testdefs/testmods_dirs/cam/lonlat_fv_diags/* -. The limited area outputs are moved to here from ghgrmp_e8 +. The limited area outputs are moved to here from ghgrmp_e8 . The FV angular momentum fixer/diags and circulation diags are moved here - from outfrq3s_am + from outfrq3s_am . Add check_finidat_year_consistency=.false. to user_nl_clm (for ERI test) cime_config/testdefs/testmods_dirs/cam/nochem_clubbmf/* @@ -68,7 +159,7 @@ cime_config/testdefs/testslist_cam.xml by ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags . run test with FHIST and update mask: - replace + replace ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist by ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist @@ -79,7 +170,7 @@ cime_config/testdefs/testslist_cam.xml by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf . remove the categories aux_cam_short and aux_cam_one as they aren't being - used. + used. . update the mask and change ERP to ERC: replace ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s From b23726fc110e71c6eb3352a58a20c193f5b2e458 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 11 Jul 2025 12:48:33 -0400 Subject: [PATCH 237/466] update cosp_rad_diags testmods --- .../testmods_dirs/cam/cosp_rad_diags/shell_commands | 2 -- doc/ChangeLog | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands index b6ca639830..a8904b09cb 100644 --- a/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/shell_commands @@ -1,5 +1,3 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL ./xmlchange --append CAM_CONFIG_OPTS="-cosp" -./xmlchange RUN_STARTDATE="19951231" -./xmlchange START_TOD="82800" diff --git a/doc/ChangeLog b/doc/ChangeLog index f5cf5d8874..6329ead9c1 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -10,6 +10,10 @@ Purpose of changes (include the issue number and title text for each relevant Gi . Add ERI tests for F compsets. Previously only aquaplanet configurations tested. +. Add testing of interpolated output for FHISTC_LTso. Move COSP output to + a separate history file that uses the SE grid. The COSP output to a lat/lon + grid doesn't work. + Describe any changes made to build system: Describe any changes made to the namelist: @@ -50,6 +54,10 @@ cime_config/testdefs/testlist_cam.xml and add ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri +cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam +. move the cosp output to h1, add cosp aux output to h2 +. interpolate h0 to default lat/lon grid + 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 From 3a150d94f0ca1b87133ccd3e3bda7c885a8b5100 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 11 Jul 2025 12:33:25 -0600 Subject: [PATCH 238/466] update atmos phys hash --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index bc0dfe07ac..18dde3152e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 9cfcb2eaca2c63a4a6f00799b226cd9893a38f64 + fxtag = 74c16d2905c6945ba210103494971fc48aca34f2 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 9cfcb2eaca..74c16d2905 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 9cfcb2eaca2c63a4a6f00799b226cd9893a38f64 +Subproject commit 74c16d2905c6945ba210103494971fc48aca34f2 From c7ef889a969f6ff1c0788dd598842abbd6d40647 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Fri, 11 Jul 2025 15:58:29 -0600 Subject: [PATCH 239/466] working gas optics pre --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 17 ++- src/physics/rrtmgp/rrtmgp_inputs_cam.F90 | 183 ----------------------- 4 files changed, 14 insertions(+), 190 deletions(-) diff --git a/.gitmodules b/.gitmodules index 678f65eda7..78b395e3c8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 91358211a4390c05729dc994762f9e6b8641a614 + fxtag = 3d5a016dce00ece748ed89b8c1670ff1e0892848 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 91358211a4..3d5a016dce 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 91358211a4390c05729dc994762f9e6b8641a614 +Subproject commit 3d5a016dce00ece748ed89b8c1670ff1e0892848 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 31d78ba4a8..a7fce8eb74 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -838,10 +838,11 @@ subroutine radiation_tend( & use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_run use rrtmgp_sw_mcica_subcol_gen, only: rrtmgp_sw_mcica_subcol_gen_run use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run + use rrtmgp_sw_gas_optics_pre, only: rrtmgp_sw_gas_optics_pre_run use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & - rrtmgp_set_gases_sw, rrtmgp_set_aer_sw + rrtmgp_set_aer_sw ! RRTMGP drivers for flux calculations. use mo_rte_lw, only: rte_lw @@ -1243,10 +1244,16 @@ subroutine radiation_tend( & if (nday > 0) then + ! Grab the gas mass mixing ratios from rad_constituents + gas_mmrs = 0._r8 + call rrtmgp_get_gas_mmrs(icall, state, pbuf, nlay, gas_mmrs) + ! Set gas volume mixing ratios for this call in gas_concs_sw. - call rrtmgp_set_gases_sw( & - icall, state, pbuf, nlay, nday, & - idxday, gas_concs_sw) + call rrtmgp_sw_gas_optics_pre_run(gas_mmrs, state%pmid(:ncol,:), state%pint(:ncol,:), nlay, nday, gaslist, idxday, & + pverp, ktoprad, ktopcam, dosw, nradgas, gas_concs_sw, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if ! Compute the gas optics (stored in atm_optics_sw). ! toa_flux is the reference solar source from RRTMGP data. @@ -1359,7 +1366,7 @@ subroutine radiation_tend( & ! Set gas volume mixing ratios for this call in gas_concs_lw call rrtmgp_lw_gas_optics_pre_run(gas_mmrs, state%pmid(:ncol,:), state%pint(:ncol,:), nlay, ncol, gaslist, & - idxday, pverp, ktoprad, ktopcam, dolw, nradgas, gas_concs_lw, errmsg, errflg) + pverp, ktoprad, ktopcam, dolw, nradgas, gas_concs_lw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if diff --git a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 index 33bef44923..b3686428f5 100644 --- a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 +++ b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 @@ -49,7 +49,6 @@ module rrtmgp_inputs_cam public :: & rrtmgp_inputs_cam_init, & rrtmgp_get_gas_mmrs, & - rrtmgp_set_gases_sw, & rrtmgp_set_aer_lw, & rrtmgp_set_aer_sw @@ -115,158 +114,6 @@ end subroutine rrtmgp_inputs_cam_init !========================================================================================= -function get_molar_mass_ratio(gas_name) result(massratio) - - ! return the molar mass ratio of dry air to gas based on gas_name - - character(len=*),intent(in) :: gas_name - real(r8) :: massratio - - ! local variables - real(r8), parameter :: amdw = 1.607793_r8 ! Molecular weight of dry air / water vapor - real(r8), parameter :: amdc = 0.658114_r8 ! Molecular weight of dry air / carbon dioxide - real(r8), parameter :: amdo = 0.603428_r8 ! Molecular weight of dry air / ozone - real(r8), parameter :: amdm = 1.805423_r8 ! Molecular weight of dry air / methane - real(r8), parameter :: amdn = 0.658090_r8 ! Molecular weight of dry air / nitrous oxide - real(r8), parameter :: amdo2 = 0.905140_r8 ! Molecular weight of dry air / oxygen - real(r8), parameter :: amdc1 = 0.210852_r8 ! Molecular weight of dry air / CFC11 - real(r8), parameter :: amdc2 = 0.239546_r8 ! Molecular weight of dry air / CFC12 - - character(len=*), parameter :: sub='get_molar_mass_ratio' - !---------------------------------------------------------------------------- - - select case (trim(gas_name)) - case ('H2O') - massratio = amdw - case ('CO2') - massratio = amdc - case ('O3') - massratio = amdo - case ('CH4') - massratio = amdm - case ('N2O') - massratio = amdn - case ('O2') - massratio = amdo2 - case ('CFC11') - massratio = amdc1 - case ('CFC12') - massratio = amdc2 - case default - call endrun(sub//": Invalid gas: "//trim(gas_name)) - end select - -end function get_molar_mass_ratio - -!========================================================================================= - -subroutine rad_gas_get_vmr(icall, gas_name, state, pbuf, nlay, numactivecols, gas_concs, idxday) - - ! Set volume mixing ratio in gas_concs object. - ! The gas_concs%set_vmr method copies data into internally allocated storage. - - integer, intent(in) :: icall ! index of climate/diagnostic radiation call - character(len=*), intent(in) :: gas_name - type(physics_state), target, intent(in) :: state - type(physics_buffer_desc), pointer :: pbuf(:) - integer, intent(in) :: nlay ! number of layers in radiation calculation - integer, intent(in) :: numactivecols ! number of columns, ncol for LW, nday for SW - - type(ty_gas_concs_ccpp), intent(inout) :: gas_concs ! the result is VMR inside gas_concs - - integer, optional, intent(in) :: idxday(:) ! indices of daylight columns in a chunk - - ! Local variables - integer :: i, idx(numactivecols) - integer :: istat - real(r8), pointer :: gas_mmr(:,:) - real(r8), allocatable :: gas_vmr(:,:) - real(r8), allocatable :: mmr(:,:) - real(r8) :: massratio - - ! For ozone profile above model - real(r8) :: P_top, P_int, P_mid, alpha, beta, a, b, chi_mid, chi_0, chi_eff - - character(len=128) :: errmsg - character(len=*), parameter :: sub = 'rad_gas_get_vmr' - !---------------------------------------------------------------------------- - - ! set the column indices; when idxday is provided (e.g. daylit columns) use them, otherwise just count. - do i = 1, numactivecols - if (present(idxday)) then - idx(i) = idxday(i) - else - idx(i) = i - end if - end do - - ! gas_mmr points to a "chunk" in either the state or pbuf objects. That storage is - ! dimensioned (pcols,pver). - call rad_cnst_get_gas(icall, gas_name, state, pbuf, gas_mmr) - - ! Copy into storage for RRTMGP - allocate(mmr(numactivecols, nlay), stat=istat) - call alloc_err(istat, sub, 'mmr', numactivecols*nlay) - allocate(gas_vmr(numactivecols, nlay), stat=istat) - call alloc_err(istat, sub, 'gas_vmr', numactivecols*nlay) - - do i = 1, numactivecols - mmr(i,ktoprad:) = gas_mmr(idx(i),ktopcam:) - end do - - ! If an extra layer is being used, copy mmr from the top layer of CAM to the extra layer. - if (nlay == pverp) then - mmr(:,1) = mmr(:,2) - end if - - ! special case: H2O is specific humidity, not mixing ratio. Use r = q/(1-q): - if (gas_name == 'H2O') then - mmr = mmr / (1._r8 - mmr) - end if - - ! convert MMR to VMR, multipy by ratio of dry air molar mas to gas molar mass. - massratio = get_molar_mass_ratio(gas_name) - gas_vmr = mmr * massratio - - ! special case: Setting O3 in the extra layer: - ! - ! For the purpose of attenuating solar fluxes above the CAM model top, we assume that ozone - ! mixing decreases linearly in each column from the value in the top layer of CAM to zero at - ! the pressure level set by P_top. P_top has been set to 50 Pa (0.5 hPa) based on model tuning - ! to produce temperatures at the top of CAM that are most consistent with WACCM at similar pressure levels. - - if ((gas_name == 'O3') .and. (nlay == pverp)) then - P_top = 50.0_r8 - do i = 1, numactivecols - P_int = state%pint(idx(i),1) ! pressure (Pa) at upper interface of CAM - P_mid = state%pmid(idx(i),1) ! pressure (Pa) at midpoint of top layer of CAM - alpha = log(P_int/P_top) - beta = log(P_mid/P_int)/log(P_mid/P_top) - - a = ( (1._r8 + alpha) * exp(-alpha) - 1._r8 ) / alpha - b = 1._r8 - exp(-alpha) - - if (alpha .gt. 0) then ! only apply where top level is below 80 km - chi_mid = gas_vmr(i,1) ! molar mixing ratio of O3 at midpoint of top layer - chi_0 = chi_mid / (1._r8 + beta) - chi_eff = chi_0 * (a + b) - gas_vmr(i,1) = chi_eff - end if - end do - end if - - errmsg = gas_concs%gas_concs%set_vmr(gas_name, gas_vmr) - if (len_trim(errmsg) > 0) then - call endrun(sub//': ERROR, gas_concs%set_vmr: '//trim(errmsg)) - end if - - deallocate(gas_vmr) - deallocate(mmr) - -end subroutine rad_gas_get_vmr - -!================================================================================================== - subroutine rrtmgp_get_gas_mmrs(icall, state, pbuf, nlay, gas_mmrs) ! Retrieve mass mixing ratios for radiatively active gases from rad_constituents @@ -293,36 +140,6 @@ end subroutine rrtmgp_get_gas_mmrs !================================================================================================== -subroutine rrtmgp_set_gases_sw( & - icall, state, pbuf, nlay, nday, & - idxday, gas_concs) - - ! Return gas_concs with gas volume mixing ratio on DAYLIT columns. - ! Set all gases in radconstants gaslist. - - ! arguments - integer, intent(in) :: icall ! index of climate/diagnostic radiation call - type(physics_state), target, intent(in) :: state - type(physics_buffer_desc), pointer :: pbuf(:) - integer, intent(in) :: nlay - integer, intent(in) :: nday - integer, intent(in) :: idxday(:) - type(ty_gas_concs_ccpp), intent(inout) :: gas_concs - - ! local variables - integer :: i - character(len=*), parameter :: sub = 'rrtmgp_set_gases_sw' - !---------------------------------------------------------------------------- - - ! use the optional argument idxday to specify which columns are sunlit - do i = 1,nradgas - call rad_gas_get_vmr(icall, gaslist(i), state, pbuf, nlay, nday, gas_concs, idxday=idxday) - end do - -end subroutine rrtmgp_set_gases_sw - -!================================================================================================== - subroutine rrtmgp_set_aer_lw(icall, state, pbuf, aer_lw) ! Load LW aerosol optical properties into the RRTMGP object. From 5fbb531e447289563473de4a7d90dfb85fb30bde Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Sun, 13 Jul 2025 12:36:44 -0600 Subject: [PATCH 240/466] new hash; use rrtmgp_sw_main_run --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 30 +++++++++--------------------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.gitmodules b/.gitmodules index 78b395e3c8..3a826c99e3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 3d5a016dce00ece748ed89b8c1670ff1e0892848 + fxtag = 1a677317ed64a4016d37f794b795cc12324b03dd fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 3d5a016dce..1a677317ed 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 3d5a016dce00ece748ed89b8c1670ff1e0892848 +Subproject commit 1a677317ed64a4016d37f794b795cc12324b03dd diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index a7fce8eb74..d3b22f9072 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -840,6 +840,7 @@ subroutine radiation_tend( & use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run use rrtmgp_sw_gas_optics_pre, only: rrtmgp_sw_gas_optics_pre_run use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_run + use rrtmgp_sw_main, only: rrtmgp_sw_main_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & rrtmgp_set_aer_sw @@ -1293,24 +1294,11 @@ subroutine radiation_tend( & !$acc cloud_sw%optical_props%g) & !$acc copy(fswc%fluxes, fswc%fluxes%flux_net,fswc%fluxes%flux_up,fswc%fluxes%flux_dn, & !$acc fsw%fluxes, fsw%fluxes%flux_net,fsw%fluxes%flux_up,fsw%fluxes%flux_dn) - errmsg = aer_sw%optical_props%increment(atm_optics_sw%optical_props) - call stop_on_err(errmsg, sub, 'aer_sw%optical_props%increment') - - ! Compute clear-sky fluxes. - errmsg = rte_sw(& - atm_optics_sw%optical_props, top_at_1, coszrs_day, toa_flux, & - alb_dir, alb_dif, fswc%fluxes) - call stop_on_err(errmsg, sub, 'clear-sky rte_sw') - - ! Increment the aerosol+gas optics (in atm_optics_sw) by the cloud optics in cloud_sw. - errmsg = cloud_sw%optical_props%increment(atm_optics_sw%optical_props) - call stop_on_err(errmsg, sub, 'cloud_sw%optical_props%increment') - - ! Compute all-sky fluxes. - errmsg = rte_sw(& - atm_optics_sw%optical_props, top_at_1, coszrs_day, toa_flux, & - alb_dir, alb_dif, fsw%fluxes) - call stop_on_err(errmsg, sub, 'all-sky rte_sw') + call rrtmgp_sw_main_run(dosw, .true., .true., nday, 1, nday, atm_optics_sw, cloud_sw, top_at_1, & + aer_sw, coszrs_day, toa_flux, alb_dir, alb_dif, fswc, fsw, errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if !$acc end data end if @@ -1406,9 +1394,9 @@ subroutine radiation_tend( & !$acc flw%fluxes%flux_up, flw%fluxes%flux_dn, & !$acc lw_ds) call rrtmgp_lw_main_run(dolw, dolw, .false., .false., .false., & - 0, ncol, 1, ncol, atm_optics_lw, & - cloud_lw, top_at_1, sources_lw, emis_sfc, kdist_lw, & - aer_lw, fluxlwup_jac, lw_ds, flwc, flw, errmsg, errflg) + 0, atm_optics_lw, cloud_lw, top_at_1, sources_lw, & + emis_sfc, kdist_lw, aer_lw, fluxlwup_jac, lw_ds, & + flwc, flw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if From e6b56bdb94a6bb84e91912b9573667a90abefa11 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Mon, 14 Jul 2025 12:06:04 -0600 Subject: [PATCH 241/466] update atmos phys --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3a826c99e3..18b0779bb7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 1a677317ed64a4016d37f794b795cc12324b03dd + fxtag = 912bec257dfab3d5c90589e4ecace18a5ce5fe10 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 1a677317ed..912bec257d 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 1a677317ed64a4016d37f794b795cc12324b03dd +Subproject commit 912bec257dfab3d5c90589e4ecace18a5ce5fe10 From 8bd5ea714b8023f5d9bc837e852dd58fc85c8a04 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Mon, 14 Jul 2025 14:19:24 -0600 Subject: [PATCH 242/466] move rrtmgp external to atmospheric-physics --- .gitmodules | 9 +-------- bld/configure | 16 ++++++++-------- src/atmos_phys | 2 +- src/physics/rrtmgp/ext | 1 - src/physics/rrtmgp/radiation.F90 | 8 ++++---- 5 files changed, 14 insertions(+), 22 deletions(-) delete mode 160000 src/physics/rrtmgp/ext diff --git a/.gitmodules b/.gitmodules index 18b0779bb7..2e99382b37 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 912bec257dfab3d5c90589e4ecace18a5ce5fe10 + fxtag = e324603cdb8d24cc4781a67c87ea791409e7b4df fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics @@ -75,13 +75,6 @@ fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/HEMCO_CESM.git -[submodule "rte-rrtmgp"] - path = src/physics/rrtmgp/ext - url = https://github.com/earth-system-radiation/rte-rrtmgp.git - fxrequired = AlwaysRequired - fxtag = v1.7 - fxDONOTUSEurl = https://github.com/earth-system-radiation/rte-rrtmgp.git - [submodule "rrtmgp-data"] path = src/physics/rrtmgp/data url = https://github.com/earth-system-radiation/rrtmgp-data.git diff --git a/bld/configure b/bld/configure index 220a80c53c..016810c306 100755 --- a/bld/configure +++ b/bld/configure @@ -2136,16 +2136,16 @@ sub write_filepath } elsif ($rad eq 'rrtmgp') { print $fh "$camsrcdir/src/physics/rrtmgp\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/extensions\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/gas-optics\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rrtmgp-frontend\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rte-frontend\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/extensions\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/gas-optics\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rrtmgp-frontend\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rte-frontend\n"; if ($use_rrtmgp_gpu) { - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rrtmgp-kernels/accel\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rte-kernels/accel\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rrtmgp-kernels/accel\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rte-kernels/accel\n"; } - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rrtmgp-kernels\n"; - print $fh "$camsrcdir/src/physics/rrtmgp/ext/rte-kernels\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rrtmgp-kernels\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/ext/rte-kernels\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp\n"; print $fh "$camsrcdir/src/atmos_phys/schemes/rrtmgp/objects\n"; } diff --git a/src/atmos_phys b/src/atmos_phys index 912bec257d..e324603cdb 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 912bec257dfab3d5c90589e4ecace18a5ce5fe10 +Subproject commit e324603cdb8d24cc4781a67c87ea791409e7b4df diff --git a/src/physics/rrtmgp/ext b/src/physics/rrtmgp/ext deleted file mode 160000 index 4d8c5df4c6..0000000000 --- a/src/physics/rrtmgp/ext +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4d8c5df4c63434aaab854afd1b02f5986d41dfb3 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index d3b22f9072..54e08e13b5 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -832,7 +832,7 @@ subroutine radiation_tend( & use rrtmgp_lw_mcica_subcol_gen, only: rrtmgp_lw_mcica_subcol_gen_run use rrtmgp_lw_gas_optics_pre, only: rrtmgp_lw_gas_optics_pre_run use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_run - use rrtmgp_lw_main, only: rrtmgp_lw_main_run + use rrtmgp_lw_rte, only: rrtmgp_lw_rte_run use rrtmgp_dry_static_energy_tendency, only: rrtmgp_dry_static_energy_tendency_run use rrtmgp_post, only: rrtmgp_post_run use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_run @@ -840,7 +840,7 @@ subroutine radiation_tend( & use rrtmgp_sw_cloud_optics, only: rrtmgp_sw_cloud_optics_run use rrtmgp_sw_gas_optics_pre, only: rrtmgp_sw_gas_optics_pre_run use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_run - use rrtmgp_sw_main, only: rrtmgp_sw_main_run + use rrtmgp_sw_rte, only: rrtmgp_sw_rte_run use rrtmgp_inputs_cam, only: rrtmgp_get_gas_mmrs, rrtmgp_set_aer_lw, & rrtmgp_set_aer_sw @@ -1294,7 +1294,7 @@ subroutine radiation_tend( & !$acc cloud_sw%optical_props%g) & !$acc copy(fswc%fluxes, fswc%fluxes%flux_net,fswc%fluxes%flux_up,fswc%fluxes%flux_dn, & !$acc fsw%fluxes, fsw%fluxes%flux_net,fsw%fluxes%flux_up,fsw%fluxes%flux_dn) - call rrtmgp_sw_main_run(dosw, .true., .true., nday, 1, nday, atm_optics_sw, cloud_sw, top_at_1, & + call rrtmgp_sw_rte_run(dosw, .true., .true., nday, 1, nday, atm_optics_sw, cloud_sw, top_at_1, & aer_sw, coszrs_day, toa_flux, alb_dir, alb_dif, fswc, fsw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) @@ -1393,7 +1393,7 @@ subroutine radiation_tend( & !$acc flwc%fluxes%flux_dn, flw%fluxes, flw%fluxes%flux_net, & !$acc flw%fluxes%flux_up, flw%fluxes%flux_dn, & !$acc lw_ds) - call rrtmgp_lw_main_run(dolw, dolw, .false., .false., .false., & + call rrtmgp_lw_rte_run(dolw, dolw, .false., .false., .false., & 0, atm_optics_lw, cloud_lw, top_at_1, sources_lw, & emis_sfc, kdist_lw, aer_lw, fluxlwup_jac, lw_ds, & flwc, flw, errmsg, errflg) From 46e92a0f44d49058ddb464b41d119821e7ff88b0 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Mon, 14 Jul 2025 14:27:30 -0600 Subject: [PATCH 243/466] new hash --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2e99382b37..62f0670a4f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = e324603cdb8d24cc4781a67c87ea791409e7b4df + fxtag = f18d36a86182b3a0140d30953b5d4153d7bffe46 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index e324603cdb..f18d36a861 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit e324603cdb8d24cc4781a67c87ea791409e7b4df +Subproject commit f18d36a86182b3a0140d30953b5d4153d7bffe46 From 14f5976b7610d6ab277bd1425f69ad3ce8e3a3dd Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Mon, 14 Jul 2025 14:40:03 -0600 Subject: [PATCH 244/466] new atmos_phys hash --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 62f0670a4f..e093273b64 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = f18d36a86182b3a0140d30953b5d4153d7bffe46 + fxtag = 37ad42677a3be738161d5bb5b931f4561901b880 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From 2302f71276cebf255816c6b79f13da8791790794 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Jul 2025 18:15:26 -0400 Subject: [PATCH 245/466] Update git submodule tags to match fxtag in .gitmodules for git-fleximod. --- components/cice | 2 +- libraries/FMS | 2 +- src/atmos_phys | 2 +- tools/CUPiD | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/cice b/components/cice index e51ab1d3f1..48737cc126 160000 --- a/components/cice +++ b/components/cice @@ -1 +1 @@ -Subproject commit e51ab1d3f12ae2959b7df978f77dc5a1ee0181d3 +Subproject commit 48737cc126b3a9ea9839746a4fc1e4a17aeddb93 diff --git a/libraries/FMS b/libraries/FMS index 1aa662acd0..99a1d4f46a 160000 --- a/libraries/FMS +++ b/libraries/FMS @@ -1 +1 @@ -Subproject commit 1aa662acd094b53d157973782dd442f46e30ee48 +Subproject commit 99a1d4f46a0e4586c51e8a2f68eb905201b128ff diff --git a/src/atmos_phys b/src/atmos_phys index 4589f434a3..fb56446930 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 4589f434a31e031e665d0d73b379ffb72cd81659 +Subproject commit fb564469305ae9718f5ceebf85ccf478ff821331 diff --git a/tools/CUPiD b/tools/CUPiD index 18c0e37022..e3d16bf491 160000 --- a/tools/CUPiD +++ b/tools/CUPiD @@ -1 +1 @@ -Subproject commit 18c0e370222070ae6b9bc061d3d404b115fdc1d3 +Subproject commit e3d16bf49184cd6dbb18c17072031b974605c8e5 From 2d1cdd2377f2356e19616c8e1da75befa5f9b7ce Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Jul 2025 18:18:41 -0400 Subject: [PATCH 246/466] Update git submodule tags to match fxtag in .gitmodules for git-fleximod (2). --- cime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime b/cime index 38bf614c60..1006c39f59 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 38bf614c60645ae5c87a948750036faf4bba26d0 +Subproject commit 1006c39f59577d47994fb3fb897566b2b8fa12ed From 0343351557795a427ea6bbd64afb59b19b351868 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Jul 2025 22:04:37 -0400 Subject: [PATCH 247/466] Finalize ChangeLog. --- doc/ChangeLog | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index bd25a52b28..6c1f4ecc1b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,113 @@ =============================================================== +Tag name: cam6_4_104 +Originator(s): jimmielin +Date: Jul 14, 2025 +One-line Summary: Reorder tautms/taublj add terms for future vertical diffusion refactoring +Github PR URL: https://github.com/ESCOMP/CAM/pull/1343 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - reorders terms for summation of taublj and tautms to be at the end of taures instead of in the middle to facilitate future decoupling of the TMS and Beljaars code from the diffusion solver (part of #1314; part of #1205) + - update git submodule hashes to be consistent with .gitmodules fxTag to pass GitHub action test + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: cacraig + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M src/physics/cam/diffusion_solver.F90 + - reorder terms for vertical diffusion surface stresses. + +M cime +M components/cice +M libraries/FMS +M src/atmos_phys +M tools/CUPiD + - checkout git submodules corresponding to .gitmodules file for consistency + (no externals are updated -- only makes submodule hashes in repository consistent with .gitmodules file) + +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: + ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 (Overall: DIFF) details: + ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details: + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) details: + SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details: + SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging (Overall: DIFF) details: + SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s (Overall: DIFF) details: + SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs (Overall: DIFF) details: + SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details: + - new answers due to changes in order where Beljaars/TMS added to residual surface stress. + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF) details: + - new answers due to changes in order where Beljaars/TMS added to residual surface stress. + +izumi/nag/aux_cam: + ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: DIFF) details: + SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: DIFF) details: + - new answers due to changes in order where Beljaars/TMS added to residual surface stress. + +izumi/gnu/aux_cam: + ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) details: + ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf (Overall: DIFF) details: + ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + - new answers due to changes in order where Beljaars/TMS added to residual surface stress. + + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: +Answer changes for all configurations using diffusion solver and Beljaars -or- TMS, +due to change in order of operations in computing residual surface stress. +Not all compsets + +=============================================================== + + Tag name: cam6_4_103 Originator(s): fvitt Date: 11 Jul 2025 From 5859cd2e976b0820ac76ae3c449d55fbaf18745d Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 14 Jul 2025 22:34:15 -0400 Subject: [PATCH 248/466] add missing text in changelog --- doc/ChangeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 6c1f4ecc1b..2acb2b065b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -103,7 +103,10 @@ tag: Summarize any changes to answers: Answer changes for all configurations using diffusion solver and Beljaars -or- TMS, due to change in order of operations in computing residual surface stress. -Not all compsets +Not all compsets change. CAM4 compsets are unaffected because they do not have orographic drag, +so the change in adding zeros will not affect answers. "Q"/aquaplanet compsets did not see +answer changes. + =============================================================== From ae69dbb46e4208af7177768ef20bc8362799e802 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 16 Jul 2025 16:02:48 -0400 Subject: [PATCH 249/466] Copy cloud fraction to ast (stratiform_cloud_area_fraction) for pbuf snapshot --- src/physics/cam/rk_stratiform_cam.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/physics/cam/rk_stratiform_cam.F90 b/src/physics/cam/rk_stratiform_cam.F90 index 29e2e353a9..f3ec285d51 100644 --- a/src/physics/cam/rk_stratiform_cam.F90 +++ b/src/physics/cam/rk_stratiform_cam.F90 @@ -1336,6 +1336,12 @@ subroutine rk_stratiform_cam_tend( & call outfld( 'ICIMR' , icimr, pcols, lchnk ) call outfld( 'ICWMR' , icwmr, pcols, lchnk ) + ! Copy stratiform_cloud_fraction to pbuf for recording in snapshot + !REMOVECAM: this is no longer needed when CAM is retired and pcols no longer exists + ast(:, :) = 0._r8 + !REMOVECAM_END + ast(:ncol, :) = cld(:ncol, :) + call t_stopf('stratiform_microphys') ! Save variables for use in the macrophysics at the next time step From a2d05aec1925db3832e9fe59184c3d3b82a07fdc Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 16 Jul 2025 23:06:49 -0400 Subject: [PATCH 250/466] ... wrong cloud field (use stratiform cloud not rh cloud) --- src/physics/cam/rk_stratiform_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/rk_stratiform_cam.F90 b/src/physics/cam/rk_stratiform_cam.F90 index f3ec285d51..e751bc3ce7 100644 --- a/src/physics/cam/rk_stratiform_cam.F90 +++ b/src/physics/cam/rk_stratiform_cam.F90 @@ -1340,7 +1340,7 @@ subroutine rk_stratiform_cam_tend( & !REMOVECAM: this is no longer needed when CAM is retired and pcols no longer exists ast(:, :) = 0._r8 !REMOVECAM_END - ast(:ncol, :) = cld(:ncol, :) + ast(:ncol, :) = cldst(:ncol, :) call t_stopf('stratiform_microphys') From 04be369cfa7193df2066f965cb1e21240015bf00 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 17 Jul 2025 11:27:48 -0600 Subject: [PATCH 251/466] latest atmosphys hash; update to latest file io reader interfaces --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/utils/cam_ccpp/pio_reader.F90 | 148 +++++++++++++++++------------- src/utils/cam_pio_utils.F90 | 25 ++++- 4 files changed, 107 insertions(+), 70 deletions(-) diff --git a/.gitmodules b/.gitmodules index 18dde3152e..bd5f0e3a3e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 74c16d2905c6945ba210103494971fc48aca34f2 + fxtag = 403130ec1bb3e245255182a3c3167aba3a84d4f3 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 74c16d2905..403130ec1b 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 74c16d2905c6945ba210103494971fc48aca34f2 +Subproject commit 403130ec1bb3e245255182a3c3167aba3a84d4f3 diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 index c3e4a38732..5a6983df7e 100644 --- a/src/utils/cam_ccpp/pio_reader.F90 +++ b/src/utils/cam_ccpp/pio_reader.F90 @@ -23,7 +23,7 @@ module pio_reader type :: file_handle_t logical :: is_file_open = .false. !Is NetCDF file currently open? type(file_desc_t) :: pio_fh !PIO File handle type - character(len=cl) :: file_path = '' !Local path to NetCDF file + character(len=cl) :: file_path = 'UNSET' !Local path to NetCDF file end type type, extends(abstract_netcdf_reader_t) :: pio_reader_t @@ -55,34 +55,34 @@ module pio_reader contains subroutine open_netcdf_file(this, file_path, errmsg, errcode) - use ioFileMod, only: getfil - use cam_pio_utils, only: cam_pio_openfile - use pio, only: PIO_NOWRITE + use cam_pio_utils, only: cam_pio_openfile + use pio, only: PIO_NOWRITE + use pio, only: PIO_NOERR class(pio_reader_t), intent(inout) :: this character(len=*), intent(in) :: file_path integer, intent(out) :: errcode character(len=*), intent(out) :: errmsg - character(len=cl) :: local_file_path !NetCDF file path on local file system - if(this%sima_pio_fh%is_file_open) then errcode = 1 - errmsg = "Trying to reuse pio_reader already used for: '"//this%sima_pio_fh%file_path + errmsg = "Trying to reuse pio_reader already used for: '"//trim(this%sima_pio_fh%file_path)//"'" return end if - if(file_path == 'UNSET_PATH') then - errcode = 1 - errmsg = "Found UNSET_PATH trying to open file" + !Open provided file with PIO: + call cam_pio_openfile(this%sima_pio_fh%pio_fh, file_path, PIO_NOWRITE, & + errcode=errcode) + + if(errcode /= PIO_NOERR) then + !Extract error message from PIO and return: + call get_pio_errmsg(1, file_path, errcode, errmsg, & + file_msg=.true.) return end if - call getfil(file_path, local_file_path) - call cam_pio_openfile(this%sima_pio_fh%pio_fh, local_file_path, PIO_NOWRITE) - !Set file handle metadata - this%sima_pio_fh%file_path = local_file_path + this%sima_pio_fh%file_path = file_path this%sima_pio_fh%is_file_open = .true. !File was successfully opened @@ -91,7 +91,7 @@ subroutine open_netcdf_file(this, file_path, errmsg, errcode) end subroutine open_netcdf_file subroutine close_netcdf_file(this, errmsg, errcode) - use pio, only: pio_closefile + use cam_pio_utils, only: cam_pio_closefile class(pio_reader_t), intent(inout) :: this integer, intent(out) :: errcode @@ -106,11 +106,12 @@ subroutine close_netcdf_file(this, errmsg, errcode) end if !Close NetCDF File: - call pio_closefile(this%sima_pio_fh%pio_fh) + call cam_pio_closefile(this%sima_pio_fh%pio_fh) - !Inidcate that file handle array id is no longer in use: + !Indicate that file handle array id is no longer in use, + !but keep file path the same in case it is needed for + !related error messages in other routines: this%sima_pio_fh%is_file_open = .false. - this%sima_pio_fh%file_path = '' !File was successfully closed errcode = 0 @@ -152,7 +153,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -190,7 +191,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 0) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -256,7 +257,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -294,7 +295,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 1) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -401,7 +402,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -439,7 +440,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 2) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -546,7 +547,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -584,7 +585,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 3) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -691,7 +692,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -729,7 +730,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 4) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -836,7 +837,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -874,7 +875,7 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 5) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -986,7 +987,7 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1024,7 +1025,7 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 0) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1090,7 +1091,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1128,7 +1129,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 1) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1235,7 +1236,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1273,7 +1274,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 2) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1380,7 +1381,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1418,7 +1419,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 3) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1525,7 +1526,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1563,7 +1564,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 4) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1670,7 +1671,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1708,7 +1709,7 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 5) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1820,7 +1821,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -1857,7 +1858,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1876,7 +1877,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 1) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1985,7 +1986,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -2022,7 +2023,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2041,7 +2042,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 2) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2150,7 +2151,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -2187,7 +2188,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2206,7 +2207,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 3) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2315,7 +2316,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -2352,7 +2353,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2371,7 +2372,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 4) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2480,7 +2481,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -2517,7 +2518,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2536,7 +2537,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 5) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2646,7 +2647,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) if(.not.this%sima_pio_fh%is_file_open) then !File isn't actually open, so throw an error errcode = file_not_open_err - errmsg = "File '"//this%sima_pio_fh%file_path//"' is not open, need to call 'open_file' first." + errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." return end if @@ -2683,7 +2684,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) !(as we cannot currently handle string-type variables): if(nc_type /= PIO_CHAR) then errcode = not_char_type_err - errmsg = "NetCDF Variable '"//varname//"' is not a character array. File can be found here: "//file_path + errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2702,7 +2703,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errcode = 0 if(ndims /= 6) then errcode = bad_var_rank_err - errmsg = "Variable '"//varname//"' isn't declared with the correct number of dimensions" + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -2781,7 +2782,7 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_5d - subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg) + subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg, file_msg) !Set error message based off PIO error code, !and then reset PIO error code to caller-specified !error code. @@ -2795,21 +2796,36 @@ subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg) use pio, only: PIO_NOERR !Input/output arguments: - integer, intent(in) :: caller_errcode !New error code caller wants. - character(len=*), intent(in) :: varname - integer, intent(inout) :: errcode !Error code - character(len=*), intent(inout) :: errmsg !Error message + integer, intent(in) :: caller_errcode !New error code caller wants. + character(len=*), intent(in) :: varname + integer, intent(inout) :: errcode !Error code + character(len=*), intent(inout) :: errmsg !Error message + logical, optional, intent(in) :: file_msg !If true then error is for file. !Local variables: integer :: strerr !Error code returned if pio_strerror fails character(len=256) :: pio_error + logical :: file_msg_flag + !Check if error is for a file instead of a variable: + if (present(file_msg)) then + file_msg_flag = file_msg + else + file_msg_flag = .false. + end if + + !Get error message from PIO: strerr = pio_strerror(errcode, pio_error) - write(errmsg, '(a,a,a,a)') 'Error for variable "', varname, '" - message: ', pio_error if(strerr /= PIO_NOERR) then write(errmsg, *) "Failed to get error message for PIO code: ", errcode errcode = pio_get_msg_err else + if (file_msg_flag) then + write(errmsg, '(a,a,a,a)') "Error for file '", varname, "' - message: ", trim(pio_error) + else + !Variable error message + write(errmsg, '(a,a,a,a)') "Error for variable '", varname, "' - message: ", trim(pio_error) + end if errcode = caller_errcode end if end subroutine get_pio_errmsg diff --git a/src/utils/cam_pio_utils.F90 b/src/utils/cam_pio_utils.F90 index 63691c8910..788957869a 100644 --- a/src/utils/cam_pio_utils.F90 +++ b/src/utils/cam_pio_utils.F90 @@ -1123,15 +1123,25 @@ subroutine cam_pio_createfile(file, fname, mode_in) end subroutine cam_pio_createfile - subroutine cam_pio_openfile(file, fname, mode) + subroutine cam_pio_openfile(file, fname, mode, errcode) use pio, only: pio_openfile, file_desc_t, pio_noerr, pio_iotask_rank + use pio, only: pio_seterrorhandling, PIO_BCAST_ERROR use cam_abortutils, only: endrun type(file_desc_t), intent(inout), target :: file character(len=*), intent(in) :: fname integer, intent(in) :: mode + integer, optional, intent(out) :: errcode integer :: ierr + integer :: err_handling + + ! If an error code is present, make sure PIO returns an error + ! instead of aborting + if (present(errcode)) then + call pio_seterrorhandling(pio_subsystem, PIO_BCAST_ERROR, & + oldmethod=err_handling) + end if if(pio_iotask_rank(pio_subsystem) == 0) then write(iulog,*) 'Opening existing file ', trim(fname), file%fh @@ -1139,10 +1149,21 @@ subroutine cam_pio_openfile(file, fname, mode) ierr = pio_openfile(pio_subsystem, file, pio_iotype, fname, mode) - if(ierr/= PIO_NOERR) then + if (present(errcode)) then + errcode = ierr + end if + + if(ierr/= PIO_NOERR .and. (.not. present(errcode))) then call endrun('Failed to open '//trim(fname)//' to read') end if + ! If an error code is requested, then set the error + ! handling back to whatever it was running before + ! this routine + if (present(errcode)) then + call pio_seterrorhandling(pio_subsystem, err_handling) + end if + end subroutine cam_pio_openfile subroutine cam_pio_closefile(file) From a6b478d8cb8118a1ae745cd089b3f2919d32b83e Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 17 Jul 2025 13:59:45 -0400 Subject: [PATCH 252/466] update ccs_config submodule --- .gitmodules | 2 +- ccs_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 2b0d2485fb..1f40371437 100644 --- a/.gitmodules +++ b/.gitmodules @@ -144,7 +144,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.40_izumi_update0.1 +fxtag = ccs_config_cesm1.0.53 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git diff --git a/ccs_config b/ccs_config index 4051731712..8103ad41d9 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 40517317127076c5e772f5eba2599899df6fb527 +Subproject commit 8103ad41d9657950ff8e387524a3df1e84bcda9e From 7f6631d0b4dbf32cba6668cc449de4472f32e9f9 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 21 Jul 2025 12:08:20 -0400 Subject: [PATCH 253/466] update ChangeLog --- doc/ChangeLog | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2acb2b065b..c8dddf7d6e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,56 @@ =============================================================== +Tag name: +Originator(s): eaton +Date: +One-line Summary: update ccs_config_cesm submodule +Github PR URL: + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +. update the ccs_config_cesm submodule to include the gnu-12 environment on izumi. + +Describe any changes made to build system: none + +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: + +List all files eliminated: none + +List all files added and what they do: none + +List all existing files that have been modified, and describe the changes: + +.gitmodules +- update: + ccs_config_cesm1.0.40_izumi_update0.1 -> ccs_config_cesm1.0.53 + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: + +=============================================================== +=============================================================== + Tag name: cam6_4_104 Originator(s): jimmielin Date: Jul 14, 2025 From 7fc34ad86a2fc07783e0c563eee12ff635351865 Mon Sep 17 00:00:00 2001 From: Rob von Behren Date: Mon, 21 Jul 2025 15:09:44 -0700 Subject: [PATCH 254/466] Fixes for atmospheric chemistry horizontal and vertical interpolation routines. --- .../utils/horizontal_interpolate.F90 | 502 ++++++++++-------- src/chemistry/utils/tracer_data.F90 | 225 ++++---- 2 files changed, 429 insertions(+), 298 deletions(-) diff --git a/src/chemistry/utils/horizontal_interpolate.F90 b/src/chemistry/utils/horizontal_interpolate.F90 index 6a7ae7e4f8..f8f04a4052 100644 --- a/src/chemistry/utils/horizontal_interpolate.F90 +++ b/src/chemistry/utils/horizontal_interpolate.F90 @@ -12,247 +12,330 @@ module horizontal_interpolate private save - real(r8) :: gw1(1000), gw2(1000) - public :: xy_interp_init, xy_interp contains - subroutine xy_interp_init(im1,jm1,lon0,lat0,im2,jm2,weight_x,weight_y,use_flight_distance) + + subroutine check_invariant(invariant_condition, message) + logical, intent(in) :: invariant_condition + character(len=*), intent(in) :: message + if ( .not.(invariant_condition) ) then + call endrun("Invariant check failed: " // message) + endif + end subroutine check_invariant + + + real(r8) function normalize_lon_right(left, right) + ! Normalize the right side of a longitude interval such that + ! norm_right > left and (norm_right - left) is in (0, 360] + real(r8), intent(in) :: left, right + + normalize_lon_right = right + + do while (normalize_lon_right <= left) + normalize_lon_right = normalize_lon_right + 360.0_r8 + end do + do while (normalize_lon_right - 360.0_r8 > left) + normalize_lon_right = normalize_lon_right - 360.0_r8 + end do + return + end function normalize_lon_right + + + real(r8) function lon_length(left, right) + ! Compute a longitude interval length, accouting for wrapping + ! around the globe. Input values are normalized so that the + ! return value is always in the range (0, 360]. + real(r8), intent(in) :: left, right + + lon_length = normalize_lon_right(left, right) - left + return + end function lon_length + + + real(r8) function normalize_lon_value(lon) + ! Normalize a lon value to be in [0, 360) + real(r8), intent(in) :: lon + real(r8) :: norm_lon + + norm_lon = lon + do while (norm_lon < 0) + norm_lon = norm_lon + 360.0_r8 + end do + do while (norm_lon >= 360.0_r8) + norm_lon = norm_lon - 360.0_r8 + end do + + normalize_lon_value = norm_lon + return + end function normalize_lon_value + + + real(r8) function calculate_lon_overlap(input_left, input_right, sim_left, sim_right) + ! Return the length of the overlap between the input and + ! simulation longitude ranges. Values are normalized before + ! calculation to ensure correct handling of ranges which wrap over + ! zero. + real(r8), intent(in) :: input_left, input_right, sim_left, sim_right + real(r8) norm_input_left, norm_input_right, norm_sim_left, norm_sim_right + real(r8) overlap_left, overlap_right + + ! Normalzie so norm_sim_left is in [0, 360) and norm_sim_left < norm_sim_right + norm_sim_left = normalize_lon_value(sim_left) + norm_sim_right = normalize_lon_right(norm_sim_left, sim_right) + + ! Normalize the input values to ensure that norm_input_left < norm_sim_left + norm_input_left = normalize_lon_value(input_left) - 360.0_r8 ! now in [-360, 0) + norm_input_right = normalize_lon_right(norm_input_left, input_right) + + ! if norm_input is strictly to the left of norm_sim, slide up by 360 + do while (norm_input_right <= norm_sim_left) + norm_input_left = norm_input_left + 360.0_r8 + norm_input_right = norm_input_right + 360.0_r8 + end do + + ! Compute overlap + overlap_left = merge(norm_input_left, norm_sim_left, norm_input_left > norm_sim_left) + overlap_right = merge(norm_input_right, norm_sim_right, norm_input_right < norm_sim_right) + if (overlap_left < overlap_right) then + calculate_lon_overlap = overlap_right - overlap_left + else + calculate_lon_overlap = 0 + endif + return + end function calculate_lon_overlap + + + real(r8) function lon_weight(input_left, input_right, sim_left, sim_right, use_flight_distance) + ! Compute how much input data in the (input_left, input_right) + ! longitude band contributes to simulation data in the (sim_left, + ! sim_right) band. + ! + ! use_flight_distance indicates how the input data should be + ! interpreted. If true, input data is assumed to be a total value + ! for the input grid cell. If false, input data is assumed to be + ! a mixing ratio. + real(r8), intent(in) :: input_left, input_right, sim_left, sim_right + logical, intent(in) :: use_flight_distance !.true. = flight distance, .false. = all mixing ratios + real(r8) :: overlap_len + + ! Sanity check that inputs aren't too large or too small. For + ! really huge floating point values, adding / subtracting 360 will + ! encounter roundoff errors, and could cause while loops to go + ! forever. Values much outside the [-360, 360] range are probably + ! an error anyway, so abort if we encounter anything suspicious here. + call check_invariant(((-2000.0 < input_left).and.(input_left < 2000.0)), "input_left is out of range") + call check_invariant(((-2000.0 < input_right).and.(input_right < 2000.0)), "input_right is out of range") + call check_invariant(((-2000.0 < sim_left).and.(sim_left < 2000.0)), "sim_left is out of range") + call check_invariant(((-2000.0 < sim_right).and.(sim_right < 2000.0)), "sim_right is out of range") + + overlap_len = calculate_lon_overlap(input_left, input_right, sim_left, sim_right) + + if (overlap_len == 0) then + ! No overlap; weight is zero + lon_weight = 0 + + elseif (use_flight_distance) then + ! Data values are total within the grid cell. Hence, the + ! weight is just the fraction of the area of the original grid + ! cell which overlaps the new cell. + lon_weight = overlap_len / lon_length(input_left, input_right) + else + ! Data values are mixing ratios. To compute how much this + ! input grid cell contributes to the mixing ratio in the + ! simulation grid cell, we multiply by the fraction of the sim + ! grid cell occupied by the overlap. Fortunately this is just + ! the ratio of the longitude ranges, since the grid cells are + ! rectangular in lat,lon coordinates. + lon_weight = overlap_len / lon_length(sim_left, sim_right) + endif + + ! Floating point precision can wind up with lon_weight slightly + ! out of the [0, 1] range, so fix up the values if that happens. + ! If things are farther off, then crash with an error. + call check_invariant((-0.0000001_r8 <= lon_weight) .and. (lon_weight <= 1.0000001_r8), "lon_weight must be in [0, 1]") + if (lon_weight < 0.0_r8) then + lon_weight = 0.0_r8 + endif + if (lon_weight > 1.0_r8) then + lon_weight = 1.0_r8 + endif + + return + end function lon_weight + + + real(r8) function lat_band_weight(low, high) + ! Retuns the unit-less weight of the latitude band on the globe + ! from [low, high]. The area of a latitudinal slice of height h + ! is just 2*pi*r*h. Since we only need to get ratios of areas, + ! this just computes the difference in the y-coordinates from low + ! to high. + real(r8), intent(in) :: low, high + + lat_band_weight = sin(high * SHR_CONST_PI / 180.0_r8) - sin(low * SHR_CONST_PI / 180.0_r8) + return + end function lat_band_weight + + + real(r8) function normalize_lat(lat) + ! Truncate a latitude value to be within [-90, 90]. Values much + ! outside that range are probably an error in the calling code, so + ! exit if we see those. + real(r8), intent(in) :: lat + call check_invariant(((-91.0_r8 < lat).and.(lat < 91.0_r8)), "Lat value is out of expected range.") + if (lat < -90.0_r8) then + normalize_lat = -90.0_r8 + else if (lat > 90.0_r8) then + normalize_lat = 90.0_r8 + else + normalize_lat = lat + endif + end function normalize_lat + + + real(r8) function lat_weight(input_bot, input_top, sim_bot, sim_top, use_flight_distance) + ! Compute how much input data in the (input_left, input_right) + ! longitude band contributes to simulation data in the (sim_left, + ! sim_right) band. + ! + ! use_flight_distance indicates how the input data should be + ! interpreted. If true, input data is assumed to be a total value + ! for the input grid cell. If false, input data is assumed to be + ! a mixing ratio. + real(r8), intent(in) :: input_bot, input_top, sim_bot, sim_top + logical, intent(in) :: use_flight_distance !.true. = flight distance, .false. = all mixing ratios + real(r8) :: norm_input_bot, norm_input_top, norm_sim_bot, norm_sim_top + real(r8) :: overlap_bot, overlap_top + + ! Make sure that inputs are in [-90, 90] and that bot < top + norm_input_bot = normalize_lat(input_bot) + norm_input_top = normalize_lat(input_top) + norm_sim_bot = normalize_lat(sim_bot) + norm_sim_top = normalize_lat(sim_top) + call check_invariant(norm_input_bot < norm_input_top, "must have input_bot < input_top") + call check_invariant(norm_sim_bot < norm_sim_top, "must have sim_bot < sim_top") + + overlap_bot = merge(norm_input_bot, norm_sim_bot, norm_input_bot > norm_sim_bot) + overlap_top = merge(norm_input_top, norm_sim_top, norm_input_top < norm_sim_top) + + if ( (norm_input_bot == norm_input_top) .or. & + (norm_sim_bot == norm_sim_top) .or. & + (overlap_top <= overlap_bot) ) then + ! No overlap + lat_weight = 0 + elseif (use_flight_distance) then + ! Input values are a total for the grid cell, so the weight is + ! just the fraction of the input cell which overlaps the + ! sim cell. + lat_weight = lat_band_weight(overlap_bot, overlap_top) / lat_band_weight(norm_input_bot, norm_input_top) + call check_invariant((0 <= lat_weight) .and. (lat_weight <= 1), "dist: lat_weight must be in [0, 1]") + else + ! Input values are a mixing ratio. The amount added in the + ! overlap is spread evenly over the sim cell. + lat_weight = lat_band_weight(overlap_bot, overlap_top) / lat_band_weight(norm_sim_bot, norm_sim_top) + call check_invariant((0 <= lat_weight) .and. (lat_weight <= 1), "mixrat: lat_weight must be in [0, 1]") + endif + return + end function lat_weight + + + subroutine xy_interp_init(num_input_lons, num_input_lats, input_lon_radians, input_lat_radians, & + num_sim_lons, num_sim_lats, weight_x, weight_y, use_flight_distance) !------------------------------------------------------------------------------------------------------------ -! This program computes weighting functions to map a variable of (im1,jm1) resolution to (im2,jm2) resolution -! weight_x(im2,im1) is the weighting function for zonal interpolation -! weight_y(jm2,jm1) is the weighting function for meridional interpolation -! +! This program computes weighting functions to map a variable of (num_input_lons,num_input_lats) resolution to (num_sim_lons,num_sim_lats) resolution +! weight_x(num_sim_lons,num_input_lons) is the weighting function for zonal interpolation +! weight_y(num_sim_lats,num_input_lats) is the weighting function for meridional interpolation +! ! Author: Chih-Chieh (Jack) Chen -- May 2010 +! Rob von Behren (jrvb@google.com) -- Oct 2024 ! !------------------------------------------------------------------------------------------------------------ - implicit none - integer, intent(in) :: im1, jm1, im2, jm2 + integer, intent(in) :: num_input_lons, num_input_lats, num_sim_lons, num_sim_lats logical, intent(in) :: use_flight_distance !.true. = flight distance, .false. = all mixing ratios - real(r8), intent(in) :: lon0(im1), lat0(jm1) - real(r8), intent(out) :: weight_x(im2,im1), weight_y(jm2,jm1) + real(r8), intent(in) :: input_lon_radians(num_input_lons), input_lat_radians(num_input_lats) + real(r8), intent(out) :: weight_x(num_sim_lons,num_input_lons), weight_y(num_sim_lats,num_input_lats) - real(r8) :: lon1(im1), lat1(jm1) - real(r8) :: lon2(im2), lat2(jm2) - real(r8) :: slon1(im1+1), slon2(im2+1), slat1(jm1+1), slat2(jm2+1) + real(r8) :: input_lon(num_input_lons), input_lat(num_input_lats) + real(r8) :: sim_lon(num_sim_lons), sim_lat(num_sim_lats) + real(r8) :: input_lon_edge(num_input_lons+1), sim_lon_edge(num_sim_lons+1) + real(r8) :: input_lat_edge(num_input_lats+1), sim_lat_edge(num_sim_lats+1) real(r8) :: x1_west, x1_east, x2_west, x2_east real(r8) :: y1_south, y1_north, y2_south, y2_north - integer :: i1, j1, i2, j2 + integer :: i1, j1, i2, j2, i weight_x(:,:) = 0.0_r8 weight_y(:,:) = 0.0_r8 -! lon0 & lat0 are longitude & latitude on the source mesh in radians -! convert lon1, lat1 from radians to degrees - lon1(:) = lon0(:)/SHR_CONST_PI*180.0_r8 - lat1(:) = lat0(:)/SHR_CONST_PI*180.0_r8 +! input_lon_radians & input_lat_radians are longitude & latitude on the source mesh in radians +! convert input_lon, input_lat from radians to degrees + input_lon(:) = input_lon_radians(:)/SHR_CONST_PI*180.0_r8 + input_lat(:) = input_lat_radians(:)/SHR_CONST_PI*180.0_r8 -! set up lon2, lat2 (target mesh), in CAM convention - do i2=1,im2 - lon2(i2) = (float(i2)-1.0_r8)*360.0_r8/float(im2) + ! Set up sim_lon, sim_lat (target mesh), in CAM convention. The + ! (lon,lat) pairs are the center points of the grid cells. + do i2=1,num_sim_lons + sim_lon(i2) = (float(i2)-1.0_r8)*360.0_r8/float(num_sim_lons) enddo - do j2=1,jm2 - lat2(j2) = -90.0_r8+(float(j2)-1.0_r8)*180.0_r8/(float(jm2)-1.0_r8) + do j2=1,num_sim_lats + sim_lat(j2) = -90.0_r8+(float(j2)-1.0_r8)*180.0_r8/(float(num_sim_lats)-1.0_r8) enddo - - -! set up staggered longitudes (cell edges in x) - do i1=2,im1 - slon1(i1) = (lon1(i1-1)+lon1(i1))/2.0_r8 + ! make sure the highest value is exactly +90, since the + ! multiplication above could give a value that is slightly off due + ! to rounding. + sim_lat(num_sim_lats) = 90.0_r8 + + ! Calculate the grid cell edges from the midpoints above. We set + ! things up so it is easy to find the boundary for grid cell i, j as: + ! lat bounds: (lat_edge(i), lat_edge(i+1)) + ! lon boudns: (lon_edge(j), lon_edge(j+1)) + ! For latitudes, we ensure that the smallest and largest edges are + ! at -90 and 90, respectively. For longitudes, the values wrap so + ! lon_edge(1) == lon_edge(num+1) - 360 + + ! Input longitude edges + do i1=2, num_input_lons + input_lon_edge(i1) = (input_lon(i1-1) + input_lon(i1)) / 2.0_r8 enddo - slon1(1) = lon1(1)-(lon1(2)-lon1(1))/2.0_r8 - slon1(im1+1) = lon1(im1)+(lon1(im1)-lon1(im1-1))/2.0_r8 + input_lon_edge(1) = (input_lon(num_input_lons) - 360_r8 + input_lon(1)) / 2.0_r8 + input_lon_edge(num_input_lons+1) = input_lon_edge(1) + 360_r8 - do i2=2,im2 - slon2(i2) = (lon2(i2-1)+lon2(i2))/2.0_r8 + do i2=2,num_sim_lons + sim_lon_edge(i2) = (sim_lon(i2-1) + sim_lon(i2)) / 2.0_r8 enddo - slon2(1) = lon2(1)-(lon2(2)-lon2(1))/2.0_r8 - slon2(im2+1) = lon2(im2)+(lon2(im2)-lon2(im2-1))/2.0_r8 + sim_lon_edge(1) = (sim_lon(num_sim_lons) - 360_r8 + sim_lon(1)) / 2.0_r8 + sim_lon_edge(num_sim_lons+1) = sim_lon_edge(1) + 360_r8 -! set up staggered lattiudes (cell edges in y) - slat1(1)=-90.0_r8 - do j1=2,jm1 - slat1(j1) = (lat1(j1-1)+lat1(j1))/2.0_r8 + ! set up staggered lattiudes (cell edges in y) + input_lat_edge(1)=-90.0_r8 + do j1=2,num_input_lats + input_lat_edge(j1) = (input_lat(j1-1)+input_lat(j1))/2.0_r8 enddo - slat1(jm1+1)=90.0_r8 - - slat2(1)=-90.0_r8 - do j2=2,jm2 - slat2(j2)=(lat2(j2-1)+lat2(j2))/2.0_r8 - enddo - slat2(jm2+1)=90.0_r8 + input_lat_edge(num_input_lats+1)=90.0_r8 -! compute Guassian weight for two meshes (discrete form of cos(lat).) - do j1=1,jm1 - gw1(j1) = sin(slat1(j1+1)/180.0_r8*SHR_CONST_PI)-sin(slat1(j1)/180.0_r8*SHR_CONST_PI) + sim_lat_edge(1) = -90.0_r8 + do j2=2,num_sim_lats + sim_lat_edge(j2) = (sim_lat(j2-1) + sim_lat(j2)) / 2.0_r8 enddo + sim_lat_edge(num_sim_lats+1) = 90.0_r8 - do j2=1,jm2 - gw2(j2) = sin(slat2(j2+1)/180.0_r8*SHR_CONST_PI)-sin(slat2(j2)/180.0_r8*SHR_CONST_PI) + ! Compute the weight for all (input_lon, sim_lon) pairs + do i2=1, num_sim_lons + do i1=1, num_input_lons + weight_x(i2, i1) = lon_weight(input_lon_edge(i1), input_lon_edge(i1+1), sim_lon_edge(i2), sim_lon_edge(i2+1), use_flight_distance) + enddo enddo - -! add 360 to slon1 and slon2 - slon1(:) = slon1(:)+360.0_r8 - slon2(:) = slon2(:)+360.0_r8 - - do i2=1,im2 - -! target grid east-west boundaries - x2_west=slon2(i2) - x2_east=slon2(i2+1) - - do i1=1,im1 - -! source grid east-west boundaries - x1_west=slon1(i1) - x1_east=slon1(i1+1) - -! check if there is any overlap between the source grid and the target grid -! if no overlap, then weighting is zero -! there are three scenarios overlaps can take place - if( (x1_west>=x2_west).and.(x1_east<=x2_east) ) then -! case 1: -! x1_west x1_east -! |-------------------| -! |---------------------------------| -! x2_west x2_east - if(use_flight_distance) then - weight_x(i2,i1) = 1.0_r8 - else - weight_x(i2,i1) = (x1_east-x1_west)/(x2_east-x2_west) - endif - elseif ( (x1_west>=x2_west).and.(x1_westx2_west).and.(x1_east<=x2_east) ) then -! case 3: -! x1_west x1_east -! |--------------------------------| -! |---------------------------------| -! x2_west x2_east - if(use_flight_distance) then - weight_x(i2,i1) = (x1_east-x2_west)/(x1_east-x1_west) - else - weight_x(i2,i1) = (x1_east-x2_west)/(x2_east-x2_west) - endif - elseif ( (x1_east>x2_east).and.(x1_westslon2(im2+1)) then -! case 1: -! slon1(im1) slon1(im1+1) <--- end point -! |-------------------------| -! |----------------|......................| -! slon2(im2) slon2(im2+1) slon2(2) (note: slon2(im2+1) = slon2(1)) - if(use_flight_distance) then - weight_x(1,im1)= weight_x(1,im1)+(slon1(im1+1)-slon2(im2+1))/(slon1(im1+1)-slon1(im1)) - else - weight_x(1,im1)= weight_x(1,im1)+(slon1(im1+1)-slon2(im2+1))/(slon2(2)-slon2(1)) - endif - endif - - if(slon1(im1+1)=y2_south).and.(y1_north<=y2_north) ) then -! case 1: -! y1_south y1_north -! |-------------------| -! |---------------------------------| -! y2_south y2_north - if(use_flight_distance) then - weight_y(j2,j1) = 1.0_r8 - else - weight_y(j2,j1) = gw1(j1)/gw2(j2) - endif - elseif ( (y1_south>=y2_south).and.(y1_southy2_south).and.(y1_north<=y2_north) ) then -! case 3: -! y1_south y1_north -! |--------------------------------| -! |---------------------------------| -! y2_south y2_north - if(use_flight_distance) then - weight_y(j2,j1) = (y1_north-y2_south)/(y1_north-y1_south) - else - weight_y(j2,j1) = (y1_north-y2_south)/(y1_north-y1_south)*gw1(j1)/gw2(j2) - endif - elseif ( (y1_north>y2_north).and.(y1_south0.0_r8 ) then - file%count_x(i2) = file%count_x(i2) + 1 - file%index_x(i2,file%count_x(i2)) = i1 - endif - enddo - enddo - - do j2=1,plat - file%count_y(j2) = 0 - do j1=1,file%nlat - if(file%weight_y(j2,j1)>0.0_r8 ) then - file%count_y(j2) = file%count_y(j2) + 1 - file%index_y(j2,file%count_y(j2)) = j1 - endif - enddo - enddo + ! compute weighting. NOTE: we always set + ! use_flight_distance=.false. for this path since these + ! weights are used to inerpolate field values like PS even + ! when the file contains other data which should be treated + ! as per-cell totals. + call xy_interp_init(file%nlon,file%nlat,file%lons,file%lats, & + plon,plat,file%weight_x,file%weight_y, .false.) + + do i2=1,plon + file%count_x(i2) = 0 + do i1=1,file%nlon + if(file%weight_x(i2,i1)>0.0_r8 ) then + file%count_x(i2) = file%count_x(i2) + 1 + file%index_x(i2,file%count_x(i2)) = i1 + endif + enddo + enddo + + do j2=1,plat + file%count_y(j2) = 0 + do j1=1,file%nlat + if(file%weight_y(j2,j1)>0.0_r8 ) then + file%count_y(j2) = file%count_y(j2) + 1 + file%index_y(j2,file%count_y(j2)) = j1 + endif + enddo + enddo if( file%dist ) then call xy_interp_init(file%nlon,file%nlat,file%lons,file%lats,& - plon,plat,file%weight0_x,file%weight0_y,file%dist) + plon,plat,file%weight0_x,file%weight0_y, .true.) do i2=1,plon file%count0_x(i2) = 0 @@ -751,6 +754,7 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & endif enddo enddo + endif endif @@ -773,15 +777,15 @@ subroutine trcdata_init( specifier, filename, filelist, datapath, flds, file, & if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: file%weight0_y") call mpi_bcast(file%count0_x, plon, mpi_integer , mstrid, mpicom,ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: file%count0_x") - call mpi_bcast(file%count0_y, plon, mpi_integer , mstrid, mpicom,ierr) + call mpi_bcast(file%count0_y, plat, mpi_integer , mstrid, mpicom,ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: file%count0_y") call mpi_bcast(file%index0_x, plon*file%nlon, mpi_integer , mstrid, mpicom,ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: file%index0_x") call mpi_bcast(file%index0_y, plat*file%nlat, mpi_integer , mstrid, mpicom,ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: file%index0_y") endif - endif + endif end subroutine trcdata_init !----------------------------------------------------------------------- @@ -1522,6 +1526,14 @@ subroutine read_2d_trc( fid, vid, loc_arr, strt, cnt, file, order ) lons(:ncols) = lon_global_grid_ndx(:ncols,c) lats(:ncols) = lat_global_grid_ndx(:ncols,c) + ! NOTE: This uses weight_[xy] instead of weight0_[xy] and + ! hence treats the values as a field rather than per-cell + ! totals. When file%dist == TRUE, this path only appears + ! to be used to interpolate PS, which is probably the + ! correct behavior. + ! + ! @reviewers: The control flow is convoluted here, so + ! this merits some additional scrutiny. call xy_interp(file%nlon,file%nlat,1,plon,plat,pcols,ncols, & file%weight_x,file%weight_y,wrk2d_in,loc_arr(:,c-begchunk+1), & lons,lats,file%count_x,file%count_y,file%index_x,file%index_y) @@ -2443,7 +2455,7 @@ subroutine interpz_conserve( nsrc, ntrg, src_x, trg_x, src, trg) end subroutine interpz_conserve !------------------------------------------------------------------------------ - subroutine vert_interp_mixrat( ncol, nsrc, ntrg, trg_x, src, trg, p0, ps, hyai, hybi, use_flight_distance) + subroutine vert_interp_mixrat( ncol, nsrc, ntrg, trg_x, src, trg, p0, ps, hyai, hybi, use_flight_distance) implicit none @@ -2453,7 +2465,7 @@ subroutine vert_interp_mixrat( ncol, nsrc, ntrg, trg_x, src, trg, p0, ps, hyai, real(r8) :: src_x(nsrc+1) ! source coordinates real(r8), intent(in) :: trg_x(pcols,ntrg+1) ! target coordinates real(r8), intent(in) :: src(pcols,nsrc) ! source array - logical, intent(in) :: use_flight_distance ! .true. = flight distance, .false. = mixing ratio + logical, intent(in) :: use_flight_distance ! .true. = flight distance, .false. = mixing ratio real(r8), intent(out) :: trg(pcols,ntrg) ! target array real(r8) :: ps(pcols), p0, hyai(nsrc+1), hybi(nsrc+1) @@ -2461,89 +2473,124 @@ subroutine vert_interp_mixrat( ncol, nsrc, ntrg, trg_x, src, trg, p0, ps, hyai, ! ... local variables !--------------------------------------------------------------- integer :: i, j, n - integer :: sil - real(r8) :: tl, y - real(r8) :: bot, top - + real(r8) :: y, trg_lo, trg_hi, src_lo, src_hi, overlap, outside + do n = 1,ncol ! loop over columns - do n = 1,ncol + trg(n,:) = 0.0_r8 ! probably not needed + ! calculate source pressure levels from hybrid coords do i=1,nsrc+1 src_x(i) = p0*hyai(i)+ps(n)*hybi(i) enddo - do i = 1, ntrg - tl = trg_x(n,i+1) - if( (tl>src_x(1)).and.(trg_x(n,i)src_x(nsrc+1)) sil = nsrc - - y = 0.0_r8 - bot = min(tl,src_x(nsrc+1)) - top = trg_x(n,i) - do j = sil,1,-1 - if( top 0.0_r8) then if(use_flight_distance) then - y = y+(bot-top)*src(n,j)/(src_x(j+1)-src_x(j)) + ! add input based on the overlap fraction + y = y + src(n,j) * overlap / (src_hi - src_lo) else - y = y+(bot-top)*src(n,j) + ! convert to mass by multiplying by dp + y = y + src(n,j) * overlap endif - exit endif enddo - trg(n,ntrg) = trg(n,ntrg)+y - endif + trg(n, i) = y + enddo + + ! Handle source values outside the target range. Since we want + ! to preserve the total amount, add these to the first/last + ! target bucket. + trg_lo = trg_x(n, 1) + y = 0.0_r8 + do j = 1, nsrc + src_lo = src_x(j) + src_hi = src_x(j+1) + + if (src_lo < trg_lo) then + if (src_hi <= trg_lo) then + ! whole source interval is outside the target range + outside = src_hi - src_lo + else + ! There was some overlap, which would have been added + ! previously. Only add the parts outside the target + ! range. + outside = trg_lo - src_lo + endif + if(use_flight_distance) then + ! add the input scaled by the fraction outside + y = y + src(n,j) * outside / (src_hi - src_lo) + else + ! convert to mass by multiplying by dp + y = y + src(n,j) * outside + endif + else + exit + endif + enddo + trg(n,1) = trg(n,1) + y + + trg_hi = trg_x(n, ntrg+1) + y = 0.0_r8 + do j = nsrc, 1, -1 + src_lo = src_x(j) + src_hi = src_x(j+1) + + if (src_hi > trg_hi) then + if (src_lo >= trg_hi) then + ! whole source interval is outside the target range + outside = src_hi - src_lo + else + ! There was some overlap, which would have been added + ! previously. Only add the parts outside the target + ! range. + outside = src_hi - trg_hi + endif + if(use_flight_distance) then + ! add the full input + y = y + src(n,j) * outside / (src_hi - src_lo) + else + ! convert to mass by multiplying by dp + y = y + src(n,j) * outside + endif + else + exit + endif + enddo + trg(n,ntrg) = trg(n,ntrg) + y ! turn mass into mixing ratio if(.not. use_flight_distance) then do i=1,ntrg - trg(n,i) = trg(n,i)/(trg_x(n,i+1)-trg_x(n,i)) + trg(n,i) = trg(n,i) / (trg_x(n,i+1) - trg_x(n,i)) enddo endif enddo - end subroutine vert_interp_mixrat + end subroutine vert_interp_mixrat + + !------------------------------------------------------------------------------ subroutine vert_interp( ncol, levsiz, pin, pmid, datain, dataout ) !-------------------------------------------------------------------------- From af056973229e84131bf969aadd2cf0def488751c Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 22 Jul 2025 09:26:36 -0400 Subject: [PATCH 255/466] update ChangeLog --- doc/ChangeLog | 104 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 6 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index c8dddf7d6e..f731c073cf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,14 +1,18 @@ =============================================================== -Tag name: +Tag name: cam6_4_105 Originator(s): eaton -Date: +Date: 22 July 2025 One-line Summary: update ccs_config_cesm submodule -Github PR URL: +Github PR URL: https://github.com/ESCOMP/CAM/pull/1347 Purpose of changes (include the issue number and title text for each relevant GitHub issue): -. update the ccs_config_cesm submodule to include the gnu-12 environment on izumi. +. Update the ccs_config_cesm submodule. Nearly all CAM tests have diffs + due to this update. In addition to the update to gnu-12 on izumi (which + was needed to enable COSP to run), the esmf libs on derecho went from + esmf-8.6.0 to esmf-8.8.1 and there were changes to the nvhpc + configuration. Describe any changes made to build system: none @@ -18,7 +22,7 @@ List any changes to the defaults for the boundary datasets: none Describe any substantial timing or memory changes: none -Code reviewed by: +Code reviewed by: cacraig List all files eliminated: none @@ -37,16 +41,104 @@ appropriate machine below. All failed tests must be justified. derecho/intel/aux_cam: +ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) +ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) +ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) +ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) +SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) +SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s_amie (Overall: DIFF) +SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) +- diffs due to esmf lib updates + +ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) +ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s (Overall: DIFF) +ERC_D_Ln9.mpasa120_mpasa120.QPC7.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) +ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) +ERC_D_Ln9.ne30pg2_ne30pg2_mt232.QPC7.derecho_intel.cam-outfrq9s (Overall: DIFF) +ERI_D_Ln18.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase (Overall: DIFF) +ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s (Overall: DIFF) +SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep (Overall: DIFF) +SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase (Overall: DIFF) +SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) +SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s (Overall: DIFF) +- diffs in cpl.hi files, but CAM is BFB. + +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) +- pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + derecho/nvhpc/aux_cam: +ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF) +- updates to nvhpc settings + izumi/nag/aux_cam: +ERC_D_Ln27.ne3pg3_ne3pg3_mt232.FKESSLER.izumi_nag.cam-outfrq9s (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: NLFAIL) +ERC_D_Ln9.mpasa480_mpasa480_mt232.FHS94.izumi_nag.cam-outfrq9s (Overall: NLFAIL) +ERC_D_Ln9.mpasa480_mpasa480_mt232.QPC7.izumi_nag.cam-outfrq9s_mpasa480 (Overall: NLFAIL) +ERC_D_Ln9.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase (Overall: NLFAIL) +ERC_D_Ln9.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase (Overall: NLFAIL) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: NLFAIL) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: NLFAIL) +ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac (Overall: NLFAIL) +ERC_D_Ln9_P1x1.ne3pg3_ne3pg3_mt232.FADIAB.izumi_nag.cam-outfrq9s (Overall: NLFAIL) +ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: NLFAIL) +PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 (Overall: NLFAIL) +PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 (Overall: NLFAIL) +PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 (Overall: NLFAIL) +SMS_D_Ld2.f45_f45_mg37.PC5.izumi_nag.cam-outfrq24h_port (Overall: NLFAIL) +SMS_D_Ln3.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s (Overall: NLFAIL) +SMS_D_Ln6.ne5_ne5_mg37.QPWmaC4.izumi_nag.cam-outfrq3s_physgrid_tem (Overall: NLFAIL) +SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam (Overall: NLFAIL) +SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: NLFAIL) +SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s (Overall: NLFAIL) +TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: NLFAIL) +- diffs in nuopc.runconfig for pio_stride. solutions are BFB + izumi/gnu/aux_cam: +ERC_D_Ln9.f10_f10_mg37.QPC4.izumi_gnu.cam-outfrq3s_diags (Overall: NLFAIL) +ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_gnu.cam-rad_diag (Overall: NLFAIL) +ERC_D_Ln9.ne5_ne5_mg37.QPC4.izumi_gnu.cam-outfrq3s_nudging_ne5_L26 (Overall: NLFAIL) +ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq3s_ba (Overall: NLFAIL) +SMS_D_Ln3.ne3pg3_ne3pg3_mt232.PC7.izumi_gnu.cam-pc7_ne3pg3 (Overall: NLFAIL) +- diffs in nuopc.runconfig for pio_stride. solutions are BFB + +ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) +ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FGRAYRAD.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C4.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FTJ16.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPC7.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) +ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) +SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 (Overall: DIFF) +SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc (Overall: DIFF) +SMS_D_Ln9.f10_f10_mg37.QPWmaC4.izumi_gnu.cam-outfrq9s_apmee (Overall: DIFF) +SMS_D_Ln9.f19_f19_mt232.FW4madSD.izumi_gnu.cam-outfrq9s (Overall: DIFF) +SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac (Overall: DIFF) +- diffs in nuopc.runconfig for pio_stride. solution diffs due to updating compiler. + CAM tag used for the baseline comparison tests if different than previous tag: -Summarize any changes to answers: +Summarize any changes to answers: Answer changes due to compiler and +library updates. =============================================================== =============================================================== From 2fa9a6ca84c86002a32a067c1b08fe986b450255 Mon Sep 17 00:00:00 2001 From: Kuan-Chih Wang Date: Wed, 23 Jul 2025 16:02:55 -0600 Subject: [PATCH 256/466] Update ChangeLog --- doc/ChangeLog | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index f731c073cf..90114c3769 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,92 @@ =============================================================== +Tag name: cam6_4_106 +Originator(s): kuanchihwang +Date: July 23, 2025 +One-line Summary: Add "_mpas" suffix and use "ncol" dimension for MPAS-specific output variables +Github PR URL: https://github.com/ESCOMP/CAM/pull/1338 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + + This PR changes how MPAS-specific output variables are written to history files: + + 1. Add the "_mpas" suffix, making it clear that these variables are specific to MPAS and + are different from the standard CAM ones. + 2. Change the dimension name from "nCells" to "ncol", improving the compatibility with + certain tools like ncremap from NetCDF Operator. + + Restart files are not affected. + + Closes #1323 (MPAS outputs w, theta, and rho) + +Describe any changes made to build system: + + None + +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: + + PeterHjortLauritzen, cacraigucar + +List all files eliminated: + + None + +List all files added and what they do: + + None + +List all existing files that have been modified, and describe the changes: + + M src/dynamics/mpas/stepon.F90 + * Add the "_mpas" suffix to MPAS-specific output variables + * Change the dimension name of MPAS-specific output variables from "nCells" to "ncol" + +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: + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: + FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s SETUP + * Pre-existing failures due to build-namelist error requiring CLM/CTSM external update + +derecho/nvhpc/aux_cam: + + All pass + +izumi/nag/aux_cam: + + All pass + +izumi/gnu/aux_cam: + + All pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + + cam6_4_105 + +Summarize any changes to answers: + + None + +=============================================================== + Tag name: cam6_4_105 Originator(s): eaton Date: 22 July 2025 From 0fa764f64254eb28788a6580cc1267c7dcf1e4bd Mon Sep 17 00:00:00 2001 From: "G. Dylan Dickerson" Date: Wed, 23 Jul 2025 20:16:43 -0600 Subject: [PATCH 257/466] Share some input files and settings from EarthWorks --- bld/namelist_files/namelist_defaults_cam.xml | 39 +++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 9b8758b424..2b8093e6bc 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -47,6 +47,12 @@ atm/cam/inic/mpas/mpasa480_L93_notopo_coords_c240814.nc atm/cam/inic/mpas/mpasa120_L93_notopo_coords_c240814.nc atm/cam/inic/mpas/mpasa60_L93_notopo_coords_c240814.nc + +atm/cam/inic/mpas/mpasa30_L58_notopo_coords_c240814.nc +atm/cam/inic/mpas/mpasa30_L93_notopo_coords_c240814.nc +atm/cam/inic/mpas/mpasa15_L58_notopo_coords_c240911.nc +atm/cam/inic/mpas/mpasa15_L93_notopo_coords_c240911.nc + atm/cam/inic/fv/cami_0000-01-01_10x15_L26_c030918.nc @@ -239,6 +245,14 @@ atm/cam/inic/mpas/QPC7_mpasa120_L58_cami_c250527.nc atm/waccm/ic/mpasa120_L70.waccm_topography_SC_c240904.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa120_L93_CFSR_c240814.nc + +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa60_L58_CFSR_c240905.nc +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa30_L58_CFSR_c240905.nc +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa15_L58_CFSR_c240905.nc +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa60_L93_CFSR_c240905.nc +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa30_L93_CFSR_c240905.nc +atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa15_L93_CFSR_c240905.nc + atm/cam/inic/fv3/cami_0000-01-01_C24_L26_c200625.nc @@ -317,6 +331,11 @@ atm/cam/topo/mpas/mpasa480_gmted2010_modis_bedmachine_nc3000_Laplace0400_noleak_20240507.nc atm/cam/topo/mpas/mpasa120_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_20240507.nc + +atm/cam/topo/mpas/mpasa60_gmted2010_modis_bedmachine_nc3000_Laplace0050_noleak_20240507.nc +atm/cam/topo/mpas/mpasa30_gmted2010_modis_bedmachine_nc3000_Laplace0025_noleak_20240507.nc +atm/cam/topo/mpas/mpasa15_gmted2010_modis_bedmachine_nc3000_Laplace0013_noleak_20240507.nc + 0.0D0 @@ -1992,8 +2011,11 @@ atm/cam/chem/trop_mam/atmsrf_C192_c200625.nc atm/cam/chem/trop_mam/atmsrf_C384_c200625.nc -atm/cam/chem/trop_mam/atmsrf_mpasa120_c090720.nc atm/cam/chem/trop_mam/atmsrf_mpasa480_c090720.nc +atm/cam/chem/trop_mam/atmsrf_mpasa120_c090720.nc +atm/cam/chem/trop_mam/atmsrf_mpasa60_c210511.nc +atm/cam/chem/trop_mam/atmsrf_mpasa30_c210601.nc +atm/cam/chem/trop_mam/atmsrf_mpasa15_c20210804.nc atm/cam/chem/trop_mozart/dvel/regrid_vegetation.nc @@ -2269,6 +2291,14 @@ 0.22 10 + + 10 + 10 + 10 + 10 + 10 + 10 + .false. .false. @@ -3290,6 +3320,10 @@ 600.D0 450.0D0 225.0D0 + + 80.0D0 + 40.0D0 + 20.0D0 .true. 2 @@ -3307,6 +3341,9 @@ 120000.0D0 60000.0D0 30000.0D0 + 15000.0D0 + 7500.0D0 + 3750.0D0 0.05D0 10.0D0 From 9227e5c1ff43916c6fd99387f65b2feca9a9f65a Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Thu, 24 Jul 2025 11:07:18 -0600 Subject: [PATCH 258/466] update submodule; fix interfaces --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/cam/cloud_rad_props.F90 | 101 +++++++++++++--------------- src/physics/rrtmg/radiation.F90 | 16 +---- src/physics/rrtmgp/radiation.F90 | 11 ++- 5 files changed, 54 insertions(+), 78 deletions(-) diff --git a/.gitmodules b/.gitmodules index bd5f0e3a3e..59d1494d30 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 403130ec1bb3e245255182a3c3167aba3a84d4f3 + fxtag = 86fc6f9542b949af4e667c1be6d364a08102485b fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 403130ec1b..86fc6f9542 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 403130ec1bb3e245255182a3c3167aba3a84d4f3 +Subproject commit 86fc6f9542b949af4e667c1be6d364a08102485b diff --git a/src/physics/cam/cloud_rad_props.F90 b/src/physics/cam/cloud_rad_props.F90 index f4eaf4a11a..da15a72a96 100644 --- a/src/physics/cam/cloud_rad_props.F90 +++ b/src/physics/cam/cloud_rad_props.F90 @@ -21,6 +21,11 @@ module cloud_rad_props use cam_logfile, only: iulog use cam_abortutils, only: endrun +use rrtmgp_cloud_optics_setup, only: g_mu_ccpp => g_mu, g_lambda_ccpp => g_lambda, g_d_eff_ccpp => g_d_eff +use rrtmgp_cloud_optics_setup, only: abs_lw_liq_ccpp => abs_lw_liq, abs_lw_ice_ccpp => abs_lw_ice +use rrtmgp_cloud_optics_setup, only: ext_sw_liq_ccpp => ext_sw_liq, ext_sw_ice_ccpp => ext_sw_ice +use rrtmgp_cloud_optics_setup, only: ssa_sw_liq_ccpp => ssa_sw_liq, ssa_sw_ice_ccpp => ssa_sw_ice +use rrtmgp_cloud_optics_setup, only: asm_sw_liq_ccpp => asm_sw_liq, asm_sw_ice_ccpp => asm_sw_ice implicit none @@ -78,9 +83,7 @@ module cloud_rad_props contains !============================================================================== -subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out, & - ssa_sw_liq_out, asm_sw_liq_out, ext_sw_ice_out, ssa_sw_ice_out, & - asm_sw_ice_out, g_mu_out, g_lambda_out, g_d_eff_out, tiny_out) +subroutine cloud_rad_props_init(tiny_out) use netcdf use spmd_utils, only: masterproc use ioFileMod, only: getfil @@ -90,18 +93,7 @@ subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out, #if ( defined SPMD ) use mpishorthand #endif - real(r8), allocatable, intent(out) :: abs_lw_liq_out(:,:,:) - real(r8), allocatable, intent(out) :: ext_sw_liq_out(:,:,:) - real(r8), allocatable, intent(out) :: asm_sw_liq_out(:,:,:) - real(r8), allocatable, intent(out) :: ssa_sw_liq_out(:,:,:) - real(r8), allocatable, intent(out) :: abs_lw_ice_out(:,:) - real(r8), allocatable, intent(out) :: ext_sw_ice_out(:,:) - real(r8), allocatable, intent(out) :: asm_sw_ice_out(:,:) - real(r8), allocatable, intent(out) :: ssa_sw_ice_out(:,:) - real(r8), allocatable, intent(out) :: g_mu_out(:) - real(r8), allocatable, intent(out) :: g_lambda_out(:,:) - real(r8), allocatable, intent(out) :: g_d_eff_out(:) - real(r8), intent(out) :: tiny_out + real(r8), intent(out) :: tiny_out character(len=256) :: liquidfile character(len=256) :: icefile @@ -142,51 +134,52 @@ subroutine cloud_rad_props_init(abs_lw_liq_out, abs_lw_ice_out, ext_sw_liq_out, call cnst_get_ind('CLDICE', ixcldice) call cnst_get_ind('CLDLIQ', ixcldliq) - call rrtmgp_cloud_optics_setup_init(liqopticsfile, iceopticsfile, abs_lw_liq, & - abs_lw_ice, ext_sw_liq, ext_sw_ice, ssa_sw_liq, ssa_sw_ice, asm_sw_liq, & - asm_sw_ice, g_lambda, g_mu, g_d_eff, errmsg, err) + call rrtmgp_cloud_optics_setup_init(liqopticsfile, iceopticsfile, errmsg, err) if (err /= 0) then call endrun(sub//': '//errmsg) end if + ! Set module-level variables + ! Set output variables + nmu = size(g_mu_ccpp) + nlambda = size(g_lambda_ccpp, 2) + n_g_d = size(g_d_eff_ccpp) + allocate(abs_lw_liq(nmu,nlambda,nlwbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'abs_lw_liq') + abs_lw_liq = abs_lw_liq_ccpp + allocate(ext_sw_liq(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ext_sw_liq') + ext_sw_liq = ext_sw_liq_ccpp + allocate(ssa_sw_liq(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ssa_sw_liq') + ssa_sw_liq = ssa_sw_liq_ccpp + allocate(asm_sw_liq(nmu,nlambda,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'asm_sw_liq') + asm_sw_liq = asm_sw_liq_ccpp + allocate(abs_lw_ice(n_g_d,nlwbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'abs_lw_ice') + abs_lw_ice = abs_lw_ice_ccpp + allocate(ext_sw_ice(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ext_sw_ice') + ext_sw_ice = ext_sw_ice_ccpp + allocate(ssa_sw_ice(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'ssa_sw_ice') + ssa_sw_ice = ssa_sw_ice_ccpp + allocate(asm_sw_ice(n_g_d,nswbands), stat=ierr) + call handle_allocate_error(ierr, sub, 'asm_sw_ice') + asm_sw_ice = asm_sw_ice_ccpp + allocate(g_mu(nmu), stat=ierr) + call handle_allocate_error(ierr, sub, 'g_mu') + g_mu = g_mu_ccpp + allocate(g_lambda(nmu,nlambda), stat=ierr) + call handle_allocate_error(ierr, sub, 'g_lambda') + g_lambda = g_lambda_ccpp + allocate(g_d_eff(n_g_d), stat=ierr) + call handle_allocate_error(ierr, sub, 'g_d_eff') + g_d_eff = g_d_eff_ccpp + ! Set output variables - nmu = size(g_mu) - nlambda = size(g_lambda, 2) - n_g_d = size(g_d_eff) tiny_out = tiny - allocate(abs_lw_liq_out(nmu,nlambda,nlwbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'abs_lw_liq_out') - abs_lw_liq_out = abs_lw_liq - allocate(ext_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'ext_sw_liq_out') - ext_sw_liq_out = ext_sw_liq - allocate(ssa_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'ssa_sw_liq_out') - ssa_sw_liq_out = ssa_sw_liq - allocate(asm_sw_liq_out(nmu,nlambda,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'asm_sw_liq_out') - asm_sw_liq_out = asm_sw_liq - allocate(abs_lw_ice_out(n_g_d,nlwbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'abs_lw_ice_out') - abs_lw_ice_out = abs_lw_ice - allocate(ext_sw_ice_out(n_g_d,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'ext_sw_ice_out') - ext_sw_ice_out = ext_sw_ice - allocate(ssa_sw_ice_out(n_g_d,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'ssa_sw_ice_out') - ssa_sw_ice_out = ssa_sw_ice - allocate(asm_sw_ice_out(n_g_d,nswbands), stat=ierr) - call handle_allocate_error(ierr, sub, 'asm_sw_ice_out') - asm_sw_ice_out = asm_sw_ice - allocate(g_mu_out(nmu), stat=ierr) - call handle_allocate_error(ierr, sub, 'g_mu_out') - g_mu_out = g_mu - allocate(g_lambda_out(nmu,nlambda), stat=ierr) - call handle_allocate_error(ierr, sub, 'g_lambda_out') - g_lambda_out = g_lambda - allocate(g_d_eff_out(n_g_d), stat=ierr) - call handle_allocate_error(ierr, sub, 'g_d_eff_out') - g_d_eff_out = g_d_eff return end subroutine cloud_rad_props_init diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index 3e381bd695..a22a66dd6a 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -382,18 +382,6 @@ subroutine radiation_init(pbuf2d) integer :: history_budget_histfile_num ! output history file number for budget fields integer :: err - ! Cloud optics variables - real(kind=r8), allocatable :: abs_lw_ice(:,:) - real(kind=r8), allocatable :: ext_sw_ice(:,:) - real(kind=r8), allocatable :: ssa_sw_ice(:,:) - real(kind=r8), allocatable :: asm_sw_ice(:,:) - real(kind=r8), allocatable :: abs_lw_liq(:,:,:) - real(kind=r8), allocatable :: ext_sw_liq(:,:,:) - real(kind=r8), allocatable :: ssa_sw_liq(:,:,:) - real(kind=r8), allocatable :: asm_sw_liq(:,:,:) - real(kind=r8), allocatable :: g_lambda(:,:) - real(kind=r8), allocatable :: g_mu(:) - real(kind=r8), allocatable :: g_d_eff(:) real(kind=r8) :: tiny integer :: dtime @@ -404,9 +392,7 @@ subroutine radiation_init(pbuf2d) call rad_data_init(pbuf2d) ! initialize output fields for offline driver call radsw_init() call radlw_init() - call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, ext_sw_liq, ssa_sw_liq, & - asm_sw_liq, ext_sw_ice, ssa_sw_ice, asm_sw_ice, g_mu, & - g_lambda, g_d_eff, tiny) + call cloud_rad_props_init(tiny) cld_idx = pbuf_get_index('CLD') cldfsnow_idx = pbuf_get_index('CLDFSNOW',errcode=err) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 187d6540dd..1343eff494 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -500,9 +500,7 @@ subroutine radiation_init(pbuf2d) call rad_data_init(pbuf2d) ! Read ice and liquid optics files - call cloud_rad_props_init(abs_lw_liq, abs_lw_ice, & - ext_sw_liq, ssa_sw_liq, asm_sw_liq, ext_sw_ice, ssa_sw_ice, & - asm_sw_ice, g_mu, g_lambda, g_d_eff, tiny) + call cloud_rad_props_init(tiny) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if @@ -1293,10 +1291,9 @@ subroutine radiation_tend( & ! Set cloud optical properties in cloud_lw object. call rrtmgp_lw_cloud_optics_run(dolw, ncol, nlay, nlaycam, cld(:ncol,:), cldfsnow_in, & cldfgrau_in, cldfprime(:ncol,:), kdist_lw, cloud_lw, lambda(:ncol,:), mu(:ncol,:), & - iclwp(:ncol,:), iciwp(:ncol,:), abs_lw_liq, abs_lw_ice, g_mu, g_lambda, g_d_eff, & - tiny, dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), icgrauwp(:ncol,:), degrau(:ncol,:), & - nlwbands, do_snow, do_graupel, pver, ktopcam, tauc, cldf, cld_lw_abs, snow_lw_abs, & - grau_lw_abs, errmsg, errflg) + iclwp(:ncol,:), iciwp(:ncol,:), tiny, dei(:ncol,:), icswp(:ncol,:), des(:ncol,:), & + icgrauwp(:ncol,:), degrau(:ncol,:), nlwbands, do_snow, do_graupel, pver, ktopcam, & + tauc, cldf, cld_lw_abs, snow_lw_abs, grau_lw_abs, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if From cfbae941eac2c5698c05c06342b91203501145a1 Mon Sep 17 00:00:00 2001 From: "G. Dylan Dickerson" Date: Thu, 24 Jul 2025 16:33:13 -0600 Subject: [PATCH 259/466] Don't contribute 93L files, avoid NaNs --- bld/namelist_files/namelist_defaults_cam.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 309bd503db..c82f2628b9 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -49,9 +49,7 @@ atm/cam/inic/mpas/mpasa60_L93_notopo_coords_c240814.nc atm/cam/inic/mpas/mpasa30_L58_notopo_coords_c240814.nc -atm/cam/inic/mpas/mpasa30_L93_notopo_coords_c240814.nc atm/cam/inic/mpas/mpasa15_L58_notopo_coords_c240911.nc -atm/cam/inic/mpas/mpasa15_L93_notopo_coords_c240911.nc @@ -250,9 +248,6 @@ atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa60_L58_CFSR_c240905.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa30_L58_CFSR_c240905.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa15_L58_CFSR_c240905.nc -atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa60_L93_CFSR_c240905.nc -atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa30_L93_CFSR_c240905.nc -atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa15_L93_CFSR_c240905.nc From 923fe30e94690e6160baed4e72a6450d592b0dd1 Mon Sep 17 00:00:00 2001 From: "G. Dylan Dickerson" Date: Fri, 25 Jul 2025 17:22:52 -0600 Subject: [PATCH 260/466] Remove ncdata with NaNs, mpasa 93L real-data --- bld/namelist_files/namelist_defaults_cam.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index c82f2628b9..a36f433274 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -237,13 +237,11 @@ atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa480_L32_CFSR_c240508.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa480_L58_CFSR_c240814.nc atm/cam/inic/mpas/QPC7_mpasa480_L58_cami_c250527.nc -atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa480_L93_CFSR_c240814.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa120_L32_CFSR_c240508.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa120_L58_CFSR_c240814.nc atm/cam/inic/mpas/QPC7_mpasa120_L58_cami_c250527.nc atm/waccm/ic/mpasa120_L70.waccm_topography_SC_c240904.nc -atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa120_L93_CFSR_c240814.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa60_L58_CFSR_c240905.nc atm/cam/inic/mpas/cami_01-01-2000_00Z_mpasa30_L58_CFSR_c240905.nc From e312e2a573b94d39744eebc8acc4bfccab0a368f Mon Sep 17 00:00:00 2001 From: Julio Bacmeister Date: Tue, 29 Jul 2025 13:39:36 -0600 Subject: [PATCH 261/466] modifying rrtmgp to work with fomichev nlte --- src/physics/cam/radheat.F90 | 404 +++++++++++++++++++++++---- src/physics/rrtmgp/radiation.F90 | 12 +- src/physics/rrtmgp/rrtmgp_inputs.F90 | 13 +- 3 files changed, 352 insertions(+), 77 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 37f8127931..bfe1575beb 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -9,32 +9,61 @@ module radheat ! radiative terms (eUV heating and nonLTE longwave cooling). ! ! Original version: B.A. Boville +! Change weighting function for RRTMG: A J Conley !----------------------------------------------------------------------- -use shr_kind_mod, only: r8 => shr_kind_r8 -use ppgrid, only: pcols, pver -use physics_types, only: physics_state, physics_ptend, physics_ptend_init +! Use a cubic polynomial over the domain from minimum pressure to maximum pressure +! Cubic polynomial is chosen so that derivative is zero at minimum and maximum pressures +! and is monotonically increasing from zero at minimum pressure to one at maximum pressure -use physics_buffer, only : physics_buffer_desc + use shr_kind_mod, only: r8 => shr_kind_r8 + use spmd_utils, only: masterproc + use ppgrid, only: pcols, pver + use physics_types, only: physics_state, physics_ptend, physics_ptend_init + use physconst, only: gravit,cpair,mwco2 + use air_composition, only: cpairv + use perf_mod + use cam_logfile, only: iulog -implicit none -private -save + implicit none + private + save ! Public interfaces -public & - radheat_readnl, &! - radheat_register, &! - radheat_init, &! - radheat_timestep_init, &! - radheat_tend ! return net radiative heating + public & + radheat_readnl, &! + radheat_register, &! + radheat_init, &! + radheat_timestep_init, &! + radheat_tend ! return net radiative heating -public :: radheat_disable_waccm ! disable waccm heating in the upper atm + public :: radheat_disable_waccm ! disable waccm heating in the upper atm + + +! Private variables for merging heating rates + real(r8):: qrs_wt(pver) ! merge weight for cam solar heating + real(r8):: qrl_wt(pver) ! merge weight for cam long wave heating + + logical :: waccm_heating + logical :: waccm_heating_on = .true. + + ! sw merge region + ! highest altitude (lowest pressure) of merge region (Pa) + real(r8) :: min_pressure_sw= 5._r8 + ! lowest altitude (lowest pressure) of merge region (Pa) + real(r8) :: max_pressure_sw=50._r8 + + ! lw merge region + ! highest altitude (lowest pressure) of merge region (Pa) + real(r8) :: min_pressure_lw= 5._r8 + ! lowest altitude (highest pressure) of merge region (Pa) + real(r8) :: max_pressure_lw=50._r8 + + integer :: ntop_qrs_cam ! top level for pure cam solar heating !=============================================================================== contains !=============================================================================== - subroutine radheat_readnl(nlfile) character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input @@ -52,19 +81,132 @@ subroutine radheat_register end subroutine radheat_register !================================================================================================ +!================================================================================================ +!================================================================================================ + + subroutine radheat_init(pref_mid) -subroutine radheat_init(pref_mid) + + use nlte_fomichev, only: nlte_fomichev_init + use cam_history, only: add_default, addfld + use phys_control, only: phys_getopts + use physics_buffer, only : physics_buffer_desc - use pmgrid, only: plev - use physics_buffer, only : physics_buffer_desc + ! args - real(r8), intent(in) :: pref_mid(plev) + real(r8), intent(in) :: pref_mid(pver) ! mid point reference pressure + ! local vars + real(r8) :: co2_mw, o1_mw, o2_mw, o3_mw, no_mw, n2_mw ! molecular weights -end subroutine radheat_init + real(r8) :: delta_merge_sw ! range of merge region + real(r8) :: midpoint_sw ! midpoint of merge region + real(r8) :: delta_merge_lw ! range of merge region + real(r8) :: midpoint_lw ! midpoint of merge region + real(r8) :: psh(pver) ! pressure scale height + integer :: k + logical :: camrt + + character(len=16) :: rad_pkg + logical :: history_scwaccm_forcing + logical :: history_waccm + logical :: nlte_limit_co2 + +!----------------------------------------------------------------------- + + + call phys_getopts(radiation_scheme_out=rad_pkg, & + history_waccm_out=history_waccm, & + history_scwaccm_forcing_out=history_scwaccm_forcing) + camrt = rad_pkg == 'CAMRT' .or. rad_pkg == 'camrt' + + ! set max/min pressures for merging regions. + + if (camrt) then + min_pressure_sw = 1e5_r8*exp(-10._r8) + max_pressure_sw = 1e5_r8*exp(-9._r8) + min_pressure_lw = 1e5_r8*exp(-10._r8) + max_pressure_lw = 1e5_r8*exp(-8.57_r8) + else + min_pressure_sw = 5._r8 + max_pressure_sw = 50._r8 + min_pressure_lw = 10._r8 + max_pressure_lw = 50._r8 + endif + + delta_merge_sw = max_pressure_sw - min_pressure_sw + delta_merge_lw = max_pressure_lw - min_pressure_lw + + midpoint_sw = (max_pressure_sw + min_pressure_sw)/2._r8 + midpoint_lw = (max_pressure_lw + min_pressure_lw)/2._r8 + + do k=1,pver + + ! pressure scale heights for camrt merging (waccm4) + psh(k)=log(1e5_r8/pref_mid(k)) + + if ( pref_mid(k) .le. min_pressure_sw ) then + qrs_wt(k) = 0._r8 + else if( pref_mid(k) .ge. max_pressure_sw) then + qrs_wt(k) = 1._r8 + else + if (camrt) then + ! camrt + qrs_wt(k) = 1._r8 - tanh( (psh(k) - 9._r8)/.75_r8 ) + else + ! rrtmg + qrs_wt(k) = 0.5_r8 + 1.5_r8*((pref_mid(k)-midpoint_sw)/delta_merge_sw) & + - 2._r8*((pref_mid(k)-midpoint_sw)/delta_merge_sw)**3._r8 + endif + endif + + if ( pref_mid(k) .le. min_pressure_lw ) then + qrl_wt(k)= 0._r8 + else if( pref_mid(k) .ge. max_pressure_lw) then + qrl_wt(k)= 1._r8 + else + if (camrt) then + ! camrt + qrl_wt(k) = 1._r8 - tanh( (psh(k) - 8.57_r8) / 0.71_r8 ) + else + ! rrtmg + qrl_wt(k) = 0.5_r8 + 1.5_r8*((pref_mid(k)-midpoint_lw)/delta_merge_lw) & + - 2._r8*((pref_mid(k)-midpoint_lw)/delta_merge_lw)**3._r8 + endif + endif + + end do + + co2_mw = mwco2 + o1_mw = 16._r8 + o2_mw = 32._r8 + o3_mw = 48._r8 + no_mw = 30._r8 + n2_mw = 28._r8 + nlte_limit_co2 = .true. +! Initialize Fomichev parameterization + call nlte_fomichev_init (co2_mw, n2_mw, o1_mw, o2_mw, o3_mw, no_mw, nlte_limit_co2) + + + ! determine upppermost level that is purely solar heating (no MLT chem heationg) + ntop_qrs_cam = 0 + do k=pver,1,-1 + if (qrs_wt(k)==1._r8) ntop_qrs_cam = k + enddo + + + ! WACCM heating if top-most layer is above merge region + waccm_heating = (pref_mid(1) .le. min_pressure_sw) + + if (masterproc) then + write(iulog,*) 'WACCM Heating is computed (true/false): ',waccm_heating + end if + + end subroutine radheat_init !================================================================================================ -subroutine radheat_timestep_init (state, pbuf2d) + subroutine radheat_timestep_init (state, pbuf2d) + use physics_types,only : physics_state use ppgrid, only : begchunk, endchunk use physics_buffer, only : physics_buffer_desc @@ -73,62 +215,210 @@ subroutine radheat_timestep_init (state, pbuf2d) type(physics_buffer_desc), pointer :: pbuf2d(:,:) -end subroutine radheat_timestep_init + + end subroutine radheat_timestep_init !================================================================================================ -subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - fsnt, flns, flnt, asdir, net_flx) -#if ( defined OFFLINE_DYN ) - use metdata, only: met_rlx, met_srf_feedback -#endif + subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & + fsnt, flns, flnt, asdir, net_flx) !----------------------------------------------------------------------- ! Compute net radiative heating from qrs and qrl, and the associated net ! boundary flux. +! +! This routine provides the waccm hook for computing nonLTE cooling and +! eUV heating. !----------------------------------------------------------------------- -! Arguments - type(physics_state), intent(in) :: state ! Physics state variables + use cam_history, only: outfld + use nlte_fomichev, only: nlte_fomichev_calc - type(physics_buffer_desc), pointer :: pbuf(:) - type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencie - real(r8), intent(in) :: qrl(pcols,pver) ! longwave heating - real(r8), intent(in) :: qrs(pcols,pver) ! shortwave heating - real(r8), intent(in) :: fsns(pcols) ! Surface solar absorbed flux - real(r8), intent(in) :: fsnt(pcols) ! Net column abs solar flux at model top - real(r8), intent(in) :: flns(pcols) ! Srf longwave cooling (up-down) flux - real(r8), intent(in) :: flnt(pcols) ! Net outgoing lw flux at model top - real(r8), intent(in) :: asdir(pcols) ! shortwave, direct albedo - real(r8), intent(out) :: net_flx(pcols) + use physics_buffer, only : physics_buffer_desc + use constituents, only: cnst_get_ind +!+++arh + use rad_constituents, only: rad_cnst_get_gas -! Local variables - integer :: i, k - integer :: ncol -!----------------------------------------------------------------------- +! Arguments + type(physics_state), intent(in) :: state ! Physics state variables + + type(physics_buffer_desc), pointer :: pbuf(:) + type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencie + real(r8), intent(in) :: qrl(pcols,pver) ! longwave heating + real(r8), intent(in) :: qrs(pcols,pver) ! shortwave heating + real(r8), intent(in) :: fsns(pcols) ! Surface solar absorbed flux + real(r8), intent(in) :: fsnt(pcols) ! Net column abs solar flux at model top + real(r8), intent(in) :: flns(pcols) ! Srf longwave cooling (up-down) flux + real(r8), intent(in) :: flnt(pcols) ! Net outgoing lw flux at model top + real(r8), intent(in) :: asdir(pcols) ! shortwave, direct albedo + real(r8), intent(out) :: net_flx(pcols) - ncol = state%ncol +! Local variables + integer :: i, k , ico2 + integer :: ncol ! number of atmospheric columns + integer :: lchnk ! chunk identifier + real(r8) :: qrl_mrg(pcols,pver) ! merged LW heating + real(r8) :: qrl_mlt(pcols,pver) ! M/LT longwave heating rates + real(r8) :: qrs_mrg(pcols,pver) ! merged SW heating + real(r8) :: qrs_mlt(pcols,pver) ! M/LT solar heating rates + real(r8) :: qout(pcols,pver) ! temp for outfld call + real(r8) :: dcoef(6) ! for tidal component of heating + real(r8) :: tau_newt ! time scale for 'IR' relaxation + + real(r8) :: qrlfomichev(pcols,pver) ! Fomichev cooling rate ! (K/s) + real(r8) :: o3cool(pcols,pver) ! Fomichev cooling rate ! (K/s) + real(r8) :: co2cool(pcols,pver) ! Fomichev cooling rate ! (K/s) + real(r8) :: c2scool(pcols,pver) ! Fomichev cooling rate ! (K/s) + real(r8) :: xco2mmr(pcols,pver) ! CO2 + real(r8) :: xo2mmr(pcols,pver) ! O2 + real(r8) :: xo3mmr(pcols,pver) ! O3 + real(r8) :: xommr(pcols,pver) ! O + real(r8) :: xhmmr(pcols,pver) ! H + real(r8) :: xnommr(pcols,pver) ! NO + real(r8) :: xn2mmr(pcols,pver) ! N2 + +!+++arh + integer :: icall + real(r8), pointer :: gas_mmr(:,:) - call physics_ptend_init(ptend,state%psetcols, 'radheat', ls=.true.) +!----------------------------------------------------------------------- -#if ( defined OFFLINE_DYN ) - ptend%s(:ncol,:) = 0._r8 - do k = 1,pver - if (met_rlx(k) < 1._r8 .or. met_srf_feedback) then - ptend%s(:ncol,k) = (qrs(:ncol,k) + qrl(:ncol,k)) - endif - enddo + ncol = state%ncol + lchnk = state%lchnk + + call cnst_get_ind( 'CO2', ico2 ) + xco2mmr = state%q(:,:,ico2) + + call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) + + qrs_mlt(:,:) = 0._r8 + +! Merge cam solar heating for lower atmosphere with M/LT heating +! call merge_qrs (ncol, qrs, qrs_mlt, qrs_mrg, cpairv(:,:,lchnk)) +! qout(:ncol,:) = qrs_mrg(:ncol,:)/cpair +!++jtb +! just use RRTMG's + qrs_mrg(:,:) = qrs(:,:) + +!++jtb + +#if 0 +! think I need to scale w/ cpair + tau_newt = 1._r8 * 86400._r8 ! 1 day Newtonian timescale + do k = 1, pver + do i = 1, ncol + qrl_mlt(i,k) = -cpair * ( state%t(i,k) - 200._r8 ) / tau_newt + end do + end do #else - ptend%s(:ncol,:) = (qrs(:ncol,:) + qrl(:ncol,:)) + +!+++arh + icall = 0 + +! can't find gas name 'O' + !call rad_cnst_get_gas(icall,'O ', state, pbuf, gas_mmr) + !xommr(:pcols,:pver) = gas_mmr(:pcols,:pver) + !nullify(gas_mmr) + xommr(:pcols,:pver) = 0._r8 + + call rad_cnst_get_gas(icall,'O2 ', state, pbuf, gas_mmr) + xo2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) + nullify(gas_mmr) + + call rad_cnst_get_gas(icall,'O3 ', state, pbuf, gas_mmr) + xo3mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) + nullify(gas_mmr) + +! can't find gas name 'N2' + !call rad_cnst_get_gas(icall,'N2 ', state, pbuf, gas_mmr) + !xn2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) + !nullify(gas_mmr) + !++ jtb set to 0.7547 ('standard' mass mixing ratio of nitrogen gas in atmos) + xn2mmr(:pcols,:pver) = 0.7547_r8 !0._r8 + + call rad_cnst_get_gas(icall,'CO2 ', state, pbuf, gas_mmr) + xco2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) + nullify(gas_mmr) + + !xommr = 0._r8 + !xo3mmr = 0._r8 + !xo2mmr = 0.2320_r8 + !xn2mmr = 0.7547_r8 + !xhmmr = 0._r8 + !xnommr = 0._r8 + call nlte_fomichev_calc (lchnk,ncol,state%pmid,state%pint,state%t, & + xo2mmr,xommr,xo3mmr,xn2mmr,xco2mmr,qrlfomichev,co2cool,o3cool,c2scool) + qrl_mlt = qrlfomichev #endif - do i = 1, ncol - net_flx(i) = fsnt(i) - fsns(i) - flnt(i) + flns(i) - end do +! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating + call merge_qrl (ncol, qrl, qrl_mlt, qrl_mrg) + qout(:ncol,:) = qrl_mrg(:ncol,:)/cpair + + ptend%s(:ncol,:) = qrs_mrg(:ncol,:) + qrl_mrg(:ncol,:) + + net_flx = 0._r8 + do k = 1, pver + do i = 1, ncol + net_flx(i) = net_flx(i) + ptend%s(i,k)*state%pdel(i,k)/gravit + end do + end do -end subroutine radheat_tend + end subroutine radheat_tend !================================================================================================ subroutine radheat_disable_waccm() + waccm_heating_on = .false. end subroutine radheat_disable_waccm +!================================================================================================ + + subroutine merge_qrs (ncol, hcam, hmlt, hmrg, cpair) +! +! Merges short wave heating rates +! + implicit none + +!-----------------Input arguments----------------------------------- + integer ncol + + real(r8), intent(in) :: hmlt(pcols,pver) ! Upper atmosphere heating rates + real(r8), intent(in) :: hcam(pcols,pver) ! CAM heating rate + real(r8), intent(out) :: hmrg(pcols,pver) ! merged heating rates + real(r8), intent(in) :: cpair(pcols,pver) ! Specific heat of dry air + +!-----------------Local workspace------------------------------------ + + integer k + + do k = 1, pver + hmrg(:ncol,k) = qrs_wt(k)*hcam(:ncol,k) + (1._r8 - qrs_wt(k))*cpair(:ncol,k)*hmlt(:ncol,k) + end do + + end subroutine merge_qrs + +!================================================================================================== + + subroutine merge_qrl (ncol, hcam, hmlt, hmrg) +! +! Merges long wave heating rates +! +!-----------------Input arguments----------------------------------- + integer ncol + + real(r8), intent(in) :: hmlt(pcols,pver) ! Upper atmosphere heating rates + real(r8), intent(in) :: hcam(pcols,pver) ! CAM heating rate + real(r8), intent(out) :: hmrg(pcols,pver) ! merged heating rates + +!-----------------Local workspace------------------------------------ + + integer k + +!-------------------------------------------------------------------- + + do k = 1, pver + hmrg(:ncol,k) = qrl_wt(k) * hcam(:ncol,k) + (1._r8-qrl_wt(k)) * hmlt(:ncol,k) + end do + + end subroutine merge_qrl + end module radheat diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 11a0db5413..517c45f889 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -454,7 +454,9 @@ subroutine radiation_init(pbuf2d) ! below 1 Pa then an extra layer is added to the top of the model for ! the purpose of the radiation calculation. - nlay = count( pref_edge(:) > 1._r8 ) ! pascals (0.01 mbar) + !nlay = count( pref_edge(:) > 1._r8 ) ! pascals (0.01 mbar) + !++ jtb set to 10 Pa + nlay = count( pref_edge(:) > 10._r8 ) ! pascals (0.1 mbar) if (nlay == pverp) then ! Top model interface is below 1 Pa. RRTMGP is active in all model layers plus @@ -462,14 +464,6 @@ subroutine radiation_init(pbuf2d) ktopcam = 1 ktoprad = 2 nlaycam = pver - else if (nlay == (pverp-1)) then - ! Special case nlay == (pverp-1) -- topmost interface outside bounds (CAM MT config), treat as if it is ok. - ktopcam = 1 - ktoprad = 2 - nlaycam = pver - nlay = nlay+1 ! reassign the value so later code understands to treat this case like nlay==pverp - write(iulog,*) 'RADIATION_INIT: Special case of 1 model interface at p < 1Pa. Top layer will be INCLUDED in radiation calculation.' - write(iulog,*) 'RADIATION_INIT: nlay = ',nlay, ' same as pverp: ',nlay==pverp else ! nlay < pverp. nlay layers are used in radiation calcs, and they are ! all CAM layers. diff --git a/src/physics/rrtmgp/rrtmgp_inputs.F90 b/src/physics/rrtmgp/rrtmgp_inputs.F90 index 4f73ae9029..2f2b125e09 100644 --- a/src/physics/rrtmgp/rrtmgp_inputs.F90 +++ b/src/physics/rrtmgp/rrtmgp_inputs.F90 @@ -150,20 +150,11 @@ subroutine rrtmgp_set_state( & ! Add extra layer values if needed. if (nlay == pverp) then - t_rad(:,1) = state%t(:ncol,1) + t_rad(:,1) = state%t(:ncol,1) + pmid_rad(:,1) = 0.5_r8 * state%pint(:ncol,1) ! The top reference pressure from the RRTMGP coefficients datasets is 1.005183574463 Pa ! Set the top of the extra layer just below that. pint_rad(:,1) = 1.01_r8 - - ! next interface down in LT will always be > 1Pa - ! but in MT we apply adjustment to have it be 1.02 Pa if it was too high - where (pint_rad(:,2) <= pint_rad(:,1)) pint_rad(:,2) = pint_rad(:,1)+0.01_r8 - - ! set the highest pmid (in the "extra layer") to the midpoint (guarantees > 1Pa) - pmid_rad(:,1) = pint_rad(:,1) + 0.5_r8 * (pint_rad(:,2) - pint_rad(:,1)) - - ! For case of CAM MT, also ensure pint_rad(:,2) > pint_rad(:,1) & pmid_rad(:,2) > max(pmid_rad(:,1), min_pressure) - where (pmid_rad(:,2) <= kdist_sw%get_press_min()) pmid_rad(:,2) = pint_rad(:,2) + 0.01_r8 else ! nlay < pverp, thus the 1 Pa level is within a CAM layer. Assuming the top interface of ! this layer is at a pressure < 1 Pa, we need to adjust the top of this layer so that it From 5d151a0a5539bfed77c3ada6eefcbf9c3a678c80 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 31 Jul 2025 09:31:35 -0600 Subject: [PATCH 262/466] add offline dynamics logic back in --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/cam/radheat.F90 | 98 ++++++++++--------------------------- 3 files changed, 29 insertions(+), 73 deletions(-) diff --git a/.gitmodules b/.gitmodules index 016ffb3b70..6c08cb8fda 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 71cb68ae6b8c31362e76cbb98e01706c596129ab + fxtag = 99b819889adf0e523980be6e7ad046b6af20c85e fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 71cb68ae6b..99b819889a 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 71cb68ae6b8c31362e76cbb98e01706c596129ab +Subproject commit 99b819889adf0e523980be6e7ad046b6af20c85e diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 936630de1e..f2d2f2776f 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -230,6 +230,9 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ! eUV heating. !----------------------------------------------------------------------- +#if ( defined OFFLINE_DYN ) + use metdata, only: met_rlx, met_srf_feedback +#endif use cam_history, only: outfld use nlte_fomichev, only: nlte_fomichev_calc @@ -262,7 +265,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: qrl_mrg(pcols,pver) ! merged LW heating real(r8) :: qrl_mlt(pcols,pver) ! M/LT longwave heating rates real(r8) :: qrs_mrg(pcols,pver) ! merged SW heating - real(r8) :: qrs_mlt(pcols,pver) ! M/LT solar heating rates real(r8) :: qout(pcols,pver) ! temp for outfld call real(r8) :: dcoef(6) ! for tidal component of heating real(r8) :: tau_newt ! time scale for 'IR' relaxation @@ -275,8 +277,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: xo2mmr(pcols,pver) ! O2 real(r8) :: xo3mmr(pcols,pver) ! O3 real(r8) :: xommr(pcols,pver) ! O - real(r8) :: xhmmr(pcols,pver) ! H - real(r8) :: xnommr(pcols,pver) ! NO real(r8) :: xn2mmr(pcols,pver) ! N2 !+++arh @@ -289,32 +289,11 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ncol = state%ncol lchnk = state%lchnk - - call cnst_get_ind( 'CO2', ico2 ) - xco2mmr = state%q(:,:,ico2) - call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) - - qrs_mlt(:,:) = 0._r8 -! Merge cam solar heating for lower atmosphere with M/LT heating -! call merge_qrs (ncol, qrs, qrs_mlt, qrs_mrg, cpairv(:,:,lchnk)) -! qout(:ncol,:) = qrs_mrg(:ncol,:)/cpair !++jtb ! just use RRTMG's qrs_mrg(:,:) = qrs(:,:) - -!++jtb - -#if 0 -! think I need to scale w/ cpair - tau_newt = 1._r8 * 86400._r8 ! 1 day Newtonian timescale - do k = 1, pver - do i = 1, ncol - qrl_mlt(i,k) = -cpair * ( state%t(i,k) - 200._r8 ) / tau_newt - end do - end do -#else !+++arh icall = 0 @@ -344,29 +323,32 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & xco2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) nullify(gas_mmr) - !xommr = 0._r8 - !xo3mmr = 0._r8 - !xo2mmr = 0.2320_r8 - !xn2mmr = 0.7547_r8 - !xhmmr = 0._r8 - !xnommr = 0._r8 - call nlte_fomichev_calc (lchnk,ncol,state%pmid,state%pint,state%t, & - xo2mmr,xommr,xo3mmr,xn2mmr,xco2mmr,qrlfomichev,co2cool,o3cool,c2scool) - qrl_mlt = qrlfomichev + call nlte_fomichev_calc (lchnk,ncol,state%pmid,state%pint,state%t, & + xo2mmr,xommr,xo3mmr,xn2mmr,xco2mmr,qrlfomichev,co2cool,o3cool,c2scool) + qrl_mlt = qrlfomichev + +! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating + call merge_qrl (ncol, qrl, qrl_mlt, qrl_mrg) + qout(:ncol,:) = qrl_mrg(:ncol,:)/cpair + + ! REMOVECAM no longer need once CAM is retired and pcols doesn't exist + net_flx = 0._r8 + ptend%s = 0._r8 + ! END_REMOVECAM + +#if ( defined OFFLINE_DYN ) + do k = 1,pver + if (met_rlx(k) < 1._r8 .or. met_srf_feedback) then + ptend%s(:ncol,k) = (qrs_mrg(:ncol,k) + qrl_mrg(:ncol,k)) + endif + enddo + call calculate_net_heating_run(ncol, pver, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), & + .true., gravit, state%pdel(:ncol,:), net_flx(:ncol), errmsg, errflg) +#else + call calculate_net_heating_run(ncol, pver, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), & + .false., gravit, state%pdel(:ncol,:), net_flx(:ncol), errmsg, errflg) #endif -! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating - call merge_qrl (ncol, qrl, qrl_mlt, qrl_mrg) - qout(:ncol,:) = qrl_mrg(:ncol,:)/cpair - - ! REMOVECAM no longer need once CAM is retired and pcols doesn't exist - net_flx = 0._r8 - ptend%s = 0._r8 - ! END_REMOVECAM - - call calculate_net_heating_run(ncol, pver, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), & - gravit, state%pdel(:ncol,:), net_flx(:ncol), errmsg, errflg) - end subroutine radheat_tend !================================================================================================ @@ -375,32 +357,6 @@ subroutine radheat_disable_waccm() end subroutine radheat_disable_waccm !================================================================================================ - subroutine merge_qrs (ncol, hcam, hmlt, hmrg, cpair) -! -! Merges short wave heating rates -! - implicit none - -!-----------------Input arguments----------------------------------- - integer ncol - - real(r8), intent(in) :: hmlt(pcols,pver) ! Upper atmosphere heating rates - real(r8), intent(in) :: hcam(pcols,pver) ! CAM heating rate - real(r8), intent(out) :: hmrg(pcols,pver) ! merged heating rates - real(r8), intent(in) :: cpair(pcols,pver) ! Specific heat of dry air - -!-----------------Local workspace------------------------------------ - - integer k - - do k = 1, pver - hmrg(:ncol,k) = qrs_wt(k)*hcam(:ncol,k) + (1._r8 - qrs_wt(k))*cpair(:ncol,k)*hmlt(:ncol,k) - end do - - end subroutine merge_qrs - -!================================================================================================== - subroutine merge_qrl (ncol, hcam, hmlt, hmrg) ! ! Merges long wave heating rates From a2bbb231a68776abc90faf8014e765360e661955 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 31 Jul 2025 10:14:20 -0600 Subject: [PATCH 263/466] Update atmos_phys external location --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6c08cb8fda..d68cea1f3e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,8 +35,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = 99b819889adf0e523980be6e7ad046b6af20c85e + url = https://github.com/cacraigucar/atmospheric_physics + fxtag = rrtmgp_julio fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From 9437cd290e8c61ce0baafdee955be844a6fe4a40 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 31 Jul 2025 15:35:28 -0400 Subject: [PATCH 264/466] cam7 satellite tracks and local tod --- cime_config/testdefs/testlist_cam.xml | 145 ++++++++++-------- .../cam/sat_lcltod/shell_commands | 3 + .../testmods_dirs/cam/sat_lcltod/user_nl_cam | 17 ++ .../testmods_dirs/cam/sat_lcltod/user_nl_clm | 27 ++++ doc/ChangeLog | 7 + 5 files changed, 131 insertions(+), 68 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/sat_lcltod/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 9ac6afc513..b8dfbe4857 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -5,6 +5,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -118,11 +195,6 @@ - - - - - @@ -1503,69 +1575,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/shell_commands b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/shell_commands new file mode 100644 index 0000000000..1716cb6ab1 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/shell_commands @@ -0,0 +1,3 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange RUN_STARTDATE="20050101" diff --git a/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_cam new file mode 100644 index 0000000000..77b776002d --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_cam @@ -0,0 +1,17 @@ + ndens=1,1,1,1,1,1 + nhtfrq=3,3,3,3,-2,3 + mfilt=1,1,1,1,1,1 + + avgflag_pertape = 'I',' ','L','L','S' + lcltod_start = 0,0, 7200,82800,0 + lcltod_stop = 0,0,10800,7200,0 + + sathist_track_infile='$DIN_LOC_ROOT/atm/cam/sat/satellite_profilelist_20020125_20101030_c110204_noleap.nc' + sathist_fincl = 'Q','T','PS','U','V' + + fincl2 = 'Q','T','PS','SOLIN' + fincl3 = 'Q','T','PS','SOLIN' + fincl4 = 'Q','T','PS','SOLIN' + fincl5 = 'Q','T','U','V','PS','AEROD_v','TOT_CLD_VISTAU','SOLIN' + + diff --git a/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_clm new file mode 100644 index 0000000000..f3ac27f1e6 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/sat_lcltod/user_nl_clm @@ -0,0 +1,27 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 3 +hist_mfilt = 1 +hist_ndens = 1 + diff --git a/doc/ChangeLog b/doc/ChangeLog index 5838b0d2f6..772d9f1dd9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -36,6 +36,9 @@ cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/* . testmods for ERI test - 3 step output frequency and set check_finidat_year_consistency=.false. in user_nl_clm +cime_config/testdefs/testmods_dirs/cam/sat_lcltod/* +. testmods for satellite track and local time of day outputs + List all existing files that have been modified, and describe the changes: cime_config/config_compsets.xml @@ -54,6 +57,10 @@ cime_config/testdefs/testlist_cam.xml ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri and add ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri +. add cam7 test for satellite tracks and local tod + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod + + cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam . move the cosp output to h1, add cosp aux output to h2 From 9ea48cc1e8d3262faa7b571527411bf1711d4ee8 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 31 Jul 2025 16:18:56 -0600 Subject: [PATCH 265/466] Update atmos_phys hash --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index d68cea1f3e..f356963ecd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/cacraigucar/atmospheric_physics - fxtag = rrtmgp_julio + fxtag = cdee0ff fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From 1c823a7af5084610ff8662f389b510c26b6a2e34 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 4 Aug 2025 09:38:23 -0600 Subject: [PATCH 266/466] update hash; update interfaces to calculate_net_heating_run --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/cam/radheat.F90 | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index f356963ecd..5eddf287cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/cacraigucar/atmospheric_physics - fxtag = cdee0ff + fxtag = 0949af7804d4f2bb75648959f2b0ec81eb8d3ba1 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 99b819889a..0949af7804 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 99b819889adf0e523980be6e7ad046b6af20c85e +Subproject commit 0949af7804d4f2bb75648959f2b0ec81eb8d3ba1 diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index f2d2f2776f..088696d502 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -342,11 +342,13 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ptend%s(:ncol,k) = (qrs_mrg(:ncol,k) + qrl_mrg(:ncol,k)) endif enddo - call calculate_net_heating_run(ncol, pver, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), & - .true., gravit, state%pdel(:ncol,:), net_flx(:ncol), errmsg, errflg) + call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), .true., & + gravit, state%pdel(:ncol,:), fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & + errmsg, errflg) #else - call calculate_net_heating_run(ncol, pver, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), & - .false., gravit, state%pdel(:ncol,:), net_flx(:ncol), errmsg, errflg) + call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), .false., & + gravit, state%pdel(:ncol,:), fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & + errmsg, errflg) #endif end subroutine radheat_tend From 0797392b1a0b0256613481ab14c636147a9769d9 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 5 Aug 2025 09:23:52 -0400 Subject: [PATCH 267/466] build-namelist check: no cosp output to interpolated histfile --- bld/build-namelist | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index eccff7d77f..4692d4a9f5 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -783,7 +783,8 @@ elsif (!$simple_phys) { # COSP simulator -if ($cfg->get('cosp')) { +my $docosp = $cfg->get('cosp'); +if ($docosp) { add_default($nl, 'docosp', 'val'=>'.true.'); } @@ -4419,18 +4420,32 @@ my $interpolate_output = $nl->get_value('interpolate_output'); my @interp_output = split /,/, $interpolate_output; for my $i (0 .. $#interp_output) { if ($interp_output[$i] =~ /$TRUE/io) { + # Currently, interpolated output is only supported for the SE dycore if ( ! ($dyn =~ /se/) ) { die "$ProgName - ERROR: interpolate_output is not supported for $dyn dycore"; } + # Currently, interpolated output is incompatible with regional output my $region = $nl->get_value('fincl${i}lonlat'); if (defined $region) { die "$ProgName - ERROR: interpolate_output is currently incompatible with regional output (e.g., fincl${i}lonlat)"; } + } } +# Currently, interpolated output does not work with the COSP fields that use +# more than 1 mdims. +my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); +if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} +if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { + die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . + " to direct COSP output to a history file that is not interpolated. COSP output is\n" . + " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; +} + + my $offline_drv = $cfg->get('offline_drv'); if ($offline_drv ne 'stub') { From aa87b6a2d4fa1bc2e3f2764b6b74d593ecfcfb9c Mon Sep 17 00:00:00 2001 From: peverwhee Date: Tue, 5 Aug 2025 09:34:27 -0600 Subject: [PATCH 268/466] update to latest pio reader --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/utils/cam_ccpp/pio_reader.F90 | 1444 ++++++++--------------------- 3 files changed, 385 insertions(+), 1063 deletions(-) diff --git a/.gitmodules b/.gitmodules index 59d1494d30..d483e6899f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 86fc6f9542b949af4e667c1be6d364a08102485b + fxtag = 8f302beb73f13e5ca61460e717346e1a535622c0 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 86fc6f9542..8f302beb73 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 86fc6f9542b949af4e667c1be6d364a08102485b +Subproject commit 8f302beb73f13e5ca61460e717346e1a535622c0 diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 index 5a6983df7e..3868e8c3a2 100644 --- a/src/utils/cam_ccpp/pio_reader.F90 +++ b/src/utils/cam_ccpp/pio_reader.F90 @@ -30,20 +30,27 @@ module pio_reader private type(file_handle_t) :: sima_pio_fh !PIO File handle type contains + !File procedures procedure :: open_file => open_netcdf_file procedure :: close_file => close_netcdf_file + + !Integer interfaces procedure :: get_var_int_0d => get_netcdf_var_int_0d procedure :: get_var_int_1d => get_netcdf_var_int_1d procedure :: get_var_int_2d => get_netcdf_var_int_2d procedure :: get_var_int_3d => get_netcdf_var_int_3d procedure :: get_var_int_4d => get_netcdf_var_int_4d procedure :: get_var_int_5d => get_netcdf_var_int_5d + + !Real interfaces procedure :: get_var_real_0d => get_netcdf_var_real_0d procedure :: get_var_real_1d => get_netcdf_var_real_1d procedure :: get_var_real_2d => get_netcdf_var_real_2d procedure :: get_var_real_3d => get_netcdf_var_real_3d procedure :: get_var_real_4d => get_netcdf_var_real_4d procedure :: get_var_real_5d => get_netcdf_var_real_5d + + !Character interfaces procedure :: get_var_char_0d => get_netcdf_var_char_0d procedure :: get_var_char_1d => get_netcdf_var_char_1d procedure :: get_var_char_2d => get_netcdf_var_char_2d @@ -122,7 +129,7 @@ end subroutine close_netcdf_file ! Integer interfaces ! ------------------------------------------------------------------ - subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -131,11 +138,15 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -143,10 +154,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer :: i !loop control variable !---------------------- !Check if file is open: @@ -226,7 +234,7 @@ subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_int_0d - subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -235,22 +243,24 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var(:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var(:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -279,69 +289,14 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 1) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension size - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + !Get variable dimension sizes: + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) @@ -371,7 +326,7 @@ subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_int_1d - subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -380,22 +335,24 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var(:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var(:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -424,69 +381,14 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 2) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + !Get variable dimension sizes: + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) @@ -516,7 +418,7 @@ subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_int_2d - subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -525,22 +427,24 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var(:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var(:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -569,69 +473,14 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 3) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) @@ -661,7 +510,7 @@ subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_int_3d - subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -670,11 +519,15 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var(:,:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var(:,:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -685,7 +538,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -714,69 +567,14 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 4) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) @@ -806,7 +604,7 @@ subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_int_4d - subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -815,22 +613,24 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) use pio, only: PIO_NOERR use pio, only: PIO_BCAST_ERROR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, pointer, intent(out) :: var(:,:,:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + integer, allocatable, intent(out) :: var(:,:,:,:,:) !Integer variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -859,69 +659,14 @@ subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - + !Get variable dimension sizes: + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 5) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & @@ -956,7 +701,7 @@ end subroutine get_netcdf_var_int_5d ! Real interfaces ! ------------------------------------------------------------------ - subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -968,19 +713,20 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer :: i !loop control variable !---------------------- !Check if file is open: @@ -1060,7 +806,7 @@ subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_real_0d - subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -1072,19 +818,21 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var(:) !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var(:) !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -1113,69 +861,14 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 1) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) @@ -1205,7 +898,7 @@ subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_real_1d - subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -1217,19 +910,21 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var(:,:) !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var(:,:) !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -1258,69 +953,14 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 2) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) @@ -1350,7 +990,7 @@ subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_real_2d - subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -1362,19 +1002,21 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var(:,:,:) !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var(:,:,:) !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -1403,71 +1045,16 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 3) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: + !Now attempt to allocate and initialize the variable, + !and read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) if(errcode /= 0) then !Reset PIO back to original error handling method: @@ -1495,7 +1082,7 @@ subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_real_3d - subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -1507,19 +1094,21 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var(:,:,:,:) !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var(:,:,:,:) !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -1548,84 +1137,29 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - + !Get variable dimension sizes: + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 4) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" + !Now attempt to allocate and initialize variable, and + !read-in the NetCDF data: + allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if + var(:,:,:,:) = huge(1._kind_phys) + errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) + + if (errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return @@ -1640,7 +1174,7 @@ subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_real_4d - subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode, start, count) use ccpp_kinds, only: kind_phys use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen @@ -1652,19 +1186,21 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) class(pio_reader_t), intent(in) :: this character(len=*), intent(in) :: varname - real(kind_phys), pointer, intent(out) :: var(:,:,:,:,:) !Real variable that file data will be read to. + real(kind_phys), allocatable, intent(out) :: var(:,:,:,:,:) !Real variable that file data will be read to. integer, intent(out) :: errcode !Error code character(len=*), intent(out) :: errmsg !Error message + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension + type(file_desc_t) :: pio_file_handle !File handle type used by PIO character(len=cl) :: file_path !Path to NetCDF file integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file !---------------------- !Check if file is open: @@ -1693,71 +1229,16 @@ subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode) return end if - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 5) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: + !Now attempt to allocate and initialize the variable, + !and read-in the NetCDF data: allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & stat=errcode, errmsg=errmsg) if(errcode /= 0) then @@ -1790,7 +1271,7 @@ end subroutine get_netcdf_var_real_5d ! Character interfaces ! ------------------------------------------------------------------ - subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -1800,11 +1281,15 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -1812,10 +1297,17 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file + !---------------------- !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -1843,8 +1335,8 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -1864,66 +1356,14 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 1) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion !is the length of the character array, so need to start @@ -1955,7 +1395,7 @@ subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_0d - subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -1965,11 +1405,15 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var(:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var(:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -1977,10 +1421,17 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file + !---------------------- !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -2008,8 +1459,8 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -2029,66 +1480,14 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 2) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion !is the length of the character array, so need to start @@ -2120,7 +1519,7 @@ subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_1d - subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -2130,11 +1529,15 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var(:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var(:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -2142,10 +1545,17 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file + !---------------------- !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -2173,8 +1583,8 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -2194,65 +1604,13 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 3) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do + end if !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion @@ -2285,7 +1643,7 @@ subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_2d - subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -2295,11 +1653,15 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var(:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var(:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -2307,10 +1669,19 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file + !---------------------- + + !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -2338,8 +1709,8 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -2359,66 +1730,14 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 4) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion !is the length of the character array, so need to start @@ -2450,7 +1769,7 @@ subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_3d - subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -2460,11 +1779,15 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var(:,:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var(:,:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -2472,10 +1795,17 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file + !---------------------- !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -2503,8 +1833,8 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -2524,66 +1854,14 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 5) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion !is the length of the character array, so need to start @@ -2616,7 +1894,7 @@ subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_4d - subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) + subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode, start, count) use pio, only: pio_inq_varid use pio, only: pio_inq_dimlen use pio, only: pio_inquire_variable @@ -2626,11 +1904,15 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) use pio, only: PIO_BCAST_ERROR use pio_types, only: PIO_CHAR - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), pointer, intent(out) :: var(:,:,:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message + class(pio_reader_t), intent(in) :: this + character(len=*), intent(in) :: varname + character(len=:), allocatable, intent(out) :: var(:,:,:,:,:) !Character variable that file data will be read to. + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Optional arguments for reading a subset of the variable + integer, optional, intent(in) :: start(:) !Start indices for each dimension + integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension !Local variables: type(file_desc_t) :: pio_file_handle !File handle type used by PIO @@ -2638,10 +1920,17 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) integer :: err_handling !PIO error handling code integer :: var_id !NetCDF variable ID integer :: nc_type !NetCDF variable type - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs integer, allocatable :: dim_sizes(:) !Variable dimension sizes - integer :: i !loop control variable + + !NOTE: NetCDF supports both character arrays and string-type + !data depending on the NetCDF version, so the dimensions + !might be one larger than the actual array size if it + !includes the character length as a dimension as well. + !Ideally the actual type would be checked and handled + !differently, but for now just confirm it's a character + !array and check for ndims = rank+1 + integer, parameter :: var_ndims = 6 !Number of expected dimensions for variable in NetCDF file + !---------------------- !Check if file is open: if(.not.this%sima_pio_fh%is_file_open) then @@ -2669,8 +1958,8 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) return end if - !Get variable type and number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type, ndims=ndims) + !Get variable type on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) if(errcode /= PIO_NOERR) then !Extract error message from PIO: call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) @@ -2690,66 +1979,14 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) return end if - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just assume a character array - !and check for ndims = rank+1 - errcode = 0 - if(ndims /= 6) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then + call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + if (errcode /= 0) then !Reset PIO back to original error handling method: call pio_seterrorhandling(pio_file_handle, err_handling) return end if - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - end do - !Now attempt to allocate and initialize variable, and !read-in the NetCDF data. Note that the first dimenstion !is the length of the character array, so need to start @@ -2782,6 +2019,10 @@ subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode) errmsg = '' end subroutine get_netcdf_var_char_5d + ! ------------------------------------------------------------------ + ! Helper routines (not externally accessible) + ! ------------------------------------------------------------------ + subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg, file_msg) !Set error message based off PIO error code, !and then reset PIO error code to caller-specified @@ -2830,4 +2071,85 @@ subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg, file_msg) end if end subroutine get_pio_errmsg + subroutine get_dim_sizes(varname, var_rank, var_id, pio_file_handle, dim_sizes, errcode, errmsg) + !Extract the dimension sizes for a NetCDF + !variable given a variable ID, and + !return a new 1-D array with the variable + !dimension sizes. + + use pio, only: pio_inq_dimlen + use pio, only: pio_inquire_variable + use pio, only: PIO_NOERR + + !Input variables: + character(len=*), intent(in) :: varname !Name of NetCDF variable + integer, intent(in) :: var_rank !Rank (number of dims) of NetCDF variable + integer, intent(in) :: var_id !Variable ID for NetCDF variable + type(file_desc_t), intent(in) :: pio_file_handle !File handle type used by PIO + + !Output variables: + integer, allocatable, intent(out) :: dim_sizes(:) !Variable dimension sizes + integer, intent(out) :: errcode !Error code + character(len=*), intent(out) :: errmsg !Error message + + !Local variables: + integer :: ndims !Number of NetCDF variable dimensions + integer, allocatable :: dim_ids(:) !Variable dimension IDs + + integer :: i !loop control variable + + !Initialize error code and message: + errcode = 0 + errmsg = '' + + !Get number of variable dimensions on file: + errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) + return + end if + + !Check that the variable rank as specified by the caller + !matches what is found on the NetCDF file: + errcode = 0 + if(ndims /= var_rank) then + errcode = bad_var_rank_err + errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" + return + end if + + !Get variable dimension sizes: + !Allocate NetCDF variable dimension ID array: + allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + return + end if + + !Get variable dimension IDs: + errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) + return + end if + + !Allocate NetCDF variable dimension sizes array: + allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) + if(errcode /= 0) then + return + end if + + !Get dimension sizes: + do i = 1, ndims + errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) + if(errcode /= PIO_NOERR) then + !Extract error message from PIO: + call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) + return + end if + end do + + end subroutine get_dim_sizes + end module pio_reader From b6548acee36c1f280022b8598474c858f9b9cbff Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 5 Aug 2025 15:53:54 -0400 Subject: [PATCH 269/466] update cam5 test w/ mam7 aerosols --- cime_config/config_component.xml | 4 +-- cime_config/config_compsets.xml | 5 ---- cime_config/testdefs/testlist_cam.xml | 28 ++++++++++++----- .../testmods_dirs/cam/mam7/shell_commands | 4 +++ .../testmods_dirs/cam/mam7/user_nl_cam | 4 +++ .../testmods_dirs/cam/mam7/user_nl_clm | 27 +++++++++++++++++ doc/ChangeLog | 30 +++++++++++++++---- 7 files changed, 81 insertions(+), 21 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/mam7/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_clm diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index fc37b307fc..0a0b851b54 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -10,7 +10,7 @@ --> CAM cam7 physics: CAM cam6 physics: - CAM cam5 physics: + CAM cam5 physics: CAM cam4 physics: CAM simplified and non-versioned physics : @@ -48,7 +48,6 @@ CAM low top model WACCM model WACCMX extended model - Modal Aerosol Model composed of 7 modes: CAM mid top model CAM tropospheric chemistry with bulk aerosols: @@ -136,7 +135,6 @@ -chem trop_strat_mam5_vbs -chem geoschem_mam4 - -chem trop_mam7 -chem trop_strat_noaero -carma trop_strat_soa5 -chem waccm_ma_noaero -carma trop_strat_soa1 -chem trop_strat_mam5_vbsext diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 625c61a803..b3d02c6b42 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -222,11 +222,6 @@ 2000_CAM50_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC5M7 - 2000_CAM50%MAM7_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC6HIST HIST_CAM60_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index b8dfbe4857..a286171f30 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -251,6 +251,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -1120,14 +1140,6 @@ - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/mam7/shell_commands b/cime_config/testdefs/testmods_dirs/cam/mam7/shell_commands new file mode 100644 index 0000000000..26ded8c48e --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mam7/shell_commands @@ -0,0 +1,4 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange --append CAM_CONFIG_OPTS="-chem trop_mam7" +./xmlchange RUN_STARTDATE="2000-07-01" diff --git a/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_cam new file mode 100644 index 0000000000..8482082dce --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_cam @@ -0,0 +1,4 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9 +inithist='ENDOFRUN' diff --git a/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_clm new file mode 100644 index 0000000000..0d83b5367b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mam7/user_nl_clm @@ -0,0 +1,27 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + diff --git a/doc/ChangeLog b/doc/ChangeLog index 772d9f1dd9..113e8a95bf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,12 +8,16 @@ Github PR URL: Purpose of changes (include the issue number and title text for each relevant GitHub issue): -. Add ERI tests (branch and hybrid runs) for F compsets. Previously only - aquaplanet configurations tested. +. Add ERI tests (branch and hybrid runs) for cam5, cam6, and cam7 F + compsets. Previously only aquaplanet configurations tested. . Add testing of interpolated output for FHISTC_LTso. Move COSP output to - a separate history file that uses the SE grid. The COSP output to a lat/lon - grid doesn't work. + a separate history file that uses the native SE grid. The COSP output of + fields with more than 1 mdim to an interpolated lat/lon grid doesn't + work. A check was added to build-namelist to prevent specifiying COSP + output on an interpolated history file. + +. Updates to cam5 testing. Describe any changes made to build system: @@ -32,6 +36,12 @@ cime_config/testdefs/testmods_dirs/cam/volc_usecase/* List all files added and what they do: +bld/build-namelist +. add check for COSP output on an interpolated file + +cime_config/testdefs/testmods_dirs/cam/mam7/* +. testmods for mam7 aerosols + cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/* . testmods for ERI test - 3 step output frequency and set check_finidat_year_consistency=.false. in user_nl_clm @@ -45,21 +55,31 @@ cime_config/config_compsets.xml . add FHIST_C5 = HIST_CAM50_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV . remove QPC5HIST +. remove QPC5M7 cime_config/config_component.xml . remove unused (and untested) modifiers %CLB, %RCO2 +. remove modifier %MAM7 + cime_config/testdefs/testlist_cam.xml -. add ERI tests for cam6 and cam7 F compsets: +. add ERI tests for cam5, cam6, and cam7 F compsets: replace ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s by ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri and add ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri + ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri + . add cam7 test for satellite tracks and local tod ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod +. add cam5 test for mam7 modal aerosols + replace + SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s + by + SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam From 06af2fcc427cab30c726e252019df0c6ea3b71cb Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 6 Aug 2025 13:23:47 -0400 Subject: [PATCH 270/466] add FHIST_C5 test; remove uneeded QPC5 tests --- cime_config/testdefs/testlist_cam.xml | 43 ++++--------------- .../cam/outfrq3s_ba/shell_commands | 4 -- .../testmods_dirs/cam/outfrq3s_ba/user_nl_cam | 5 --- .../testmods_dirs/cam/outfrq3s_ba/user_nl_clm | 27 ------------ .../testmods_dirs/cam/outfrq3s_ba/user_nl_cpl | 2 - .../cam/outfrq3s_ttrac/shell_commands | 6 --- .../cam/outfrq3s_ttrac/user_nl_cam | 8 ---- .../cam/outfrq3s_ttrac/user_nl_clm | 27 ------------ .../cam/outfrq3s_ttrac/user_nl_cpl | 2 - .../testmods_dirs/cam/rad_diag/shell_commands | 4 +- .../testmods_dirs/cam/rad_diag/user_nl_cam | 2 +- .../testmods_dirs/cam/rad_diag/user_nl_clm | 2 +- doc/ChangeLog | 24 +++++++++++ 13 files changed, 36 insertions(+), 120 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cpl diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index a286171f30..1933a5cdb7 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -351,10 +351,15 @@ - + + + + + + @@ -497,13 +502,13 @@ - - + + - + @@ -1049,36 +1054,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/shell_commands deleted file mode 100644 index e520bffc51..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange -append CAM_CONFIG_OPTS="-chem none" -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="19950101" diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cam deleted file mode 100644 index b8f943cd5f..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cam +++ /dev/null @@ -1,5 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -pbuf_global_allocate=.false. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/shell_commands deleted file mode 100644 index 3746e133fa..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -./xmlchange -append CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-12-31" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cam deleted file mode 100644 index 20883325af..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cam +++ /dev/null @@ -1,8 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -interpolate_output=.false.,.true. -interpolate_nlat=0,30 -interpolate_nlon=0,60 -fincl2='Q:I','T:I','U:I','V:I','Q_gll:I','T_gll:I','U_gll:I','V_gll:I' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag/shell_commands b/cime_config/testdefs/testmods_dirs/cam/rad_diag/shell_commands index bb678ba72e..ce8baae676 100644 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/rad_diag/shell_commands @@ -1,5 +1,3 @@ -./xmlchange --append CAM_CONFIG_OPTS="-chem none" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-01-01" -./xmlchange CAM_NML_USE_CASE=UNSET +./xmlchange --append CAM_CONFIG_OPTS="-chem none" diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam index 4df009c573..01d91ea552 100644 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam @@ -1,6 +1,6 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 +nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' rad_diag_1='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:sulf:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc' diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_clm index f3ac27f1e6..0d83b5367b 100644 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_clm @@ -21,7 +21,7 @@ ! Set maxpatch_glcmec with GLC_NEC option ! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable !---------------------------------------------------------------------------------- -hist_nhtfrq = 3 +hist_nhtfrq = 9 hist_mfilt = 1 hist_ndens = 1 diff --git a/doc/ChangeLog b/doc/ChangeLog index 113e8a95bf..b382161faa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -30,6 +30,9 @@ Describe any substantial timing or memory changes: Code reviewed by: List all files eliminated: + +cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/* cime_config/testdefs/testmods_dirs/cam/volc/* cime_config/testdefs/testmods_dirs/cam/volc_usecase/* . remove unused testmods @@ -80,12 +83,33 @@ cime_config/testdefs/testlist_cam.xml SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s by SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 +. remove + SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac + ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac + - test tracers and interpolated se output tested elsewhere + ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq3s_ba + - cam5 nochem tested by rad_diag testmods +. replace + ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s +. replace + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_gnu.cam-rad_diag + by + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam . move the cosp output to h1, add cosp aux output to h2 . interpolate h0 to default lat/lon grid +cime_config/testdefs/testmods_dirs/cam/rad_diag/shell_commands +. remove RUN_STARTDATE and unsetting of use case + +cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam +cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_clm +. change nhtfrq to 9 + 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 From 5223a2b02c5426bbeaa04d790bf5d88d37c5aa57 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 6 Aug 2025 16:08:24 -0600 Subject: [PATCH 271/466] Changes from John Dennis for robustness and reduce likelihood of memory leaks --- src/dynamics/mpas/dp_coupling.F90 | 6 +- src/dynamics/se/dycore/derivative_mod.F90 | 23 +++----- src/dynamics/se/dycore/dof_mod.F90 | 2 +- src/dynamics/se/dycore/edge_mod.F90 | 47 +++++++-------- src/dynamics/se/dycore/edgetype_mod.F90 | 46 +++++++-------- src/dynamics/se/dycore/fvm_mapping.F90 | 12 +++- src/dynamics/se/dycore/global_norms_mod.F90 | 3 +- src/dynamics/se/dycore/interpolate_mod.F90 | 47 +++++++++++++-- src/dynamics/se/dycore/mass_matrix_mod.F90 | 3 +- src/dynamics/se/dycore/quadrature_mod.F90 | 26 +++++++-- src/dynamics/se/dycore/spacecurve_mod.F90 | 6 +- src/utils/coords_1d.F90 | 63 +++++++++++---------- 12 files changed, 166 insertions(+), 118 deletions(-) diff --git a/src/dynamics/mpas/dp_coupling.F90 b/src/dynamics/mpas/dp_coupling.F90 index 10d75b4b8c..86436a3a9a 100644 --- a/src/dynamics/mpas/dp_coupling.F90 +++ b/src/dynamics/mpas/dp_coupling.F90 @@ -106,7 +106,7 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) integer :: lchnk, icol, icol_p, k, kk ! indices over chunks, columns, physics columns and layers integer :: i, m, ncols integer :: block_index - integer, dimension(:), pointer :: block_offset + integer, dimension(:), allocatable :: block_offset real(r8), allocatable:: pmid(:,:) !mid-level hydrostatic pressure consistent with MPAS discrete state real(r8), allocatable:: pintdry(:,:) !interface hydrostatic pressure consistent with MPAS discrete state @@ -226,6 +226,7 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) frontga_phys(icol_p, k, lchnk) = frontogenesisAngle(kk, i) end if end do + if(allocated(block_offset)) deallocate(block_offset) do k = 1, pverp kk = pverp - k + 1 @@ -295,7 +296,7 @@ subroutine p_d_coupling(phys_state, phys_tend, dyn_in) integer :: lchnk, icol, icol_p, k, kk ! indices over chunks, columns, layers integer :: i, m, ncols integer :: block_index - integer, dimension(:), pointer :: block_offset + integer, dimension(:), allocatable :: block_offset real(r8) :: factor real(r8) :: dt_phys @@ -394,6 +395,7 @@ subroutine p_d_coupling(phys_state, phys_tend, dyn_in) end do end do end do + if(allocated(block_offset)) deallocate(block_offset) call t_stopf('pd_copy') diff --git a/src/dynamics/se/dycore/derivative_mod.F90 b/src/dynamics/se/dycore/derivative_mod.F90 index 682afeae4b..8594a2bd52 100644 --- a/src/dynamics/se/dycore/derivative_mod.F90 +++ b/src/dynamics/se/dycore/derivative_mod.F90 @@ -189,8 +189,7 @@ subroutine derivinit(deriv,fvm_corners, fvm_points) ! notice we deallocate this memory here even though it was allocated ! by the call to gausslobatto. - deallocate(gp%points) - deallocate(gp%weights) + call gp%finalize() end subroutine derivinit @@ -256,11 +255,8 @@ subroutine dmatinit(dmat) end do end do - deallocate(gll%points) - deallocate(gll%weights) - - deallocate(gs%points) - deallocate(gs%weights) + call gll%finalize() + call gs%finalize() end subroutine dmatinit @@ -321,11 +317,8 @@ subroutine dpvinit(dmat) end do end do - deallocate(gll%points) - deallocate(gll%weights) - - deallocate(gs%points) - deallocate(gs%weights) + call gll%finalize() + call gs%finalize() end subroutine dpvinit @@ -400,8 +393,7 @@ subroutine v2pinit(v2p,gll,gs,n1,n2) v2p_new(l,j) = gll_pts%weights(l)*sum enddo enddo - deallocate(gll_pts%points) - deallocate(gll_pts%weights) + call gll_pts%finalize() v2p=v2p_new end subroutine v2pinit @@ -934,8 +926,7 @@ function remap_phys2gll(pin,nphys) result(pout) enddo gll_edges(np+1)=1 delta_a=gll_pts%weights - deallocate(gll_pts%points) - deallocate(gll_pts%weights) + call gll_pts%finalize() count=0 x1=-1 diff --git a/src/dynamics/se/dycore/dof_mod.F90 b/src/dynamics/se/dycore/dof_mod.F90 index 4b33c2788a..ceb45065e0 100644 --- a/src/dynamics/se/dycore/dof_mod.F90 +++ b/src/dynamics/se/dycore/dof_mod.F90 @@ -394,7 +394,7 @@ subroutine CreateMetaData(par,elem,subelement_corners, fdofp) if(present(fdofp)) then fdofp=-fdofp_local end if - + call FreeEdgeBuffer(edge) end subroutine CreateMetaData diff --git a/src/dynamics/se/dycore/edge_mod.F90 b/src/dynamics/se/dycore/edge_mod.F90 index 7fa1e146be..1741fcb937 100644 --- a/src/dynamics/se/dycore/edge_mod.F90 +++ b/src/dynamics/se/dycore/edge_mod.F90 @@ -222,7 +222,6 @@ subroutine initEdgeBuffer_r8(par,edge,elem,nlyr, bndry_type,nthreads,CardinalLen integer :: j,jj,il,mesgid, dst0,src0 integer :: moveptr integer :: nbuf2,ilm1,iem1,lenm1 - integer,allocatable :: putmap2(:,:),getmap2(:,:) integer,allocatable :: scounts(:), rcounts(:) integer,allocatable :: sdispls(:), rdispls(:) integer :: nInter, nIntra @@ -290,10 +289,6 @@ subroutine initEdgeBuffer_r8(par,edge,elem,nlyr, bndry_type,nthreads,CardinalLen edge%putmap(:,:)=-1 edge%getmap(:,:)=-1 - allocate(putmap2(max_neigh_edges,nelemd)) - allocate(getmap2(max_neigh_edges,nelemd)) - putmap2(:,:)=-1 - getmap2(:,:)=-1 do ie=1,nelemd do i=1,max_neigh_edges edge%reverse(i,ie) = elem(ie)%desc%reverse(i) @@ -617,34 +612,34 @@ subroutine FreeEdgeBuffer_r8(edge) !$OMP BARRIER !$OMP MASTER - if(allocated(edge%buf)) deallocate(edge%buf) - if(allocated(edge%receive)) deallocate(edge%receive) - if(associated(edge%putmap)) deallocate(edge%putmap) - if(associated(edge%getmap)) deallocate(edge%getmap) - if(associated(edge%reverse)) deallocate(edge%reverse) - if(associated(edge%moveLength)) deallocate(edge%moveLength) - if(associated(edge%movePtr)) deallocate(edge%movePtr) + if(allocated(edge%buf)) deallocate(edge%buf) + if(allocated(edge%receive)) deallocate(edge%receive) + if(allocated(edge%putmap)) deallocate(edge%putmap) + if(allocated(edge%getmap)) deallocate(edge%getmap) + if(allocated(edge%reverse)) deallocate(edge%reverse) + if(allocated(edge%moveLength)) deallocate(edge%moveLength) + if(allocated(edge%movePtr)) deallocate(edge%movePtr) ! All MPI communications - if(associated(edge%rcountsFull)) deallocate(edge%rcountsFull) - if(associated(edge%scountsFull)) deallocate(edge%scountsFull) - if(associated(edge%sdisplsFull)) deallocate(edge%sdisplsFull) - if(associated(edge%rdisplsFull)) deallocate(edge%rdisplsFull) + if(allocated(edge%rcountsFull)) deallocate(edge%rcountsFull) + if(allocated(edge%scountsFull)) deallocate(edge%scountsFull) + if(allocated(edge%sdisplsFull)) deallocate(edge%sdisplsFull) + if(allocated(edge%rdisplsFull)) deallocate(edge%rdisplsFull) ! Intra-node MPI Communication if(edge%nIntra>0) then - if(associated(edge%rcountsIntra)) deallocate(edge%rcountsIntra) - if(associated(edge%scountsIntra)) deallocate(edge%scountsIntra) - if(associated(edge%sdisplsIntra)) deallocate(edge%sdisplsIntra) - if(associated(edge%rdisplsIntra)) deallocate(edge%rdisplsIntra) + if(allocated(edge%rcountsIntra)) deallocate(edge%rcountsIntra) + if(allocated(edge%scountsIntra)) deallocate(edge%scountsIntra) + if(allocated(edge%sdisplsIntra)) deallocate(edge%sdisplsIntra) + if(allocated(edge%rdisplsIntra)) deallocate(edge%rdisplsIntra) endif ! Inter-node MPI Communication if(edge%nInter>0) then - if(associated(edge%rcountsInter)) deallocate(edge%rcountsInter) - if(associated(edge%scountsInter)) deallocate(edge%scountsInter) - if(associated(edge%sdisplsInter)) deallocate(edge%sdisplsInter) - if(associated(edge%rdisplsInter)) deallocate(edge%rdisplsInter) + if(allocated(edge%rcountsInter)) deallocate(edge%rcountsInter) + if(allocated(edge%scountsInter)) deallocate(edge%scountsInter) + if(allocated(edge%sdisplsInter)) deallocate(edge%sdisplsInter) + if(allocated(edge%rdisplsInter)) deallocate(edge%rdisplsInter) endif if(allocated(edge%rRequest)) deallocate(edge%rRequest) if(allocated(edge%sRequest)) deallocate(edge%sRequest) @@ -666,8 +661,8 @@ subroutine FreeEdgeBuffer_i8(edge) edge%nbuf=0 edge%nlyr=0 - deallocate(edge%buf) - deallocate(edge%receive) + if(allocated(edge%buf)) deallocate(edge%buf) + if(allocated(edge%receive)) deallocate(edge%receive) end subroutine FreeEdgeBuffer_i8 diff --git a/src/dynamics/se/dycore/edgetype_mod.F90 b/src/dynamics/se/dycore/edgetype_mod.F90 index 4cfe12020f..eb38cf6463 100644 --- a/src/dynamics/se/dycore/edgetype_mod.F90 +++ b/src/dynamics/se/dycore/edgetype_mod.F90 @@ -38,25 +38,25 @@ module edgetype_mod type, public :: EdgeBuffer_t real (kind=r8), allocatable :: buf(:) real (kind=r8), allocatable :: receive(:) - integer, pointer :: putmap(:,:) => null() - integer, pointer :: getmap(:,:) => null() - logical, pointer :: reverse(:,:) => null() - integer, pointer :: moveLength(:) => null() - integer, pointer :: movePtr(:) => null() - integer, pointer :: rcountsFull(:) => null() - integer, pointer :: scountsFull(:) => null() - integer, pointer :: sdisplsFull(:) => null() - integer, pointer :: rdisplsFull(:) => null() - integer, pointer :: rcountsInter(:) => null() - integer, pointer :: scountsInter(:) => null() - integer, pointer :: sdisplsInter(:) => null() - integer, pointer :: rdisplsInter(:) => null() - integer, pointer :: rcountsIntra(:) => null() - integer, pointer :: scountsIntra(:) => null() - integer, pointer :: sdisplsIntra(:) => null() - integer, pointer :: rdisplsIntra(:) => null() - integer, pointer :: getDisplsFull(:) => null() - integer, pointer :: putDisplsFull(:) => null() + integer, allocatable :: putmap(:,:) + integer, allocatable :: getmap(:,:) + logical, allocatable :: reverse(:,:) + integer, allocatable :: moveLength(:) + integer, allocatable :: movePtr(:) + integer, allocatable :: rcountsFull(:) + integer, allocatable :: scountsFull(:) + integer, allocatable :: sdisplsFull(:) + integer, allocatable :: rdisplsFull(:) + integer, allocatable :: rcountsInter(:) + integer, allocatable :: scountsInter(:) + integer, allocatable :: sdisplsInter(:) + integer, allocatable :: rdisplsInter(:) + integer, allocatable :: rcountsIntra(:) + integer, allocatable :: scountsIntra(:) + integer, allocatable :: sdisplsIntra(:) + integer, allocatable :: rdisplsIntra(:) + integer, allocatable :: getDisplsFull(:) + integer, allocatable :: putDisplsFull(:) integer, allocatable :: Rrequest(:),Srequest(:) integer, allocatable :: status(:,:) type (gbarrier_t) :: gbarrier @@ -76,13 +76,13 @@ module edgetype_mod type, public :: LongEdgeBuffer_t integer :: nlyr integer :: nbuf - integer, pointer :: buf(:,:) => null() - integer, pointer :: receive(:,:) => null() + integer, allocatable :: buf(:,:) + integer, allocatable :: receive(:,:) end type LongEdgeBuffer_t type, public :: GhostBuffer3D_t - real (kind=r8), dimension(:,:,:,:), pointer :: buf => null() - real (kind=r8), dimension(:,:,:,:), pointer :: receive => null() + real (kind=r8), dimension(:,:,:,:), allocatable :: buf + real (kind=r8), dimension(:,:,:,:), allocatable :: receive integer :: nlyr ! Number of layers integer :: nhc ! Number of layers of ghost cells integer :: np ! Number of points in a cell diff --git a/src/dynamics/se/dycore/fvm_mapping.F90 b/src/dynamics/se/dycore/fvm_mapping.F90 index 0f090ebe9e..8dbfdbdcf2 100644 --- a/src/dynamics/se/dycore/fvm_mapping.F90 +++ b/src/dynamics/se/dycore/fvm_mapping.F90 @@ -616,6 +616,13 @@ function dyn2phys_vector(v_gll,elem) result(v_phys) v_phys(i,2,k)=D(2,1,i)*v1 + D(2,2,i)*v2 end do end do + + ! Cleanup interp_p + call interp_p%finalize() + + ! Cleanup interpdata + call interpdata%finalize() + end function dyn2phys_vector subroutine setup_interpdata_for_gll_to_phys_vec_mapping(interpdata,interp_p) @@ -660,8 +667,11 @@ subroutine setup_interpdata_for_gll_to_phys_vec_mapping(interpdata,interp_p) ioff=ioff+1 enddo enddo - end subroutine setup_interpdata_for_gll_to_phys_vec_mapping + ! Cleanup gp_quadrature + call gp_quadrature%finalize() + + end subroutine setup_interpdata_for_gll_to_phys_vec_mapping function lagrange_1d(src_grid,src_val,ngrid,dst_point,iwidth) result(val) integer , intent(in) :: ngrid,iwidth diff --git a/src/dynamics/se/dycore/global_norms_mod.F90 b/src/dynamics/se/dycore/global_norms_mod.F90 index e4701c9d37..9699bfaa2f 100644 --- a/src/dynamics/se/dycore/global_norms_mod.F90 +++ b/src/dynamics/se/dycore/global_norms_mod.F90 @@ -573,8 +573,7 @@ subroutine print_cfl(elem,hybrid,nets,nete,dtnu,ptop,pmid,& enddo !rowind enddo !colind endif - deallocate(gp%points) - deallocate(gp%weights) + call gp%finalize() call automatically_set_viscosity_coefficients(hybrid,ne,max_min_dx,min_min_dx,nu_p ,1.0_r8 ,'_p ') call automatically_set_viscosity_coefficients(hybrid,ne,max_min_dx,min_min_dx,nu ,1.0_r8,' ') diff --git a/src/dynamics/se/dycore/interpolate_mod.F90 b/src/dynamics/se/dycore/interpolate_mod.F90 index 55093dad73..726513cace 100644 --- a/src/dynamics/se/dycore/interpolate_mod.F90 +++ b/src/dynamics/se/dycore/interpolate_mod.F90 @@ -24,10 +24,13 @@ module interpolate_mod logical :: debug=.false. type, public :: interpolate_t - real (kind=r8), dimension(:,:), pointer :: Imat ! P_k(xj)*wj/gamma(k) - real (kind=r8), dimension(:) , pointer :: rk ! 1/k - real (kind=r8), dimension(:) , pointer :: vtemp ! temp results - real (kind=r8), dimension(:) , pointer :: glp ! GLL pts (nair) + real (kind=r8), dimension(:,:), allocatable :: Imat ! P_k(xj)*wj/gamma(k) + real (kind=r8), dimension(:) , allocatable :: rk ! 1/k + real (kind=r8), dimension(:) , allocatable :: vtemp ! temp results + real (kind=r8), dimension(:) , allocatable :: glp ! GLL pts (nair) + contains + procedure :: finalize => finalize_interpolate_t + final :: finalize_interpolate_t_core end type interpolate_t type, public :: interpdata_t @@ -40,8 +43,12 @@ module interpolate_mod integer :: nlat integer :: nlon logical :: first_entry = .TRUE. + contains + procedure :: finalize => finalize_interpdata_t + final :: finalize_interpdata_t_core end type interpdata_t + real (kind=r8), private :: delta = 1.0e-9_r8 ! move tiny bit off center to ! avoid landing on element edges @@ -76,6 +83,7 @@ module interpolate_mod public :: vec_latlon_to_contra + interface interpolate_scalar module procedure interpolate_scalar2d module procedure interpolate_scalar3d @@ -114,6 +122,34 @@ module interpolate_mod !JMD public :: bilin_phys2gll_init contains + ! + ! Destructors for interpdata_t + ! + subroutine finalize_interpdata_t(this) + class(interpdata_t), intent(inout) :: this + call finalize_interpdata_t_core(this) + end subroutine finalize_interpdata_t + subroutine finalize_interpdata_t_core(this) + type (interpdata_t) :: this + if(associated(this%interp_xy)) deallocate(this%interp_xy) + if(associated(this%ilat)) deallocate(this%ilat) + if(associated(this%ilon)) deallocate(this%ilon) + end subroutine finalize_interpdata_t_core + + ! + ! Destructors for interpolate_t + ! + subroutine finalize_interpolate_t(this) + class(interpolate_t), intent(inout) :: this + call finalize_interpolate_t_core(this) + end subroutine finalize_interpolate_t + subroutine finalize_interpolate_t_core(this) + type (interpolate_t) :: this + if(allocated(this%Imat)) deallocate(this%Imat) + if(allocated(this%rk)) deallocate(this%rk) + if(allocated(this%vtemp)) deallocate(this%vtemp) + if(allocated(this%glp)) deallocate(this%glp) + end subroutine finalize_interpolate_t_core subroutine set_interp_parameter(parm_name, value) character*(*), intent(in) :: parm_name @@ -266,8 +302,7 @@ subroutine interpolate_tracers_init() interp_gll(:) = gll%points(:) interp_tracers_init = .true. - deallocate(gll%points) - deallocate(gll%weights) + call gll%finalize() end subroutine interpolate_tracers_init diff --git a/src/dynamics/se/dycore/mass_matrix_mod.F90 b/src/dynamics/se/dycore/mass_matrix_mod.F90 index a59f1cc15d..b9478d8b8f 100644 --- a/src/dynamics/se/dycore/mass_matrix_mod.F90 +++ b/src/dynamics/se/dycore/mass_matrix_mod.F90 @@ -84,8 +84,7 @@ subroutine mass_matrix(par,elem) end do !$OMP BARRIER - deallocate(gp%points) - deallocate(gp%weights) + call gp%finalize() ! ============================================= ! compute spherical element mass matrix diff --git a/src/dynamics/se/dycore/quadrature_mod.F90 b/src/dynamics/se/dycore/quadrature_mod.F90 index ca6ba83578..9580d5d975 100644 --- a/src/dynamics/se/dycore/quadrature_mod.F90 +++ b/src/dynamics/se/dycore/quadrature_mod.F90 @@ -6,8 +6,11 @@ module quadrature_mod private type, public :: quadrature_t - real (kind=r8), dimension(:), pointer :: points - real (kind=r8), dimension(:), pointer :: weights + real (kind=r8), dimension(:), allocatable :: points + real (kind=r8), dimension(:), allocatable :: weights + contains + procedure :: finalize + final :: finalize_quadrature_t end type quadrature_t public :: gausslobatto @@ -32,6 +35,19 @@ module quadrature_mod contains + subroutine finalize(this) + class(quadrature_t), intent(inout) :: this + call finalize_quadrature_t(this) + end subroutine finalize + +! Deallocate and reset to initial state. +subroutine finalize_quadrature_t(this) + type(quadrature_t) :: this + + if(allocated(this%points)) deallocate(this%points) + if(allocated(this%weights)) deallocate(this%weights) + +end subroutine finalize_quadrature_t ! ============================================================== ! gauss: @@ -258,8 +274,7 @@ subroutine test_gauss(npts) print *,"sum of Gaussian weights=",gssum print *,"============================================" - deallocate(gs%points) - deallocate(gs%weights) + call gs%finalize() end subroutine test_gauss @@ -487,8 +502,7 @@ subroutine test_gausslobatto(npts) print *,"sum of Gauss-Lobatto weights=",gllsum print *,"============================================" - deallocate(gll%points) - deallocate(gll%weights) + call gll.finalize() end subroutine test_gausslobatto diff --git a/src/dynamics/se/dycore/spacecurve_mod.F90 b/src/dynamics/se/dycore/spacecurve_mod.F90 index c7631121c8..1c5336b239 100644 --- a/src/dynamics/se/dycore/spacecurve_mod.F90 +++ b/src/dynamics/se/dycore/spacecurve_mod.F90 @@ -5,8 +5,8 @@ module spacecurve_mod private type, public :: factor_t - integer :: numfact - integer, dimension(:),pointer :: factors => NULL() + integer :: numfact + integer, dimension(:),allocatable :: factors end type factor_t @@ -978,7 +978,7 @@ function IsFactorable(n) logical :: IsFactorable - if (associated(fact%factors)) then + if (allocated(fact%factors)) then call endrun("fact already allocated!!!") end if fact = Factor(n) diff --git a/src/utils/coords_1d.F90 b/src/utils/coords_1d.F90 index c854cecabb..3b6084fc6c 100644 --- a/src/utils/coords_1d.F90 +++ b/src/utils/coords_1d.F90 @@ -35,7 +35,8 @@ module coords_1d real(r8), allocatable :: rdst(:,:) contains procedure :: section - procedure :: finalize + procedure :: finalize ! User-callable + final :: finalize_Coords1D ! Auto-finalize end type Coords1D interface Coords1D @@ -97,12 +98,19 @@ function section(self, n_bnds, d_bnds) section = allocate_coords(n_bnds(2)-n_bnds(1)+1, d_bnds(2)-d_bnds(1)+1) - section%ifc = self%ifc(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)+1) - section%mid = self%mid(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) - section%del = self%del(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) - section%dst = self%dst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) - section%rdel = self%rdel(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) - section%rdst = self%rdst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) + ! The following code is intrepreted by nvhpc 24.9 as an allocation on assign + ! section%ifc = self%ifc(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)+1) + ! section%mid = self%mid(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + ! section%del = self%del(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + ! section%dst = self%dst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) + ! section%rdel = self%rdel(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + ! section%rdst = self%rdst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) + section%ifc(:,:) = self%ifc(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)+1) + section%mid(:,:) = self%mid(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + section%del(:,:) = self%del(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + section%dst(:,:) = self%dst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) + section%rdel(:,:) = self%rdel(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)) + section%rdst(:,:) = self%rdst(n_bnds(1):n_bnds(2),d_bnds(1):d_bnds(2)-1) end function section @@ -123,29 +131,24 @@ function allocate_coords(n, d) result(coords) end function allocate_coords -! Deallocate and reset to initial state. -subroutine finalize(self) - class(Coords1D), intent(inout) :: self - - self%n = 0 - self%d = 0 - - call guarded_deallocate(self%ifc) - call guarded_deallocate(self%mid) - call guarded_deallocate(self%del) - call guarded_deallocate(self%dst) - call guarded_deallocate(self%rdel) - call guarded_deallocate(self%rdst) - -contains - - subroutine guarded_deallocate(array) - real(r8), allocatable :: array(:,:) - - if (allocated(array)) deallocate(array) - - end subroutine guarded_deallocate - +subroutine finalize(this) + class(Coords1D), intent(inout) :: this + call finalize_Coords1D(this) end subroutine finalize +! Deallocate and reset to initial state. +subroutine finalize_Coords1D(this) + type(Coords1D) :: this + + this%n = 0 + this%d = 0 + if(allocated(this%ifc)) deallocate(this%ifc) + if(allocated(this%mid)) deallocate(this%mid) + if(allocated(this%del)) deallocate(this%del) + if(allocated(this%dst)) deallocate(this%dst) + if(allocated(this%rdel)) deallocate(this%rdel) + if(allocated(this%rdst)) deallocate(this%rdst) + +end subroutine finalize_Coords1D + end module coords_1d From 41dc184710710cef61675f3fe0315e4948ebf1a5 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 6 Aug 2025 16:48:01 -0600 Subject: [PATCH 272/466] Update atmos_phys external --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1f40371437..10e4989301 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_14_001 + url = https://github.com/cacraigucar/atmospheric_physics + fxtag = 3e9e026 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From a47aa3b19a415761cb44fcca39757722e3fc9ba8 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 7 Aug 2025 13:20:20 -0400 Subject: [PATCH 273/466] add testmods carma_cosp_subcol_rad --- .../cam/carma_cosp_subcol_rad/shell_commands | 4 ++ .../cam/carma_cosp_subcol_rad/user_nl_cam | 54 +++++++++++++++++++ .../cam/carma_cosp_subcol_rad/user_nl_clm | 27 ++++++++++ .../testmods_dirs/cam/rad_diag/user_nl_cam | 34 ++++++++---- 4 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands new file mode 100644 index 0000000000..81b2c5c227 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands @@ -0,0 +1,4 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange --append CAM_CONFIG_OPTS="-cosp -carma sea_salt -psubcols 3" + diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam new file mode 100644 index 0000000000..262acaa778 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam @@ -0,0 +1,54 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9 +inithist='ENDOFRUN' + +history_carma=.true. +carma_do_fixedinit=.false. + +fexcl1='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP','CS_PIA', + 'CS_RAINPOSS','CS_RAINPROB','CS_RAINCERT','CS_RAINHARD','CS_SNOWCERT','CS_SNOWPOSS' + +microp_uniform=.false. +use_subcol_microp=.true. +subcol_scheme='tstcp' +subcol_tstcp_noAvg=.true. + +mode_defs= +'mam3_mode1:accum:=', 'A:num_a1:N:num_c1:num_mr:+', + 'A:so4_a1:N:so4_c1:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc:+', + 'A:pom_a1:N:pom_c1:p-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c101112.nc:+', + 'A:soa_a1:N:soa_c1:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', + 'A:bc_a1:N:bc_c1:black-c:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c100508.nc:+', + 'A:dst_a1:N:dst_c1:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', + 'A:ncl_a1:N:ncl_c1:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', +'mam3_mode2:aitken:=', 'A:num_a2:N:num_c2:num_mr:+', + 'A:so4_a2:N:so4_c2:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc:+', + 'A:soa_a2:N:soa_c2:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', + 'A:ncl_a2:N:ncl_c2:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', +'mam3_mode3:coarse:=', 'A:num_a3:N:num_c3:num_mr:+', + 'A:dst_a3:N:dst_c3:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', + 'A:ncl_a3:N:ncl_c3:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc:+', + 'A:so4_a3:N:so4_c3:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc', +'mam3_m1_noso4:accum:=', 'A:num_a1:N:num_c1:num_mr:+', + 'A:pom_a1:N:pom_c1:p-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c101112.nc:+', + 'A:soa_a1:N:soa_c1:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', + 'A:bc_a1:N:bc_c1:black-c:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c100508.nc:+', + 'A:dst_a1:N:dst_c1:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', + 'A:ncl_a1:N:ncl_c1:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', +'mam3_m2_noso4:aitken:=', 'A:num_a2:N:num_c2:num_mr:+', + 'A:soa_a2:N:soa_c2:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', + 'A:ncl_a2:N:ncl_c2:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', +'mam3_m3_noso4:coarse:=', 'A:num_a3:N:num_c3:num_mr:+', + 'A:dst_a3:N:dst_c3:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', + 'A:ncl_a3:N:ncl_c3:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc' +rad_climate= + 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'N:ozone:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam3_mode1:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam3_mode2:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', + 'M:mam3_mode3:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc' +rad_diag_1= + 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'N:ozone:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', + 'M:mam3_m1_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', + 'M:mam3_m2_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', + 'M:mam3_m3_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc' diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm new file mode 100644 index 0000000000..0d83b5367b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm @@ -0,0 +1,27 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam index 01d91ea552..27959dccfd 100644 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/rad_diag/user_nl_cam @@ -2,23 +2,37 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' -rad_diag_1='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:sulf:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc' -rad_diag_2='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:dust1:$DIN_LOC_ROOT/atm/cam/physprops/dust1_rrtmg_c080918.nc' +rad_diag_1='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4','N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:sulf:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc' -rad_diag_3='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:dust2:$DIN_LOC_ROOT/atm/cam/physprops/dust2_rrtmg_c080918.nc' +rad_diag_2='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:dust1:$DIN_LOC_ROOT/atm/cam/physprops/dust1_rrtmg_c080918.nc' -rad_diag_4='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:dust3:$DIN_LOC_ROOT/atm/cam/physprops/dust3_rrtmg_c080918.nc' +rad_diag_3='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:dust2:$DIN_LOC_ROOT/atm/cam/physprops/dust2_rrtmg_c080918.nc' -rad_diag_5='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:dust4:$DIN_LOC_ROOT/atm/cam/physprops/dust4_rrtmg_c080918.nc' +rad_diag_4='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:dust3:$DIN_LOC_ROOT/atm/cam/physprops/dust3_rrtmg_c080918.nc' -rad_diag_6='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:bcar1:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c080918.nc' +rad_diag_5='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:dust4:$DIN_LOC_ROOT/atm/cam/physprops/dust4_rrtmg_c080918.nc' -rad_diag_7='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:bcar2:$DIN_LOC_ROOT/atm/cam/physprops/bcphi_rrtmg_c080918.nc' +rad_diag_6='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:bcar1:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c080918.nc' -rad_diag_8='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:ocar1:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c080918.nc' +rad_diag_7='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:bcar2:$DIN_LOC_ROOT/atm/cam/physprops/bcphi_rrtmg_c080918.nc' -rad_diag_9='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:ocar2:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c080918.nc' +rad_diag_8='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:ocar1:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c080918.nc' -rad_diag_10='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11','N:CFC12:CFC12', 'N:sslt1:$DIN_LOC_ROOT/atm/cam/physprops/seasalt1_rrtmg_c080918.nc', 'N:sslt2:$DIN_LOC_ROOT/atm/cam/physprops/seasalt2_rrtmg_c080918.nc', 'N:sslt3:$DIN_LOC_ROOT/atm/cam/physprops/seasalt3_rrtmg_c080918.nc', 'N:sslt4:$DIN_LOC_ROOT/atm/cam/physprops/seasalt4_rrtmg_c080918.nc' +rad_diag_9='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:ocar2:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c080918.nc' + +rad_diag_10='A:Q:H2O','N:O2:O2','N:CO2:CO2','N:ozone:O3','N:N2O:N2O','N:CH4:CH4', 'N:CFC11:CFC11', +'N:CFC12:CFC12', 'N:sslt1:$DIN_LOC_ROOT/atm/cam/physprops/seasalt1_rrtmg_c080918.nc', +'N:sslt2:$DIN_LOC_ROOT/atm/cam/physprops/seasalt2_rrtmg_c080918.nc', +'N:sslt3:$DIN_LOC_ROOT/atm/cam/physprops/seasalt3_rrtmg_c080918.nc', +'N:sslt4:$DIN_LOC_ROOT/atm/cam/physprops/seasalt4_rrtmg_c080918.nc' From 76d72b45b6d94e80e1208b7ebf149c7c957f671b Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 7 Aug 2025 13:35:10 -0600 Subject: [PATCH 274/466] Add CAM-SIMA submodule. --- .gitmodules | 3 +++ src/utils/cam-sima | 1 + 2 files changed, 4 insertions(+) create mode 160000 src/utils/cam-sima diff --git a/.gitmodules b/.gitmodules index d483e6899f..f8ef554b1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -211,3 +211,6 @@ fxtag = v0.2.1 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git +[submodule "src/utils/cam-sima"] + path = src/utils/cam-sima + url = https://github.com/ESCOMP/CAM-SIMA.git diff --git a/src/utils/cam-sima b/src/utils/cam-sima new file mode 160000 index 0000000000..2de9631d37 --- /dev/null +++ b/src/utils/cam-sima @@ -0,0 +1 @@ +Subproject commit 2de9631d376ed5bcacee8bc70051cbf2d8c80eb5 From 3899b8a6eebb074de544966c1784d4f9578a916a Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 7 Aug 2025 13:41:38 -0600 Subject: [PATCH 275/466] Try sparse checkout of CAM-SIMA submodule. --- .gitmodules | 12 ++++++++---- src/utils/.sima_phys_utils_sparse_checkout | 2 ++ src/utils/cam-sima | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 src/utils/.sima_phys_utils_sparse_checkout diff --git a/.gitmodules b/.gitmodules index f8ef554b1f..ee9f1b805d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -40,6 +40,14 @@ fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics +[submodule "cam-sima"] + path = src/utils/cam-sima + url = https://github.com/ESCOMP/CAM-SIMA.git + fxrequired = AlwaysRequired + fxsparse = ../.sima_phys_utils_sparse_checkout + fxtag = sima0_07_000 + fxDONOTUSEurl = https://github.com/ESCOMP/CAM-SIMA.git + [submodule "fv3"] path = src/dynamics/fv3 url = https://github.com/ESCOMP/CAM_FV3_interface.git @@ -210,7 +218,3 @@ url = https://github.com/NCAR/CUPiD.git fxtag = v0.2.1 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git - -[submodule "src/utils/cam-sima"] - path = src/utils/cam-sima - url = https://github.com/ESCOMP/CAM-SIMA.git diff --git a/src/utils/.sima_phys_utils_sparse_checkout b/src/utils/.sima_phys_utils_sparse_checkout new file mode 100644 index 0000000000..25c9d9e9d6 --- /dev/null +++ b/src/utils/.sima_phys_utils_sparse_checkout @@ -0,0 +1,2 @@ +src/physics/utils/pio_reader.F90 +src/physics/utils/pio_reader_sub.F90 diff --git a/src/utils/cam-sima b/src/utils/cam-sima index 2de9631d37..0aaee1d390 160000 --- a/src/utils/cam-sima +++ b/src/utils/cam-sima @@ -1 +1 @@ -Subproject commit 2de9631d376ed5bcacee8bc70051cbf2d8c80eb5 +Subproject commit 0aaee1d39067501c0ade7d176c7551ddda0f56d6 From 0656262f12c62b5095f086d153a0862364a10d20 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 7 Aug 2025 14:05:13 -0600 Subject: [PATCH 276/466] Use CAM-SIMA version instead of copy. --- bld/configure | 3 + src/utils/cam_ccpp/pio_reader.F90 | 2155 ------------------------- src/utils/cam_ccpp/pio_reader_sub.F90 | 8 - 3 files changed, 3 insertions(+), 2163 deletions(-) delete mode 100644 src/utils/cam_ccpp/pio_reader.F90 delete mode 100644 src/utils/cam_ccpp/pio_reader_sub.F90 diff --git a/bld/configure b/bld/configure index 220a80c53c..2b18344f2e 100755 --- a/bld/configure +++ b/bld/configure @@ -2206,6 +2206,9 @@ sub write_filepath print $fh "$camsrcdir/src/utils\n"; print $fh "$camsrcdir/src/utils/cam_ccpp\n"; + # Routines from CAM-SIMA + print $fh "$camsrcdir/src/utils/cam-sima/src/physics/utils\n"; + $fh->close; } diff --git a/src/utils/cam_ccpp/pio_reader.F90 b/src/utils/cam_ccpp/pio_reader.F90 deleted file mode 100644 index 3868e8c3a2..0000000000 --- a/src/utils/cam_ccpp/pio_reader.F90 +++ /dev/null @@ -1,2155 +0,0 @@ -module pio_reader - use pio, only: file_desc_t - use ccpp_io_reader, only: abstract_netcdf_reader_t - use shr_kind_mod, only: cl=>shr_kind_cl - - implicit none - private - - public :: pio_reader_t - - !Error code parameters - integer, parameter :: pio_inq_dim_id_err = 1 - integer, parameter :: pio_inq_dim_len_err = 2 - integer, parameter :: pio_inq_var_id_err = 3 - integer, parameter :: pio_inq_var_info_err = 4 - integer, parameter :: bad_var_rank_err = 5 - integer, parameter :: too_high_rank_err = 6 - integer, parameter :: pio_get_var_err = 7 - integer, parameter :: not_char_type_err = 8 - integer, parameter :: file_not_open_err = 9 - integer, parameter :: pio_get_msg_err = 10 - - type :: file_handle_t - logical :: is_file_open = .false. !Is NetCDF file currently open? - type(file_desc_t) :: pio_fh !PIO File handle type - character(len=cl) :: file_path = 'UNSET' !Local path to NetCDF file - end type - - type, extends(abstract_netcdf_reader_t) :: pio_reader_t - private - type(file_handle_t) :: sima_pio_fh !PIO File handle type - contains - !File procedures - procedure :: open_file => open_netcdf_file - procedure :: close_file => close_netcdf_file - - !Integer interfaces - procedure :: get_var_int_0d => get_netcdf_var_int_0d - procedure :: get_var_int_1d => get_netcdf_var_int_1d - procedure :: get_var_int_2d => get_netcdf_var_int_2d - procedure :: get_var_int_3d => get_netcdf_var_int_3d - procedure :: get_var_int_4d => get_netcdf_var_int_4d - procedure :: get_var_int_5d => get_netcdf_var_int_5d - - !Real interfaces - procedure :: get_var_real_0d => get_netcdf_var_real_0d - procedure :: get_var_real_1d => get_netcdf_var_real_1d - procedure :: get_var_real_2d => get_netcdf_var_real_2d - procedure :: get_var_real_3d => get_netcdf_var_real_3d - procedure :: get_var_real_4d => get_netcdf_var_real_4d - procedure :: get_var_real_5d => get_netcdf_var_real_5d - - !Character interfaces - procedure :: get_var_char_0d => get_netcdf_var_char_0d - procedure :: get_var_char_1d => get_netcdf_var_char_1d - procedure :: get_var_char_2d => get_netcdf_var_char_2d - procedure :: get_var_char_3d => get_netcdf_var_char_3d - procedure :: get_var_char_4d => get_netcdf_var_char_4d - procedure :: get_var_char_5d => get_netcdf_var_char_5d - end type pio_reader_t - -contains - - subroutine open_netcdf_file(this, file_path, errmsg, errcode) - use cam_pio_utils, only: cam_pio_openfile - use pio, only: PIO_NOWRITE - use pio, only: PIO_NOERR - - class(pio_reader_t), intent(inout) :: this - character(len=*), intent(in) :: file_path - integer, intent(out) :: errcode - character(len=*), intent(out) :: errmsg - - if(this%sima_pio_fh%is_file_open) then - errcode = 1 - errmsg = "Trying to reuse pio_reader already used for: '"//trim(this%sima_pio_fh%file_path)//"'" - return - end if - - !Open provided file with PIO: - call cam_pio_openfile(this%sima_pio_fh%pio_fh, file_path, PIO_NOWRITE, & - errcode=errcode) - - if(errcode /= PIO_NOERR) then - !Extract error message from PIO and return: - call get_pio_errmsg(1, file_path, errcode, errmsg, & - file_msg=.true.) - return - end if - - !Set file handle metadata - this%sima_pio_fh%file_path = file_path - this%sima_pio_fh%is_file_open = .true. - - !File was successfully opened - errcode = 0 - errmsg = '' - end subroutine open_netcdf_file - - subroutine close_netcdf_file(this, errmsg, errcode) - use cam_pio_utils, only: cam_pio_closefile - - class(pio_reader_t), intent(inout) :: this - integer, intent(out) :: errcode - character(len=*), intent(out) :: errmsg - - if(.not.this%sima_pio_fh%is_file_open) then - !File is already closed, so just exit - !quietly. - errcode = 0 - errmsg = '' - return - end if - - !Close NetCDF File: - call cam_pio_closefile(this%sima_pio_fh%pio_fh) - - !Indicate that file handle array id is no longer in use, - !but keep file path the same in case it is needed for - !related error messages in other routines: - this%sima_pio_fh%is_file_open = .false. - - !File was successfully closed - errcode = 0 - errmsg = '' - end subroutine close_netcdf_file - - ! ------------------------------------------------------------------ - ! Integer interfaces - ! ------------------------------------------------------------------ - - subroutine get_netcdf_var_int_0d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 0) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var, stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_0d - - subroutine get_netcdf_var_int_1d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var(:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:) = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var(:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_1d - - subroutine get_netcdf_var_int_2d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var(:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:) = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_2d - - subroutine get_netcdf_var_int_3d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var(:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:) = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_3d - - subroutine get_netcdf_var_int_4d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var(:,:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_ids(:) !Variable dimension IDs - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:) = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_4d - - subroutine get_netcdf_var_int_5d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - integer, allocatable, intent(out) :: var(:,:,:,:,:) !Integer variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & - stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:,:) = huge(1) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_int_5d - - ! ------------------------------------------------------------------ - ! Real interfaces - ! ------------------------------------------------------------------ - - subroutine get_netcdf_var_real_0d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: ndims !Number of variable dimensions on NetCDF file - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= 0) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var, stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_0d - - subroutine get_netcdf_var_real_1d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var(:) !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_1d - - subroutine get_netcdf_var_real_2d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var(:,:) !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_2d - - subroutine get_netcdf_var_real_3d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var(:,:,:) !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize the variable, - !and read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_3d - - subroutine get_netcdf_var_real_4d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var(:,:,:,:) !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_4d - - subroutine get_netcdf_var_real_5d(this, varname, var, errmsg, errcode, start, count) - use ccpp_kinds, only: kind_phys - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - real(kind_phys), allocatable, intent(out) :: var(:,:,:,:,:) !Real variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize the variable, - !and read-in the NetCDF data: - allocate(var(dim_sizes(1), dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & - stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:,:) = huge(1._kind_phys) - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_real_5d - - ! ------------------------------------------------------------------ - ! Character interfaces - ! ------------------------------------------------------------------ - - subroutine get_netcdf_var_char_0d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 1 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var, stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_0d - - subroutine get_netcdf_var_char_1d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var(:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 2 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var(dim_sizes(2)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:) = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var(:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_1d - - subroutine get_netcdf_var_char_2d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var(:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 3 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:) = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var(:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_2d - - subroutine get_netcdf_var_char_3d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var(:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 4 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4)), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:) = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_3d - - subroutine get_netcdf_var_char_4d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var(:,:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 5 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5)), & - stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:) = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_4d - - subroutine get_netcdf_var_char_5d(this, varname, var, errmsg, errcode, start, count) - use pio, only: pio_inq_varid - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: pio_seterrorhandling - use pio, only: pio_get_var - use pio, only: PIO_NOERR - use pio, only: PIO_BCAST_ERROR - use pio_types, only: PIO_CHAR - - class(pio_reader_t), intent(in) :: this - character(len=*), intent(in) :: varname - character(len=:), allocatable, intent(out) :: var(:,:,:,:,:) !Character variable that file data will be read to. - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Optional arguments for reading a subset of the variable - integer, optional, intent(in) :: start(:) !Start indices for each dimension - integer, optional, intent(in) :: count(:) !Number of elements to read for each dimension - - !Local variables: - type(file_desc_t) :: pio_file_handle !File handle type used by PIO - character(len=cl) :: file_path !Path to NetCDF file - integer :: err_handling !PIO error handling code - integer :: var_id !NetCDF variable ID - integer :: nc_type !NetCDF variable type - integer, allocatable :: dim_sizes(:) !Variable dimension sizes - - !NOTE: NetCDF supports both character arrays and string-type - !data depending on the NetCDF version, so the dimensions - !might be one larger than the actual array size if it - !includes the character length as a dimension as well. - !Ideally the actual type would be checked and handled - !differently, but for now just confirm it's a character - !array and check for ndims = rank+1 - integer, parameter :: var_ndims = 6 !Number of expected dimensions for variable in NetCDF file - !---------------------- - - !Check if file is open: - if(.not.this%sima_pio_fh%is_file_open) then - !File isn't actually open, so throw an error - errcode = file_not_open_err - errmsg = "File '"//trim(this%sima_pio_fh%file_path)//"' is not open, need to call 'open_file' first." - return - end if - - !Extract open file information: - pio_file_handle = this%sima_pio_fh%pio_fh - file_path = this%sima_pio_fh%file_path - - !Force PIO to send an error code instead of dying: - call pio_seterrorhandling(pio_file_handle, PIO_BCAST_ERROR, oldmethod=err_handling) - - !Look for variable on file: - errcode = pio_inq_varid(pio_file_handle, varname, var_id) - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_id_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable type on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, xtype=nc_type) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Check that variable is a character array - !(as we cannot currently handle string-type variables): - if(nc_type /= PIO_CHAR) then - errcode = not_char_type_err - errmsg = "NetCDF Variable '"//trim(varname)//"' is not a character array. File can be found here: "//file_path - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Get variable dimension sizes: - call get_dim_sizes(varname, var_ndims, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - if (errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Now attempt to allocate and initialize variable, and - !read-in the NetCDF data. Note that the first dimenstion - !is the length of the character array, so need to start - !the dim_sizes allocation count at index two: - allocate(character(dim_sizes(1)) :: var(dim_sizes(2), dim_sizes(3), dim_sizes(4), dim_sizes(5), dim_sizes(6)), & - stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - var(:,:,:,:,:) = 'UNSET' - errcode = pio_get_var(pio_file_handle, var_id, var(:,:,:,:,:)) - - if (errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_get_var_err, varname, errcode, errmsg) - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - return - end if - - !Reset PIO back to original error handling method: - call pio_seterrorhandling(pio_file_handle, err_handling) - - !Variable was successfully read, so properly set the error - !code and message: - errcode = 0 - errmsg = '' - end subroutine get_netcdf_var_char_5d - - ! ------------------------------------------------------------------ - ! Helper routines (not externally accessible) - ! ------------------------------------------------------------------ - - subroutine get_pio_errmsg(caller_errcode, varname, errcode, errmsg, file_msg) - !Set error message based off PIO error code, - !and then reset PIO error code to caller-specified - !error code. - - !Note that if an internal error occurs when - !attempting to grab the error message both - !the error code and error message will be - !updated. - - use pio, only: pio_strerror - use pio, only: PIO_NOERR - - !Input/output arguments: - integer, intent(in) :: caller_errcode !New error code caller wants. - character(len=*), intent(in) :: varname - integer, intent(inout) :: errcode !Error code - character(len=*), intent(inout) :: errmsg !Error message - logical, optional, intent(in) :: file_msg !If true then error is for file. - - !Local variables: - integer :: strerr !Error code returned if pio_strerror fails - character(len=256) :: pio_error - logical :: file_msg_flag - - !Check if error is for a file instead of a variable: - if (present(file_msg)) then - file_msg_flag = file_msg - else - file_msg_flag = .false. - end if - - !Get error message from PIO: - strerr = pio_strerror(errcode, pio_error) - if(strerr /= PIO_NOERR) then - write(errmsg, *) "Failed to get error message for PIO code: ", errcode - errcode = pio_get_msg_err - else - if (file_msg_flag) then - write(errmsg, '(a,a,a,a)') "Error for file '", varname, "' - message: ", trim(pio_error) - else - !Variable error message - write(errmsg, '(a,a,a,a)') "Error for variable '", varname, "' - message: ", trim(pio_error) - end if - errcode = caller_errcode - end if - end subroutine get_pio_errmsg - - subroutine get_dim_sizes(varname, var_rank, var_id, pio_file_handle, dim_sizes, errcode, errmsg) - !Extract the dimension sizes for a NetCDF - !variable given a variable ID, and - !return a new 1-D array with the variable - !dimension sizes. - - use pio, only: pio_inq_dimlen - use pio, only: pio_inquire_variable - use pio, only: PIO_NOERR - - !Input variables: - character(len=*), intent(in) :: varname !Name of NetCDF variable - integer, intent(in) :: var_rank !Rank (number of dims) of NetCDF variable - integer, intent(in) :: var_id !Variable ID for NetCDF variable - type(file_desc_t), intent(in) :: pio_file_handle !File handle type used by PIO - - !Output variables: - integer, allocatable, intent(out) :: dim_sizes(:) !Variable dimension sizes - integer, intent(out) :: errcode !Error code - character(len=*), intent(out) :: errmsg !Error message - - !Local variables: - integer :: ndims !Number of NetCDF variable dimensions - integer, allocatable :: dim_ids(:) !Variable dimension IDs - - integer :: i !loop control variable - - !Initialize error code and message: - errcode = 0 - errmsg = '' - - !Get number of variable dimensions on file: - errcode = pio_inquire_variable(pio_file_handle, var_id, ndims=ndims) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - return - end if - - !Check that the variable rank as specified by the caller - !matches what is found on the NetCDF file: - errcode = 0 - if(ndims /= var_rank) then - errcode = bad_var_rank_err - errmsg = "Variable '"//trim(varname)//"' isn't declared with the correct number of dimensions" - return - end if - - !Get variable dimension sizes: - !Allocate NetCDF variable dimension ID array: - allocate(dim_ids(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - return - end if - - !Get variable dimension IDs: - errcode = pio_inquire_variable(pio_file_handle, var_id, dimids=dim_ids) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_var_info_err, varname, errcode, errmsg) - return - end if - - !Allocate NetCDF variable dimension sizes array: - allocate(dim_sizes(ndims), stat=errcode, errmsg=errmsg) - if(errcode /= 0) then - return - end if - - !Get dimension sizes: - do i = 1, ndims - errcode = pio_inq_dimlen(pio_file_handle, dim_ids(i), dim_sizes(i)) - if(errcode /= PIO_NOERR) then - !Extract error message from PIO: - call get_pio_errmsg(pio_inq_dim_len_err, varname, errcode, errmsg) - return - end if - end do - - end subroutine get_dim_sizes - -end module pio_reader diff --git a/src/utils/cam_ccpp/pio_reader_sub.F90 b/src/utils/cam_ccpp/pio_reader_sub.F90 deleted file mode 100644 index 3ce3ec7305..0000000000 --- a/src/utils/cam_ccpp/pio_reader_sub.F90 +++ /dev/null @@ -1,8 +0,0 @@ -submodule (ccpp_io_reader) pio_submodule -use pio_reader, only: pio_reader_t -implicit none -contains - module procedure create_netcdf_reader_t - allocate(pio_reader_t :: r) - end procedure create_netcdf_reader_t -end submodule pio_submodule From f7fc0f23fb4e75d11cedc613e7b35d9ab661aea1 Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Thu, 7 Aug 2025 14:29:11 -0600 Subject: [PATCH 277/466] Add back ending newline in .gitmodules file. --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index ee9f1b805d..97f1e6b17e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -218,3 +218,4 @@ url = https://github.com/NCAR/CUPiD.git fxtag = v0.2.1 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git + From c04b9221b33744781578059e6ac5e935303c6689 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 8 Aug 2025 11:23:43 -0400 Subject: [PATCH 278/466] replace carma_cosp_subcol_rad by carma_cosp_rad_diag_mam --- .../testmods_dirs/cam/carma_cosp_rad_diag_mam/shell_commands | 4 ++++ .../user_nl_cam | 5 ----- .../user_nl_clm | 0 .../testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands | 4 ---- 4 files changed, 4 insertions(+), 9 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/shell_commands rename cime_config/testdefs/testmods_dirs/cam/{carma_cosp_subcol_rad => carma_cosp_rad_diag_mam}/user_nl_cam (97%) rename cime_config/testdefs/testmods_dirs/cam/{carma_cosp_subcol_rad => carma_cosp_rad_diag_mam}/user_nl_clm (100%) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/shell_commands b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/shell_commands new file mode 100644 index 0000000000..ec1d962149 --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/shell_commands @@ -0,0 +1,4 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange --append CAM_CONFIG_OPTS="-cosp -carma sea_salt" + diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/user_nl_cam similarity index 97% rename from cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam rename to cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/user_nl_cam index 262acaa778..052d30812e 100644 --- a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/user_nl_cam @@ -9,11 +9,6 @@ carma_do_fixedinit=.false. fexcl1='CFAD_DBZE94_CS','CLDTOT_CALCS','CLD_CAL_NOTCS','CS_MIXCERT','CS_MIXPOSS','CS_NOPRECIP','CS_PIA', 'CS_RAINPOSS','CS_RAINPROB','CS_RAINCERT','CS_RAINHARD','CS_SNOWCERT','CS_SNOWPOSS' -microp_uniform=.false. -use_subcol_microp=.true. -subcol_scheme='tstcp' -subcol_tstcp_noAvg=.true. - mode_defs= 'mam3_mode1:accum:=', 'A:num_a1:N:num_c1:num_mr:+', 'A:so4_a1:N:so4_c1:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc:+', diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/user_nl_clm similarity index 100% rename from cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/user_nl_clm rename to cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/user_nl_clm diff --git a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands b/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands deleted file mode 100644 index 81b2c5c227..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/carma_cosp_subcol_rad/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange --append CAM_CONFIG_OPTS="-cosp -carma sea_salt -psubcols 3" - From 850d5b9266bc461c1008cfc67b53a49c5f255bce Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 8 Aug 2025 13:59:33 -0400 Subject: [PATCH 279/466] new testmods for TMC test --- cime_config/testdefs/testlist_cam.xml | 68 +++++++------------ .../testmods_dirs/cam/mc_ttrac/shell_commands | 3 + .../testmods_dirs/cam/mc_ttrac/user_nl_cam | 4 ++ .../testmods_dirs/cam/mc_ttrac/user_nl_clm | 27 ++++++++ doc/ChangeLog | 18 ++++- 5 files changed, 75 insertions(+), 45 deletions(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/mc_ttrac/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 1933a5cdb7..93af15bc62 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -256,8 +256,8 @@ - + @@ -266,8 +266,28 @@ - + + + + + + + + + + + + + + + + + + + + + @@ -433,16 +453,6 @@ - - - - - - - - - - @@ -492,26 +502,7 @@ - - - - - - - - - - - - - - - - - - - @@ -533,16 +524,6 @@ - - - - - - - - - - @@ -611,7 +592,6 @@ - @@ -1135,13 +1115,13 @@ - + - + diff --git a/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/shell_commands b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/shell_commands new file mode 100644 index 0000000000..8bc65f966b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/shell_commands @@ -0,0 +1,3 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange --append CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" diff --git a/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_cam new file mode 100644 index 0000000000..8482082dce --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_cam @@ -0,0 +1,4 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9 +inithist='ENDOFRUN' diff --git a/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_clm new file mode 100644 index 0000000000..0d83b5367b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/mc_ttrac/user_nl_clm @@ -0,0 +1,27 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + diff --git a/doc/ChangeLog b/doc/ChangeLog index b382161faa..aa18e76246 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -17,7 +17,8 @@ Purpose of changes (include the issue number and title text for each relevant Gi work. A check was added to build-namelist to prevent specifiying COSP output on an interpolated history file. -. Updates to cam5 testing. +. Updates to cam5 testing: combine several one-off tests into a single test + and move most aquaplanet tests to F compsets. Describe any changes made to build system: @@ -42,6 +43,10 @@ List all files added and what they do: bld/build-namelist . add check for COSP output on an interpolated file +cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/* +. combine testmods carma_sea_salt, outfrq3s_cosp, rad_diag_mam into this + one. + cime_config/testdefs/testmods_dirs/cam/mam7/* . testmods for mam7 aerosols @@ -83,6 +88,7 @@ cime_config/testdefs/testlist_cam.xml SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s by SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 + . remove SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac @@ -90,15 +96,25 @@ cime_config/testdefs/testlist_cam.xml ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq3s_ba - cam5 nochem tested by rad_diag testmods + . replace ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s + . replace ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_gnu.cam-rad_diag by ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag +. combine 3 QPC5 tests into a single FHIST_C5 test: + replace + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp + SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_nag.cam-carma_cosp_rad_diag_mam + cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam . move the cosp output to h1, add cosp aux output to h2 . interpolate h0 to default lat/lon grid From c61cf58c6abd3582fe0ff6031b214edf288ac264 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 8 Aug 2025 15:43:15 -0600 Subject: [PATCH 280/466] Add p_top_for_rrtmgp namelist --- .gitmodules | 2 +- bld/build-namelist | 3 +++ bld/namelist_files/namelist_defaults_cam.xml | 4 ++++ bld/namelist_files/namelist_definition.xml | 7 +++++++ src/physics/rrtmgp/radiation.F90 | 7 ++++++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5eddf287cf..1c1077c268 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/cacraigucar/atmospheric_physics - fxtag = 0949af7804d4f2bb75648959f2b0ec81eb8d3ba1 + fxtag = 86589b5 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/bld/build-namelist b/bld/build-namelist index eccff7d77f..6a91fc834c 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -738,6 +738,9 @@ elsif ($rad_pkg =~ m/rrtmgp/) { $rel_path = $nl->get_value('rrtmgp_coefs_sw_file'); my $abs_path = quote_string(set_abs_filepath($rel_path, $cam_dir)); $nl->set_variable_value('radiation_nl', 'rrtmgp_coefs_sw_file', $abs_path); + + add_default($nl, 'p_top_for_rrtmgp'); + } # Solar irradiance diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 8e64a8c451..322f22fe45 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -575,6 +575,10 @@ src/physics/rrtmgp/data/rrtmgp-gas-lw-g128.nc src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc + 10._r8 + 1._r8 + 1._r8 + atm/cam/rad/abs_ems_factors_fastvx.c030508.nc diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 215d3358b4..acb1c912ea 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5771,6 +5771,13 @@ Calculate radiative effect of graupel/hail (using snow optics) Default: FALSE + +Top pressure level for RRTMGP +Default: 1.0 for WACCM/WACCMX + 10. for all other CAM runs + + If true, then average the zenith angle over the radiation timestep rather diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 28b5943e8f..1ba30cf60a 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -150,6 +150,8 @@ module radiation logical :: graupel_in_rad = .false. ! graupel in radiation code logical :: use_rad_uniform_angle = .false. ! if true, use the namelist rad_uniform_angle for the coszrs calculation +real(r8) :: p_top_for_rrtmgp = 0._r8 ! top pressure for RRTMGP + ! Gathered indices of day and night columns integer :: nday ! Number of daylight columns integer :: nnite ! Number of night columns @@ -273,7 +275,7 @@ subroutine radiation_readnl(nlfile) namelist /radiation_nl/ & rrtmgp_coefs_lw_file, rrtmgp_coefs_sw_file, iradsw, iradlw, & irad_always, use_rad_dt_cosz, spectralflux, use_rad_uniform_angle, & - rad_uniform_angle, graupel_in_rad + rad_uniform_angle, graupel_in_rad, p_top_for_rrtmgp !----------------------------------------------------------------------------- if (masterproc) then @@ -310,6 +312,8 @@ subroutine radiation_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: rad_uniform_angle") call mpi_bcast(graupel_in_rad, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: graupel_in_rad") + call mpi_bcast(p_top_for_rrtmgp, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_rrtmgp") if (use_rad_uniform_angle .and. rad_uniform_angle == -99._r8) then call endrun(sub//': ERROR - use_rad_uniform_angle is set to .true,' & @@ -468,6 +472,7 @@ subroutine radiation_init(pbuf2d) call rrtmgp_inputs_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & pref_edge, nlay, pver, pverp, kdist_sw, kdist_lw, qrl_unused, is_first_step(), use_rad_dt_cosz, & get_step_size(), get_nstep(), iradsw, dt_avg, irad_always, is_first_restart_step(), masterproc, & + p_top_for_rrtmgp, & nlwbands, nradgas, gasnamelength, idx_sw_diag, idx_nir_diag, idx_uv_diag, & idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, nswgpts, nlwgpts, nlayp, & nextsw_cday, get_curr_calday(), band2gpt_sw, errmsg, errflg) From 3d267f7df286be0ef885bf1b81991cde8cf576e2 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 8 Aug 2025 16:39:35 -0600 Subject: [PATCH 281/466] Finish adding p_top_for_rrtmgp namelist --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 1ba30cf60a..6869e5d4c1 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -132,7 +132,7 @@ module radiation real(r8) :: grau_icld_vistau(pcols,pver) ! Graupel in-cloud visible sw optical depth for output on history files end type rad_out_t -! Control variables set via namelist +! Control variables set via nmamelist character(len=cl) :: coefs_lw_file ! filepath for lw coefficients character(len=cl) :: coefs_sw_file ! filepath for sw coefficients From 6cb09f5c67d7a3379d7a0758e8f1f1d21273eccc Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 11 Aug 2025 12:52:31 -0400 Subject: [PATCH 282/466] update cam5 tests --- cime_config/testdefs/testlist_cam.xml | 21 +++++---- .../cam/outfrq3s_eoyttrac/shell_commands | 6 --- .../cam/outfrq3s_eoyttrac/user_nl_cam | 4 -- .../cam/outfrq3s_eoyttrac/user_nl_clm | 27 ------------ .../cam/outfrq3s_eoyttrac/user_nl_cpl | 2 - .../cam/rad_diag_mam/shell_commands | 4 -- .../cam/rad_diag_mam/user_nl_cam | 43 ------------------- .../cam/rad_diag_mam/user_nl_clm | 27 ------------ .../cam/rad_diag_mam/user_nl_cpl | 2 - .../cam/ttrac_loadbal0/shell_commands | 5 +-- .../cam/ttrac_loadbal0/user_nl_cam | 2 +- .../cam/ttrac_loadbal0/user_nl_clm | 2 +- .../cam/ttrac_loadbal1/shell_commands | 5 +-- .../cam/ttrac_loadbal1/user_nl_cam | 2 +- .../cam/ttrac_loadbal1/user_nl_clm | 2 +- .../cam/ttrac_loadbal3/shell_commands | 5 +-- doc/ChangeLog | 23 ++++++++-- 17 files changed, 37 insertions(+), 145 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cpl diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 93af15bc62..63752ff7f2 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -291,6 +291,16 @@ + + + + + + + + + + @@ -453,17 +463,6 @@ - - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/shell_commands deleted file mode 100644 index 3746e133fa..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -./xmlchange -append CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-12-31" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cam deleted file mode 100644 index 43ef003dd6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cam +++ /dev/null @@ -1,4 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/shell_commands b/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/shell_commands deleted file mode 100644 index df77eb8183..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-01-01" -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cam deleted file mode 100644 index 03475a7753..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cam +++ /dev/null @@ -1,43 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 - -mode_defs= -'mam3_mode1:accum:=', 'A:num_a1:N:num_c1:num_mr:+', - 'A:so4_a1:N:so4_c1:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc:+', - 'A:pom_a1:N:pom_c1:p-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c101112.nc:+', - 'A:soa_a1:N:soa_c1:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', - 'A:bc_a1:N:bc_c1:black-c:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c100508.nc:+', - 'A:dst_a1:N:dst_c1:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', - 'A:ncl_a1:N:ncl_c1:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', -'mam3_mode2:aitken:=', 'A:num_a2:N:num_c2:num_mr:+', - 'A:so4_a2:N:so4_c2:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc:+', - 'A:soa_a2:N:soa_c2:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', - 'A:ncl_a2:N:ncl_c2:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', -'mam3_mode3:coarse:=', 'A:num_a3:N:num_c3:num_mr:+', - 'A:dst_a3:N:dst_c3:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', - 'A:ncl_a3:N:ncl_c3:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc:+', - 'A:so4_a3:N:so4_c3:sulfate:$DIN_LOC_ROOT/atm/cam/physprops/sulfate_rrtmg_c080918.nc', -'mam3_m1_noso4:accum:=', 'A:num_a1:N:num_c1:num_mr:+', - 'A:pom_a1:N:pom_c1:p-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocpho_rrtmg_c101112.nc:+', - 'A:soa_a1:N:soa_c1:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', - 'A:bc_a1:N:bc_c1:black-c:$DIN_LOC_ROOT/atm/cam/physprops/bcpho_rrtmg_c100508.nc:+', - 'A:dst_a1:N:dst_c1:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', - 'A:ncl_a1:N:ncl_c1:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', -'mam3_m2_noso4:aitken:=', 'A:num_a2:N:num_c2:num_mr:+', - 'A:soa_a2:N:soa_c2:s-organic:$DIN_LOC_ROOT/atm/cam/physprops/ocphi_rrtmg_c100508.nc:+', - 'A:ncl_a2:N:ncl_c2:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc', -'mam3_m3_noso4:coarse:=', 'A:num_a3:N:num_c3:num_mr:+', - 'A:dst_a3:N:dst_c3:dust:$DIN_LOC_ROOT/atm/cam/physprops/dust_aeronet_rrtmg_c141106.nc:+', - 'A:ncl_a3:N:ncl_c3:seasalt:$DIN_LOC_ROOT/atm/cam/physprops/ssam_rrtmg_c100508.nc' -rad_climate= - 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'N:ozone:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', - 'M:mam3_mode1:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', - 'M:mam3_mode2:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', - 'M:mam3_mode3:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc' -rad_diag_1= - 'A:Q:H2O', 'N:O2:O2', 'N:CO2:CO2', 'N:ozone:O3', 'N:N2O:N2O', 'N:CH4:CH4', 'N:CFC11:CFC11', 'N:CFC12:CFC12', - 'M:mam3_m1_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_c141106.nc', - 'M:mam3_m2_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', - 'M:mam3_m3_noso4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc' - diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/shell_commands b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/shell_commands index e09be8b977..bbb90c61ce 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/shell_commands @@ -1,6 +1,3 @@ -./xmlchange CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" --append ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-12-31" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET +./xmlchange --append CAM_CONFIG_OPTS="-nadv_tt 5" diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_cam index e9a6d5b70c..d06d2ae8a4 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_cam @@ -1,5 +1,5 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 +nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' phys_loadbalance=0 diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_clm index f3ac27f1e6..0d83b5367b 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal0/user_nl_clm @@ -21,7 +21,7 @@ ! Set maxpatch_glcmec with GLC_NEC option ! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable !---------------------------------------------------------------------------------- -hist_nhtfrq = 3 +hist_nhtfrq = 9 hist_mfilt = 1 hist_ndens = 1 diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/shell_commands b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/shell_commands index e09be8b977..bbb90c61ce 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/shell_commands @@ -1,6 +1,3 @@ -./xmlchange CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" --append ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-12-31" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET +./xmlchange --append CAM_CONFIG_OPTS="-nadv_tt 5" diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_cam index 74b84fd2ce..fc95a329b7 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_cam @@ -1,5 +1,5 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 +nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' phys_loadbalance=1 diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_clm index f3ac27f1e6..0d83b5367b 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_clm +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal1/user_nl_clm @@ -21,7 +21,7 @@ ! Set maxpatch_glcmec with GLC_NEC option ! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable !---------------------------------------------------------------------------------- -hist_nhtfrq = 3 +hist_nhtfrq = 9 hist_mfilt = 1 hist_ndens = 1 diff --git a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal3/shell_commands b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal3/shell_commands index e09be8b977..bbb90c61ce 100644 --- a/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal3/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/ttrac_loadbal3/shell_commands @@ -1,6 +1,3 @@ -./xmlchange CAM_CONFIG_OPTS="-nadv_tt 5 -cppdefs -DTRACER_CHECK" --append ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="0001-12-31" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET +./xmlchange --append CAM_CONFIG_OPTS="-nadv_tt 5" diff --git a/doc/ChangeLog b/doc/ChangeLog index aa18e76246..bc6d73653a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -18,7 +18,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi output on an interpolated history file. . Updates to cam5 testing: combine several one-off tests into a single test - and move most aquaplanet tests to F compsets. + and move most QPC5 tests to FHIST_C5. Describe any changes made to build system: @@ -33,7 +33,9 @@ Code reviewed by: List all files eliminated: cime_config/testdefs/testmods_dirs/cam/outfrq3s_ba/* +cime_config/testdefs/testmods_dirs/cam/outfrq3s_eoyttrac/* cime_config/testdefs/testmods_dirs/cam/outfrq3s_ttrac/* +cime_config/testdefs/testmods_dirs/cam/rad_diag_mam/* cime_config/testdefs/testmods_dirs/cam/volc/* cime_config/testdefs/testmods_dirs/cam/volc_usecase/* . remove unused testmods @@ -44,12 +46,15 @@ bld/build-namelist . add check for COSP output on an interpolated file cime_config/testdefs/testmods_dirs/cam/carma_cosp_rad_diag_mam/* -. combine testmods carma_sea_salt, outfrq3s_cosp, rad_diag_mam into this - one. +. combine testmods carma_sea_salt, outfrq3s_cosp, and rad_diag_mam into + carma_cosp_rad_diag_mam. cime_config/testdefs/testmods_dirs/cam/mam7/* . testmods for mam7 aerosols +cime_config/testdefs/testmods_dirs/cam/mc_ttrac +. testmods for mass conservation of test tracer TT_UN + cime_config/testdefs/testmods_dirs/cam/outfrq3s_eri/* . testmods for ERI test - 3 step output frequency and set check_finidat_year_consistency=.false. in user_nl_clm @@ -115,6 +120,18 @@ cime_config/testdefs/testlist_cam.xml by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_nag.cam-carma_cosp_rad_diag_mam +. remove + ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac + - cam5 ERI test done elsewhere + +. move QPC5 tests to FHIST_C5 + replace + TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac + by + TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac + + + cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam . move the cosp output to h1, add cosp aux output to h2 . interpolate h0 to default lat/lon grid From 61e72921f6c9e8a1fc2a37716e7f02d099f9587e Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 11:07:12 -0600 Subject: [PATCH 283/466] Update p_top_for_rrtmgp settings --- bld/namelist_files/namelist_defaults_cam.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 322f22fe45..50e18fc7a6 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -575,9 +575,9 @@ src/physics/rrtmgp/data/rrtmgp-gas-lw-g128.nc src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc - 10._r8 - 1._r8 - 1._r8 + 10.D0 + 1.D0 + 1.D0 atm/cam/rad/abs_ems_factors_fastvx.c030508.nc From 1e56bb0e1381675ca516fd1e07c5199fe229910b Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 11 Aug 2025 13:25:33 -0400 Subject: [PATCH 284/466] update cam5 tests --- cime_config/testdefs/testlist_cam.xml | 57 ++++++++++++++------------- doc/ChangeLog | 6 +++ 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 63752ff7f2..c328dee47e 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -301,6 +301,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -463,34 +492,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/ChangeLog b/doc/ChangeLog index bc6d73653a..ba944e69df 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -127,8 +127,14 @@ cime_config/testdefs/testlist_cam.xml . move QPC5 tests to FHIST_C5 replace TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 by TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 From ce7d2626fea098d91368d1a2b2bcc1d34b6a59c7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 15:01:29 -0600 Subject: [PATCH 285/466] Further cleanup --- src/physics/cam/radheat.F90 | 14 ++++---------- src/physics/rrtmgp/radiation.F90 | 5 ++--- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 088696d502..2d8db06c40 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -248,7 +248,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & type(physics_state), intent(in) :: state ! Physics state variables type(physics_buffer_desc), pointer :: pbuf(:) - type(physics_ptend), intent(out) :: ptend ! indivdual parameterization tendencie + type(physics_ptend), intent(out) :: ptend ! individual parameterization tendencies real(r8), intent(in) :: qrl(pcols,pver) ! longwave heating real(r8), intent(in) :: qrs(pcols,pver) ! shortwave heating real(r8), intent(in) :: fsns(pcols) ! Surface solar absorbed flux @@ -291,11 +291,9 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & lchnk = state%lchnk call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) -!++jtb -! just use RRTMG's +! Shortwave heating is RRTMG solar heating only qrs_mrg(:,:) = qrs(:,:) -!+++arh icall = 0 ! can't find gas name 'O' @@ -312,12 +310,8 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & xo3mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) nullify(gas_mmr) -! can't find gas name 'N2' - !call rad_cnst_get_gas(icall,'N2 ', state, pbuf, gas_mmr) - !xn2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) - !nullify(gas_mmr) - !++ jtb set to 0.7547 ('standard' mass mixing ratio of nitrogen gas in atmos) - xn2mmr(:pcols,:pver) = 0.7547_r8 !0._r8 +! Using standard US N2_VMR(0.78084) converted to N2_MMR=N2_VMR*(N2_mass/dry_air_mass) + xn2mmr(:pcols,:pver) = 0.7553_r8 ! N2_MMR call rad_cnst_get_gas(icall,'CO2 ', state, pbuf, gas_mmr) xco2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 6869e5d4c1..8470f1368c 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -132,7 +132,7 @@ module radiation real(r8) :: grau_icld_vistau(pcols,pver) ! Graupel in-cloud visible sw optical depth for output on history files end type rad_out_t -! Control variables set via nmamelist +! Control variables set via namelist character(len=cl) :: coefs_lw_file ! filepath for lw coefficients character(len=cl) :: coefs_sw_file ! filepath for sw coefficients @@ -282,9 +282,8 @@ subroutine radiation_readnl(nlfile) open( newunit=unitn, file=trim(nlfile), status='old' ) call find_group_name(unitn, 'radiation_nl', status=ierr) if (ierr == 0) then - read(unitn, radiation_nl, iostat=ierr) + read(unitn, radiation_nl, iostat=ierr, iomsg=errmsg) if (ierr /= 0) then - write(errmsg,'(a,i5)') 'iostat =', ierr call endrun(sub//': ERROR reading namelist: '//trim(errmsg)) end if end if From 29cd4938c2ab12cee395d82e713e170a219bbce7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 15:33:47 -0600 Subject: [PATCH 286/466] remove unused parameters from calculate_net_heating call --- src/physics/cam/radheat.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 2d8db06c40..e5a829d1a2 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -337,11 +337,11 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & endif enddo call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), .true., & - gravit, state%pdel(:ncol,:), fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & + fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & errmsg, errflg) #else call calculate_net_heating_run(ncol, ptend%s(:ncol,:), qrl_mrg(:ncol,:), qrs_mrg(:ncol,:), .false., & - gravit, state%pdel(:ncol,:), fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & + fsns(:ncol), fsnt(:ncol), flns(:ncol), flnt(:ncol), net_flx(:ncol), & errmsg, errflg) #endif From 22d9c62216c60fdac40e6e8b792780052209d133 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 15:35:31 -0600 Subject: [PATCH 287/466] Update atmos_phys hash --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 1c1077c268..1d2bbccbb3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/cacraigucar/atmospheric_physics - fxtag = 86589b5 + fxtag = 692e98b fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From b346bddfe542109dfe0dec6c4bf1bb2095426bc4 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 15:43:18 -0600 Subject: [PATCH 288/466] Address some review comments --- src/physics/cam/radheat.F90 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index e5a829d1a2..0643fd11d5 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -20,7 +20,7 @@ module radheat use spmd_utils, only: masterproc use ppgrid, only: pcols, pver use physics_types, only: physics_state, physics_ptend, physics_ptend_init - use physconst, only: gravit,cpair,mwco2 + use physconst, only: cpair,mwco2 use air_composition, only: cpairv use perf_mod use cam_logfile, only: iulog @@ -88,9 +88,7 @@ subroutine radheat_init(pref_mid) use nlte_fomichev, only: nlte_fomichev_init - use cam_history, only: add_default, addfld use phys_control, only: phys_getopts - use physics_buffer, only : physics_buffer_desc ! args @@ -187,7 +185,7 @@ subroutine radheat_init(pref_mid) call nlte_fomichev_init (co2_mw, n2_mw, o1_mw, o2_mw, o3_mw, no_mw, nlte_limit_co2) - ! determine upppermost level that is purely solar heating (no MLT chem heationg) + ! determine upppermost level that is purely solar heating (no MLT chem heating) ntop_qrs_cam = 0 do k=pver,1,-1 if (qrs_wt(k)==1._r8) ntop_qrs_cam = k @@ -241,7 +239,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & use calculate_net_heating, only: calculate_net_heating_run use cam_abortutils, only: endrun -!+++arh use rad_constituents, only: rad_cnst_get_gas ! Arguments @@ -259,15 +256,12 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8), intent(out) :: net_flx(pcols) ! Local variables - integer :: i, k , ico2 + integer :: k integer :: ncol ! number of atmospheric columns integer :: lchnk ! chunk identifier real(r8) :: qrl_mrg(pcols,pver) ! merged LW heating real(r8) :: qrl_mlt(pcols,pver) ! M/LT longwave heating rates real(r8) :: qrs_mrg(pcols,pver) ! merged SW heating - real(r8) :: qout(pcols,pver) ! temp for outfld call - real(r8) :: dcoef(6) ! for tidal component of heating - real(r8) :: tau_newt ! time scale for 'IR' relaxation real(r8) :: qrlfomichev(pcols,pver) ! Fomichev cooling rate ! (K/s) real(r8) :: o3cool(pcols,pver) ! Fomichev cooling rate ! (K/s) @@ -279,7 +273,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: xommr(pcols,pver) ! O real(r8) :: xn2mmr(pcols,pver) ! N2 -!+++arh integer :: icall real(r8), pointer :: gas_mmr(:,:) character(len=512) :: errmsg @@ -323,7 +316,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating call merge_qrl (ncol, qrl, qrl_mlt, qrl_mrg) - qout(:ncol,:) = qrl_mrg(:ncol,:)/cpair ! REMOVECAM no longer need once CAM is retired and pcols doesn't exist net_flx = 0._r8 From 2966cf43f00721fa5cffbc25b24bddeaf4d86c42 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 11 Aug 2025 16:14:20 -0600 Subject: [PATCH 289/466] Revert back to original code for mpas/dp_coupling.F90 --- src/dynamics/mpas/dp_coupling.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/dynamics/mpas/dp_coupling.F90 b/src/dynamics/mpas/dp_coupling.F90 index e84356aff0..1681ec6df2 100644 --- a/src/dynamics/mpas/dp_coupling.F90 +++ b/src/dynamics/mpas/dp_coupling.F90 @@ -112,7 +112,7 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) integer :: lchnk, icol, icol_p, k, kk ! indices over chunks, columns, physics columns and layers integer :: i, m, ncols integer :: block_index - integer, dimension(:), allocatable :: block_offset + integer, dimension(:), pointer :: block_offset real(r8), allocatable:: pmid(:,:) !mid-level hydrostatic pressure consistent with MPAS discrete state real(r8), allocatable:: pintdry(:,:) !interface hydrostatic pressure consistent with MPAS discrete state @@ -248,7 +248,6 @@ subroutine d_p_coupling(phys_state, phys_tend, pbuf2d, dyn_out) vort4gw_phys(icol_p, k, lchnk) = vort4gw(kk, i) end if end do - if(allocated(block_offset)) deallocate(block_offset) do k = 1, pverp kk = pverp - k + 1 @@ -337,7 +336,7 @@ subroutine p_d_coupling(phys_state, phys_tend, dyn_in) integer :: lchnk, icol, icol_p, k, kk ! indices over chunks, columns, layers integer :: i, m, ncols integer :: block_index - integer, dimension(:), allocatable :: block_offset + integer, dimension(:), pointer :: block_offset real(r8) :: factor real(r8) :: dt_phys @@ -436,7 +435,6 @@ subroutine p_d_coupling(phys_state, phys_tend, dyn_in) end do end do end do - if(allocated(block_offset)) deallocate(block_offset) call t_stopf('pd_copy') From 29fa410b4f24f6601921151f19b39563f4cda7d9 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 12 Aug 2025 12:00:13 -0600 Subject: [PATCH 290/466] Add calculation for N2_VMR --- src/physics/cam/radheat.F90 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 0643fd11d5..76355f9a63 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -44,9 +44,6 @@ module radheat real(r8):: qrs_wt(pver) ! merge weight for cam solar heating real(r8):: qrl_wt(pver) ! merge weight for cam long wave heating - logical :: waccm_heating - logical :: waccm_heating_on = .true. - ! sw merge region ! highest altitude (lowest pressure) of merge region (Pa) real(r8) :: min_pressure_sw= 5._r8 @@ -273,6 +270,10 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: xommr(pcols,pver) ! O real(r8) :: xn2mmr(pcols,pver) ! N2 + real(r8), parameter :: N2_VMR = 0.78084 ! From US standard atmosphere + real(r8), parameter :: N2_mass = 28.0134 ! g/mol + real(r8), parameter :: mass_dry_air = 28.9647 ! g/mol + integer :: icall real(r8), pointer :: gas_mmr(:,:) character(len=512) :: errmsg @@ -289,10 +290,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & icall = 0 -! can't find gas name 'O' - !call rad_cnst_get_gas(icall,'O ', state, pbuf, gas_mmr) - !xommr(:pcols,:pver) = gas_mmr(:pcols,:pver) - !nullify(gas_mmr) xommr(:pcols,:pver) = 0._r8 call rad_cnst_get_gas(icall,'O2 ', state, pbuf, gas_mmr) @@ -304,7 +301,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & nullify(gas_mmr) ! Using standard US N2_VMR(0.78084) converted to N2_MMR=N2_VMR*(N2_mass/dry_air_mass) - xn2mmr(:pcols,:pver) = 0.7553_r8 ! N2_MMR + xn2mmr(:pcols,:pver) = N2_VMR * (N2_mass / dry_air_mass) call rad_cnst_get_gas(icall,'CO2 ', state, pbuf, gas_mmr) xco2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) From b6f0658890bff8097e41d8676d133fe9b95b50f7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 12 Aug 2025 12:14:20 -0600 Subject: [PATCH 291/466] Remove extraneous waccm logic from cam version of radheat --- .gitmodules | 2 +- src/physics/cam/radheat.F90 | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1d2bbccbb3..921c4ce02d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/cacraigucar/atmospheric_physics - fxtag = 692e98b + fxtag = 205d248 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 76355f9a63..e5299d984a 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -37,8 +37,6 @@ module radheat radheat_timestep_init, &! radheat_tend ! return net radiative heating - public :: radheat_disable_waccm ! disable waccm heating in the upper atm - ! Private variables for merging heating rates real(r8):: qrs_wt(pver) ! merge weight for cam solar heating @@ -188,14 +186,6 @@ subroutine radheat_init(pref_mid) if (qrs_wt(k)==1._r8) ntop_qrs_cam = k enddo - - ! WACCM heating if top-most layer is above merge region - waccm_heating = (pref_mid(1) .le. min_pressure_sw) - - if (masterproc) then - write(iulog,*) 'WACCM Heating is computed (true/false): ',waccm_heating - end if - end subroutine radheat_init !================================================================================================ @@ -337,11 +327,6 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & end subroutine radheat_tend !================================================================================================ - subroutine radheat_disable_waccm() - waccm_heating_on = .false. - end subroutine radheat_disable_waccm -!================================================================================================ - subroutine merge_qrl (ncol, hcam, hmlt, hmrg) ! ! Merges long wave heating rates From 563934e03ee3fb2d4b6f72eaad8440efa524c0da Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 12 Aug 2025 13:20:47 -0600 Subject: [PATCH 292/466] restore radheat_disable_waccm --- src/physics/cam/radheat.F90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index e5299d984a..c439ff3eb1 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -37,6 +37,7 @@ module radheat radheat_timestep_init, &! radheat_tend ! return net radiative heating + public :: radheat_disable_waccm ! disable waccm heating in the upper atm ! Private variables for merging heating rates real(r8):: qrs_wt(pver) ! merge weight for cam solar heating @@ -134,7 +135,7 @@ subroutine radheat_init(pref_mid) do k=1,pver - ! pressure scale heights for camrt merging (waccm4) + ! pressure scale heights for camrt merging (cam4) psh(k)=log(1e5_r8/pref_mid(k)) if ( pref_mid(k) .le. min_pressure_sw ) then @@ -290,8 +291,8 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & xo3mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) nullify(gas_mmr) -! Using standard US N2_VMR(0.78084) converted to N2_MMR=N2_VMR*(N2_mass/dry_air_mass) - xn2mmr(:pcols,:pver) = N2_VMR * (N2_mass / dry_air_mass) +! Using standard US N2_VMR(0.78084) converted to N2_MMR + xn2mmr(:pcols,:pver) = N2_VMR * (N2_mass / mass_dry_air) call rad_cnst_get_gas(icall,'CO2 ', state, pbuf, gas_mmr) xco2mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) @@ -327,6 +328,9 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & end subroutine radheat_tend !================================================================================================ + subroutine radheat_disable_waccm() + end subroutine radheat_disable_waccm + subroutine merge_qrl (ncol, hcam, hmlt, hmrg) ! ! Merges long wave heating rates From 3fc40a114ac19ba1b92d14bdf31ff04ce3948f5c Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 12 Aug 2025 16:57:50 -0600 Subject: [PATCH 293/466] Use official atmos_phys tag --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 921c4ce02d..280ce7f549 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,8 +35,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/cacraigucar/atmospheric_physics - fxtag = 205d248 + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = dev_atmos_phys0_15_000 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From f941d3a587a72266cdf869004d8064a9a36a74bc Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 13 Aug 2025 12:42:43 -0600 Subject: [PATCH 294/466] Update ChangeLog for cam6_4_107 --- doc/ChangeLog | 93 +++++++++++++++++++++++++++++++++++++++++++++++++- src/atmos_phys | 2 +- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 90114c3769..35b0b564d3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,96 @@ =============================================================== +Tag name: cam6_4_107 +Originator(s): JulioTBacmeister, perverwhee, cacraigucar +Date: August 13, 2025 +One-line Summary: RRTMGP mods to support MT configurations +Github PR URL: https://github.com/ESCOMP/CAM/pull/1353 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - RRTMGP error with mpas and L93 mid-top configuration: https://github.com/ESCOMP/AM/issues/1279 + - Removes extra logic needed to use RRTMGP in the MT configuration where minimum pressures may fall below 1 Pa - the lower + limit of validity for RRTMGP + - MT will now use cooling rates from Fomichev radiation above 10 Pa. + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: + - introduce p_top_for_rrtmgp: Top pressure level for RRTMGP + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: peverwhee, cacraigucar + +List all files eliminated: +D src/physics/waccm/nlte_fomichev.F90 + - Moved to ESCOMP/atmospheric_physics + +List all files added and what they do: + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - Update atmos_phys external tag + +M bld/build-namelist +M bld/namelist_files/namelist_defaults_cam.xml +M bld/namelist_files/namelist_definition.xml + - introduce p_top_for_rrtmgp + +M src/physics/cam/radheat.F90 +M src/physics/rrtmgp/radiation.F90 + - Julio's modifications as described above + +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. + + - Numerous NLFAIL due to the new p_top_for_rrtmgp namelist + +derecho/intel/aux_cam: + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + - MT answer changes are expected + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: BFB + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + Tag name: cam6_4_106 Originator(s): kuanchihwang Date: July 23, 2025 @@ -185,7 +276,7 @@ ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: NLFAIL) PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 (Overall: NLFAIL) PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 (Overall: NLFAIL) PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 (Overall: NLFAIL) -SMS_D_Ld2.f45_f45_mg37.PC5.izumi_nag.cam-outfrq24h_port (Overall: NLFAIL) +SMS_D_Ld2.f45_f45_mg37.PC5.izumi_nag.cam-outfrq24h_port (Overall: NLFAIL) SMS_D_Ln3.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s (Overall: NLFAIL) SMS_D_Ln6.ne5_ne5_mg37.QPWmaC4.izumi_nag.cam-outfrq3s_physgrid_tem (Overall: NLFAIL) SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam (Overall: NLFAIL) diff --git a/src/atmos_phys b/src/atmos_phys index 0949af7804..addb421211 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 0949af7804d4f2bb75648959f2b0ec81eb8d3ba1 +Subproject commit addb421211690ed8c63ba6a7c7e27005e7c50c1a From b7d1c6511a84e68b581a7df3a5a1b3bbdd66fd91 Mon Sep 17 00:00:00 2001 From: Courtney Peverley Date: Wed, 13 Aug 2025 14:54:29 -0600 Subject: [PATCH 295/466] add missing r8s --- src/physics/cam/radheat.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index c439ff3eb1..767608fd4d 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -261,9 +261,9 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: xommr(pcols,pver) ! O real(r8) :: xn2mmr(pcols,pver) ! N2 - real(r8), parameter :: N2_VMR = 0.78084 ! From US standard atmosphere - real(r8), parameter :: N2_mass = 28.0134 ! g/mol - real(r8), parameter :: mass_dry_air = 28.9647 ! g/mol + real(r8), parameter :: N2_VMR = 0.78084_r8 ! From US standard atmosphere + real(r8), parameter :: N2_mass = 28.0134_r8 ! g/mol + real(r8), parameter :: mass_dry_air = 28.9647_r8 ! g/mol integer :: icall real(r8), pointer :: gas_mmr(:,:) From 8632fba06f961ebde7f64a38e2436621cee7015c Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 14 Aug 2025 10:19:48 -0600 Subject: [PATCH 296/466] remove unused variables --- src/physics/rrtmgp/radiation.F90 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 8efaeb0e91..82ead2d545 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -223,18 +223,6 @@ module radiation integer :: nlwgpts integer :: nswgpts -! Cloud optics variables -real(kind=r8), allocatable :: abs_lw_ice(:,:) -real(kind=r8), allocatable :: asm_sw_ice(:,:) -real(kind=r8), allocatable :: ssa_sw_ice(:,:) -real(kind=r8), allocatable :: ext_sw_ice(:,:) -real(kind=r8), allocatable :: abs_lw_liq(:,:,:) -real(kind=r8), allocatable :: ext_sw_liq(:,:,:) -real(kind=r8), allocatable :: ssa_sw_liq(:,:,:) -real(kind=r8), allocatable :: asm_sw_liq(:,:,:) -real(kind=r8), allocatable :: g_lambda(:,:) -real(kind=r8), allocatable :: g_mu(:) -real(kind=r8), allocatable :: g_d_eff(:) real(kind=r8) :: tiny ! Band indices for bands containing specific wavelengths From d7ad452a7e2885dc58397b89aa7ec4a61ce550ab Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 14 Aug 2025 17:53:16 -0400 Subject: [PATCH 297/466] testing fixes --- cime_config/testdefs/testlist_cam.xml | 22 +--------------------- doc/ChangeLog | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index c328dee47e..e268387254 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -108,7 +108,7 @@ - + @@ -1095,16 +1095,6 @@ - - - - - - - - - - @@ -1161,16 +1151,6 @@ - - - - - - - - - - diff --git a/doc/ChangeLog b/doc/ChangeLog index ba944e69df..daab161e0a 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,25 +8,27 @@ Github PR URL: Purpose of changes (include the issue number and title text for each relevant GitHub issue): -. Add ERI tests (branch and hybrid runs) for cam5, cam6, and cam7 F - compsets. Previously only aquaplanet configurations tested. +. Add ERI tests (branch and hybrid runs) for cam5, cam6, and cam7 + F-compsets. Previously only aquaplanet configurations tested. . Add testing of interpolated output for FHISTC_LTso. Move COSP output to a separate history file that uses the native SE grid. The COSP output of fields with more than 1 mdim to an interpolated lat/lon grid doesn't - work. A check was added to build-namelist to prevent specifiying COSP - output on an interpolated history file. + work. + +. Add check to build-namelist to prevent specifiying COSP output on an + interpolated history file. . Updates to cam5 testing: combine several one-off tests into a single test and move most QPC5 tests to FHIST_C5. -Describe any changes made to build system: +Describe any changes made to build system: none -Describe any changes made to the namelist: +Describe any changes made to the namelist: none -List any changes to the defaults for the boundary datasets: +List any changes to the defaults for the boundary datasets: none -Describe any substantial timing or memory changes: +Describe any substantial timing or memory changes: none Code reviewed by: @@ -94,6 +96,13 @@ cime_config/testdefs/testlist_cam.xml by SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 +. Combine these tests and move to FHIST_C5. + Replace + ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase + SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase + by + ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri + . remove SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac @@ -136,8 +145,6 @@ cime_config/testdefs/testlist_cam.xml PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 - - cime_config/testdefs/testmods_dirs/cam/cosp_rad_diags/user_nl_cam . move the cosp output to h1, add cosp aux output to h2 . interpolate h0 to default lat/lon grid From d6e0d519b69e2588c7bffe245ba5daef37e662ca Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 15 Aug 2025 09:24:40 -0600 Subject: [PATCH 298/466] add new directory to configure --- .gitmodules | 2 +- bld/configure | 1 + src/atmos_phys | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d68129a521..c94f4469e7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 4cc1e406979e8543171cdf22eedd4e2ef130cd81 + fxtag = cacfac54beb0f880a22e927f42d973abc5dd100d fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/bld/configure b/bld/configure index 55cef3bd53..65a2457f88 100755 --- a/bld/configure +++ b/bld/configure @@ -2172,6 +2172,7 @@ sub write_filepath # in the list of filepaths. print $fh "$camsrcdir/src/physics/cam\n"; print $fh "$camsrcdir/src/atmos_phys/to_be_ccppized\n"; + print $fh "$camsrcdir/src/atmos_phys/to_be_ccppized/radiation_utils\n"; print $fh "$camsrcdir/src/atmos_phys/phys_utils\n"; # Add the CCPP'ized subdirectories diff --git a/src/atmos_phys b/src/atmos_phys index 4cc1e40697..cacfac54be 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 4cc1e406979e8543171cdf22eedd4e2ef130cd81 +Subproject commit cacfac54beb0f880a22e927f42d973abc5dd100d From 09b75b25ae3888574f710f10c0ff6e1d6333d00d Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 18 Aug 2025 10:04:58 -0600 Subject: [PATCH 299/466] update ChangeLog --- doc/ChangeLog | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 35b0b564d3..c520059d4f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,107 @@ =============================================================== +Tag name: cam6_4_108 +Originator(s): peverwhee +Date: August 18, 2025 +One-line Summary: Bring in file i/o object and update interfaces for CCPPized RRTMGP +Github PR URL: https://github.com/ESCOMP/CAM/pull/1339 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): +- Bring in sparsely-checked-out CAM-SIMA as submodule to grab file i/o object +- Bring in new atmospheric physics tag that incorporates the file i/o object + into RRTMGP +- Update calling lists to match new interfaces (in `rrtmgp/radiation.F90` and + `src/physics/cam/cloud_rad_props.F90` +- Removes file reading from cloud_rad_props.F90 and instead calls new CCPP + interface + +Describe any changes made to build system: +M bld/configure + - Add new to_be_ccppized subdirectory + +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 + +List all files eliminated: N/A + +List all files added and what they do: +A src/utils/.sima_phys_utils_sparse_checkout +A src/utils/cam-sima + - bring in new CAM-SIMA submodule (sparse check out) + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - Update atmos_phys external tag + - Add new CAM-SIMA external + +M src/physics/cam/cloud_rad_props.F90 + - call CCPPized scheme to read ice and liquid optics files + +M src/physics/cam/radheat.F90 + - add missing "_r8"s + +M src/physics/rrtmgp/radiation.F90 + - update interface to cloud_rad_props_init + +M src/physics/rrtmgp/radiation.F90 + - update interfaces to CCPPized schemes + - delete coefs_init subroutine (ccppized) + +M src/utils/cam_pio_utils.F90 + - add "errcode" variable to cam_pio_openfile to be used by ccpp i/o + reader + +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_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + - MT answer changes are expected (added "_r8"s) + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: BFB + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + Tag name: cam6_4_107 Originator(s): JulioTBacmeister, perverwhee, cacraigucar Date: August 13, 2025 From d9f1eb9440070606e8b33d6ba7161434021cbe7c Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 19 Aug 2025 07:16:30 -0600 Subject: [PATCH 300/466] add support for nuopc write_restart_at_endofrun --- src/cpl/nuopc/atm_comp_nuopc.F90 | 39 ++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/cpl/nuopc/atm_comp_nuopc.F90 b/src/cpl/nuopc/atm_comp_nuopc.F90 index bfde73912d..3b19f50633 100644 --- a/src/cpl/nuopc/atm_comp_nuopc.F90 +++ b/src/cpl/nuopc/atm_comp_nuopc.F90 @@ -115,7 +115,8 @@ module atm_comp_nuopc logical :: dart_mode = .false. logical :: mediator_present - + logical :: write_restart_at_endofrun = .false. + character(len=CL) :: orb_mode ! attribute - orbital mode integer :: orb_iyear ! attribute - orbital year integer :: orb_iyear_align ! attribute - associated with model year @@ -316,6 +317,12 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call shr_sys_abort(subname//'Need to set attribute mediator_present') endif + call NUOPC_CompAttributeGet(gcomp, name="write_restart_at_endofrun", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + if (isPresent .and. isSet) then + if (trim(cvalue) .eq. '.true.') write_restart_at_endofrun = .true. + end if + if (dbug_flag > 5) then call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO) end if @@ -1105,20 +1112,6 @@ subroutine ModelAdvance(gcomp, rc) dosend = .true. end if - ! Determine if time to write restart - - call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - - if (ESMF_AlarmIsRinging(alarm, rc=rc)) then - if (ChkErr(rc,__LINE__,u_FILE_u)) return - rstwr = .true. - call ESMF_AlarmRingerOff( alarm, rc=rc ) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - else - rstwr = .false. - endif - ! Determine if time to stop call ESMF_ClockGetAlarm(clock, alarmname='alarm_stop', alarm=alarm, rc=rc) @@ -1130,6 +1123,22 @@ subroutine ModelAdvance(gcomp, rc) nlend = .false. endif + ! Determine if time to write restart + rstwr = .false. + if (nlend .and. write_restart_at_endofrun) then + rstwr = .true. + else + call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + + if (ESMF_AlarmIsRinging(alarm, rc=rc)) then + if (ChkErr(rc,__LINE__,u_FILE_u)) return + rstwr = .true. + call ESMF_AlarmRingerOff( alarm, rc=rc ) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif + endif + ! Run CAM (run2, run3, run4) call t_startf ('CAM_run2') From f24fc736678209fc6943c49eb38bdf6812fd2b3c Mon Sep 17 00:00:00 2001 From: peverwhee Date: Tue, 19 Aug 2025 10:50:30 -0600 Subject: [PATCH 301/466] update atmospheric_physics tag --- .gitmodules | 4 ++-- doc/ChangeLog | 2 +- src/atmos_phys | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index c94f4469e7..cfa3336bce 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,8 +35,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = cacfac54beb0f880a22e927f42d973abc5dd100d + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_15_000 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/doc/ChangeLog b/doc/ChangeLog index c520059d4f..3222eceed7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Tag name: cam6_4_108 Originator(s): peverwhee -Date: August 18, 2025 +Date: August 19, 2025 One-line Summary: Bring in file i/o object and update interfaces for CCPPized RRTMGP Github PR URL: https://github.com/ESCOMP/CAM/pull/1339 diff --git a/src/atmos_phys b/src/atmos_phys index cacfac54be..e4d9da925b 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit cacfac54beb0f880a22e927f42d973abc5dd100d +Subproject commit e4d9da925ba44f503f85a9aef1b7fe972bb9f25f From 385c4a7b1d8cbf79a61ebf8ed750d7ab840d4761 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 19 Aug 2025 11:24:54 -0600 Subject: [PATCH 302/466] update change log --- doc/ChangeLog | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 27d34bf57c..02fd581f5c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,250 @@ + +=============================================================== + +Tag name: tbd +Originator(s): Matt Dawson, Francis Vitt +Date: August 18, 2025 +One-line Summary: Bug fixes in the cloud chemistry module +Github PR URL: tbd + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): +GitHub Issue 1345 +Several minor bugs related to cloud chemistry were identified during refactoring, and addressed here: +- different values for Henry's Law Constant parameters were being used for wet deposition and cloud chemistry +- air density was taken as an input to the cloud chemistry function setsox() and used in several places, but in other places air density is calculated assuming an ideal gas +- inconsistent and rounded values for physical constants (e.g., Avogadro's number, Boltzmann Constant, pressure unit conversion) are used in setsox() +- a hard-coded value of 330 ppm was used for CO2 +- the rate of H2O2 formation was incorrectly calculated for bulk aerosols +- outdated rate parameters for sulfur oxidation were used +- there were errors in the filters used to prevent over-reaction of some sulfur oxidation reactions +- there were a couple missing diagnostics for bulk aerosol configurations +- there was some incorrect logic in the output of wet deposition diagnostics for CARMA + +Describe any changes made to build system: +none + +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: + +List all files eliminated: +none + +List all files added and what they do: +none + +List all existing files that have been modified, and describe the changes: +M src/chemistry/aerosol/aero_convproc.F90 +- fixed incorrect diagnostic label +M src/chemistry/aerosol/aero_wetdep_cam.F90 +- output corrected diagnostic +M src/chemistry/bulk_aero/aero_model.F90 +- added missing diagnostics for bulk aerosols +- removed air_density as arg to setsox() +M src/chemistry/carma_aero/aero_model.F90 +- removed air_density as arg to setsox() +M src/chemistry/modal_aero/aero_model.F90 +- removed air_density as arg to setsox() +M src/chemistry/modal_aero/sox_cldaero_mod.F90 +- fix filtering logic + + + +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: +mattdawson@derecho3:/glade/derecho/scratch/mattdawson/aux_cam_intel_20250815100530> ./cs.status.aux_cam_intel_20250815100530 | grep -v PASS | grep -v TPUTCOMP | grep -v MEMCOMP +aux_cam_intel_20250815100530: 51 tests + ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details: + FAIL ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s (Overall: DIFF) details: + FAIL ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + FAIL ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + FAIL ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase (Overall: DIFF) details: + FAIL ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: + FAIL ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + FAIL ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 (Overall: DIFF) details: + FAIL ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) details: + FAIL ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details: + FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep (Overall: DIFF) details: + FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase (Overall: DIFF) details: + FAIL SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) details: + FAIL SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) details: + FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details: + FAIL SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: + FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s SETUP + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + FAIL SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + FAIL SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + FAIL SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details: + FAIL SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging (Overall: DIFF) details: + FAIL SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s (Overall: DIFF) details: + FAIL SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs (Overall: DIFF) details: + FAIL SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details: + FAIL SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + +derecho/nvhpc/aux_cam: +aux_cam_nvhpc_20250815100605: 1 test + ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF) details: + FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_nvhpc: DIFF + +izumi/nag/aux_cam: +aux_cam_nag_20250814122118: 31 tests + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: DIFF) details: + FAIL ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 (Overall: DIFF) details: + FAIL ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + ERP_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf (Overall: DIFF) details: + FAIL ERP_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam (Overall: DIFF) details: + FAIL SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: DIFF) details: + FAIL SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase (Overall: DIFF) details: + FAIL SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s (Overall: DIFF) details: + FAIL SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: DIFF) details: + FAIL TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + +izumi/gnu/aux_cam: +aux_cam_gnu_20250814122709: 19 tests + ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + FAIL ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + FAIL ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) details: + FAIL ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + FAIL ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 (Overall: DIFF) details: + FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc (Overall: DIFF) details: + FAIL SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac (Overall: DIFF) details: + FAIL SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + +CAM tag used for the baseline comparison tests if different than previous +tag: cam6_4_101 + +Summarize any changes to answers, i.e., +- what code configurations: anyhting that includes cloud chemistry +- what platforms/compilers: intel/nvhpc/gnu/nag +- nature of change (roundoff; larger than roundoff but same climate; new + climate): larger than roundoff + +If bitwise differences were observed, how did you show they were no worse +than roundoff? N/A + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): https://github.com/NCAR/CAM-ACOM-dev/tree/develop-cloud-bug-fix d1358e4 +- platform/compilers: Derecho/Intel +- configure commandline: + ./create_newcase --compset FCnudged --res f09_f09_mg17 --case /glade/work/tilmes/derecho/cesm3/FCnudged_f09.cloud-bug-fix.2015_2018.001 --project P93300043 --run-unsupported + ./create_newcase --compset FCARMAnudged --res f09_f09_mg17 --case /glade/work/tilmes/derecho/cesm3/FCARMAnudged_f09.cloud-bug-fix.2015_2018.001 --project P93300043 --run-unsupported +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + =============================================================== Tag name: cam6_4_101 From 8fc5b3be639f70e7bf580fe425641bc429c2ae42 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 19 Aug 2025 12:52:45 -0600 Subject: [PATCH 303/466] address copilot comments --- src/chemistry/aerosol/mo_setsox.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 0d4bfc98f6..8bbed6c7e4 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -21,7 +21,7 @@ module mo_setsox logical :: cloud_borne = .false. - ! Inidices for species in the shared array of Henry's Law constant parameters + ! Indices for species in the shared array of Henry's Law constant parameters integer :: heff_id_hno3, heff_id_so2, heff_id_nh3, heff_id_co2, heff_id_h2o2, heff_id_o3 contains @@ -890,7 +890,7 @@ end subroutine setsox !----------------------------------------------------------------- ! ... looks up Effective Henry's Law Constant parameters !----------------------------------------------------------------- - pure elemental integer function get_heff_index(species_name) result(index) + pure integer function get_heff_index(species_name) result(index) use shr_drydep_mod, only: species_name_table, dheff character(len=*), intent(in) :: species_name From e619153ce7a35d22b2b1823cd40969693b784085 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Tue, 19 Aug 2025 13:44:02 -0600 Subject: [PATCH 304/466] changelog updates --- doc/ChangeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3222eceed7..519e74b470 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -39,13 +39,16 @@ M .gitmodules - Update atmos_phys external tag - Add new CAM-SIMA external +M src/atmos_phys + - updated atmospheric_physics submodule + M src/physics/cam/cloud_rad_props.F90 - call CCPPized scheme to read ice and liquid optics files M src/physics/cam/radheat.F90 - add missing "_r8"s -M src/physics/rrtmgp/radiation.F90 +M src/physics/rrtmg/radiation.F90 - update interface to cloud_rad_props_init M src/physics/rrtmgp/radiation.F90 From aa22f05480473a9a4cf6d57449eda160bac19834 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 20 Aug 2025 14:15:45 -0400 Subject: [PATCH 305/466] update ChangeLog --- doc/ChangeLog | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3b33601d05..7b065fc807 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -162,16 +162,41 @@ appropriate machine below. All failed tests must be justified. derecho/intel/aux_cam: -derecho/nvhpc/aux_cam: +ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) +ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) +ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) +SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 (Overall: DIFF) +- new tests - no baselines + +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) +- pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: PASS izumi/nag/aux_cam: +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) +- changed test definition to include interpolated output on h0 and move the + cosp output to h1 + +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal0 (Overall: DIFF) +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal1 (Overall: DIFF) +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal3 (Overall: DIFF) +TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac (Overall: DIFF) + izumi/gnu/aux_cam: +ERC_D_Ln9.f10_f10_mg37.FHIST_C5.izumi_gnu.cam-rad_diag (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_gnu.cam-carma_cosp_rad_diag_mam (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) +- new tests - no baselines + CAM tag used for the baseline comparison tests if different than previous tag: -Summarize any changes to answers: +Summarize any changes to answers: None. Diffs all due either to lack of + baselines for new tests or to changes in the test definition. =============================================================== =============================================================== From e0eabbda56253fc5cbff729dae6927ed96bc7db2 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 22 Aug 2025 13:32:43 -0400 Subject: [PATCH 306/466] testing updates for subcols and cam4 --- cime_config/config_compsets.xml | 5 + cime_config/testdefs/testlist_cam.xml | 117 ++++++++---------- .../testmods_dirs/cam/co2rmp/shell_commands | 3 - .../testmods_dirs/cam/co2rmp/user_nl_cam | 6 +- .../cam/co2rmp_1850/shell_commands | 5 - .../testmods_dirs/cam/co2rmp_1850/user_nl_cam | 16 --- .../testmods_dirs/cam/co2rmp_1850/user_nl_clm | 27 ---- .../testmods_dirs/cam/co2rmp_1850/user_nl_cpl | 2 - .../cam/co2rmp_usecase/shell_commands | 4 - .../cam/co2rmp_usecase/user_nl_cam | 13 -- .../cam/co2rmp_usecase/user_nl_clm | 27 ---- .../cam/outfrq3s_subcol/shell_commands | 6 +- .../cam/outfrq3s_subcol/user_nl_cam | 2 +- doc/ChangeLog | 103 +++++++++++++++ 14 files changed, 166 insertions(+), 170 deletions(-) delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_cam delete mode 100644 cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_clm diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index b3d02c6b42..35aef55a86 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -308,6 +308,11 @@ 1850_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + F1850_C4 + 1850_CAM40_CLM50%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + FHIST_BDRD HIST_CAM60_CLM50%BGC-CROP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV_BGC%BDRD diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index e268387254..b60745c484 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -157,6 +157,17 @@ + + + + + + + + + + + @@ -271,7 +282,7 @@ - + @@ -303,7 +314,7 @@ - + @@ -313,7 +324,7 @@ - + @@ -322,7 +333,7 @@ - + @@ -330,60 +341,70 @@ + + + + + + + + + + - + - - + + - + - + + + - + - + + + - + - + + - - + - - + - - + - - + - @@ -421,6 +442,16 @@ + + + + + + + + + + @@ -503,28 +534,6 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -1034,26 +1043,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp/shell_commands b/cime_config/testdefs/testmods_dirs/cam/co2rmp/shell_commands index 17b0e95e59..eb40ad83e0 100644 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/co2rmp/shell_commands @@ -1,5 +1,2 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="2000-09-14" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/co2rmp/user_nl_cam index 18f6cf7791..73f058a2b6 100644 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/co2rmp/user_nl_cam @@ -1,13 +1,13 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 +nhtfrq=9,9,9,9,9,9 inithist='ENDOFRUN' -fexcl1='UU' + fincl1='T:I','PS:I' fincl2='T:A','PS:A' fincl3='T:X','PS:X' fincl4='T:M','PS:M' fincl5='PS','U200' fincl6='PS','TREFHTMX','TREFHTMN' -ramp_co2_start_ymd=20000915 + scenario_ghg='RAMP_CO2_ONLY' diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/shell_commands b/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/shell_commands deleted file mode 100644 index 17b0e95e59..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="2000-09-14" -./xmlchange START_TOD="82800" -./xmlchange CAM_NML_USE_CASE=UNSET diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cam deleted file mode 100644 index 9695e5f414..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cam +++ /dev/null @@ -1,16 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -fexcl1='UU' -fincl1='T:I','PS:I' -fincl2='T:A','PS:A' -fincl3='T:X','PS:X' -fincl4='T:M','PS:M' -fincl5='PS','U200' -fincl6='PS','TREFHTMX','TREFHTMN' -inithist='DAILY' -ramp_co2_start_ymd=20000915 -scenario_ghg='RAMP_CO2_ONLY' -start_tod=82800 -start_ymd=20000914 diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cpl b/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cpl deleted file mode 100644 index 398535cf65..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/user_nl_cpl +++ /dev/null @@ -1,2 +0,0 @@ -reprosum_diffmax=1.0e-14 -reprosum_recompute=.true. diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/shell_commands b/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/shell_commands deleted file mode 100644 index 0b1089d2b8..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -./xmlchange ROF_NCPL=\$ATM_NCPL -./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange RUN_STARTDATE="2000-09-14" -./xmlchange START_TOD="82800" diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_cam deleted file mode 100644 index 18f6cf7791..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_cam +++ /dev/null @@ -1,13 +0,0 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=3,3,3,3,3,3 -inithist='ENDOFRUN' -fexcl1='UU' -fincl1='T:I','PS:I' -fincl2='T:A','PS:A' -fincl3='T:X','PS:X' -fincl4='T:M','PS:M' -fincl5='PS','U200' -fincl6='PS','TREFHTMX','TREFHTMN' -ramp_co2_start_ymd=20000915 -scenario_ghg='RAMP_CO2_ONLY' diff --git a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_clm deleted file mode 100644 index f3ac27f1e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set glc_smb with GLC_SMB option -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- -hist_nhtfrq = 3 -hist_mfilt = 1 -hist_ndens = 1 - diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/shell_commands index ba00791e60..445d4954c6 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/shell_commands @@ -1,7 +1,3 @@ -./xmlchange --append CAM_CONFIG_OPTS="-psubcols 3" ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_NML_USE_CASE=UNSET -./xmlchange RUN_STARTDATE="19950101" -./xmlchange REST_OPTION="nsteps" -./xmlchange REST_N=3 +./xmlchange --append CAM_CONFIG_OPTS="-psubcols 3" diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/user_nl_cam index 836246015e..9981f8ee17 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/user_nl_cam @@ -2,7 +2,7 @@ mfilt=1,1,1,1,1,1 ndens=1,1,1,1,1,1 nhtfrq=3,3,3,3,3,3 inithist='ENDOFRUN' -pbuf_global_allocate=.false. + microp_uniform=.false. use_subcol_microp=.true. subcol_scheme='tstcp' diff --git a/doc/ChangeLog b/doc/ChangeLog index 7b065fc807..bf6fb7c19f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,108 @@ =============================================================== +Tag name: +Originator(s): +Date: +One-line Summary: testing updates +Github PR URL: + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: + +List all files eliminated: + +cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/* +cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/* +. remove unused testmods + +List all files added and what they do: + +List all existing files that have been modified, and describe the changes: + +cime_config/testdefs/testlist_cam.xml +. move the PLB tests from nag to gnu on izumi +. update mask, change ERP to ERC + replace + ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPC7.izumi_gnu.cam-outfrq9s + ERC_D_Ln9.f10_f10_mg37.FHIST_C5.izumi_gnu.cam-rad_diag/ + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag/ +. add subcol test on SE grid + replace + SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s + by + SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s +. move subcol test to F compset + replace + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol + by + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-outfrq3s_subcol +. replace + ERC_D_Ln9.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + ERC_D_Ln9.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s + + +cime_config/testdefs/testmods_dirs/cam/co2rmp/* +. modify to use default start date +. change to nhtfrq=9; use default for ramp_co2_start_ymd (begining of run) + +cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/* +. modify test to not unset the use case and use the default start date. + + + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + Tag name: cam6_4_109 Originator(s): eaton Date: 20 August 2025 From 5bb62e208b9eed3d0dfaf77a5abd25fe7fb451fb Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 22 Aug 2025 22:07:26 -0600 Subject: [PATCH 307/466] update sw cloud optics arguments --- .gitmodules | 2 +- src/atmos_phys | 2 +- src/physics/rrtmgp/radiation.F90 | 15 +++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 23a28105fb..1d766a0757 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = 4b494f6f03d0143983df28146f7f0a2f4c96e0f1 + fxtag = ad12f78752c62eadb03f28f68df0d4fb9678e575 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 4b494f6f03..ad12f78752 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 4b494f6f03d0143983df28146f7f0a2f4c96e0f1 +Subproject commit ad12f78752c62eadb03f28f68df0d4fb9678e575 diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 21e1e3c853..1ce5769840 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1202,14 +1202,13 @@ subroutine radiation_tend( & if (dosw) then ! Set cloud optical properties in cloud_sw object. - call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & - fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:,:), & - cldfgrau(:,:), cldfprime(:ncol,:), cld_tau(:,:ncol,:), grau_tau(:,:ncol,:), snow_tau(:,:ncol,:), degrau(:ncol,:), & - dei(:ncol,:), des(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), icswp(:ncol,:), icgrauwp(:ncol,:), tiny, ext_sw_liq, ssa_sw_liq, & - asm_sw_liq, ext_sw_ice, asm_sw_ice, ssa_sw_ice, g_mu, g_d_eff, g_lambda,& - idx_sw_diag, do_graupel, do_snow, kdist_sw, c_cld_tau(:,:ncol,:), & - c_cld_tau_w(:,:ncol,:), c_cld_tau_w_g(:,:ncol,:), rd%tot_cld_vistau(:ncol,:), rd%tot_icld_vistau(:ncol,:), & - rd%liq_icld_vistau(:ncol,:), rd%ice_icld_vistau(:ncol,:), & + call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & + fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:,:), & + cldfgrau(:,:), cldfprime(:ncol,:), cld_tau(:,:ncol,:), grau_tau(:,:ncol,:), snow_tau(:,:ncol,:), & + degrau(:ncol,:), dei(:ncol,:), des(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), icswp(:ncol,:), & + icgrauwp(:ncol,:), tiny, idx_sw_diag, do_graupel, do_snow, kdist_sw, c_cld_tau(:,:ncol,:), & + c_cld_tau_w(:,:ncol,:), c_cld_tau_w_g(:,:ncol,:), rd%tot_cld_vistau(:ncol,:), & + rd%tot_icld_vistau(:ncol,:), rd%liq_icld_vistau(:ncol,:), rd%ice_icld_vistau(:ncol,:), & rd%snow_icld_vistau(:ncol,:), rd%grau_icld_vistau(:ncol,:), errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) From 0f06715f2af50388bdfbcd713e04b7c356bab0da Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 22 Aug 2025 23:46:10 -0600 Subject: [PATCH 308/466] don't use graupel and snow cldfrac directly from pbuf --- src/physics/rrtmgp/radiation.F90 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 1ce5769840..d4c2972237 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1202,13 +1202,13 @@ subroutine radiation_tend( & if (dosw) then ! Set cloud optical properties in cloud_sw object. - call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & - fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow(:,:), & - cldfgrau(:,:), cldfprime(:ncol,:), cld_tau(:,:ncol,:), grau_tau(:,:ncol,:), snow_tau(:,:ncol,:), & - degrau(:ncol,:), dei(:ncol,:), des(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), icswp(:ncol,:), & - icgrauwp(:ncol,:), tiny, idx_sw_diag, do_graupel, do_snow, kdist_sw, c_cld_tau(:,:ncol,:), & - c_cld_tau_w(:,:ncol,:), c_cld_tau_w_g(:,:ncol,:), rd%tot_cld_vistau(:ncol,:), & - rd%tot_icld_vistau(:ncol,:), rd%liq_icld_vistau(:ncol,:), rd%ice_icld_vistau(:ncol,:), & + call rrtmgp_sw_cloud_optics_run(dosw, ncol, pver, ktopcam, ktoprad, nlay, nswgpts, nday, idxday, & + fillvalue, nswbands, iulog, mu(:ncol,:), lambda(:ncol,:), nnite, idxnite, cld, cldfsnow_in, & + cldfgrau_in, cldfprime(:ncol,:), cld_tau(:,:ncol,:), grau_tau(:,:ncol,:), snow_tau(:,:ncol,:), & + degrau(:ncol,:), dei(:ncol,:), des(:ncol,:), iclwp(:ncol,:), iciwp(:ncol,:), icswp(:ncol,:), & + icgrauwp(:ncol,:), tiny, idx_sw_diag, do_graupel, do_snow, kdist_sw, c_cld_tau(:,:ncol,:), & + c_cld_tau_w(:,:ncol,:), c_cld_tau_w_g(:,:ncol,:), rd%tot_cld_vistau(:ncol,:), & + rd%tot_icld_vistau(:ncol,:), rd%liq_icld_vistau(:ncol,:), rd%ice_icld_vistau(:ncol,:), & rd%snow_icld_vistau(:ncol,:), rd%grau_icld_vistau(:ncol,:), errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) From b745acbb6d6279b6446b18e01c76680d724528e7 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Mon, 25 Aug 2025 11:08:23 -0400 Subject: [PATCH 309/466] testing updates for cam4 --- cime_config/config_compsets.xml | 5 ---- cime_config/testdefs/testlist_cam.xml | 39 ++++++++++++++------------- doc/ChangeLog | 30 ++++++++++++++++++++- 3 files changed, 49 insertions(+), 25 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 35aef55a86..0521731823 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -207,11 +207,6 @@ 2000_CAM40%TMOZ_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC41850 - 1850_CAM40_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV - - QPC4X 2000_CAM40%WX_SLND_SICE_DOCN%AQP3_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index b60745c484..5fc4369d2a 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -351,6 +351,16 @@ + + + + + + + + + + @@ -1053,16 +1063,6 @@ - - - - - - - - - - @@ -1095,7 +1095,7 @@ - + @@ -1724,13 +1724,13 @@ - + + - @@ -2514,13 +2514,13 @@ - + + - @@ -2542,12 +2542,12 @@ - + - + @@ -2566,13 +2566,14 @@ - + + @@ -2581,8 +2582,8 @@ + - diff --git a/doc/ChangeLog b/doc/ChangeLog index bf6fb7c19f..bb5ef205cb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -28,6 +28,9 @@ List all files added and what they do: List all existing files that have been modified, and describe the changes: +cime_config/config_compsets.xml +. remove unused QPC41850 + cime_config/testdefs/testlist_cam.xml . move the PLB tests from nag to gnu on izumi . update mask, change ERP to ERC @@ -47,11 +50,36 @@ cime_config/testdefs/testlist_cam.xml ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol by ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-outfrq3s_subcol -. replace +. consolidate tests, update mask + replace ERC_D_Ln9.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase ERC_D_Ln9.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s +. move cam4 ERI test to F compset. + replace + ERI_D_Ln18.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase + by + ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri +. consolidate cam4 co2rmp test with existing test. + replace + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C4.izumi_gnu.cam-outfrq9s + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp +. update mask + replace + SMS_D_Ld2.f45_f45_mg37.PC5.izumi_nag.cam-outfrq24h_port + SMS_D_Ld5.f19_f19_mg17.PC4.derecho_intel.cam-cam4_port5d + SMS_Ld5.f09_f09_mg17.PC6.derecho_intel.cam-cam6_port_f09 + ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp + by + SMS_D_Ld2.f45_f45_mt232.PC5.izumi_nag.cam-outfrq24h_port + SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d + SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 + ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp + + + cime_config/testdefs/testmods_dirs/cam/co2rmp/* From b114109320dff801a7ec4d64b97303c815ebf723 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 25 Aug 2025 16:38:49 -0400 Subject: [PATCH 310/466] Zero out HB below where CLUBB is active in the free_atm_diff scheme. --- src/physics/cam/vertical_diffusion.F90 | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 42eec51d89..0df4cd516f 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -870,6 +870,7 @@ subroutine vertical_diffusion_tend( & real(r8) :: shflux(pcols) real(r8) :: cflux(pcols,pcnst) integer, pointer :: clubbtop(:) ! (pcols) + real(r8) :: clubbtop_r(pcols) logical :: lq(pcnst) @@ -1264,6 +1265,9 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + call pbuf_get_field(pbuf, clubbtop_idx, clubbtop) + clubbtop_r = real(clubbtop, r8) + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists kvm(:,:) = 0._r8 kvh(:,:) = 0._r8 @@ -1278,6 +1282,8 @@ subroutine vertical_diffusion_tend( & ! Input from hb_pbl_independent_coefficients s2 = s2(:ncol,:pver), & ri = ri(:ncol,:pver), & + ! Zero out HB below this level, where CLUBB is active: + bottom_boundary = clubbtop_r(:ncol), & ! Output variables kvm = kvm(:ncol,:pverp), & kvh = kvh(:ncol,:pverp), & @@ -1287,20 +1293,6 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) - call pbuf_get_field(pbuf, clubbtop_idx, clubbtop) - ! - ! zero out HB where CLUBB is active - ! - do i=1,ncol - do k=clubbtop(i),pverp - kvm(i,k) = 0.0_r8 - kvh(i,k) = 0.0_r8 - kvq(i,k) = 0.0_r8 - cgs(i,k) = 0.0_r8 - cgh(i,k) = 0.0_r8 - end do - end do - call outfld( 'HB_ri', ri, pcols, lchnk ) else ! CLUBB has only a bare-bones placeholder here. If using CLUBB, the From 8a95868da0dd09a0dc39fd5a4469de6bdaa36f7a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 25 Aug 2025 16:39:03 -0400 Subject: [PATCH 311/466] Output clubbtop pbuf field as real by converting from integer --- src/control/cam_snapshot_common.F90 | 49 +++++++++++++++++++---------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index 859295a4ba..8e0575589e 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -84,7 +84,7 @@ module cam_snapshot_common type (snapshot_type) :: state_snapshot(30) type (snapshot_type) :: cnst_snapshot(pcnst) type (snapshot_type) :: tend_snapshot(6) -type (snapshot_type) :: cam_in_snapshot(30) +type (snapshot_type) :: cam_in_snapshot(200) ! needs to be bigger than pcnst because cam_in is split by constituent. type (snapshot_type) :: cam_out_snapshot(30) type (snapshot_type_nd) :: pbuf_snapshot(300) @@ -1218,6 +1218,9 @@ subroutine cam_pbuf_snapshot_all_outfld(lchnk, file_num, pbuf) real(r8), pointer, dimension(:,:,:,:) :: tmpptr4d real(r8), pointer, dimension(:,:,:,:,:) :: tmpptr5d + ! Special handling of integer type fields (output as real) + integer, pointer, dimension(:,:) :: tmpptr2d_int + do i=1, npbuf_var @@ -1227,28 +1230,40 @@ subroutine cam_pbuf_snapshot_all_outfld(lchnk, file_num, pbuf) ! Turn on the writing for only the requested tape (file_num) call cam_history_snapshot_activate(trim(pbuf_snapshot(i)%standard_name), file_num) - ! Retrieve the pbuf data (dependent on the number of dimensions) - ndims = count(pbuf_snapshot(i)%dim_name(:) /= '') + ! Retrieve the pbuf data. Special handling for certain + ! integer-type fields. + if( trim(pbuf_snapshot(i)%ddt_string) == 'clubbtop') then + call pbuf_get_field(pbuf, pbuf_idx, tmpptr2d_int) + ! copy into real + allocate(tmpptr2d(size(tmpptr2d_int, 1), size(tmpptr2d_int, 2))) + tmpptr2d = real(tmpptr2d_int, r8) + call outfld(pbuf_snapshot(i)%standard_name, tmpptr2d, pcols, lchnk) + deallocate(tmpptr2d) + else + ! For regular real-type data: + ! Retrieve the pbuf data (dependent on the number of dimensions) + ndims = count(pbuf_snapshot(i)%dim_name(:) /= '') - select case (ndims) ! Note that dimension 5 and 6 do not work with pbuf_get_field, so these are not used here + select case (ndims) ! Note that dimension 5 and 6 do not work with pbuf_get_field, so these are not used here - case (1) - call pbuf_get_field(pbuf, pbuf_idx, tmpptr2d) - call outfld(pbuf_snapshot(i)%standard_name, tmpptr2d, pcols, lchnk) + case (1) + call pbuf_get_field(pbuf, pbuf_idx, tmpptr2d) + call outfld(pbuf_snapshot(i)%standard_name, tmpptr2d, pcols, lchnk) - case (2) - call pbuf_get_field(pbuf, pbuf_idx, tmpptr3d) - call outfld(pbuf_snapshot(i)%standard_name, tmpptr3d, pcols, lchnk) + case (2) + call pbuf_get_field(pbuf, pbuf_idx, tmpptr3d) + call outfld(pbuf_snapshot(i)%standard_name, tmpptr3d, pcols, lchnk) - case (3) - call pbuf_get_field(pbuf, pbuf_idx, tmpptr3d) - call outfld(pbuf_snapshot(i)%standard_name, tmpptr4d, pcols, lchnk) + case (3) + call pbuf_get_field(pbuf, pbuf_idx, tmpptr3d) + call outfld(pbuf_snapshot(i)%standard_name, tmpptr4d, pcols, lchnk) - case (4) - call pbuf_get_field(pbuf, pbuf_idx, tmpptr5d) - call outfld(pbuf_snapshot(i)%standard_name, tmpptr5d, pcols, lchnk) + case (4) + call pbuf_get_field(pbuf, pbuf_idx, tmpptr5d) + call outfld(pbuf_snapshot(i)%standard_name, tmpptr5d, pcols, lchnk) - end select + end select + endif ! Now that the field has been written, turn off the writing for field call cam_history_snapshot_deactivate(trim(pbuf_snapshot(i)%standard_name)) From cb6704808a6379b10b4c219876b121c3ee17994e Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 25 Aug 2025 15:47:57 -0600 Subject: [PATCH 312/466] Modifications to handle PUMAS external being moved to atmos_phys --- .gitmodules | 9 +-------- bld/build-namelist | 2 +- bld/configure | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index cfa3336bce..ca27ea0086 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,13 +12,6 @@ fxtag = carma4_09 fxDONOTUSEurl = https://github.com/ESCOMP/CARMA_base.git -[submodule "pumas"] - path = src/physics/pumas - url = https://github.com/ESCOMP/PUMAS - fxrequired = AlwaysRequired - fxtag = pumas_cam-release_v1.39 - fxDONOTUSEurl = https://github.com/ESCOMP/PUMAS - [submodule "pumas-frozen"] path = src/physics/pumas-frozen url = https://github.com/ESCOMP/PUMAS @@ -36,7 +29,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_15_000 + fxtag = atmos_phys0_16_000 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/bld/build-namelist b/bld/build-namelist index 0dddc28b9f..90972d850a 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3339,7 +3339,7 @@ if ($cfg->get('microphys') =~ /^mg/) { add_default($nl, 'micro_mg_accre_sees_auto'); add_default($nl, 'micro_mg_vtrms_factor'); add_default($nl, 'micro_mg_implicit_fall'); - add_default($nl, 'pumas_stochastic_tau_kernel_filename', 'val'=>"$cfgdir/../src/physics/pumas/KBARF_tau_kernel.dat"); + add_default($nl, 'pumas_stochastic_tau_kernel_filename', 'val'=>"$cfgdir/../src/atmos_phys/pumas/pumas/KBARF_tau_kernel.dat"); #set path for stochastic_tau_kernel_filename my $cam_dir = $cfg->get('cam_dir'); diff --git a/bld/configure b/bld/configure index 65a2457f88..52bfdaaa9c 100755 --- a/bld/configure +++ b/bld/configure @@ -2161,7 +2161,7 @@ sub write_filepath } if ($phys_pkg eq 'cam7') { - print $fh "$camsrcdir/src/physics/pumas\n"; + print $fh "$camsrcdir/src/atmos_phys/schemes/pumas/pumas\n"; } else { print $fh "$camsrcdir/src/physics/pumas-frozen\n"; } From 16a2d11902c8332eac722962d49e2abca3cb5b33 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 25 Aug 2025 16:00:54 -0600 Subject: [PATCH 313/466] update atmos_phys external --- src/physics/pumas | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/physics/pumas diff --git a/src/physics/pumas b/src/physics/pumas deleted file mode 160000 index 5f6e420d95..0000000000 --- a/src/physics/pumas +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5f6e420d9530aee8595d33c95dfbfec53867ced5 From 6b15fd4a1e029c75c2e0da802ea024a910dda317 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Mon, 25 Aug 2025 16:01:02 -0600 Subject: [PATCH 314/466] Simone's changes for fifth mode modified: src/chemistry/utils/prescribed_strataero.F90 --- src/chemistry/utils/prescribed_strataero.F90 | 76 ++++++++++++++------ 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/src/chemistry/utils/prescribed_strataero.F90 b/src/chemistry/utils/prescribed_strataero.F90 index cb3f00b8d7..e50cc5c8d3 100644 --- a/src/chemistry/utils/prescribed_strataero.F90 +++ b/src/chemistry/utils/prescribed_strataero.F90 @@ -12,7 +12,7 @@ module prescribed_strataero implicit none private - save + save type(trfld), pointer :: fields(:) type(trfile) :: file @@ -37,21 +37,28 @@ module prescribed_strataero character(len=16), parameter :: mmr_name1 = 'VOLC_MMR1' character(len=16), parameter :: mmr_name2 = 'VOLC_MMR2' character(len=16), parameter :: mmr_name3 = 'VOLC_MMR3' + character(len=16), parameter :: mmr_name5 = 'VOLC_MMR5' character(len=16), parameter :: rad_name1 = 'VOLC_RAD_GEOM1' character(len=16), parameter :: rad_name2 = 'VOLC_RAD_GEOM2' character(len=16), parameter :: rad_name3 = 'VOLC_RAD_GEOM3' + character(len=16), parameter :: rad_name5 = 'VOLC_RAD_GEOM5' character(len=16), parameter :: mass_name1 = 'VOLC_MASS1' character(len=16), parameter :: mass_name2 = 'VOLC_MASS2' character(len=16), parameter :: mass_name3 = 'VOLC_MASS3' + character(len=16), parameter :: mass_name5 = 'VOLC_MASS5' character(len=16), parameter :: mass_column_name1 = 'VOLC_MASS_C1' character(len=16), parameter :: mass_column_name2 = 'VOLC_MASS_C2' character(len=16), parameter :: mass_column_name3 = 'VOLC_MASS_C3' + character(len=16), parameter :: mass_column_name5 = 'VOLC_MASS_C5' character(len=16), parameter :: dens_name1 = 'VOLC_DENS1' character(len=16), parameter :: dens_name2 = 'VOLC_DENS2' character(len=16), parameter :: dens_name3 = 'VOLC_DENS3' + character(len=16), parameter :: dens_name5 = 'VOLC_DENS5' + + integer, parameter :: MAXN = 9 ! These variables are settable via the namelist (with longer names) - character(len=32) :: specifier(7) = ' ' + character(len=32) :: specifier(MAXN) = ' ' character(len=256) :: filename = 'NONE' character(len=256) :: filelist = '' character(len=256) :: datapath = '' @@ -63,10 +70,12 @@ module prescribed_strataero integer :: rad_ndx1 = -1 integer :: rad_ndx2 = -1 integer :: rad_ndx3 = -1 + integer :: rad_ndx5 = -1 integer :: sad_ndx = -1 integer :: mmr_ndx1 = -1 integer :: mmr_ndx2 = -1 integer :: mmr_ndx3 = -1 + integer :: mmr_ndx5 = -1 logical :: prescribed_strataero_use_chemtrop = .false. logical :: three_mode = .true. @@ -88,7 +97,7 @@ subroutine prescribed_strataero_readnl(nlfile) integer :: unitn, ierr character(len=*), parameter :: subname = 'prescribed_strataero_readnl' - character(len=32) :: prescribed_strataero_specifier(7) + character(len=32) :: prescribed_strataero_specifier(MAXN) character(len=256) :: prescribed_strataero_file character(len=256) :: prescribed_strataero_filelist character(len=256) :: prescribed_strataero_datapath @@ -139,7 +148,7 @@ subroutine prescribed_strataero_readnl(nlfile) #ifdef SPMD ! Broadcast namelist variables - call mpibcast(prescribed_strataero_specifier,len(prescribed_strataero_specifier)*7, mpichar, 0, mpicom) + call mpibcast(prescribed_strataero_specifier,len(prescribed_strataero_specifier)*MAXN, mpichar, 0, mpicom) call mpibcast(prescribed_strataero_file, len(prescribed_strataero_file), mpichar, 0, mpicom) call mpibcast(prescribed_strataero_filelist, len(prescribed_strataero_filelist), mpichar, 0, mpicom) call mpibcast(prescribed_strataero_datapath, len(prescribed_strataero_datapath), mpichar, 0, mpicom) @@ -197,12 +206,16 @@ subroutine prescribed_strataero_register() three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a3', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + ierr = pio_inq_varid( file_handle, 'so4mass_a5', varid ) + three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a1', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a2', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a3', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + ierr = pio_inq_varid( file_handle, 'diamwet_a5', varid ) + three_mode = three_mode .and. (ierr.eq.PIO_NOERR) call pio_seterrorhandling(file_handle, PIO_INTERNAL_ERROR) @@ -212,19 +225,23 @@ subroutine prescribed_strataero_register() call pbuf_add_field(mmr_name1, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx1) call pbuf_add_field(mmr_name2, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx2) call pbuf_add_field(mmr_name3, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx3) + call pbuf_add_field(mmr_name5, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx5) call pbuf_add_field(rad_name1, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx1) call pbuf_add_field(rad_name2, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx2) call pbuf_add_field(rad_name3, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx3) + call pbuf_add_field(rad_name5, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx5) call pbuf_add_field(sad_name, 'physpkg', dtype_r8,(/pcols,pver/), sad_ndx) - specifier(1:7) = (/'VOLC_MMR1:so4mass_a1 ', & - 'VOLC_MMR2:so4mass_a2 ', & - 'VOLC_MMR3:so4mass_a3 ', & - 'VOLC_RAD_GEOM1:diamwet_a1 ', & - 'VOLC_RAD_GEOM2:diamwet_a2 ', & - 'VOLC_RAD_GEOM3:diamwet_a3 ', & - 'VOLC_SAD:SAD_AERO ' /) - rad_fld_no = 4 - sad_fld_no = 7 + specifier(1:MAXN) = (/'VOLC_MMR1:so4mass_a1 ', & + 'VOLC_MMR2:so4mass_a2 ', & + 'VOLC_MMR3:so4mass_a3 ', & + 'VOLC_MMR5:so4mass_a5 ', & + 'VOLC_RAD_GEOM1:diamwet_a1 ', & + 'VOLC_RAD_GEOM2:diamwet_a2 ', & + 'VOLC_RAD_GEOM3:diamwet_a3 ', & + 'VOLC_RAD_GEOM5:diamwet_a5 ', & + 'VOLC_SAD:SAD_AERO ' /) + rad_fld_no = 5 + sad_fld_no = 9 else if (masterproc) then write(iulog, *) ' pbuf add mmr_name = '//trim(mmr_name) @@ -249,7 +266,7 @@ subroutine prescribed_strataero_init() use tracer_data, only : trcdata_init use cam_history, only : addfld, horiz_only use error_messages, only: handle_err - + if ( has_prescribed_strataero ) then if ( masterproc ) then write(iulog,*) 'stratospheric aerosol is prescribed in :'//trim(filename) @@ -269,18 +286,23 @@ subroutine prescribed_strataero_init() call addfld(dens_name1, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 1' ) call addfld(dens_name2, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 2' ) call addfld(dens_name3, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 3' ) + call addfld(dens_name5, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 5' ) call addfld(mmr_name1, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 1' ) call addfld(mmr_name2, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 2' ) call addfld(mmr_name3, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 3' ) + call addfld(mmr_name5, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 5' ) call addfld(rad_name1, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 1' ) call addfld(rad_name2, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 2' ) call addfld(rad_name3, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 3' ) + call addfld(rad_name5, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 5' ) call addfld(mass_name1, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 1' ) call addfld(mass_name2, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 2' ) call addfld(mass_name3, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 3' ) + call addfld(mass_name5, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 5' ) call addfld(mass_column_name1, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass in Mode 1' ) call addfld(mass_column_name2, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass in Mode 2' ) call addfld(mass_column_name3, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass IN Mode 3' ) + call addfld(mass_column_name5, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass IN Mode 5' ) else call addfld(dens_name, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density' ) call addfld(mmr_name, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio' ) @@ -309,31 +331,35 @@ subroutine prescribed_strataero_adv( state, pbuf2d) use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_get_chunk use physconst, only : pi - type(physics_state), intent(in) :: state(begchunk:endchunk) - + type(physics_state), intent(in) :: state(begchunk:endchunk) + type(physics_buffer_desc), pointer :: pbuf2d(:,:) type(physics_buffer_desc), pointer :: pbuf_chnk(:) integer :: c,ncol,i,k real(r8) :: to_mmr(pcols,pver) - real(r8), parameter :: molmass = 4._r8/3._r8*98.0_r8 !convert dry mass to wet mass of h2so4 + real(r8), parameter :: molmass = 4._r8/3._r8*98.0_r8 !convert dry mass to wet mass of h2so4 real(r8) :: volcmass1(pcols,pver) real(r8) :: volcmass2(pcols,pver) real(r8) :: volcmass3(pcols,pver) + real(r8) :: volcmass5(pcols,pver) real(r8) :: columnmass1(pcols) real(r8) :: columnmass2(pcols) real(r8) :: columnmass3(pcols) + real(r8) :: columnmass5(pcols) integer :: tropLev(pcols) real(r8) :: area_fact, radius_fact real(r8), pointer :: mass1(:,:) real(r8), pointer :: mass2(:,:) real(r8), pointer :: mass3(:,:) + real(r8), pointer :: mass5(:,:) real(r8), pointer :: area(:,:) real(r8), pointer :: radius1(:,:) real(r8), pointer :: radius2(:,:) real(r8), pointer :: radius3(:,:) + real(r8), pointer :: radius5(:,:) !WACCM-derived relation between mass concentration and wet aerosol radius in meters real(r8),parameter :: radius_conversion = 1.9e-4_r8 @@ -367,11 +393,13 @@ subroutine prescribed_strataero_adv( state, pbuf2d) if (mmr_ndx1>0) call pbuf_get_field(pbuf_chnk, mmr_ndx1, mass1) if (mmr_ndx2>0) call pbuf_get_field(pbuf_chnk, mmr_ndx2, mass2) if (mmr_ndx3>0) call pbuf_get_field(pbuf_chnk, mmr_ndx3, mass3) + if (mmr_ndx5>0) call pbuf_get_field(pbuf_chnk, mmr_ndx5, mass5) if (three_mode) then call outfld( dens_name1, mass1(:,:), pcols, state(c)%lchnk) call outfld( dens_name2, mass2(:,:), pcols, state(c)%lchnk) call outfld( dens_name3, mass3(:,:), pcols, state(c)%lchnk) + call outfld( dens_name5, mass5(:,:), pcols, state(c)%lchnk) else call outfld( dens_name, mass1(:,:), pcols, state(c)%lchnk) endif @@ -379,10 +407,12 @@ subroutine prescribed_strataero_adv( state, pbuf2d) if (mmr_ndx1>0) mass1(:ncol,:) = to_mmr(:ncol,:) * mass1(:ncol,:) ! mmr if (mmr_ndx2>0) mass2(:ncol,:) = to_mmr(:ncol,:) * mass2(:ncol,:) ! mmr if (mmr_ndx3>0) mass3(:ncol,:) = to_mmr(:ncol,:) * mass3(:ncol,:) ! mmr + if (mmr_ndx5>0) mass5(:ncol,:) = to_mmr(:ncol,:) * mass5(:ncol,:) ! mmr if (rad_ndx1>0) call pbuf_get_field(pbuf_chnk, rad_ndx1, radius1) if (rad_ndx2>0) call pbuf_get_field(pbuf_chnk, rad_ndx2, radius2) if (rad_ndx3>0) call pbuf_get_field(pbuf_chnk, rad_ndx3, radius3) + if (rad_ndx5>0) call pbuf_get_field(pbuf_chnk, rad_ndx5, radius5) select case ( to_lower(trim(fields(rad_fld_no)%units(:GLC(fields(rad_fld_no)%units)))) ) case ("m","meters") @@ -399,6 +429,7 @@ subroutine prescribed_strataero_adv( state, pbuf2d) radius1(:ncol,:) = radius_fact*radius1(:ncol,:)*0.5_r8 radius2(:ncol,:) = radius_fact*radius2(:ncol,:)*0.5_r8 radius3(:ncol,:) = radius_fact*radius3(:ncol,:)*0.5_r8 + radius5(:ncol,:) = radius_fact*radius5(:ncol,:)*0.5_r8 else radius1(:ncol,:) = radius_fact*radius1(:ncol,:) endif @@ -418,9 +449,6 @@ subroutine prescribed_strataero_adv( state, pbuf2d) area(:ncol,:) = area_fact*area(:ncol,:) ! this definition of tropopause is consistent with what is used in chemistry - !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists - tropLev = 0 - !REMOVECAM_END call tropopause_findChemTrop(state(c), tropLev) do i = 1,ncol @@ -434,9 +462,11 @@ subroutine prescribed_strataero_adv( state, pbuf2d) if (mmr_ndx1>0) mass1(i,k) = 0._r8 if (mmr_ndx2>0) mass2(i,k) = 0._r8 if (mmr_ndx3>0) mass3(i,k) = 0._r8 + if (mmr_ndx5>0) mass5(i,k) = 0._r8 if (rad_ndx1>0) radius1(i,k) = 0._r8 if (rad_ndx2>0) radius2(i,k) = 0._r8 if (rad_ndx3>0) radius3(i,k) = 0._r8 + if (rad_ndx5>0) radius5(i,k) = 0._r8 area(i,k) = 0._r8 endif enddo @@ -448,20 +478,26 @@ subroutine prescribed_strataero_adv( state, pbuf2d) if (three_mode) then volcmass2(:ncol,:) = mass2(:ncol,:)*state(c)%pdel(:ncol,:)/gravit volcmass3(:ncol,:) = mass3(:ncol,:)*state(c)%pdel(:ncol,:)/gravit + volcmass5(:ncol,:) = mass5(:ncol,:)*state(c)%pdel(:ncol,:)/gravit columnmass2(:ncol) = sum(volcmass2(:ncol,:), 2) columnmass3(:ncol) = sum(volcmass3(:ncol,:), 2) + columnmass5(:ncol) = sum(volcmass5(:ncol,:), 2) call outfld( mmr_name1, mass1(:,:), pcols, state(c)%lchnk) call outfld( mmr_name2, mass2(:,:), pcols, state(c)%lchnk) call outfld( mmr_name3, mass3(:,:), pcols, state(c)%lchnk) + call outfld( mmr_name5, mass5(:,:), pcols, state(c)%lchnk) call outfld( mass_name1, volcmass1(:,:), pcols, state(c)%lchnk) call outfld( mass_name2, volcmass2(:,:), pcols, state(c)%lchnk) call outfld( mass_name3, volcmass3(:,:), pcols, state(c)%lchnk) + call outfld( mass_name5, volcmass5(:,:), pcols, state(c)%lchnk) call outfld( mass_column_name1, columnmass1(:), pcols, state(c)%lchnk) call outfld( mass_column_name2, columnmass2(:), pcols, state(c)%lchnk) call outfld( mass_column_name3, columnmass3(:), pcols, state(c)%lchnk) + call outfld( mass_column_name5, columnmass5(:), pcols, state(c)%lchnk) call outfld( rad_name1, radius1(:,:), pcols, state(c)%lchnk) call outfld( rad_name2, radius2(:,:), pcols, state(c)%lchnk) call outfld( rad_name3, radius3(:,:), pcols, state(c)%lchnk) + call outfld( rad_name5, radius5(:,:), pcols, state(c)%lchnk) else call outfld( mmr_name, mass1(:,:), pcols, state(c)%lchnk) call outfld( mass_name, volcmass1(:,:), pcols, state(c)%lchnk) From 9225e7341bf3e9518b4d11bf6a69ae0bd57d2876 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 25 Aug 2025 16:18:44 -0600 Subject: [PATCH 315/466] update atmos_phys external --- src/atmos_phys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atmos_phys b/src/atmos_phys index e4d9da925b..abf7f40fa4 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit e4d9da925ba44f503f85a9aef1b7fe972bb9f25f +Subproject commit abf7f40fa4145c522e3e94e2cccb0a6fc3fad0be From 7100e094ca32e021ff297daf1c976ba10a792521 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Mon, 25 Aug 2025 19:42:47 -0600 Subject: [PATCH 316/466] fix backwards compatibility issues modified: src/chemistry/utils/prescribed_strataero.F90 --- src/chemistry/utils/prescribed_strataero.F90 | 73 ++++++++++++++------ 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/src/chemistry/utils/prescribed_strataero.F90 b/src/chemistry/utils/prescribed_strataero.F90 index e50cc5c8d3..ed925c2475 100644 --- a/src/chemistry/utils/prescribed_strataero.F90 +++ b/src/chemistry/utils/prescribed_strataero.F90 @@ -78,7 +78,8 @@ module prescribed_strataero integer :: mmr_ndx5 = -1 logical :: prescribed_strataero_use_chemtrop = .false. - logical :: three_mode = .true. + logical :: three_mode = .false. + logical :: five_mode = .false. integer :: rad_fld_no=-1, sad_fld_no=-1 contains @@ -201,27 +202,47 @@ subroutine prescribed_strataero_register() call pio_seterrorhandling(file_handle, PIO_BCAST_ERROR) ierr = pio_inq_varid( file_handle, 'so4mass_a1', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a2', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a3', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) - ierr = pio_inq_varid( file_handle, 'so4mass_a5', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a1', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a2', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a3', varid ) three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + + ierr = pio_inq_varid( file_handle, 'so4mass_a5', varid ) + five_mode = (ierr.eq.PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a5', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + five_mode = five_mode .and. (ierr.eq.PIO_NOERR) + + three_mode = three_mode .and. (.not.five_mode) call pio_seterrorhandling(file_handle, PIO_INTERNAL_ERROR) call pio_closefile( file_handle ) if (three_mode) then + call pbuf_add_field(mmr_name1, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx1) + call pbuf_add_field(mmr_name2, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx2) + call pbuf_add_field(mmr_name3, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx3) + call pbuf_add_field(rad_name1, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx1) + call pbuf_add_field(rad_name2, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx2) + call pbuf_add_field(rad_name3, 'physpkg', dtype_r8,(/pcols,pver/), rad_ndx3) + call pbuf_add_field(sad_name, 'physpkg', dtype_r8,(/pcols,pver/), sad_ndx) + specifier(1:7) = (/'VOLC_MMR1:so4mass_a1 ', & + 'VOLC_MMR2:so4mass_a2 ', & + 'VOLC_MMR3:so4mass_a3 ', & + 'VOLC_RAD_GEOM1:diamwet_a1 ', & + 'VOLC_RAD_GEOM2:diamwet_a2 ', & + 'VOLC_RAD_GEOM3:diamwet_a3 ', & + 'VOLC_SAD:SAD_AERO ' /) + rad_fld_no = 4 + sad_fld_no = 7 + else if (five_mode) then call pbuf_add_field(mmr_name1, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx1) call pbuf_add_field(mmr_name2, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx2) call pbuf_add_field(mmr_name3, 'physpkg', dtype_r8,(/pcols,pver/), mmr_ndx3) @@ -282,27 +303,29 @@ subroutine prescribed_strataero_init() call trcdata_init( specifier, filename, filelist, datapath, fields, file, & rmv_file, cycle_yr, fixed_ymd, fixed_tod, data_type) - if (three_mode) then + if (three_mode.or.five_mode) then call addfld(dens_name1, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 1' ) call addfld(dens_name2, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 2' ) call addfld(dens_name3, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 3' ) - call addfld(dens_name5, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 5' ) call addfld(mmr_name1, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 1' ) call addfld(mmr_name2, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 2' ) call addfld(mmr_name3, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 3' ) - call addfld(mmr_name5, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 5' ) call addfld(rad_name1, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 1' ) call addfld(rad_name2, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 2' ) call addfld(rad_name3, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 3' ) - call addfld(rad_name5, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 5' ) call addfld(mass_name1, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 1' ) call addfld(mass_name2, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 2' ) call addfld(mass_name3, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 3' ) - call addfld(mass_name5, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 5' ) call addfld(mass_column_name1, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass in Mode 1' ) call addfld(mass_column_name2, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass in Mode 2' ) call addfld(mass_column_name3, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass IN Mode 3' ) - call addfld(mass_column_name5, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass IN Mode 5' ) + if (five_mode) then + call addfld(dens_name5, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density in Mode 5' ) + call addfld(mmr_name5, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio in Mode 5' ) + call addfld(rad_name5, (/ 'lev' /), 'I','m', 'volcanic aerosol geometric-mode radius in Mode 5' ) + call addfld(mass_name5, (/ 'lev' /), 'I','kg/m^2', 'volcanic aerosol vertical mass path in layer in Mode 5' ) + call addfld(mass_column_name5, horiz_only, 'I','kg/m^2', 'volcanic aerosol column mass IN Mode 5' ) + end if else call addfld(dens_name, (/ 'lev' /), 'I','molecules/cm3', 'prescribed volcanic aerosol number density' ) call addfld(mmr_name, (/ 'lev' /), 'I','kg/kg', 'prescribed volcanic aerosol dry mass mixing ratio' ) @@ -395,11 +418,13 @@ subroutine prescribed_strataero_adv( state, pbuf2d) if (mmr_ndx3>0) call pbuf_get_field(pbuf_chnk, mmr_ndx3, mass3) if (mmr_ndx5>0) call pbuf_get_field(pbuf_chnk, mmr_ndx5, mass5) - if (three_mode) then + if (three_mode.or.five_mode) then call outfld( dens_name1, mass1(:,:), pcols, state(c)%lchnk) call outfld( dens_name2, mass2(:,:), pcols, state(c)%lchnk) call outfld( dens_name3, mass3(:,:), pcols, state(c)%lchnk) - call outfld( dens_name5, mass5(:,:), pcols, state(c)%lchnk) + if (five_mode) then + call outfld( dens_name5, mass5(:,:), pcols, state(c)%lchnk) + end if else call outfld( dens_name, mass1(:,:), pcols, state(c)%lchnk) endif @@ -425,11 +450,13 @@ subroutine prescribed_strataero_adv( state, pbuf2d) end select !MAM output is diamter so we need to half the value - if (three_mode) then + if (three_mode.or.five_mode) then radius1(:ncol,:) = radius_fact*radius1(:ncol,:)*0.5_r8 radius2(:ncol,:) = radius_fact*radius2(:ncol,:)*0.5_r8 radius3(:ncol,:) = radius_fact*radius3(:ncol,:)*0.5_r8 - radius5(:ncol,:) = radius_fact*radius5(:ncol,:)*0.5_r8 + if (five_mode) then + radius5(:ncol,:) = radius_fact*radius5(:ncol,:)*0.5_r8 + end if else radius1(:ncol,:) = radius_fact*radius1(:ncol,:) endif @@ -475,29 +502,31 @@ subroutine prescribed_strataero_adv( state, pbuf2d) volcmass1(:ncol,:) = mass1(:ncol,:)*state(c)%pdel(:ncol,:)/gravit columnmass1(:ncol) = sum(volcmass1(:ncol,:), 2) - if (three_mode) then + if (three_mode.or.five_mode) then volcmass2(:ncol,:) = mass2(:ncol,:)*state(c)%pdel(:ncol,:)/gravit volcmass3(:ncol,:) = mass3(:ncol,:)*state(c)%pdel(:ncol,:)/gravit - volcmass5(:ncol,:) = mass5(:ncol,:)*state(c)%pdel(:ncol,:)/gravit columnmass2(:ncol) = sum(volcmass2(:ncol,:), 2) columnmass3(:ncol) = sum(volcmass3(:ncol,:), 2) - columnmass5(:ncol) = sum(volcmass5(:ncol,:), 2) call outfld( mmr_name1, mass1(:,:), pcols, state(c)%lchnk) call outfld( mmr_name2, mass2(:,:), pcols, state(c)%lchnk) call outfld( mmr_name3, mass3(:,:), pcols, state(c)%lchnk) - call outfld( mmr_name5, mass5(:,:), pcols, state(c)%lchnk) call outfld( mass_name1, volcmass1(:,:), pcols, state(c)%lchnk) call outfld( mass_name2, volcmass2(:,:), pcols, state(c)%lchnk) call outfld( mass_name3, volcmass3(:,:), pcols, state(c)%lchnk) - call outfld( mass_name5, volcmass5(:,:), pcols, state(c)%lchnk) call outfld( mass_column_name1, columnmass1(:), pcols, state(c)%lchnk) call outfld( mass_column_name2, columnmass2(:), pcols, state(c)%lchnk) call outfld( mass_column_name3, columnmass3(:), pcols, state(c)%lchnk) - call outfld( mass_column_name5, columnmass5(:), pcols, state(c)%lchnk) call outfld( rad_name1, radius1(:,:), pcols, state(c)%lchnk) call outfld( rad_name2, radius2(:,:), pcols, state(c)%lchnk) call outfld( rad_name3, radius3(:,:), pcols, state(c)%lchnk) - call outfld( rad_name5, radius5(:,:), pcols, state(c)%lchnk) + if (five_mode) then + volcmass5(:ncol,:) = mass5(:ncol,:)*state(c)%pdel(:ncol,:)/gravit + columnmass5(:ncol) = sum(volcmass5(:ncol,:), 2) + call outfld( mmr_name5, mass5(:,:), pcols, state(c)%lchnk) + call outfld( mass_name5, volcmass5(:,:), pcols, state(c)%lchnk) + call outfld( mass_column_name5, columnmass5(:), pcols, state(c)%lchnk) + call outfld( rad_name5, radius5(:,:), pcols, state(c)%lchnk) + end if else call outfld( mmr_name, mass1(:,:), pcols, state(c)%lchnk) call outfld( mass_name, volcmass1(:,:), pcols, state(c)%lchnk) From edb6b550121ba8abf529e38af43239bf08f6ead3 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Tue, 26 Aug 2025 06:32:58 -0600 Subject: [PATCH 317/466] add regression test new file: cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands new file: cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam new file: cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm modified: cime_config/testdefs/testlist_cam.xml --- cime_config/testdefs/testlist_cam.xml | 2 +- .../outfrq9s_cam7_presc_volc/shell_commands | 3 +++ .../cam/outfrq9s_cam7_presc_volc/user_nl_cam | 24 +++++++++++++++++ .../cam/outfrq9s_cam7_presc_volc/user_nl_clm | 27 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam create mode 100644 cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index e268387254..3a32c3e8a2 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -1540,7 +1540,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands new file mode 100644 index 0000000000..7e85801f9c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands @@ -0,0 +1,3 @@ +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL +./xmlchange RUN_STARTDATE=2000-01-01 diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam new file mode 100644 index 0000000000..8ee49bc0cd --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam @@ -0,0 +1,24 @@ +mfilt=1,1,1,1,1,1 +ndens=1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9 +write_nstep0=.true. +inithist='ENDOFRUN' + + prescribed_strataero_datapath = '$DIN_LOC_ROOT/atm/cam/volc' + prescribed_strataero_file = 'ozone_strataero_f.e30_beta02.FCts4MTHIST.ne30.104_1980_2014_c20241104.nc' + prescribed_strataero_type = 'SERIAL' + prescribed_strataero_use_chemtrop = .true. + +rad_climate = + 'A:Q:H2O', 'N:O2:O2', 'A:CO2:CO2', 'N:ozone:O3', 'A:N2O:N2O', 'A:CH4:CH4', 'N:CFC11STAR:CFC11', 'A:CFC12:CFC12', + 'M:mam4_mode1:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_sig1.6_dgnh.48_c140304.nc', + 'M:mam4_mode2:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', + 'M:mam4_mode3:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam4_mode4:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'N:VOLC_MMR1:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode1_c210211.nc', + 'N:VOLC_MMR2:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode2_c210211.nc', + 'N:VOLC_MMR3:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc', + 'N:VOLC_MMR5:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc' + + fincl2 = 'VOLC_MMR1','VOLC_MMR2','VOLC_MMR3','VOLC_MMR5','VOLC_RAD_GEOM1','VOLC_RAD_GEOM2','VOLC_RAD_GEOM3','VOLC_RAD_GEOM5', + 'VOLC_SAD' \ No newline at end of file diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm new file mode 100644 index 0000000000..0d83b5367b --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm @@ -0,0 +1,27 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options +! are set in the CLM_NAMELIST_OPTS env variable. +! +! EXCEPTIONS: +! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting +! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting +! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting +! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting +! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting +! Set irrigate by the CLM_BLDNML_OPTS -irrig setting +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! Set glc_grid with CISM_GRID option +! Set glc_smb with GLC_SMB option +! Set maxpatch_glcmec with GLC_NEC option +! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable +!---------------------------------------------------------------------------------- +hist_nhtfrq = 9 +hist_mfilt = 1 +hist_ndens = 1 + From c979f2601894cab0b6e7e013f83c8200ba09f74f Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 26 Aug 2025 10:52:20 -0400 Subject: [PATCH 318/466] update testing --- cime_config/testdefs/testlist_cam.xml | 2 +- doc/ChangeLog | 46 ++++++++------------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 5fc4369d2a..1b8f331f98 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -2542,7 +2542,7 @@ - + diff --git a/doc/ChangeLog b/doc/ChangeLog index bb5ef205cb..fe003fc4fb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -8,13 +8,19 @@ Github PR URL: Purpose of changes (include the issue number and title text for each relevant GitHub issue): -Describe any changes made to build system: +. Refactor cam4 testing. +. Move more tests from aquaplanet to F compsets. +. Update masks, change ERP to ERC +. Move some tests from nag to gnu on izumi for better load balance. +. Add subcolumn test to SE grid -Describe any changes made to the namelist: +Describe any changes made to build system: none -List any changes to the defaults for the boundary datasets: +Describe any changes made to the namelist: none -Describe any substantial timing or memory changes: +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none Code reviewed by: @@ -24,7 +30,7 @@ cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/* cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/* . remove unused testmods -List all files added and what they do: +List all files added and what they do: none List all existing files that have been modified, and describe the changes: @@ -68,19 +74,13 @@ cime_config/testdefs/testlist_cam.xml ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp . update mask replace - SMS_D_Ld2.f45_f45_mg37.PC5.izumi_nag.cam-outfrq24h_port SMS_D_Ld5.f19_f19_mg17.PC4.derecho_intel.cam-cam4_port5d SMS_Ld5.f09_f09_mg17.PC6.derecho_intel.cam-cam6_port_f09 ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp by - SMS_D_Ld2.f45_f45_mt232.PC5.izumi_nag.cam-outfrq24h_port SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp - - - - cime_config/testdefs/testmods_dirs/cam/co2rmp/* . modify to use default start date @@ -89,8 +89,6 @@ cime_config/testdefs/testmods_dirs/cam/co2rmp/* cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/* . modify test to not unset the use case and use the default start date. - - 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 @@ -107,26 +105,8 @@ izumi/gnu/aux_cam: CAM tag used for the baseline comparison tests if different than previous tag: -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: +Summarize any changes to answers: No answer changes. All diffs due to new + and modified test configurations. =============================================================== =============================================================== From acd9a45dca37407b1880514e65ac3715c1297c29 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Tue, 26 Aug 2025 10:18:47 -0600 Subject: [PATCH 319/466] Use TEST_ONLY input file for reg test modified: cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam --- .../testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam index 8ee49bc0cd..72d52455dd 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam @@ -5,7 +5,7 @@ write_nstep0=.true. inithist='ENDOFRUN' prescribed_strataero_datapath = '$DIN_LOC_ROOT/atm/cam/volc' - prescribed_strataero_file = 'ozone_strataero_f.e30_beta02.FCts4MTHIST.ne30.104_1980_2014_c20241104.nc' + prescribed_strataero_file = 'TEST_ONLY_strataero_mam5_1980_2014_c20250826.nc' prescribed_strataero_type = 'SERIAL' prescribed_strataero_use_chemtrop = .true. From 19dbe13541453a8422a1073c289609f9cd4e3129 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 26 Aug 2025 11:22:46 -0600 Subject: [PATCH 320/466] Update atmos_phys external --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index ca27ea0086..a890fac4d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_16_000 + fxtag = atmos_phys0_16_001 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index abf7f40fa4..470f1fee56 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit abf7f40fa4145c522e3e94e2cccb0a6fc3fad0be +Subproject commit 470f1fee56af645c44493afab6c042d2d15e9311 From f735fc789161b32a3952526dd904c6d997396486 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 26 Aug 2025 15:57:31 -0600 Subject: [PATCH 321/466] Changes to support Cecile's latest runs --- bld/build-namelist | 2 +- bld/namelist_files/namelist_defaults_cam.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 0dddc28b9f..559d88ed1f 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3373,7 +3373,7 @@ if ($cfg->get('microphys') =~ /^mg/) { $micro_mg_dcs = '500.D-6'; } elsif ($phys eq 'cam7') { - $micro_mg_dcs = '500.D-6'; + $micro_mg_dcs = '600.D-6'; } } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 50e18fc7a6..4e57930999 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -307,7 +307,7 @@ atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc atm/cam/topo/se/ne16pg3_gmted2010_modis_bedmachine_nc3000_Laplace0200_20230202.nc -atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_20240720.nc +atm/cam/topo/se/ne30np4_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250822.nc atm/cam/topo/se/ne60pg3_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc atm/cam/topo/se/ne120pg3_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc atm/cam/topo/se/ne240pg3_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171015.nc @@ -2122,7 +2122,7 @@ 0.1 0.5 4.2 - 4.5 + 4.6 0.0 1.0 0.1 @@ -2678,7 +2678,7 @@ 0.14D0 0.10D0 0.10D0 - 0.10D0 + 0.05D0 0.10D0 0.10D0 From fbae91103f19a3afd1ceaa7feb6d11a5c6d479d8 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Wed, 27 Aug 2025 11:02:17 -0400 Subject: [PATCH 322/466] update nvhpc/gpu test for cam7 --- cime_config/testdefs/testlist_cam.xml | 19 ++++++++++--------- doc/ChangeLog | 7 +++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 1b8f331f98..f02d87f7bb 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -77,6 +77,16 @@ + + + + + + + + + + @@ -1248,15 +1258,6 @@ - - - - - - - - - diff --git a/doc/ChangeLog b/doc/ChangeLog index fe003fc4fb..23f49d12fe 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -13,6 +13,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi . Update masks, change ERP to ERC . Move some tests from nag to gnu on izumi for better load balance. . Add subcolumn test to SE grid +. Update nvhpc/gpu test to cam7. Describe any changes made to build system: none @@ -81,6 +82,12 @@ cime_config/testdefs/testlist_cam.xml SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp +. update nvhpc/gpu test to cam7 + replace + ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default + by + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + cime_config/testdefs/testmods_dirs/cam/co2rmp/* . modify to use default start date From bdcb82fe47f28d44cd644dbc09023851817a181f Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 27 Aug 2025 09:07:11 -0600 Subject: [PATCH 323/466] cam should specify this requirement itself --- cime_config/buildcpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index fac7dcbf68..0acb2a8f9b 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -78,7 +78,10 @@ def buildcpp(case): if cam_dycore == 'fv3': config_opts += ["-fv3core_libdir", os.path.join(exeroot,"atm","obj","atmos_cubed_sphere")] - + libs = case.get_values("CASE_SUPPORT_LIBRARIES") + if libs is not None and "FMS" not in libs: + libs.extend(["gptl","pio","csm_share","FMS") + case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) # The ocean component setting is only used by CAM to do attribute matching for # setting default tuning parameter values. In SOM mode we want to use the same # tunings as the fully coupled B compset, so set the ocean component to pop in From aa83058ecfdfb8bedf0b3c7010fe5182a14fd261 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Wed, 27 Aug 2025 11:14:46 -0600 Subject: [PATCH 324/466] address reviewer comments --- src/chemistry/aerosol/mo_setsox.F90 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/chemistry/aerosol/mo_setsox.F90 b/src/chemistry/aerosol/mo_setsox.F90 index 8bbed6c7e4..7e0077adc6 100644 --- a/src/chemistry/aerosol/mo_setsox.F90 +++ b/src/chemistry/aerosol/mo_setsox.F90 @@ -191,6 +191,11 @@ subroutine setsox( state, & ! NOTE: This routine assumes an Ideal Gas. !----------------------------------------------------------------------- ! + use physconst, only : AVOGADRO_KMOL => avogad, & + BOLTZMANN => boltz, & + GAS_CONSTANT_KMOL => r_universal, & + MOLECULAR_WEIGHT_CO2_G_MOL => mwco2, & + MOLECULAR_WEIGHT_DRY_AIR_G_MOL => mwdry use ppgrid, only : pcols, pver use chem_mods, only : gas_pcnst, nfs use chem_mods, only : adv_mass @@ -239,15 +244,16 @@ subroutine setsox( state, & !----------------------------------------------------------------------- integer, parameter :: itermax = 20 real(r8), parameter :: ph0 = 5.0_r8 ! INITIAL PH VALUES - real(r8), parameter :: AVOGADRO = 6.02214076e23_r8 ! mol-1 - real(r8), parameter :: BOLTZMANN = 1.380649e-23_r8 ! J K-1 real(r8), parameter :: PASCAL_TO_ATM = 1.0_r8 / 101325.0_r8 ! atm Pa-1 real(r8), parameter :: M3_TO_L = 1.0e3_r8 ! L m-3 real(r8), parameter :: M3_TO_CM3 = 1.0e6_r8 ! cm3 m-3 + real(r8), parameter :: G_TO_KG = 1.0e-3_r8 ! kg g-1 + real(r8), parameter :: KMOL_TO_MOL = 1.0e3_r8 ! mol kmol-1 real(r8), parameter :: SMALL_NUMBER = 1.0e-30_r8 + real(r8), parameter :: AVOGADRO = AVOGADRO_KMOL / KMOL_TO_MOL ! molecule mol-1 real(r8), parameter :: const0 = 1.e3_r8/AVOGADRO - real(r8), parameter :: MOLECULAR_WEIGHT_DRY_AIR = 0.028966_r8 ! kg mol-1 - real(r8), parameter :: MOLECULAR_WEIGHT_CO2 = 0.044009_r8 ! kg mol-1 + real(r8) :: MOLECULAR_WEIGHT_DRY_AIR ! kg mol-1 + real(r8), parameter :: MOLECULAR_WEIGHT_CO2 = MOLECULAR_WEIGHT_CO2_G_MOL * G_TO_KG ! kg mol-1 real(r8), parameter :: xa0 = 11._r8 real(r8), parameter :: xb0 = -.1_r8 real(r8), parameter :: xa1 = 1.053_r8 @@ -261,7 +267,7 @@ subroutine setsox( state, & real(r8), parameter :: kh1 = 1.6e-5_r8 ! HO2(a) -> H+ + O2- Reference: JPL 19-5 real(r8), parameter :: kh2 = 8.3e5_r8 ! HO2(a) + ho2(a) -> h2o2(a) + o2 Reference: JPL; Bielski et al. 1985 real(r8), parameter :: kh3 = 9.7e7_r8 ! HO2(a) + o2- -> h2o2(a) + o2 Reference: JPL; Bielski et al. 1985 - real(r8), parameter :: Ra = BOLTZMANN * AVOGADRO * M3_TO_L * PASCAL_TO_ATM ! universal constant (atm)/(M-K) + real(r8), parameter :: Ra = GAS_CONSTANT_KMOL / KMOL_TO_MOL * M3_TO_L * PASCAL_TO_ATM ! universal constant (atm)/(M-K) ! real(r8) :: xdelso4hp(ncol,pver) @@ -303,7 +309,7 @@ subroutine setsox( state, & henh3, & ! henry law const for nh3 heo3 !!, & ! henry law const for o3 - real(r8), pointer :: co2_mass_mixing_ratio(:,:) ! kg kg-1 + real(r8), pointer :: co2_mass_mixing_ratio(:,:) ! kg kg-1 real(r8), dimension(ncol) :: work1 logical :: converged @@ -323,6 +329,8 @@ subroutine setsox( state, & real(r8) :: yph, yph_lo, yph_hi real(r8) :: ynetpos, ynetpos_lo, ynetpos_hi + MOLECULAR_WEIGHT_DRY_AIR = MOLECULAR_WEIGHT_DRY_AIR_G_MOL * G_TO_KG ! kg mol-1 + !----------------------------------------------------------------- ! ... NOTE: The press array is in pascals and must be ! mutiplied by 10 to yield dynes/cm**2. @@ -891,7 +899,7 @@ end subroutine setsox ! ... looks up Effective Henry's Law Constant parameters !----------------------------------------------------------------- pure integer function get_heff_index(species_name) result(index) - use shr_drydep_mod, only: species_name_table, dheff + use shr_drydep_mod, only: species_name_table character(len=*), intent(in) :: species_name From c751192ca78cb655990a9d99276f6ef67b401aab Mon Sep 17 00:00:00 2001 From: Julio Bacmeister Date: Wed, 27 Aug 2025 14:08:33 -0600 Subject: [PATCH 325/466] made blending consistent with p_top_for_{rad...} --- src/physics/cam/radheat.F90 | 3 ++- src/physics/camrt/radiation.F90 | 7 +++++++ src/physics/rrtmg/radiation.F90 | 7 +++++++ src/physics/rrtmgp/radiation.F90 | 15 +++++++++++++++ src/physics/simple/radiation.F90 | 6 ++++++ 5 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 767608fd4d..f0ece7db7e 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -85,6 +85,7 @@ subroutine radheat_init(pref_mid) use nlte_fomichev, only: nlte_fomichev_init use phys_control, only: phys_getopts + use radiation, only: p_top_for_equil_rad ! args @@ -123,7 +124,7 @@ subroutine radheat_init(pref_mid) else min_pressure_sw = 5._r8 max_pressure_sw = 50._r8 - min_pressure_lw = 10._r8 + min_pressure_lw = p_top_for_equil_rad max_pressure_lw = 50._r8 endif diff --git a/src/physics/camrt/radiation.F90 b/src/physics/camrt/radiation.F90 index d7e0cdbac6..5355126175 100644 --- a/src/physics/camrt/radiation.F90 +++ b/src/physics/camrt/radiation.F90 @@ -59,7 +59,14 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs +! Top of valid pressure range (Pa) for this radiation scheme +! in local thermo. equilibrium. No limits for this +! scheme, so +! will be set to zero below +public :: p_top_for_equil_rad + real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models +real(r8) :: p_top_for_equil_rad = 0._r8 type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index a22a66dd6a..bde48868c4 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -59,10 +59,17 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs +! Top of valid pressure range (Pa) for this radiation scheme +! in local thermo. equilibrium. No limits for this +! scheme, so will be set to zero below +public :: p_top_for_equil_rad + integer,public, allocatable :: cosp_cnt(:) ! counter for cosp integer,public :: cosp_cnt_init = 0 !initial value for cosp counter real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models +real(r8) :: p_top_for_equil_rad = 0._r8 + type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 82ead2d545..0df4084f13 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -72,11 +72,23 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs +! Top of valid pressure range (Pa) for this radiation scheme +! in local thermo. equilibrium. Will be set to +! +! p_top_for_rrtmgp +! +! below. Will then be used in CAM's radheat to determine blending region +! of LTE and non-LTE schemes. +public :: p_top_for_equil_rad + integer,public, allocatable :: cosp_cnt(:) ! counter for cosp integer,public :: cosp_cnt_init = 0 !initial value for cosp counter real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models +real(r8) :: p_top_for_equil_rad + + type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux @@ -467,6 +479,9 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': sw '//errmsg) end if + ! Set public variable for use by radheat. + p_top_for_equil_rad = p_top_for_rrtmgp + ! Set up inputs to RRTMGP call rrtmgp_inputs_setup_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & pref_edge, nlay, pver, pverp, kdist_sw, kdist_lw, qrl_unused, is_first_step(), use_rad_dt_cosz, & diff --git a/src/physics/simple/radiation.F90 b/src/physics/simple/radiation.F90 index aa4fc2cec7..1c6d98ec05 100644 --- a/src/physics/simple/radiation.F90 +++ b/src/physics/simple/radiation.F90 @@ -11,8 +11,14 @@ module radiation public :: & radiation_readnl, & radiation_do +! Top of valid pressure range (Pa) for this radiation scheme +! in local thermo. equilibrium. No limits for this +! scheme, so +! will be set to zero below +public :: p_top_for_equil_rad real(r8), public, protected :: nextsw_cday = -1._r8 ! future radiation calday for surface models +real(r8) :: p_top_for_equil_rad = 0._r8 !======================================================================================== contains From e77d7035b733a9d21c7fd191d9a5b108c62dbd99 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 27 Aug 2025 14:33:04 -0600 Subject: [PATCH 326/466] Update ChangeLog for cam6_4_110 --- doc/ChangeLog | 63 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7b065fc807..afad5b7791 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,62 @@ + +=============================================================== + +Tag name: cam6_4_110 +Originator(s): cacraigucar +Date: August 27, 2025 +One-line Summary: Modifications to handle PUMAS external being moved to atmos_phys +Github PR URL: https://github.com/ESCOMP/CAM/pull/1373 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Move PUMAS external to atmospheric_physics: https://github.com/ESCOMP/CAM/issues/1364 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: nusbaume + +List all files eliminated: +D src/physics/pumas + - Delete PUMAS submodule in ESCOMP/CAM + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - Remove PUMAS from external in ESCOMP/CAM + - Update atmos_phys external which contains PUMAS + +M bld/build-namelist + - Change location of pumas external for pumas supplied file + +M bld/configure + - Change location of checked out pumas + +M src/atmos_phys + - update submodule + + +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: all BFB except: + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: BFB + +izumi/nag/aux_cam: BFB + +izumi/gnu/aux_cam: BFB + +=============================================================== =============================================================== Tag name: cam6_4_109 @@ -9,7 +68,7 @@ Github PR URL: https://github.com/ESCOMP/CAM/pull/1359 Purpose of changes (include the issue number and title text for each relevant GitHub issue): . Add ERI tests (branch and hybrid runs) for cam5, cam6, and cam7 - F-compsets. Previously only aquaplanet configurations tested. + F-compsets. Previously only aquaplanet configurations tested. . Add testing of interpolated output for FHISTC_LTso. Move COSP output to a separate history file that uses the native SE grid. The COSP output of @@ -78,7 +137,7 @@ cime_config/config_component.xml cime_config/testdefs/testlist_cam.xml . add ERI tests for cam5, cam6, and cam7 F compsets: - replace + replace ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s by ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri From 56b1e84a8543d583fe99df46fac9f6e2e3238842 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 28 Aug 2025 07:38:41 -0600 Subject: [PATCH 327/466] updates buildcpp to add support libraries --- cime_config/buildcpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index 0acb2a8f9b..8f444558b3 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -80,7 +80,7 @@ def buildcpp(case): config_opts += ["-fv3core_libdir", os.path.join(exeroot,"atm","obj","atmos_cubed_sphere")] libs = case.get_values("CASE_SUPPORT_LIBRARIES") if libs is not None and "FMS" not in libs: - libs.extend(["gptl","pio","csm_share","FMS") + libs.extend(["gptl","pio","csm_share","FMS"]) case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) # The ocean component setting is only used by CAM to do attribute matching for # setting default tuning parameter values. In SOM mode we want to use the same From 20e48d2008ffbcce0e19cfabe034487be93f27fe Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 28 Aug 2025 09:51:11 -0600 Subject: [PATCH 328/466] improve backward compatiblity --- cime_config/buildcpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cime_config/buildcpp b/cime_config/buildcpp index 8f444558b3..09b4fc31a9 100644 --- a/cime_config/buildcpp +++ b/cime_config/buildcpp @@ -78,10 +78,13 @@ def buildcpp(case): if cam_dycore == 'fv3': config_opts += ["-fv3core_libdir", os.path.join(exeroot,"atm","obj","atmos_cubed_sphere")] - libs = case.get_values("CASE_SUPPORT_LIBRARIES") - if libs is not None and "FMS" not in libs: - libs.extend(["gptl","pio","csm_share","FMS"]) - case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) + try: + libs = case.get_values("CASE_SUPPORT_LIBRARIES") + if libs is not None and "FMS" not in libs: + libs.extend(["gptl","pio","csm_share","FMS"]) + case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) + except: + pass # The ocean component setting is only used by CAM to do attribute matching for # setting default tuning parameter values. In SOM mode we want to use the same # tunings as the fully coupled B compset, so set the ocean component to pop in From 315d73d3b9de16ceed3056428f1d7da40ef698a1 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 28 Aug 2025 12:31:40 -0400 Subject: [PATCH 329/466] fix misconfigured silhs test --- cime_config/testdefs/testlist_cam.xml | 2 +- .../testdefs/testmods_dirs/cam/silhs/shell_commands | 10 ++-------- .../testdefs/testmods_dirs/cam/silhs/user_nl_cam | 12 ++++++------ doc/ChangeLog | 9 +++++++++ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index f02d87f7bb..3f655a4347 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -251,7 +251,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/cam/silhs/shell_commands b/cime_config/testdefs/testmods_dirs/cam/silhs/shell_commands index fea94fabf2..70d3031563 100644 --- a/cime_config/testdefs/testmods_dirs/cam/silhs/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/silhs/shell_commands @@ -1,9 +1,3 @@ -driver=`./xmlquery --value COMP_INTERFACE` -if [ "$driver" = "nuopc" ]; then - ./xmlchange ROF_NCPL=\$ATM_NCPL - ./xmlchange GLC_NCPL=\$ATM_NCPL -fi +./xmlchange ROF_NCPL=\$ATM_NCPL +./xmlchange GLC_NCPL=\$ATM_NCPL ./xmlchange -append CAM_CONFIG_OPTS=" -silhs -psubcols 4" -./xmlchange RUN_STARTDATE="0001-01-01" -./xmlchange STOP_OPTION=nsteps -./xmlchange STOP_N=9 diff --git a/cime_config/testdefs/testmods_dirs/cam/silhs/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/silhs/user_nl_cam index 13ceac46c1..9ad54d9904 100644 --- a/cime_config/testdefs/testmods_dirs/cam/silhs/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/silhs/user_nl_cam @@ -1,11 +1,11 @@ dtime = 1800 -nhtfrq = 0,-24,-6,-3 -write_nstep0 = .true. -mfilt = 1,5000,5000 +nhtfrq = 9,9,9,9 +mfilt = 1,1,1,1 ndens = 2,2,2,2,2,2 -history_budget = .true. -history_amwg = .true. -history_vdiag = .true. +write_nstep0 = .true. +history_budget = .false. +history_amwg = .false. +history_vdiag = .false. fincl1 = 'U:A','PS:A','T:A','V:A','OMEGA:A','Z3:A','PRECT:A', 'CLDLIQ:A', 'CLDICE:A', 'LWCF:A', 'SWCF:A', 'FLUT:A', 'TMQ:A', 'PRECC:A', 'PRECL:A', 'CME:A', 'PRODPREC:A', diff --git a/doc/ChangeLog b/doc/ChangeLog index 23f49d12fe..ad77e8d4ef 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -14,6 +14,7 @@ Purpose of changes (include the issue number and title text for each relevant Gi . Move some tests from nag to gnu on izumi for better load balance. . Add subcolumn test to SE grid . Update nvhpc/gpu test to cam7. +. Fix misconfigured output in silhs test. Describe any changes made to build system: none @@ -87,12 +88,20 @@ cime_config/testdefs/testlist_cam.xml ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default by ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default +. fix misconfigured output in silhs test, and update mask + replace + SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs + by + SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs cime_config/testdefs/testmods_dirs/cam/co2rmp/* . modify to use default start date . change to nhtfrq=9; use default for ramp_co2_start_ymd (begining of run) +cime_config/testdefs/testmods_dirs/cam/silhs/* +. set nhtfrq=9,9,9,9 so history output is produced by 9 step run. + cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/* . modify test to not unset the use case and use the default start date. From 45238d312b26bbc8922b3f4d7a0ef7ae146ad8fc Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 28 Aug 2025 12:37:46 -0400 Subject: [PATCH 330/466] fix ChangeLog --- doc/ChangeLog | 117 +++++++++++++++++++++++++------------------------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 5af3009207..f7d9cc0115 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,62 +1,3 @@ - -=============================================================== - -Tag name: cam6_4_110 -Originator(s): cacraigucar -Date: August 27, 2025 -One-line Summary: Modifications to handle PUMAS external being moved to atmos_phys -Github PR URL: https://github.com/ESCOMP/CAM/pull/1373 - -Purpose of changes (include the issue number and title text for each relevant GitHub issue): - - Move PUMAS external to atmospheric_physics: https://github.com/ESCOMP/CAM/issues/1364 - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: nusbaume - -List all files eliminated: -D src/physics/pumas - - Delete PUMAS submodule in ESCOMP/CAM - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: -M .gitmodules - - Remove PUMAS from external in ESCOMP/CAM - - Update atmos_phys external which contains PUMAS - -M bld/build-namelist - - Change location of pumas external for pumas supplied file - -M bld/configure - - Change location of checked out pumas - -M src/atmos_phys - - update submodule - - -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: all BFB except: - SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) - - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. - -derecho/nvhpc/aux_cam: BFB - -izumi/nag/aux_cam: BFB - -izumi/gnu/aux_cam: BFB - -=============================================================== =============================================================== Tag name: @@ -186,6 +127,64 @@ Summarize any changes to answers: No answer changes. All diffs due to new =============================================================== =============================================================== +Tag name: cam6_4_110 +Originator(s): cacraigucar +Date: August 27, 2025 +One-line Summary: Modifications to handle PUMAS external being moved to atmos_phys +Github PR URL: https://github.com/ESCOMP/CAM/pull/1373 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Move PUMAS external to atmospheric_physics: https://github.com/ESCOMP/CAM/issues/1364 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: nusbaume + +List all files eliminated: +D src/physics/pumas + - Delete PUMAS submodule in ESCOMP/CAM + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - Remove PUMAS from external in ESCOMP/CAM + - Update atmos_phys external which contains PUMAS + +M bld/build-namelist + - Change location of pumas external for pumas supplied file + +M bld/configure + - Change location of checked out pumas + +M src/atmos_phys + - update submodule + + +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: all BFB except: + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: BFB + +izumi/nag/aux_cam: BFB + +izumi/gnu/aux_cam: BFB + +=============================================================== +=============================================================== + Tag name: cam6_4_109 Originator(s): eaton Date: 20 August 2025 From a9d022c8a689446391aa1a52e0d2143a780f57e8 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 10:42:46 -0600 Subject: [PATCH 331/466] move and rename p_top_for_rrtmgp; cleanup --- bld/build-namelist | 2 +- bld/namelist_files/namelist_defaults_cam.xml | 6 +- bld/namelist_files/namelist_definition.xml | 9 +-- src/physics/cam/radheat.F90 | 64 ++++++++++---------- src/physics/rrtmgp/radiation.F90 | 24 +------- src/physics/waccm/radheat.F90 | 5 +- 6 files changed, 47 insertions(+), 63 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 90972d850a..541332dcf6 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -739,7 +739,7 @@ elsif ($rad_pkg =~ m/rrtmgp/) { my $abs_path = quote_string(set_abs_filepath($rel_path, $cam_dir)); $nl->set_variable_value('radiation_nl', 'rrtmgp_coefs_sw_file', $abs_path); - add_default($nl, 'p_top_for_rrtmgp'); + add_default($nl, 'p_top_for_equil_rad'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 50e18fc7a6..5aedf18abe 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -575,9 +575,9 @@ src/physics/rrtmgp/data/rrtmgp-gas-lw-g128.nc src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc - 10.D0 - 1.D0 - 1.D0 + 10.D0 + 1.D0 + 1.D0 atm/cam/rad/abs_ems_factors_fastvx.c030508.nc diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index acb1c912ea..4d260f9e58 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5771,11 +5771,12 @@ Calculate radiative effect of graupel/hail (using snow optics) Default: FALSE - -Top pressure level for RRTMGP + +Top pressure level for non-LTE blending region Default: 1.0 for WACCM/WACCMX - 10. for all other CAM runs + 10. for all other RRTMGP runs + 0.0 for all other runs masterprocid, mpi_real8 + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + integer :: dtime ! timestep size + character(len=32) :: errmsg + character(len=*), parameter :: sub = 'radheat_readnl' + + namelist /radheat_nl/ p_top_for_equil_rad + !----------------------------------------------------------------------------- + + if (masterproc) then + open( newunit=unitn, file=trim(nlfile), status='old' ) + call find_group_name(unitn, 'radheat_nl', status=ierr) + if (ierr == 0) then + read(unitn, radiation_nl, iostat=ierr, iomsg=errmsg) + if (ierr /= 0) then + call endrun(sub//': ERROR reading namelist: '//trim(errmsg)) + end if + end if + close(unitn) + end if + + call mpi_bcast(p_top_for_equil_rad, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_equil_rad") end subroutine radheat_readnl @@ -93,8 +114,6 @@ subroutine radheat_init(pref_mid) ! local vars real(r8) :: co2_mw, o1_mw, o2_mw, o3_mw, no_mw, n2_mw ! molecular weights - real(r8) :: delta_merge_sw ! range of merge region - real(r8) :: midpoint_sw ! midpoint of merge region real(r8) :: delta_merge_lw ! range of merge region real(r8) :: midpoint_lw ! midpoint of merge region real(r8) :: psh(pver) ! pressure scale height @@ -117,21 +136,15 @@ subroutine radheat_init(pref_mid) ! set max/min pressures for merging regions. if (camrt) then - min_pressure_sw = 1e5_r8*exp(-10._r8) - max_pressure_sw = 1e5_r8*exp(-9._r8) min_pressure_lw = 1e5_r8*exp(-10._r8) max_pressure_lw = 1e5_r8*exp(-8.57_r8) else - min_pressure_sw = 5._r8 - max_pressure_sw = 50._r8 min_pressure_lw = p_top_for_equil_rad max_pressure_lw = 50._r8 endif - delta_merge_sw = max_pressure_sw - min_pressure_sw delta_merge_lw = max_pressure_lw - min_pressure_lw - midpoint_sw = (max_pressure_sw + min_pressure_sw)/2._r8 midpoint_lw = (max_pressure_lw + min_pressure_lw)/2._r8 do k=1,pver @@ -139,21 +152,6 @@ subroutine radheat_init(pref_mid) ! pressure scale heights for camrt merging (cam4) psh(k)=log(1e5_r8/pref_mid(k)) - if ( pref_mid(k) .le. min_pressure_sw ) then - qrs_wt(k) = 0._r8 - else if( pref_mid(k) .ge. max_pressure_sw) then - qrs_wt(k) = 1._r8 - else - if (camrt) then - ! camrt - qrs_wt(k) = 1._r8 - tanh( (psh(k) - 9._r8)/.75_r8 ) - else - ! rrtmg - qrs_wt(k) = 0.5_r8 + 1.5_r8*((pref_mid(k)-midpoint_sw)/delta_merge_sw) & - - 2._r8*((pref_mid(k)-midpoint_sw)/delta_merge_sw)**3._r8 - endif - endif - if ( pref_mid(k) .le. min_pressure_lw ) then qrl_wt(k)= 0._r8 else if( pref_mid(k) .ge. max_pressure_lw) then diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 0df4084f13..93064d30af 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -72,23 +72,11 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs -! Top of valid pressure range (Pa) for this radiation scheme -! in local thermo. equilibrium. Will be set to -! -! p_top_for_rrtmgp -! -! below. Will then be used in CAM's radheat to determine blending region -! of LTE and non-LTE schemes. -public :: p_top_for_equil_rad - integer,public, allocatable :: cosp_cnt(:) ! counter for cosp integer,public :: cosp_cnt_init = 0 !initial value for cosp counter real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models -real(r8) :: p_top_for_equil_rad - - type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux @@ -160,8 +148,6 @@ module radiation logical :: graupel_in_rad = .false. ! graupel in radiation code logical :: use_rad_uniform_angle = .false. ! if true, use the namelist rad_uniform_angle for the coszrs calculation -real(r8) :: p_top_for_rrtmgp = 0._r8 ! top pressure for RRTMGP - ! Gathered indices of day and night columns integer :: nday ! Number of daylight columns integer :: nnite ! Number of night columns @@ -287,7 +273,7 @@ subroutine radiation_readnl(nlfile) namelist /radiation_nl/ & rrtmgp_coefs_lw_file, rrtmgp_coefs_sw_file, iradsw, iradlw, & irad_always, use_rad_dt_cosz, spectralflux, use_rad_uniform_angle, & - rad_uniform_angle, graupel_in_rad, p_top_for_rrtmgp + rad_uniform_angle, graupel_in_rad !----------------------------------------------------------------------------- if (masterproc) then @@ -323,8 +309,6 @@ subroutine radiation_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: rad_uniform_angle") call mpi_bcast(graupel_in_rad, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: graupel_in_rad") - call mpi_bcast(p_top_for_rrtmgp, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_rrtmgp") if (use_rad_uniform_angle .and. rad_uniform_angle == -99._r8) then call endrun(sub//': ERROR - use_rad_uniform_angle is set to .true,' & @@ -432,6 +416,7 @@ subroutine radiation_init(pbuf2d) use rad_constituents, only: iceopticsfile, liqopticsfile use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_init use rrtmgp_sw_gas_optics, only: rrtmgp_sw_gas_optics_init + use radheat, only: p_top_for_equil_rad ! Initialize the radiation and cloud optics. ! Add fields to the history buffer. @@ -479,14 +464,11 @@ subroutine radiation_init(pbuf2d) call endrun(sub//': sw '//errmsg) end if - ! Set public variable for use by radheat. - p_top_for_equil_rad = p_top_for_rrtmgp - ! Set up inputs to RRTMGP call rrtmgp_inputs_setup_init(ktopcam, ktoprad, nlaycam, sw_low_bounds, sw_high_bounds, nswbands, & pref_edge, nlay, pver, pverp, kdist_sw, kdist_lw, qrl_unused, is_first_step(), use_rad_dt_cosz, & get_step_size(), get_nstep(), iradsw, dt_avg, irad_always, is_first_restart_step(), & - p_top_for_rrtmgp, nlwbands, nradgas, gasnamelength, idx_sw_diag, idx_nir_diag, idx_uv_diag, & + p_top_for_equil_rad, nlwbands, nradgas, gasnamelength, idx_sw_diag, idx_nir_diag, idx_uv_diag, & idx_sw_cloudsim, idx_lw_diag, idx_lw_cloudsim, nswgpts, nlwgpts, nlayp, nextsw_cday, & get_curr_calday(), band2gpt_sw, errmsg, errflg) if (errflg /= 0) then diff --git a/src/physics/waccm/radheat.F90 b/src/physics/waccm/radheat.F90 index 092b40b260..d0d79d856e 100644 --- a/src/physics/waccm/radheat.F90 +++ b/src/physics/waccm/radheat.F90 @@ -46,6 +46,7 @@ module radheat logical :: nlte_limit_co2 = .false. ! if true apply upper limit to co2 in the Fomichev scheme logical :: nlte_use_aliarms = .false. ! If true, use ALI-ARMS for the cooling rate calculation integer :: nlte_aliarms_every_X = 1 ! Call aliarms every X times radiation is called + real(r8) :: p_top_for_equil_rad = 0._r8 ! Pressure top for blending layer ! Private variables for merging heating rates real(r8):: qrs_wt(pver) ! merge weight for cam solar heating @@ -87,7 +88,7 @@ subroutine radheat_readnl(nlfile) integer :: unitn, ierr character(len=*), parameter :: subname = 'radheat_readnl' - namelist /radheat_nl/ nlte_use_mo, nlte_limit_co2, nlte_use_aliarms,nlte_aliarms_every_X + namelist /radheat_nl/ nlte_use_mo, nlte_limit_co2, nlte_use_aliarms,nlte_aliarms_every_X, p_top_for_equil_rad if (masterproc) then unitn = getunit() @@ -112,6 +113,8 @@ subroutine radheat_readnl(nlfile) if (ierr /= 0) call endrun("radheat_readnl: FATAL: mpi_bcast: nlte_use_aliarms") call mpi_bcast (nlte_aliarms_every_X, 1, mpi_integer, masterprocid, mpicom, ierr) if (ierr /= 0) call endrun("radheat_readnl: FATAL: mpi_bcast: nlte_aliarms_every_X") + call mpi_bcast(p_top_for_equil_rad, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_equil_rad") ! Have waccm_forcing read its namelist as well. call waccm_forcing_readnl(nlfile) From dc69798677b64498b192ef863252190035bde658 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 28 Aug 2025 13:48:00 -0400 Subject: [PATCH 332/466] update FV3 tests --- cime_config/testdefs/testlist_cam.xml | 5 +++-- doc/ChangeLog | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 3f655a4347..7fbd99bfa0 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -261,13 +261,14 @@ - + + @@ -515,7 +516,7 @@ - + diff --git a/doc/ChangeLog b/doc/ChangeLog index f7d9cc0115..1c32fd761c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -93,7 +93,13 @@ cime_config/testdefs/testlist_cam.xml SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs by SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs - +. modify FV3 tests: + replace + ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 + ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s + by + ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s + ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s cime_config/testdefs/testmods_dirs/cam/co2rmp/* . modify to use default start date From 3c9ad49df02c88c1453cd524775a88bff57e86ca Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 12:06:33 -0600 Subject: [PATCH 333/466] remove residual use statement --- src/physics/cam/radheat.F90 | 1 - 1 file changed, 1 deletion(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index dca1e6d324..c2df860403 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -106,7 +106,6 @@ subroutine radheat_init(pref_mid) use nlte_fomichev, only: nlte_fomichev_init use phys_control, only: phys_getopts - use radiation, only: p_top_for_equil_rad ! args From 41e9e2e6a9b0bc30e4ba7a1193309b9d756c61db Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 12:07:56 -0600 Subject: [PATCH 334/466] fix nl name --- src/physics/cam/radheat.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index c2df860403..a8536d43a9 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -76,7 +76,7 @@ subroutine radheat_readnl(nlfile) open( newunit=unitn, file=trim(nlfile), status='old' ) call find_group_name(unitn, 'radheat_nl', status=ierr) if (ierr == 0) then - read(unitn, radiation_nl, iostat=ierr, iomsg=errmsg) + read(unitn, radheat_nl, iostat=ierr, iomsg=errmsg) if (ierr /= 0) then call endrun(sub//': ERROR reading namelist: '//trim(errmsg)) end if From f036a7d4e46cab9ac0476c9483885d9a75ef90a8 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 12:10:15 -0600 Subject: [PATCH 335/466] add missing endrun use statement --- src/physics/cam/radheat.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index a8536d43a9..cf0906037d 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -60,6 +60,7 @@ subroutine radheat_readnl(nlfile) ! Read radheat_nl namelist group use namelist_utils, only: find_group_name use spmd_utils, only: mpicom, mstrid=>masterprocid, mpi_real8 + use cam_abortutils, only: endrun character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input From 7e02086c4b53610a5d09593620e863856d11fee8 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 12:56:37 -0600 Subject: [PATCH 336/466] add missing use statement --- src/physics/waccm/radheat.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/waccm/radheat.F90 b/src/physics/waccm/radheat.F90 index d0d79d856e..b3dffea2e3 100644 --- a/src/physics/waccm/radheat.F90 +++ b/src/physics/waccm/radheat.F90 @@ -78,7 +78,7 @@ subroutine radheat_readnl(nlfile) use namelist_utils, only: find_group_name use units, only: getunit, freeunit use cam_abortutils, only: endrun - use spmd_utils, only : mpicom, masterprocid, mpi_logical, mpi_integer + use spmd_utils, only : mpicom, masterprocid, mpi_logical, mpi_integer, mpi_real8 use waccm_forcing, only: waccm_forcing_readnl From eb939b00fd4e1d7dfd8d335f13343b08643345dd Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 15:15:14 -0600 Subject: [PATCH 337/466] make nl variable public in waccm radheat; cleanup --- src/physics/waccm/radheat.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/physics/waccm/radheat.F90 b/src/physics/waccm/radheat.F90 index b3dffea2e3..37489e8afb 100644 --- a/src/physics/waccm/radheat.F90 +++ b/src/physics/waccm/radheat.F90 @@ -46,7 +46,7 @@ module radheat logical :: nlte_limit_co2 = .false. ! if true apply upper limit to co2 in the Fomichev scheme logical :: nlte_use_aliarms = .false. ! If true, use ALI-ARMS for the cooling rate calculation integer :: nlte_aliarms_every_X = 1 ! Call aliarms every X times radiation is called - real(r8) :: p_top_for_equil_rad = 0._r8 ! Pressure top for blending layer + real(r8), public :: p_top_for_equil_rad = 0._r8 ! Pressure top for blending layer ! Private variables for merging heating rates real(r8):: qrs_wt(pver) ! merge weight for cam solar heating @@ -113,8 +113,8 @@ subroutine radheat_readnl(nlfile) if (ierr /= 0) call endrun("radheat_readnl: FATAL: mpi_bcast: nlte_use_aliarms") call mpi_bcast (nlte_aliarms_every_X, 1, mpi_integer, masterprocid, mpicom, ierr) if (ierr /= 0) call endrun("radheat_readnl: FATAL: mpi_bcast: nlte_aliarms_every_X") - call mpi_bcast(p_top_for_equil_rad, 1, mpi_real8, mstrid, mpicom, ierr) - if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_equil_rad") + call mpi_bcast(p_top_for_equil_rad, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("radheat_readnl: FATAL: mpi_bcast: p_top_for_equil_rad") ! Have waccm_forcing read its namelist as well. call waccm_forcing_readnl(nlfile) From fc5fe7d81a36d3a9e41ed418523e07136f9f04c1 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 28 Aug 2025 15:44:12 -0600 Subject: [PATCH 338/466] fix pumas file path --- bld/build-namelist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/build-namelist b/bld/build-namelist index 541332dcf6..72d85d7218 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -3339,7 +3339,7 @@ if ($cfg->get('microphys') =~ /^mg/) { add_default($nl, 'micro_mg_accre_sees_auto'); add_default($nl, 'micro_mg_vtrms_factor'); add_default($nl, 'micro_mg_implicit_fall'); - add_default($nl, 'pumas_stochastic_tau_kernel_filename', 'val'=>"$cfgdir/../src/atmos_phys/pumas/pumas/KBARF_tau_kernel.dat"); + add_default($nl, 'pumas_stochastic_tau_kernel_filename', 'val'=>"$cfgdir/../src/atmos_phys/schemes/pumas/pumas/KBARF_tau_kernel.dat"); #set path for stochastic_tau_kernel_filename my $cam_dir = $cfg->get('cam_dir'); From 1765aefc94ee2f9cffe587216ac36fcd7ac23ddf Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 29 Aug 2025 09:21:58 -0600 Subject: [PATCH 339/466] remove unused variables from other radiation packages; update default to 2 --- bld/namelist_files/namelist_defaults_cam.xml | 3 ++- bld/namelist_files/namelist_definition.xml | 2 +- src/physics/camrt/radiation.F90 | 7 ------- src/physics/rrtmg/radiation.F90 | 7 ------- src/physics/simple/radiation.F90 | 6 ------ 5 files changed, 3 insertions(+), 22 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 5aedf18abe..6c53cb86e5 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -575,7 +575,8 @@ src/physics/rrtmgp/data/rrtmgp-gas-lw-g128.nc src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc - 10.D0 + + 2.D0 1.D0 1.D0 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 4d260f9e58..1b1562546e 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5775,7 +5775,7 @@ Default: FALSE group="radheat_nl" valid_values="" > Top pressure level for non-LTE blending region Default: 1.0 for WACCM/WACCMX - 10. for all other RRTMGP runs + 2. for all other RRTMGP runs 0.0 for all other runs diff --git a/src/physics/camrt/radiation.F90 b/src/physics/camrt/radiation.F90 index 5355126175..d7e0cdbac6 100644 --- a/src/physics/camrt/radiation.F90 +++ b/src/physics/camrt/radiation.F90 @@ -59,14 +59,7 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs -! Top of valid pressure range (Pa) for this radiation scheme -! in local thermo. equilibrium. No limits for this -! scheme, so -! will be set to zero below -public :: p_top_for_equil_rad - real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models -real(r8) :: p_top_for_equil_rad = 0._r8 type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index bde48868c4..a22a66dd6a 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -59,17 +59,10 @@ module radiation radiation_tend, &! compute heating rates and fluxes rad_out_t ! type for diagnostic outputs -! Top of valid pressure range (Pa) for this radiation scheme -! in local thermo. equilibrium. No limits for this -! scheme, so will be set to zero below -public :: p_top_for_equil_rad - integer,public, allocatable :: cosp_cnt(:) ! counter for cosp integer,public :: cosp_cnt_init = 0 !initial value for cosp counter real(r8), public, protected :: nextsw_cday ! future radiation calday for surface models -real(r8) :: p_top_for_equil_rad = 0._r8 - type rad_out_t real(r8) :: solin(pcols) ! Solar incident flux diff --git a/src/physics/simple/radiation.F90 b/src/physics/simple/radiation.F90 index 1c6d98ec05..aa4fc2cec7 100644 --- a/src/physics/simple/radiation.F90 +++ b/src/physics/simple/radiation.F90 @@ -11,14 +11,8 @@ module radiation public :: & radiation_readnl, & radiation_do -! Top of valid pressure range (Pa) for this radiation scheme -! in local thermo. equilibrium. No limits for this -! scheme, so -! will be set to zero below -public :: p_top_for_equil_rad real(r8), public, protected :: nextsw_cday = -1._r8 ! future radiation calday for surface models -real(r8) :: p_top_for_equil_rad = 0._r8 !======================================================================================== contains From d6dcc5aa008516f20246b3e69eaa782cf53f8c2f Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 29 Aug 2025 10:20:30 -0600 Subject: [PATCH 340/466] add default default --- bld/namelist_files/namelist_defaults_cam.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 6c53cb86e5..b866a486b1 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -576,6 +576,7 @@ src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc + 0.D0 2.D0 1.D0 1.D0 From ccbd1aa306559469e2de12af044ffef384e0c1f7 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 29 Aug 2025 11:50:08 -0600 Subject: [PATCH 341/466] fix namelist default order --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index b866a486b1..9118900e17 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -577,9 +577,9 @@ 0.D0 - 2.D0 1.D0 1.D0 + 2.D0 atm/cam/rad/abs_ems_factors_fastvx.c030508.nc From add761a133fe474965ebc517e536f05f39318219 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 29 Aug 2025 15:05:37 -0600 Subject: [PATCH 342/466] update changelog --- doc/ChangeLog | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index afad5b7791..ad53fcef36 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,92 @@ +=============================================================== + +Tag name: cam6_4_111 +Originator(s): JulioTBacmeister, cacraigucar, peverwhee +Date: August 29, 2025 +One-line Summary: Making blending region consistent with p_top for radiation schemes +Github PR URL: https://github.com/ESCOMP/CAM/pull/1379 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Rename p_top_for_rrtmgp to the more generic p_top_for_equil_rad + - Move p_top_for_equil_rad to radheat namelist group and read in radheat_readnl + - Use p_top_for_equil_rad to set minimum pressure for blending layer in radheat_init + - Update stochastic tau PUMAS file path to match new location + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: +M bld/build-namelist +M bld/namelist_files/namelist_defaults_cam.xml +M bld/namelist_files/namelist_definition.xml +- Rename p_top_for_rrtmgp to p_top_for_equil_rad +- Update default for RRTMGP (cam7 physics) to 2 +- Correct the stochastic tau pumas file path + +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, peverwhee + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M src/physics/cam/radheat.F90 +- remove unused variables +- read in p_top_for_equil_rad in readnl +- use p_top_for_equil_rad as minimum lw pressure + +M src/physics/rrtmgp/radiation.F90 +- Remove p_top_for_rrtmgp from readnl +- "use" p_top_for_equil_rad in radiation_init to pass into rrtmgp_inputs_setup_init + +M src/physics/waccm/radheat.F90 +- Add p_top_for_equil_rad to readnl routine + +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_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + - diffs for MT configuration due to namelist default change + + ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: NLFAIL) details: + ERC_D_Ln9.mpasa120_mpasa120.QPC7.derecho_intel.cam-outfrq9s_mpasa120 (Overall: NLFAIL) details: + ERC_D_Ln9.ne30pg2_ne30pg2_mt232.QPC7.derecho_intel.cam-outfrq9s (Overall: NLFAIL) details: + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: NLFAIL) details: + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: NLFAIL) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: NLFAIL) details: + ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: NLFAIL) details: + ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: NLFAIL) details: + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: NLFAIL) details: + SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: NLFAIL) details: + - nlfails for all RRTMGP configurations due to namelist name change + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: NLFAIL) details: + - nlfail for all RRTMGP configurations due to namelist name change + +izumi/nag/aux_cam: + ERC_D_Ln9.mpasa480_mpasa480_mt232.QPC7.izumi_nag.cam-outfrq9s_mpasa480 (Overall: NLFAIL) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: NLFAIL) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: NLFAIL) details: + - nlfails for all RRTMGP configurations due to namelist name change + +izumi/gnu/aux_cam: + ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: NLFAIL) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: NLFAIL) details: + ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPC7.izumi_gnu.cam-outfrq9s (Overall: NLFAIL) details: + SMS_D_Ln3.ne3pg3_ne3pg3_mt232.PC7.izumi_gnu.cam-pc7_ne3pg3 (Overall: NLFAIL) details: + - nlfails for all RRTMGP configurations due to namelist name change =============================================================== From 4344d789c28c51d2dc96cc6797642de1099d8ab4 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 29 Aug 2025 15:51:54 -0600 Subject: [PATCH 343/466] update topo and solar_irrad file --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml | 2 +- bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml | 2 +- .../use_cases/carma_trop_strat_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_cam_lt.xml | 2 +- bld/namelist_files/use_cases/hist_cam_mt.xml | 2 +- bld/namelist_files/use_cases/hist_geoschem.xml | 2 +- bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 2 +- .../use_cases/hist_trop_strat_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml | 2 +- bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml | 2 +- .../use_cases/hist_trop_strat_vbsext_cam6.xml | 2 +- .../use_cases/hist_trop_strat_vbsfire_cam6.xml | 2 +- bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml | 6 +++--- bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml | 4 ++-- bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml | 4 ++-- bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml | 6 +++--- 23 files changed, 33 insertions(+), 33 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 4e57930999..f5e9a4bf5f 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -307,7 +307,7 @@ atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc atm/cam/topo/se/ne16pg3_gmted2010_modis_bedmachine_nc3000_Laplace0200_20230202.nc -atm/cam/topo/se/ne30np4_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250822.nc +atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250828.nc atm/cam/topo/se/ne60pg3_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc atm/cam/topo/se/ne120pg3_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc atm/cam/topo/se/ne240pg3_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171015.nc diff --git a/bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml b/bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml index dfd6d55003..59d35a851b 100644 --- a/bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml +++ b/bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml @@ -6,7 +6,7 @@ atm/cam/inic/se/1850C_T4S_ne30pg3_spinup01.cam.i.0002-01-01_c241114.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc FIXED 18500701 diff --git a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml index 1033b64761..c4ef1f90bd 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml index 4ba33bb21e..5d9e56e912 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml index b8004c93b2..84ba12c3c7 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml @@ -25,7 +25,7 @@ atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml index 0fba6ef50e..26c8fc6ae2 100644 --- a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml @@ -4,7 +4,7 @@ atm/waccm/ic/FWmaCARMAHIST_f09_spinup01.cam.i.1980-01-01-00000_c220128.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml b/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml index 47a0bcaa2f..1743899807 100644 --- a/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml @@ -4,7 +4,7 @@ atm/waccm/ic/FWmaCARMAHIST_f09_spinup01.cam.i.1980-01-01-00000_c220128.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/hist_cam6.xml b/bld/namelist_files/use_cases/hist_cam6.xml index 9b79a04132..598fd19bf9 100644 --- a/bld/namelist_files/use_cases/hist_cam6.xml +++ b/bld/namelist_files/use_cases/hist_cam6.xml @@ -3,7 +3,7 @@ cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.i.0301-01-01-00000.nc - 'atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc' + 'atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc' 'atm/cam/tracer_cnst' 'tracer_cnst_halons_3D_L70_1849-2015_CMIP6ensAvg_c180927.nc' diff --git a/bld/namelist_files/use_cases/hist_cam_lt.xml b/bld/namelist_files/use_cases/hist_cam_lt.xml index 8f071a149b..35a5cb4cdf 100644 --- a/bld/namelist_files/use_cases/hist_cam_lt.xml +++ b/bld/namelist_files/use_cases/hist_cam_lt.xml @@ -4,7 +4,7 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc atm/waccm/lb/LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc diff --git a/bld/namelist_files/use_cases/hist_cam_mt.xml b/bld/namelist_files/use_cases/hist_cam_mt.xml index 0c8e2e85fb..8efd9424f1 100644 --- a/bld/namelist_files/use_cases/hist_cam_mt.xml +++ b/bld/namelist_files/use_cases/hist_cam_mt.xml @@ -4,7 +4,7 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc atm/waccm/lb/LBC_17500116-20150116_CMIP6_0p5degLat_c180905.nc diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 587ec4c1a4..03bee39f97 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -18,7 +18,7 @@ 00010101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 6d6e94c6c5..49ff148346 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -18,7 +18,7 @@ 00010101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml index 026e329d7a..ec5df405e3 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml @@ -8,7 +8,7 @@ atm/cam/inic/se/f.e22.FCnudged.ne0CONUSne30x8_ne0CONUSne30x8_mt12.cesm2_2_alpha06b.001.cam.i.2013-01-01-00000_c200706.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml b/bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml index 4e65f4f34c..20418b62e4 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml @@ -6,7 +6,7 @@ atm/cam/inic/se/f.cam6_3_153.FCMTnudged_climate_chemistry_ne30.factor_fix.cam.i.1996-01-01-00000_c220522.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc SERIAL diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml index f9ea8eb9eb..4bda4f302f 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml @@ -7,7 +7,7 @@ atm/cam/inic/fv/f.e20.FCHIST.f09_f09_mg17.cesm2_0_rel.emis_fix.001.cam.i.1996-01-01-00000_c180716.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml index 1605081d6d..a1f993ee2b 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml @@ -7,7 +7,7 @@ atm/cam/inic/fv/f.e20.FCHIST.f09_f09_mg17.cesm2_0_rel.emis_fix.fullVBS.cam.i.1996-01-01-00000_c180716.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml index 51e3538f47..0b991305a5 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml @@ -8,7 +8,7 @@ atm/cam/inic/se/f.e20.FCHIST.ne30_ne30.chem01_cam5_4_152.001.cam.i.2011-01-01-00000_c171215.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc .true. diff --git a/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml index 3bc7948bce..29d58eff25 100644 --- a/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml @@ -5,13 +5,13 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc 'epp_ion_rates' diff --git a/bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml b/bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml index 5543a8ddc9..9a6ae47352 100644 --- a/bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml +++ b/bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml @@ -5,13 +5,13 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc 'epp_ion_rates' diff --git a/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml index 3c2583af96..a97e05b370 100644 --- a/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml @@ -5,10 +5,10 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc cesm2_init/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001/0003-01-01/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001.cam.i.0003-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml b/bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml index 91efaae03a..2be3c29239 100644 --- a/bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml +++ b/bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml @@ -5,10 +5,10 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc atm/waccm/ic/FHIST_WAt1ma_ne30pg3_spinup01.cam.i.1980-01-01-00000_c250124.nc diff --git a/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml index 623d08bc95..42835b0c36 100644 --- a/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml @@ -5,13 +5,13 @@ 19900101 -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc 'epp_ion_rates' diff --git a/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml b/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml index 37ca427cd2..d06ba37a40 100644 --- a/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml @@ -7,12 +7,12 @@ atm/waccm/ic/f.e22.FXHIST.f09_f09_mg17_test.001.cam.i.1979-01-01-00000_c200820.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc SERIAL -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc epp_ion_rates From 8f47b405681408e7e13d4cf26cc947cc4008a227 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 2 Sep 2025 10:44:24 -0600 Subject: [PATCH 344/466] update change log --- doc/ChangeLog | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 02fd581f5c..f02feb5bac 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -3,7 +3,7 @@ Tag name: tbd Originator(s): Matt Dawson, Francis Vitt -Date: August 18, 2025 +Date: September 2, 2025 One-line Summary: Bug fixes in the cloud chemistry module Github PR URL: tbd @@ -63,7 +63,6 @@ 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: -mattdawson@derecho3:/glade/derecho/scratch/mattdawson/aux_cam_intel_20250815100530> ./cs.status.aux_cam_intel_20250815100530 | grep -v PASS | grep -v TPUTCOMP | grep -v MEMCOMP aux_cam_intel_20250815100530: 51 tests ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details: FAIL ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF From 1c1b30ff3119b7f71d327ff64a7b0312efbc48b2 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 2 Sep 2025 14:15:48 -0400 Subject: [PATCH 345/466] Update for reviewer comments in atmos_phys. --- src/physics/cam/vertical_diffusion.F90 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 0df4cd516f..e370f95c7b 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -383,6 +383,7 @@ subroutine vertical_diffusion_init(pbuf2d) amIRoot = masterproc, & iulog = iulog, & pver = pver, & + pverp = pverp, & karman = karman, & pref_mid = pref_mid, & is_hbr_pbl_scheme = (eddy_scheme .eq. 'HBR'), & @@ -398,6 +399,7 @@ subroutine vertical_diffusion_init(pbuf2d) amIRoot = masterproc, & iulog = iulog, & pver = pver, & + pverp = pverp, & karman = karman, & pref_mid = pref_mid, & is_hbr_pbl_scheme = (eddy_scheme .eq. 'HBR'), & @@ -1457,7 +1459,7 @@ subroutine vertical_diffusion_tend( & ncol = ncol, & pver = pver, & pverp = pverp, & - ztodt = ztodt, & + dt = ztodt, & rair = rair, & gravit = gravit, & do_iss = do_iss, & @@ -1495,7 +1497,7 @@ subroutine vertical_diffusion_tend( & call vertical_diffusion_diffuse_dry_static_energy_run( & ncol = ncol, & pver = pver, & - ztodt = ztodt, & + dt = ztodt, & gravit = gravit, & p = p, & ! Coords1D, pressure coordinates [Pa] rhoi = rhoi(:ncol,:pverp), & @@ -1514,7 +1516,7 @@ subroutine vertical_diffusion_tend( & ncol = ncol, & pver = pver, & ncnst = pcnst, & - ztodt = ztodt, & + dt = ztodt, & rair = rair, & gravit = gravit, & do_diffusion_const = do_diffusion_const_wet, & ! moist constituents to diffuse From 8b43f1d7b96a9c6181eea14c058f1e91f740d769 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 2 Sep 2025 14:39:00 -0400 Subject: [PATCH 346/466] Use PBL diagnostics module in atmos_phys --- src/physics/cam/vertical_diffusion.F90 | 256 +++++++++++-------------- 1 file changed, 116 insertions(+), 140 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index e370f95c7b..030818d456 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -481,8 +481,8 @@ subroutine vertical_diffusion_init(pbuf2d) call addfld( 'TPERT' , horiz_only , 'A', 'K' , 'Perturbation temperature (eddies in PBL)' ) call addfld( 'QPERT' , horiz_only , 'A', 'kg/kg' , 'Perturbation specific humidity (eddies in PBL)' ) - call addfld( 'UFLX' , (/ 'ilev' /) , 'A', 'W/m2' , 'Zonal momentum flux' ) - call addfld( 'VFLX' , (/ 'ilev' /) , 'A', 'W/m2' , 'Meridional momentm flux' ) + call addfld( 'UFLX' , (/ 'ilev' /) , 'A', 'N/m2' , 'Zonal momentum flux' ) + call addfld( 'VFLX' , (/ 'ilev' /) , 'A', 'N/m2' , 'Meridional momentm flux' ) call register_vector_field('UFLX', 'VFLX') ! For detailed analysis of UW moist turbulence scheme @@ -688,11 +688,15 @@ subroutine vertical_diffusion_tend( & use diffusion_solver, only: vertical_diffusion_tendencies_run use ccpp_constituent_prop_mod, only: ccpp_const_props + ! Diagnostic utility subroutine shared with CCPP-ized/SIMA + use vertical_diffusion_diagnostic_utils, only: vertical_diffusion_diagnostic_profiles use wv_saturation, only : qsat use diffusion_solver, only: vertical_diffusion_set_dry_static_energy_at_toa_molecdiff_run use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type + + ! Legacy version of diffusion solver supporting molecular diffusion for WACCM. use diffusion_solver_cam, only : compute_vdiff use air_composition, only : cpairv, rairv !Needed for calculation of upward H flux use air_composition, only : mbarv @@ -1359,35 +1363,6 @@ subroutine vertical_diffusion_tend( & u_tmp(:ncol,:) = state%u(:ncol,:) v_tmp(:ncol,:) = state%v(:ncol,:) - !------------------------------------------------------ ! - ! Write profile output before applying diffusion scheme ! - !------------------------------------------------------ ! - - if (.not. is_clubb_scheme) then - sl_prePBL(:ncol,:pver) = s_tmp(:ncol,:) - latvap * q_tmp(:ncol,:,ixcldliq) & - - ( latvap + latice) * q_tmp(:ncol,:,ixcldice) - qt_prePBL(:ncol,:pver) = q_tmp(:ncol,:,1) + q_tmp(:ncol,:,ixcldliq) & - + q_tmp(:ncol,:,ixcldice) - slv_prePBL(:ncol,:pver) = sl_prePBL(:ncol,:pver) * ( 1._r8 + zvir*qt_prePBL(:ncol,:pver) ) - - do k = 1, pver - call qsat(state%t(1:ncol,k), state%pmid(1:ncol,k), tem2(1:ncol,k), ftem(1:ncol,k), ncol) - end do - ftem_prePBL(:ncol,:) = state%q(:ncol,:,1)/ftem(:ncol,:)*100._r8 - - call outfld( 'qt_pre_PBL ', qt_prePBL, pcols, lchnk ) - call outfld( 'sl_pre_PBL ', sl_prePBL, pcols, lchnk ) - call outfld( 'slv_pre_PBL ', slv_prePBL, pcols, lchnk ) - call outfld( 'u_pre_PBL ', state%u, pcols, lchnk ) - call outfld( 'v_pre_PBL ', state%v, pcols, lchnk ) - call outfld( 'qv_pre_PBL ', state%q(:,:,1), pcols, lchnk ) - call outfld( 'ql_pre_PBL ', state%q(:,:,ixcldliq), pcols, lchnk ) - call outfld( 'qi_pre_PBL ', state%q(:,:,ixcldice), pcols, lchnk ) - call outfld( 't_pre_PBL ', state%t, pcols, lchnk ) - call outfld( 'rh_pre_PBL ', ftem_prePBL, pcols, lchnk ) - - end if - ! --------------------------------------------------------------------------------- ! ! Call the diffusivity solver and solve diffusion equation ! ! The final two arguments are optional function references to ! @@ -1717,87 +1692,6 @@ subroutine vertical_diffusion_tend( & end if end do - ! -------------------------------------------------------- ! - ! Diagnostics and output writing after applying PBL scheme ! - ! -------------------------------------------------------- ! - - if (.not. is_clubb_scheme) then - - sl(:ncol,:pver) = s_tmp(:ncol,:) - latvap * q_tmp(:ncol,:,ixcldliq) & - - ( latvap + latice) * q_tmp(:ncol,:,ixcldice) - qt(:ncol,:pver) = q_tmp(:ncol,:,1) + q_tmp(:ncol,:,ixcldliq) & - + q_tmp(:ncol,:,ixcldice) - slv(:ncol,:pver) = sl(:ncol,:pver) * ( 1._r8 + zvir*qt(:ncol,:pver) ) - - slflx(:ncol,1) = 0._r8 - qtflx(:ncol,1) = 0._r8 - uflx(:ncol,1) = 0._r8 - vflx(:ncol,1) = 0._r8 - - slflx_cg(:ncol,1) = 0._r8 - qtflx_cg(:ncol,1) = 0._r8 - uflx_cg(:ncol,1) = 0._r8 - vflx_cg(:ncol,1) = 0._r8 - - do k = 2, pver - do i = 1, ncol - rhoair = state%pint(i,k) / ( rair * ( ( 0.5_r8*(slv(i,k)+slv(i,k-1)) - gravit*state%zi(i,k))/cpair ) ) - slflx(i,k) = kvh(i,k) * & - ( - rhoair*(sl(i,k-1)-sl(i,k))/(state%zm(i,k-1)-state%zm(i,k)) & - + cgh(i,k) ) - qtflx(i,k) = kvh(i,k) * & - ( - rhoair*(qt(i,k-1)-qt(i,k))/(state%zm(i,k-1)-state%zm(i,k)) & - + rhoair*(cam_in%cflx(i,1)+cam_in%cflx(i,ixcldliq)+cam_in%cflx(i,ixcldice))*cgs(i,k) ) - uflx(i,k) = kvm(i,k) * & - ( - rhoair*(u_tmp(i,k-1)-u_tmp(i,k))/(state%zm(i,k-1)-state%zm(i,k))) - vflx(i,k) = kvm(i,k) * & - ( - rhoair*(v_tmp(i,k-1)-v_tmp(i,k))/(state%zm(i,k-1)-state%zm(i,k))) - slflx_cg(i,k) = kvh(i,k) * cgh(i,k) - qtflx_cg(i,k) = kvh(i,k) * rhoair * ( cam_in%cflx(i,1) + & - cam_in%cflx(i,ixcldliq) + cam_in%cflx(i,ixcldice) ) * cgs(i,k) - uflx_cg(i,k) = 0._r8 - vflx_cg(i,k) = 0._r8 - end do - end do - - ! Modification : I should check whether slflx(:ncol,pverp) is correctly computed. - ! Note also that 'tautotx' is explicit total stress, different from - ! the ones that have been actually added into the atmosphere. - - slflx(:ncol,pverp) = cam_in%shf(:ncol) - qtflx(:ncol,pverp) = cam_in%cflx(:ncol,1) - uflx(:ncol,pverp) = tautotx(:ncol) - vflx(:ncol,pverp) = tautoty(:ncol) - - slflx_cg(:ncol,pverp) = 0._r8 - qtflx_cg(:ncol,pverp) = 0._r8 - uflx_cg(:ncol,pverp) = 0._r8 - vflx_cg(:ncol,pverp) = 0._r8 - - if (trim(shallow_scheme) == 'UNICON') then - call pbuf_get_field(pbuf, qtl_flx_idx, qtl_flx) - call pbuf_get_field(pbuf, qti_flx_idx, qti_flx) - qtl_flx(:ncol,1) = 0._r8 - qti_flx(:ncol,1) = 0._r8 - do k = 2, pver - do i = 1, ncol - ! For use in the cloud macrophysics - ! Note that density is not added here. Also, only consider local transport term. - qtl_flx(i,k) = - kvh(i,k)*(q_tmp(i,k-1,1)-q_tmp(i,k,1)+q_tmp(i,k-1,ixcldliq)-q_tmp(i,k,ixcldliq))/& - (state%zm(i,k-1)-state%zm(i,k)) - qti_flx(i,k) = - kvh(i,k)*(q_tmp(i,k-1,1)-q_tmp(i,k,1)+q_tmp(i,k-1,ixcldice)-q_tmp(i,k,ixcldice))/& - (state%zm(i,k-1)-state%zm(i,k)) - end do - end do - do i = 1, ncol - rhoair = state%pint(i,pverp)/(rair*((slv(i,pver)-gravit*state%zi(i,pverp))/cpair)) - qtl_flx(i,pverp) = cam_in%cflx(i,1)/rhoair - qti_flx(i,pverp) = cam_in%cflx(i,1)/rhoair - end do - end if - - end if - ! --------------------------------------------------------------- ! ! Convert the new profiles into vertical diffusion tendencies. ! ! Convert KE dissipative heat change into "temperature" tendency. ! @@ -1833,9 +1727,103 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + ! -------------------------------------------------------- ! + ! Diagnostics and output writing after applying PBL scheme ! + ! -------------------------------------------------------- ! + if (.not. is_clubb_scheme) then - slten(:ncol,:) = ( sl(:ncol,:) - sl_prePBL(:ncol,:) ) * rztodt - qtten(:ncol,:) = ( qt(:ncol,:) - qt_prePBL(:ncol,:) ) * rztodt + + ! Unified computation of diagnostics shared with CCPP-ized scheme + call vertical_diffusion_diagnostic_profiles( & + ncol = ncol, & + pver = pver, & + pverp = pverp, & + ztodt = ztodt, & + latvap = latvap, & + latice = latice, & + zvir = zvir, & + cpair = cpair, & + gravit = gravit, & + rair = rair, & + pint = state%pint(:ncol, :pverp), & + pmid = state%pmid(:ncol, :pver), & + zi = state%zi(:ncol, :pverp), & + zm = state%zm(:ncol, :pver), & + kvh = kvh(:ncol, :pverp), & + kvm = kvm(:ncol, :pverp), & + cgh = cgh(:ncol, :pverp), & + cgs = cgs(:ncol, :pverp), & + cam_in_shf = cam_in%shf(:ncol), & + cam_in_cflx_wv = cam_in%cflx(:ncol, 1), & + cam_in_cflx_cldliq = cam_in%cflx(:ncol, ixcldliq), & + cam_in_cflx_cldice = cam_in%cflx(:ncol, ixcldice), & + tautotx = tautotx(:ncol), & ! these are the surface stresses to HB + tautoty = tautoty(:ncol), & ! these are the surface stresses to HB + t0 = state%t(:ncol, :pver), & + q0_wv = state%q(:ncol, :pver, ixq), & + q0_cldliq = state%q(:ncol, :pver, ixcldliq), & + q0_cldice = state%q(:ncol, :pver, ixcldice), & + s0 = state%s(:ncol, :pver), & + u0 = state%u(:ncol, :pver), & + v0 = state%v(:ncol, :pver), & + s1 = s_tmp(:ncol, :pver), & + u1 = u_tmp(:ncol, :pver), & + v1 = v_tmp(:ncol, :pver), & + tend_s = ptend%s(:ncol, :pver), & + tend_u = ptend%u(:ncol, :pver), & + tend_v = ptend%v(:ncol, :pver), & + tend_q_wv = ptend%q(:ncol, :pver, ixq), & + tend_q_cldliq = ptend%q(:ncol, :pver, ixcldliq), & + tend_q_cldice = ptend%q(:ncol, :pver, ixcldice), & + qt_pre_PBL = qt_prePBL(:ncol, :pver), & + sl_pre_PBL = sl_prePBL(:ncol, :pver), & + slv_pre_PBL = slv_prePBL(:ncol, :pver), & + rh_pre_PBL = ftem_prePBL(:ncol, :pver), & + qt_aft_PBL = qt(:ncol, :pver), & + sl_aft_PBL = sl(:ncol, :pver), & + slv_aft_PBL = slv(:ncol, :pver), & + qv_aft_PBL = qv_aft_PBL(:ncol, :pver), & + ql_aft_PBL = ql_aft_PBL(:ncol, :pver), & + qi_aft_PBL = qi_aft_PBL(:ncol, :pver), & + t_aft_PBL = t_aftPBL(:ncol, :pver), & + rh_aft_PBL = ftem_aftPBL(:ncol, :pver), & + u_aft_PBL = u_aft_PBL(:ncol, :pver), & + v_aft_PBL = v_aft_PBL(:ncol, :pver), & + slflx = slflx(:ncol, :pverp), & + qtflx = qtflx(:ncol, :pverp), & + uflx = uflx(:ncol, :pverp), & + vflx = vflx(:ncol, :pverp), & + slflx_cg = slflx_cg(:ncol, :pverp), & + qtflx_cg = qtflx_cg(:ncol, :pverp), & + uflx_cg = uflx_cg(:ncol, :pverp), & + vflx_cg = vflx_cg(:ncol, :pverp), & + slten = slten(:ncol, :pver), & + qtten = qtten(:ncol, :pver), & + tten = tten(:ncol, :pver), & + rhten = rhten(:ncol, :pver)) + + if (trim(shallow_scheme) == 'UNICON') then + call pbuf_get_field(pbuf, qtl_flx_idx, qtl_flx) + call pbuf_get_field(pbuf, qti_flx_idx, qti_flx) + qtl_flx(:ncol,1) = 0._r8 + qti_flx(:ncol,1) = 0._r8 + do k = 2, pver + do i = 1, ncol + ! For use in the cloud macrophysics + ! Note that density is not added here. Also, only consider local transport term. + qtl_flx(i,k) = - kvh(i,k)*(q_tmp(i,k-1,1)-q_tmp(i,k,1)+q_tmp(i,k-1,ixcldliq)-q_tmp(i,k,ixcldliq))/& + (state%zm(i,k-1)-state%zm(i,k)) + qti_flx(i,k) = - kvh(i,k)*(q_tmp(i,k-1,1)-q_tmp(i,k,1)+q_tmp(i,k-1,ixcldice)-q_tmp(i,k,ixcldice))/& + (state%zm(i,k-1)-state%zm(i,k)) + end do + end do + do i = 1, ncol + rhoair = state%pint(i,pverp)/(rair*((slv(i,pver)-gravit*state%zi(i,pverp))/cpair)) + qtl_flx(i,pverp) = cam_in%cflx(i,1)/rhoair + qti_flx(i,pverp) = cam_in%cflx(i,1)/rhoair + end do + end if + end if ! ------------------------------------------------------------ ! @@ -1892,32 +1880,6 @@ subroutine vertical_diffusion_tend( & end if - ! ----------------------------------------------------------------- ! - ! Re-calculate diagnostic output variables after vertical diffusion ! - ! ----------------------------------------------------------------- ! - - if (.not. is_clubb_scheme) then - - qv_aft_PBL(:ncol,:pver) = state%q(:ncol,:pver,1) + ptend%q(:ncol,:pver,1) * ztodt - ql_aft_PBL(:ncol,:pver) = state%q(:ncol,:pver,ixcldliq) + ptend%q(:ncol,:pver,ixcldliq) * ztodt - qi_aft_PBL(:ncol,:pver) = state%q(:ncol,:pver,ixcldice) + ptend%q(:ncol,:pver,ixcldice) * ztodt - s_aft_PBL(:ncol,:pver) = state%s(:ncol,:pver) + ptend%s(:ncol,:pver) * ztodt - t_aftPBL(:ncol,:pver) = ( s_aft_PBL(:ncol,:pver) - gravit*state%zm(:ncol,:pver) ) / cpair - - u_aft_PBL(:ncol,:pver) = state%u(:ncol,:pver) + ptend%u(:ncol,:pver) * ztodt - v_aft_PBL(:ncol,:pver) = state%v(:ncol,:pver) + ptend%v(:ncol,:pver) * ztodt - - do k = 1, pver - call qsat(t_aftPBL(1:ncol,k), state%pmid(1:ncol,k), tem2(1:ncol,k), ftem(1:ncol,k), ncol) - end do - ftem_aftPBL(:ncol,:pver) = qv_aft_PBL(:ncol,:pver) / ftem(:ncol,:pver) * 100._r8 - - tten(:ncol,:pver) = ( t_aftPBL(:ncol,:pver) - state%t(:ncol,:pver) ) * rztodt - rhten(:ncol,:pver) = ( ftem_aftPBL(:ncol,:pver) - ftem_prePBL(:ncol,:pver) ) * rztodt - - end if - - ! -------------------------------------------------------------- ! ! mass conservation check......... ! -------------------------------------------------------------- ! @@ -1962,6 +1924,20 @@ subroutine vertical_diffusion_tend( & ! ------------------------------------------- ! if (.not. is_clubb_scheme) then + + ! Write profile output of before diffusion scheme + call outfld( 'qt_pre_PBL ', qt_prePBL, pcols, lchnk ) + call outfld( 'sl_pre_PBL ', sl_prePBL, pcols, lchnk ) + call outfld( 'slv_pre_PBL ', slv_prePBL, pcols, lchnk ) + call outfld( 'u_pre_PBL ', state%u, pcols, lchnk ) + call outfld( 'v_pre_PBL ', state%v, pcols, lchnk ) + call outfld( 'qv_pre_PBL ', state%q(:,:,1), pcols, lchnk ) + call outfld( 'ql_pre_PBL ', state%q(:,:,ixcldliq), pcols, lchnk ) + call outfld( 'qi_pre_PBL ', state%q(:,:,ixcldice), pcols, lchnk ) + call outfld( 't_pre_PBL ', state%t, pcols, lchnk ) + call outfld( 'rh_pre_PBL ', ftem_prePBL, pcols, lchnk ) + + ! Standard output variables call outfld( 'QT' , qt, pcols, lchnk ) call outfld( 'SL' , sl, pcols, lchnk ) call outfld( 'SLV' , slv, pcols, lchnk ) From 961411d27b4e612713f7edaba12ca2d6e9ce60e7 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 2 Sep 2025 14:42:44 -0400 Subject: [PATCH 347/466] Change ztodt to dt in atmos_phys interfaces --- src/physics/cam/vertical_diffusion.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 030818d456..0a0c689efd 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1738,7 +1738,7 @@ subroutine vertical_diffusion_tend( & ncol = ncol, & pver = pver, & pverp = pverp, & - ztodt = ztodt, & + dt = ztodt, & latvap = latvap, & latice = latice, & zvir = zvir, & From 13e1132b5059d05564dad50d2f0a5f1b627ea5d9 Mon Sep 17 00:00:00 2001 From: Matt Dawson Date: Tue, 2 Sep 2025 15:04:33 -0600 Subject: [PATCH 348/466] update change log --- doc/ChangeLog | 186 ++++++++++++++++++++++---------------------------- 1 file changed, 83 insertions(+), 103 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a91492a455..47ee071c82 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,11 +1,11 @@ =============================================================== -Tag name: tbd +Tag name: cam6_4_112 Originator(s): Matt Dawson, Francis Vitt Date: September 2, 2025 One-line Summary: Bug fixes in the cloud chemistry module -Github PR URL: tbd +Github PR URL: https://github.com/ESCOMP/cesm/pull/1369 Purpose of changes (include the issue number and title text for each relevant GitHub issue): GitHub Issue 1345 @@ -63,163 +63,143 @@ 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: -aux_cam_intel_20250815100530: 51 tests +aux_cam_intel_20250902105209: 48 tests + ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + FAIL ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details: - FAIL ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s (Overall: DIFF) details: - FAIL ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: - FAIL ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: - FAIL ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details: - FAIL ERC_D_Ln9.ne16_ne16_mg17.QPC5HIST.derecho_intel.cam-outfrq3s_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERC_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase (Overall: DIFF) details: - FAIL ERC_D_Ln9_P144x1.ne16pg3_ne16pg3_mg17.QPC6HIST.derecho_intel.cam-outfrq3s_ttrac_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF + ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + FAIL ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF + ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + FAIL ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + FAIL ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: - FAIL ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: - FAIL ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 (Overall: DIFF) details: - FAIL ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERP_Ln9.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.f09_f09_mg17.F2000climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.f09_f09_mg17.FHIST_BDRD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) details: - FAIL ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details: - FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep (Overall: DIFF) details: - FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase (Overall: DIFF) details: - FAIL SMS_D_Ld2.f19_f19_mg17.QPC5HIST.derecho_intel.cam-volc_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) details: - FAIL SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) details: - FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details: - FAIL SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF - SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.f19_f19_mg17.QPC5M7.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF + SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 (Overall: DIFF) details: + FAIL SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) details: FAIL SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s SETUP SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: - FAIL SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: - FAIL SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: - FAIL SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details: - FAIL SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging (Overall: DIFF) details: - FAIL SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s (Overall: DIFF) details: - FAIL SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs (Overall: DIFF) details: - FAIL SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details: - FAIL SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_intel: DIFF + FAIL SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_intel: DIFF derecho/nvhpc/aux_cam: -aux_cam_nvhpc_20250815100605: 1 test +aux_cam_nvhpc_20250902105230: 1 test ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF) details: - FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_101_nvhpc: DIFF + FAIL ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default BASELINE /glade/campaign/cesm/community/amwg/cam_baselines/cam6_4_111_nvhpc: DIFF izumi/nag/aux_cam: -aux_cam_nag_20250814122118: 31 tests - ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-carma_sea_salt BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_cosp BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF +TR8 test PASS +TGIT test PASS +aux_cam_nag_20250902111953: 20 tests ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_am BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s_cospsathist BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPC6.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + FAIL ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details: - FAIL ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + FAIL ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF + ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details: + FAIL ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details: - FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac (Overall: DIFF) details: - FAIL ERC_D_Ln9.ne5_ne5_mg37.QPC5.izumi_nag.cam-outfrq3s_ttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: DIFF) details: - FAIL ERI_D_Ln18.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 (Overall: DIFF) details: - FAIL ERI_D_Ln18.f19_f19_mg17.QPC6.izumi_nag.cam-ghgrmp_e8 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - ERP_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf (Overall: DIFF) details: - FAIL ERP_Ln9.ne5pg3_ne5pg3_mg37.QPC6.izumi_nag.cam-outfrq9s_clubbmf BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 (Overall: DIFF) details: - FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal0 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 (Overall: DIFF) details: - FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal1 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 (Overall: DIFF) details: - FAIL PLB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-ttrac_loadbal3 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam (Overall: DIFF) details: - FAIL SMS_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-rad_diag_mam BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal0 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal0 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal1 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal1 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal3 (Overall: DIFF) details: + FAIL PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-ttrac_loadbal3 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: DIFF) details: - FAIL SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase (Overall: DIFF) details: - FAIL SMS_P48x1_D_Ln3.f09_f09_mg17.QPC6HIST.izumi_nag.cam-outfrq3s_co2cycle_usecase BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + FAIL SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s (Overall: DIFF) details: - FAIL SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF - TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac (Overall: DIFF) details: - FAIL TMC_D.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_eoyttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_nag: DIFF + FAIL SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF + TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac (Overall: DIFF) details: + FAIL TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_nag: DIFF izumi/gnu/aux_cam: -aux_cam_gnu_20250814122709: 19 tests +aux_cam_gnu_20250902112104: 21 tests + ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) details: + FAIL ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: - FAIL ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_gnu.cam-carma_cosp_rad_diag_mam (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_gnu.cam-carma_cosp_rad_diag_mam BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + FAIL ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF - ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: - FAIL ERP_Ln9.ne5_ne5_mg37.QPC5.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) details: - FAIL ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: - FAIL ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 (Overall: DIFF) details: - FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc (Overall: DIFF) details: - FAIL SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF - SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac (Overall: DIFF) details: - FAIL SMS_D_Ln9.ne5pg3_ne5pg3_mg37.QPC5.izumi_gnu.cam-outfrq3s_ttrac BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_101_gnu: DIFF + FAIL SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc BASELINE /fs/cgd/csm/models/atm/cam/pretag_bl/cam6_4_111_gnu: DIFF CAM tag used for the baseline comparison tests if different than previous -tag: cam6_4_101 +tag: cam6_4_111 Summarize any changes to answers, i.e., - what code configurations: anyhting that includes cloud chemistry From d4398a8a5db409550cf0af6b3727f9945d5ab100 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Tue, 2 Sep 2025 20:26:59 -0400 Subject: [PATCH 349/466] Fix build --- src/physics/cam/vertical_diffusion.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 0a0c689efd..0abbfb1543 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1508,7 +1508,7 @@ subroutine vertical_diffusion_tend( & ubc_mmr = ubc_mmr(:ncol,:pcnst), & cnst_fixed_ubc = cnst_fixed_ubc(:pcnst), & q0 = state%q(:ncol,:pver,:pcnst), & - q = q_tmp(:ncol,:pver,:pcnst), & + q1 = q_tmp(:ncol,:pver,:pcnst), & errmsg = errmsg, & errflg = errflg) else From 3d886ccfdbffc5c802ae894e6065bb41276136bc Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 3 Sep 2025 12:32:50 -0600 Subject: [PATCH 350/466] grab latest atmos phys hash --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 1d766a0757..f47bbd06a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -36,7 +36,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/peverwhee/atmospheric_physics - fxtag = ad12f78752c62eadb03f28f68df0d4fb9678e575 + fxtag = d36b8d9093b09c521401a8bdd1583fbb507549fe fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index ad12f78752..d36b8d9093 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit ad12f78752c62eadb03f28f68df0d4fb9678e575 +Subproject commit d36b8d9093b09c521401a8bdd1583fbb507549fe From 832146583788c8a93fb7041079484f7c97a4ea43 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 3 Sep 2025 15:14:07 -0400 Subject: [PATCH 351/466] Merge in WACCM-X eddy_top handling to regular version. --- src/physics/cam/vertical_diffusion.F90 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 0abbfb1543..c68e80442e 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -271,7 +271,6 @@ subroutine vertical_diffusion_init(pbuf2d) use vertical_diffusion_sponge_layer, only: vertical_diffusion_sponge_layer_init use holtslag_boville_diff_interstitials, only: hb_diff_set_vertical_diffusion_top_init - use holtslag_boville_diff_interstitials, only: hb_diff_set_vertical_diffusion_top_waccmx_init use molec_diff, only : init_molec_diff use diffusion_solver_cam, only : init_vdiff @@ -360,11 +359,7 @@ subroutine vertical_diffusion_init(pbuf2d) ! ntop_eddy must be 1 or <= nbot_molec ! Currently, it is always 1 except for WACCM-X. - if ( waccmx_mode ) then - call hb_diff_set_vertical_diffusion_top_waccmx_init(ntop_eddy=ntop_eddy, errmsg=errmsg, errflg=errflg) - else - call hb_diff_set_vertical_diffusion_top_init(ntop_eddy=ntop_eddy, errmsg=errmsg, errflg=errflg) - end if + call hb_diff_set_vertical_diffusion_top_init(ntop_eddy=ntop_eddy, errmsg=errmsg, errflg=errflg) nbot_eddy = pver if (masterproc) write(iulog, fmt='(a,i3,5x,a,i3)') 'NTOP_EDDY =', ntop_eddy, 'NBOT_EDDY =', nbot_eddy From f078efb8915708700dea7620be869696e4600062 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 3 Sep 2025 16:01:14 -0600 Subject: [PATCH 352/466] remove unused file - routines CCPPized and moved to atmospheric_phyics --- src/physics/rrtmgp/rad_solar_var.F90 | 156 --------------------------- 1 file changed, 156 deletions(-) delete mode 100644 src/physics/rrtmgp/rad_solar_var.F90 diff --git a/src/physics/rrtmgp/rad_solar_var.F90 b/src/physics/rrtmgp/rad_solar_var.F90 deleted file mode 100644 index bda38e2543..0000000000 --- a/src/physics/rrtmgp/rad_solar_var.F90 +++ /dev/null @@ -1,156 +0,0 @@ -!------------------------------------------------------------------------------- -! This module uses the solar irradiance data -! to provide a spectral scaling factor -! to approximate the spectral distribution of irradiance -! when the radiation scheme might use a different solar source function -!------------------------------------------------------------------------------- -module rad_solar_var - - use shr_kind_mod , only : r8 => shr_kind_r8 - use radiation_utils, only : get_sw_spectral_boundaries_ccpp - use solar_irrad_data, only : sol_irrad, we, nbins, has_spectrum, sol_tsi - use solar_irrad_data, only : do_spctrl_scaling - use cam_abortutils, only : endrun - use error_messages, only : alloc_err - - implicit none - save - - private - public :: rad_solar_var_init - public :: get_variability - - real(r8), allocatable :: irrad(:) ! solar irradiance at model timestep in each band - - real(r8), allocatable :: radbinmax(:) - real(r8), allocatable :: radbinmin(:) - -!------------------------------------------------------------------------------- -contains -!------------------------------------------------------------------------------- - - subroutine rad_solar_var_init(nswbands) - integer, intent(in) :: nswbands - - integer :: ierr, errflg - integer :: radmax_loc - character(len=512) :: errmsg - - if ( do_spctrl_scaling ) then - - if ( .not.has_spectrum ) then - call endrun('rad_solar_var_init: solar input file must have irradiance spectrum') - endif - - allocate (radbinmax(nswbands),stat=ierr) - if (ierr /= 0) then - call endrun('rad_solar_var_init: Error allocating space for radbinmax') - end if - - allocate (radbinmin(nswbands),stat=ierr) - if (ierr /= 0) then - call endrun('rad_solar_var_init: Error allocating space for radbinmin') - end if - - allocate (irrad(nswbands), stat=ierr) - if (ierr /= 0) then - call endrun('rad_solar_var_init: Error allocating space for irrad') - end if - - call get_sw_spectral_boundaries_ccpp(radbinmin, radbinmax, 'nm', errmsg, errflg) - if (errflg /= 0) then - call endrun('rad_solar_var_init: Error during get_sw_spectral_boundaries_ccpp - message: "'//errmsg//'"') - end if - - ! Make sure that the far-IR is included, even if radiation grid does not - ! extend that far down. 10^5 nm corresponds to a wavenumber of - ! 100 cm^-1. - radmax_loc = maxloc(radbinmax,1) - radbinmax(radmax_loc) = max(100000._r8,radbinmax(radmax_loc)) - - endif - - end subroutine rad_solar_var_init - -!------------------------------------------------------------------------------- -!------------------------------------------------------------------------------- - - subroutine get_variability(toa_flux, sfac, band2gpt_sw, nswbands) - - ! Arguments - real(r8), intent(in) :: toa_flux(:,:) ! TOA flux to be scaled (columns,gpts) - real(r8), intent(out) :: sfac(:,:) ! scaling factors (columns,gpts) - integer, intent(in) :: band2gpt_sw(:,:) - integer, intent(in) :: nswbands - - ! Local variables - integer :: i, j, istat, gpt_start, gpt_end, ncols - real(r8), allocatable :: scale(:) - character(len=*), parameter :: sub = 'get_variability' - - if (do_spctrl_scaling) then - - ! Determine target irradiance for each band - call integrate_spectrum(nbins, nswbands, we, radbinmin, radbinmax, sol_irrad, irrad) - - ncols = size(toa_flux, 1) - allocate(scale(ncols), stat=istat) - call alloc_err(istat, sub, 'scale', ncols) - - do i = 1, nswbands - gpt_start = band2gpt_sw(1,i) - gpt_end = band2gpt_sw(2,i) - scale = spread(irrad(i), 1, ncols) / sum(toa_flux(:, gpt_start:gpt_end), dim=2) - do j = gpt_start, gpt_end - sfac(:,j) = scale - end do - end do - - else - sfac(:,:) = sol_tsi / spread(sum(toa_flux, 2), 2, size(toa_flux, 2)) - end if - end subroutine get_variability - - -!------------------------------------------------------------------------------- -! private method......... -!------------------------------------------------------------------------------- - - subroutine integrate_spectrum( nsrc, ntrg, src_x, min_trg, max_trg, src, trg ) - - use mo_util, only : rebin - - implicit none - - !--------------------------------------------------------------- - ! ... dummy arguments - !--------------------------------------------------------------- - integer, intent(in) :: nsrc ! dimension source array - integer, intent(in) :: ntrg ! dimension target array - real(r8), intent(in) :: src_x(nsrc+1) ! source coordinates - real(r8), intent(in) :: max_trg(ntrg) ! target coordinates - real(r8), intent(in) :: min_trg(ntrg) ! target coordinates - real(r8), intent(in) :: src(nsrc) ! source array - real(r8), intent(out) :: trg(ntrg) ! target array - - !--------------------------------------------------------------- - ! ... local variables - !--------------------------------------------------------------- - real(r8) :: trg_x(2), targ(1) ! target coordinates - integer :: i - - do i = 1, ntrg - - trg_x(1) = min_trg(i) - trg_x(2) = max_trg(i) - - call rebin( nsrc, 1, src_x, trg_x, src(1:nsrc), targ(:) ) - ! W/m2/nm --> W/m2 - trg( i ) = targ(1)*(trg_x(2)-trg_x(1)) - - enddo - - - end subroutine integrate_spectrum - -end module rad_solar_var From 1334a6ec3d68044bf3b237c28359586cfed6c851 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 4 Sep 2025 12:05:37 -0600 Subject: [PATCH 353/466] Update pre-industrial solar forcing files to CMIP7 version --- bld/namelist_files/use_cases/1850_cam6.xml | 2 +- bld/namelist_files/use_cases/1850_cam_lt.xml | 2 +- bld/namelist_files/use_cases/1850_cam_mt.xml | 2 +- bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml | 4 ++-- bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml | 6 +++--- src/atmos_phys | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bld/namelist_files/use_cases/1850_cam6.xml b/bld/namelist_files/use_cases/1850_cam6.xml index 7f4cf09a5c..f44f238ad8 100644 --- a/bld/namelist_files/use_cases/1850_cam6.xml +++ b/bld/namelist_files/use_cases/1850_cam6.xml @@ -4,7 +4,7 @@ cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.i.0301-01-01-00000.nc - 'atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc' + 'atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc' 18500101 FIXED diff --git a/bld/namelist_files/use_cases/1850_cam_lt.xml b/bld/namelist_files/use_cases/1850_cam_lt.xml index d046c8bec7..beb918f6ea 100644 --- a/bld/namelist_files/use_cases/1850_cam_lt.xml +++ b/bld/namelist_files/use_cases/1850_cam_lt.xml @@ -2,7 +2,7 @@ -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc 18500101 FIXED diff --git a/bld/namelist_files/use_cases/1850_cam_mt.xml b/bld/namelist_files/use_cases/1850_cam_mt.xml index 68e7ca4a1a..bbe9e365d7 100644 --- a/bld/namelist_files/use_cases/1850_cam_mt.xml +++ b/bld/namelist_files/use_cases/1850_cam_mt.xml @@ -2,7 +2,7 @@ -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc 18500101 FIXED diff --git a/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml index fbd7423680..39fd544b57 100644 --- a/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml @@ -11,15 +11,15 @@ cesm2_init/b.e20.BWma1850.f19_g17.release_cesm2_1_0.020/0289-01-01/b.e20.BWma1850.f19_g17.release_cesm2_1_0.020.cam.i.0289-01-01-00000.nc -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc 18500101 FIXED -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc epp_ion_rates diff --git a/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml index 77184615a1..e02e944804 100644 --- a/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml @@ -5,12 +5,12 @@ 19790101 -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc 18500101 FIXED -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc cesm2_init/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001/0003-01-01/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001.cam.i.0003-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml index eefbf88163..3616c80298 100644 --- a/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml @@ -7,15 +7,15 @@ 1850 -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc 18500701 FIXED -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc -atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc +atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc epp_ion_rates diff --git a/src/atmos_phys b/src/atmos_phys index 470f1fee56..e4d9da925b 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 470f1fee56af645c44493afab6c042d2d15e9311 +Subproject commit e4d9da925ba44f503f85a9aef1b7fe972bb9f25f From 089ff65aac44cf3b5979ab7e140fda664dd0517f Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 4 Sep 2025 14:59:29 -0400 Subject: [PATCH 354/466] change cam7 flag to apply_nonwv_cflx for clarity --- src/physics/cam/vertical_diffusion.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index c68e80442e..af6bfb5fa6 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1034,14 +1034,14 @@ subroutine vertical_diffusion_tend( & pverp = pverp, & pcnst = pcnst, & const_props = ccpp_const_props, & - flag_for_cflux = cam_physpkg_is("cam7"), & ! does vertical diffusion apply ANY fluxes? + apply_nonwv_cflx = (.not. cam_physpkg_is("cam7")), & ! does vertical diffusion apply ANY fluxes? cflx_from_coupler = cam_in%cflx(:ncol,:pcnst), & pint = state%pint(:ncol,:pverp), & ! below output taux = taux(:ncol), & ! these are zero since handled by CLUBB. tauy = tauy(:ncol), & ! these are zero since handled by CLUBB. shflux = shflux(:ncol), & ! these are zero since handled by CLUBB. - cflux = cflux(:ncol,:pcnst), & ! if flag_for_cflux, contains non-wv. fluxes, otherwise 0 + cflux = cflux(:ncol,:pcnst), & ! if apply_nonwv_cflx, contains non-wv. fluxes, otherwise 0 itaures = itaures, & p = p, & q_wv_cflx = q_wv_cflx(:ncol), & ! for use in HB for kinematic water vapor flux calc. From 36cfbcedc8734dfdbcdbf654b1ce9a7aed622f23 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 4 Sep 2025 17:27:58 -0400 Subject: [PATCH 355/466] update ChangeLog --- doc/ChangeLog | 264 +++++++++++++++++++++++++------------------------- 1 file changed, 132 insertions(+), 132 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 42013e2f22..19cdbe1be7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,136 @@ +=============================================================== + +Tag name: cam6_4_113 +Originator(s): eaton +Date: +One-line Summary: testing updates +Github PR URL: https://github.com/ESCOMP/CAM/pull/1374 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + +. Refactor cam4 testing. +. Move more tests from aquaplanet to F compsets. +. Update masks, change ERP to ERC +. Move some tests from nag to gnu on izumi for better load balance. +. Add subcolumn test to SE grid +. Update nvhpc/gpu test to cam7. +. Fix misconfigured output in silhs test. + +Describe any changes made to build system: none + +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: cacraig + +List all files eliminated: + +cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/* +cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/* +. remove unused testmods + +List all files added and what they do: none + +List all existing files that have been modified, and describe the changes: + +cime_config/config_compsets.xml +. remove unused QPC41850 + +cime_config/testdefs/testlist_cam.xml +. move the PLB tests from nag to gnu on izumi +. update mask, change ERP to ERC + replace + ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPC7.izumi_gnu.cam-outfrq9s + ERC_D_Ln9.f10_f10_mg37.FHIST_C5.izumi_gnu.cam-rad_diag/ + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag/ +. add subcol test on SE grid + replace + SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s + by + SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s +. move subcol test to F compset + replace + ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol + by + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-outfrq3s_subcol +. consolidate tests, update mask + replace + ERC_D_Ln9.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + ERC_D_Ln9.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s +. move cam4 ERI test to F compset. + replace + ERI_D_Ln18.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase + by + ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri +. consolidate cam4 co2rmp test with existing test. + replace + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C4.izumi_gnu.cam-outfrq9s + by + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp +. update mask + replace + SMS_D_Ld5.f19_f19_mg17.PC4.derecho_intel.cam-cam4_port5d + SMS_Ld5.f09_f09_mg17.PC6.derecho_intel.cam-cam6_port_f09 + ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp + by + SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d + SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 + ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp +. update nvhpc/gpu test to cam7 + replace + ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default + by + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default +. fix misconfigured output in silhs test, and update mask + replace + SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs + by + SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs +. modify FV3 tests: + replace + ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 + ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s + by + ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s + ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s + +cime_config/testdefs/testmods_dirs/cam/co2rmp/* +. modify to use default start date +. change to nhtfrq=9; use default for ramp_co2_start_ymd (begining of run) + +cime_config/testdefs/testmods_dirs/cam/silhs/* +. set nhtfrq=9,9,9,9 so history output is produced by 9 step run. + +cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/* +. modify test to not unset the use case and use the default start date. + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +CAM tag used for the baseline comparison tests if different than previous +tag: +Summarize any changes to answers: No answer changes. All diffs due to new + and modified test configurations. + +=============================================================== =============================================================== Tag name: cam6_4_112 @@ -224,138 +356,6 @@ MSS location of control simulations used to validate new climate: URL for AMWG diagnostics output used to validate new climate: -=============================================================== - -Tag name: -Originator(s): -Date: -One-line Summary: testing updates -Github PR URL: - -Purpose of changes (include the issue number and title text for each relevant GitHub issue): - -. Refactor cam4 testing. -. Move more tests from aquaplanet to F compsets. -. Update masks, change ERP to ERC -. Move some tests from nag to gnu on izumi for better load balance. -. Add subcolumn test to SE grid -. Update nvhpc/gpu test to cam7. -. Fix misconfigured output in silhs test. - -Describe any changes made to build system: none - -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: - -List all files eliminated: - -cime_config/testdefs/testmods_dirs/cam/co2rmp_1850/* -cime_config/testdefs/testmods_dirs/cam/co2rmp_usecase/* -. remove unused testmods - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -cime_config/config_compsets.xml -. remove unused QPC41850 - -cime_config/testdefs/testlist_cam.xml -. move the PLB tests from nag to gnu on izumi -. update mask, change ERP to ERC - replace - ERP_D_Ln9.ne3pg3_ne3pg3_mg37.QPC7.izumi_gnu.cam-outfrq9s - ERC_D_Ln9.f10_f10_mg37.FHIST_C5.izumi_gnu.cam-rad_diag/ - by - ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s - ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag/ -. add subcol test on SE grid - replace - SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s - by - SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s -. move subcol test to F compset - replace - ERC_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s_subcol - by - ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-outfrq3s_subcol -. consolidate tests, update mask - replace - ERC_D_Ln9.ne16_ne16_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase - ERC_D_Ln9.ne16pg3_ne16pg3_mg17.QPC4.izumi_nag.cam-outfrq3s_usecase - by - ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s -. move cam4 ERI test to F compset. - replace - ERI_D_Ln18.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase - by - ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri -. consolidate cam4 co2rmp test with existing test. - replace - ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C4.izumi_gnu.cam-outfrq9s - by - ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp -. update mask - replace - SMS_D_Ld5.f19_f19_mg17.PC4.derecho_intel.cam-cam4_port5d - SMS_Ld5.f09_f09_mg17.PC6.derecho_intel.cam-cam6_port_f09 - ERC_D_Ln9.f19_f19_mg17.QPC6.derecho_intel.cam-outfrq3s_cosp - by - SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d - SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 - ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp -. update nvhpc/gpu test to cam7 - replace - ERS_Ln9.ne30pg3_ne30pg3_mg17.F2000dev.derecho_nvhpc.cam-outfrq9s_gpu_default - by - ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default -. fix misconfigured output in silhs test, and update mask - replace - SMS_Ln9.f19_f19_mg17.F2000climo.derecho_intel.cam-silhs - by - SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs -. modify FV3 tests: - replace - ERP_Ln9.C96_C96_mg17.F2000climo.derecho_intel.cam-outfrq9s_mg3 - ERP_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s - by - ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s - ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s - -cime_config/testdefs/testmods_dirs/cam/co2rmp/* -. modify to use default start date -. change to nhtfrq=9; use default for ramp_co2_start_ymd (begining of run) - -cime_config/testdefs/testmods_dirs/cam/silhs/* -. set nhtfrq=9,9,9,9 so history output is produced by 9 step run. - -cime_config/testdefs/testmods_dirs/cam/outfrq3s_subcol/* -. modify test to not unset the use case and use the default start date. - -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: - -derecho/nvhpc/aux_cam: - -izumi/nag/aux_cam: - -izumi/gnu/aux_cam: - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: No answer changes. All diffs due to new - and modified test configurations. - =============================================================== =============================================================== From d832ce39decde0eee50e5bea2098667570d138b9 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Thu, 4 Sep 2025 18:25:28 -0400 Subject: [PATCH 356/466] update ChangeLog --- doc/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 19cdbe1be7..3dfe0973e9 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,7 +2,7 @@ Tag name: cam6_4_113 Originator(s): eaton -Date: +Date: 5 September 2025 One-line Summary: testing updates Github PR URL: https://github.com/ESCOMP/CAM/pull/1374 From 85655d0380121723f60f089b01e241ebece0752c Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 4 Sep 2025 21:47:46 -0600 Subject: [PATCH 357/466] use official tag instead of hash for testing --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index eb5fbc57dc..f353a3240d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = d36b8d9093b09c521401a8bdd1583fbb507549fe + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_16_001 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From 9398be6e9770f426de97c05fd02aada4f32fa5b6 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 4 Sep 2025 21:51:26 -0600 Subject: [PATCH 358/466] update submodule --- src/atmos_phys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atmos_phys b/src/atmos_phys index d36b8d9093..470f1fee56 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit d36b8d9093b09c521401a8bdd1583fbb507549fe +Subproject commit 470f1fee56af645c44493afab6c042d2d15e9311 From 9099d29dcff40269c8ab816f3698758bae60abe9 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Fri, 5 Sep 2025 09:23:11 -0400 Subject: [PATCH 359/466] update ChangeLog --- doc/ChangeLog | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3dfe0973e9..4a40698cec 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -118,12 +118,40 @@ appropriate machine below. All failed tests must be justified. derecho/intel/aux_cam: +ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) +ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) +ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) +SMS_D_Ld5.f09_f09_mt232.PC6.derecho_intel.cam-cam6_port_f09 (Overall: DIFF) +SMS_D_Ld5.f19_f19_mt232.PC4.derecho_intel.cam-cam4_port5d (Overall: DIFF) +SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs (Overall: DIFF) +- new tests - no baselines + +SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) +- pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + derecho/nvhpc/aux_cam: +ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: DIFF) +- new test - no baseline + izumi/nag/aux_cam: +ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-outfrq3s_subcol (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s (Overall: DIFF) +- new tests - no baselines + izumi/gnu/aux_cam: +ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) +ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp (Overall: DIFF) +ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s (Overall: DIFF) +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 (Overall: DIFF) +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 (Overall: DIFF) +PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 (Overall: DIFF) +SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s (Overall: DIFF) +- new tests - no baselines + CAM tag used for the baseline comparison tests if different than previous tag: From abc6441e5b284761a6ec47c820dbabdb26aa07d0 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 5 Sep 2025 12:49:54 -0600 Subject: [PATCH 360/466] Revert back to CAM6 SolarForcing files for CAM6 use_cases --- .gitmodules | 4 ++-- bld/namelist_files/use_cases/1850_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml | 2 +- .../use_cases/carma_trop_strat_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_geoschem.xml | 2 +- bld/namelist_files/use_cases/hist_geoschem_nudged.xml | 2 +- .../use_cases/hist_trop_strat_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml | 2 +- .../use_cases/hist_trop_strat_vbsext_cam6.xml | 2 +- .../use_cases/hist_trop_strat_vbsfire_cam6.xml | 2 +- bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml | 4 ++-- bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml | 6 +++--- bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml | 6 +++--- 20 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5642d67e9b..d973c73ca8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = 621f46c1378141bc2d403af693b6c04d2f862dcf + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_16_002 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/bld/namelist_files/use_cases/1850_cam6.xml b/bld/namelist_files/use_cases/1850_cam6.xml index f44f238ad8..7f4cf09a5c 100644 --- a/bld/namelist_files/use_cases/1850_cam6.xml +++ b/bld/namelist_files/use_cases/1850_cam6.xml @@ -4,7 +4,7 @@ cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.i.0301-01-01-00000.nc - 'atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc' + 'atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc' 18500101 FIXED diff --git a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml index c4ef1f90bd..1d931bca8f 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml index 5d9e56e912..2c042de913 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml index 84ba12c3c7..c0c9b56c96 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml @@ -25,7 +25,7 @@ atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml index 26c8fc6ae2..7a8547af10 100644 --- a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml @@ -4,7 +4,7 @@ atm/waccm/ic/FWmaCARMAHIST_f09_spinup01.cam.i.1980-01-01-00000_c220128.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml b/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml index 1743899807..47a0bcaa2f 100644 --- a/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/carma_waccm_ma_nudged_cam6.xml @@ -4,7 +4,7 @@ atm/waccm/ic/FWmaCARMAHIST_f09_spinup01.cam.i.1980-01-01-00000_c220128.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/hist_cam6.xml b/bld/namelist_files/use_cases/hist_cam6.xml index 598fd19bf9..9b79a04132 100644 --- a/bld/namelist_files/use_cases/hist_cam6.xml +++ b/bld/namelist_files/use_cases/hist_cam6.xml @@ -3,7 +3,7 @@ cesm2_init/b.e20.B1850.f19_g17.release_cesm2_1_0.020/0301-01-01/b.e20.B1850.f19_g17.release_cesm2_1_0.020.cam.i.0301-01-01-00000.nc - 'atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc' + 'atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc' 'atm/cam/tracer_cnst' 'tracer_cnst_halons_3D_L70_1849-2015_CMIP6ensAvg_c180927.nc' diff --git a/bld/namelist_files/use_cases/hist_geoschem.xml b/bld/namelist_files/use_cases/hist_geoschem.xml index 03bee39f97..587ec4c1a4 100644 --- a/bld/namelist_files/use_cases/hist_geoschem.xml +++ b/bld/namelist_files/use_cases/hist_geoschem.xml @@ -18,7 +18,7 @@ 00010101 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml index 49ff148346..6d6e94c6c5 100644 --- a/bld/namelist_files/use_cases/hist_geoschem_nudged.xml +++ b/bld/namelist_files/use_cases/hist_geoschem_nudged.xml @@ -18,7 +18,7 @@ 00010101 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml index ec5df405e3..026e329d7a 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_nudged_cam6.xml @@ -8,7 +8,7 @@ atm/cam/inic/se/f.e22.FCnudged.ne0CONUSne30x8_ne0CONUSne30x8_mt12.cesm2_2_alpha06b.001.cam.i.2013-01-01-00000_c200706.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml index 4bda4f302f..f9ea8eb9eb 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbs_cam6.xml @@ -7,7 +7,7 @@ atm/cam/inic/fv/f.e20.FCHIST.f09_f09_mg17.cesm2_0_rel.emis_fix.001.cam.i.1996-01-01-00000_c180716.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml index a1f993ee2b..1605081d6d 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbsext_cam6.xml @@ -7,7 +7,7 @@ atm/cam/inic/fv/f.e20.FCHIST.f09_f09_mg17.cesm2_0_rel.emis_fix.fullVBS.cam.i.1996-01-01-00000_c180716.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml b/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml index 0b991305a5..51e3538f47 100644 --- a/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml +++ b/bld/namelist_files/use_cases/hist_trop_strat_vbsfire_cam6.xml @@ -8,7 +8,7 @@ atm/cam/inic/se/f.e20.FCHIST.ne30_ne30.chem01_cam5_4_152.001.cam.i.2011-01-01-00000_c171215.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc .true. diff --git a/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml index 39fd544b57..fbd7423680 100644 --- a/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_ma_1850_cam6.xml @@ -11,15 +11,15 @@ cesm2_init/b.e20.BWma1850.f19_g17.release_cesm2_1_0.020/0289-01-01/b.e20.BWma1850.f19_g17.release_cesm2_1_0.020.cam.i.0289-01-01-00000.nc -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc 18500101 FIXED -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc epp_ion_rates diff --git a/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml index 29d58eff25..3bc7948bce 100644 --- a/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_ma_hist_cam6.xml @@ -5,13 +5,13 @@ 19790101 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc 'epp_ion_rates' diff --git a/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml index e02e944804..77184615a1 100644 --- a/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_sc_1850_cam6.xml @@ -5,12 +5,12 @@ 19790101 -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc 18500101 FIXED -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc cesm2_init/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001/0003-01-01/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001.cam.i.0003-01-01-00000.nc diff --git a/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml b/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml index 3616c80298..eefbf88163 100644 --- a/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_tsmlt_1850_cam6.xml @@ -7,15 +7,15 @@ 1850 -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc 18500701 FIXED -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc -atm/cam/solar/SolarForcingCMIP7piControl_c20250103.nc +atm/cam/solar/SolarForcingCMIP6piControl_c160921.nc epp_ion_rates diff --git a/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml index 42835b0c36..623d08bc95 100644 --- a/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_tsmlt_hist_cam6.xml @@ -5,13 +5,13 @@ 19900101 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc 'epp_ion_rates' diff --git a/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml b/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml index d06ba37a40..37ca427cd2 100644 --- a/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccmx_ma_hist_cam6.xml @@ -7,12 +7,12 @@ atm/waccm/ic/f.e22.FXHIST.f09_f09_mg17_test.001.cam.i.1979-01-01-00000_c200820.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc SERIAL -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc epp_ion_rates From cd447dfac32780308fa2540969643ed71653cce7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 5 Sep 2025 12:55:51 -0600 Subject: [PATCH 361/466] Fix typos --- bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml | 2 +- bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml | 2 +- bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml index 2c042de913..4ba33bb21e 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_nudged_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml index c0c9b56c96..b8004c93b2 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_sd_cam6.xml @@ -25,7 +25,7 @@ atm/cam/met/MERRA2/1.9x2.5/fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_GRNL_MERRA2_c190617.nc -atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml index 7a8547af10..0fba6ef50e 100644 --- a/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_waccm_ma_hist_cam6.xml @@ -4,7 +4,7 @@ atm/waccm/ic/FWmaCARMAHIST_f09_spinup01.cam.i.1980-01-01-00000_c220128.nc -atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc INTERP_MISSING_MONTHS diff --git a/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml b/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml index a97e05b370..3c2583af96 100644 --- a/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml +++ b/bld/namelist_files/use_cases/waccm_sc_hist_cam6.xml @@ -5,10 +5,10 @@ 19790101 -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc -atm/cam/solar/SolarForcingCMIP7-4.6_18491230-20240101_sumEPP_c20250630.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc cesm2_init/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001/0003-01-01/f.e21.FWsc1850.f09_f09_mg17.cesm2.1-exp011.001.cam.i.0003-01-01-00000.nc From b103a829692571e1dc975014096606b5a3901ee5 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Fri, 5 Sep 2025 12:57:52 -0600 Subject: [PATCH 362/466] update atmospheric physics hash --- .gitmodules | 4 ++-- src/atmos_phys | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index f353a3240d..1b3672403f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_16_001 + url = https://github.com/peverwhee/atmospheric_physics + fxtag = d65ef2ff1dea66dd7c873cf1ccef79d00563e14e fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 470f1fee56..d65ef2ff1d 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 470f1fee56af645c44493afab6c042d2d15e9311 +Subproject commit d65ef2ff1dea66dd7c873cf1ccef79d00563e14e From f60c585aaf782082ee1987914819b7e1852c4afc Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 5 Sep 2025 13:00:33 -0600 Subject: [PATCH 363/466] Update submodules --- src/atmos_phys | 2 +- src/physics/rrtmgp/ext | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/atmos_phys b/src/atmos_phys index e4d9da925b..0666731e19 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit e4d9da925ba44f503f85a9aef1b7fe972bb9f25f +Subproject commit 0666731e19797b1bbbbd6fe9ffb20faa7e3b821f diff --git a/src/physics/rrtmgp/ext b/src/physics/rrtmgp/ext index 4d8c5df4c6..77ff83ccf6 160000 --- a/src/physics/rrtmgp/ext +++ b/src/physics/rrtmgp/ext @@ -1 +1 @@ -Subproject commit 4d8c5df4c63434aaab854afd1b02f5986d41dfb3 +Subproject commit 77ff83ccf645e5bc404c138ca4e7a6e3abf5d963 From 91a4084bf5d3251aa7c16c346dc238705007057f Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 5 Sep 2025 13:13:01 -0600 Subject: [PATCH 364/466] Fix one more typo --- bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml index 1d931bca8f..1033b64761 100644 --- a/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml +++ b/bld/namelist_files/use_cases/carma_trop_strat_hist_cam6.xml @@ -7,7 +7,7 @@ 4.5D0 -atm/cam/solar/SolarForcingCMIP6_18491230-230000102_c20200615.nc +atm/cam/solar/SolarForcingCMIP6_18491230-23000102_c20200615.nc INTERP_MISSING_MONTHS From d8f9da522e7a9b521d0f3fc0c4e23e16d351707d Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 5 Sep 2025 17:09:55 -0600 Subject: [PATCH 365/466] remove vars which no longer are in a structure for GPU test --- src/physics/rrtmgp/radiation.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 533a259161..704bf2bf9c 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1322,8 +1322,7 @@ subroutine radiation_tend( & !$acc copy(atm_optics_lw%optical_props, atm_optics_lw%optical_props%tau, & !$acc sources_lw%sources, sources_lw%sources%lay_source, & !$acc sources_lw%sources%sfc_source, & - !$acc sources_lw%sources%lev_source_inc, & - !$acc sources_lw%sources%lev_source_dec, & + !$acc sources_lw%sources%lev_source, & !$acc sources_lw%sources%sfc_source_jac) call rrtmgp_lw_gas_optics_run(dolw, 1, ncol, ncol, pmid_rad, pint_rad, t_rad, & t_sfc, gas_concs_lw, atm_optics_lw, sources_lw, t_rad, .false., kdist_lw, errmsg, & @@ -1342,8 +1341,7 @@ subroutine radiation_tend( & !$acc cloud_lw%optical_props, cloud_lw%optical_props%tau, & !$acc sources_lw%sources,sources_lw%sources%lay_source, & !$acc sources_lw%sources%sfc_source, & - !$acc sources_lw%sources%lev_source_inc, & - !$acc sources_lw%sources%lev_source_dec, & + !$acc sources_lw%sources%lev_source, & !$acc sources_lw%sources%sfc_source_jac, & !$acc emis_sfc) & !$acc copy(flwc%fluxes, flwc%fluxes%flux_net, flwc%fluxes%flux_up, & From a06d567d810b8245d4d0c33f974bf0f60a77b5f8 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 8 Sep 2025 10:40:42 -0600 Subject: [PATCH 366/466] Update ChangeLog for cam6_4_114 --- doc/ChangeLog | 126 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4a40698cec..3c27cac830 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,123 @@ + +=============================================================== + +Tag name: cam6_4_114 +Originator(s): cacraigucar, hannay, peverwhee, PeterHjortLauritzen +Date: September 8, 2025 +One-line Summary: Changes to support Cecile's latest runs +Github PR URL: https://github.com/ESCOMP/CAM/pull/1376 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Match new (coupled) baseline out-of-the-box: https://github.com/ESCOMP/CAM/issues/1357 + - Changed various CAM7 namelist settings + - Updated RRTMGP external library + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: + - Change default settings for CAM7 settings of: + micro_mg_dcs + bnd_topo + clubb_C8 + cldfrc_dp1 + solar_irrad_data + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: adamrher, PeterHjortLauritzen, cecilehannay + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - Update atmos_phys external + - Update RRTMGP external + +M bld/build-namelist + - Update micro_mg_dcs default + +M bld/namelist_files/namelist_defaults_cam.xml + - Update other namelist defaults + +M bld/namelist_files/use_cases/1850_cam_lt.xml +M bld/namelist_files/use_cases/1850_cam_mt.xml +M bld/namelist_files/use_cases/1850_trop_strat_t4s_cam7.xml +M bld/namelist_files/use_cases/hist_cam_lt.xml +M bld/namelist_files/use_cases/hist_cam_mt.xml +M bld/namelist_files/use_cases/hist_trop_strat_t4s_cam7.xml +M bld/namelist_files/use_cases/waccm_ma_hist_cam7.xml +M bld/namelist_files/use_cases/waccm_sc_hist_cam7.xml + - Update SolarForcing file for CAM7 runs + +M src/atmos_phys +M src/physics/rrtmgp/ext + - Update submodules + +M src/physics/rrtmgp/radiation.F90 + - Changes necessary to work with updated RRTMGP library + +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: + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + + ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.QPC7.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.ne30pg2_ne30pg2_mt232.QPC7.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) details: + ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details: + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details: + - Answer changes due to CAM7 namelist settings, an updated topo file and updated RRTMGP library + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: FAIL) details: + - New RRTMGP library breaks GPU test + - See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: + ERC_D_Ln9.mpasa480_mpasa480_mt232.QPC7.izumi_nag.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: DIFF) details: + - Answer changes due to CAM7 namelist settings, an updated topo file and updated RRTMGP library + + +izumi/gnu/aux_cam: + ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln3.ne3pg3_ne3pg3_mt232.PC7.izumi_gnu.cam-pc7_ne3pg3 (Overall: DIFF) details: + - Answer changes due to CAM7 namelist settings, an updated topo file and updated RRTMGP library + + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: Any configuration which uses RRTMGP +- what platforms/compilers: all +- nature of change (roundoff; larger than roundoff but same climate; new + climate): larger than roundoff but same climate + +- Brian Mederios made a run with this new library and AMP scientists viewed the results and okayed the changes + +=============================================================== =============================================================== Tag name: cam6_4_113 @@ -51,7 +171,7 @@ cime_config/testdefs/testlist_cam.xml . add subcol test on SE grid replace SUB_D_Ln9.f10_f10_mg37.QPC5.izumi_nag.cam-outfrq3s - by + by SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s . move subcol test to F compset replace @@ -65,7 +185,7 @@ cime_config/testdefs/testlist_cam.xml by ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s . move cam4 ERI test to F compset. - replace + replace ERI_D_Ln18.f45_f45_mg37.QPC41850.derecho_intel.cam-co2rmp_usecase by ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri @@ -374,7 +494,7 @@ If this tag changes climate describe the run(s) done to evaluate the new climate in enough detail that it(they) could be reproduced, i.e., - source tag (all code used must be in the repository): https://github.com/NCAR/CAM-ACOM-dev/tree/develop-cloud-bug-fix d1358e4 - platform/compilers: Derecho/Intel -- configure commandline: +- configure commandline: ./create_newcase --compset FCnudged --res f09_f09_mg17 --case /glade/work/tilmes/derecho/cesm3/FCnudged_f09.cloud-bug-fix.2015_2018.001 --project P93300043 --run-unsupported ./create_newcase --compset FCARMAnudged --res f09_f09_mg17 --case /glade/work/tilmes/derecho/cesm3/FCARMAnudged_f09.cloud-bug-fix.2015_2018.001 --project P93300043 --run-unsupported - build-namelist command (or complete namelist): From fca601236c82216b7c4fd958eca37e05a188e6f0 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 8 Sep 2025 11:47:52 -0600 Subject: [PATCH 367/466] Update gitmodules to match current alpha07d --- .gitmodules | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.gitmodules b/.gitmodules index d973c73ca8..fad7f90c22 100644 --- a/.gitmodules +++ b/.gitmodules @@ -117,56 +117,56 @@ [submodule "cism"] path = components/cism url = https://github.com/ESCOMP/CISM-wrapper -fxtag = cismwrap_2_2_006 +fxtag = cismwrap_2_2_008 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CISM-wrapper [submodule "rtm"] path = components/rtm url = https://github.com/ESCOMP/RTM -fxtag = rtm1_0_86 +fxtag = rtm1_0_89 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/RTM [submodule "mosart"] path = components/mosart url = https://github.com/ESCOMP/MOSART -fxtag = mosart1.1.08 +fxtag = mosart1.1.12 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/MOSART [submodule "mizuRoute"] path = components/mizuRoute url = https://github.com/ESCOMP/mizuRoute -fxtag = cesm-coupling.n03_v2.2.0 +fxtag = v3.0.0 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.53 +fxtag = ccs_config_cesm1.0.57 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git [submodule "cime"] path = cime url = https://github.com/ESMCI/cime -fxtag = cime6.1.102 +fxtag = cime6.1.120 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/cime [submodule "cmeps"] path = components/cmeps url = https://github.com/ESCOMP/CMEPS.git -fxtag = cmeps1.0.47 +fxtag = cmeps1.1.10 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git [submodule "cdeps"] path = components/cdeps url = https://github.com/ESCOMP/CDEPS.git -fxtag = cdeps1.0.73 +fxtag = cdeps1.0.80 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git @@ -180,7 +180,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/CESM_share [submodule "parallelio"] path = libraries/parallelio url = https://github.com/NCAR/ParallelIO -fxtag = pio2_6_4 +fxtag = pio2_6_6 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/ParallelIO @@ -194,7 +194,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/CESM_CICE [submodule "clm"] path = components/clm url = https://github.com/ESCOMP/CTSM -fxtag = ctsm5.3.029 +fxtag = alpha-ctsm5.4.CMIP7.09.ctsm5.3.068 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CTSM @@ -208,7 +208,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/FMS_interface [submodule "tools/CUPiD"] path = tools/CUPiD url = https://github.com/NCAR/CUPiD.git -fxtag = v0.2.1 +fxtag = v0.3.1 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git From a8d5921f880c014c75a4180f2b58a38e3fd668c6 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 8 Sep 2025 13:49:45 -0600 Subject: [PATCH 368/466] Update externals --- .gitmodules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index fad7f90c22..168feced79 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,21 +145,21 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.57 +fxtag = ccs_config_cesm1.0.58 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git [submodule "cime"] path = cime url = https://github.com/ESMCI/cime -fxtag = cime6.1.120 +fxtag = cime6.1.122 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/cime [submodule "cmeps"] path = components/cmeps url = https://github.com/ESCOMP/CMEPS.git -fxtag = cmeps1.1.10 +fxtag = cmeps1.1.16 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git From 582b961441f2d0ceedf82831f667d0bdaed2806c Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 8 Sep 2025 15:28:43 -0600 Subject: [PATCH 369/466] Update submodules --- ccs_config | 2 +- cime | 2 +- components/cdeps | 2 +- components/cism | 2 +- components/clm | 2 +- components/cmeps | 2 +- components/mizuRoute | 2 +- components/mosart | 2 +- components/rtm | 2 +- libraries/parallelio | 2 +- tools/CUPiD | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ccs_config b/ccs_config index 8103ad41d9..35e4baa48b 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 8103ad41d9657950ff8e387524a3df1e84bcda9e +Subproject commit 35e4baa48b2667e5c6285a4de16050883a8cd48a diff --git a/cime b/cime index 1006c39f59..16f1fb4460 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 1006c39f59577d47994fb3fb897566b2b8fa12ed +Subproject commit 16f1fb44607037e5a1dfe769a69bad366baf7d12 diff --git a/components/cdeps b/components/cdeps index 9e57b278de..692150fc02 160000 --- a/components/cdeps +++ b/components/cdeps @@ -1 +1 @@ -Subproject commit 9e57b278de18cf69351bc693fe1988143e859fa7 +Subproject commit 692150fc020e31235784634dd3eab4e78629bb82 diff --git a/components/cism b/components/cism index 0a4e6cfe88..be2e4109d9 160000 --- a/components/cism +++ b/components/cism @@ -1 +1 @@ -Subproject commit 0a4e6cfe8828cd28cdab06f83a7c1eb464c1ca8c +Subproject commit be2e4109d946ca8c5d923dafa704a6764ea43932 diff --git a/components/clm b/components/clm index be65fad30a..0991175998 160000 --- a/components/clm +++ b/components/clm @@ -1 +1 @@ -Subproject commit be65fad30a741fc594bca9e1221ffe987e7bf271 +Subproject commit 0991175998c94291f3d544169e3a4acb71b0b7f1 diff --git a/components/cmeps b/components/cmeps index dfe357ec28..a0735ecdb5 160000 --- a/components/cmeps +++ b/components/cmeps @@ -1 +1 @@ -Subproject commit dfe357ec28da465b1d0e435594c6bd6700ce62f3 +Subproject commit a0735ecdb5a3e1150797a8f05ded6e4b6a271b41 diff --git a/components/mizuRoute b/components/mizuRoute index 362bee329b..07dfd26a17 160000 --- a/components/mizuRoute +++ b/components/mizuRoute @@ -1 +1 @@ -Subproject commit 362bee329bd6bf1fd45c8f36e006b9c4294bb8ca +Subproject commit 07dfd26a17acb914b9036f59a8c6237990da09f2 diff --git a/components/mosart b/components/mosart index 00a87c9084..0faa624a59 160000 --- a/components/mosart +++ b/components/mosart @@ -1 +1 @@ -Subproject commit 00a87c9084af1af0d2b14d14e3d432f6808681f9 +Subproject commit 0faa624a59b5ce677c40ed64f1ca65bb4997db8d diff --git a/components/rtm b/components/rtm index 26e96f500b..1165b4ff0c 160000 --- a/components/rtm +++ b/components/rtm @@ -1 +1 @@ -Subproject commit 26e96f500b9500b32a870db20eed6b1bd37587ea +Subproject commit 1165b4ff0c015369d350478c5833cf366acada9f diff --git a/libraries/parallelio b/libraries/parallelio index a844617662..1d516b8276 160000 --- a/libraries/parallelio +++ b/libraries/parallelio @@ -1 +1 @@ -Subproject commit a844617662cbb2b1a6445bd7560f9095ccefd180 +Subproject commit 1d516b82768ef9d2cade524724c38ab63fbe08e4 diff --git a/tools/CUPiD b/tools/CUPiD index e3d16bf491..3d9531779b 160000 --- a/tools/CUPiD +++ b/tools/CUPiD @@ -1 +1 @@ -Subproject commit e3d16bf49184cd6dbb18c17072031b974605c8e5 +Subproject commit 3d9531779b6f3e4c26059b10ba67c0f4477684e5 From b47bb504bad2ba3586b4d587895865dfd0e8ea49 Mon Sep 17 00:00:00 2001 From: Julio Bacmeister Date: Wed, 10 Sep 2025 09:43:08 -0600 Subject: [PATCH 370/466] Making merge region more controllable. Re-instated 'tricking' of RRTMGP --- bld/build-namelist | 3 + bld/namelist_files/namelist_defaults_cam.xml | 13 ++- bld/namelist_files/namelist_definition.xml | 17 +++- src/physics/cam/radheat.F90 | 99 +++++++++++++++++--- src/physics/rrtmgp/radiation.F90 | 2 +- 5 files changed, 117 insertions(+), 17 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 72d85d7218..0f9d9c4986 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -739,7 +739,10 @@ elsif ($rad_pkg =~ m/rrtmgp/) { my $abs_path = quote_string(set_abs_filepath($rel_path, $cam_dir)); $nl->set_variable_value('radiation_nl', 'rrtmgp_coefs_sw_file', $abs_path); + add_default($nl, 'qrsmlt_scaling'); add_default($nl, 'p_top_for_equil_rad'); + add_default($nl, 'p_top_for_radmrg'); + add_default($nl, 'p_bot_for_radmrg'); } diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 9118900e17..20a132d777 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -575,12 +575,23 @@ src/physics/rrtmgp/data/rrtmgp-gas-lw-g128.nc src/physics/rrtmgp/data/rrtmgp-gas-sw-g112.nc - + 0.D0 1.D0 1.D0 2.D0 + + 0.D0 + 2.D0 + + + 1.D0 + 5.D0 + + + 1.D0 + atm/cam/rad/abs_ems_factors_fastvx.c030508.nc diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 1b1562546e..a55f3ab13f 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5773,12 +5773,27 @@ Default: FALSE -Top pressure level for non-LTE blending region +Top valid pressure level LTE radiation scheme Default: 1.0 for WACCM/WACCMX 2. for all other RRTMGP runs 0.0 for all other runs + +Top pressure level LTE/non-LTE merger region + + + +Bottom pressure level LTE/non-LTE merger region + + + +Scaling factor for simplified QRS MLT heating in CAM + + If true, then average the zenith angle over the radiation timestep rather diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index cf0906037d..8a75ccab34 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -40,10 +40,14 @@ module radheat public :: radheat_disable_waccm ! disable waccm heating in the upper atm real(r8), public :: p_top_for_equil_rad = 0._r8 + real(r8), public :: p_top_for_radmrg = 0._r8 + real(r8), public :: p_bot_for_radmrg = 0._r8 + real(r8), public :: qrsmlt_scaling = 1.0_r8 ! Scaling for "M/LT" SW heating ! Private variables for merging heating rates real(r8):: qrs_wt(pver) ! merge weight for cam solar heating real(r8):: qrl_wt(pver) ! merge weight for cam long wave heating + real(r8):: zref_mid_7km(pver) ! Zref profile based on 7km scale height ! lw merge region ! highest altitude (lowest pressure) of merge region (Pa) @@ -70,7 +74,7 @@ subroutine radheat_readnl(nlfile) character(len=32) :: errmsg character(len=*), parameter :: sub = 'radheat_readnl' - namelist /radheat_nl/ p_top_for_equil_rad + namelist /radheat_nl/ p_top_for_equil_rad, p_top_for_radmrg, p_bot_for_radmrg, qrsmlt_scaling !----------------------------------------------------------------------------- if (masterproc) then @@ -87,6 +91,12 @@ subroutine radheat_readnl(nlfile) call mpi_bcast(p_top_for_equil_rad, 1, mpi_real8, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_equil_rad") + call mpi_bcast(p_top_for_radmrg, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_top_for_radmrg") + call mpi_bcast(p_bot_for_radmrg, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: p_bot_for_radmrg") + call mpi_bcast(qrsmlt_scaling, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: qrsmlt_scaling ") end subroutine radheat_readnl @@ -107,10 +117,11 @@ subroutine radheat_init(pref_mid) use nlte_fomichev, only: nlte_fomichev_init use phys_control, only: phys_getopts + use cam_history, only: addfld ! args - real(r8), intent(in) :: pref_mid(pver) ! mid point reference pressure + real(r8), intent(in) :: pref_mid(pver) ! mid point reference pressure (Pa) ! local vars real(r8) :: co2_mw, o1_mw, o2_mw, o3_mw, no_mw, n2_mw ! molecular weights @@ -127,7 +138,8 @@ subroutine radheat_init(pref_mid) !----------------------------------------------------------------------- - + zref_mid_7km = -7.0_r8 * log( pref_mid/100000._r8 ) + call phys_getopts(radiation_scheme_out=rad_pkg, & history_waccm_out=history_waccm, & history_scwaccm_forcing_out=history_scwaccm_forcing) @@ -139,8 +151,8 @@ subroutine radheat_init(pref_mid) min_pressure_lw = 1e5_r8*exp(-10._r8) max_pressure_lw = 1e5_r8*exp(-8.57_r8) else - min_pressure_lw = p_top_for_equil_rad - max_pressure_lw = 50._r8 + min_pressure_lw = p_top_for_radmrg + max_pressure_lw = p_bot_for_radmrg endif delta_merge_lw = max_pressure_lw - min_pressure_lw @@ -186,6 +198,10 @@ subroutine radheat_init(pref_mid) if (qrs_wt(k)==1._r8) ntop_qrs_cam = k enddo + ! Add history variables to master field list + call addfld ('QRL_TOT',(/ 'lev' /), 'A','K/s','Merged LW heating: QRL+QRL_MLT') + call addfld ('QRS_TOT',(/ 'lev' /), 'A','K/s','Merged SW heating: QRS+QRS_MLT') + end subroutine radheat_init !================================================================================================ @@ -206,7 +222,7 @@ end subroutine radheat_timestep_init !================================================================================================ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - fsnt, flns, flnt, asdir, net_flx) + fsnt, flns, flnt, asdir, coszrs, net_flx) !----------------------------------------------------------------------- ! Compute net radiative heating from qrs and qrl, and the associated net ! boundary flux. @@ -240,6 +256,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8), intent(in) :: flns(pcols) ! Srf longwave cooling (up-down) flux real(r8), intent(in) :: flnt(pcols) ! Net outgoing lw flux at model top real(r8), intent(in) :: asdir(pcols) ! shortwave, direct albedo + real(r8), intent(in) :: coszrs(pcols) ! cosine solar zenith angle real(r8), intent(out) :: net_flx(pcols) ! Local variables @@ -249,6 +266,10 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8) :: qrl_mrg(pcols,pver) ! merged LW heating real(r8) :: qrl_mlt(pcols,pver) ! M/LT longwave heating rates real(r8) :: qrs_mrg(pcols,pver) ! merged SW heating + real(r8) :: qrs_mlt(pcols,pver) ! M/LT shortwave heating rates + real(r8) :: qout(pcols,pver) ! temp for outfld call + + real(r8) :: qrs_mlt_prof(pver) ! Base profile for QRS_MLT (K/day) real(r8) :: qrlfomichev(pcols,pver) ! Fomichev cooling rate ! (K/s) real(r8) :: o3cool(pcols,pver) ! Fomichev cooling rate ! (K/s) @@ -264,6 +285,8 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8), parameter :: N2_mass = 28.0134_r8 ! g/mol real(r8), parameter :: mass_dry_air = 28.9647_r8 ! g/mol + !real(r8), parameter :: mlt_rad_scaling = 1.0_r8 ! Scaling for "M/LT" SW heating + integer :: icall real(r8), pointer :: gas_mmr(:,:) character(len=512) :: errmsg @@ -275,8 +298,14 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & lchnk = state%lchnk call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) -! Shortwave heating is RRTMG solar heating only - qrs_mrg(:,:) = qrs(:,:) + ! Shortwave heating is RRTMG solar heating only + ! ++ jtb test setting M/LT SW to scaled cosine + ! solar zenith angle + + qrs_mlt_prof = qrs_mlt_profile( zref_mid_7km ) + do k = 1,pver + qrs_mlt(:,k) = qrsmlt_scaling * qrs_mlt_prof(k) * max( coszrs(:) , 0._r8 ) / 86400._r8 + end do icall = 0 @@ -290,7 +319,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & xo3mmr(:pcols,:pver) = gas_mmr(:pcols,:pver) nullify(gas_mmr) -! Using standard US N2_VMR(0.78084) converted to N2_MMR + ! Using standard US N2_VMR(0.78084) converted to N2_MMR xn2mmr(:pcols,:pver) = N2_VMR * (N2_mass / mass_dry_air) call rad_cnst_get_gas(icall,'CO2 ', state, pbuf, gas_mmr) @@ -301,9 +330,20 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & xo2mmr,xommr,xo3mmr,xn2mmr,xco2mmr,qrlfomichev,co2cool,o3cool,c2scool) qrl_mlt = qrlfomichev -! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating - call merge_qrl (ncol, qrl, qrl_mlt, qrl_mrg) + ! Merge cam long wave heating for lower atmosphere with M/LT (nlte) heating + call merge_qrx (ncol, qrl, qrl_mlt, qrl_mrg) + ! Merge cam short wave heating for lower atmosphere with M/LT (nlte) heating + call merge_qrx (ncol, qrs, qrs_mlt, qrs_mrg) + + qout(:ncol,:) = qrs_mrg(:ncol,:)/cpair + call outfld ('QRS_TOT', qout, pcols, lchnk) + qout(:ncol,:) = qrl_mrg(:ncol,:)/cpair + call outfld ('QRL_TOT', qout, pcols, lchnk) + + + + ! REMOVECAM no longer need once CAM is retired and pcols doesn't exist net_flx = 0._r8 ptend%s = 0._r8 @@ -330,9 +370,9 @@ end subroutine radheat_tend subroutine radheat_disable_waccm() end subroutine radheat_disable_waccm - subroutine merge_qrl (ncol, hcam, hmlt, hmrg) + subroutine merge_qrx (ncol, hcam, hmlt, hmrg) ! -! Merges long wave heating rates +! Merges heating rates ! !-----------------Input arguments----------------------------------- integer ncol @@ -351,6 +391,37 @@ subroutine merge_qrl (ncol, hcam, hmlt, hmrg) hmrg(:ncol,k) = qrl_wt(k) * hcam(:ncol,k) + (1._r8-qrl_wt(k)) * hmlt(:ncol,k) end do - end subroutine merge_qrl + end subroutine merge_qrx + +!-------------------------------------------------------------------- +!-------------------------------------------------------------------- + ! Elemental: works on scalars and arrays + pure elemental function qrs_mlt_profile(z) result(x) + !--------------------------------------------------------------- + ! Returns profile of SW heating (K/day) based on curve + ! fitting to equatorial mean profile of QRS_TOT in: + ! + ! SCWACCM_forcing_zm_L70_1849-2015_CMIP6ensAvg_c181011.nc + !---------------------------------------------------------------- + real(r8), intent(in) :: z ! height in km + real(r8) :: x ! heating in K/day + + + ! Named parameters + real(r8) :: c0, c1, a1, z1, s1, a2, z2, s2 + + ! Assign values from popt + c0 = 32.45612064_r8 + c1 = -0.50124861_r8 + a1 = 19.11626479_r8 + z1 = 30.41572125_r8 + s1 = 20.90525292_r8 + a2 = 13.50543681_r8 + z2 = 87.95888464_r8 + s2 = 9.94346974_r8 + + x = c0 + c1*z + a1 * tanh( (z - z1)/s1 ) + a2 * tanh( (z - z2)/s2 ) + + end function qrs_mlt_profile end module radheat diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 93064d30af..ad1046b8ff 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1440,7 +1440,7 @@ subroutine radiation_tend( & ! of radheat_tend merges upper atmosphere heating rates with those calculated ! by RRTMGP. call radheat_tend(state, pbuf, ptend, qrl_prime, qrs_prime, fsns, & - fsnt, flns, flnt, cam_in%asdir, net_flx) + fsnt, flns, flnt, cam_in%asdir, coszrs, net_flx) if (write_output) then ! Compute heating rate for dtheta/dt From da5b6399f15cd2bc99afc32d40f518dadbf178d9 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 10 Sep 2025 13:40:57 -0600 Subject: [PATCH 371/466] update rrtmgp_inputs_run interface; add mods to other radiation package radheat_tend calls --- .gitmodules | 4 ++-- src/atmos_phys | 2 +- src/physics/camrt/radiation.F90 | 2 +- src/physics/rrtmg/radiation.F90 | 2 +- src/physics/rrtmgp/radiation.F90 | 7 +++++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitmodules b/.gitmodules index d973c73ca8..beec93ef52 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_16_002 + url = https://github.com/peverwhee/atmospheric_physics + fxtag = 5e8d7fff667b473ff9ab89892e3c5fa1df0b310b fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 0666731e19..9afbf411f8 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 0666731e19797b1bbbbd6fe9ffb20faa7e3b821f +Subproject commit 9afbf411f81ec9a4e59148edcd2eead8841f61ef diff --git a/src/physics/camrt/radiation.F90 b/src/physics/camrt/radiation.F90 index d7e0cdbac6..f422fb78d2 100644 --- a/src/physics/camrt/radiation.F90 +++ b/src/physics/camrt/radiation.F90 @@ -1182,7 +1182,7 @@ subroutine radiation_tend( & ! Compute net radiative heating tendency call radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - fsnt, flns, flnt, cam_in%asdir, net_flx) + fsnt, flns, flnt, cam_in%asdir, coszrs, net_flx) if (write_output) then ! Compute heating rate for dtheta/dt diff --git a/src/physics/rrtmg/radiation.F90 b/src/physics/rrtmg/radiation.F90 index a22a66dd6a..efc271b70d 100644 --- a/src/physics/rrtmg/radiation.F90 +++ b/src/physics/rrtmg/radiation.F90 @@ -1360,7 +1360,7 @@ subroutine radiation_tend( & ! Compute net radiative heating tendency call radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - fsnt, flns, flnt, cam_in%asdir, net_flx) + fsnt, flns, flnt, cam_in%asdir, coszrs, net_flx) if (write_output) then ! Compute heating rate for dtheta/dt diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index a20c37e280..4a3fb856a1 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -806,7 +806,7 @@ subroutine radiation_tend( & use phys_grid, only: get_rlat_all_p, get_rlon_all_p use cam_control_mod, only: eccen, mvelpp, lambm0, obliqr use shr_orb_mod, only: shr_orb_decl, shr_orb_cosz - + ! CCPPized schemes use rrtmgp_inputs, only: rrtmgp_inputs_run use rrtmgp_pre, only: rrtmgp_pre_run, rrtmgp_pre_timestep_init @@ -833,6 +833,7 @@ subroutine radiation_tend( & use interpolate_data, only: vertinterp use tropopause, only: tropopause_find_cam, TROP_ALG_HYBSTOB, TROP_ALG_CLIMATE use cospsimulator_intr, only: docosp, cospsimulator_intr_run, cosp_nradsteps + use dycore, only: dycore_is ! Arguments @@ -988,6 +989,7 @@ subroutine radiation_tend( & real(r8) :: gb_snow_tau(pcols,pver) ! grid-box mean snow_tau real(r8) :: gb_snow_lw(pcols,pver) ! grid-box mean LW snow optical depth + logical :: is_mpas ! Flag for whether the dycore is MPAS real(r8) :: ftem(pcols,pver) ! Temporary workspace for outfld variables real(r8), target :: zero_variable(1,1) @@ -1127,10 +1129,11 @@ subroutine radiation_tend( & else cldfsnow_in => zero_variable end if + is_mpas = dycore_is('MPAS') ! Prepare state variables, daylit columns, albedos for RRTMGP ! Also calculate modified cloud fraction call rrtmgp_inputs_run(dosw, dolw, associated(cldfsnow), associated(cldfgrau), & - state%pmid(:ncol,:), state%pint(:ncol,:), state%t(:ncol,:), & + masterproc, iulog, is_mpas, state%pmid(:ncol,:), state%pint(:ncol,:), state%t(:ncol,:), & nday, idxday, cldfprime(:ncol,:), coszrs(:ncol), kdist_sw, t_sfc, & emis_sfc, t_rad, pmid_rad, pint_rad, t_day, pmid_day, & pint_day, coszrs_day, alb_dir, alb_dif, cam_in%lwup(:ncol), stebol, & From af445c53ac85a6665014825c17861cacff9034d7 Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Wed, 10 Sep 2025 13:45:03 -0600 Subject: [PATCH 372/466] fix the CAM+RRTMGP GPU interface bug --- src/physics/rrtmgp/radiation.F90 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 704bf2bf9c..fe7caea467 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1180,9 +1180,8 @@ subroutine radiation_tend( & ! Compute the gas optics (stored in atm_optics_sw). ! toa_flux is the reference solar source from RRTMGP data. - !$acc data copyin(kdist_sw%gas_props,pmid_day,pint_day,t_day,gas_concs_sw%gas_concs) & - !$acc copy(atm_optics_sw%optical_props) & - !$acc copyout(toa_flux) + !$acc data copyin(kdist_sw%gas_props,pmid_day,pint_day,t_day,gas_concs_sw%gas_concs,atm_optics_sw%optical_props) & + !$acc copyout(toa_flux) errmsg = kdist_sw%gas_props%gas_optics( & pmid_day, pint_day, t_day, gas_concs_sw%gas_concs, atm_optics_sw%optical_props, & toa_flux) @@ -1200,7 +1199,7 @@ subroutine radiation_tend( & ! diagnostic aerosol output. call rrtmgp_set_aer_sw( & icall, state, pbuf, nday, idxday, nnite, idxnite, aer_sw) - + if (nday > 0) then ! Increment the gas optics (in atm_optics_sw) by the aerosol optics in aer_sw. @@ -1318,8 +1317,8 @@ subroutine radiation_tend( & ! Compute the gas optics and Planck sources. !$acc data copyin(kdist_lw%gas_props, pmid_rad, pint_rad, t_rad, & - !$acc t_sfc, gas_concs_lw%gas_concs) & - !$acc copy(atm_optics_lw%optical_props, atm_optics_lw%optical_props%tau, & + !$acc t_sfc, gas_concs_lw%gas_concs, atm_optics_lw%optical_props) & + !$acc copy(atm_optics_lw%optical_props%tau, & !$acc sources_lw%sources, sources_lw%sources%lay_source, & !$acc sources_lw%sources%sfc_source, & !$acc sources_lw%sources%lev_source, & From 4c8f22df04be9ad9641f959a7f9254639a9d16c6 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 10 Sep 2025 14:04:47 -0600 Subject: [PATCH 373/466] update waccm radheat_tend interface to match --- src/physics/waccm/radheat.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/physics/waccm/radheat.F90 b/src/physics/waccm/radheat.F90 index 37489e8afb..d42daaf186 100644 --- a/src/physics/waccm/radheat.F90 +++ b/src/physics/waccm/radheat.F90 @@ -293,7 +293,7 @@ end subroutine radheat_timestep_init !================================================================================================ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - fsnt, flns, flnt, asdir, net_flx) + fsnt, flns, flnt, asdir, coszrs, net_flx) !----------------------------------------------------------------------- ! Compute net radiative heating from qrs and qrl, and the associated net ! boundary flux. @@ -322,6 +322,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8), intent(in) :: flns(pcols) ! Srf longwave cooling (up-down) flux real(r8), intent(in) :: flnt(pcols) ! Net outgoing lw flux at model top real(r8), intent(in) :: asdir(pcols) ! shortwave, direct albedo + real(r8), intent(in) :: coszrs(pcols) ! cosine solar zenith angle real(r8), intent(out) :: net_flx(pcols) ! Local variables From 8aab40680629866a3369cee00dd36dce24727883 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Wed, 10 Sep 2025 20:27:30 -0600 Subject: [PATCH 374/466] Fix rei_cloud and rel_cloud units to um for CAM4 --- src/physics/cam/cloud_diagnostics.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/cloud_diagnostics.F90 b/src/physics/cam/cloud_diagnostics.F90 index 5063813fb5..c1ad0fa99c 100644 --- a/src/physics/cam/cloud_diagnostics.F90 +++ b/src/physics/cam/cloud_diagnostics.F90 @@ -172,8 +172,8 @@ subroutine cloud_diagnostics_init(pbuf2d) endif if(one_mom_clouds) then - call addfld ('rel_cloud',(/ 'lev' /),'I','1/meter','effective radius of liq in cloud', sampling_seq=sampling_seq) - call addfld ('rei_cloud',(/ 'lev' /),'I','1','effective radius of ice in cloud', sampling_seq=sampling_seq) + call addfld ('rel_cloud',(/ 'lev' /),'I','micrometers','effective radius of liq in cloud', sampling_seq=sampling_seq) + call addfld ('rei_cloud',(/ 'lev' /),'I','micrometers','effective radius of ice in cloud', sampling_seq=sampling_seq) endif call addfld ('SETLWP',(/ 'lev' /), 'A','gram/m2','Prescribed liquid water path' , sampling_seq=sampling_seq) From ef7ad5ce6d7f5cdc4664716b31b1cb262d85401b Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Thu, 11 Sep 2025 09:56:36 -0600 Subject: [PATCH 375/466] address Courtney's comment --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index fe7caea467..0177d63965 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1199,7 +1199,7 @@ subroutine radiation_tend( & ! diagnostic aerosol output. call rrtmgp_set_aer_sw( & icall, state, pbuf, nday, idxday, nnite, idxnite, aer_sw) - + if (nday > 0) then ! Increment the gas optics (in atm_optics_sw) by the aerosol optics in aer_sw. From 2d9a3cf54f94246e0fd34c9c81fd54c27e42ac03 Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Thu, 11 Sep 2025 09:58:16 -0600 Subject: [PATCH 376/466] add back some spaces --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 0177d63965..7fffbc6b92 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1199,7 +1199,7 @@ subroutine radiation_tend( & ! diagnostic aerosol output. call rrtmgp_set_aer_sw( & icall, state, pbuf, nday, idxday, nnite, idxnite, aer_sw) - + if (nday > 0) then ! Increment the gas optics (in atm_optics_sw) by the aerosol optics in aer_sw. From 1721228d8a8b603d4a581c08b91c86364a4fd706 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 11 Sep 2025 13:48:12 -0600 Subject: [PATCH 377/466] only add defaults when not running waccm physics --- bld/build-namelist | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 8db6cb560b..816c05ed16 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -739,10 +739,12 @@ elsif ($rad_pkg =~ m/rrtmgp/) { my $abs_path = quote_string(set_abs_filepath($rel_path, $cam_dir)); $nl->set_variable_value('radiation_nl', 'rrtmgp_coefs_sw_file', $abs_path); - add_default($nl, 'qrsmlt_scaling'); add_default($nl, 'p_top_for_equil_rad'); - add_default($nl, 'p_top_for_radmrg'); - add_default($nl, 'p_bot_for_radmrg'); + if (not $waccm_phys) { + add_default($nl, 'qrsmlt_scaling'); + add_default($nl, 'p_top_for_radmrg'); + add_default($nl, 'p_bot_for_radmrg'); + } } From dbc9fa7a3ed933abed605b0ba4deae17ab31a58c Mon Sep 17 00:00:00 2001 From: Jian Sun Date: Thu, 11 Sep 2025 14:58:03 -0600 Subject: [PATCH 378/466] update new ccs_config tag --- .gitmodules | 2 +- ccs_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d973c73ca8..0812e1aa87 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,7 +145,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.53 +fxtag = ccs_config_cesm1.0.59 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git diff --git a/ccs_config b/ccs_config index 8103ad41d9..028bbd779b 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 8103ad41d9657950ff8e387524a3df1e84bcda9e +Subproject commit 028bbd779bf989cab8767dd0e7135126429b4531 From f29793eead89a871f0b37fd48a287c83243e1839 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Thu, 11 Sep 2025 20:46:40 -0600 Subject: [PATCH 379/466] Separate out TMS/Beljaars (orographic form drag) from vertical diffusion section in physpkg. This will facilitate future CCPPization of the CAM7 vertical diffusion, Beljaars and Turbulent Mountain Stress (TMS; CAM5) orographic form drag, as otherwise their changes are embedded within the vertical_diffusion_tend and the corresponding snapshot sections. --- bld/build-namelist | 2 ++ bld/namelist_files/namelist_definition.xml | 4 +-- src/physics/cam/physpkg.F90 | 35 ++++++++++++++++++---- src/physics/cam/vertical_diffusion.F90 | 15 +++------- src/physics/cam7/physpkg.F90 | 32 ++++++++++++++++---- 5 files changed, 65 insertions(+), 23 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 75313104f5..5779737dda 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -5277,6 +5277,7 @@ sub check_snapshot_settings { push (@validList_ac, ("'chem_timestep_tend'")); } push (@validList_ac, ("'vertical_diffusion_section'", + "'orographic_form_drag_stress'", "'aero_model_drydep'", "'gw_tend'", "'qbo_relax'", "'iondrag_calc_section'", "'physics_dme_adjust'")); @@ -5292,6 +5293,7 @@ sub check_snapshot_settings { push (@validList_ac, ("'chem_timestep_tend'")); } push (@validList_ac, ("'vertical_diffusion_section'", + "'orographic_form_drag_stress'", "'aero_model_drydep'", "'gw_tend'", "'qbo_relax'", "'iondrag_calc_section'", "'physics_dme_adjust'")); diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 1b1562546e..3ba2c32b76 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -5672,7 +5672,7 @@ Default: + group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,orographic_form_drag_stress,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,rayleigh_friction_tend,user_set" > Name of parameterization to take snapshot before running user_set is used when a user inserts a call to cam_snapshot_all_outfld using cam_snapshot_before_num as the first argument. @@ -5680,7 +5680,7 @@ Default: Unused + group="phys_ctl_nl" valid_values="chem_emissions,aoa_tracers_timestep_tend,co2_cycle_set_ptend,chem_timestep_tend,orographic_form_drag_stress,vertical_diffusion_section,aero_model_drydep,gw_tend,qbo_relax,iondrag_calc_section,physics_dme_adjust,physics_dme_adjust,dadadj_tend,convect_deep_tend,convect_shallow_tend,convect_diagnostics_calc,macrop_driver_tend,clubb_tend_cam,microp_section,microp_driver_tend_subcol,aero_model_wetdep,radiation_tend,held_suarez_tend,kessler_tend,thatcher_jablonowski_precip_tend,rk_stratiform_tend,rayleigh_friction_tend,user_set" > Name of parameterization to take snapshot after running user_set is used when a user inserts a call to cam_snapshot_all_outfld using cam_snapshot_after_num as the first argument. diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index faa956cff8..87f49d7d7b 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -1387,6 +1387,8 @@ subroutine tphysac (ztodt, cam_in, & use chemistry, only: chem_is_active, chem_timestep_tend, chem_emissions use cam_diagnostics, only: diag_phys_tend_writeout use gw_drag, only: gw_tend + use trb_mtn_stress_cam, only: trb_mtn_stress_tend + use beljaars_drag_cam, only: beljaars_drag_tend use vertical_diffusion, only: vertical_diffusion_tend use rayleigh_friction, only: rayleigh_friction_run use constituents, only: cnst_get_ind @@ -1660,11 +1662,34 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== ! Vertical diffusion/pbl calculation - ! Call vertical diffusion code (pbl, free atmosphere and molecular) !=================================================== - call t_startf('vertical_diffusion_tend') + !------------------------------------------ + ! Compute orographic form drag stress + ! (Beljaars in CAM6+; TMS in CAM5) + ! + ! Only the pbuf fields are updated in these routines (no ptend) + ! The computed stresses are used in the PBL scheme and the vertical diffusion solver + ! in the call to vertical_diffusion_tend below. + !------------------------------------------ + if (trim(cam_take_snapshot_before) == "orographic_form_drag_stress") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call trb_mtn_stress_tend(state, pbuf, cam_in) + call beljaars_drag_tend(state, pbuf, cam_in) + + if (trim(cam_take_snapshot_after) == "orographic_form_drag_stress") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + !------------------------------------------ + ! Call vertical diffusion code (pbl, free atmosphere and molecular) + !------------------------------------------ + if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat) @@ -1675,9 +1700,9 @@ subroutine tphysac (ztodt, cam_in, & call vertical_diffusion_tend (ztodt ,state , cam_in, & surfric ,obklen ,ptend ,ast ,pbuf ) - !------------------------------------------ - ! Call major diffusion for extended model - !------------------------------------------ + !------------------------------------------ + ! Call major diffusion for extended model + !------------------------------------------ if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then call waccmx_phys_mspd_tend (ztodt ,state ,ptend) endif diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 545031573d..4f60da49bd 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -668,8 +668,6 @@ subroutine vertical_diffusion_tend( & use camsrfexch, only : cam_in_t use cam_history, only : outfld - use trb_mtn_stress_cam, only : trb_mtn_stress_tend - use beljaars_drag_cam, only : beljaars_drag_tend use eddy_diff_cam, only : eddy_diff_tend use hb_diff, only : compute_hb_diff, compute_hb_free_atm_diff use wv_saturation, only : qsat @@ -925,15 +923,13 @@ subroutine vertical_diffusion_tend( & end do ! ---------------------------------------- ! - ! Computation of turbulent mountain stress ! + ! Add in turbulent mountain stress (CAM5) ! ! ---------------------------------------- ! - ! Consistent with the computation of 'normal' drag coefficient, we are using - ! the raw input (u,v) to compute 'ksrftms', not the provisionally-marched 'u,v' + ! Consistent with the computation of 'normal' drag coefficient, + ! the raw input (u,v) is used to compute 'ksrftms', not the provisionally-marched 'u,v' ! within the iteration loop of the PBL scheme. - call trb_mtn_stress_tend(state, pbuf, cam_in) - call pbuf_get_field(pbuf, ksrftms_idx, ksrftms) call pbuf_get_field(pbuf, tautmsx_idx, tautmsx) call pbuf_get_field(pbuf, tautmsy_idx, tautmsy) @@ -942,17 +938,14 @@ subroutine vertical_diffusion_tend( & tautoty(:ncol) = cam_in%wsy(:ncol) + tautmsy(:ncol) ! ------------------------------------- ! - ! Computation of Beljaars SGO form drag ! + ! Add in Beljaars SGO form drag (CAM6+) ! ! ------------------------------------- ! - call beljaars_drag_tend(state, pbuf, cam_in) - call pbuf_get_field(pbuf, dragblj_idx, dragblj) call pbuf_get_field(pbuf, taubljx_idx, taubljx) call pbuf_get_field(pbuf, taubljy_idx, taubljy) ! Add Beljaars integrated drag - tautotx(:ncol) = tautotx(:ncol) + taubljx(:ncol) tautoty(:ncol) = tautoty(:ncol) + taubljy(:ncol) diff --git a/src/physics/cam7/physpkg.F90 b/src/physics/cam7/physpkg.F90 index b360e0ce6b..8970a3d099 100644 --- a/src/physics/cam7/physpkg.F90 +++ b/src/physics/cam7/physpkg.F90 @@ -1383,6 +1383,7 @@ subroutine tphysac (ztodt, cam_in, & use chemistry, only: chem_is_active, chem_timestep_tend, chem_emissions use cam_diagnostics, only: diag_phys_tend_writeout use gw_drag, only: gw_tend + use beljaars_drag_cam, only: beljaars_drag_tend use vertical_diffusion, only: vertical_diffusion_tend use rayleigh_friction, only: rayleigh_friction_run use physics_types, only: physics_dme_adjust, set_dry_to_wet, physics_state_check, & @@ -2151,11 +2152,32 @@ subroutine tphysac (ztodt, cam_in, & !=================================================== ! Vertical diffusion/pbl calculation - ! Call vertical diffusion (apply tracer emissions, molecular diffusion and pbl form drag) !=================================================== - call t_startf('vertical_diffusion_tend') + !------------------------------------------ + ! Compute orographic form drag stress (Beljaars) + ! + ! Only the pbuf fields are updated in these routines (no ptend) + ! The computed stresses are used in the PBL scheme and the vertical diffusion solver + ! in the call to vertical_diffusion_tend below. + !------------------------------------------ + if (trim(cam_take_snapshot_before) == "orographic_form_drag_stress") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + call beljaars_drag_tend(state, pbuf, cam_in) + + if (trim(cam_take_snapshot_after) == "orographic_form_drag_stress") then + call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& + fh2o, surfric, obklen, flx_heat) + end if + + !------------------------------------------ + ! Call vertical diffusion (apply tracer emissions, molecular diffusion and pbl form drag) + !------------------------------------------ + if (trim(cam_take_snapshot_before) == "vertical_diffusion_section") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx) @@ -2164,9 +2186,9 @@ subroutine tphysac (ztodt, cam_in, & call vertical_diffusion_tend (ztodt ,state , cam_in, & surfric ,obklen ,ptend ,ast ,pbuf ) - !------------------------------------------ - ! Call major diffusion for extended model - !------------------------------------------ + !------------------------------------------ + ! Call major diffusion for extended model + !------------------------------------------ if ( waccmx_is('ionosphere') .or. waccmx_is('neutral') ) then call waccmx_phys_mspd_tend (ztodt ,state ,ptend) endif From 62d1b9b8d4b5aee5023a6740aba430b6641344a3 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 12 Sep 2025 10:05:10 -0600 Subject: [PATCH 380/466] Fix CAM7 snapshotting --- src/physics/cam7/physpkg.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam7/physpkg.F90 b/src/physics/cam7/physpkg.F90 index 8970a3d099..f2827a318a 100644 --- a/src/physics/cam7/physpkg.F90 +++ b/src/physics/cam7/physpkg.F90 @@ -2164,14 +2164,14 @@ subroutine tphysac (ztodt, cam_in, & !------------------------------------------ if (trim(cam_take_snapshot_before) == "orographic_form_drag_stress") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) + fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx) end if call beljaars_drag_tend(state, pbuf, cam_in) if (trim(cam_take_snapshot_after) == "orographic_form_drag_stress") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& - fh2o, surfric, obklen, flx_heat) + fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx) end if !------------------------------------------ From e4ac87b1e921fffb95d4c1fc6fc3303d4b12568e Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 12 Sep 2025 10:31:49 -0600 Subject: [PATCH 381/466] Update externals --- .gitmodules | 4 ++-- ccs_config | 2 +- components/cism | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitmodules b/.gitmodules index 168feced79..a97c92057c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -117,7 +117,7 @@ [submodule "cism"] path = components/cism url = https://github.com/ESCOMP/CISM-wrapper -fxtag = cismwrap_2_2_008 +fxtag = cismwrap_2_2_010 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESCOMP/CISM-wrapper @@ -145,7 +145,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.58 +fxtag = ccs_config_cesm1.0.59 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git diff --git a/ccs_config b/ccs_config index 35e4baa48b..028bbd779b 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 35e4baa48b2667e5c6285a4de16050883a8cd48a +Subproject commit 028bbd779bf989cab8767dd0e7135126429b4531 diff --git a/components/cism b/components/cism index be2e4109d9..84767787b7 160000 --- a/components/cism +++ b/components/cism @@ -1 +1 @@ -Subproject commit be2e4109d946ca8c5d923dafa704a6764ea43932 +Subproject commit 84767787b78a3547497cd3f1b452e775cdc56f95 From f913b86aa351562c49040a874e59d53d9e6cce76 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Fri, 12 Sep 2025 17:24:45 -0600 Subject: [PATCH 382/466] use preprocessor tag chem_proc5_0_07 --- .gitmodules | 3 +-- chem_proc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index d973c73ca8..83a4299fc8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,7 +2,7 @@ path = chem_proc url = https://github.com/ESCOMP/CHEM_PREPROCESSOR.git fxrequired = AlwaysRequired - fxtag = chem_proc5_0_06 + fxtag = chem_proc5_0_07 fxDONOTUSEurl = https://github.com/ESCOMP/CHEM_PREPROCESSOR.git [submodule "carma"] @@ -211,4 +211,3 @@ url = https://github.com/NCAR/CUPiD.git fxtag = v0.2.1 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/NCAR/CUPiD.git - diff --git a/chem_proc b/chem_proc index f923081508..fecf661b50 160000 --- a/chem_proc +++ b/chem_proc @@ -1 +1 @@ -Subproject commit f923081508f4264e61fcef2753a9898e55d1598e +Subproject commit fecf661b50acabbfbd535004333dfa090e4fe980 From 4a5116fbb8a2ebbe818fca02905bedf02d9e3201 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 15 Sep 2025 12:42:21 -0600 Subject: [PATCH 383/466] Update cime --- .gitmodules | 2 +- cime | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index a97c92057c..e872c07abc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,7 +152,7 @@ fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git [submodule "cime"] path = cime url = https://github.com/ESMCI/cime -fxtag = cime6.1.122 +fxtag = cime6.1.124 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/cime diff --git a/cime b/cime index 16f1fb4460..467626cdd9 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 16f1fb44607037e5a1dfe769a69bad366baf7d12 +Subproject commit 467626cdd92fa7cdd6d46d04888021f336708b81 From 323e1db818d8d1ff32253a5ad4dadb1dbd7ab753 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 15 Sep 2025 14:25:36 -0600 Subject: [PATCH 384/466] Update git-fleximod --- .lib/git_fleximod/cli.py | 42 +++++++++++++------------------ .lib/git_fleximod/gitinterface.py | 9 ++++++- .lib/git_fleximod/submodule.py | 24 ++++++++++-------- .lib/pyproject.toml | 2 +- .lib/tbump.toml | 2 +- .lib/tests/test_c_required.py | 13 ++++++++++ 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/.lib/git_fleximod/cli.py b/.lib/git_fleximod/cli.py index 09f23db6de..b5a0549422 100644 --- a/.lib/git_fleximod/cli.py +++ b/.lib/git_fleximod/cli.py @@ -1,9 +1,8 @@ from pathlib import Path import argparse, os, sys -from importlib.resources import files from git_fleximod import utils -__version__ = "1.0.1" +__version__ = "1.0.2" class CustomArgumentParser(argparse.ArgumentParser): def print_help(self, file=None): @@ -12,8 +11,8 @@ def print_help(self, file=None): # Then append the contents of README.md candidate_paths = [ - os.path.join(sys.prefix, "share", "your-package", "README.md"), - os.path.join(os.path.dirname(__file__), "..", "README.md") # fallback for dev + Path(sys.prefix) / "share" / "git_fleximod" / "README.md", + Path(__file__).resolve().parent.parent / "README.md", # fallback for dev ] for path in candidate_paths: if os.path.exists(path): @@ -25,26 +24,21 @@ def print_help(self, file=None): def find_root_dir(filename=".gitmodules"): """ finds the highest directory in tree which contains a file called filename """ - try: - root = utils.execute_subprocess(["git","rev-parse", "--show-toplevel"], - output_to_caller=True ).rstrip() - except: - d = Path.cwd() - root = Path(d.root) - dirlist = [] - dl = d - while dl != root: - dirlist.append(dl) - dl = dl.parent - dirlist.append(root) - dirlist.reverse() - - for dl in dirlist: - attempt = dl / filename - if attempt.is_file(): - return str(dl) - return None - return Path(root) + d = Path.cwd() + root = Path(d.root) + dirlist = [] + dl = d + while dl != root: + dirlist.append(dl) + dl = dl.parent + dirlist.append(root) + dirlist.reverse() + + for dl in dirlist: + attempt = dl / filename + if attempt.is_file(): + return str(dl) + return None def get_parser(): description = """ diff --git a/.lib/git_fleximod/gitinterface.py b/.lib/git_fleximod/gitinterface.py index 1a736e4e98..022426d28c 100644 --- a/.lib/git_fleximod/gitinterface.py +++ b/.lib/git_fleximod/gitinterface.py @@ -60,7 +60,14 @@ def _git_operation_command(self, operation, args): # pylint: disable=unused-argument def git_operation(self, operation, *args, **kwargs): - command = self._git_operation_command(operation, args) + newargs = [] + for a in args: + # Do not use ssh interface + if isinstance(a, str): + a = a.replace("git@github.com:", "https://github.com/") + newargs.append(a) + + command = self._git_command(operation, *newargs) if isinstance(command, list): try: status, output = utils.execute_subprocess(command, status_to_caller=True, output_to_caller=True) diff --git a/.lib/git_fleximod/submodule.py b/.lib/git_fleximod/submodule.py index 48c59a064a..4c6c3accb3 100644 --- a/.lib/git_fleximod/submodule.py +++ b/.lib/git_fleximod/submodule.py @@ -119,27 +119,25 @@ def status(self): atag = atag[:-1] if atag == self.fxtag: break - - - #print(f"line is {line} ahash is {ahash} atag is {atag} {parts}") - # atag = git.git_operation("describe", "--tags", "--always") - # ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0] - recurse = False if rurl != self.url: remote = self._add_remote(git) git.git_operation("fetch", remote) + # Asked for a tag and found that tag if self.fxtag and atag == self.fxtag: result = f" {self.name:>20} at tag {self.fxtag}" recurse = True testfails = False + # Asked for and found a hash elif self.fxtag and (ahash[: len(self.fxtag)] == self.fxtag or (self.fxtag.find(ahash)==0)): result = f" {self.name:>20} at hash {ahash}" recurse = True testfails = False + # Asked for and found a hash elif atag == ahash: result = f" {self.name:>20} at hash {ahash}" recurse = True + # Did not find requested tag or hash elif self.fxtag: result = f"s {self.name:>20} {atag} {ahash} is out of sync with .gitmodules {self.fxtag}" testfails = True @@ -396,13 +394,19 @@ async def update(self): smgit = GitInterface(repodir, self.logger) newremote = self._add_remote(smgit) # Trying to distingush a tag from a hash - allowed = set(string.digits + 'abcdef') + allowed = set(string.digits + 'abcdef') + status = 0 if not set(self.fxtag) <= allowed: # This is a tag tag = f"refs/tags/{self.fxtag}:refs/tags/{self.fxtag}" - smgit.git_operation("fetch", newremote, tag) - smgit.git_operation("checkout", self.fxtag) - + status,_ = smgit.git_operation("fetch", newremote, tag) + if status == 0: + status,_ = smgit.git_operation("checkout", self.fxtag) + if status: + utils.fatal_error( + f"Failed to checkout {self.name} at tag or hash {self.fxtag} from {repodir}" + ) + if not os.path.exists(os.path.join(repodir, ".git")): utils.fatal_error( f"Failed to checkout {self.name} {repo_exists} {repodir} {self.path}" diff --git a/.lib/pyproject.toml b/.lib/pyproject.toml index 95e6076f7f..029fd65e2b 100644 --- a/.lib/pyproject.toml +++ b/.lib/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "git-fleximod" -version = "1.0.1" +version = "1.0.2" description = "Extended support for git-submodule and git-sparse-checkout" authors = ["Jim Edwards "] maintainers = ["Jim Edwards "] diff --git a/.lib/tbump.toml b/.lib/tbump.toml index b20c789b6c..f6fe1e88e2 100644 --- a/.lib/tbump.toml +++ b/.lib/tbump.toml @@ -2,7 +2,7 @@ github_url = "https://github.com/jedwards4b/git-fleximod/" [version] -current = "1.0.1" +current = "1.0.2" # Example of a semver regexp. # Make sure this matches current_version before diff --git a/.lib/tests/test_c_required.py b/.lib/tests/test_c_required.py index 89ab8d294d..2ac6614519 100644 --- a/.lib/tests/test_c_required.py +++ b/.lib/tests/test_c_required.py @@ -1,4 +1,5 @@ import pytest +import re from pathlib import Path def test_required(git_fleximod, test_repo, shared_repos): @@ -28,3 +29,15 @@ def test_required(git_fleximod, test_repo, shared_repos): assert result.returncode == 0 status = git_fleximod(test_repo, f"status {repo_name}") assert shared_repos["status4"] in status.stdout + + text = file_path.read_text() + new_value = "somethingelse" + pattern = r"(^\s*fxtag\s*=\s*).*$" + replacement = r"\1" + new_value + new_text = re.sub(pattern, replacement, text, flags=re.MULTILINE) + + # Write updated content back to file + file_path.write_text(new_text) + + result = git_fleximod(test_repo, f"update {repo_name}") + assert f'fatal: couldn\'t find remote ref' in result.stderr or 'error: pathspec \'somethingelse\' did not match any file(s) known to git' in result.stderr From 60e92913efdc30a534e9335b4da515354c68e6ab Mon Sep 17 00:00:00 2001 From: Jesse Nusbaumer Date: Mon, 15 Sep 2025 14:49:16 -0600 Subject: [PATCH 385/466] Update git-fleximod Github Actions workflow to match CESM alpha branch. --- .github/workflows/fleximod_test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fleximod_test.yaml b/.github/workflows/fleximod_test.yaml index 4e432c0b19..4c13199a37 100644 --- a/.github/workflows/fleximod_test.yaml +++ b/.github/workflows/fleximod_test.yaml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - id: run-fleximod run: | - $GITHUB_WORKSPACE/bin/git-fleximod update + $GITHUB_WORKSPACE/bin/git-fleximod update -o echo echo "Update complete, checking status" echo @@ -23,7 +23,7 @@ jobs: echo echo "Checking if git fleximod matches expected externals" echo - git diff --exit-code + git add . && git diff --exit-code && git diff --cached --exit-code # - name: Setup tmate session # if: ${{ failure() }} # uses: mxschmitt/action-tmate@v3 From 55327c056b569533c07440b79c83ead2f7f4c789 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 16 Sep 2025 12:27:43 -0600 Subject: [PATCH 386/466] Add emission files --- bld/namelist_files/use_cases/1850_cam_lt.xml | 48 ++++++++++++++++--- bld/namelist_files/use_cases/1850_cam_mt.xml | 49 +++++++++++++++++--- bld/namelist_files/use_cases/hist_cam_lt.xml | 45 ++++++++++++++++++ bld/namelist_files/use_cases/hist_cam_mt.xml | 45 ++++++++++++++++++ 4 files changed, 173 insertions(+), 14 deletions(-) diff --git a/bld/namelist_files/use_cases/1850_cam_lt.xml b/bld/namelist_files/use_cases/1850_cam_lt.xml index beb918f6ea..46772f2370 100644 --- a/bld/namelist_files/use_cases/1850_cam_lt.xml +++ b/bld/namelist_files/use_cases/1850_cam_lt.xml @@ -45,18 +45,52 @@ CYCLICAL 1850 - 'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_so4_a1_anthro-ene_vertical_mol_175001-201412_ne30pg3_c20200103.nc', - 'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_anthro-ene_vertical_mol_175001-201412_ne30pg3_c20200103.nc', - 'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' CYCLICAL 1850 + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' + CYCLICAL 1850 diff --git a/bld/namelist_files/use_cases/1850_cam_mt.xml b/bld/namelist_files/use_cases/1850_cam_mt.xml index bbe9e365d7..6a74c2558f 100644 --- a/bld/namelist_files/use_cases/1850_cam_mt.xml +++ b/bld/namelist_files/use_cases/1850_cam_mt.xml @@ -40,18 +40,53 @@ CYCLICAL 1850 - 'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_so4_a1_anthro-ene_vertical_mol_175001-201412_ne30pg3_c20200103.nc', - 'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_anthro-ene_vertical_mol_175001-201412_ne30pg3_c20200103.nc', - 'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', - 'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' CYCLICAL 1850 + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' + + CYCLICAL 1850 diff --git a/bld/namelist_files/use_cases/hist_cam_lt.xml b/bld/namelist_files/use_cases/hist_cam_lt.xml index 35a5cb4cdf..3ae1019360 100644 --- a/bld/namelist_files/use_cases/hist_cam_lt.xml +++ b/bld/namelist_files/use_cases/hist_cam_lt.xml @@ -37,9 +37,54 @@ INTERP_MISSING_MONTHS + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' + INTERP_MISSING_MONTHS + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' + + + SERIAL diff --git a/bld/namelist_files/use_cases/hist_cam_mt.xml b/bld/namelist_files/use_cases/hist_cam_mt.xml index 8efd9424f1..30c16a659a 100644 --- a/bld/namelist_files/use_cases/hist_cam_mt.xml +++ b/bld/namelist_files/use_cases/hist_cam_mt.xml @@ -32,9 +32,54 @@ INTERP_MISSING_MONTHS + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' + + INTERP_MISSING_MONTHS + +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' + + SERIAL From 6fa61d9f747e761a1164280b446a798dc94111d6 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 16 Sep 2025 13:40:18 -0600 Subject: [PATCH 387/466] Add 1850 CAM7 regression tests --- cime_config/testdefs/testlist_cam.xml | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 7fbd99bfa0..7550cf3ee3 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -88,6 +88,25 @@ + + + + + + + + + + + + + + + + + + + @@ -1522,6 +1541,15 @@ + + + + + + + + + @@ -1540,6 +1568,15 @@ + + + + + + + + + From 91407b94a64cc6dba39b9aedaa65e8eb49ceabb8 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 16 Sep 2025 13:55:05 -0600 Subject: [PATCH 388/466] add missing file --- cime_config/config_compsets.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 0521731823..254949e81f 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -62,6 +62,16 @@ HIST_CAM70%MT_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + F1850C_LTso + 1850_CAM70%LT_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + + + F1850C_MTso + 1850_CAM70%MT_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV + + FLT1850_TESTINGONLY_v0c 1850_CAM70%LT_CLM60%SP_CICE%PRES_DOCN%DOM_MOSART_SGLC_SWAV From 6e0a2ee22388c9aaf073e277b0293098b467b7b4 Mon Sep 17 00:00:00 2001 From: Julio Bacmeister Date: Tue, 16 Sep 2025 14:36:44 -0600 Subject: [PATCH 389/466] added mlt heating. lowered mrg region --- bld/namelist_files/namelist_defaults_cam.xml | 6 ++-- src/physics/cam/radheat.F90 | 34 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 6f95609b1f..ab056f3bb4 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -579,15 +579,15 @@ 0.D0 1.D0 1.D0 - 2.D0 + 5.D0 0.D0 - 2.D0 + 6.1D0 1.D0 - 5.D0 + 20.D0 1.D0 diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 8a75ccab34..1809f9a486 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -302,7 +302,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ! ++ jtb test setting M/LT SW to scaled cosine ! solar zenith angle - qrs_mlt_prof = qrs_mlt_profile( zref_mid_7km ) + qrs_mlt_prof = qrs_mlt_profile_a( zref_mid_7km ) do k = 1,pver qrs_mlt(:,k) = qrsmlt_scaling * qrs_mlt_prof(k) * max( coszrs(:) , 0._r8 ) / 86400._r8 end do @@ -396,7 +396,7 @@ end subroutine merge_qrx !-------------------------------------------------------------------- !-------------------------------------------------------------------- ! Elemental: works on scalars and arrays - pure elemental function qrs_mlt_profile(z) result(x) + pure elemental function qrs_mlt_profile_b(z) result(x) !--------------------------------------------------------------- ! Returns profile of SW heating (K/day) based on curve ! fitting to equatorial mean profile of QRS_TOT in: @@ -422,6 +422,34 @@ pure elemental function qrs_mlt_profile(z) result(x) x = c0 + c1*z + a1 * tanh( (z - z1)/s1 ) + a2 * tanh( (z - z2)/s2 ) - end function qrs_mlt_profile + end function qrs_mlt_profile_b +!----------------------------------------------------------------------- +! Pure elemental function: works on scalars or arrays, side-effect free. +!----------------------------------------------------------------------- + pure elemental function qrs_mlt_profile_a(z) result(x) + !--------------------------------------------------------------- + ! Returns profile of SW heating (K/day) based on curve + ! fitting to equatorial mean profile of QRS_TOT in: + ! + ! SCWACCM_forcing_zm_L70_1849-2015_CMIP6ensAvg_c181011.nc + !---------------------------------------------------------------- + implicit none + real(r8), intent(in) :: z + real(r8) :: x ! heating in K/day + + ! ---- Best-fit parameters ---- + real(r8), parameter :: c0_1 = -11.839696742958163_r8 + real(r8), parameter :: c1_1 = 0.23077408652259085_r8 + real(r8), parameter :: a1_1 = 3.741649559788312_r8 + real(r8), parameter :: z1_1 = 36.50366034343402_r8 + real(r8), parameter :: s1_1 = 8.696300405188122_r8 + + if (z < 40._r8 ) then + x = 0._r8 + else + x = c0_1 + c1_1*z + a1_1*sin( (z - z1_1)/s1_1 ) + end if + + end function qrs_mlt_profile_a end module radheat From d9b9e2f337532043e926766ec8253907f0ec7c85 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 17 Sep 2025 12:37:39 -0600 Subject: [PATCH 390/466] Limit the new emission files to only ne30pg3 runs --- bld/namelist_files/use_cases/1850_cam_lt.xml | 4 ++-- bld/namelist_files/use_cases/1850_cam_mt.xml | 4 ++-- bld/namelist_files/use_cases/hist_cam_lt.xml | 4 ++-- bld/namelist_files/use_cases/hist_cam_mt.xml | 4 ++-- cime_config/testdefs/testlist_cam.xml | 22 +++----------------- 5 files changed, 11 insertions(+), 27 deletions(-) diff --git a/bld/namelist_files/use_cases/1850_cam_lt.xml b/bld/namelist_files/use_cases/1850_cam_lt.xml index 46772f2370..14b2801215 100644 --- a/bld/namelist_files/use_cases/1850_cam_lt.xml +++ b/bld/namelist_files/use_cases/1850_cam_lt.xml @@ -44,7 +44,7 @@ CYCLICAL 1850 - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', @@ -60,7 +60,7 @@ CYCLICAL 1850 - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', 'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', diff --git a/bld/namelist_files/use_cases/1850_cam_mt.xml b/bld/namelist_files/use_cases/1850_cam_mt.xml index 6a74c2558f..4202d8650f 100644 --- a/bld/namelist_files/use_cases/1850_cam_mt.xml +++ b/bld/namelist_files/use_cases/1850_cam_mt.xml @@ -39,7 +39,7 @@ CYCLICAL 1850 - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', @@ -55,7 +55,7 @@ CYCLICAL 1850 - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', 'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', diff --git a/bld/namelist_files/use_cases/hist_cam_lt.xml b/bld/namelist_files/use_cases/hist_cam_lt.xml index 3ae1019360..0f2227f216 100644 --- a/bld/namelist_files/use_cases/hist_cam_lt.xml +++ b/bld/namelist_files/use_cases/hist_cam_lt.xml @@ -37,7 +37,7 @@ INTERP_MISSING_MONTHS - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', @@ -52,7 +52,7 @@ INTERP_MISSING_MONTHS - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', 'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', diff --git a/bld/namelist_files/use_cases/hist_cam_mt.xml b/bld/namelist_files/use_cases/hist_cam_mt.xml index 30c16a659a..f63df161f9 100644 --- a/bld/namelist_files/use_cases/hist_cam_mt.xml +++ b/bld/namelist_files/use_cases/hist_cam_mt.xml @@ -32,7 +32,7 @@ INTERP_MISSING_MONTHS - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', @@ -48,7 +48,7 @@ INTERP_MISSING_MONTHS - + 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', 'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', 'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', diff --git a/cime_config/testdefs/testlist_cam.xml b/cime_config/testdefs/testlist_cam.xml index 7550cf3ee3..b4a008c5df 100644 --- a/cime_config/testdefs/testlist_cam.xml +++ b/cime_config/testdefs/testlist_cam.xml @@ -88,22 +88,14 @@ - - - - - - - - - + - + @@ -1541,15 +1533,6 @@ - - - - - - - - - @@ -1570,6 +1553,7 @@ + From 4432dd7bd314837ff4a38f850d34667a58c63f63 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 17 Sep 2025 15:57:16 -0600 Subject: [PATCH 391/466] ChangeLog for cam6_4_115 --- doc/ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 3c27cac830..85d849e600 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,70 @@ =============================================================== +Tag name: cam6_4_115 +Originator(s): cacraig, hannay +Date: Sept 17, 2025 +One-line Summary: Add emission files for CAM7 runs +Github PR URL: https://github.com/ESCOMP/CAM/pull/1395 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Update emission flies for CAM7: https://github.com/ESCOMP/CAM/issues/1394 + - Important NOTE: These new files only work with ne30pg3 compsets + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: + - Update the emission files for ne30pg3 CAM7 compsets + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: fvitt, hannay + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M bld/namelist_files/use_cases/1850_cam_lt.xml +M bld/namelist_files/use_cases/1850_cam_mt.xml +M bld/namelist_files/use_cases/hist_cam_lt.xml +M bld/namelist_files/use_cases/hist_cam_mt.xml + - Add emission files for ne30pg3 CAM7 compsets + +M cime_config/config_compsets.xml +M cime_config/testdefs/testlist_cam.xml + - Introduce F1850C_LTso and F1850C_MTso compsets and tests for them + +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: all BFB except: + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - New emission files change answers for CAM7 ne30pg3 compsets + + ERP_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - New regression tests, so no baselines to compare against + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + - pre-existing failure- See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +=============================================================== +=============================================================== + Tag name: cam6_4_114 Originator(s): cacraigucar, hannay, peverwhee, PeterHjortLauritzen Date: September 8, 2025 From 900121cf9c9adcef259d354efbfd4f03b7635274 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 17 Sep 2025 16:24:03 -0600 Subject: [PATCH 392/466] Update atmos_phys tag and address reviewer comments --- .gitmodules | 4 +-- src/physics/cam/radheat.F90 | 64 +++++++++++++++++++++++++------------ 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/.gitmodules b/.gitmodules index beec93ef52..b0aded667f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = 5e8d7fff667b473ff9ab89892e3c5fa1df0b310b + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_17_001 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 1809f9a486..3ac3e255b1 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -114,7 +114,7 @@ end subroutine radheat_register subroutine radheat_init(pref_mid) - + use nlte_fomichev, only: nlte_fomichev_init use phys_control, only: phys_getopts use cam_history, only: addfld @@ -139,7 +139,7 @@ subroutine radheat_init(pref_mid) !----------------------------------------------------------------------- zref_mid_7km = -7.0_r8 * log( pref_mid/100000._r8 ) - + call phys_getopts(radiation_scheme_out=rad_pkg, & history_waccm_out=history_waccm, & history_scwaccm_forcing_out=history_scwaccm_forcing) @@ -180,7 +180,7 @@ subroutine radheat_init(pref_mid) endif end do - + co2_mw = mwco2 o1_mw = 16._r8 o2_mw = 32._r8 @@ -190,7 +190,7 @@ subroutine radheat_init(pref_mid) nlte_limit_co2 = .true. ! Initialize Fomichev parameterization call nlte_fomichev_init (co2_mw, n2_mw, o1_mw, o2_mw, o3_mw, no_mw, nlte_limit_co2) - + ! determine upppermost level that is purely solar heating (no MLT chem heating) ntop_qrs_cam = 0 @@ -201,7 +201,7 @@ subroutine radheat_init(pref_mid) ! Add history variables to master field list call addfld ('QRL_TOT',(/ 'lev' /), 'A','K/s','Merged LW heating: QRL+QRL_MLT') call addfld ('QRS_TOT',(/ 'lev' /), 'A','K/s','Merged SW heating: QRS+QRS_MLT') - + end subroutine radheat_init !================================================================================================ @@ -260,7 +260,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & real(r8), intent(out) :: net_flx(pcols) ! Local variables - integer :: k + integer :: k integer :: ncol ! number of atmospheric columns integer :: lchnk ! chunk identifier real(r8) :: qrl_mrg(pcols,pver) ! merged LW heating @@ -297,10 +297,8 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ncol = state%ncol lchnk = state%lchnk call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) - - ! Shortwave heating is RRTMG solar heating only - ! ++ jtb test setting M/LT SW to scaled cosine - ! solar zenith angle + + ! Setting idealized M/LT SW to scaled cosine solar zenith angle qrs_mlt_prof = qrs_mlt_profile_a( zref_mid_7km ) do k = 1,pver @@ -343,7 +341,7 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & - + ! REMOVECAM no longer need once CAM is retired and pcols doesn't exist net_flx = 0._r8 ptend%s = 0._r8 @@ -411,6 +409,21 @@ pure elemental function qrs_mlt_profile_b(z) result(x) real(r8) :: c0, c1, a1, z1, s1, a2, z2, s2 ! Assign values from popt + + ! -------------------- + ! Values from are from fitting to mean equatorial WACCM QRS_TOT in + ! + ! SCWACCM_forcing_zm_L70_1849-2015_CMIP6ensAvg_c181011.nc + ! + ! using function 'curve_fit' in scipy.optimize: + ! https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html + ! + ! applied to the functional form: + ! c0 + c1*z + a1 * tanh( (z - z1)/s1 ) + a2 * tanh( (z - z2)/s2 ) + ! + ! z is in the range 0 to 100km + ! -------------------- + c0 = 32.45612064_r8 c1 = -0.50124861_r8 a1 = 19.11626479_r8 @@ -419,7 +432,7 @@ pure elemental function qrs_mlt_profile_b(z) result(x) a2 = 13.50543681_r8 z2 = 87.95888464_r8 s2 = 9.94346974_r8 - + x = c0 + c1*z + a1 * tanh( (z - z1)/s1 ) + a2 * tanh( (z - z2)/s2 ) end function qrs_mlt_profile_b @@ -434,18 +447,29 @@ pure elemental function qrs_mlt_profile_a(z) result(x) ! SCWACCM_forcing_zm_L70_1849-2015_CMIP6ensAvg_c181011.nc !---------------------------------------------------------------- implicit none - real(r8), intent(in) :: z + real(r8), intent(in) :: z ! reference height profile real(r8) :: x ! heating in K/day ! ---- Best-fit parameters ---- - real(r8), parameter :: c0_1 = -11.839696742958163_r8 - real(r8), parameter :: c1_1 = 0.23077408652259085_r8 - real(r8), parameter :: a1_1 = 3.741649559788312_r8 - real(r8), parameter :: z1_1 = 36.50366034343402_r8 - real(r8), parameter :: s1_1 = 8.696300405188122_r8 - + ! Values from are from fitting to mean equatorial WACCM QRS_TOT in + ! + ! SCWACCM_forcing_zm_L70_1849-2015_CMIP6ensAvg_c181011.nc + ! https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html + ! + ! applied to the functional form: + ! c0_1 + c1_1z + a1_1sin( (z - z1_1)/s1_1 ) + ! + ! z is in the range 40 to 100km + ! ---------- + real(r8), parameter :: c0_1 = -11.839696742958163_r8 + real(r8), parameter :: c1_1 = 0.23077408652259085_r8 + real(r8), parameter :: a1_1 = 3.741649559788312_r8 + real(r8), parameter :: z1_1 = 36.50366034343402_r8 + real(r8), parameter :: s1_1 = 8.696300405188122_r8 + + ! Set heating rate profile to zero below 40km. Above 40km, use funtional form if (z < 40._r8 ) then - x = 0._r8 + x = 0._r8 else x = c0_1 + c1_1*z + a1_1*sin( (z - z1_1)/s1_1 ) end if From 9d07344bdb39a688deb0dd5d0adab12f611e1858 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 18 Sep 2025 13:44:08 -0600 Subject: [PATCH 393/466] use namelist defaults for all non-waccm physics --- bld/build-namelist | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 816c05ed16..7db9cebbf7 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -740,12 +740,11 @@ elsif ($rad_pkg =~ m/rrtmgp/) { $nl->set_variable_value('radiation_nl', 'rrtmgp_coefs_sw_file', $abs_path); add_default($nl, 'p_top_for_equil_rad'); - if (not $waccm_phys) { - add_default($nl, 'qrsmlt_scaling'); - add_default($nl, 'p_top_for_radmrg'); - add_default($nl, 'p_bot_for_radmrg'); - } - +} +if (not $waccm_phys) { + add_default($nl, 'qrsmlt_scaling'); + add_default($nl, 'p_top_for_radmrg'); + add_default($nl, 'p_bot_for_radmrg'); } # Solar irradiance From ecdeda27adbd01df5a190962173f69d0f1bc80d7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 18 Sep 2025 15:18:44 -0600 Subject: [PATCH 394/466] Fix failing NAG test --- src/physics/cam/radheat.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/radheat.F90 b/src/physics/cam/radheat.F90 index 3ac3e255b1..7c1acfcb90 100644 --- a/src/physics/cam/radheat.F90 +++ b/src/physics/cam/radheat.F90 @@ -41,7 +41,7 @@ module radheat real(r8), public :: p_top_for_equil_rad = 0._r8 real(r8), public :: p_top_for_radmrg = 0._r8 - real(r8), public :: p_bot_for_radmrg = 0._r8 + real(r8), public :: p_bot_for_radmrg = 1._r8 real(r8), public :: qrsmlt_scaling = 1.0_r8 ! Scaling for "M/LT" SW heating ! Private variables for merging heating rates @@ -296,13 +296,15 @@ subroutine radheat_tend(state, pbuf, ptend, qrl, qrs, fsns, & ncol = state%ncol lchnk = state%lchnk + qrs_mlt(:,:) = 0._r8 + call physics_ptend_init(ptend, state%psetcols, 'radheat', ls=.true.) ! Setting idealized M/LT SW to scaled cosine solar zenith angle qrs_mlt_prof = qrs_mlt_profile_a( zref_mid_7km ) do k = 1,pver - qrs_mlt(:,k) = qrsmlt_scaling * qrs_mlt_prof(k) * max( coszrs(:) , 0._r8 ) / 86400._r8 + qrs_mlt(:ncol,k) = qrsmlt_scaling * qrs_mlt_prof(k) * max( coszrs(:ncol) , 0._r8 ) / 86400._r8 end do icall = 0 From caf7a3c62f95b256694adb550beeba6d2869aa69 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 18 Sep 2025 15:20:10 -0600 Subject: [PATCH 395/466] Add updated submodule --- src/atmos_phys | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atmos_phys b/src/atmos_phys index 9afbf411f8..59abaad4e6 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 9afbf411f81ec9a4e59148edcd2eead8841f61ef +Subproject commit 59abaad4e66984b7071165fcc94fbb4a1355e4c2 From 60175dc8aae5c51c506c5531e49e5543cc9ee6ce Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 18 Sep 2025 16:46:48 -0600 Subject: [PATCH 396/466] Update atmos_phys external --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index b0aded667f..e6246b8a8f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_17_001 + fxtag = atmos_phys0_17_002 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 59abaad4e6..cd1365da0f 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 59abaad4e66984b7071165fcc94fbb4a1355e4c2 +Subproject commit cd1365da0f23d0529a497757e64266ce60f746a3 From 9f35c094a7853c0d65b874c0b72c7f0b320396cd Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 19 Sep 2025 08:59:04 -0600 Subject: [PATCH 397/466] ChangeLog for cam6_4_116 --- doc/ChangeLog | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 85d849e600..8e989fc075 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,76 @@ =============================================================== +Tag name: cam6_4_116 +Originator(s): JulioTBacmeister, cacraigucar, peverwhee +Date: Sept 19, 2025 +One-line Summary: Mods for RRTMGP blending layer +Github PR URL: https://github.com/ESCOMP/CAM/pull/1396 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Further refine the blending layer for the upper stratosphere: https://github.com/ESCOMP/CAM/issues/1382 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: + - radheat namelist is being written to atm_in for more configurations + +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, peverwhee + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .gitmodules +M src/atmos_phys + - update atmos_phys tag + +M bld/build-namelist +M bld/namelist_files/namelist_defaults_cam.xml +M bld/namelist_files/namelist_definition.xml + - added qrsmlt_scaling, p_top_for_radmrg and p_bot_for_radmrg + +M src/physics/camrt/radiation.F90 +M src/physics/rrtmg/radiation.F90 +M src/physics/waccm/radheat.F90 + - Changes to interface to match other configurations + +M src/physics/cam/radheat.F90 +M src/physics/rrtmgp/radiation.F90 + - refine the radiation blending layer + + +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: all BFB except: + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: FAIL) + - pre-existing failure due to build-namelist error requiring CLM/CTSM external update. + + ERP_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + - Answer changes for MT configurations due to modified blending layer for RRTMGP + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + - pre-existing failure- See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +=============================================================== +=============================================================== + Tag name: cam6_4_115 Originator(s): cacraig, hannay Date: Sept 17, 2025 From 730a361cc0e3c7a4847ef173ddd94e7f7ec6bea9 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 19 Sep 2025 09:56:43 -0600 Subject: [PATCH 398/466] Update cime external --- .gitmodules | 2 +- cime | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 78aad31067..67e28bac4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,7 +152,7 @@ fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git [submodule "cime"] path = cime url = https://github.com/ESMCI/cime -fxtag = cime6.1.124 +fxtag = cime6.1.126 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/cime diff --git a/cime b/cime index 467626cdd9..c0681033bd 160000 --- a/cime +++ b/cime @@ -1 +1 @@ -Subproject commit 467626cdd92fa7cdd6d46d04888021f336708b81 +Subproject commit c0681033bdfb71d10821b478fe562e825f28268b From 8d883345f73ff0b5ba5a7615363e9ce66958796d Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Fri, 19 Sep 2025 12:03:28 -0600 Subject: [PATCH 399/466] Update externals one more time --- .gitmodules | 2 +- ccs_config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 67e28bac4e..7981e11f27 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,7 +145,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.59 +fxtag = ccs_config_cesm1.0.60 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git diff --git a/ccs_config b/ccs_config index 028bbd779b..ff41a3963e 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 028bbd779bf989cab8767dd0e7135126429b4531 +Subproject commit ff41a3963e325db3348d56da492c4e18535d34fc From fe4c865b921ce53321ca0990b301c653403e93b0 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:25:04 -0400 Subject: [PATCH 400/466] Address review comments; check errflg at end of CCPPized vertical diffusion calls --- src/physics/cam/diffusion_solver_cam.F90 | 4 +- src/physics/cam/vertical_diffusion.F90 | 81 ++++++++++++++++++++++++ src/utils/air_composition.F90 | 2 +- 3 files changed, 84 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/diffusion_solver_cam.F90 b/src/physics/cam/diffusion_solver_cam.F90 index 87973a5e1f..549329a588 100644 --- a/src/physics/cam/diffusion_solver_cam.F90 +++ b/src/physics/cam/diffusion_solver_cam.F90 @@ -180,7 +180,7 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & logical, intent(in) :: use_temperature_molec_diff! Flag indicating that molecular diffusion should apply to temperature, not ! dry static energy. real(r8), intent(in) :: cpairv(:,:) ! Specific heat at constant pressure - real(r8), intent(in) :: mbarv(:,:) ! Composition dependent atmosphere mean mass + real(r8), intent(in) :: mbarv(:,:) ! Composition dependent atmosphere mean molar mass [kg mol-1] ! The molecular diffusion module will likely change significantly in ! the future, and this module may directly depend on it after that. @@ -803,7 +803,7 @@ end function vd_lu_qdecomp molec_boundary = molec_boundary, & t = t(:ncol,:), & ! temperature, midpoints tint = tint(:ncol,:), & ! temperature, interfaces - mbarv = mbarv(:ncol,:), & ! composition dependent atmosphere mean mass + mbarv = mbarv(:ncol,:), & ! composition dependent atmosphere mean molar mass ztodt = ztodt, & nbot_molec = nbot_molec, & no_molec_decomp = no_molec_decomp) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 82eb8d3c40..3885f9fe8e 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -386,6 +386,10 @@ subroutine vertical_diffusion_init(pbuf2d) errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('holtslag_boville_diff_init: ' // errmsg) + endif + call addfld('HB_ri', (/ 'lev' /), 'A', 'no', 'Richardson Number (HB Scheme), I' ) case ( 'CLUBB_SGS' ) is_clubb_scheme = .true. @@ -401,6 +405,11 @@ subroutine vertical_diffusion_init(pbuf2d) ntop_turb_in = ntop_eddy, & errmsg = errmsg, & errflg = errflg) + + if(errflg /= 0) then + call endrun('holtslag_boville_diff_init: ' // errmsg) + endif + ! ! run HB scheme where CLUBB is not active when running cam7 or cam6 physics ! else init_hb_diff is called just for diagnostic purposes @@ -969,6 +978,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('vertical_diffusion_interpolate_to_interfaces_run: ' // errmsg) + endif + ! Initialize total surface stresses ! these are used for HB diffusion scheme and later PBL diagnostics but ! not for the vertical diffusion solver, which uses surface stresses from the coupler @@ -1041,6 +1054,10 @@ subroutine vertical_diffusion_tend( & q_wv_cflx = q_wv_cflx(:ncol), & ! for use in HB for kinematic water vapor flux calc. errmsg = errmsg, & errflg = errflg) + + if(errflg /= 0) then + call endrun('hb_free_atm_diff_prepare_vertical_diffusion_inputs_run: ' // errmsg) + endif else call hb_diff_prepare_vertical_diffusion_inputs_run( & ncol = ncol, & @@ -1062,6 +1079,10 @@ subroutine vertical_diffusion_tend( & q_wv_cflx = q_wv_cflx(:ncol), & ! for use in HB for kinematic water vapor flux calc. errmsg = errmsg, & errflg = errflg) + + if(errflg /= 0) then + call endrun('hb_diff_prepare_vertical_diffusion_inputs_run: ' // errmsg) + endif endif !----------------------------------------------------------------------- ! @@ -1142,6 +1163,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('hb_pbl_independent_coefficients_run: ' // errmsg) + endif + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists pblh(:) = 0._r8 wstar(:) = 0._r8 @@ -1169,6 +1194,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('hb_pbl_dependent_coefficients_run: ' // errmsg) + endif + !REMOVECAM - no longer need this when CAM is retired and pcols no longer exists kvm(:,:) = 0._r8 kvh(:,:) = 0._r8 @@ -1211,6 +1240,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('hb_diff_exchange_coefficients_run: ' // errmsg) + endif + call outfld( 'HB_ri', ri, pcols, lchnk ) case ( 'CLUBB_SGS' ) @@ -1260,6 +1293,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('hb_pbl_independent_coefficients_run: ' // errmsg) + endif + call pbuf_get_field(pbuf, clubbtop_idx, clubbtop) clubbtop_r = real(clubbtop, r8) @@ -1288,6 +1325,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('hb_diff_free_atm_exchange_coefficients_run: ' // errmsg) + endif + call outfld( 'HB_ri', ri, pcols, lchnk ) else ! CLUBB has only a bare-bones placeholder here. If using CLUBB, the @@ -1330,6 +1371,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('vertical_diffusion_sponge_layer_run: ' // errmsg) + endif + ! kvh (in pbuf) is used by other physics parameterizations, and as an initial guess in compute_eddy_diff ! on the next timestep. It is not updated by the compute_vdiff call below. call pbuf_set_field(pbuf, kvh_idx, kvh) @@ -1386,6 +1431,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('implicit_surface_stress_add_drag_coefficient_run: ' // errmsg) + endif + ! Add TMS surface drag rate call turbulent_mountain_stress_add_drag_coefficient_run( & ncol = ncol, & @@ -1396,6 +1445,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('turbulent_mountain_stress_add_drag_coefficient_run: ' // errmsg) + endif + ! Based on the drag coefficients, calculate wind damping rates call vertical_diffusion_wind_damping_rate_run( & ncol = ncol, & @@ -1408,6 +1461,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('vertical_diffusion_wind_damping_rate_run: ' // errmsg) + endif + ! Add Beljaars wind damping rate call beljaars_add_wind_damping_rate_run( & ncol = ncol, & @@ -1418,6 +1475,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('beljaars_add_wind_damping_rate_run: ' // errmsg) + endif + ! If molecular diffusion is not done, use the CCPP-ized subroutine call vertical_diffusion_diffuse_horizontal_momentum_run( & ncol = ncol, & @@ -1457,6 +1518,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('vertical_diffusion_diffuse_horizontal_momentum_run: ' // errmsg) + endif + ! Diffuse dry static energy call vertical_diffusion_diffuse_dry_static_energy_run( & ncol = ncol, & @@ -1475,6 +1540,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun('vertical_diffusion_diffuse_dry_static_energy_run: ' // errmsg) + endif + ! Diffuse tracers call vertical_diffusion_diffuse_tracers_run( & ncol = ncol, & @@ -1500,6 +1569,10 @@ subroutine vertical_diffusion_tend( & q1 = q_tmp(:ncol,:pver,:pcnst), & errmsg = errmsg, & errflg = errflg) + + if(errflg /= 0) then + call endrun('vertical_diffusion_diffuse_tracers_run: ' // errmsg) + endif else ! Molecular diffusion is active, use old compute_vdiff @@ -1519,6 +1592,10 @@ subroutine vertical_diffusion_tend( & dse_top = dse_top(:ncol), & errmsg = errmsg, & errflg = errflg) + + if(errflg /= 0) then + call endrun('vertical_diffusion_set_dry_static_energy_at_toa_molecdiff_run: ' // errmsg) + endif else dse_top(:ncol) = 0._r8 end if @@ -1716,6 +1793,10 @@ subroutine vertical_diffusion_tend( & errmsg = errmsg, & errflg = errflg) + if(errflg /= 0) then + call endrun("vertical_diffusion_tendencies_run: " // errmsg) + endif + ! -------------------------------------------------------- ! ! Diagnostics and output writing after applying PBL scheme ! ! -------------------------------------------------------- ! diff --git a/src/utils/air_composition.F90 b/src/utils/air_composition.F90 index 6046ffebf1..f9d53beca1 100644 --- a/src/utils/air_composition.F90 +++ b/src/utils/air_composition.F90 @@ -103,7 +103,7 @@ module air_composition real(r8), public, protected, allocatable :: rairv(:,:,:) ! cappav: rairv / cpairv real(r8), public, protected, allocatable :: cappav(:,:,:) - ! mbarv: composition dependent atmosphere mean mass + ! mbarv: composition dependent atmosphere mean molar mass [kg mol-1] real(r8), public, protected, allocatable :: mbarv(:,:,:) ! cp_or_cv_dycore: enthalpy or internal energy scaling factor for ! energy consistency From 857eb7b089c577922714978b4e84921cf8318143 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:25:36 -0400 Subject: [PATCH 401/466] Update src/physics/cam/diffusion_solver_cam.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/diffusion_solver_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/diffusion_solver_cam.F90 b/src/physics/cam/diffusion_solver_cam.F90 index 549329a588..ac3289bf28 100644 --- a/src/physics/cam/diffusion_solver_cam.F90 +++ b/src/physics/cam/diffusion_solver_cam.F90 @@ -120,7 +120,7 @@ subroutine compute_vdiff( ncol, pver, pverp, ncnst, tint , & integer, intent(in) :: pver integer, intent(in) :: pverp integer, intent(in) :: ncnst ! # of constituents to diffuse. In eddy_diff, only wv. Others, pcnst. - real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] + real(r8), intent(in) :: ztodt ! delta-t [ s ] logical, intent(in) :: do_diffusion_u_v ! diffuse horizontal winds [flag] logical, intent(in) :: do_diffusion_s ! diffuse dry static energy [flag] From 0d8ae91ab31713c1b515fea2f8a32e52e128bb33 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:25:54 -0400 Subject: [PATCH 402/466] Update src/control/cam_snapshot_common.F90 Co-authored-by: Jesse Nusbaumer --- src/control/cam_snapshot_common.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index 8e0575589e..2f57a2ccca 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -84,7 +84,7 @@ module cam_snapshot_common type (snapshot_type) :: state_snapshot(30) type (snapshot_type) :: cnst_snapshot(pcnst) type (snapshot_type) :: tend_snapshot(6) -type (snapshot_type) :: cam_in_snapshot(200) ! needs to be bigger than pcnst because cam_in is split by constituent. +type (snapshot_type) :: cam_in_snapshot(pcnst+31) ! needs to be bigger than pcnst because cam_in is split by constituent. type (snapshot_type) :: cam_out_snapshot(30) type (snapshot_type_nd) :: pbuf_snapshot(300) From beed70f4497ed606971e9c47cf164c57757c570a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:26:08 -0400 Subject: [PATCH 403/466] Update src/physics/cam/eddy_diff_cam.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/eddy_diff_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index d0f69f7d9a..c38a543336 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -197,7 +197,7 @@ subroutine eddy_diff_init(pbuf2d, ntop_eddy_in, nbot_eddy_in) end do ml2(nbot_eddy+1:pver+1) = 0._r8 - ! Only diffuse constituent 1 and disable molecular diffusion + ! Only diffuse water vapor (constituent 1) and disable molecular diffusion do_diffusion_const_wet(:) = .false. do_molecular_diffusion_const(:) = .false. do_diffusion_const_wet(1) = .true. From a2c0f80fde66d65e3de7d377e57ddc474c0179ef Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:26:20 -0400 Subject: [PATCH 404/466] Update src/physics/cam/eddy_diff_cam.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/eddy_diff_cam.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/eddy_diff_cam.F90 b/src/physics/cam/eddy_diff_cam.F90 index c38a543336..2e00e41005 100644 --- a/src/physics/cam/eddy_diff_cam.F90 +++ b/src/physics/cam/eddy_diff_cam.F90 @@ -454,7 +454,7 @@ subroutine compute_eddy_diff( pbuf, lchnk , real(r8), intent(in) :: taux(pcols) ! Zonal wind stress at surface [ N/m2 ] real(r8), intent(in) :: tauy(pcols) ! Meridional wind stress at surface [ N/m2 ] real(r8), intent(in) :: shflx(pcols) ! Sensible heat flux at surface [ unit ? ] - real(r8), intent(in) :: qflx(pcols,1) ! Water vapor flux at surface [ unit ? ] + real(r8), intent(in) :: qflx(pcols,1) ! Water vapor flux at surface [ kg/m2/s] real(r8), intent(in) :: kvm_in(pcols,pver+1) ! kvm saved from last timestep [ m2/s ] real(r8), intent(in) :: kvh_in(pcols,pver+1) ! kvh saved from last timestep [ m2/s ] real(r8), intent(in) :: ksrftms(pcols) ! Surface drag coefficient of turbulent mountain stress [ unit ? ] From b45727e8a89c10d363188bd08cb415c97c6f523a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:27:09 -0400 Subject: [PATCH 405/466] Update src/physics/cam/molec_diff.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/molec_diff.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/molec_diff.F90 b/src/physics/cam/molec_diff.F90 index f54330dad8..996493c9d4 100644 --- a/src/physics/cam/molec_diff.F90 +++ b/src/physics/cam/molec_diff.F90 @@ -248,7 +248,7 @@ function vd_lu_qdecomp( & type(Coords1D), intent(in) :: p ! Pressure coordinates type(BoundaryType), intent(in) :: interface_boundary ! Boundary on grid edge. type(BoundaryType), intent(in) :: molec_boundary ! Boundary at edge of molec_diff region. - real(r8), intent(in) :: tint(:,:) ! Interface temperature [ K ], interfaces + real(r8), intent(in) :: tint(:,:) ! Air temperature [ K ], interfaces real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] real(r8), intent(in) :: t(:,:) ! temperature From 21dcd791e37b0f9598587c06b1b1736271fb5abf Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:27:17 -0400 Subject: [PATCH 406/466] Update src/physics/cam/vertical_diffusion.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/vertical_diffusion.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 3885f9fe8e..504fd80aef 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -102,8 +102,8 @@ module vertical_diffusion character(len=16) :: shallow_scheme ! Shallow convection scheme -logical :: do_diffusion_const_dry(pcnst)! Do vertical diffusion (as dry) for this constituent? -logical :: do_diffusion_const_wet(pcnst)! Do vertical diffusion (as wet) for this constituent? +logical :: do_diffusion_const_dry(pcnst)! Do vertical diffusion (as a dry mixing ratio) for this constituent? +logical :: do_diffusion_const_wet(pcnst)! Do vertical diffusion (as a wet mixing ratio) for this constituent? logical :: do_molecular_diffusion_const(pcnst) ! Do molecular diffusion for this constituent? ! In compute_vdiff, both do_diffusion_const and molecular_diffusion_const ! have to be true for molec diff to happen From e2cf9cd2a4878fd504ce3c8863db938a34779f59 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:27:39 -0400 Subject: [PATCH 407/466] Update src/physics/cam/molec_diff.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/molec_diff.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/molec_diff.F90 b/src/physics/cam/molec_diff.F90 index 996493c9d4..6fbac5a39d 100644 --- a/src/physics/cam/molec_diff.F90 +++ b/src/physics/cam/molec_diff.F90 @@ -251,9 +251,9 @@ function vd_lu_qdecomp( & real(r8), intent(in) :: tint(:,:) ! Air temperature [ K ], interfaces real(r8), intent(in) :: ztodt ! 2 delta-t [ s ] - real(r8), intent(in) :: t(:,:) ! temperature + real(r8), intent(in) :: t(:,:) ! Air temperature [ K ] integer, intent(in) :: m ! cnst index - real(r8), intent(in) :: mbarv(:,:) ! composition dependent atmosphere mean mass + real(r8), intent(in) :: mbarv(:,:) ! composition dependent molar mass of dry air [ kg kmol-1] ! Decomposition covering levels without vertical diffusion. type(TriDiagDecomp), intent(in) :: no_molec_decomp From 63ab44c8bf68c372b43f1ec4d828c9538e446713 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:27:45 -0400 Subject: [PATCH 408/466] Update src/physics/cam/vertical_diffusion.F90 Co-authored-by: Jesse Nusbaumer --- src/physics/cam/vertical_diffusion.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 504fd80aef..4ceac357ff 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1031,7 +1031,7 @@ subroutine vertical_diffusion_tend( & q_wv_cflx(:) = 0._r8 !END REMOVECAM - if(eddy_scheme .eq. 'CLUBB_SGS') then + if(eddy_scheme == 'CLUBB_SGS') then ! If running CLUBB_SGS, use the hb_free_atm CCPPized interstitial. ! ! In this case, vertical diffusion solver only applies constituent fluxes excluding water vapor From 5046f53a43534ee36ef82200785e47f009d103c5 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Sun, 21 Sep 2025 14:32:52 -0400 Subject: [PATCH 409/466] Address review comments (2) --- src/physics/cam/molec_diff.F90 | 2 +- src/physics/cam/vertical_diffusion.F90 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/physics/cam/molec_diff.F90 b/src/physics/cam/molec_diff.F90 index 6fbac5a39d..49329db158 100644 --- a/src/physics/cam/molec_diff.F90 +++ b/src/physics/cam/molec_diff.F90 @@ -253,7 +253,7 @@ function vd_lu_qdecomp( & real(r8), intent(in) :: t(:,:) ! Air temperature [ K ] integer, intent(in) :: m ! cnst index - real(r8), intent(in) :: mbarv(:,:) ! composition dependent molar mass of dry air [ kg kmol-1] + real(r8), intent(in) :: mbarv(:,:) ! composition dependent molar mass of dry air [ kg mol-1 ] ! Decomposition covering levels without vertical diffusion. type(TriDiagDecomp), intent(in) :: no_molec_decomp diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index 4ceac357ff..bb5782344b 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -1002,8 +1002,6 @@ subroutine vertical_diffusion_tend( & call pbuf_get_field(pbuf, tautmsy_idx, tautmsy) ! Add turbulent mountain stress to total surface stress for PBL scheme. - ! tautotx(:ncol) = cam_in%wsx(:ncol) + tautmsx(:ncol) - ! tautoty(:ncol) = cam_in%wsy(:ncol) + tautmsy(:ncol) tautotx(:ncol) = tautotx(:ncol) + tautmsx(:ncol) tautoty(:ncol) = tautoty(:ncol) + tautmsy(:ncol) @@ -1410,6 +1408,8 @@ subroutine vertical_diffusion_tend( & if(.not. do_molec_diff) then ! Dry static energy top boundary is zero if no molecular diffusion + ! Note: this is an artifact to the way the vertical diffusion calculations are done; + ! it does not represent physical reality. dse_top(:ncol) = 0._r8 ksrf(:) = 0._r8 From 187ab9c6be966746e34a94852f77d5039d5b4b1a Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 22 Sep 2025 10:49:25 -0400 Subject: [PATCH 410/466] Fix build changes; do_beljaars logical move --- src/physics/cam/vertical_diffusion.F90 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/physics/cam/vertical_diffusion.F90 b/src/physics/cam/vertical_diffusion.F90 index bb5782344b..8b19982639 100644 --- a/src/physics/cam/vertical_diffusion.F90 +++ b/src/physics/cam/vertical_diffusion.F90 @@ -209,7 +209,7 @@ subroutine vd_register() ! Register physics buffer fields and constituents ! !------------------------------------------------ ! - use physics_buffer, only : pbuf_add_field, dtype_r8, dtype_i4 + use physics_buffer, only : pbuf_add_field, dtype_r8 use trb_mtn_stress_cam, only : trb_mtn_stress_register use beljaars_drag_cam, only : beljaars_drag_register use eddy_diff_cam, only : eddy_diff_register @@ -274,7 +274,7 @@ subroutine vertical_diffusion_init(pbuf2d) use molec_diff, only : init_molec_diff use diffusion_solver_cam, only : init_vdiff - use constituents, only : cnst_get_ind, cnst_get_type_byind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed + use constituents, only : cnst_get_ind, cnst_name, cnst_get_molec_byind, cnst_ndropmixed use spmd_utils, only : masterproc use ref_pres, only : pref_mid use physics_buffer, only : pbuf_set_field, pbuf_get_index, physics_buffer_desc @@ -290,8 +290,6 @@ subroutine vertical_diffusion_init(pbuf2d) integer :: nbot_eddy ! Bottom interface level to which eddy vertical diffusion is applied ( = pver ) integer :: k ! Vertical loop index - integer :: ierr - logical :: history_amwg ! output the variables used by the AMWG diag package logical :: history_eddy ! output the eddy variables logical :: history_budget ! Output tendencies and state variables for CAM4 T, qv, ql, qi @@ -656,13 +654,17 @@ subroutine vertical_diffusion_tend( & use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_set_field use physics_types, only : physics_state, physics_ptend, physics_ptend_init + ! flag for FV correction use phys_control, only: fv_am_correction + ! flag for Beljaars + use beljaars_drag_cam, only: do_beljaars use camsrfexch, only : cam_in_t use cam_history, only : outfld use eddy_diff_cam, only : eddy_diff_tend + ! CCPP-ized HB scheme use holtslag_boville_diff, only: hb_pbl_independent_coefficients_run use holtslag_boville_diff, only: hb_pbl_dependent_coefficients_run @@ -693,7 +695,6 @@ subroutine vertical_diffusion_tend( & ! Diagnostic utility subroutine shared with CCPP-ized/SIMA use vertical_diffusion_diagnostic_utils, only: vertical_diffusion_diagnostic_profiles - use wv_saturation, only : qsat use diffusion_solver, only: vertical_diffusion_set_dry_static_energy_at_toa_molecdiff_run use molec_diff, only : compute_molec_diff, vd_lu_qdecomp use constituents, only : qmincg, qmin, cnst_type @@ -809,10 +810,8 @@ subroutine vertical_diffusion_tend( & real(r8) :: kqfs(pcols) ! sfc kinematic water vapor flux [kg kg-1 m s-1] real(r8) :: kbfs(pcols) ! sfc kinematic buoyancy flux [m^2/s^3] - real(r8) :: ftem(pcols,pver) ! Saturation vapor pressure before PBL real(r8) :: ftem_prePBL(pcols,pver) ! Saturation vapor pressure before PBL real(r8) :: ftem_aftPBL(pcols,pver) ! Saturation vapor pressure after PBL - real(r8) :: tem2(pcols,pver) ! Saturation specific humidity and RH real(r8) :: t_aftPBL(pcols,pver) ! Temperature after PBL diffusion real(r8) :: tten(pcols,pver) ! Temperature tendency by PBL diffusion real(r8) :: rhten(pcols,pver) ! RH tendency by PBL diffusion From 78503022b8bd6599b53da3dd6a33b3e9477033ae Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 22 Sep 2025 10:01:33 -0600 Subject: [PATCH 411/466] address review comments --- src/physics/rrtmgp/radiation.F90 | 20 ++++++++++++-------- src/physics/rrtmgp/rrtmgp_inputs_cam.F90 | 1 - 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 1fd3145583..3fd02093b7 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -889,9 +889,9 @@ subroutine radiation_tend( & real(r8) :: cld_lw_abs(nlwbands,state%ncol,pver) ! Cloud absorption optics depth real(r8) :: snow_lw_abs(nlwbands,state%ncol,pver) ! Snow absorption optics depth real(r8) :: grau_lw_abs(nlwbands,state%ncol,pver) ! Graupel absorption optics depth - real(r8) :: cld_tau(nswbands,state%ncol,pver) ! Cloud absorption optics depth (sw) - real(r8) :: snow_tau(nswbands,state%ncol,pver) ! Snow absorption optics depth (sw) - real(r8) :: grau_tau(nswbands,state%ncol,pver) ! Graupel absorption optics depth (sw) + real(r8) :: cld_tau(nswbands,state%ncol,pver) ! Cloud absorption optical depth (sw) + real(r8) :: snow_tau(nswbands,state%ncol,pver) ! Snow absorption optical depth (sw) + real(r8) :: grau_tau(nswbands,state%ncol,pver) ! Graupel absorption optical depth (sw) real(r8) :: c_cld_tau(nswbands,state%ncol,pver) real(r8) :: c_cld_tau_w(nswbands,state%ncol,pver) real(r8) :: c_cld_tau_w_g(nswbands,state%ncol,pver) @@ -1146,13 +1146,14 @@ subroutine radiation_tend( & cldfsnow_in => zero_variable end if ! Grab additional pbuf fields for LW cloud optics - dei_idx = pbuf_get_index('DEI',errcode=err) - mu_idx = pbuf_get_index('MU',errcode=err) - lambda_idx = pbuf_get_index('LAMBDAC',errcode=err) + dei_idx = pbuf_get_index('DEI') + mu_idx = pbuf_get_index('MU') + lambda_idx = pbuf_get_index('LAMBDAC') + des_idx = pbuf_get_index('DES') + icswp_idx = pbuf_get_index('ICSWP') + ! Below fields are optional iciwp_idx = pbuf_get_index('ICIWP',errcode=err) iclwp_idx = pbuf_get_index('ICLWP',errcode=err) - des_idx = pbuf_get_index('DES',errcode=err) - icswp_idx = pbuf_get_index('ICSWP',errcode=err) icgrauwp_idx = pbuf_get_index('ICGRAUWP',errcode=err) ! Available when using MG3 degrau_idx = pbuf_get_index('DEGRAU',errcode=err) ! Available when using MG3 call pbuf_get_field(pbuf, lambda_idx, lambda) @@ -1220,6 +1221,9 @@ subroutine radiation_tend( & call rrtmgp_sw_mcica_subcol_gen_run(dosw, kdist_sw, nswbands, nswgpts, nday, nlay, & pver, tiny, idxday, ktopcam, ktoprad, cldfprime, c_cld_tau, & c_cld_tau_w, c_cld_tau_w_g, cloud_sw, pmid_day(:ncol,:), errmsg, errflg) + if (errflg /= 0) then + call endrun(sub//': '//errmsg) + end if if (write_output) then call radiation_output_cld(lchnk, rd) diff --git a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 index b3686428f5..c854c10245 100644 --- a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 +++ b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 @@ -10,7 +10,6 @@ module rrtmgp_inputs_cam use shr_kind_mod, only: r8=>shr_kind_r8 use ppgrid, only: pcols, pver, pverp -use cam_logfile, only: iulog use physconst, only: stebol, pi From d96d8745808e1b576a01e6842f5c465329e5d29d Mon Sep 17 00:00:00 2001 From: peverwhee Date: Mon, 22 Sep 2025 11:09:24 -0600 Subject: [PATCH 412/466] remote top_at_1 vestiges --- src/physics/rrtmgp/radiation.F90 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index efcbd65d3c..e9fc87fa33 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -950,9 +950,6 @@ subroutine radiation_tend( & real(r8) :: snow_lw_abs_cloudsim(pcols,pver)! snow real(r8) :: grau_lw_abs_cloudsim(pcols,pver)! graupel - ! Set vertical indexing in RRTMGP to be the same as CAM (top to bottom). - logical, parameter :: top_at_1 = .true. - logical :: do_graupel, do_snow ! TOA solar flux on RRTMGP g-points @@ -1289,7 +1286,7 @@ subroutine radiation_tend( & !$acc cloud_sw%optical_props%g) & !$acc copy(fswc%fluxes, fswc%fluxes%flux_net,fswc%fluxes%flux_up,fswc%fluxes%flux_dn, & !$acc fsw%fluxes, fsw%fluxes%flux_net,fsw%fluxes%flux_up,fsw%fluxes%flux_dn) - call rrtmgp_sw_rte_run(dosw, .true., .true., nday, 1, nday, atm_optics_sw, cloud_sw, top_at_1, & + call rrtmgp_sw_rte_run(dosw, .true., .true., nday, 1, nday, atm_optics_sw, cloud_sw, & aer_sw, coszrs_day, toa_flux, alb_dir, alb_dif, fswc, fsw, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) From 7ac810eba15eeece037c81ba7662530909be45b6 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 22 Sep 2025 14:05:48 -0400 Subject: [PATCH 413/466] Fix TMS reset initialization in CAM7 (set to zero even if not used) --- src/physics/cam7/physpkg.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/physics/cam7/physpkg.F90 b/src/physics/cam7/physpkg.F90 index f2827a318a..545fd44013 100644 --- a/src/physics/cam7/physpkg.F90 +++ b/src/physics/cam7/physpkg.F90 @@ -1384,6 +1384,7 @@ subroutine tphysac (ztodt, cam_in, & use cam_diagnostics, only: diag_phys_tend_writeout use gw_drag, only: gw_tend use beljaars_drag_cam, only: beljaars_drag_tend + use trb_mtn_stress_cam, only: trb_mtn_stress_tend ! only used as a stub to set to zero - TMS is not used in CAM7 use vertical_diffusion, only: vertical_diffusion_tend use rayleigh_friction, only: rayleigh_friction_run use physics_types, only: physics_dme_adjust, set_dry_to_wet, physics_state_check, & @@ -2169,6 +2170,10 @@ subroutine tphysac (ztodt, cam_in, & call beljaars_drag_tend(state, pbuf, cam_in) + ! TMS is not active in CAM7 (it is only for CAM5), but the tms tend subroutine + ! will initialize the pbuf fields to zero - no logic is computed below: + call trb_mtn_stress_tend(state, pbuf, cam_in) + if (trim(cam_take_snapshot_after) == "orographic_form_drag_stress") then call cam_snapshot_all_outfld_tphysac(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf,& fh2o, surfric, obklen, flx_heat, cmfmc, dlf, det_s, det_ice, net_flx) From d78f0b4071db16a116e534c47778f60fd0aba3fd Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 22 Sep 2025 21:14:41 -0600 Subject: [PATCH 414/466] Update ccs_config external --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7981e11f27..5b2907b102 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,7 +145,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.60 +fxtag = ccs_config_cesm1.0.61 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git From ef65b3f6ec35d4186178906e9997ff54edae12c7 Mon Sep 17 00:00:00 2001 From: Brian Eaton Date: Tue, 23 Sep 2025 11:38:46 -0400 Subject: [PATCH 415/466] fix check of COSP with interpolated output --- bld/build-namelist | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 7db9cebbf7..ae4b65c1f4 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -4444,12 +4444,14 @@ for my $i (0 .. $#interp_output) { # Currently, interpolated output does not work with the COSP fields that use # more than 1 mdims. -my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); -if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} -if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { - die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . - " to direct COSP output to a history file that is not interpolated. COSP output is\n" . - " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; +if ($docosp) { + my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); + if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} + if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { + die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . + " to direct COSP output to a history file that is not interpolated. COSP output is\n" . + " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; + } } From cd39a2d6cea20a8325e00dbd0c0501b6ba4bf39a Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 23 Sep 2025 10:42:39 -0600 Subject: [PATCH 416/466] ChangeLog for cam6_4_117 --- ccs_config | 2 +- doc/ChangeLog | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 155 insertions(+), 1 deletion(-) diff --git a/ccs_config b/ccs_config index ff41a3963e..b20a207bc9 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit ff41a3963e325db3348d56da492c4e18535d34fc +Subproject commit b20a207bc918b956b8dad44c14c4471aff9331ee diff --git a/doc/ChangeLog b/doc/ChangeLog index 8e989fc075..2240a8e7fa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,160 @@ =============================================================== +Tag name: cam6_4_117 +Originator(s): cacraig +Date: Sept 23, 2025 +One-line Summary: Match cesm3_0_alpha07d externals +Github PR URL: https://github.com/ESCOMP/CAM/pull/1384 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Update externals to match cesm3_0_alpha07d: https://github.com/ESOCMP/CAM/issues/1381 + - Update git-fleximod to v1.0.2: https://github.com/ESCOMP/CAM/issues/1362 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the bound N/Aary datasets: + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: haipeng + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .github/workflows/fleximod_test.yaml +M .lib/git_fleximod/cli.py +M .lib/git_fleximod/gitinterface.py +M .lib/git_fleximod/submodule.py +M .lib/pyproject.toml +M .lib/tbump.toml +M .lib/tests/test_c_required.py + - update git-fleximod + +M .gitmodules +M ccs_config +M cime +M components/cdeps +M components/cism +M components/clm +M components/cmeps +M components/mizuRoute +M components/mosart +M components/rtm +M libraries/parallelio +M tools/CUPiD + - update externals to match alpha07d + +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. + +NOTE -- Numerous namelist changes in lnd_in due to updated externals + +derecho/intel/aux_cam: + ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.f19_f19_mg17.QPMOZ.derecho_intel.cam-outfrq3s (Overall: DIFF) details: + ERC_D_Ln9.f19_f19_mt232.QPC6.derecho_intel.cam-outfrq3s_cosp (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.F2000climo.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.FHISTC_LTso.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.mpasa120_mpasa120.QPC7.derecho_intel.cam-outfrq9s_mpasa120 (Overall: DIFF) details: + ERC_D_Ln9.ne30pg2_ne30pg2_mt232.QPC7.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERC_Ln9.C96_C96_mt232.F2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERI_D_Ln18.f09_f09_mt232.FHIST.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERI_D_Ln18.f19_f19_mt232.FHIST_C5.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERP_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_D_Ln9_P64x2.f09_f09_mg17.QSC6.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: + ERP_Ld3.ne30pg3_ne30pg3_mt232.FHISTC_MTt4s.derecho_intel.cam-outfrq1d_aoa (Overall: DIFF) details: + ERP_Lh12.f19_f19_mg17.FW4madSD.derecho_intel.cam-outfrq3h (Overall: DIFF) details: + ERP_Ln9.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.f19_f19_mg17.FWsc1850.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FCnudged.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERP_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WAma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERR_Ln9.ne16pg3_ne16pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq9s_bwic (Overall: DIFF) details: + ERS_Ln9.f09_f09_mg17.FX2000.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERS_Ln9.f19_f19_mg17.FXSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERS_Ln9.ne30pg3_ne30pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s_ctem (Overall: DIFF) details: + SCT_D_Ln7.ne3_ne3_mg37.QPC5.derecho_intel.cam-scm_prep (Overall: DIFF) details: + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FCts2nudged.derecho_intel.cam-outfrq9s_leapday (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FCvbsxHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f09_f09_mg17.FSD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mg17.FWma2000climo.derecho_intel.cam-outfrq9s_waccm_ma_mam4 (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mg17.QPC2000climo.derecho_intel.cam-outfrq3s_usecase (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mt232.FHIST_C5.derecho_intel.cam-mam7 (Overall: DIFF) details: + SMS_D_Ln9.ne0ARCTICne30x4_ne0ARCTICne30x4_mt12.FHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.ne16_ne16_mg17.QPX2000.derecho_intel.cam-outfrq9s_amie (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9_P1280x1.ne30pg3_ne30pg3_mt232.FHISTC_MTt1s.derecho_intel.cam-outfrq9s_Leung_dust (Overall: DIFF) details: + SMS_Ld1.f09_f09_mg17.FCHIST_GC.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Ld1.f09_f09_mg17.FW2000climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Ld1.ne30pg3_ne30pg3_mg17.FC2010climo.derecho_intel.cam-outfrq1d (Overall: DIFF) details: + SMS_Lh12.f09_f09_mg17.FCSD_HCO.derecho_intel.cam-outfrq3h (Overall: DIFF) details: + SMS_Ln9.f09_f09_mg17.F2010climo.derecho_intel.cam-nudging (Overall: DIFF) details: + SMS_Ln9.f09_f09_mg17.FW1850.derecho_intel.cam-reduced_hist3s (Overall: DIFF) details: + SMS_Ln9.f19_f19_mt232.F2000climo.derecho_intel.cam-silhs (Overall: DIFF) details: + SMS_Ln9.ne30pg3_ne30pg3_mg17.FW2000climo.derecho_intel.cam-outfrq9s_rrtmgp (Overall: DIFF) details: + - baseline changes due to CISM + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - Baselines missing due to previously failing test. Test now works due to updating CTSM external + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + - pre-existing failure- See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: + ERC_D_Ln9.f10_f10_mg37.QPWmaC6.izumi_nag.cam-outfrq3s (Overall: DIFF) details: + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-outfrq3s_subcol (Overall: DIFF) details: + ERC_D_Ln9.f10_f10_mt232.FHIST.izumi_nag.cam-outfrq3s_cospsathist (Overall: DIFF) details: + ERC_D_Ln9.mpasa480_mpasa480_mt232.QPC7.izumi_nag.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-cosp_rad_diags (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_nag.cam-outfrq9s_nochem (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC4.izumi_nag.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln3.ne5pg3_ne5pg3_mg37.QPX2000.izumi_nag.cam-outfrq3s (Overall: DIFF) details: + SMS_D_Ln6.ne5_ne5_mg37.QPWmaC4.izumi_nag.cam-outfrq3s_physgrid_tem (Overall: DIFF) details: + SMS_D_Ln9.f10_f10_mt232.F1850.izumi_nag.cam-outfrq9s (Overall: DIFF) details: + TMC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_nag.cam-mc_ttrac (Overall: DIFF) details: + - baseline changes due to CISM + +izumi/gnu/aux_cam: + ERC_D_Ln9.C48_C48_mg17.QPC6.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.f10_f10_mg37.QPC4.izumi_gnu.cam-outfrq3s_diags (Overall: DIFF) details: + ERC_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-rad_diag (Overall: DIFF) details: + ERC_D_Ln9.f19_f19_mt232.FHIST.izumi_gnu.cam-lonlat_fv_diags (Overall: DIFF) details: + ERC_D_Ln9.mpasa480_mpasa480_mt232.FHISTC_LTso.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.F1850_C4.izumi_gnu.cam-co2rmp (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST_C5.izumi_gnu.cam-carma_cosp_rad_diag_mam (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHISTC_LTso.izumi_gnu.cam-sat_lcltod (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-nochem_clubbmf (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC5.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.ne3pg3_ne3pg3_mt232.QPC7.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + ERC_D_Ln9.ne5_ne5_mg37.QPC4.izumi_gnu.cam-outfrq3s_nudging_ne5_L26 (Overall: DIFF) details: + ERP_Ln9_P24x2.f45_f45_mg37.QPWmaC6.izumi_gnu.cam-outfrq9s_mee_fluxes (Overall: DIFF) details: + ERS_Ln9_P24x1.mpasa480_mpasa480.F2000climo.izumi_gnu.cam-outfrq9s_mpasa480 (Overall: DIFF) details: + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal0 (Overall: DIFF) details: + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal1 (Overall: DIFF) details: + PLB_D_Ln9.f10_f10_mt232.FHIST_C5.izumi_gnu.cam-ttrac_loadbal3 (Overall: DIFF) details: + SCT_D_Ln7.ne3_ne3_mg37.QPC6.izumi_gnu.cam-scm_prep_c6 (Overall: DIFF) details: + SMS_D_Ln3.f10_f10_mg37.QPMOZ.izumi_gnu.cam-outfrq3s_chemproc (Overall: DIFF) details: + SMS_D_Ln9.f10_f10_mg37.QPWmaC4.izumi_gnu.cam-outfrq9s_apmee (Overall: DIFF) details: + SMS_D_Ln9.f19_f19_mt232.FW4madSD.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + SUB_D_Ln9.ne3pg3_ne3pg3_mt232.FHIST.izumi_gnu.cam-outfrq9s (Overall: DIFF) details: + - baseline changes due to CISM + +=============================================================== +=============================================================== + Tag name: cam6_4_116 Originator(s): JulioTBacmeister, cacraigucar, peverwhee Date: Sept 19, 2025 From 57bd4f93e8a94e98a9bab95a5e2db18d68823980 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 23 Sep 2025 10:43:32 -0600 Subject: [PATCH 417/466] ChangeLog for cam6_4_117 --- doc/ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 2240a8e7fa..d4eb1f1aad 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -9,13 +9,13 @@ Github PR URL: https://github.com/ESCOMP/CAM/pull/1384 Purpose of changes (include the issue number and title text for each relevant GitHub issue): - Update externals to match cesm3_0_alpha07d: https://github.com/ESOCMP/CAM/issues/1381 - - Update git-fleximod to v1.0.2: https://github.com/ESCOMP/CAM/issues/1362 + - Update git-fleximod to v1.0.2: https://github.com/ESCOMP/CAM/issues/1362 Describe any changes made to build system: N/A Describe any changes made to the namelist: N/A -List any changes to the defaults for the bound N/Aary datasets: +List any changes to the defaults for the boundary datasets: N/A Describe any substantial timing or memory changes: N/A From f3101f2ae9c91dc51cfa78bf37e923156d5833be Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Wed, 24 Sep 2025 15:41:31 -0600 Subject: [PATCH 418/466] Update emission files to use relative path --- bld/namelist_files/use_cases/1850_cam_lt.xml | 78 ++++++++++---------- bld/namelist_files/use_cases/1850_cam_mt.xml | 78 ++++++++++---------- bld/namelist_files/use_cases/hist_cam_lt.xml | 78 ++++++++++---------- bld/namelist_files/use_cases/hist_cam_mt.xml | 78 ++++++++++---------- 4 files changed, 156 insertions(+), 156 deletions(-) diff --git a/bld/namelist_files/use_cases/1850_cam_lt.xml b/bld/namelist_files/use_cases/1850_cam_lt.xml index 14b2801215..410c31e500 100644 --- a/bld/namelist_files/use_cases/1850_cam_lt.xml +++ b/bld/namelist_files/use_cases/1850_cam_lt.xml @@ -45,51 +45,51 @@ CYCLICAL 1850 -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' CYCLICAL 1850 -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' CYCLICAL diff --git a/bld/namelist_files/use_cases/1850_cam_mt.xml b/bld/namelist_files/use_cases/1850_cam_mt.xml index 4202d8650f..1bd9eeb6b9 100644 --- a/bld/namelist_files/use_cases/1850_cam_mt.xml +++ b/bld/namelist_files/use_cases/1850_cam_mt.xml @@ -40,51 +40,51 @@ CYCLICAL 1850 -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' CYCLICAL 1850 -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' diff --git a/bld/namelist_files/use_cases/hist_cam_lt.xml b/bld/namelist_files/use_cases/hist_cam_lt.xml index 0f2227f216..1e5b3775c9 100644 --- a/bld/namelist_files/use_cases/hist_cam_lt.xml +++ b/bld/namelist_files/use_cases/hist_cam_lt.xml @@ -38,50 +38,50 @@ INTERP_MISSING_MONTHS -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' INTERP_MISSING_MONTHS -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' diff --git a/bld/namelist_files/use_cases/hist_cam_mt.xml b/bld/namelist_files/use_cases/hist_cam_mt.xml index f63df161f9..81bec8c43b 100644 --- a/bld/namelist_files/use_cases/hist_cam_mt.xml +++ b/bld/namelist_files/use_cases/hist_cam_mt.xml @@ -33,51 +33,51 @@ INTERP_MISSING_MONTHS -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'num_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a1 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'so4_a2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', -'SO2 -> /glade/campaign/cesm/cesmdata/inputdata/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-AIR-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ene_vertical-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a1_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'num_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_num_a2_so4_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a1 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a1_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'so4_a2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_so4_a2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/emissions-cmip6_SO2_contvolcano_vertical_850-5000_ne30pg3_c20200125.nc' INTERP_MISSING_MONTHS -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'bc_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'pom_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a4 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'num_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a2-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'so4_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'num_a1-> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SO2 -> /glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 0.5954D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 2.5592D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.5371D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 16.650D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 8.2367D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', -'SOAE -> 6.5013D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/CEDS-CMIP-2025-04-18/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', -'SOAE -> 5.1004D0*/glade/campaign/acom/MUSICA/emis/cmip7/ne30/DRES-CMIP-BB4CMIP7-2-0_smoothed/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'bc_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'pom_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_bc_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a4 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_pom_a4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ag-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a1_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'num_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a1_ag_ship_slv-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a2-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/so4_a2_res_trs-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'so4_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'num_a1-> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/num_SO4_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SO2 -> $INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SO2_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 0.5954D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/ISOP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 2.5592D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/BENZENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.5371D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/IVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 16.650D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/SVOC-em-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18_gn_175001-202312.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 8.2367D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/TOLUENE-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc', +'SOAE -> 6.5013D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/XYLENES-VOC-anthro_input4MIPs_emissions_CMIP_CEDS-CMIP-2025-04-18-supplemental_gn_175001-202312.nc', +'SOAE -> 5.1004D0*$INPUTDATA_ROOT/atm/cam/chem/emis/historical_ne30pg3/MTERP_smoothed_input4MIPs_emissions_CMIP_DRES-CMIP-BB4CMIP7-2-0_gn_175001-202112.nc' SERIAL From e83f351143257f1da3c42f27809438351c782be3 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 24 Sep 2025 19:20:07 -0600 Subject: [PATCH 419/466] update atmos phys tag and submodule --- .gitmodules | 4 ++-- src/atmos_phys | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 723a854dc2..355a945898 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/peverwhee/atmospheric_physics - fxtag = f64aaff810062d31d2033b6a4fc5d75081f51d97 + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_17_003 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index f64aaff810..f148be4882 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit f64aaff810062d31d2033b6a4fc5d75081f51d97 +Subproject commit f148be4882f660ddb454bca4af65bf2dcd97e200 From 2c8350626313cde162d2fe83cc3604f60f5729a7 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 24 Sep 2025 19:44:41 -0600 Subject: [PATCH 420/466] remove unused imports --- src/physics/rrtmgp/rrtmgp_inputs_cam.F90 | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 index c854c10245..af1b6fca3e 100644 --- a/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 +++ b/src/physics/rrtmgp/rrtmgp_inputs_cam.F90 @@ -38,8 +38,6 @@ module rrtmgp_inputs_cam use cam_abortutils, only: endrun use error_messages, only: alloc_err use radiation_utils, only: get_sw_spectral_boundaries_ccpp -use spmd_utils, only: masterproc -use spmd_utils, only: iam implicit none private From d54a9b19012350a76005c76383c1a9fc5293efbe Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 24 Sep 2025 19:45:34 -0600 Subject: [PATCH 421/466] align use statement --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index e9fc87fa33..4ac376f63a 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -819,7 +819,7 @@ subroutine radiation_tend( & use rrtmgp_lw_mcica_subcol_gen, only: rrtmgp_lw_mcica_subcol_gen_run use rrtmgp_lw_gas_optics_pre, only: rrtmgp_lw_gas_optics_pre_run use rrtmgp_lw_gas_optics, only: rrtmgp_lw_gas_optics_run - use rrtmgp_lw_rte, only: rrtmgp_lw_rte_run + use rrtmgp_lw_rte, only: rrtmgp_lw_rte_run use rrtmgp_dry_static_energy_tendency, only: rrtmgp_dry_static_energy_tendency_run use rrtmgp_post, only: rrtmgp_post_run use rrtmgp_sw_solar_var, only: rrtmgp_sw_solar_var_run From 0f1964e6e7cfe85df9fe2f958fd3064f25e51c68 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 24 Sep 2025 20:46:30 -0600 Subject: [PATCH 422/466] remove erroneous subsetting --- src/physics/rrtmgp/radiation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 4ac376f63a..62131a62ff 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1222,7 +1222,7 @@ subroutine radiation_tend( & call rrtmgp_sw_mcica_subcol_gen_run(dosw, kdist_sw, nswbands, nswgpts, nday, nlay, & pver, tiny, idxday, ktopcam, ktoprad, cldfprime, c_cld_tau, & - c_cld_tau_w, c_cld_tau_w_g, cloud_sw, pmid_day(:ncol,:), errmsg, errflg) + c_cld_tau_w, c_cld_tau_w_g, cloud_sw, pmid_day, errmsg, errflg) if (errflg /= 0) then call endrun(sub//': '//errmsg) end if From 1f4c8c4c17358fb18066444f58f4f8e9f7ddcf43 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 25 Sep 2025 18:58:55 -0600 Subject: [PATCH 423/466] ChangeLog for cam6_4_118 --- doc/ChangeLog | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index d4eb1f1aad..1c8976071e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,60 @@ =============================================================== +Tag name: cam6_4_118 +Originator(s): cacraig, peverwhee, jimmielin +Date: Sept 25, 2025 +One-line Summary: Update emission files to use relative path +Github PR URL: https://github.com/ESCOMP/CAM/pull/1401 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - use cases updated with emissions have incorrect path: https://github.com/ESCOMP/CAM/issues/1399 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: haipeng + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M bld/namelist_files/use_cases/1850_cam_lt.xml +M bld/namelist_files/use_cases/1850_cam_mt.xml +M bld/namelist_files/use_cases/hist_cam_lt.xml +M bld/namelist_files/use_cases/hist_cam_mt.xml + - Use relative path for emission 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. + +derecho/intel/aux_cam: all BFB + ERC_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_LTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + ERI_D_Ln18.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERP_D_Ln9.ne30pg3_ne30pg3_mt232.F1850C_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + SMS_D_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_MTso.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - Answer changes due to different sorting of emission files because changed directory paths sort differently + See PR for more details + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + - pre-existing failure- See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +=============================================================== +=============================================================== + Tag name: cam6_4_117 Originator(s): cacraig Date: Sept 23, 2025 From d92e3e44d2e1912ff3e9a1c837a1f63d053fb0f0 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Thu, 25 Sep 2025 22:50:52 -0600 Subject: [PATCH 424/466] final changelog --- doc/ChangeLog | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1c8976071e..4677582671 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,64 @@ +=============================================================== + +Tag name: cam6_4_119 +Originator: peverwhee +Date: 26 September, 2025 +One-line Summary: Bring in new atmospheric_physics tag and use CCPPized shortwave interfaces +Github PR URL: https://github.com/ESCOMP/CAM/pull/1372 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): +Part of "Conversion of RRTMGP to CCPP" (#1192) +- Modifies the interfaces in radiation.F90 +- Moves rrtmgp external to atmospheric_physics (schemes/rrtmgp/ext) + +Describe any changes made to build system: + +M bld/configure +- update paths to RRTMGP external + +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 + +List all files eliminated: + +D src/physics/rrtmgp/ext +- move submodule to atmospheric_physics + +D src/physics/rrtmgp/rad_solar_var.F90 +- ccppized and moved to schemes/rrtmgp/rrtmgp_sw_solar_var.F90 + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: + +M src/atmos_phys +- updated submodule + +M src/physics/rrtmgp/radiation.F90 +- update interface to use CCPPized schemes + +M src/physics/rrtmgp/rrtmgp_inputs_cam.F90 +- ccppize and move sw gas optics and cloud optics + +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: all BFB + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default + - pre-existing failure- See issue: https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB =============================================================== From 6c95635c18cf41c098b7204ada3e1adb2f6f7abe Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 26 Sep 2025 13:47:45 -0400 Subject: [PATCH 425/466] Draft Changelog. --- doc/ChangeLog | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 4677582671..707220c455 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,94 @@ =============================================================== +Tag name: cam6_4_120 +Originator(s): jimmielin +Date: September 26, 2025 +One-line Summary: Complete CCPPization of HB PBL scheme and vertical diffusion solver (non-WACCM) +Github PR URL: https://github.com/ESCOMP/CAM/pull/1361 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): +- Completes #1300 by CCPPizing compute_hb_diff, compute_hb_free_atm_diff, pblintd, trbintd +- Cleanup, refactoring, and optimization of HB +- Partially completes #1205; and completes #1314 by CCPPizing partial interstitial logic of vertical_diffusion_tend +- Partially completes #1205; and completes #1314 by CCPPizing compute_vdiff in diffusion_solver.F90 +- Correctly update 'AST' field in physics buffer in RK stratiform CAM interface for snapshot consistency (bit-for-bit). +- Adds snapshot points for orographic form drag stress (Beljaars in CAM6+ and TMS in CAM5) for future CCPPization work. + +Describe any changes made to build system: +- add holtslag_boville CCPP scheme +- add vertical_diffusion CCPP scheme + +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 + +List all files eliminated: +``` +D src/physics/cam/hb_diff.F90 + - moved to atmos_phys as CCPPized holstlag_boville scheme +D src/physics/cam/vdiff_lu_solver.F90 + - moved to atmos_phys into to_be_ccppized (unchanged) +``` + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +R053 src/physics/cam/diffusion_solver.F90 src/physics/cam/diffusion_solver_cam.F90 + - this is the "remnant" diffusion solver supporting WACCM with molecular diffusion. + - partial refactor to avoid excessive code divergence with CCPPized diffusion_solver. + - renamed to avoid name conflict with CCPPized diffusion_solver. + +M bld/configure + - add holtslag_boville and diffusion_solver folders in atmos_phys/schemes to build. + +M src/physics/cam/vertical_diffusion.F90 + - use CCPPized subroutines for HB and vertical diffusion solver. + +M src/physics/cam/eddy_diff_cam.F90 + - use CCPPized vertical diffusion solver. + +M src/physics/cam/molec_diff.F90 + - dechunkize and use assumed dimensions for vd_lu_qdecomp. + +M src/physics/cam/clubb_intr.F90 + - use CCPPized HB boundary layer computation. + +M src/physics/cam/ref_pres.F90 +M src/utils/air_composition.F90 + - comment updates for clarification of units/purpose. + +M src/physics/cam/rk_stratiform_cam.F90 + - Correctly update AST pbuf field in RK stratiform CAM interface for snapshot consistency (bit-for-bit). + +M src/physics/cam7/physpkg.F90 +M src/physics/cam/physpkg.F90 +M bld/build-namelist +M bld/namelist_files/namelist_definition.xml + - move Beljaars, TMS drag call routines to physpkg level for snapshotting. + - add orographic_form_drag_stress snapshot point. + +M src/control/cam_snapshot_common.F90 + - expand size of cam_in snapshot output maximum because it needs to fit all constituents. + +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: + +derecho/nvhpc/aux_cam: + +izumi/nag/aux_cam: + +izumi/gnu/aux_cam: + +=============================================================== + Tag name: cam6_4_119 Originator: peverwhee Date: 26 September, 2025 From ce69331e5a89d7c42c63a7a74f5d394d96b5843f Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 26 Sep 2025 14:21:47 -0400 Subject: [PATCH 426/466] Update to atmos_phys atmos_phys0_18_000 --- .gitmodules | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index c81e05237b..4e90186fa8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_17_003 + fxtag = atmos_phys0_18_000 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index f148be4882..9ecb80f12c 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit f148be4882f660ddb454bca4af65bf2dcd97e200 +Subproject commit 9ecb80f12c799fdf35bd593a77a7764ae3882560 From a4265d671179f23727d82cbc86e9fc47a028140c Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Fri, 26 Sep 2025 18:14:55 -0400 Subject: [PATCH 427/466] Finalize ChangeLog for cam6_4_120 - complete CCPPization of HB and diffusion solver --- doc/ChangeLog | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 707220c455..06e7425ada 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -79,13 +79,20 @@ 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: +derecho/intel/aux_cam: ALL PASS + + SMS_D_Ln9_P1280x1.ne0CONUSne30x8_ne0CONUSne30x8_mt12.FCHIST.derecho_intel.cam-outfrq9s (Overall: PASS) details: + - This test continues to fail most of the time on lnd_set_decomp_and_domain.F90 line 497 + despite the updated externals. + It can be re-run to eventually work (as it was done here). derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: FAIL) details: + - pre-existing failure - See issue: https://github.com/ESCOMP/CAM/issues/1383 -izumi/nag/aux_cam: +izumi/nag/aux_cam: ALL PASS -izumi/gnu/aux_cam: +izumi/gnu/aux_cam: ALL PASS =============================================================== From 31bd3e80c47c6e659560ed36252209bece849613 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 29 Sep 2025 16:08:18 -0600 Subject: [PATCH 428/466] Add missing _r8 --- src/chemistry/utils/horizontal_interpolate.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/chemistry/utils/horizontal_interpolate.F90 b/src/chemistry/utils/horizontal_interpolate.F90 index f8f04a4052..bc7db696f7 100644 --- a/src/chemistry/utils/horizontal_interpolate.F90 +++ b/src/chemistry/utils/horizontal_interpolate.F90 @@ -1,6 +1,6 @@ module horizontal_interpolate -! +! ! Modules Used: ! use shr_kind_mod, only: r8 => shr_kind_r8 @@ -124,10 +124,10 @@ real(r8) function lon_weight(input_left, input_right, sim_left, sim_right, use_f ! encounter roundoff errors, and could cause while loops to go ! forever. Values much outside the [-360, 360] range are probably ! an error anyway, so abort if we encounter anything suspicious here. - call check_invariant(((-2000.0 < input_left).and.(input_left < 2000.0)), "input_left is out of range") - call check_invariant(((-2000.0 < input_right).and.(input_right < 2000.0)), "input_right is out of range") - call check_invariant(((-2000.0 < sim_left).and.(sim_left < 2000.0)), "sim_left is out of range") - call check_invariant(((-2000.0 < sim_right).and.(sim_right < 2000.0)), "sim_right is out of range") + call check_invariant(((-2000.0_r8 < input_left).and.(input_left < 2000.0_r8)), "input_left is out of range") + call check_invariant(((-2000.0_r8 < input_right).and.(input_right < 2000.0_r8)), "input_right is out of range") + call check_invariant(((-2000.0_r8 < sim_left).and.(sim_left < 2000.0_r8)), "sim_left is out of range") + call check_invariant(((-2000.0_r8 < sim_right).and.(sim_right < 2000.0_r8)), "sim_right is out of range") overlap_len = calculate_lon_overlap(input_left, input_right, sim_left, sim_right) @@ -358,7 +358,7 @@ subroutine xy_interp(im1,jm1,km1,im2,jm2,pcols,ncols,weight_x,weight_y,var_src,v real(r8) :: sum_x var_trg(:,:) = 0.0_r8 - + do k1=1,km1 do n=1,ncols From 08504f890eee850145452f0d0323c26edb00c3b2 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Tue, 30 Sep 2025 11:47:01 -0600 Subject: [PATCH 429/466] fix issues raised by code reviewer modified: cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam modified: src/chemistry/utils/prescribed_strataero.F90 --- .../cam/outfrq9s_cam7_presc_volc/user_nl_cam | 20 +++++++++---------- src/chemistry/utils/prescribed_strataero.F90 | 16 +++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam index 72d52455dd..fe148286bd 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam @@ -1,6 +1,6 @@ -mfilt=1,1,1,1,1,1 -ndens=1,1,1,1,1,1 -nhtfrq=9,9,9,9,9,9 +mfilt=1,1,1,1,1,1,1,1,1,1 +ndens=1,1,1,1,1,1,1,1,1,1 +nhtfrq=9,9,9,9,9,9,9,9,9,9 write_nstep0=.true. inithist='ENDOFRUN' @@ -12,13 +12,13 @@ inithist='ENDOFRUN' rad_climate = 'A:Q:H2O', 'N:O2:O2', 'A:CO2:CO2', 'N:ozone:O3', 'A:N2O:N2O', 'A:CH4:CH4', 'N:CFC11STAR:CFC11', 'A:CFC12:CFC12', 'M:mam4_mode1:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode1_rrtmg_aeronetdust_sig1.6_dgnh.48_c140304.nc', - 'M:mam4_mode2:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', - 'M:mam4_mode3:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', - 'M:mam4_mode4:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', - 'N:VOLC_MMR1:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode1_c210211.nc', - 'N:VOLC_MMR2:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode2_c210211.nc', - 'N:VOLC_MMR3:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc', - 'N:VOLC_MMR5:/glade/campaign/cesm/cesmdata/inputdata/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc' + 'M:mam4_mode2:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode2_rrtmg_aitkendust_c141106.nc', + 'M:mam4_mode3:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode3_rrtmg_aeronetdust_c141106.nc', + 'M:mam4_mode4:$DIN_LOC_ROOT/atm/cam/physprops/mam4_mode4_rrtmg_c130628.nc', + 'N:VOLC_MMR1:$DIN_LOC_ROOT/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode1_c210211.nc', + 'N:VOLC_MMR2:$DIN_LOC_ROOT/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.6_mode2_c210211.nc', + 'N:VOLC_MMR3:$DIN_LOC_ROOT/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc', + 'N:VOLC_MMR5:$DIN_LOC_ROOT/atm/cam/physprops/volc_camRRTMG_byradius_sigma1.2_mode3_c210211.nc' fincl2 = 'VOLC_MMR1','VOLC_MMR2','VOLC_MMR3','VOLC_MMR5','VOLC_RAD_GEOM1','VOLC_RAD_GEOM2','VOLC_RAD_GEOM3','VOLC_RAD_GEOM5', 'VOLC_SAD' \ No newline at end of file diff --git a/src/chemistry/utils/prescribed_strataero.F90 b/src/chemistry/utils/prescribed_strataero.F90 index ed925c2475..35215d9083 100644 --- a/src/chemistry/utils/prescribed_strataero.F90 +++ b/src/chemistry/utils/prescribed_strataero.F90 @@ -202,22 +202,22 @@ subroutine prescribed_strataero_register() call pio_seterrorhandling(file_handle, PIO_BCAST_ERROR) ierr = pio_inq_varid( file_handle, 'so4mass_a1', varid ) - three_mode = (ierr.eq.PIO_NOERR) + three_mode = (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a2', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = three_mode .and. (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a3', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = three_mode .and. (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a1', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = three_mode .and. (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a2', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = three_mode .and. (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a3', varid ) - three_mode = three_mode .and. (ierr.eq.PIO_NOERR) + three_mode = three_mode .and. (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'so4mass_a5', varid ) - five_mode = (ierr.eq.PIO_NOERR) + five_mode = (ierr==PIO_NOERR) ierr = pio_inq_varid( file_handle, 'diamwet_a5', varid ) - five_mode = five_mode .and. (ierr.eq.PIO_NOERR) + five_mode = five_mode .and. (ierr==PIO_NOERR) three_mode = three_mode .and. (.not.five_mode) From ad2872f6f2b6df595efe41f62af603d4a3981374 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 30 Sep 2025 16:13:38 -0600 Subject: [PATCH 430/466] ChangeLog for cam6_4_121 --- doc/ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 06e7425ada..05350cec7f 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,50 @@ + +=============================================================== + +Tag name: cam6_4_121 +Originator(s): jvrb (Rob von Behren), andrewgettelman, chihchen24, cacraigucar +Date: Sept 30, 2025 +One-line Summary: Fixes for input interpolation routines (aircraft runs only) +Github PR URL: https://github.com/ESCOMP/CAM/pull/1349 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - Fix number of erros in the input interpolation routine that are used in aircraft simulations, specifically contrails + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: cacraig, andrewgettelman, chihchen24 + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M src/chemistry/utils/horizontal_interpolate.F90 +M src/chemistry/utils/tracer_data.F90 + - Interpolation fixes and rewrite + +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: all BFB except: + ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - Answer changes expected for aircraft simulations + +derecho/nvhpc/aux_cam: all BFB + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +=============================================================== =============================================================== Tag name: cam6_4_120 From bcff0d7ac31b5ca3dd250692a70b2f763f985f96 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 30 Sep 2025 16:18:18 -0600 Subject: [PATCH 431/466] Update ChangeLog for cam6_4_121 --- doc/ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 05350cec7f..17a76019ab 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -38,7 +38,9 @@ derecho/intel/aux_cam: all BFB except: ERC_D_Ln9.f09_f09_mt232.FHIST_BDRD.derecho_intel.cam-outfrq9s (Overall: DIFF) details: - Answer changes expected for aircraft simulations -derecho/nvhpc/aux_cam: all BFB +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: FAIL) details: + - pre-existing failure - See issue: https://github.com/ESCOMP/CAM/issues/1383 izumi/nag/aux_cam: all BFB From bbf6ca2a6299e1e95906ab53388a495f1c4dc9fc Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 1 Oct 2025 15:45:38 -0600 Subject: [PATCH 432/466] time_manager fix, cost nl bug fix, add mf namelist --- bld/build-namelist | 21 ++++--- bld/namelist_files/namelist_defaults_cam.xml | 1 + bld/namelist_files/namelist_definition.xml | 5 ++ src/physics/cam/clubb_intr.F90 | 6 +- src/physics/cam/clubb_mf.F90 | 8 ++- src/utils/time_manager.F90 | 65 ++++++++++++++++++++ 6 files changed, 91 insertions(+), 15 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index fdafe7b927..8e53241fbf 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -4467,16 +4467,17 @@ for my $i (0 .. $#interp_output) { } } -# Currently, interpolated output does not work with the COSP fields that use -# more than 1 mdims. -my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); -if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} -if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { - die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . - " to direct COSP output to a history file that is not interpolated. COSP output is\n" . - " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; -} - +#+++arh -- below is a bug, comment out for now +## Currently, interpolated output does not work with the COSP fields that use +## more than 1 mdims. +#my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); +#if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} +#if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { +# die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . +# " to direct COSP output to a history file that is not interpolated. COSP output is\n" . +# " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; +#} +#---arh my $offline_drv = $cfg->get('offline_drv'); if ($offline_drv ne 'stub') { diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 2fd8829bf9..2a6dc6b3fe 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2307,6 +2307,7 @@ 1.0 1.0 3.0 + 1.0 .false. .false. 1 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 283e27394b..eab573d381 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4483,6 +4483,11 @@ Default: 1.0 Elevation power law exponent for downdrafts velocities in the subcloud layer Default: 3.0 + +Factor to increase the ensemble MF plume cloud fractions +Default: 1.0 + If .true. use ustar for initializing the plume ensemble diff --git a/src/physics/cam/clubb_intr.F90 b/src/physics/cam/clubb_intr.F90 index 335e0c99f3..5013abd604 100644 --- a/src/physics/cam/clubb_intr.F90 +++ b/src/physics/cam/clubb_intr.F90 @@ -38,7 +38,8 @@ module clubb_intr use clubb_api_module, only: nparams use clubb_mf, only: do_clubb_mf, do_clubb_mf_diag, clubb_mf_nup, do_clubb_mf_rad, clubb_mf_Lopt, & - clubb_mf_ddalph, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_cmt, do_clubb_mf_addtke + clubb_mf_ddalph, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_cmt, do_clubb_mf_addtke, & + clubb_mf_cldfrac_fac use cam_history_support, only: add_hist_coord use cloud_fraction, only: dp1, dp2 #endif @@ -5939,8 +5940,7 @@ subroutine clubb_tend_cam( state, ptend_all, pbuf, hdtime, & endif if (do_clubb_mf_rad) then - ! multiply mf cloud fraction by 10 - shalcu(i,k) = 10._r8*mf_cloudfrac_output(i,k) + shalcu(i,k) = clubb_mf_cldfrac_fac*mf_cloudfrac_output(i,k) sh_icwmr(i,k) = mf_qc_output(i,k) end if diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index e688cdebd6..8aba214b96 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -29,7 +29,8 @@ module clubb_mf clubb_mf_up_ndt, & clubb_mf_cp_ndt, & do_clubb_mf_cmt, & - do_clubb_mf_addtke + do_clubb_mf_addtke, & + clubb_mf_cldfrac_fac ! ! Lopt 0 = fixed L0 @@ -53,6 +54,7 @@ module clubb_mf real(r8) :: clubb_mf_ddbeta = 0._r8 real(r8) :: clubb_mf_pwfac = 0._r8 real(r8) :: clubb_mf_ddexp = 0._r8 + real(r8) :: clubb_mf_cldfrac_fac = 1._r8 integer :: clubb_mf_up_ndt = 1 integer :: clubb_mf_cp_ndt = 1 integer :: clubb_mf_kseed = 1 @@ -97,7 +99,7 @@ subroutine clubb_mf_readnl(nlfile) clubb_mf_fdd, do_clubb_mf_coldpool, clubb_mf_ddalph, clubb_mf_ddbeta, clubb_mf_pwfac, do_clubb_mf_ustar, & clubb_mf_ddexp, do_clubb_mf_mixd, clubb_mf_up_ndt, clubb_mf_cp_ndt, do_clubb_mf_rhtke, do_clubb_mf_cmt, & do_clubb_mf_coldpool_init, do_clubb_mf_coldpool_perplume, do_clubb_mf_lscale_perplume, clubb_mf_kseed, & - do_clubb_mf_addtke, do_clubb_mf_aloft + do_clubb_mf_addtke, do_clubb_mf_aloft, clubb_mf_cldfrac_fac if (masterproc) then open( newunit=iunit, file=trim(nlfile), status='old' ) @@ -171,6 +173,8 @@ subroutine clubb_mf_readnl(nlfile) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_addtke") call mpi_bcast(do_clubb_mf_aloft, 1, mpi_logical, mstrid, mpicom, ierr) if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: do_clubb_mf_aloft") + call mpi_bcast(clubb_mf_cldfrac_fac, 1, mpi_real8, mstrid, mpicom, ierr) + if (ierr /= 0) call endrun(sub//": FATAL: mpi_bcast: clubb_mf_cldfrac_fac") if ((.not. do_clubb_mf) .and. do_clubb_mf_diag ) then call endrun('clubb_mf_readnl: Error - cannot turn on do_clubb_mf_diag without also turning on do_clubb_mf') diff --git a/src/utils/time_manager.F90 b/src/utils/time_manager.F90 index d79689260e..43c27fcf61 100644 --- a/src/utils/time_manager.F90 +++ b/src/utils/time_manager.F90 @@ -26,6 +26,10 @@ module time_manager get_curr_date, &! return date components at end of current timestep get_prev_date, &! return date components at beginning of current timestep get_start_date, &! return components of the start date +!+++arh + get_stop_date, &! return components of the stop date + get_run_duration, &! return run duration in whole days and remaining seconds + get_ref_date, &! return components of the reference date get_perp_date, &! return components of the perpetual date, and current time of day get_curr_time, &! return components of elapsed time since reference date at end of current timestep @@ -690,6 +694,67 @@ subroutine get_start_date(yr, mon, day, tod) end subroutine get_start_date !========================================================================================= +!+++arh manually add get_stop_date & get_run_duration (mpas build failure) + +!========================================================================================= + +subroutine get_stop_date(yr, mon, day, tod) + + ! Return date components valid at end of run + + ! Arguments + integer, intent(out) ::& + yr, &! year + mon, &! month + day, &! day of month + tod ! time of day (seconds past 0Z) + + ! Local variables + character(len=*), parameter :: sub = 'get_stop_date' + integer :: rc + type(ESMF_Time) :: date + !---------------------------------------------------------------------------- + + call ESMF_ClockGet(tm_clock, stopTime=date, rc=rc) + call chkrc(rc, sub//': error return from ESMF_ClockGet') + + call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) + call chkrc(rc, sub//': error return from ESMF_TimeGet') + +end subroutine get_stop_date + +!========================================================================================= + +subroutine get_run_duration(nday, nsec) + + ! Return run duration in days and seconds + + ! Arguments + integer, intent(out) ::& + nday, &! number of days in interval + nsec ! remainder in seconds + + ! Local variables + character(len=*), parameter :: sub = 'get_run_duration' + integer :: rc + type(ESMF_Time) :: start_time, stop_time + type(ESMF_TimeInterval) :: diff + !---------------------------------------------------------------------------- + + call ESMF_ClockGet(tm_clock, startTime=start_time, stopTime=stop_time, rc=rc) + call chkrc(rc, sub//': error return from ESMF_ClockGet') + + diff = stop_time - start_time + + call ESMF_TimeIntervalGet(diff, d=nday, s=nsec, rc=rc) + call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') + +end subroutine get_run_duration + +!========================================================================================= + +!---arh + subroutine get_ref_date(yr, mon, day, tod) ! Return date components of the reference date. From d0308c899b1e5f01da0cb0202332fa2f483da999 Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 2 Oct 2025 06:03:16 -0600 Subject: [PATCH 433/466] update ChangeLog --- doc/ChangeLog | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/doc/ChangeLog b/doc/ChangeLog index 17a76019ab..b27e88d95e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,70 @@ +=============================================================== + +Tag name: cam6_4_122 +Originator(s): fvitt +Date: 2 Oct 2025 +One-line Summary: Enable prescribed MAM5 volcanic forcings; chemistry preprocessor fix +Github PR URLs: + https://github.com/ESCOMP/CAM/pull/1375 + https://github.com/ESCOMP/CAM/pull/1391 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + + Enable the use of prescribed MAM5 stratospheric volcanic aerosol forcings. + (Updates needed for prescribed MAM5 stratospheric aerosols #1187) + + Fix an issue with the chemistry preprocessor on derecho. + (Chemistry preprocessor broken on derecho #1389) + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: N/A + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: cacraigucar + +List all files eliminated: N/A + +List all files added and what they do: + +A cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/shell_commands +A cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_cam +A cime_config/testdefs/testmods_dirs/cam/outfrq9s_cam7_presc_volc/user_nl_clm + - add regression test for precscribed MAM5 stratospheric aerosols +List all existing files that have been modified, and describe the changes: + +M .gitmodules +M chem_proc + - update preprocessor to tag cam_proc5_0_07 + +M cime_config/testdefs/testlist_cam.xml + - regression test for precscribed MAM5 stratospheric aerosols + +M src/chemistry/utils/prescribed_strataero.F90 + - add ability to include precscribed MAM5 stratospheric aerosols + +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: All PASS + +derecho/nvhpc/aux_cam: + FAIL ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default RUN time=441 + - pre-existing failure -- might be related to https://github.com/ESCOMP/CAM/issues/1383 + +izumi/nag/aux_cam: All PASS + +izumi/gnu/aux_cam: All PASS + +Summarize any changes to answers: bit-for-bit unchanged + +=============================================================== =============================================================== Tag name: cam6_4_121 From 223f2a591ef52124a7d95eda53b9b38469b173b7 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 2 Oct 2025 14:20:57 -0600 Subject: [PATCH 434/466] Update topo files --- bld/namelist_files/namelist_defaults_cam.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 0faba96560..0d2df0026b 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -300,20 +300,20 @@ atm/cam/topo/se/ne5np4_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170515.nc atm/cam/topo/se/ne16np4_nc3000_Co120_Fi001_PF_nullRR_Nsw084_20171012.nc -atm/cam/topo/se/ne30np4_nc3000_Co060_Fi001_PF_nullRR_Nsw042_20171020.nc +atm/cam/topo/se/ne30np4_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250822.nc atm/cam/topo/se/ne60np4_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc atm/cam/topo/se/ne120np4_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171011.nc atm/cam/topo/se/ne240np4_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171014.nc atm/cam/topo/se/ne5pg2_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw060_20170706.nc -atm/cam/topo/se/ne30pg2_nc3000_Co060_Fi001_PF_nullRR_Nsw042_20171014.nc +atm/cam/topo/se/ne30pg2_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250825.nc atm/cam/topo/se/ne60pg2_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171014.nc atm/cam/topo/se/ne120pg2_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171012.nc atm/cam/topo/se/ne240pg2_nc3000_Co008_Fi001_PF_nullRR_Nsw005_20171014.nc atm/cam/topo/se/ne3np4_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230717.nc atm/cam/topo/se/ne3pg3_gmted2010_modis_bedmachine_nc0540_Laplace1000_noleak_20230209.nc atm/cam/topo/se/ne5pg3_nc3000_Co360_Fi001_MulG_PF_nullRR_Nsw064_20170516.nc -atm/cam/topo/se/ne16pg3_gmted2010_modis_bedmachine_nc3000_Laplace0200_20230202.nc +atm/cam/topo/se/ne16pg3_gmted2010_modis_bedmachine_nc3000_Laplace0200_noleak_greenlndantarcsgh30fac2.50_20250825.nc atm/cam/topo/se/ne30pg3_gmted2010_modis_bedmachine_nc3000_Laplace0100_noleak_greenlndantarcsgh30fac2.50_20250828.nc atm/cam/topo/se/ne60pg3_nc3000_Co030_Fi001_PF_nullRR_Nsw021_20171012.nc atm/cam/topo/se/ne120pg3_nc3000_Co015_Fi001_PF_nullRR_Nsw010_20171014.nc From e9aa95a90fadbc01b4e0c2e78026dfa6359666e5 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 2 Oct 2025 15:21:16 -0600 Subject: [PATCH 435/466] Update atmos_phys external --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index f782515d0c..114484b244 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,7 +29,7 @@ [submodule "atmos_phys"] path = src/atmos_phys url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_18_000 + fxtag = atmos_phys0_18_001 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics From 09449481faed9c4108ffde99f66f9235d8d6a5d9 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 2 Oct 2025 15:30:56 -0600 Subject: [PATCH 436/466] Update submodules --- ccs_config | 2 +- src/atmos_phys | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ccs_config b/ccs_config index 028bbd779b..b20a207bc9 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit 028bbd779bf989cab8767dd0e7135126429b4531 +Subproject commit b20a207bc918b956b8dad44c14c4471aff9331ee diff --git a/src/atmos_phys b/src/atmos_phys index 9ecb80f12c..6f38b7ce08 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 9ecb80f12c799fdf35bd593a77a7764ae3882560 +Subproject commit 6f38b7ce083d599146921fde33b045e9ae39a97b From 6203fcc3579fe17fd4287470f9971eede955545a Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Thu, 2 Oct 2025 16:22:40 -0600 Subject: [PATCH 437/466] fix compiler bug --- src/dynamics/se/dycore/quadrature_mod.F90 | 70 +++++++++++------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/dynamics/se/dycore/quadrature_mod.F90 b/src/dynamics/se/dycore/quadrature_mod.F90 index 9580d5d975..feed0dd912 100644 --- a/src/dynamics/se/dycore/quadrature_mod.F90 +++ b/src/dynamics/se/dycore/quadrature_mod.F90 @@ -235,7 +235,7 @@ function gauss_wts(np1, gpts) result(wts) beta = c0 n = np1-1 - djac=jacobi_derivatives(np1,alpha,beta,np1,gpts) + djac=jacobi_derivatives(np1,alpha,beta,np1,gpts) do i=1,np1 wts(i)=c2/((c1-gpts(i)**2)*djac(i)*djac(i)) @@ -302,7 +302,7 @@ end function gausslobatto ! ============================================================== ! gausslobatto_pts: ! - ! Compute the Gauss-Lobatto Collocation points + ! Compute the Gauss-Lobatto Collocation points ! for Jacobi Polynomials ! ! ============================================================== @@ -321,10 +321,10 @@ function gausslobatto_pts(np1) result(pts) real (kind=r8) :: jacm1(0:np1) real (kind=r8) :: djac(0:np1) - integer prec ! number of mantissa bits + integer prec ! number of mantissa bits real (kind=r8) eps ! machine epsilon - real (kind=r8), parameter :: convthresh = 10 ! convergence threshold relative - ! to machine epsilon + real (kind=r8), parameter :: convthresh = 10 ! convergence threshold relative + ! to machine epsilon integer, parameter :: kstop = 30 ! max iterations for polynomial deflation real (kind=r8) :: a,b,det @@ -351,7 +351,7 @@ function gausslobatto_pts(np1) result(pts) ! ========================================================= ! compute machine precision and set the convergence - ! threshold thresh to 10 times that level + ! threshold thresh to 10 times that level ! ========================================================= prec = PRECISION(c10) @@ -370,7 +370,7 @@ function gausslobatto_pts(np1) result(pts) ! ============================================================ ! ============================================================ - ! compute the parameters in the polynomial whose + ! compute the parameters in the polynomial whose ! roots are desired... ! ============================================================ @@ -390,7 +390,7 @@ function gausslobatto_pts(np1) result(pts) nh = (n+1)/2 do j=1,nh-1 - x=cs ! first guess at root + x=cs ! first guess at root k=0 delx=c1 do while(k thresh) @@ -416,16 +416,16 @@ function gausslobatto_pts(np1) result(pts) ! cs = cs(theta) => cs(theta+2*dth) ! ===================================================== - cstmp=cs*cd-ss*sd - ss=cs*sd+ss*cd - cs=cstmp + cstmp=cs*cd-ss*sd + ss=cs*sd+ss*cd + cs=cstmp end do ! ================================================ ! compute the second half of the roots by symmetry ! ================================================ - do j=1,nh + do j=1,nh xjac(n-j) = -xjac(j) end do @@ -433,7 +433,7 @@ function gausslobatto_pts(np1) result(pts) ! ==================================================== ! Reverse the sign of everything so that indexing - ! increases with position + ! increases with position ! ==================================================== do j=0,n @@ -443,8 +443,8 @@ function gausslobatto_pts(np1) result(pts) end function gausslobatto_pts ! ================================================ - ! Gauss Lobatto Legendre Weights - ! ================================================ + ! Gauss Lobatto Legendre Weights + ! ================================================ function gausslobatto_wts(np1, glpts) result(wts) @@ -502,7 +502,7 @@ subroutine test_gausslobatto(npts) print *,"sum of Gauss-Lobatto weights=",gllsum print *,"============================================" - call gll.finalize() + call gll%finalize() end subroutine test_gausslobatto @@ -511,11 +511,11 @@ end subroutine test_gausslobatto ! subroutine jacobi: ! ! Computes the Jacobi Polynomials (jac) and their - ! first derivatives up to and including degree n + ! first derivatives up to and including degree n ! at point x on the interval (-1,1). ! - ! See for example the recurrence relations - ! in equation 2.5.4 (page 70) in + ! See for example the recurrence relations + ! in equation 2.5.4 (page 70) in ! ! "Spectral Methods in Fluid Dynamics", ! by C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A.Zang @@ -558,19 +558,19 @@ subroutine jacobi(n, x, alpha, beta, jac, djac) a2k = ( c2*k + alpha + beta + c1 )*( alpha*alpha - beta*beta ) + x*da2kdx a3k = c2*(k + alpha)*( k + beta )*( c2*k + alpha + beta + c2 ) jac(k+1) = ( a2k*jac(k)-a3k*jac(k-1) )/a1k - djac(k+1)= ( a2k*djac(k) + da2kdx*jac(k) - a3k*djac(k-1) )/a1k + djac(k+1)= ( a2k*djac(k) + da2kdx*jac(k) - a3k*djac(k-1) )/a1k end do end subroutine jacobi ! ========================================================== - ! This routine computes the Nth order Jacobi Polynomials + ! This routine computes the Nth order Jacobi Polynomials ! (jac) for a vector of positions x on the interval (-1,1), ! of length npoints. ! - ! See for example the recurrence relations - ! in equation 2.5.4 (page 70) in + ! See for example the recurrence relations + ! in equation 2.5.4 (page 70) in ! ! "Spectral Methods in Fluid Dynamics", ! by C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A.Zang @@ -581,7 +581,7 @@ end subroutine jacobi function jacobi_polynomials(n, alpha, beta, npoints, x) result(jac) integer, intent(in) :: n ! order of the Jacobi Polynomial - real (kind=r8) :: alpha + real (kind=r8) :: alpha real (kind=r8) :: beta integer, intent(in) :: npoints real (kind=r8) :: x(npoints) @@ -631,11 +631,11 @@ end function jacobi_polynomials ! ================================================ ! This routine computes the first derivatives of Nth - ! order Jacobi Polynomials (djac) for a vector of + ! order Jacobi Polynomials (djac) for a vector of ! positions x on the interval (-1,1), of length npoints. ! - ! See for example the recurrence relations - ! in equation 2.5.4 (page 70) in + ! See for example the recurrence relations + ! in equation 2.5.4 (page 70) in ! ! "Spectral Methods in Fluid Dynamics", ! by C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A.Zang @@ -646,7 +646,7 @@ end function jacobi_polynomials function jacobi_derivatives(n, alpha, beta, npoints, x) result(djac) integer , intent(in) :: n ! order of the Jacobi Polynomial - real (kind=r8), intent(in) :: alpha + real (kind=r8), intent(in) :: alpha real (kind=r8), intent(in) :: beta integer , intent(in) :: npoints real (kind=r8), intent(in) :: x(npoints) @@ -754,7 +754,7 @@ end function legendre ! =========================================== ! quad_norm: ! - ! compute normalization constants + ! compute normalization constants ! for k=1,N order Legendre polynomials ! ! e.g. gamma(k) in Canuto, page 58. @@ -821,13 +821,13 @@ END FUNCTION f x=x+del end do s=0.5_r8*(s + del*ssum) - it=2*it + it=2*it end if end subroutine trapN ! ========================================== - ! Trapezoid Rule for integrating functions + ! Trapezoid Rule for integrating functions ! from a to b with residual error eps ! ========================================== @@ -871,7 +871,7 @@ END FUNCTION f end function trapezoid ! ========================================== - ! Simpsons Rule for integrating functions + ! Simpsons Rule for integrating functions ! from a to b with residual error eps ! ========================================== @@ -924,9 +924,9 @@ end function simpsons ! ========================================== ! gaussian_int: ! - ! Gaussian Quadrature Rule for integrating - ! function f from a to b with gs weights and - ! points with precomputed gaussian quadrature + ! Gaussian Quadrature Rule for integrating + ! function f from a to b with gs weights and + ! points with precomputed gaussian quadrature ! and weights. ! ========================================== From c8422f61ca0e967e7b8d280674fd14df89181adf Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Mon, 6 Oct 2025 10:55:16 -0600 Subject: [PATCH 438/466] Fix NAG compiler issues --- src/dynamics/se/dycore/interpolate_mod.F90 | 26 +++++++++++----------- src/dynamics/se/native_mapping.F90 | 6 ++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/dynamics/se/dycore/interpolate_mod.F90 b/src/dynamics/se/dycore/interpolate_mod.F90 index e0d8c288a3..a19738b647 100644 --- a/src/dynamics/se/dycore/interpolate_mod.F90 +++ b/src/dynamics/se/dycore/interpolate_mod.F90 @@ -28,7 +28,7 @@ module interpolate_mod real (kind=r8), dimension(:) , allocatable :: rk ! 1/k real (kind=r8), dimension(:) , allocatable :: vtemp ! temp results real (kind=r8), dimension(:) , allocatable :: glp ! GLL pts (nair) - contains + contains procedure :: finalize => finalize_interpolate_t final :: finalize_interpolate_t_core end type interpolate_t @@ -37,8 +37,8 @@ module interpolate_mod ! Output Interpolation points. Used to output data on lat-lon (or other grid) ! with native element interpolation. Each element keeps a list of points from the ! interpolation grid that are in this element - type (cartesian2D_t),pointer,dimension(:):: interp_xy ! element coordinate - integer, pointer,dimension(:) :: ilat,ilon ! position of interpolation point in lat-lon grid + type (cartesian2D_t),allocatable,dimension(:):: interp_xy ! element coordinate + integer, allocatable,dimension(:) :: ilat,ilon ! position of interpolation point in lat-lon grid integer :: n_interp integer :: nlat integer :: nlon @@ -131,9 +131,9 @@ subroutine finalize_interpdata_t(this) end subroutine finalize_interpdata_t subroutine finalize_interpdata_t_core(this) type (interpdata_t) :: this - if(associated(this%interp_xy)) deallocate(this%interp_xy) - if(associated(this%ilat)) deallocate(this%ilat) - if(associated(this%ilon)) deallocate(this%ilon) + if(allocated(this%interp_xy)) deallocate(this%interp_xy) + if(allocated(this%ilat)) deallocate(this%ilat) + if(allocated(this%ilon)) deallocate(this%ilon) end subroutine finalize_interpdata_t_core ! @@ -1359,21 +1359,21 @@ subroutine setup_latlon_interp(elem,interpdata,par) ! allocate storage do ii=1,nelemd ngrid = interpdata(ii)%n_interp - if(interpdata(ii)%first_entry)then - NULLIFY(interpdata(ii)%interp_xy) - NULLIFY(interpdata(ii)%ilat) - NULLIFY(interpdata(ii)%ilon) + if(interpdata(ii)%first_entry)then +! NULLIFY(interpdata(ii)%interp_xy) +! NULLIFY(interpdata(ii)%ilat) +! NULLIFY(interpdata(ii)%ilon) interpdata(ii)%first_entry=.FALSE. endif - if(associated(interpdata(ii)%interp_xy))then + if(allocated(interpdata(ii)%interp_xy))then if(size(interpdata(ii)%interp_xy)>0)deallocate(interpdata(ii)%interp_xy) endif - if(associated(interpdata(ii)%ilat))then + if(allocated(interpdata(ii)%ilat))then if(size(interpdata(ii)%ilat)>0)deallocate(interpdata(ii)%ilat) endif - if (associated(interpdata(ii)%ilon))then + if (allocated(interpdata(ii)%ilon))then if(size(interpdata(ii)%ilon)>0)deallocate(interpdata(ii)%ilon) endif allocate(interpdata(ii)%interp_xy( ngrid ) ) diff --git a/src/dynamics/se/native_mapping.F90 b/src/dynamics/se/native_mapping.F90 index bfe75511fb..3140194a47 100644 --- a/src/dynamics/se/native_mapping.F90 +++ b/src/dynamics/se/native_mapping.F90 @@ -506,13 +506,13 @@ subroutine create_native_mapping_files(par, elem, maptype, ncol, clat, clon, are deallocate(grid_imask, lat,lon, h1d, col, row, dg_dims, ldof) do ii=1,nelemd - if(associated(interpdata(ii)%interp_xy))then + if(allocated(interpdata(ii)%interp_xy))then deallocate(interpdata(ii)%interp_xy) endif - if(associated(interpdata(ii)%ilat))then + if(allocated(interpdata(ii)%ilat))then deallocate(interpdata(ii)%ilat) endif - if (associated(interpdata(ii)%ilon))then + if (allocated(interpdata(ii)%ilon))then deallocate(interpdata(ii)%ilon) endif end do From 26e9f89d0a9038b128fc04d513749abf452555e4 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 7 Oct 2025 17:03:37 -0600 Subject: [PATCH 439/466] Apply changes to GPU code to allow for modified SW calling list --- src/physics/rrtmgp/radiation.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 475119b247..5583c2260c 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1251,6 +1251,9 @@ subroutine radiation_tend( & ! Compute the gas optics (stored in atm_optics_sw). ! toa_flux is the reference solar source from RRTMGP data. !$acc data copyin(kdist_sw%gas_props,pmid_day,pint_day,t_day,gas_concs_sw%gas_concs,atm_optics_sw%optical_props) & + !$acc copy(atm_optics_sw%optical_props%tau, & + !$acc atm_optics_sw%optical_props%g, & + !$acc atm_optics_sw%optical_props%ssa) & !$acc copyout(toa_flux) call rrtmgp_sw_gas_optics_run(dosw, 1, nday, nday, pmid_day, pint_day, t_day, & gas_concs_sw, atm_optics_sw, kdist_sw, toa_flux, errmsg, errflg) From 3a3e63114e6fcdea0fe864180b58984ac1f716a0 Mon Sep 17 00:00:00 2001 From: Cheryl Craig Date: Tue, 7 Oct 2025 17:10:10 -0600 Subject: [PATCH 440/466] ChangeLog for cam6_4_123 --- doc/ChangeLog | 26009 +----------------------------------------------- 1 file changed, 112 insertions(+), 25897 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index b27e88d95e..44224a7f00 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,114 @@ + +=============================================================== + +Tag name: cam6_4_123 +Originator(s): cacraigucar, jimmielin, gdicker1, johnmauff, jedards4b, PeterHjortLauritzen, sjsprecious, brian-eaton +Date: Oct 6, 2025 +One-line Summary: Misc changes to CAM +Github PR URL: https://github.com/ESCOMP/CAM/pull/1407 + +Purpose of changes (include the issue number and title text for each relevant GitHub issue): + - fix rei_cloud and rel_cloud units to um for CAM4 - @jimmielin + https://github.com/ESCOMP/CAM/pull/1388 + https://github.com/ESCOMP/CAM/issues/1387 + - share some input and settings from EarthWorks - @gdicker1 + https://github.com/ESCOMP/CAM/pull/1352 + https://github.com/ESCOMP/CAM/issues/1351 + https://github.com/ESCOMP/CAM/issues/1179 + - Reduce potential memory leaks - @johnmauff + https://github.com/ESCOMP/CAM/pull/1356 + https://github.com/ESCOMP/CAM/issues/1337 + - Add support for NUOPC write_restart_at_endorun - @jedwards4b + https://github.com/ESCOMP/CAM/pull/1367 + https://github.com/ESCOMP/CAM/issues/1367 + - Update topo file for ne30np4 (no physics grid), ne16pg3 and ne30pg2 - @PeterHjortLauritzen + https://github.com/ESCOMP/CAM/issues/1371 + - Move FMS support requirement to components - @jedwards4b + https://github.com/ESCOMP/CAM/pull/1378 + https://github.com/ESCOMP/CAM/issues/1377 + - Fix the CAM+RRTMGP GPU interface bug - @sjsprecious + https://github.com/ESCOMP/CAM/pull/1386 + https://github.com/ESCOMP/CAM/issues/1383 + - fix check of COSP with interpolated output - @brian-eaton + https://github.com/ESCOMP/CAM/pull/1398 + https://github.com/ESCOMP/CAM/issues/1397 + +Describe any changes made to build system: N/A + +Describe any changes made to the namelist: + - updated three topo files + +List any changes to the defaults for the boundary datasets: N/A + +Describe any substantial timing or memory changes: N/A + +Code reviewed by: jimmielin, jedwards4b, johmauff, sjsprecious, PeterHjortLaurizen + +List all files eliminated: N/A + +List all files added and what they do: N/A + +List all existing files that have been modified, and describe the changes: +M .gitmodules + - updated atmos_phys + +M bld/build-namelist + - fix so COSP check is only done when COSP is turned on + +M bld/namelist_files/namelist_defaults_cam.xml + - MPAS updates + - topo file updates + +M cime_config/buildcpp + - Have CAM do FMS library setting + +M src/atmos_phys + - updated atmos_phys external + +M src/cpl/nuopc/atm_comp_nuopc.F90 + - Have CAM use write_restart_at_endofrun logical + +M src/dynamics/se/dycore/derivative_mod.F90 +M src/dynamics/se/dycore/dof_mod.F90 +M src/dynamics/se/dycore/edge_mod.F90 +M src/dynamics/se/dycore/edgetype_mod.F90 +M src/dynamics/se/dycore/fvm_mapping.F90 +M src/dynamics/se/dycore/global_norms_mod.F90 +M src/dynamics/se/dycore/interpolate_mod.F90 +M src/dynamics/se/dycore/mass_matrix_mod.F90 +M src/dynamics/se/dycore/quadrature_mod.F90 +M src/dynamics/se/dycore/spacecurve_mod.F90 +M src/dynamics/se/native_mapping.F90 + - Reduce potential memory leaks + +M src/physics/cam/cloud_diagnostics.F90 + - Fix units + +M src/physics/rrtmgp/radiation.F90 + - Fix GPU interface bug (but still broken - see regression test) + +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: + ERI_D_Ln18.ne16pg3_ne16pg3_mt232.FHIST_C4.derecho_intel.cam-outfrq3s_eri (Overall: DIFF) details: + ERP_Ld3.ne16pg3_ne16pg3_mg17.FHISTC_WAt1ma.derecho_intel.cam-reduced_hist1d (Overall: DIFF) details: + SMS_C2_D_Ln9.ne16pg3_ne16pg3_mg17.FHISTC_WXma.derecho_intel.cam-outfrq9s (Overall: DIFF) details: + - Updated topo file produces answer changes + - Ran these three tests with old topo file and verfied the code was BFB when using the old files. + Expected answer changes on runs which use the new topo files + +derecho/nvhpc/aux_cam: + ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default (Overall: FAIL) details: + - New failure see issue: https://github.com/ESCOMP/CAM/issues/1408 + +izumi/nag/aux_cam: all BFB + +izumi/gnu/aux_cam: all BFB + +=============================================================== =============================================================== Tag name: cam6_4_122 @@ -57,7 +168,6 @@ derecho/intel/aux_cam: All PASS derecho/nvhpc/aux_cam: FAIL ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default RUN time=441 - pre-existing failure -- might be related to https://github.com/ESCOMP/CAM/issues/1383 - izumi/nag/aux_cam: All PASS izumi/gnu/aux_cam: All PASS @@ -128927,25899 +129037,4 @@ Purpose of changes: ncdata but not start_ymd. This is because build-namelist has default values for start_ymd which correspond to the default datasets used for ncdata. If the user overrides the default ncdata, then the default - start_ymd should also be overridden since the default may be inconsistent - with the dataset specified for ncdata. - -. add fix to XML::Lite parser code to recognize attributes when there is - optional white space between the equals sign and the value. Also allow - the attribute values to be enclosed in single quotes as well as double - quotes. - -. modify build for a homme run - -. Add some initializers for index values in FV (from Art Mirin). - -. replace deprecated float() intrinsic with real(). - -. fix for spaces in the name of the spmdstats file (from Pat Worley). - -. update mct external to trunk tag MCT2_3_0_070112 - -Bugs fixed (include bugzilla ID): - -. Bugzilla bug 89: - Change to cd_core.F90 required to enable the ifort compiler to compile the - omp directive surrounding "do 4500" loop. - -. Bugzilla bug 65: - Remove a informative print statement from inside an CSD region (caused - problem on Cray-X1E). - -. add fix for intermittent problem Tony found running in coupled mode on - bassi (NERSC IBM p5). Add initializer for srfflx_state2d%qref. - -. fix ctl_nl.pm (a homme namelist) so that it doesn't ignore the resolution - found in the config_cache.xml file. Remove the hardcoded value of "ne" - from Default_CTL_NL_Namelist.xml. - -. NOTE -- initial commit and tag contained problem with svn external - definitions. Deleted that tag, fixed definitions, recommitted and - retagged. - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - -. Add checks to build-namelist to fail if ncdata is specified without - specifying start_ymd. - -List any changes to the defaults for the boundary datasets: - -. New CLM datasets for FV, 1.9x2.5. These datasets are consistent with the - landfraction used for CCSM runs (1.9x2.5_gx1v4). - -Describe any substantial timing or memory changes: none - -Code reviewed by: myself - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -. update mct external to trunk tag MCT2_3_0_070112 - SVN_EXTERNAL_DIRECTORIES - -. Mods to add 1/4 and 1/2 degree FV grids - models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml - models/atm/cam/bld/resolution_parameters.xml - models/atm/cam/src/physics/cam1/cldwat.F90 - models/atm/cam/src/physics/cam1/cloud_fraction.F90 - models/atm/cam/src/physics/cam1/hk_conv.F90 - models/atm/cam/src/physics/cam1/zm_conv.F90 - models/atm/cam/src/dynamics/fv/dycore.F90 - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - -. modify warning about extrapolating too much of grid - models/atm/cam/src/control/interpolate_data.F90 - -. bug fix for CAM banner in output log - models/drv/seq_mct/seq_ccsm_drv.F90 - -. Modify build-namelist defaults for FV, 1.9x2.5. - models/atm/cam/bld/cam_inparm.pm - models/atm/cam/bld/clm_inparm.pm - models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml - -. add check to force user to also specify start_ymd if ncdata has been - specified. - models/atm/cam/bld/SeqCCSM_namelist.pm - -. add fix to XML::Lite parser code to recognize attributes when there is - optional white space between the equals sign and the value. Also allow - the attribute values to be enclosed in single quotes as well as double - quotes. - models/atm/cam/bld/XML/Lite/Element.pm - -. add missing initializer for srfflx_state2d%qref. - models/atm/cam/src/control/camsrfexch_types.F90 - -. mods for homme build - models/atm/cam/bld/config_cam_homme_defaults.xml - models/atm/cam/bld/ctl_nl.pm - models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - models/atm/cam/bld/DefaultCTL_NL_Namelist.xml - models/atm/cam/bld/DefaultTIMEMGR_INPARM_Namelist.xml - -. add some initializers for index values in FV (from Art Mirin). - models/atm/cam/src/dynamics/fv/d2a3dijk.F90 - models/atm/cam/src/dynamics/fv/d2a3dikj.F90 - models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - -. Replace deprecated float() intrinsic with real(): - models/atm/cam/src/physics/cam1/mcshallow.F90 - models/atm/cam/src/physics/cam1/convect_ke.F - models/atm/cam/src/physics/cam1/uw_conv.F - -. Bugzilla bug 89: - models/atm/cam/src/dynamics/fv/cd_core.F90 - -. Bugzilla bug 65 - models/atm/cam/src/dynamics/fv/fill_module.F90 - -. Put shr_sys_flush calls inside "#ifndef UNICOSMP" as a workaround for a bug - on the Cray-X1E. -. fix spmdstats filename so that it doesn't contain spaces - models/atm/cam/src/control/cam_comp.F90 - -. Mods to remove the "non-advected" species option. Remove all occurances - of pnats and ppcnst, and change the cnst_add interface to remove the - 'type' argument. - models/ocn/som/mixed_layer.F90 - models/utils/pilgrim/mod_comm.F90 - models/atm/cam/test/unit/control/file_test.pl - models/atm/cam/test/unit/ocnsice/dom/params.h - models/atm/cam/tools/scam/configure - models/atm/cam/tools/scam/scm_init/forecast.F90 - models/atm/cam/tools/scam/obj/Makefile - models/atm/cam/bld/CAM_config.pm - models/atm/cam/src/control/ccsm_msg.F90 - models/atm/cam/src/control/wtrc_flxoce.F90 - models/atm/cam/src/control/srfxfer.F90 - models/atm/cam/src/control/history_scam.F90 - models/atm/cam/src/control/cam_history.F90 - models/atm/cam/src/control/history_defaults.F90 - models/atm/cam/src/control/camsrfexch_types.F90 - models/atm/cam/src/control/ncdio_atm.F90 - models/atm/cam/src/control/iop.F90 - models/atm/cam/src/physics/cam1/tphysidl.F90 - models/atm/cam/src/physics/cam1/tphysbc.F90 - models/atm/cam/src/physics/cam1/drydep_mod.F90 - models/atm/cam/src/physics/cam1/restart_physics.F90 - models/atm/cam/src/physics/cam1/hk_conv.F90 - models/atm/cam/src/physics/cam1/constituents.F90 - models/atm/cam/src/physics/cam1/water_tracers.F90 - models/atm/cam/src/physics/cam1/hb_diff.F90 - models/atm/cam/src/physics/cam1/convect_shallow.F90 - models/atm/cam/src/physics/cam1/convect_deep.F90 - models/atm/cam/src/physics/cam1/buffer.F90 - models/atm/cam/src/physics/cam1/zm_conv.F90 - models/atm/cam/src/physics/cam1/qneg4.F90 - models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - models/atm/cam/src/physics/cam1/initindx.F90 - models/atm/cam/src/physics/cam1/seasalt_intr.F90 - models/atm/cam/src/physics/cam1/tracers.F90 - models/atm/cam/src/physics/cam1/progseasalts_intr.F90 - models/atm/cam/src/physics/cam1/dust_intr.F90 - models/atm/cam/src/physics/cam1/stratiform.F90 - models/atm/cam/src/physics/cam1/carbon_intr.F90 - models/atm/cam/src/physics/cam1/co2_cycle.F90 - models/atm/cam/src/physics/cam1/chemistry.F90 - models/atm/cam/src/physics/cam1/aerosol_intr.F90 - models/atm/cam/src/physics/cam1/sulfur_intr.F90 - models/atm/cam/src/physics/cam1/tracers.F90 - models/atm/cam/src/physics/cam1/radiation.F90 - models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 - models/atm/cam/src/physics/cam1/cam_diagnostics.F90 - models/atm/cam/src/physics/cam1/upper_bc.F90 - models/atm/cam/src/physics/cam1/physics_types.F90 - models/atm/cam/src/physics/cam1/physpkg.F90 - models/atm/cam/src/physics/cam1/constituent_burden.F90 - models/atm/cam/src/physics/cam1/tphysac.F90 - models/atm/cam/src/physics/waccm/tracers.F90 - models/atm/cam/src/physics/waccm/chemistry.F90 - models/atm/cam/src/physics/waccm/gw_drag.F90 - models/atm/cam/src/physics/waccm/upper_bc.F90 - models/atm/cam/src/physics/waccm/mo_msis_ubc.F90 - models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 - models/atm/cam/src/chemistry/waccm_mozart/upper_bc.F90 - models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 - models/atm/cam/src/chemistry/waccm_mozart/mo_tgcm_ubc.F90 - models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 - models/atm/cam/src/chemistry/waccm_mozart/mo_snoe.F90 - models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 - models/atm/cam/src/dynamics/sld/linemsdyn.F90 - models/atm/cam/src/dynamics/sld/spegrd.F90 - models/atm/cam/src/dynamics/sld/prognostics.F90 - models/atm/cam/src/dynamics/sld/scanslt.F90 - models/atm/cam/src/dynamics/sld/scan2.F90 - models/atm/cam/src/dynamics/sld/restart_dynamics.F90 - models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 - models/atm/cam/src/dynamics/sld/dp_coupling.F90 - models/atm/cam/src/dynamics/sld/inidat.F90 - models/atm/cam/src/dynamics/sld/dyn_comp.F90 - models/atm/cam/src/dynamics/sld/spmd_dyn.F90 - models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 - models/atm/cam/src/dynamics/eul/linemsdyn.F90 - models/atm/cam/src/dynamics/eul/spegrd.F90 - models/atm/cam/src/dynamics/eul/scanslt.F90 - models/atm/cam/src/dynamics/eul/prognostics.F90 - models/atm/cam/src/dynamics/eul/scandyn.F90 - models/atm/cam/src/dynamics/eul/restart_dynamics.F90 - models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 - models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 - models/atm/cam/src/dynamics/eul/dp_coupling.F90 - models/atm/cam/src/dynamics/eul/dyn_comp.F90 - models/atm/cam/src/dynamics/eul/inidat.F90 - models/atm/cam/src/dynamics/eul/spmd_dyn.F90 - models/atm/cam/src/dynamics/fv/stepon.F90 - models/atm/cam/src/dynamics/fv/dp_coupling.F90 - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - models/atm/cam/src/dynamics/fv/inital.F90 - models/atm/cam/src/dynamics/fv/restart_dynamics.F90 - models/atm/cam/src/advection/slt/qmassa.F90 - models/atm/cam/src/dynamics/homme/dp_coupling.F90 - - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluevista: all PASS except: -035 bl375 TBL.sh f1.9h outfrq24h 2d ...............................FAIL! rc= 7 -059 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 - -tempest: all PASS except -031 bl376 TBL.sh f1.9o outfrq24h 2d ...............................FAIL! rc= 7 - -bangkok/lf95: all PASS except: -031 bl377 TBL.sh f1.9m outfrq24h 2d ...............................FAIL! rc= 7 - -The failure of the FV, 1.9x2.5 baseline comparisons are expected due to a -change in the default landfrac file for that case. - -The failure of the CCSM restart test is still under investigation. The -latest CCSM tag in collections (ccsm3_1_beta42) is also failing with -cam3_3_46 which means the failure is not associated with the mods in this -commit. - - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: BFB - -=============================================================== -=============================================================== - -Tag name: cam3_3_46 -Originator(s): mvr,jet,eaton,aconley -Date: 10 Jan 2007 -One-line Summary: test_driver mods, consolidation of external -definitions in top directory, various bug fixes - -Purpose of changes: --having external definitions in multiple places led to some confusion --previously had no pretag tests at fv 1.9x2.5, an important production res --wanted some posttag testing to occur on calgary as alternative linux cluster --testing of fv 2d decomposition needed bolstering and multiple platforms --needed test of an extended run (several months) to catch certain run-time bugs --added lightning test environment setting to override that of users --branch test again branches from an earlier restart file than the last created - (broken since cam3_3_15) - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself,eaton - -List all subroutines eliminated: -D models/utils/SVN_EXTERNAL_DIRECTORIES -D models/SVN_EXTERNAL_DIRECTORIES -- files no longer needed with consolidation of external defs to top dir -D models/atm/cam/test/system/config_files/f2h -D models/atm/cam/test/system/config_files/f2m -D models/atm/cam/test/system/config_files/f2o -- fv tests at "production" settings moved from fv2x2.5 to fv1.9x2.5 -D models/atm/cam/test/system/tests_posttag_bangkok -- posttag testing of linux cluster moved from bangkok to calgary -D models/atm/cam/test/system/TRX.sh -- restart test while toggling fv 2d decomp settings merged with TER.sh - -List all subroutines added and what they do: -A models/atm/cam/test/system/config_files/f4h -- new configuration options file for performance/extended-run test -A models/atm/cam/test/system/config_files/f1.9o -- new configuration options file for "production" setting on tempest -A models/atm/cam/test/system/nl_files/fv2d_4tsk -A models/atm/cam/test/system/nl_files/fv2d_8tsk -- new namelist options files for testing of fv 2d decomposition -A models/atm/cam/test/system/tests_posttag_calgary -- posttag testing of linux cluster moved from bangkok to calgary -A SVN_EXTERNAL_DIRECTORIES -- new, consolidated list of all cam external definitions - -List all existing files that have been modified, and describe the changes: - M . -- set externals property on top level dir - M models - M models/utils -- deleted externals properties where they previously existed -M models/atm/cam/test/system/TBR.sh -M models/atm/cam/test/system/TSM.sh -- modified to handle new syntax for run length -M models/atm/cam/test/system/TER.sh -- modified to handle new syntax for run length; restart now toggles resources - appropriately if running fv 2d decompostion -M models/atm/cam/test/system/tests_pretag_tempest -- now running "production" test at fv 1.9x2.5 -M models/atm/cam/test/system/tests_pretag_bangkok -M models/atm/cam/test/system/tests_posttag_lightning -- added test for fv 2d decomp and now running "production" test at fv 1.9x2.5 -M models/atm/cam/test/system/tests_posttag_bluesky -M models/atm/cam/test/system/tests_pretag_bluesky -M models/atm/cam/test/system/tests_pretag_bluevista -- changed test for fv 2d decomp and now running "production" test at fv 1.9x2.5 -M models/atm/cam/test/system/tests_posttag_bluevista -- added extended run (two months) and moved the performance test from 10d to 2m -M models/atm/cam/test/system/test_driver.sh -- modified settings for calgary; bug fix for lightning environment -M models/atm/cam/test/system/nl_files/pghgsul -- added namelist settings for freq of restart writes -M models/atm/cam/test/system/input_tests_master -- modified syntax for run length of tests - needed to specify something other - than timesteps or days; addition and deletion of tests mentioned -M models/atm/cam/test/system/CAM_runcmnd.sh -- modified setting for calgary -M models/atm/cam/src/control/getnetcdfdata.F90 -- SCM bug fix for setlatlonidx routine when determining closest model column to - given lat/lon pair -M models/atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 -- fix to memory bug when calling radforce with omp enabled -M models/atm/cam/src/physics/cam1/phys_gmean.F90 -- fix to memory leak introduced in cam3_3_35; whitespace cleanup -M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 -- fixed bug in reading PS data from Match. Bug introduced in cam3_3_43 - -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. - -bluevista: -- all baseline tests failed due to the changes in the testing scripts and in - some cases the fixing of bugs - when a baseline was set up with the same - script changes and bug fixes, all baseline tests passed - -tempest: -- all baseline tests failed due to the changes in the testing scripts and in - some cases the fixing of bugs - when a baseline was set up with the same - script changes and bug fixes, all baseline tests passed - -bangkok/lf95: -- all baseline tests failed due to the changes in the testing scripts and in - some cases the fixing of bugs - when a baseline was set up with the same - script changes and bug fixes, all baseline tests passed - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_45 -Originator(s): Dani Bundy Coleman, Jerry Olson -Date: 8 Jan 2007 -One-line Summary: Alternative convection & PBL schemes, forecast mode - -Purpose of changes: Allow users to run the UW PBL scheme or the Emanuel - deep convection scheme. Add rough code to run in forecast mode. - - The UW PBL scheme requires: - configuration option: nlev = 30 - namelist options: shallow_scheme = 'UW' - eddy_scheme = 'diag TKE' - The Emanuel deep convection requires: - namelist options: deep_scheme = 'KE' - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - -character(len=16) :: shallow_scheme ! 'Hack' (default),'UW','off' -! 'Hack' = Hack shallow convection (default) -! 'UW' = original McCaa UW pbl scheme, modified by Sungsu Park -! 'off' = no shallow convection -! -character(len=16) :: deep_scheme ! 'ZM' (default), 'KE', 'off' -! 'ZM' = Zhang-McFarlane (default) -! 'KE' = Kerry Emanuel's scheme -! 'off' no deep convection -! -character(len=16) :: eddy_scheme ! 'HB' (default), 'diag TKE' -! 'HB' = Holtslag and Boville (default) -! 'diag TKE' = diagnostic tke version of Grenier and Bretherton - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: - -A models/atm/cam/src/utils/error_function.F90 - provides an erfc function for the UW PBL scheme -A models/atm/cam/src/physics/cam1/phys_control.F90 - Control interface to CAM physics packages -A models/atm/cam/src/physics/cam1/mcshallow.F90 - UW PBL shallow convection package -A models/atm/cam/src/physics/cam1/convect_ke_intr.F90 - Interface to Kerry Emanuel's deep convection scheme -A models/atm/cam/src/physics/cam1/convect_ke.F - Kerry Emanuel's deep convection scheme -A models/atm/cam/src/physics/cam1/zm_conv_intr.F90 - Interface to Zhang-McFarlane deep convection scheme - (used to be convect_deep.F90) -A models/atm/cam/src/physics/cam1/eddy_diff.F90 - UW PBL eddy diffusivity package -A models/atm/cam/src/physics/cam1/uw_conv.F90 - UW PBL shallow convection package - -List all existing files that have been modified, and describe the changes: - -Forecast mode changes: -M models/atm/cam/src/control/cam_history.F90 -M models/atm/cam/src/physics/cam1/check_energy.F90 -M models/atm/cam/src/physics/cam1/cam_diagnostics.F90 -M models/atm/cam/src/dynamics/sld/spegrd.F90 -M models/atm/cam/src/dynamics/sld/linemsdyn.F90 -M models/atm/cam/src/dynamics/sld/scanslt.F90 -M models/atm/cam/src/dynamics/sld/dyn_comp.F90 -M models/atm/cam/src/dynamics/sld/inidat.F90 -M models/atm/cam/src/dynamics/sld/grmult.F90 -M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 -M models/atm/cam/src/dynamics/eul/linemsdyn.F90 -M models/atm/cam/src/dynamics/eul/inidat.F90 -M models/atm/cam/src/dynamics/eul/dyn_comp.F90 -M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 -M models/atm/cam/src/dynamics/fv/initcom.F90 -M models/atm/cam/src/dynamics/fv/inidat.F90 -M models/atm/cam/src/dynamics/fv/dyn_comp.F90 -M models/atm/cam/src/dynamics/fv/commap.F90 -M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 -M models/atm/cam/src/dynamics/fv/uv3s_update.F90 -M models/atm/cam/src/dynamics/fv/stepon.F90 - -Convection option changes: -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/physics/cam1/initindx.F90 -M models/atm/cam/src/physics/cam1/param_cldoptics.F90 -M models/atm/cam/src/physics/cam1/physpkg.F90 -M models/atm/cam/src/physics/cam1/cloud_fraction.F90 -M models/atm/cam/src/physics/cam1/gw_drag.F90 -M models/atm/cam/src/physics/cam1/phys_buffer.F90 -M models/atm/cam/src/physics/cam1/zm_conv.F90 -M models/atm/cam/src/physics/cam1/cldwat.F90 -M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 -M models/atm/cam/src/physics/cam1/convect_shallow.F90 - This is now the interface to all shallow convection schemes -M models/atm/cam/src/physics/cam1/convect_deep.F90 - This is now the interface to all deep convection schemes - -Convection and Forecast-mode changes: -M models/atm/cam/src/physics/cam1/tphysbc.F90 -M models/atm/cam/src/physics/cam1/stratiform.F90 -M models/atm/cam/src/physics/cam1/constituents.F90 -M models/atm/cam/src/physics/cam1/tphysac.F90 - -Miscellaneous changes: -M models/atm/cam/test/system/TBL.sh - Add more information to output -M models/atm/cam/test/system/test_driver.sh - Change bluevista gmake option from "-j" to "-j8" -M models/atm/cam/src/physics/cam1/acbnd.F90 - Check that oxidant file has correct vertical dimensions -M models/atm/cam/src/physics/cam1/radiation.F90 -M models/atm/cam/src/physics/cam1/radsw.F90 -M models/atm/cam/src/physics/cam1/radlw.F90 - Calculate clearsky solor & longwave heating rates - New output fields: QRSC, QRSC_RF, QRLC -M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 - stdout - -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. - -bluevista: -Some code was moved from timestepping routines to initialization -routines. In cldwat.F90, this causes a roundoff change -on bluevista that causes the following baseline tests to fail: -005 bl131 TBL.sh e32c11dh pghgsul 9 -008 bl132 TBL.sh e32sdh ghgrmp 9 -015 bl151 TBL.sh e64h outfrq24h -2 -019 bl331 TBL.sh f4c11gdh pghgsul 9 -022 bl332 TBL.sh f4sdh ghgrmp 9 -030 bl336 TBL.sh wm4h outfrq3s 9 -034 bl351 TBL.sh f2h outfrq24h -2 -037 bl354 TBL.sh fm2dh outfrq3s 9 -040 bl355 TBL.sh fmo2dh off2x2.5 9 -054 bl551 TBL.sh s64h outfrq24h -2 - -tempest: -The roundoff difference as seen on bluevista seems to -show up in a waccm test that fails: -017 bl314 TBL.sh wg10dh outfrq3s 9 - -The baseline model field DTCOND included the effects of the energy -fixer (which is actually a fix to the nonconservation of the -dynamics). We moved the call to diag_conv_tend_ini from its position -above the energy fixer to below it, which makes the field different -and allows the heat budget to work out. This causes the following tests to -fail (only DTCOND is different): -021 bl331 TBL.sh f4c11gdh pghgsul 9 -024 bl332 TBL.sh f4sdh ghgrmp 9 -031 bl352 TBL.sh f2o outfrq24h -2 - - -bangkok/lf95: -Failed because of fixed DTCOND (only DTCOND is different) -016 bl311 TBL.sh f10c8mdm ttrac 9 -024 bl312 TBL.sh f10sdm ghgrmp 9 -028 bl353 TBL.sh f2m outfrq24h -2 - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_3_44 - -Summarize any changes to answers, i.e., -- what code configurations: - Any configuration on bluevista, although the sulfur cycle is particularly sensitive. - WACCM on tempest was also sensitive to the roundoff change - -- what platforms/compilers: - bluevista, tempest - -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - roundoff -If bitwise differences were observed, how did you show they were no worse -than roundoff? - pergro test, tracking roundoff change to culprit code - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_44 -Originator(s): Jim Edwards -Date: 12-13-2006 -One-line Summary: Update of homme dynamics, update of tests and timing utils - -Purpose of changes: Merge homme dynamics development branch. - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - Added a default homme core build - M 2606 models/atm/cam/bld/config_cam_homme_defaults.xml - M 2606 models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - M 2606 models/atm/cam/bld/DefaultCTL_NL_Namelist.xml - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself Brian Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - updated for new timings tag: - models/utils/SVN_EXTERNAL_DIRECTORIES - - added a homme test and updated the CCSM test: - A 0 models/atm/cam/test/system/config_files/h5x8dm - M 2606 models/atm/cam/test/system/TCT.ccsm.sh - M 2606 models/atm/cam/test/system/tests_pretag_bluevista - M 2606 models/atm/cam/test/system/input_tests_master - - ccsm tests will now pull in share code from tester's sandbox by default... - added environment variable (CAM_USE_SHR) to control behavior - - Added support for homme grid in energy calculation - M 2606 models/atm/cam/src/physics/cam1/phys_gmean.F90 - Replaced some data statements with parameter declarations - M 2606 models/atm/cam/src/physics/cam1/radae.F90 - - Removed some debugging code - M 2606 models/atm/cam/src/physics/cam1/physpkg.F90 - M 2606 models/atm/cam/src/physics/cam1/qneg3.F90 - - Removed some timers that were causing a problem on bluevista - - this is a hack, it looks like there is a memory problem associated - with fmo2dh - I will continue to investigate. - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluevista: 056 bl711 TBL.sh h5x8dm adia 9 FAIL (no existing baseline) - - 058 cs998 TCS.ccsm.sh ERS f19_g13 K - 040 bl355 TBL.sh fmo2dh off2x2.5 9 - FAILED against cam3_3_43 PASS against cam3_3_42 this is due to - problems introduced in 3_3_42 - -tempest: none - -bangkok/lf95: none - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_43 -Originator(s): John Truesdale -Date: 4 Dec 2006 -One-line Summary: Added single column mode to CAM - -Purpose of changes: - - This commit adds a single column mode (SCM) to CAM. The scam - GUI is being refactored and has been removed from the - trunk. The CAM single column mode is controlled via the - standard cam namelist. Additional namelist parameters allow - cam to be forced using a standard IOP dataset. Future commits - will add back much of the original scam and column radiation - capablity as well as an updated GUI. - - To run cam in single column mode you need to invoke the standard - cam configure script with the -scam option and compile the model - as usual. Although single column mode only runs with the eularian - dynamics most other options for configuring cam (resolution, external - libraries, etc) will work. Next invoking the build-namelist - script will provide a namelist template for running with the - default ARM IOP. The build-namelist procedure requires the user - to supply namelist values for the latitude and longitude of the - IOP column using the namelist variables scmlat and scmlon. - In practice though the user must also specify the starting date - and timesteps to run as well as an appropriate initial condition. - The following parameters to the build-namelist script may be used for - running with the various IOP datasets. The initial data being read - in and used as a background for each of the IOPs is the standard - SEP 1 initial condition. It is suggested that the user generate an - initial condition closer to the starting date of the IOP. - Once the namelist is generated the user may run cam and analyze the - standard history tape produced for the IOP column with any netcdf - visualization tool. - - The relavent namelist parameters for use with the single column mode - of cam are: - - single_column = .true. - scmlat = xxx ! scm latitude to use for the model run - scmlon = xxx ! scm longitude to use for the model run - iopfile = 'xxx' ! iop boundary condition file - - -build-namelist script params for the ARM IOP - -build-namelist -namelist \ -"&camexp \ -mss_irt=0 \ -scmlat=36.6 \ -scmlon=262.5 \ -start_ymd=19950718 \ -start_tod=19800 \ -stop_n=1259 \ -stop_option='nsteps' \ -iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/arm0795v1.2.nc' \ -ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ -mfilt=1400 \ -nhtfrq=1/" - -build-namelist script params for the Gate IOP - -build-namelist -namelist \ -"&camexp \ -mss_irt=0 \ -scmlat=9. \ -scmlon=336. \ -start_ymd=19740830 \ -start_tod=0 \ -stop_n=1440 \ -stop_option='nsteps' \ -iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/gate0874v1.2.nc' \ -ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ -mfilt=1500 \ -nhtfrq=1/" - -build-namelist script params for GCSS IOP - -build-namelist -namelist \ -"&camexp \ -mss_irt=0 \ -scmlat=-2. \ -scmlon=155. \ -start_ymd=19921220 \ -start_tod=0 \ -stop_n=505 \ -stop_option='nsteps' \ -iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/gcss1292v1.2.nc' \ -ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ -mfilt=1500 \ -nhtfrq=1/" - - - In addition to the standard IOP datasets the single column version - of CAM may be forced with an intial condition file and a "pseudo - IOP" history file generated from a previous global CAM run. This - mode is useful for getting a feel for how new physics modules - behave given forcing from an actual CAM run. To generate an - initial condition and IOP style forcing data from a standard cam - run configure the model using the new -camiop option of the - configure script. The build-namelist script has been modified to - generate a namelist which will create an initial condition for a - scm model run as well as an auxillary history tape containing the - IOP fields needed to drive a single column version of CAM. Both - the initial conditions file and the IOP forcing history tape are 3 - dimensional. When running with these datasets in SCM mode the - user can choose which column will be used via the namelist - parameters scmlat and scmlon. - - The relavent namelist parameters for generating an CAMIOP are - - fincl2 = 'Ps','u','v','t','q','omega','phis','Prec','lhflx','shflx',\ - 'Tsair','Tg','divq3d','divT3d','dcldice','dcldliq','beta',\ - 'fixmas','afixq','afixcldl','afixcldi','dqfxq','dqfxcldl',\ - 'dqfxcldi','CLAT','T','Q' - inithist = 'CAMIOP' - mfilt = 1,10 - nhtfrq = 0,1 - - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: Added -scam and -camiop options - to configure script. The -scam option will configure cam for - single column mode. The -camiop option will configure cam to produce - an iop initial condition file and a boundary forcing history tape - to be used in single column mode. - -Describe any changes made to the namelist: Added namelist parameters for - single column mode. Since all surface models need single column - control information the following namelist variables were added - to ccsm_inparm - - ! enable single_column mode - logical :: single_column ! default false set to true to - ! enable single column mode - - ! single column longitude - real(r8) :: scmlon ! longitude setting used by cam in - ! scm mode - ! single column latitude - real(r8) :: scmlat ! latitude setting used by cam in - ! scm mode - - The following namelist variable was added to the cam_inparm namelist - - ! iop boundary file - integer, parameter :: max_chars = 128 - character(len=max_chars) iopfile !IOP Boundary condition file - - - Added the CAMIOP option to the inithist namelist variable. This - option will produce an initial condition for use with a cam - generated iop forcing history tape. - - ! inithist Generate initial dataset as auxillary history file - ! can be set to '6-HOURLY', 'DAILY', 'MONTHLY', - ! 'YEARLY', 'CAMIOP', or 'NONE'. - ! default: 'YEARLY' - - -List any changes to the defaults for the boundary datasets: - Added a namelist option to specify an IOP file for SCM mode. - -Describe any substantial timing or memory changes: - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: - - configuration/namelist/script files for testing of scm cam mode: - - models/atm/cam/test/system/config_files/scm64bfbiop - models/atm/cam/test/system/config_files/e64bfbiop - models/atm/cam/test/system/nl_files/scm_prep - models/atm/cam/test/system/nl_files/scm_b4b_o1 - models/atm/cam/test/system/TSC.sh - - Files adding scm capability to cam: - models/atm/cam/src/control/scamMod.F90 - models/atm/cam/src/control/getnetcdfdata.F90 - models/atm/cam/src/dynamics/eul/forecast.F90 - models/atm/cam/src/dynamics/eul/getinterpnetcdfdata.F90 - models/lnd/clm2/src/main/getnetcdfdata.F90 - -List all existing files that have been modified, and describe the changes: -The majority of the modifications had to do with removing the -#define SCAM sections of code. There is still some duplication of -functionality that will be cleaned up in future commits (reading of -netcdf data). The pieces of independent single column mode code -are delineated now by a run time 'if (single_column)' test. The single_column -logical is defined in the ccsm_inparm namelist and is available to all component -models. Files in the test and bld subdirectories were modified to allow -bit for bit testing of scam against a control run of the 3d model as well -as adding functionality to the build-namelist and configure scripts to make -running in single column mode easier. - - models/ocn/dom/sst_data.F90 - models/ice/csim4/ice_data.F90 - models/atm/cam/test/system/tests_pretag_bangkok - models/atm/cam/test/system/TPF.sh - - TPF.sh: the script for testing performance problems was modified to - reflect the move to a single timing file introduced in cam3_3_42 - - models/atm/cam/test/system/tests_pretag_bluevista - models/atm/cam/test/system/nl_files/scm_prep - models/atm/cam/test/system/nl_files/scm_b4b_o1 - models/atm/cam/test/system/input_tests_master - models/atm/cam/test/system/TSC.sh - models/atm/cam/test/system/TCT.sh - - TCT.sh: all ccsm tests through cam's test suite will now use the - csm_share and clm code from the cam sandboxes rather than that - from the latest ccsm tag (up to now it used just the cam code) - - models/atm/cam/test/system/tests_posttag_lightning - models/atm/cam/bld/configure - models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - models/atm/cam/bld/cam_inparm.pm - models/atm/cam/bld/NamelistsDescriptions.xml - models/atm/cam/bld/resolution_parameters.xml - models/atm/cam/bld/CAM_config.pm - models/atm/cam/bld/ccsm_inparm.pm - models/atm/cam/src/control/readinitial.F90 - models/atm/cam/src/control/history_defaults.F90 - models/atm/cam/src/control/runtime_opts.F90 - models/atm/cam/src/control/ncdio_atm.F90 - models/atm/cam/src/control/rgrid.F90 - models/atm/cam/src/control/interpolate_data.F90 - models/atm/cam/src/control/con_cam.F90 - models/atm/cam/src/control/atm_comp_mct.F90 - models/atm/cam/src/control/startup_initialconds.F90 - models/atm/cam/src/control/history_scam.F90 - models/atm/cam/src/control/cam_comp.F90 - models/atm/cam/src/control/cam_history.F90 - models/atm/cam/src/physics/cam1/initindx.F90 - models/atm/cam/src/physics/cam1/radiation.F90 - models/atm/cam/src/physics/cam1/radsw.F90 - models/atm/cam/src/physics/cam1/cam_diagnostics.F90 - models/atm/cam/src/physics/cam1/physics_types.F90 - models/atm/cam/src/physics/cam1/radlw.F90 - models/atm/cam/src/physics/cam1/physpkg.F90 - models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 - models/atm/cam/src/physics/cam1/aerosol_index.F90 - models/atm/cam/src/physics/cam1/gw_drag.F90 - models/atm/cam/src/chemistry/trop_mozart/mz_aerosols_intr.F90 - models/atm/cam/src/dynamics/sld/dyn_comp.F90 - models/atm/cam/src/dynamics/eul/sphdep.F90 - models/atm/cam/src/dynamics/eul/initcom.F90 - models/atm/cam/src/dynamics/eul/scanslt.F90 - models/atm/cam/src/dynamics/eul/inidat.F90 - models/atm/cam/src/dynamics/eul/getinterpnetcdfdata.F90 - models/atm/cam/src/dynamics/eul/inital.F90 - models/atm/cam/src/dynamics/eul/dycore.F90 - models/atm/cam/src/dynamics/eul/iop.F90 - models/atm/cam/src/dynamics/eul/dynpkg.F90 - models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 - models/atm/cam/src/dynamics/eul/scan2.F90 - models/atm/cam/src/dynamics/eul/stepon.F90 - models/atm/cam/src/dynamics/eul/restart_dynamics.F90 - models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 - models/SVN_EXTERNAL_DIRECTORIES - models/drv/seq_mct_drv/seq_ccsm_drv.F90 - models/drv/seq_mct/mrg_x2a_mct.F90 - models/csm_share/shr/shr_inputinfo_mod.F90 - models/lnd/clm2/src/main/inicFileMod.F90 - models/lnd/clm2/src/main/driver.F90 - models/lnd/clm2/src/main/ncdio.F90 - models/lnd/clm2/src/main/initializeMod.F90 - models/lnd/clm2/src/main/iniTimeConst.F90 - models/lnd/clm2/src/main/restFileMod.F90 - models/lnd/clm2/src/main/controlMod.F90 - models/lnd/clm2/src/main/lnd_comp_mct.F90 - models/lnd/clm2/src/main/surfrdMod.F90 - models/lnd/clm2/src/biogeochem/STATICEcosysDynMod.F90 - models/lnd/clm2/src//main/clm_varctl.F90 - - The following files were deleted. As stated above - the GUI version of SCAM is being refactored. An - impoved GUI will be added in the future. - - scam - scam/configure - scam/crm - scam/GNUmakefile - scam/.scam_defaults - scam/README - scam/tools - scam/tools/sdev - scam/tools/sdev/sdev - scam/tools/sdev/sdev.C - scam/tools/sdev/Makefile - scam/tools/sdev/README - scam/tools/ncmult - scam/tools/ncmult/ncmult.C - scam/tools/ncmult/Makefile - scam/tools/ncmult/README - scam/tools/nctrans - scam/tools/nctrans/nctrans - scam/tools/nctrans/nctrans.C - scam/tools/nctrans/Makefile - scam/tools/nctrans/README - scam/tools/diurnal_ave - scam/tools/diurnal_ave/diurnal_ave - scam/tools/diurnal_ave/diurnal_ave.C - scam/tools/diurnal_ave/Makefile - scam/tools/diurnal_ave/README - scam/tools/intercomparison-post-processing - scam/tools/intercomparison-post-processing/ncfile.C - scam/tools/intercomparison-post-processing/field.C - scam/tools/intercomparison-post-processing/post - scam/tools/intercomparison-post-processing/ncfile.H - scam/tools/intercomparison-post-processing/post.C - scam/tools/intercomparison-post-processing/field.H - scam/tools/intercomparison-post-processing/intercompare.scm - scam/tools/intercomparison-post-processing/Makefile - scam/tools/intercomparison-post-processing/process - scam/tools/ncadd - scam/tools/ncadd/ncadd - scam/tools/ncadd/ncadd.C - scam/tools/ncadd/Makefile - scam/tools/ncadd/README - scam/tools/pdf - scam/tools/pdf/ferret.jnl - scam/tools/pdf/pdf - scam/tools/pdf/pdf.C - scam/tools/pdf/Makefile - scam/tools/pdf/README - scam/tools/ccm2iop - scam/tools/ccm2iop/ncfile.C - scam/tools/ccm2iop/ncfile.cpp - scam/tools/ccm2iop/ioerr.h - scam/tools/ccm2iop/ncfile.h - scam/tools/ccm2iop/Makefile - scam/tools/ccm2iop/ccm2iop.C - scam/tools/ccm2iop/test.nc - scam/getlatlon.pl - scam/testscript - scam/html - scam/html/userguide.html - scam/html/tdiff-cam2.gif - scam/html/gif - scam/html/gif/tdiff-cam2.gif - scam/html/gif/plot.gif - scam/html/gif/tdiff3.2.gif - scam/html/gif/tdiff3.6.gif - scam/html/gif/post.gif - scam/html/gif/formula1.gif - scam/html/gif/formula2.gif - scam/html/gif/iop.gif - scam/html/gif/formula3.gif - scam/html/gif/formula4.gif - scam/html/gif/qdiff.gif - scam/html/gif/formula5.gif - scam/html/gif/formula6.gif - scam/html/gif/tdiff.gif - scam/html/gif/mainwnd.gif - scam/html/gif/qls.gif - scam/html/gif/global.gif - scam/html/gif/sls.gif - scam/html/gif/mainwin.gif - scam/html/gif/uls.gif - scam/html/gif/vls.gif - scam/html/gif/w.gif - scam/html/gif/option.gif - scam/html/gif/g2.gif - scam/html/gif/uphys.gif - scam/html/gif/selectdata.gif - scam/html/gif/vphys.gif - scam/html/tdiff3.6.gif - scam/html/index.html - scam/scm_init - scam/scm_init/init_model.F90 - scam/scm_init/misc.h - scam/scm_init/scam_srfdata.F90 - scam/scm_init/drand48_.c - scam/scm_init/get_levels.F90 - scam/scm_init/scam_srfdata_MCT.F90 - scam/scm_init/runtype.h - scam/scm_init/scam_rpc.x - scam/scm_init/calcdate.F90 - scam/scm_init/comfrc.h - scam/scm_init/fortran.h - scam/scm_init/ipc.h - scam/scm_init/setlatlon.F90 - scam/scm_init/forecast.F90 - scam/scm_init/scam_run.F90 - scam/scm_init/myhandler.F - scam/scm_init/realtype.h - scam/scm_init/inital.F90 - scam/scm_init/readpressdata.F90 - scam/scm_init/c_outfld.c - scam/scm_init/scamMod.F90 - scam/scm_init/c_outfld.h - scam/scm_init/interplevs.F90 - scam/scm_init/getnetcdfdata.F90 - scam/scm_init/preproc.h - scam/scm_init/setiopupdate.F90 - scam/scm_init/scam.c - scam/scm_init/scam_fifo.c - scam/scm_init/getinterpncdata.F90 - scam/scm_init/readiopdata.F90 - scam/scm_init/readsaveinit.F90 - scam/scm_init/max.h - scam/scm_init/scam_fifo.h - scam/INSTALL - scam/mymods - scam/mymods/README - scam/userdata - scam/userdata/crmtest18.in - scam/userdata/crmtest26.out - scam/userdata/crmdarwintest26.out - scam/userdata/crmtest200.in - scam/userdata/README - scam/userdata/crmtest26.in - scam/data - scam/data/README - scam/obj - scam/obj/makdep.linux - scam/obj/makdep - scam/obj/Makefile - scam/ui - scam/ui/timeconvert.cpp - scam/ui/PostPlottingDlg.h - scam/ui/OptionsDlg.ui.h - scam/ui/LoadData.ui - scam/ui/utils.h - scam/ui/history.h - scam/ui/IOPSelectDateDlg.ui - scam/ui/PlistDlgImpl.h - scam/ui/rpcmodel.h - scam/ui/defaults.h - scam/ui/map.cpp - scam/ui/PlistDlg.ui - scam/ui/datasetselector.cw - scam/ui/plot.cpp - scam/ui/manager.h - scam/ui/map.xbm - scam/ui/msgdlg.h - scam/ui/field.cpp - scam/ui/globalmap.cw - scam/ui/crm.h - scam/ui/fieldlistbox.cpp - scam/ui/dataset.h - scam/ui/Platform.Notes - scam/ui/ncarg.cpp - scam/ui/observer.h - scam/ui/IOPSelectDateDlg.ui.h - scam/ui/PostPlottingDlg.cpp - scam/ui/IOPSelectDateDlgImpl.cpp - scam/ui/ncfile.cpp - scam/ui/PlotDlg.ui - scam/ui/LoadDataImpl.h - scam/ui/history.cpp - scam/ui/ascii_dataset.h - scam/ui/globalmap.h - scam/ui/fifomodel.cpp - scam/ui/rpcmodel.cpp - scam/ui/plot.cw - scam/ui/GNUmakefile - scam/ui/defaults.cpp - scam/ui/ncarg - scam/ui/ncarg/c.h - scam/ui/SelectGlobalDataDlg.ui - scam/ui/msgdlg.cpp - scam/ui/sicfile.cpp - scam/ui/list.h - scam/ui/crm.cpp - scam/ui/dbgmodel.h - scam/ui/plot.h - scam/ui/PostPlottingDlgImpl.h - scam/ui/dataset.cpp - scam/ui/MainWnd.ui - scam/ui/world.xbm - scam/ui/LoadDataImpl.cpp - scam/ui/PlotDlgImpl.h - scam/ui/fieldlistbox.h - scam/ui/ncarg.h - scam/ui/model.cpp - scam/ui/configure - scam/ui/IOPSelectDateDlgImpl.h - scam/ui/map.cw - scam/ui/OptionsDlgImpl.cpp - scam/ui/ChangeAxisScaleDlg.ui - scam/ui/ncfile.h - scam/ui/SelectGlobalDataDlgImpl.h - scam/ui/fifomodel.h - scam/ui/ncarg_stubs.cpp - scam/ui/fieldplotwidget.cw - scam/ui/dbgmodel.cpp - scam/ui/PostPlottingDlgImpl.cpp - scam/ui/fortran.h - scam/ui/numlined.h - scam/ui/sicfile.h - scam/ui/images - scam/ui/images/editcopy - scam/ui/images/editcut - scam/ui/images/fileopen - scam/ui/images/editpaste - scam/ui/images/textbold - scam/ui/images/undo - scam/ui/images/searchfind - scam/ui/images/filenew - scam/ui/images/redo - scam/ui/images/print - scam/ui/images/filesave - scam/ui/main.cpp - scam/ui/MainWndImpl.h - scam/ui/ioerr.h - scam/ui/PlotDlgImpl.cpp - scam/ui/ld.man - scam/ui/ChangeAxisScaleDlgImpl.h - scam/ui/utils.cpp - scam/ui/SelectGlobalDataDlgImpl.cpp - scam/ui/configure.works - scam/ui/PlistDlgImpl.cpp - scam/ui/timeconvert.h - scam/ui/model.h - scam/ui/OptionsDlgImpl.h - scam/ui/manager.cpp - scam/ui/OptionsDlg.ui - scam/ui/fieldlistbox.cw - scam/ui/MainWndImpl.cpp - scam/ui/c.h - scam/ui/field.h - scam/ui/sst - scam/ui/max.h - scam/ui/ChangeAxisScaleDlgImpl.cpp - -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. - -bluevista: - -The following test failed as part of the cam3_3_42 commit and also fail as part -of this commit. - -038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 -039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 - - All ccsm tests through cam's test suite will now use the - csm_share and clm code from the cam sandboxes rather than that - from the latest ccsm tag (up to now it used just the cam code) - - -tempest: - -bangkok/lf95: - -CAM tag used for the baseline comparison tests if different than previous -tag:cam3_3_42 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - NONE - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - - NA - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - - NA - -MSS location of control simulations used to validate new climate: - - NA - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: cam3_3_42 -Originator(s): Patrick Worley -Date: 24 Nov 2006 -One-line Summary: refactored timer instrumentation and support for single timing output file - -Purpose of changes: - - To update timing instrumentation to reflect recent model changes, - and to improve 'coverage' by adding timers for all top level events. - - To improve usability on large numbers of processes by decreasing number - of process count-dependent files and lines of output: - - added option to generate single timing and spmdstats files - (containing all of the information that had been spread between - multiple files before) - - added option to restrict reporting of many runtime options and - memory usage statistics to process 0 - These new options are enabled by default - -Bugs fixed (include bugzilla ID): - 'debugging' shr_sys_flush call in seq_domain_mct.F90 erroneously left in - during earlier check-in caused error on Cray X1E - -Describe any changes made to build system: - Added new CPP flags: - - MULTIPLE_PERF_FILES: if defined, timing and output files will be - created for each process (the previous default) - - WRAP_MPI_TIMING: if defined, timing events are defined for each MPI - call in wrap_mpi.F90 (the previous default) - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: Patrick Worley - -List all subroutines eliminated: - -List all subroutines added and what they do: - t_pr_onef in utils/timing/f_wrappers.c: - variant of t_prf that write all timing data in one file - t_enablef in utils/timing/f_wrappers.c, - GPTL_enable in utils/timing/gptl.c: - runtime timing routine enabler - t_disablef in utils/timing/f_wrappers.c, - GPTL_disable in utils/timing/gptl.c: - runtime timing routine disabler - -List all existing files that have been modified, and describe the changes: - - SVN_EXTERNAL_DIRECTORIES - using clm3_expa_79 - - utils/SVN_EXTERNAL_DIRECTORIES - using timing_061124 - - atm/cam/src/control/atm_comp_mct.F90 - atm/cam/src/control/cam_comp.F90 - atm/cam/src/control/wrap_mpi.F90 - atm/cam/src/dynamics/eul/dp_coupling.F90 - atm/cam/src/dynamics/eul/dyndrv.F90 - atm/cam/src/dynamics/eul/dynpkg.F90 - atm/cam/src/dynamics/eul/scan2.F90 - atm/cam/src/dynamics/eul/scandyn.F90 - atm/cam/src/dynamics/eul/scanslt.F90 - atm/cam/src/dynamics/eul/stepon.F90 - atm/cam/src/dynamics/fv/cd_core.F90 - atm/cam/src/dynamics/fv/dp_coupling.F90 - atm/cam/src/dynamics/fv/dyn_comp.F90 - atm/cam/src/dynamics/fv/mapz_module.F90 - atm/cam/src/dynamics/fv/stepon.F90 - atm/cam/src/dynamics/fv/trac2d.F90 - atm/cam/src/dynamics/sld/dp_coupling.F90 - atm/cam/src/dynamics/sld/dyndrv.F90 - atm/cam/src/dynamics/sld/dynpkg.F90 - atm/cam/src/dynamics/sld/scan2.F90 - atm/cam/src/dynamics/sld/scandyn.F90 - atm/cam/src/dynamics/sld/scanslt.F90 - atm/cam/src/dynamics/sld/stepon.F90 - atm/cam/src/physics/cam1/convect_deep.F90 - atm/cam/src/physics/cam1/convect_shallow.F90 - atm/cam/src/physics/cam1/diffusion_solver.F90 - atm/cam/src/physics/cam1/physpkg.F90 - atm/cam/src/physics/cam1/radiation.F90 - atm/cam/src/physics/cam1/tphysac.F90 - atm/cam/src/physics/cam1/tphysbc.F90 - atm/cam/src/physics/cam1/vertical_diffusion.F90 - atm/cam/src/physics/cam1/zm_conv.F90 - drv/seq_mct_drv/seq_ccsm_drv.F90 - ice/csim4/ice_comp.F9 - ice/csim4/ice_comp_mct.F90 - ice/csim4/ice_srf.F90 - lnd/clm2/src/main/clm_comp.F90 - lnd/clm2/src/main/driver.F90 - lnd/clm2/src/main/lnd_comp_mct.F90 - ocn/dom/ocn_comp.F90 - ocn/dom/ocn_comp_mct.F90 - ocn/som/ocn_comp.F90 - ocn/som/ocn_comp_mct.F90 - modified performance timer logic - - atm/cam/src/control/cam_comp.F90 - single spmdstats output file option - - atm/cam/src/control/cam_history.F90 - process 0-only reporting (eliminating unnecessary output) - - atm/cam/src/control/print_memusage.F90 - process 0-only reporting memory usage. Old default restored - by defining DEBUG. - - atm/cam/src/dynamics/eul/spmd_dyn.F90 - atm/cam/src/dynamics/sld/spmd_dyn.F90 - process 0-only reporting of SPMD buffer allocation. - - atm/cam/src/physics/cam1/chem_surfvals.F90 - atm/cam/src/physics/cam1/prescribed_aerosols.F90 - process 0-only reporting of runtime options - - drv/seq_mct/seq_domain_mct.F90 - deleted 'call shr_sys_flush(25+iam)' - - drv/seq_mct_drv/seq_ccsm_drv.F90 - disabled CATAMOUNT-specific call to usetlbuf; I/O buffering is now - the system default, and usetlbuf is unecessary - added option to create a single timing output file - - lnd/clm2/src/main/restFileMod.F90 - (ask T. Craig or M. Vertenstein) - - utils/timing/f_wrappers.c - added t_pr_onef, t_enablef, t_disablef - - utils/timing/gptl.c - utils/timing/gptl.h - added GPTL_enable, GPTL_disable - modified GPTLpr to create either one timer output file, - or one file per process - process 0-only reporting timing options. Old default restored - by defining DEBUG. - - utils/timing/gptl_papi.c - modified error message (mod. from J. Edwards) - - utils/timing/private.h - increased timing event name length - -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. - -bluevista: All PASSED - -tempest: All PASSED - -bangkok/lf95: All PASSED - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: cam3_3_41 -Originator(s): Francis Vitt -Date: 15 Nov 2006 -One-line Summary: Added functionality and flexibility to the trop_mozart chemistry. - -Purpose of changes: - - To implement flexibility in the chemical mechanism used in trop_mozart - chemistry package. This flexibility is provided - via: - - flexible namelist variables - - helper functions which use data provided by the chemical preprocessor - - Use cam implemented prognostic sea salt and dust with the trop_mozart - chemistry package. - - Use cam implemented rain out of trop_mozart aerosols. - - Provide the ability to use cam sulfur chemistry routines with trop_mozart - chemistry package. - - Provide the ability to use prescribed chemical constituents and sources - in trop_mozart chemistry package. - - Fix bug in the offline driver on bluevista. - -Bugs fixed (include bugzilla ID): - #239 fv offline driver fails in cam on bluevista - -Describe any changes made to build system: - -Describe any changes made to the namelist: - - Added several namelist variables for trop_mozart chemistry package - for the flexable chemical mechanism implementation. These are: - - ! trop_mozart surface emissions: - character(len=256) :: srf_emis_specifier(pcnst) ! string array where each - ! string contains the constituent name and filepath separated by "->", e.g. - ! srf_emis_specifier = 'CO -> /path/CO_emis_file.nc','NO -> /path/NO_emis_file.nc',... - character(len=8) :: emis_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' - integer :: emis_date ! yyyymmdd for SERIAL(yyyy) or FIXED - integer :: emis_yr_offset ! yrs added to current model year for CYCLICAL - - ! trop_mozart chem sources(sinks): - character(len=256) :: ext_frc_specifier(pcnst) ! string array where each - ! string contains the constituent name and filepath separated by "->", e.g. - ! ext_frc_specifier = 'CO -> /path/CO_extfrc_file.nc','NO -> /path/NO_extfrc_file.nc',... - character(len=8) :: ext_frc_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' - integer :: ext_frc_date ! yyyymmdd for SERIAL(yyyy) or FIXED - integer :: ext_frc_yr_offset ! yrs added to current model year for CYCLICAL - - ! trop_mozart fixed lower boundary: - character(len=16) :: flbc_list(pcnst) ! list of constituents - character(len=256) :: flbc_file ! lower boundary data file - character(len=8) :: flbc_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' - integer :: flbc_date ! yyyymmdd for SERIAL(yyyy) or FIXED - integer :: flbc_yr_offset ! yrs added to current yr for CYCLICAL - - ! trop_mozart constituents that have dry deposition - character(len=16) :: drydep_list(pcnst) - - ! trop_mozart constituents that are constrained in the stratosphere - character(len=16) :: fstrat_list(pcnst) ! list of constituents - character(len=256) :: fstrat_file ! data file for fixed stratosphere constituents - character(len=256) :: trop_pause_file - - ! trop_mozart aerosol constituents that have wet deposition - character(len=16) :: aer_wetdep_list(pcnst) - - ! trop_mozart use CAM sulfur chemistry driver rather than mo_setsox - logical :: use_cam_sulfchem - ! trop_mozart use CAM prescribed ozone for radiation rather than trop_moz prescribed data - logical :: use_cam_ozone_data - ! trop_mozart use CAM prescribed green house gases for radiation rather than trop_moz prescribed data - logical :: use_cam_ghg_data - - ! trop_mozart prescribed constituents - character(len=256) :: tracer_cnst_file ! prescribed data file - character(len=256) :: tracer_cnst_filelist ! list of prescribed data files (series of files) - character(len=256) :: tracer_cnst_specifier(pcnst) ! string array where each - ! string contains the prescribed constituent name and field name in the data file separated by ":", e.g. - ! ext_frc_specifier = 'CO : CO_VMR','OH : OH_VMR',... - logical :: tracer_cnst_rmfile ! remove data file from local disk (default .false.) - integer :: tracer_cnst_ymd ! yyyymmdd - start date of the prescribed data (default is current model date) - integer :: tracer_cnst_tod ! start time of day (seconds) of the prescribed data (default is current model time) - - ! trop_mozart prescribed constituent sourrces/sinks - character(len=256) :: tracer_srcs_file ! prescribed data file - character(len=256) :: tracer_srcs_filelist ! list of prescribed data files (series of files) - character(len=256) :: tracer_srcs_specifier(pcnst) ! string array where each - ! string contains the constituent source name and field name in the data file separated by ":", e.g. - ! ext_frc_specifier = 'CO : CO_SRC','OH : OH_SRC',... - logical :: tracer_srcs_rmfile ! remove data file from local disk (default .false.) - integer :: tracer_srcs_ymd ! yyyymmdd - start date of the prescribed data (default is current model date) - integer :: tracer_srcs_tod ! start time of day (seconds) of the prescribed data (default is current model time) - - Replaced the namelist variables for the individual species emissions - files with the srf_emis_specifier variable. - - Replaced trop_mozart ub and lb variables for individual species with - corresponding specifier variables as described above. - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: - - atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 - atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 - atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 - atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 - -List all subroutines added and what they do: - - atm/cam/src/chemistry/trop_mozart/mo_chem_utls.F90 - provides helper functons to allow easier changes in chemical mechanisms - - atm/cam/src/chemistry/trop_mozart/mo_extfrc.F90 - provides the ability to include external (or prescribed) sources (or sinks) - - atm/cam/src/chemistry/trop_mozart/mo_flbc.F90 - applies fixed lower boundary conditions to constituents - - atm/cam/src/chemistry/trop_mozart/mo_fstrat.F90 - applies constraints to constituents in the stratosphere - - atm/cam/src/chemistry/trop_mozart/mo_sethet.F90 - replaces mo_wetdep module -- set heterogeneous reaction rates - - atm/cam/src/chemistry/trop_mozart/mo_synoz.F90 - implements synthetic ozone scheme in the stratosphere - - atm/cam/src/chemistry/trop_mozart/mz_aerosols_intr.F90 - handles the wet depostion of trop_mozart aerososl as well as the - operation of cam implemented sulfur chemistry routines on trop_mozart - constituents - - atm/cam/src/chemistry/trop_mozart/tracer_cnst.F90 - atm/cam/src/chemistry/trop_mozart/tracer_data.F90 - atm/cam/src/chemistry/trop_mozart/tracer_srcs.F90 - These provide the ability to use prescribed constituents as well as - sources for the trop_mozart chemical mechanism. - - atm/cam/src/chemistry/trop_mozart/rad_cnst_data_interface.F90 - Overrides the cam routines that set radiative constituents to prescribed - data to use trop_mozart prescribed data. - - atm/cam/src/physics/cam1/rad_cnst_data_interface.F90 - provides the chemistry packages the opportunity to override procedures - that set the radiative constituents from prescribed data - - atm/cam/src/dynamics/fv/advect_tend.F90 - Handles the computation and history output of advection tendency. - -List all existing files that have been modified, and describe the changes: - - atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - Change defualt upper boundary data files and dust input files. - - atm/cam/bld/cam_inparm.pm - Made changes to accommodate the namelist changes for the trop_mozart - chemistry package. - Set default aero_feedback=.false. since a special aerosol optics - file is required for dust. - - atm/cam/bld/config_trop_chem_mozart_defaults.xml - set prog_aero="dust,seasalt" and nadv=98 for default trop_mozart chemistry - - atm/cam/bld/configure - - allow prog_aero seasalt without dust for trop_mozart chemistry - - set cppdef DUST for seasalt or dust when trop_mozart is used - - disallow prog_aero sulfur and caer (carbon aerosols) when - trop_mozart is used - - atm/cam/src/chemistry/trop_mozart/chem_mods.F90 - atm/cam/src/chemistry/trop_mozart/chemistry.F90 - atm/cam/src/chemistry/trop_mozart/m_het_id.F90 - atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 - atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 - atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 - atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 - atm/cam/src/chemistry/trop_mozart/mo_constants.F90 - atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - atm/cam/src/chemistry/trop_mozart/mo_exp_sol.F90 - atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 - atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 - atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 - atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 - atm/cam/src/chemistry/trop_mozart/mo_jshort.F90 - atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 - atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 - atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 - atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 - atm/cam/src/chemistry/trop_mozart/mo_mass_xforms.F90 - atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 - atm/cam/src/chemistry/trop_mozart/mo_photo.F90 - atm/cam/src/chemistry/trop_mozart/mo_photoin.F90 - atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 - atm/cam/src/chemistry/trop_mozart/mo_rtlink.F90 - atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 - atm/cam/src/chemistry/trop_mozart/mo_setaer.F90 - atm/cam/src/chemistry/trop_mozart/mo_setext.F90 - atm/cam/src/chemistry/trop_mozart/mo_setinv.F90 - atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 - atm/cam/src/chemistry/trop_mozart/mo_setsoa.F90 - atm/cam/src/chemistry/trop_mozart/mo_setsox.F90 - atm/cam/src/chemistry/trop_mozart/mo_sim_dat.F90 - atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 - atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 - atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 - atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 - Changes in the trop_mozart chemistry are mostly for: - - the addition to SYNOZ/O3RAD ozone formulation and NH4/H2SO4 chemistry - - flexible namelist variables - - addition of helper functions to allow flexibility in terms of - chemical mechanisms facilitated by the chemical preprocessor - - atm/cam/src/chemistry/waccm_mozart/chemistry.F90 - interface changes that correspond to the interface changes of - trop_mozart/chemistry.F90 - - atm/cam/src/control/atm_comp_mct.F90 - Added a check to insure that dust constituents are in the - simulation before setting the dust surface fluxes. - - atm/cam/src/control/runtime_opts.F90 - Added several namelist variables for trop_mozart chemistry package - for the flexible chemical mechanism implementation (see above). - Added a check to not allow trace_gas = .true. when trop_mozart - chemistry package is used. - - atm/cam/src/dynamics/fv/dyn_comp.F90 - Changed the actual argument "dyn_state%grid" to "grid" to - subroutines metdata_dyn_init, get_met_fields and adjust_press. - - atm/cam/src/dynamics/fv/metdata.F90 - Removed the unnecessary ghosting of US and VS in the get_us_vs - subroutine. - - atm/cam/src/dynamics/fv/stepon.F90 - Added calls to compute and output advection tendencies. - - atm/cam/src/physics/cam1/aerosol_intr.F90 - Moved the call to hub2atm_sepopts to aerosol_register_cnst - from the dust_intr module -- this is to allow one to have - sea salt constituents without dust constituents. - Disabled the register call for dust and sea salts when - trop_mozart chemistry package is used. - Added the invocation of wet deposition of trop_mozart aerosols. - - atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 - added optical depth history outputs of carbon and dust - - atm/cam/src/physics/cam1/chemistry.F90 - interface changes that correspond to the interface changes of - trop_mozart/chemistry.F90 - - atm/cam/src/physics/cam1/convect_deep.F90 - add prognostics outputs of convective mass fluxes - - atm/cam/src/physics/cam1/drydep_mod.F90 - don't allow surface friction velocity returned from calcram - to be equal to zero -- zero fv causes a float point exception - in the dry deposition calculation of dust and sea salt - - atm/cam/src/physics/cam1/dust_intr.F90 - changes dust names - a lot of code cleanup - added the public interfaces: - dust_set_idx, dust_names, and dust_has_wet_dep - - atm/cam/src/physics/cam1/progseasalts_intr.F90 - changes sea salt names - a lot of code cleanup - added the public interfaces: - progseasalts_set_idx, progseasalt_names, and progseasalt_has_wet_dep - - atm/cam/src/physics/cam1/rad_constituents.F90 - added string variables to be used for radiative constituent names - - atm/cam/src/physics/cam1/radiation.F90 - replaced hard wired radiative constituent names with string - variables defined on the rad_constituents module - - atm/cam/src/physics/cam1/restart_physics.F90 - added a call to write and read chemistry data to restart file - - atm/cam/src/physics/cam1/sulchem.F90 - created a sulfur chemistry driver seperate from the wet deposition - -- this gives the trop_mozart chemistry the opportunity to use - the "cam" sulfur chemistry routines without the wet deposition. - - atm/cam/src/physics/cam1/sulfur_intr.F90 - moved some of the addfld calls to sulchem.F90 -- where the - fields are output to history - - atm/cam/src/physics/waccm/chemistry.F90 - interface changes that correspond to the interface changes of - trop_mozart/chemistry.F90 - - drv/seq_flds/dust/seq_flds_mod.F90 - corrected fortran syntax errors and made changes for ibm compile - -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. - -bluevista: - -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 5 -These failures are expected due to changes in trop_mozart chemistry package. - -tempest: All Pass - -bangkok/lf95: All Pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_40 -Originator(s): eaton -Date: Tue Nov 7 10:19:16 MST 2006 -One-line Summary: Misc updates - -Purpose of changes: - -. Replace all occurances of 273.16 either by SHR_CONST_TKFRZ or by tmelt - which is the CAM specific constant that's set to SHR_CONST_TKFRZ in the - physconst module. - -. Remove the cfort.h file -- put the Fortran name mangling CPP macro into - CAM and SCAM's configure. - -. Remove cfort.h from the timing library. This required creating a new - trunk_tag for the timing library (timing_061028) and updating CAM's - external property to use it. - -. Update MCT to trunk_tag MCT2_2_3_061018. - -. Update CLM to trunk_tag clm3_expa_76. - -. Remove excessive info/debug print statements (there is more to do). - -. Fix bug (introduced at cam3_3_34) to enable running w/ HOMME dycore. - - -Bugs fixed (include bugzilla ID): - -. bugID 224 -- fix for SHR_CONST_TKFRZ - -Describe any changes made to build system: none - -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: - -. possible performance improvements on certain platforms due to update of - MCT and CLM externals - -Code reviewed by: eaton - -List all subroutines eliminated: - - atm/cam/src/utils/cfort.h - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -. SHR_CONST_TKFRZ mods in: - models/atm/cam/src/physics/cam1/stratiform.F90 - models/atm/cam/src/physics/cam1/wetdep.F90 - models/atm/cam/src/physics/cam1/sulchem.F90 - models/atm/cam/src/physics/cam1/water_isotopes.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - -. mods to remove cfort.h in: - models/atm/cam/bld/configure - models/atm/cam/bld/Makefile.in - models/atm/cam/tools/scam/configure - models/atm/cam/src/control/get_memusage.c - models/atm/cam/src/control/linebuf_stdout.c - models/atm/cam/src/control/uselbuf.c - models/utils/timing/f_wrappers.c # create trunk_tag timing_061028 - -. update external for timing library, MCT, and CLM - models/SVN_EXTERNAL_DIRECTORIES - models/utils/SVN_EXTERNAL_DIRECTORIES - -. remove excessive info print statements - models/atm/cam/src/physics/cam1/phys_grid.F90 - models/atm/cam/src/control/cam_history.F90 - -. Replace deprecated float intrinsic by real - models/atm/cam/src/control/interpolate_data.F90 - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluevista: All PASS except expected failures of offline trop_mozart tests: - -038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 -039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: BFB - -=============================================================== -=============================================================== - -Tag name: cam3_3_39 -Originator(s): mvertens -Date: Fri Nov 3 16:40:37 MST 2006 -One-line Summary: Top level driver now invokes cam as one run phase - -Purpose of changes: To have CAM called as one run phase from the top level driver. -This is necessary if the surface components are to couple to cam at frequencies -other than the cam time step (a feature that will be required for a sequential CCSM). - -Bugs fixed (include bugzilla ID): #255 - -Describe any changes made to build system: None - -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: eaton - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - M atm/cam/tools/scam/scm_init/init_model.F90 - M atm/cam/tools/scam/scm_init/scam_run.F90 - M atm/cam/src/control/atm_comp_mct.F90 - M drv/seq_mct_drv/seq_ccsm_drv.F90 - - Seq_ccsm_drv.F90 and scam_run.F90 will now call only one run phase of cam. - The basic idea is that the first time the cam run phase is called outside - of the time loop, it will only call tphysbc. Within the run loop the cam - mct levelrun phase will call tphysac, update the cam time and then call tphysbc. - - M drv/seq_mct/seq_domain_mct.F90 - - removed extra writes - - M drv/seq_mct/seq_flux_mct.F90 - - fixed bug #255 - - M drv/seq_flds/dust/seq_flds_mod.F90 - M drv/seq_flds/default/seq_flds_mod.F90 - M drv/seq_flds/gensom/seq_flds_mod.F90 - M drv/seq_flds_indices/seq_flds_indices.F90 - - Added Foxx_salt to drv->ocn fields - Note needed now, but will be needed when pop is used for active ocn - - M drv/seq_mct/mrg_x2o_mct.F90 - - Fixed bugs for fields needed in merging when active ocean will be - utilized - - M ice/csim4/ice_data.F90 - M ice/csim4/ice_dh.F - M ice/csim4/ice_srf.F90 - M ice/csim4/ice_comp.F90 - M atm/cam/src/control/runtime_opts.F90 - M atm/cam/src/control/cam_control_mod.F90 - - moved input namelist variables prognostic_icesnow and reset_csim_iceprops - from ice_dh to cam_control_mod.F90. This will make it possible to replace - cam-csim with cice4. - -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. - -bluevista: -019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 -- this test failed due to a sign change implemented for the latent/sensible - oi gensom fluxes (this was a bug introduced in cam3_3_37 that did not get picked - up in the testing. -038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 -039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 -- these tests began failing with the upgrade of the compilers on bluevista - around 060918...a retest of a previous tag (cam3_3_28) where these tests - had passed, showed these tests now fail as well...it fails run-time as it - tries to read in the met data...see bug #239 - -tempest: All tests passed except for -021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 -- this tested failed due to the same gensom bug fix as appeared in bluevista - test 19 - -bangkok/lf95: All tests passed - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: None, answers are bfb except for gensom oi diagnostics - -=============================================================== -=============================================================== - -Tag name: cam3_3_38 -Originator(s): mvr -Date: 20061027 -One-line Summary: mods to resolve naming conflict when cam is used in -a ccsm single-executable; bluevista replaces bluesky as required pretag -test platform; mods to conform to changes in ccsm's test scripts - -Purpose of changes: one more naming conflict in ccsm single-executable -that was overlooked; bluesky is scheduled for decommission by the end -of the year, so bluevista will now be the platform required for testing -cam prior to commits; ccsm changed its default behavior for cleanup -of files after successful tests - a change was made to specifically -turn off this cleanup and let cam's test scripts handle the cleanup - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: myself - -List all subroutines eliminated: -D models/atm/cam/src/control/restart.F90 -- just a rename required to clear up name conflict in ccsm single-executable - -List all subroutines added and what they do: -A + models/atm/cam/src/control/cam_restart.F90 -- newly named file and mods to clear up name conflict in ccsm single-executable -A models/atm/cam/test/system/tests_pretag_bluevista -- new file with test ids to run by default for pretag testing on bluevista - -List all existing files that have been modified, and describe the changes: -M models/ocn/dom/ocn_comp.F90 -M models/ocn/som/ocn_comp.F90 -M models/ice/csim4/ice_comp.F90 -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/cam_comp.F90 -M models/drv/seq_mct/mrg_x2a_mct.F90 -- files modified to reflect name change: restart -> cam_restart - -M ChangeLog_template -M models/atm/cam/test/system/TSB.ccsm.sh -M models/atm/cam/test/system/TCT.ccsm.sh -M models/atm/cam/test/system/tests_posttag_bluesky -M models/atm/cam/test/system/test_driver.sh -M models/atm/cam/test/system/tests_posttag_bluevista -- mods to test scripts to have bluevista replace bluesky as the required - platform for pretag testing, utilize mods in ccsm scripts for the bluevista16 - machine definition, and turned off ccsm's cleanup functionality - -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. - -bluevista: -038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 -039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 -- these tests began failing with the upgrade of the compilers on bluevista - around 060918...a retest of a previous tag (cam3_3_28) where these tests - had passed, showed these tests now fail as well...it fails run-time as it - tries to read in the met data...see bug #239 - -tempest: -all pass - -bangkok/lf95: -all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_37 -Originator(s): mvertens -Date: Tue Oct 24 22:58:04 MDT 2006 -One-line Summary: use cpl6 ocn/atm flux calculation and surface flux sign convention - -Purpose of changes: To bring the current sequential system in line with the - concurrent system atm/ocn flux calculation, ocn and ice and merge functionalities, - and ccsm surface flux sign convention. In addition, to remove the need for the ice - and ocean components to know pass any landfrac information to the top level driver. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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 (to the best of my knowledge) - -Code reviewed by: mvertens, rjacob, tcraig - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - M ocn/dom/ocn_comp.F90 - - Removed all references to lwup - M ocn/dom/ocn_comp_mct.F90 - - Removed latr and lonr from dom_o - conversion is now done in seq_flux_mct.F90 - - Removed o2x_o(index_o2x_Faoo_lwup,ig) - (now done in atm/ocn flux calc) - - Removed setting of maxfrac to 1.-landfrac in dom_o - - M ocn/som/ocn_types.F90 - - Removed lwup from ocn_out type - M ocn/som/ocn_comp.F90 - - Removed computation of lwup (now done in atm/ocn flux calc) - - Removed lwup from restart file - M ocn/som/ocn_comp_mct.F90 - - Removed latr and lonr from dom_o - conversion is now done in seq_flux_mct.F90 - - Removed o2x_o(index_o2x_Faoo_lwup,ig) - (now done in atm/ocn flux calc) - - Removed setting of maxfrac to 1.-landfrac in dom_o - - Set sign convention to fluxes are positive downwards - - Moved multiplication of fswabs, shflx, lhflx, lwdn and lwup by (1.-aice) - to mrg_x2o_mct.F90 (this is consistent now with ocn merging in cpl6) - - M ice/csim4/ice_types.F90 - - Made cflx component of ice_out one-dimensional - - Made qbot component of ice_in one-dimensional - - Removed reference to pcnst - M ice/csim4/ice_srf.F90 - - Fluxes are now positive downwards for lwup, shflx, lhflx, taux, tauy, qflx - - Removed setting of non-water constituent fluxes to zero - - Arguemnts qbot and qflx no longer depend on pcnst+pnats - M ice/csim4/ice_diagnostics.F - - Made qbot component of ice_in one-dimensional - M ice/csim4/ice_comp.F90 - - Sign convention for lwup is now that fluxes are positive downwards - - Removed references to aqua-planet - M ice/csim4/ice_comp_mct.F90 - - Removed i2x_i%rAttr(index_i2x_Si_aice,ig) and set i2x_i%rAttr(index_i2x_Si_ifrac,ig) - to now correspond to fraction of ice with respect to ocean part of gridcell - - M atm/cam/test/system/test_driver.sh - - Updates to lightning and bluevista tests - - Replaced x2a_a%rAttr(index_x2a_Faoo_lwup,n) with x2a_a%rAttr(index_x2a_Faox_lwup,n) - - M atm/cam/src/control/atm_comp_mct.F90 - - Sign convention is that all fluxes from driver are positive downwards - - M drv/seq_flds/dust/seq_flds_mod.F90 - M drv/seq_flds/default/seq_flds_mod.F90 - M drv/seq_flds/gensom/seq_flds_mod.F90 - M drv/seq_flds_indices/seq_flds_indices.F90 - - Added fields and indices to get closer to cpl_fields_mod. This involved adding: - 'So_u' ! velocity, zonal DEF - 'So_v' ! velocity, meridional DEF - 'So_s' ! salinity DEF - 'So_dhdx' ! surface slope, zonal DEF - 'So_dhdy' ! surface slope, meridional DEF - 'Si_ifrac' ! state: ice fraction wrt ocean DEF - 'Sa_pslv' ! state: sea level pressure DEF - 'Foxx_lwup' ! heat flux: long-wave up DEF - 'Foxx_prec' ! water flux: rain+snow DEF - 'Foxx_snow' ! water flux: snow DEF - 'Foxx_rain' ! water flux: rain DEF - 'Foxx_evap' ! water flux: evap DEF - 'Foxx_meltw' ! water flux: melt DEF - 'Forr_roff' ! water flux: runoff DEF - 'Faoo_lwup' ! shortwave: net absorbed DEF - 'Faox_lwup' ! upward longwave heat flux DEF - and removed Si_aice and changed the previous functionality of Si_ifrac - Some of the above fields are not currently used - but are place holders for - when the ccsm components will be put in. - - M atm/cam/tools/scam/scm_init/init_model.F90 - - Added domain information to mapping initialization - - M drv/seq_mct_drv/seq_ccsm_drv.F90 - - Added domain information to mapping initialization - - M drv/seq_mct/mrg_x2a_mct.F90 - - Replaced index_o2x_Faoo_lwup with index_xao_Faox_lwup - - M drv/seq_mct/mrg_x2o_mct.F90 - - Merging functionality for input to ocn component is now same as cpl6 - - M drv/seq_mct/seq_domain_mct.F90 - - maxfrac_o = 1.- maxfrac_l is set for points where maxfrac_l > 0 and - maxfrac_l < 1. The same is true for maxfrac_i. As a result, the ocean - and ice components need not know the land fraction in the gridcell. - Furthermore, the ice fraction need only be scaled as that relative to - the total gridcell for merging functionality from drv->atm. The ice fraction - is only needed relative to the ocean part of the gridcell for merging - functionality from drv->ocn. - - M drv/seq_mct/seq_flux_mct.F90 - - xao_o%rAttr(index_xao_Faox_lwup,n) is now used (instead of lwup - being calculated by the ocean components) - - flux_albo is not identical to cpl6 code - - M drv/seq_mct/flux_ao.F90 - - This code is now the same as the flux_atmOcn routine in the cpl6 flux_mod.F90. - Both this routine and flux_atmOcn will be migrated to a csm_share/shr/shr_flux_mod.F90 - code base in upcoming tags. - - M drv/seq_mct/seq_mct_mod.F90 - - Added use aliases for mct_aVectimport Rattr and mct_aVect_exportRattr - - M drv/seq_mct/map_atmice_mct.F90 - - Obtain maxfrac_ice on atmosphere decomp, needed for merging to atmosphere grid - when all components are on same grid and when partial land cover in ice gridcell. - - Added domain information to initialization phase - - M drv/seq_mct/map_atmlnd_mct.F90 - M drv/seq_mct/map_iceocn_mct.F90 - M drv/seq_mct/map_atmocn_mct.F90 - - Added domain information to initialization phases - - SVN_EXTERNALS has been updated to clm3_expa_75 - M lnd/clm2/src/main/clm_time_manager.F90 - - Removed write statement to fort.30 - M lnd/clm2/src/main/lnd_comp_mct.F90 - - Changed sign convention of fluxes sent to driver to be consistent - with those used by concurrent ccsm - -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. - -bluesky: all tests passed except for - - 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 - 019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 - 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 - 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 - 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 - 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 5 - - the above were bfb except for the TREFHT output (which is not totally different) - - 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - - the above represent round-off level diffs for som tests - -tempest: all tests passed except for - - 004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 - 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 - 021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 - 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 - 035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 - - the above were bfb except for the TREFHT output (which is not totally different) - - 007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 - - the above represent round-off level diffs for som tests - -bangkok/lf95: all tests passed except for - - 004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 - 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 - 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 - 032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 - - the above were bfb except for the TREFHT output (which is not totally different) - - 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 - 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 - 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - - the above represent round-off level diffs due to higher optimization levels - than the 9 timestep tests - - 008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 - 036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 - - the above represent round-off level diffs for som tests - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- nature of change (larger than roundoff but same climate) - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - -- source tag (all code used must be in the repository): - cam3_3_37 -- platform/compilers: - ibm (bluesky) -- configure commandline: - configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 -gensom -- build-namelist command (or complete namelist): - &ccsm_inparm - case_name = 'cam3_3_34_nonbfb_fv4x5dom' - start_type = "startup" - / - &timemgr_inparm - atm_cpl_dt = 1800 - orb_iyear_ad = 1950 - restart_option= 'monthly' - start_ymd = 10101 - stop_n = 4000 - stop_option = 'ndays' - / - &cam_inparm - absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' - aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' - bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' - bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' - bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' - bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' - dtime = 1800 - ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0001-01-01_4x5_L26_c060608.nc' - / - &clm_inparm - dtime = 1800 - fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' - fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' - / - -MSS location of output: - /MVERTENS/csm/cam3_3_34_nonbfb_fv4x5dom - -MSS location of control simulations used to validate new climate: - /MVERTENS/csm/cam3_3_34_nonbfb_fv4x5dom_0 - -URL for AMWG diagnostics output used to validate new climate: -http://www.cgd.ucar.edu/cms/rneale/runs/cam/cam3_3_34_nonbfb_fv4x5dom-cam3_3_34_nonbfb_fv4x5dom_0/ -=============================================================== -=============================================================== - -Tag name: cam3_3_36 -Originator(s): mvertens -Date: Tue Oct 24 21:58:40 MDT 2006 -One-line Summary: non-bfb changes corresponding to cam3_3_37 - -Purpose of changes: to create the minimal code base that generates the - greater than round-off changes in cam3_3_37. Since cam3_3_37 will - contain number round-off level changes for som, it is useful to isolate - the few pieces of code that produced the greater than round-off differences.a - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: mvertens - M models/ocn/dom/ocn_comp.F90 - - Computation of lwup is occuring before temperature is updated. This is - now consistent with obtaining lwup from atm/ocn flux computation. This - will ensure that all fluxes in atm/ocn flux computation (including lwup) - are based on the same surface temperature. - M models/ocn/som/ocn_comp.F90 - - No longer multiplying onf by 1.-aice. Now doing this to each component of - onf in ocn_comp_mct.F90 - M models/ocn/som/ocn_comp_mct.F90 - - Now multiplying Foxx_melth, Foxx_swnet, Foxx_sen, Foxx_lat and Foxx_lwdn, - and lwup by 1.-aice. - M models/atm/cam/src/control/atm_comp_mct.F90 - - At first time step determine the longwave up flux from the surface - temperature. This is identical to what is being done in ccsm_msg.F90 - M models/drv/seq_mct/seq_flux_mct.F90 - - Put in computation to no longer require lat/lon to be passed in radians - from the ocean domain. Ocean domain will now pass lat/lon in degrees and - will convert to radians. - - Set ocean albedos to 1. when coszen < 0. - M models/drv/seq_mct/flux_ao.F90 - - Set umin to 0.5_r8 - This is the only answer changing modification between this code and the - atm/ocn flux calcuation code in cpl6. The goal is for both the concurrent - and sequential ccsm to use the same atm/ocn flux calculation code base. - Note that the diagnostic TREF will be totally different when the cpl6 - atm/ocn flux calculation is utilized - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -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. - -bluesky: all passed except for following baseline comparisons - 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 7 - 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 - 019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 - 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 - 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 - 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 - 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 - 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 7 - 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 - -tempest: all passed except for following baseline comparisons - 004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 5 - 007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 5 - 009 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 5 - 012 bl135 TBL.sh e32dh idphys 9 ...................................FAIL! rc= 5 - 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 5 - 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 5 - 021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 - 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 5 - 026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 5 - 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 5 - 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 5 - 035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 5 - 038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 5 - 040 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 5 - 043 bl535 TBL.sh s32dh idphys 9 ...................................FAIL! rc= 5 - 045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 5 - -bangkok/lf95: all passed except for following baseline comparisons - 004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 - 008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 - 010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 7 - 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 - 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 - 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 - 026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 - 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 - 032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 - 036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 - 038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 7 - 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- nature of change (larger than roundoff but same climate) - see complete documentation of runs to evaluate changes in cam3_3_37 tag info - -=============================================================== -=============================================================== - -Tag name: cam3_3_35 -Originator(s): Jim Edwards -Date: 10-11-2006 -One-line Summary: homme dycore development, replacement of cam common blocks - -Purpose of changes: development, code clean-up - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: refined build support for target_os=bgl - -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: - -Code reviewed by: self - -List all subroutines eliminated: -D 2094 models/atm/cam/src/control/comtfc.h -D 2094 models/atm/cam/src/control/comfft.h -D 2094 models/atm/cam/src/control/comctl.h -D 2094 models/atm/cam/src/control/comqfl.h -D 2094 models/atm/cam/src/control/perturb.h -D 2094 models/atm/cam/src/physics/cam1/comsol.h -D 2094 models/atm/cam/src/physics/cam1/comtsc.h -D 2094 models/atm/cam/src/physics/cam1/comadj.h - -List all subroutines added and what they do: -These are data modules which replace the common blocks eliminated above, -because the fv_control_mod contains namelist variables it needs to be compiled -regardless of dycore - thus it's location in the control directory. - -A + - models/atm/cam/src/control/cam_control_mod.F90 -A + - models/atm/cam/src/control/fv_control_mod.F90 -A + - models/atm/cam/src/dynamics/sld/sld_control_mod.F90 -A + - models/atm/cam/src/dynamics/eul/eul_control_mod.F90 - - -List all existing files that have been modified, and describe the changes: -Changes related to the continuing development of the homme dycore: -M 2094 models/atm/cam/src/dynamics/homme/external/forcing_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/parallel_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/prim_state_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/element_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/prim_advection_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/dof_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/bndry_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/diffusion_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/prim_advance_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/baroclinic_inst_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/external/edge_mod.F90 -M 2094 models/atm/cam/src/dynamics/homme/README -M 2094 models/atm/cam/src/dynamics/homme/dp_coupling.F90 -M 2094 models/atm/cam/src/dynamics/homme/stepon.F90 -M 2094 models/atm/cam/src/dynamics/homme/inidat.F90 -M 2094 models/atm/cam/src/dynamics/homme/dyn_comp.F90 -M 2094 models/atm/cam/src/dynamics/homme/restart_dynamics.F90 -M 2094 models/atm/cam/src/dynamics/homme/inital.F90 -C 2094 models/ocn/dom/sst_data.F90 -M 2094 models/atm/cam/tools/interpic_new/README -M 2094 models/atm/cam/bld/configure -M 2094 models/atm/cam/bld/Makefile.in -M 2094 models/atm/cam/src/control/cam_history.F90 -M 2094 models/atm/cam/src/utils/abortutils.F90 -M 2094 models/atm/cam/src/physics/cam1/tphysidl.F90 - -Changes related to the elemination of common blocks (note: there is some overlap in these lists): -C 2094 models/ocn/dom/sst_data.F90 -M 2094 models/ocn/dom/ocn_comp.F90 -M 2094 models/ocn/som/somint.F90 -M 2094 models/ocn/som/ocn_comp.F90 -M 2094 models/ocn/som/somini.F90 -M 2094 models/ice/csim4/ice_data.F90 -C 2094 models/ice/csim4/ice_comp.F90 -M 2094 models/atm/cam/tools/scam/scm_init/init_model.F90 -M 2094 models/atm/cam/tools/scam/scm_init/forecast.F90 -M 2094 models/atm/cam/tools/scam/scm_init/inital.F90 -M 2094 models/atm/cam/tools/scam/scm_init/readiopdata.F90 -M 2094 models/atm/cam/src/control/readinitial.F90 -M 2094 models/atm/cam/src/control/history_defaults.F90 -M 2094 models/atm/cam/src/control/runtime_opts.F90 -M 2094 models/atm/cam/src/control/ncdio_atm.F90 -M 2094 models/atm/cam/src/control/srfxfer.F90 -M 2094 models/atm/cam/src/control/restart.F90 -M 2094 models/atm/cam/src/control/startup_initialconds.F90 -M 2094 models/atm/cam/src/control/history_scam.F90 -C 2094 models/atm/cam/src/control/cam_comp.F90 -M 2094 models/atm/cam/src/control/cam_history.F90 -M 2094 models/atm/cam/src/physics/cam1/initindx.F90 -M 2094 models/atm/cam/src/physics/cam1/zenith.F90 -M 2094 models/atm/cam/src/physics/cam1/radiation.F90 -M 2094 models/atm/cam/src/physics/cam1/tphysbc.F90 -M 2094 models/atm/cam/src/physics/cam1/check_energy.F90 -M 2094 models/atm/cam/src/physics/cam1/restart_physics.F90 -M 2094 models/atm/cam/src/physics/cam1/cam_diagnostics.F90 -M 2094 models/atm/cam/src/physics/cam1/phys_gmean.F90 -M 2094 models/atm/cam/src/physics/cam1/stratiform.F90 -M 2094 models/atm/cam/src/physics/cam1/physics_types.F90 -M 2094 models/atm/cam/src/physics/cam1/radlw.F90 -M 2094 models/atm/cam/src/physics/cam1/tsinti.F90 -M 2094 models/atm/cam/src/physics/cam1/co2_data_flux.F90 -M 2094 models/atm/cam/src/physics/cam1/physpkg.F90 -M 2094 models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 -M 2094 models/atm/cam/src/physics/cam1/dadadj.F90 -M 2094 models/atm/cam/src/physics/cam1/chemistry.F90 -M 2094 models/atm/cam/src/physics/cam1/phys_buffer.F90 -M 2094 models/atm/cam/src/physics/cam1/ramp_scon.F90 -M 2094 models/atm/cam/src/physics/cam1/phys_grid.F90 -M 2094 models/atm/cam/src/physics/cam1/advnce.F90 -M 2094 models/atm/cam/src/physics/cam1/tphysac.F90 -M 2094 models/atm/cam/src/physics/cam1/zm_conv.F90 -M 2094 models/atm/cam/src/physics/cam1/cldwat.F90 -M 2094 models/atm/cam/src/physics/waccm/nlte_fomichev.F90 -M 2094 models/atm/cam/src/physics/waccm/chemistry.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/solvar_interface.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_apex.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/efield.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 -M 2094 models/atm/cam/src/chemistry/waccm_mozart/exbdrift.F90 -M 2094 models/atm/cam/src/dynamics/sld/spegrd.F90 -M 2094 models/atm/cam/src/dynamics/sld/linemsdyn.F90 -M 2094 models/atm/cam/src/dynamics/sld/initcom.F90 -M 2094 models/atm/cam/src/dynamics/sld/scanslt.F90 -M 2094 models/atm/cam/src/dynamics/sld/inidat.F90 -M 2094 models/atm/cam/src/dynamics/sld/dyn_comp.F90 -M 2094 models/atm/cam/src/dynamics/sld/hordif.F90 -M 2094 models/atm/cam/src/dynamics/sld/spetru.F90 -M 2094 models/atm/cam/src/dynamics/sld/scan2.F90 -M 2094 models/atm/cam/src/dynamics/sld/restart_dynamics.F90 -M 2094 models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 -M 2094 models/atm/cam/src/dynamics/eul/spegrd.F90 -M 2094 models/atm/cam/src/dynamics/eul/initcom.F90 -M 2094 models/atm/cam/src/dynamics/eul/linemsdyn.F90 -M 2094 models/atm/cam/src/dynamics/eul/scanslt.F90 -M 2094 models/atm/cam/src/dynamics/eul/inidat.F90 -M 2094 models/atm/cam/src/dynamics/eul/dyn_comp.F90 -M 2094 models/atm/cam/src/dynamics/eul/hordif.F90 -M 2094 models/atm/cam/src/dynamics/eul/spetru.F90 -M 2094 models/atm/cam/src/dynamics/eul/scan2.F90 -M 2094 models/atm/cam/src/dynamics/eul/restart_dynamics.F90 -M 2094 models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 -M 2094 models/atm/cam/src/dynamics/fv/pmgrid.F90 -M 2094 models/atm/cam/src/dynamics/fv/initcom.F90 -M 2094 models/atm/cam/src/dynamics/fv/dryairm.F90 -M 2094 models/atm/cam/src/dynamics/fv/inidat.F90 -M 2094 models/atm/cam/src/dynamics/fv/dyn_comp.F90 -M 2094 models/atm/cam/src/dynamics/fv/inital.F90 -M 2094 models/atm/cam/src/dynamics/fv/stepon.F90 -M 2094 models/atm/cam/src/dynamics/fv/restart_dynamics.F90 -M 2094 models/atm/cam/src/dynamics/fv/metdata.F90 -M 2094 models/atm/cam/src/advection/slt/difcor.F90 -C 2094 models/drv/seq_mct/mrg_x2l_mct.F90 - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: none - -tempest: none - -bangkok/lf95: none - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., - - what code configurations: - what platforms/compilers: - nature - of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_34 -Originator(s): Will Sawyer -Date: Wed Oct 11 03:05:07 MDT 2006 -One-line Summary: Reduce init time (#213), clean up FV constants (#214), allocate status (#166) - -Purpose of changes: - - o PILGRIM initialization time has been reduced (Bug #213). This has - been achieved by removing the communications for XZY index and replacing - them by XYZ communication patterns. These are assembled by generating - an XY decomposition comm. pattern, then extending it to 3D in the - (undistributed) Z direction. This reduces initialization time, drastically - in the case of high resolution. Note that this change required extensive - restructuring of cam_history. - - o The status of allocation of large 3-D arrays in FV is checked (Bug #166) - - o FV constants were cleaned up in a consistent way (Bug #214), e.g., - - real(r8), parameter :: D0_0 = 0.0_r8 - real(r8), parameter :: D0_5 = 0.5_r8 - real(r8), parameter :: D1_0 = 1.0_r8 - real(r8), parameter :: D1_5 = 1.5_r8 - -Bugs fixed (include bugzilla ID): #166, #213, #214 - -Describe any changes made to build system: none - -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: FV initialization time is - now much faster, especially so for high resolutions. - -Code reviewed by: myself - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/src/control/cam_history.F90: Extensive changes to use - XYZ indexing to gather and scatter arrays. Now only one type of - PILGRIM gather/scatter operation (fv_gather_??, fv_scatter_??) - is used. Addition of routines to copy the *local* portion of the - array from XYZ -> XZY (loc_xyz_to_xzy) and XZY -> XYZ (loc_xzy_to_xyz) - decompositions. Performing this local give a minor performance - improvement. Overall this reduces the length and complexity of the - module. Treats the writing of the staggered U-winds field (which - has 1 less latitude than other fields) in a cleaner way. Now - writes all fields to restart consistently in XYZ indexing. - - models/atm/cam/src/dynamics/fv/benergy.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/cd_core.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/d2a3dijk.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/d2a3dikj.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/dp_coupling.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/dyn_grid.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/dynconst.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/epvd.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/fill_module.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/fv_prints.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/geopk.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/inital.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/initcom.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/mapz_module.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/mean_module.F90: new treatment of constants, e.g., - models/atm/cam/src/dynamics/fv/metdata.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/p_d_adjust.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/par_vecsum.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/pfixer.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/pft_module.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/stepon.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/sw_core.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/te_map.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/trac2d.F90: new treatment of constants - models/atm/cam/src/dynamics/fv/tp_core.F90: new treatment of constants, cleaning - models/atm/cam/src/dynamics/fv/xpavg.F90: new treatment of constants - - models/atm/cam/src/dynamics/fv/dyn_comp.F90: new treatment of constants, test return - status of allocations - - models/atm/cam/src/dynamics/fv/inidat.F90: new treatment of constants, test return - status of allocations, use new naming scheme for scatter/gather comm. patterns - - models/atm/cam/src/dynamics/fv/restart_dynamics.F90: new treatment of constants; - use new naming scheme for scatter/gather comm. patterns - - models/atm/cam/src/dynamics/fv/io_dist.F90: extensive cleaning. Removed old - methods for writing and reading; scheme is now consistent with - fv_read/write_r4/r8/i4 and fv_scatter/gather_r4/r8/i4 routines. - - models/atm/cam/src/dynamics/fv/dynamics_vars.F90: removed (unused) ESMF code - revised naming scheme for gather/scatter comm. patterns now consistent, - added PI argument to dynamics_init, dynpkg_init; XYZ patterns generated - by XY pattern with extension in Z; new treatment of constants - -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. - -bluesky: Failed on tests 030 (bl336), 034 (bl351), 055 (cs998), probably - because of new treatment of constants, specifically removal of - 4.0*atan(1.0) as definition of PI. Perturbation growth tests by - Brian Eaton indicate that these are roundoff differences. Check-in - OK'ed by Mathew Rothstein. - -tempest: passes all tests - -bangkok/lf95: passes all tests - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_3_33 (previous tag) - -Summarize any changes to answers, i.e., -- what code configurations: WACCM, FV -- what platforms/compilers: Bluesky -- nature of change (roundoff; larger than roundoff but same climate; new - climate): roundoff - -If bitwise differences were observed, how did you show they were no worse -than roundoff? perturbation growth test (by Eaton) - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -=============================================================== - -Tag name: cam3_3_33 -Originator(s): eaton -Date: Fri Oct 6 16:22:01 MDT 2006 -One-line Summary: Enable linking to external ESMF library - -Purpose of changes: - -. Changes to configure and Makefile.in to allow linking to ESMF library - This can be done by: - 1. setting the new -esmf_libdir option, - or - 2. by setting the environment variable ESMF_LIBDIR. - - Either of these methods will cause configure to check that the - files libesmf.a or libesmf.so and esmf.mk are present in the specified - directory. The esmf.mk file is produced when the ESMF library is built - and contains Makefile macros that CAM's Makefile will reference when - compiling and linking to the external library. - -. Remove interactive mode from configure. - -. Cleanup of Makefile.in. Remove untested SUN and OSF1 sections. - -Bugs fixed (include bugzilla ID): - -. Fix bug in fv/inidat.F90 applying perturbation to initial temperature - field. - -. Fixed SCAM build on bangkok. - -Describe any changes made to build system: - -. Add ability to link to an external ESMF library. The default remains to use - the WRF_ESMF time manager code. - -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: eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -models/atm/cam/bld/configure -. Add capability to specify that an external ESMF library should be used. -. Add test for linking to the ESMF library to test suite invoked by - configure's -test option. -. Add ability to try running a successfully built test. This helps to - identify problems related shared libraries not being found. -. Remove interactive mode. -. Simplify verbose mode; now set by "-v" option without a numeric argument. - -models/atm/cam/bld/Makefile.in -. Include the esmf.mk file if ESMF_LIBDIR is defined. -. use ESMF_F90COMPILEPATHS from esmf.mk to set search path for esmf module file . -. Use ESMF_F90LINKPATHS and ESMF_F90ESMFLINKLIBS from esmf.mk to set search - path and library name for linking to external esmf lib. -. Remove 32-bit addressing option for AIX. If this is needed somewhere it - should be re-implemented in configure rather than by requiring editing of the - Makefile. -. Remove unused SUN and OSF1 sections. -. Substantial cleanup. Tried to eliminate duplicated code from the - architecture specific sections of the Makefile. Tried to organize the - architecture specific sections to more or less follow the same order of - setting macros. - -models/atm/cam/src/dynamics/fv/inidat.F90 -. fix bug in how perturbation was applied to initial temperature field. - -models/atm/cam/test/system/test_driver.sh -. increase to bluevista time limit from 2:28 to 4:28 to account for - slowdown in compilation times -. update pathscale compiler version to 2.4 from 2.2.1 (on lightning) - -models/atm/cam/tools/scam/ui/configure -. add -lpgc to the LINK_LIBS macro in the Linux section. - -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. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_32 -Originator(s): mvertens -Date: Mon Oct 2 21:03:25 MDT 2006 -One-line Summary: Have SCAM driver determine the fractional - land cover in any gridcell. - -Purpose of changes: remove SCAM if-defs in lnd_comp_mct.F90 - and put the logic in SCAM driver. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: erik, eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - M ocn/dom/ocn_comp_mct.F90 - - removed SCAM if-def - M ocn/som/ocn_comp_mct.F90 - - removed SCAM if-def - M atm/cam/tools/scam/scm_init/init_model.F90 - M atm/cam/tools/scam/scm_init/scamMod.F90 - - changes enable SCAM to read in landfrac for the gridcell and determine - if the land model should be called - M SVN_EXTERNAL_DIRECTORIES - - updated to clm_exp_73 - M drv/seq_mct_drv/seq_ccsm_drv.F90 - - formatting change - M lnd/clm2/src/main/lnd_comp_mct.F90 - - removed SCAM if-defs - -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. - -bluesky: ALL TESTS PASSED -tempest: ALL TESTS PASSED -bangkok/lf95: ALL TESTS PASSED - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE -=============================================================== -=============================================================== - -Tag name: cam3_3_31 -Originator(s): mvertens -Date: Tue Sep 26 19:48:56 MDT 2006 -One-line Summary: made surface components mpi utilities and clm time manager independent of cam - -Purpose of changes: cam surface components no longer "use" cam communicator group settings - and clm no longer uses cam time manager when in COUP_CAM mode - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - M atm/cam/bld/clm_inparm.pm - M atm/cam/bld/SeqCCSM_namelist.pm - - added dtime to clm namelist input - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: eaton, tcraig, robj - -List all subroutines eliminated: none - -List all subroutines added and what they do: - - A ocn/dom/ocn_spmd.F90 - - determine communicator group and masterproc, iam, npes for ocn - A ocn/som/ocn_spmd.F90 - - determine communicator group and masterproc, iam, npes for ocn - A ice/csim4/ice_spmd.F90 - - determine communicator group and masterproc, iam, npes for ice - A drv/seq_mct/seq_communicator.F90 - - determine communicator group and masterproc, iam, npes for drv routines - -List all existing files that have been modified, and describe the changes: - - M ocn/dom/sst_data.F90 - - replace "use mpishorthand" with "use ocn_utils" - - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand - M ocn/dom/ocn_comp.F90 - - replace "use spmd_utils" with "use ocn_utils" - - ocn_mpicom now passed in as argument and used to initialize ocn communicator - group, masterproc, iam and npes - M ocn/dom/ocn_comp_mct.F90 - - ocn_mpicom now passed in as argument - - replaced call to module routine seq_init_SetgsMap with call to mct routine - mct_gsMap_init in order to initialize gsmap - - M ocn/som/mixed_layer.F90 - - replace "use mpishorthand" with "use ocn_utils" - - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand - M ocn/som/ocn_comp.F90 - - replace "use spmd_utils" with "use ocn_utils" - - ocn_mpicom now passed in as argument and used to initialize ocn communicator - group, masterproc, iam and npes - - fixed bug in conservation check equation (this is turned off in all tests) - ocn_in(c)%netfocn replaced with ocn_in(c)%melth - M ocn/som/somini.F90 - - replace "use mpishorthand" with "use ocn_utils" - - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand - M ocn/som/ocn_comp_mct.F90 - - ocn_mpicom now passed in as argument - - replaced call to module routine seq_init_SetgsMap with call to mct routine - mct_gsMap_init in order to initialize gsmap - - M ice/csim4/ice_data.F90 - - replace "use spmd_utils" with "use ice_utils" - - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand - M ice/csim4/print_coverage.F90 - - replace "use spmd_utils" with "use ice_utils" - M ice/csim4/ice_comp.F90 - - replace "use spmd_utils" with "use ice_utils" - - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand - M ice/csim4/ice_comp_mct.F90 - - added ICEID and mpicom_ice to input arguments - - replaced call to module routine seq_init_SetgsMap with call to mct routine - mct_gsMap_init in order to initialize gsmap - - M atm/cam/tools/scam/scm_init/init_model.F90 - - put in changes analogous to those in seq_ccsm_drv.F90 - M atm/cam/tools/scam/scm_init/scam_run.F90 - - separated calls to ocn_run_mct and atm/ocn flux calculation into two separate blocks - M atm/cam/tools/scam/scm_init/scamMod.F90 - - added dtime_out as argument to scam_clm_default_opts (see clm notes below - - M atm/cam/src/control/con_cam.F90 - - removed call to cam_init2 (call to cam_init1 now is call to cam_init) - - removed call to spmdinit - - mpicom now passed as argument to cam_init - M atm/cam/src/control/atm_comp_mct.F90 - M atm/cam/src/control/cam_comp.F90 - - removed cam_init2 and replaced cam_init1 with cam_init - - call to intht is now done on first call of cam_comp - M atm/cam/src/utils/spmd_utils.F90 - - no longer calls mpi_init when COUP_CSM ins not defined - - removed code-block for if-defined IRIX (no longer needed) - - mpicom_atm passed as now as argument - M atm/cam/src/utils/time_manager.F90 - - removed module variables perpetual_ymd and perpetual_run (no longer needed) - - M SVN_EXTERNAL_DIRECTORIES - - now using clm3_expa_73 - - clm3_expa_73 no longer uses the cam time manager and as a result dtime needs to be - specified explicitly in the clm namelist - - clm3_expa_73 also no longer obtains irad from the call to the cam routine radiation_get - as a result bugzilla #228 has been added - - M drv/seq_mct_drv/seq_ccsm_drv.F90 - - removed call to atm_init2 - - mpi now initialized in seq_ccsm_drv.F90 rather than in the cam routine spmdinit - - currently it is assumed that cam and all the surface components will utilize the global - communicator group - - mpicom_glob now passed as an argument to cam and the surface components - - replaced calls to mrg_x2*_alloc_mct with mrg_x2*_init_mct, and removed the original calls - to mrg_x2* - - M drv/seq_mct/seq_init_mct.F90 - - now calls mpi_init (rather than in cam routine spmdinit) - - removed routine seq_init_setgsmap (see above) - M drv/seq_mct/seq_domain_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - - removed explicit setting of mpicom=1 when SPMD is not defined - M drv/seq_mct/seq_flux_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - - removed explicit setting of mpicom=1 when SPMD is not defined - M drv/seq_mct/mrg_x2a_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - - replaced hard-wired copies for each field with mct call to mct_aVect_copy. - M drv/seq_mct/mrg_x2i_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - all common attribute vector components from one attribute vector to another. - - replaced hard-wired copies for each field with mct call to mct_aVect_copy (only - rain and snow are now hard-wired in the copy command). mct_aVect_copy will copy - - removed explicit setting of mpicom=1 when SPMD is not defined - M drv/seq_mct/mrg_x2l_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - - removed explicit setting of mpicom=1 when SPMD is not defined - - replaced hard-wired copies for each field with mct call to mct_aVect_copy. - M drv/seq_mct/mrg_x2o_mct.F90 - - replaced "use mpishorthand" with "use seq_comunicator" - - removed explicit setting of mpicom=1 when SPMD is not defined - -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. - -bluesky: ALL PASS -tempest: ALL PASS -bangkok/lf95: ALL PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE - -=============================================================== -=============================================================== - -Tag name: cam3_3_30 -Originator(s): Jim Edwards - Pat Worley (phys_grid) -Date: 09-21-2006 -One-line Summary: homme dycore development - -Purpose of changes: homme dycore development - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: added build for bluegene - -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: Edwards, Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: added dynamics/homme/external - -List all existing files that have been modified, and describe the changes: - - Improved documentation for creating initial and boundary files - for the homme dycore -M models/atm/cam/tools/interpic_new/README - - Added support for bluegene system at NCAR (frost) - and improved support for homme dycore. -M models/atm/cam/bld/configure -M models/atm/cam/bld/Makefile.in -M models/atm/cam/bld/namelist.pm -A + models/atm/cam/bld/filter_nl.pm -M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml -M models/atm/cam/bld/system_defaults.xml -A + models/atm/cam/bld/DefaultCTL_NL_Namelist.xml -M models/atm/cam/bld/cam_inparm.pm -M models/atm/cam/bld/resolution_parameters.xml -A + models/atm/cam/bld/ctl_nl.pm -M models/atm/cam/bld/config_cam_homme_defaults.xml -M models/atm/cam/bld/SeqCCSM_namelist.pm -A + models/atm/cam/bld/DefaultFILTER_NL_Namelist.xml - - Improved the interface that allows reading multiple namelists from multiple source code files. - Fixed a problem with the dyn_grid -> phys_grid mapping apparent in the homme dycore. - -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/control/con_cam.F90 -M models/atm/cam/src/control/atm_comp_mct.F90 -M models/atm/cam/src/control/cam_comp.F90 -M models/atm/cam/src/control/cam_history.F90 -M models/atm/cam/src/physics/cam1/boundarydata.F90 -M models/atm/cam/src/physics/cam1/physpkg.F90 -M models/atm/cam/src/physics/cam1/phys_grid.F90 -M models/atm/cam/src/physics/cam1/cldwat.F90 -M models/atm/cam/src/dynamics/fv/inital.F90 - -Continued development of the homme dycore: the external directory represents a - mirror of the files in repository - https://svn-homme-model.cgd.ucar.edu/trunk/src/share - -A + models/atm/cam/src/dynamics/homme/external -A + models/atm/cam/src/dynamics/homme/external/flops_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/filter_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/math_constants.F90 -A + models/atm/cam/src/dynamics/homme/external/forcing_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/stats.h -A + models/atm/cam/src/dynamics/homme/external/preq_init_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/interface.h -A + models/atm/cam/src/dynamics/homme/external/schedule_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/reduction_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/parallel_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/spacecurve_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/utils_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/derivative_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_state_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/dimensions_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/locate.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_restart_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/torus_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/quadrature_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/coordinate_systems_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/global_norms_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/control_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/element_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/time_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_si_ref_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/stats.F90 -A + models/atm/cam/src/dynamics/homme/external/hybvcoord_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/checksum_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_advection_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/directions.F90 -A + models/atm/cam/src/dynamics/homme/external/thread_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/dof_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/physical_constants.F90 -A + models/atm/cam/src/dynamics/homme/external/kinds.F90 -A + models/atm/cam/src/dynamics/homme/external/solver_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/restart_io_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/namelist_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/perfmodel_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/bndry_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/metis_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/params_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/field_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/diffusion_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/mass_matrix_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_advance_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/cg_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/prim_si_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/types_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/domain_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/gridgraph_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/metagraph_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/generic_list.F90 -A + models/atm/cam/src/dynamics/homme/external/ref_state_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/vertex_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/cube_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/physics_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/rotation_init.F90 -A + models/atm/cam/src/dynamics/homme/external/interpolate_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/linear_algebra_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/baroclinic_inst_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/edge_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/ll_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/vertical_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/timer.h -A + models/atm/cam/src/dynamics/homme/external/timer_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/state_mod.F90 -A + models/atm/cam/src/dynamics/homme/external/hybrid_mod.F90 -A + models/atm/cam/src/dynamics/homme/io_dist.F90 -M models/atm/cam/src/dynamics/homme/dyn_grid.F90 -M models/atm/cam/src/dynamics/homme/dp_coupling.F90 -M models/atm/cam/src/dynamics/homme/dyn_comp.F90 -M models/atm/cam/src/dynamics/homme/inidat.F90 -M models/atm/cam/src/dynamics/homme/stepon.F90 -M models/atm/cam/src/dynamics/homme/spmd_dyn.F90 -M models/atm/cam/src/dynamics/homme/inital.F90 - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: passed - -tempest: passed - -bangkok/lf95: passed - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_28 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: cam3_3_29 -Originator(s): jwolfe, eaton -Date: Wed Sep 20 17:08:08 MDT 2006 -One-line Summary: fix for single executable CCSM - -Purpose of changes: fix for single executable CCSM - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -In con_cam.F90 change this: - -#ifdef SINGLE_EXEC - call MPH_get_argument("THREADS", nthreads, "atm") - call OMP_SET_NUM_THREADS(nthreads) -#endif - -to this: - -#ifdef SINGLE_EXEC - call MPH_get_argument("THREADS", nThreads, "atm") -#ifdef _OPENMP - call OMP_SET_NUM_THREADS(nThreads) -#endif -#endif - -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. - -bluesky: not done - -tempest: not done - -bangkok/lf95: not done - -Tests not done because this change is inside an ifdef that isn't turned on -for any of CAM's current regression tests. - -=============================================================== -=============================================================== - -Tag name: cam3_3_28 -Originator(s): mvr, jwolfe -Date: 060914 -One-line Summary: implemented last remaining items needed for cam to -be included in a ccsm single-executable; bug fix to enable scam to compile - -Purpose of changes: ccsm single-executable required a few more mods, -including one name conflict that was overlooked; a compile-time bug was -introduced to the scam build in cam3_3_27 - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, eaton, mvertens - -List all subroutines eliminated: -D models/atm/cam/src/physics/cam1/diagnostics.F90 -- just a rename required to clear up name conflict in ccsm single-executable - -List all subroutines added and what they do: -A + models/atm/cam/src/physics/cam1/cam_diagnostics.F90 -- newly named file and mods to clear up name conflict in ccsm single-executable - -List all existing files that have been modified, and describe the changes: -M models/ice/csim4/ice_comp.F90 -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/control/con_cam.F90 -M models/atm/cam/src/physics/cam1/tphysbc.F90 -M models/atm/cam/src/physics/cam1/physpkg.F90 -- files modified to reflect name change: diagnostics -> cam_diagnostics - -M models/atm/cam/tools/scam/scm_init/init_model.F90 -- bug fix to enable scam to compile - -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. - -bluesky: -ALL PASS - -tempest: -ALL PASS - -bangkok/lf95: -ALL PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_27 -Originator(s): mvertens -Date: Mon Sep 11 21:44:10 MDT 2006 -One-line Summary: moved atm/ocn flux calculation to top level - -Purpose of changes: - -Moved the atmosphere/ocean flux calculation out of the ocn (dom/som) -models and up to the top level driver. This is a necessary stop in constructing -a sequential ccsm system. It will also enable the use of the cpl6 atm/ocn flux -calculation to be utilized in both the sequential and concurrent system. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -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: Probably none (this should be checked) - -Code reviewed by: eaton, erik (briefly) - -List all subroutines eliminated: - - D ocn/dom/albocean.F90 - - calculation now done in seq_flux_mct.F90 (see below) - D ocn/dom/print_coverage.F90 - - not used by any code in dom/ - D ocn/dom/parpbl.h - - only used in flxoce.F90 - which is no longer utilized - D ocn/dom/albedo.h - - not used by any code in dom/ - D ocn/dom/wtrc_flxoce.F90 - - moved to atm/cam/src/control - D ocn/dom/flxoce.F90 - - replaced by flux_ao routine (see below) - D ocn/dom/srfoce.F90 - - see below - - D ocn/som/albocean.F90 - - calculation now done in seq_flux_mct.F90 (see below) - D ocn/som/mixed_layer_globalcalcs.F90 - D ocn/som/ocn_srf.F90 - - ocn_srf.F90 and mixed_layer_globalcalcs.F90 merged into mixed_layer.F90 - D ocn/som/parpbl.h - - only used in flxoce.F90 - which is no longer utilized - D ocn/som/flxoce.F90 - - replaced by flux_ao routine (see below) - -List all subroutines added and what they do: - - A ocn/som/mixed_layer.F90 - - merge of mixed_layer_globalcalcs.F90 and ocn_srf.F90 - - A atm/cam/src/control/wtrc_flxoce.F90 - - moved computation of water tracer exchange from ocean into atmospheric code base - to reduce number of fields that need to be exchanged between ocean and atmosphere - - A drv/seq_mct/seq_flux_mct.F90 - A drv/seq_mct/flux_ao.F90 - - performs calculation previously done in dom/flxocn.F90 and som/flxocn.F90 - - also calculates ocean albedo and net shortwace absorbed by surface - -List all existing files that have been modified, and describe the changes: - - M ocn/dom/sst_data.F90 - M ocn/dom/ocn_types.F90 - M ocn/dom/ocn_comp.F90 - M ocn/dom/ocn_comp_mct.F90 - - see below - - M ocn/som/ocn_types.F90 - M ocn/som/ocn_comp.F90 - M ocn/som/ocn_comp_mct.F90 - - see below - - M atm/cam/tools/scam/scm_init/init_model.F90 - M atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 - M atm/cam/tools/scam/scm_init/scam_run.F90 - - put in changes to incorporate xao_o and xao_a along with calls to ocean/atmosphere - flux calculation from top level driver - - M atm/cam/src/control/ccsm_msg.F90 - M atm/cam/src/control/camsrfexch_types.F90 - - added "rho, netsw, ustar, re, ssq" as cam_out components in camsrfexch_types.F90 - M atm/cam/src/control/srfxfer.F90 - - removed rho and netsw as module variables in ccsm_msg.F90 - M atm/cam/src/control/atm_comp_mct.F90 - - introduced call to wtrc_flxoce if trace_water is true - - replace call to atm_init1_mct with atm_init_mct - - added ustar, re and ssq to x1a_a input - - M drv/seq_flds/dust/seq_flds_mod.F90 - M drv/seq_flds/default/seq_flds_mod.F90 - M drv/seq_flds/gensom/seq_flds_mod.F90 - - see below - - M drv/seq_mct_drv/seq_ccsm_drv.F90 - M drv/seq_mct/mrg_x2a_mct.F90 - - replaced o2x_a components that are now calculated in seq_flux_mct with xao_a components - M drv/seq_mct/mrg_x2i_mct.F90 - - removed index_o2x_So_tsocn from o2x_i and x2i_i - M drv/seq_mct/mrg_x2o_mct.F90 - - removed unnecessary a2x_o (this is now utilized in atm/ocn flux calculatin in seq_flux_mct) - M drv/seq_flds_indices/seq_flds_indices.F90 - - put in changes necessary for new atm/ocn flux computation at top level (see below) - - Summary: New attribute vectors xao_o and xao_a were introduced at the top level - to account for the calculation of the atm/ocn flux calculation. - - The routines dom/srfoce.F90, dom/flxoce.F90 and som/flxoce.F90 were replaced with - drv/seq_mct/flux_ao.F90 and drv/seq_mct/seq_flux_mct.F90. - The current form of flx_ao.F90 is such that it can be replaced with - the equivalent coupler code once sign conventions are addressed. (Note, - to increase clarity som/ocn_srf.F90 and som/mixed_layer_globalcalcs.F90 were - merged to create som/mixed_layer.F90). - - The ocean albedo calculation was also moved out of the ocean code and - put into seq_flux_mct.F90. As a result, ocn/som/albocean.F90 and - ocn/dom/albedo.h are no longer needed). The new routine to calculate ocean albedos, - seq_flux_albo_mct, is now contained in seq_flux_mct.F90. - - Ocean input information was significantly altered as a result of bringing the atm/ocn - flux calculation out of the ocean code base. The CAM DOM code now does not need any - input information. The CAM SOM code also requires significantly less input information - (only netsw from the atmosphere). - - It is important to note that lwup is still being computed in the ocean code. The - impact on SOM needs to be evaluated when moving this calculation to the - atm/ocean flux routine (as is done in the cpl6 code). - - The routine, wtrc_flxoce.F90 (isotope calculation) was moved out of the ocean model - and into atm/cam/src/control. The extra fields necessary to do this - computation (ustar, re, ssq) were added to the x2a attribute vector. - Note that this feature is currently not tested. - -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. - -bluesky: ALL PASSED -tempest: ALL PASSED -bangkok/lf95: ALL PASSED except for - 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 - 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 - 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - - the above difference appear to be roundoff errors that set in very early - - note that all other tests (including on all other platforms) produced bfb - baseline comparisons - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE -=============================================================== -=============================================================== - -Tag name: cam3_3_26 -Originator(s): mvertens -Date: Sun Sep 10 20:22:42 MDT 2006 -One-line Summary: Changes necessary for moving atm/ocn flux calc to top level - -Purpose of changes: - -Incorporated changes necessary to move the atm/ocn flux calculation out of the dom/som -ocean code and into the top level application driver. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -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: eaton - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M ocn/dom/ocn_comp.F90 - - Moved update of ocean temperature to after calculation of ocean surface/fluxes - This was done to be consistent with SOM update and to be able to move the atm/ocean - surface flux calculation to the top level driver without introducint cpp ifdefs. - This change also required writing the surface temperature to the ocean restart file. - This modification will result in greater than round-off level differences with cam3_3_25. - - removed the call to sstan and made the conversion from degees K to C explicit - - M ice/csim4/ice_types.F90 - M ice/csim4/ice_comp.F90 - M ice/csim4/ice_diagnostics.F - - Removed "precsc, precsl, precc, precl" as ice_in types and replaced them with "snow" - since only snow is needed as input to csim. This change should only result in round-off - level differences with cam3_3_25. - M ice/csim4/ice_comp_mct.F90 - - In addition to only using "snow" as input from the application driver, also removed - x2i_i%rAttr(index_x2i_So_tsocn,g) as input and instead used - x2i_i%rAttr(index_x2i_So_t,g)-SHR_CONST_TKFRZ. This change should only result in - round-off level differences with cam3_3_25. - - M drv/seq_flds/dust/seq_flds_mod.F90 - M drv/seq_flds/default/seq_flds_mod.F90 - M drv/seq_flds/gensom/seq_flds_mod.F90 - M drv/seq_mct/mrg_x2i_mct.F90 - M drv/seq_flds_indices/seq_flds_indices.F90 - - replaced 'Faxa_rainc', Faxa_rainl','Faxa_snowc','Faxa_snowl' as input to ice - with 'Faxa_rain' and :Faxa_snow' - - M drv/seq_mct/mrg_x2a_mct.F90 - - Removed calculation of ts for non-fractional grid box - This makes the merge consistent with that done in cpl6. - -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. - -bluesky: All tests passed (no baseline compare was done) -tempest: All tests passed (no baseline compare was done) -bangkok/lf95: All tests passed (no baseline compare was done) - -Summarize any changes to answers, i.e., -- what code configurations: see above -- what platforms/compilers: effects all platforms -- nature of change: larger than roundoff but same climate - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - -- source tag (all code used must be in the repository): cam3_3_26 -- platform/compilers: bluesky - -- configure commandline: -configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 - -- build-namelist command (or complete namelist): -&ccsm_inparm - case_name = 'cam3_3_24_fluxao_fv4x5dom' - start_type = "continue" -/ -&timemgr_inparm - atm_cpl_dt = 1800 - orb_iyear_ad = 1950 - restart_option = 'monthly' - start_ymd = 10101 - stop_n = 720 - stop_option = 'ndays' -/ -&cam_inparm - dtime = 1800 - absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' - aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' - bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' - bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' - bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' - bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' - ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0001-01-01_4x5_L26_c060608.nc' -/ -&clm_inparm - fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' - fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' -/ - -- MSS location of output: -/MVERTENS/csm/cam3_3_24_fluxao_fv4x5dom/hist (cam3_3_24+ current mods) - -MSS location of control simulations used to validate new climate: -/MVERTENS/csm/cam3_3_24_fluxao_fv4x5dom_0/hist (cam3_3_24) - -URL for AMWG diagnostics output used to validate new climate: -http://www.cgd.ucar.edu/cms/rneale/runs/cam/cam3_3_24_fluxao_fv4x5dom-cam3_3_24_fluxao_fv4x5dom_0/ - -=============================================================== -=============================================================== - -Tag name: cam3_3_25 -Originator(s): eaton -Date: Tue Sep 5 08:53:01 MDT 2006 -One-line Summary: add spun-up CLM initial files - -Purpose of changes: - -. add spun-up CLM initial files for FV 1.9x2.5. There are files for both - 0000-01-01 and 0000-09-01 - -. Fixed syntax of some attributes in the default XML files. XML requires - that attribute values are quoted, and there were unquoted values in the - files. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: - -. add spun-up CLM initial files for FV 1.9x2.5. There are files for both - 0000-01-01 and 0000-09-01 - -Describe any substantial timing or memory changes: none - -Code reviewed by: eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -. models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml -. models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml - -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. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE - -=============================================================== -=============================================================== - -Tag name: cam3_3_24 -Originator(s): mvr, jwolfe -Date: 060830 -One-line Summary: mods to eliminate naming conflicts in the ccsm -single executable; increased max fields for history tapes; -minor test driver enhancements - -Purpose of changes: the move to a single executable for running -cam as part of ccsm introduced some naming conflicts that needed -to be resolved; running cam in ccsm and turning on the chemistry -and co2 blew out the maximum allowed fields on a history tape - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, eaton - -List all subroutines eliminated: -D models/atm/cam/src/control/history.F90 -- renamed due to conflict in the ccsm single executable - -List all subroutines added and what they do: -A + models/atm/cam/src/control/cam_history.F90 -- newly named to work with the ccsm single executable -- also modified the maximum number of fields allowed on history tapes - -List all existing files that have been modified, and describe the changes: -M models/atm/cam/test/system/TSB.ccsm.sh -- modified to use resource settings returned from ccsm scripts -- ccsm tests now use default queue on phoenix - -M models/atm/cam/test/system/test_driver.sh -- machine calgary now supported by test driver; -- increased wall clock limit for default testing on bluevista - -M models/atm/cam/test/system/CAM_runcmnd.sh -- added code in support of machine calgary - -M models/ocn/dom/ocn_comp.F90 -M models/ocn/som/ocn_srf.F90 -M models/ocn/som/ocn_comp.F90 -M models/ice/csim4/ice_srf.F90 -M models/ice/csim4/ice_comp.F90 -M models/atm/cam/tools/scam/scm_init/init_model.F90 -M models/atm/cam/tools/scam/scm_init/forecast.F90 -M models/atm/cam/src/control/history_defaults.F90 -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/srfxfer.F90 -M models/atm/cam/src/control/restart.F90 -M models/atm/cam/src/control/atm_comp_mct.F90 -M models/atm/cam/src/control/filenames.F90 -M models/atm/cam/src/control/history_scam.F90 -M models/atm/cam/src/control/cam_comp.F90 -M models/atm/cam/src/utils/time_manager.F90 -M models/atm/cam/src/physics/cam1/seasalt_intr.F90 -M models/atm/cam/src/physics/cam1/tphysidl.F90 -M models/atm/cam/src/physics/cam1/progseasalts_intr.F90 -M models/atm/cam/src/physics/cam1/tracers.F90 -M models/atm/cam/src/physics/cam1/param_cldoptics.F90 -M models/atm/cam/src/physics/cam1/diagnostics.F90 -M models/atm/cam/src/physics/cam1/radiation.F90 -M models/atm/cam/src/physics/cam1/dust_intr.F90 -M models/atm/cam/src/physics/cam1/tphysbc.F90 -M models/atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 -M models/atm/cam/src/physics/cam1/radsw.F90 -M models/atm/cam/src/physics/cam1/check_energy.F90 -M models/atm/cam/src/physics/cam1/stratiform.F90 -M models/atm/cam/src/physics/cam1/water_tracers.F90 -M models/atm/cam/src/physics/cam1/radlw.F90 -M models/atm/cam/src/physics/cam1/ozone_data.F90 -M models/atm/cam/src/physics/cam1/physpkg.F90 -M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 -M models/atm/cam/src/physics/cam1/convect_shallow.F90 -M models/atm/cam/src/physics/cam1/convect_deep.F90 -M models/atm/cam/src/physics/cam1/carbon_intr.F90 -M models/atm/cam/src/physics/cam1/sulchem.F90 -M models/atm/cam/src/physics/cam1/co2_cycle.F90 -M models/atm/cam/src/physics/cam1/chemistry.F90 -M models/atm/cam/src/physics/cam1/gw_drag.F90 -M models/atm/cam/src/physics/cam1/sulemis.F90 -M models/atm/cam/src/physics/cam1/aerosol_intr.F90 -M models/atm/cam/src/physics/cam1/cloudsimulator.F90 -M models/atm/cam/src/physics/cam1/zm_conv.F90 -M models/atm/cam/src/physics/cam1/sulfur_intr.F90 -M models/atm/cam/src/physics/cam1/constituent_burden.F90 -M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 -M models/atm/cam/src/physics/waccm/iondrag.F90 -M models/atm/cam/src/physics/waccm/tracers.F90 -M models/atm/cam/src/physics/waccm/nlte_lw.F90 -M models/atm/cam/src/physics/waccm/chemistry.F90 -M models/atm/cam/src/physics/waccm/ctem.F90 -M models/atm/cam/src/physics/waccm/radheat.F90 -M models/atm/cam/src/physics/waccm/gw_drag.F90 -M models/atm/cam/src/physics/waccm/tgcm_forcing.F90 -M models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 -M models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 -M models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 -M models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 -M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 -M models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_aero_settling.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_airglow.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_jlong.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_setext.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_photo.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_jshort.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_cph.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_chm_diags.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_aurora.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_apex.F90 -M models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 -M models/atm/cam/src/chemistry/waccm_mozart/iondrag.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 -M models/atm/cam/src/chemistry/waccm_mozart/mo_jeuv.F90 -M models/atm/cam/src/chemistry/waccm_mozart/exbdrift.F90 -M models/atm/cam/src/dynamics/sld/spegrd.F90 -M models/atm/cam/src/dynamics/sld/linemsdyn.F90 -M models/atm/cam/src/dynamics/sld/dyn_comp.F90 -M models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 -M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 -M models/atm/cam/src/dynamics/eul/spegrd.F90 -M models/atm/cam/src/dynamics/eul/linemsdyn.F90 -M models/atm/cam/src/dynamics/eul/dyn_comp.F90 -M models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 -M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 -M models/atm/cam/src/dynamics/fv/inidat.F90 -M models/atm/cam/src/dynamics/fv/dyn_comp.F90 -M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 -M models/atm/cam/src/dynamics/fv/uv3s_update.F90 -- mods to eliminate naming conflicts when used in the ccsm single executable: - (mods included 'use' statements, documentation, and whitespace formatting) - subroutine write_restart -> cam_write_restart - subroutine read_restart -> cam_read_restart - module history -> cam_history - - -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. - -bluesky: -ALL PASS -tempest: -ALL PASS -bangkok/lf95: -ALL PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_23 -Originator(s): eaton -Date: Sun Aug 27 14:17:37 MDT 2006 -One-line Summary: fix some intent attributes in various high level interfaces - -Purpose of changes: - -. Some of the intents for derived types that contain pointer components are - wrong in the FV interface routines. In this situation the intent refers to - the association status of the pointer, not to the target of the pointer. - Fix these intents in fv/stepon.F90 and fv/dyn_comp.F90. - -. cam_run1 has args cam_in and cam_out declared intent(inout). Most of the - components of these user defined types are arrays of length pcols, but - we're adding components that are pointers, and probably all the - components should be pointers. Since for pointer components the - intent(inout) doesn't make sense, and for non-pointer components it's the - default, this intent has been removed. Also switched the order of these - args to match the convention of listing input args first. - -. replace the variables surface_state2d and srfflx_state2d by cam_out and - cam_in respectively in physpkg. There are alot of other places where - this still needs to happen. - -. utils/timing/f_wrappers.c was missing the header file string.h. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - models/utils/timing/f_wrappers.c - . add missing include of string.h - - models/atm/cam/src/dynamics/fv/stepon.F90 - . remove the intent(out) attributes of dummy args dyn_in and dyn_out in - both stepon_init and stepon_run1. That intent - implies that the pointer components should be associated in this - routine. But the pointers were previously associated in - dyn_create_interface and the targets are what is being set here. - - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - . remove the intent(inout) attributes of dummy args dyn_in and dyn_out in - dyn_run - - models/atm/cam/src/control/cam_comp.F90 - . remove the intent(inout) attribute of args cam_in and cam_out in - cam_run1 interface. Also switched the order of these - args to match the convention of listing input args first. - . order actual args (.., cam_in, cam_out) in call to phys_run1 - - models/atm/cam/src/control/con_cam.F90 - . switch order of actual args in call to cam_run1 - - models/atm/cam/src/control/atm_comp_mct.F90 - . switch order of actual args in call to cam_run1 - - models/atm/cam/src/physics/cam1/physpkg.F90 - . replace surface_state2d by cam_out and replace srfflx_state2d by cam_in - . order dummy args (.., cam_in, cam_out) in definition of phys_run1 - -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. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE - -=============================================================== -=============================================================== - -Tag name: cam3_3_22 -Originator(s): erik -Date: Fri Aug 18 10:18:32 MDT 2006 -One-line Summary: fix restart_option=end, get_perp_date bugs - -Purpose of changes: - -Bugs fixed (include bugzilla ID): 107, 185 - -Describe any changes made to build system: None - -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: self - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M cam/test/unit/control/run_time_test - Add tests for perpetual case and other restart_options -M atm/cam/test/unit/control/test_time.F90 - Add tests for perpetual case and other restart_options -M atm/cam/src/utils/time_manager.F90 - Add ability to use offset optional argument for get_perp_date - -Externals updated: - - csm_share to share3_060814 - clm2 to clm3_expa_69 - -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. - -bluesky: All PASS - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: bit-for-bit - -=============================================================== -=============================================================== - -Tag name: cam3_3_21 -Originator(s): eaton, klindsay, mirin -Date: 2006-08-17 -One-line Summary: Update icesst tools; add column burden diags; FV fixes/cleanup. - -Purpose of changes: - -. Update the icesst tool to recognize the new datasets being provided by - Dennis Shea. These have a CF-conforming time coordinate and the date - information in YYYYMMDD format is moved to a new date variable. - Also needed to change some fixed sizes in bcgen/solver.f90 to allow for - the new datasets starting from 1870 rather than 1949. - -. Add hist_fld_active query function to history.F90. Returns whether or - not a field is active on any history file. This enables the ability to - not perform expensive diagnostic calculations if they aren't being asked - for in the history output. (Contributed by Keith Lindsay.) - -. Add column burden diagnostics for all constituents except water vapor. - These are not put on the history tapes by default. The names of the - output variables are of the form 'TM'//cnst_name. Not enabled for SCAM. - (Contributed by Keith Lindsay.) - -. Add modcomm_gatscat to namelist (bugfix); fix defaults for some modcomm - options; cleanup of comments. (Contributed by Art Mirin.) - -Bugs fixed (include bugzilla ID): - -. Add modcomm_gatscat to namelist - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - -. Add modcomm_gatscat to namelist - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: eaton - -List all subroutines eliminated: - - models/atm/cam/tools/icesst/README.bfb - -List all subroutines added and what they do: - -. column burden diagnostics for all constituents except water vapor - models/atm/cam/src/physics/cam1/constituent_burden.F90 - -List all existing files that have been modified, and describe the changes: - -. enable icesst tools to read new input datasets - models/atm/cam/tools/icesst/README - models/atm/cam/tools/icesst/bcgen/solver.f90 - models/atm/cam/tools/icesst/regrid/regrid.f90 - models/atm/cam/tools/icesst/regrid/wrap_nf.f90 - -. add column burden diagnostics - models/atm/cam/src/physics/cam1/diagnostics.F90 - -. add new query function to history - models/atm/cam/src/control/history.F90 - -. FV and modcomm bugfixes and cleanup - models/atm/cam/src/control/runtime_opts.F90 - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - models/utils/pilgrim/mod_comm.F90 - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: All PASS - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: NONE - -=============================================================== -=============================================================== - -Tag name: cam3_3_20 -Originator(s): erik -Date: Wed Aug 16 09:34:33 MDT 2006 -On-line Summary: Fix bugs from cam3_3_15 for working on phoenix - -Purpose of changes: Changes needed for CCSM to work on phoenix. - -Bugs fixed (include bugzilla ID): 204 and 205 - -Describe any changes made to build system: none - -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: self, jwolfe - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/atm/cam/test/unit/control/run_time_test - Remove old style namelists for comparision, add netcdf directories - explicitly for bangkok. -M models/atm/cam/src/control/con_cam.F90 - Move start of timers to earlier in program. -M models/SVN_EXTERNAL_DIRECTORIES - Update to share3_060814. Fixes problem in shr_file_mod for phoenix. - -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. - -bluesky: all tests pass - -tempest: all tests pass - -bangkok/lf95: all tests pass - -Summarize any changes to answers: bit-for-bit - -=============================================================== -=============================================================== - -Tag name: cam3_3_19 -Originator(s): Jim Edwards (homme, history, phys_grid), - Rory Kelly (homme), - Pat Worley (phys_grid) -Date: 8-14-2006 -One-line Summary: Moved dynamic core specific functions from history - to specific cores. - -Purpose of changes: Continuing work on general dynamics/physics API - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: None - -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: Originators, Brian Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - - The dynamics fields that were previously added to the history output from - the history_defaults file have been moved to dyn_init so that each dycore - is responsible for declaring the fields for which outfld calls will be made - using the dynamics decomposition. - - Moving addfld calls into dyn_init created a circular dependency, i.e., - - dyn_comp -> history -> io_dist -> dyn_comp - - io_dist uses dyn_state (in dyn_comp) to access the decomposition info - needed for gathers. We broke the chain by putting dyn_state in a separate - module, i.e., - - dyn_comp -> history -> io_dist -> dyn_internal_state - - Another side effect of moving addfld calls into dyn_init was to require - moving the setting of the dyngrid_set variable (and give it the more - appropriate name dyndecomp_set) to a place in front of these calls. It was - previously being set in initcom which is after the dyn_init call. It - should be set as soon as the parameters that determine the dynamics - decomposition are known. It can probably still be set earlier than it is - currently. - - The gather/scatter methods in phys_grid have been modified to work when the - global field is on either a lat/lon grid or an unstructured grid. - (Contributed by Pat Worley.) - - The wrapper routines in wrap_nf have been moved into a module. This - provides interface checking for these routines. - - More work has been done to the dycore interface for HOMME in the - dynamics/homme directory. This work is still in progress. - - -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. - -bluesky: all tests pass - -tempest: all tests pass - -bangkok/lf95: all tests pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_18 -Originator(s): bundy (Dani Bundy Coleman) -Date: Aug 11 2006 -One-line Summary: Fix and improve prognostic aerosol packages - -Purpose of changes: Some of the existing prognostic aerosol packages -did not function out-of-the-box. Furthermore, the dust package was -outdated, the sea salt was actually diagnostic and the carbon -offered only one simple scenerio. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: -Added configure option for prognostic aerosol packages - -prog_aero sulfur,caer4,caer16,dust,seasalt -Invoke with comma-separated list of any combination of the above. -This adds the correct number of advected constituents to the build and -defines cpp tokens required for dust, seasalt and the new 16-constituent -carbon aerosol package. - -Describe any changes made to the namelist: -The configure option for prognostic aerosols is used by build-namelist to - set namelist variables related to the aerosol packages. -Added namelist variables to control implementation & feedback of dust & sea salt. - aero_progsslt - Set to .TRUE. to turn on prognostic seal salt aerosols - should be set by build-namelist, as needs cppdefs too - aero_feedback_progsslt - Set to .TRUE. to enable feedback of prognostic sea salt - aerosols. NOT YET IMPLEMENTED - aero_dust - Set to .TRUE. to turn on dust prognostic aerosols - should be set by build-namelist, as needs cppdefs too - aero_feedback_dust - Set to .TRUE. to enable feedback of dust - prognostic aerosols. - -To avoid confusion with the existing co_emis_file namelist variable, - renamed emissions file for prognostic carbon aerosol: -OLD co_emis -NEW caer_emis - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none -When run without aerosols, there are no changes. - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: -models/atm/cam/src/physics/cam1/dust.F90 - module information moved to (existing) dust_intr.F90 - -List all subroutines added and what they do: -models/atm/cam/src/physics/cam1/progseasalts_intr.F90 - new module includes methods for registering, initializing, setting - indices, and calculating sinks of prognostic sea salt aerosol - progseasalts_register_cnst - progseasalts_init_cnst - set_progseasalts_idx - progseasalts_initialize - progseasalts_time_interp - ProgseasaltsDryDep -models/atm/cam/src/control/camsrfexch_types.F90 - hub2atm_setopts - called by dust.F90:dust_register_cnst to allocate ram1 & fv in srfflx_state -models/atm/cam/src/physics/cam1/aerosol_intr.F90 - aerosol_getopts ! get runtime options - -Also added -models/drv/seq_flds/dust -models/drv/seq_flds/dust/seq_flds_mod.F90 - add tokens for new exchange components in x2a and l2x strings - -List all existing files that have been modified, and describe the changes: - -M models/atm/cam/bld/CAM_config.pm - add AEROSOLS attribute - -M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - changed co_emis to caer_emis - add caer_emis_16 - -M models/atm/cam/bld/cam_inparm.pm - Add AEROSOLS attribute to namelist object - Use settings from config_cache to set aero_carbon and caer_emis - All carbon surface emissions in caer_emis - Use config_cache to set prognostic_sulfur and prescribed_sulfur - Use config_cache to set soil_erod - -M models/atm/cam/bld/config_cam_eul_defaults.xml -M models/atm/cam/bld/config_cam_fv_defaults.xml -M models/atm/cam/bld/config_cam_homme_defaults.xml -M models/atm/cam/bld/config_cam_sld_defaults.xml -M models/atm/cam/bld/config_trop_chem_mozart_defaults.xml -M models/atm/cam/bld/config_waccm_ghg_defaults.xml -M models/atm/cam/bld/config_waccm_mozart_defaults.xml - add prog_aero to defaults xml files - -M models/atm/cam/bld/configure - add "-prog_aero " option - add consistency check for specified packages - increment nadv with the number of constituents in specified packages - -M models/atm/cam/src/control/atm_comp_mct.F90 - transfer fv, ram1 & dust fluxes if dust or progseasalt is running - -M models/atm/cam/src/control/camsrfexch_types.F90 - add ram1,fv to srfflx_state type definition - add subroutine hub2atm_setopts( aero_dust_in ) - called by dust.F90:dust_register_cnst - to allocate ram1 & fv pointers - -M models/atm/cam/src/control/runtime_opts.F90 - change namelist var co_emis to caer_emis - changed comments about sea salt to diagnostic - added namelist variables for prognostic sea salt & dust - -M models/atm/cam/src/physics/cam1/aer_optics.F90 - if prognostic dust is running, use different optics - -M models/atm/cam/src/physics/cam1/aerosol_intr.F90 - new subroutine aerosol_getopts to get run-time settings - add dust & progseasalt implementation & control flags - take out old ifdef DUSTs - initialize dry deposition module if any aerosol is running - generalize interfaces to carbon_intr - -M models/atm/cam/src/physics/cam1/caer.F90 - add new carbon aerosol scenario with 16 constituents - invoke with configure -prog_aero caer16 - -M models/atm/cam/src/physics/cam1/caerbnd.F90 - add new caer16 carbon emission scenario - -M models/atm/cam/src/physics/cam1/carbon_intr.F90 - generalize interface for both caer4 & caer16 packages - -D models/atm/cam/src/physics/cam1/dust.F90 - moved information into dust_intr.F90 - -M models/atm/cam/src/physics/cam1/dust_intr.F90 - move calcarm, d3ddflux subroutines to drydep_mod.F90 - moved dust.F90 information into dust_intr.F90 - -M models/atm/cam/src/physics/cam1/hk_conv.F90 - modify checks for small constituent values - causes roundoff diffs to any constituent with mixing ration < 1.e-300 - -M models/atm/cam/src/physics/cam1/physpkg.F90 - remove ram1, fv from comsrf - -A models/atm/cam/src/physics/cam1/progseasalts_intr.F90 - new module to handle prognostic sea salt aersols - -M models/atm/cam/src/physics/cam1/seasalt_intr.F90 - added method to return ixsslt - -M models/atm/cam/src/physics/cam1/sulchem.F90 - add wet deposition diagnostics to dummy args of chemwdepdr - -M models/atm/cam/src/physics/cam1/sulfur_intr.F90 - add SO4 wet deposition diagnostics to history (not default) - remove call to inidrydep (now down in aerosol_intr if any aerosol is running) - move outfld calls to sulfur_wet_intr from chemwdepdr - -M models/atm/cam/src/physics/cam1/tphysac.F90 - remove fv and ram1 dummy args (in srfflx_state2d?) - pass srfflx_state2d to aerosol_drydep_intr instead of its components - -M models/atm/cam/src/physics/cam1/wetdep.F90 - add optional args to wetdepa - -A models/drv/seq_flds/dust -A models/drv/seq_flds/dust/seq_flds_mod.F90 - added directory for configure-time dust options - add tokens for new exchange components in x2a and l2x strings - -M models/drv/seq_flds_indices/seq_flds_indices.F90 - add indices for fv, ram1, flxdst[1-4] in x2a, l2x sections (no ifdefs here) - -M models/drv/seq_mct/mrg_x2a_mct.F90 - copy from surface attribute vectors to atm attvec - -NOTE these land mods were checked into the clm trunk with clm3_expa_64 -M src/biogeochem/DUSTMod.F90 - OLD dmt_vma = 2.524e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 - NEW dmt_vma = 3.500e-6_r8 ! [m] Mass median diameter analytic -M src/main/clm_atmlnd.F90 - add land-to-atmosphere communication of fv,ram1 & dust fluxes - (only active if defined DUST or PROGSEASALT ) -M src/main/lnd_comp_mct.F90 - add land-to-atmosphere communication of fv,ram1 & dust fluxes - (only active if defined DUST or PROGSEASALT ) - -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. - -bluesky: -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! - Round-off changes to chemistry constituents Np and N2p are caused - by a modification to the Hack shallow convection scheme - models/atm/cam/src/physics/cam1/hk_conv.F90 - -tempest: all PASS - -bangkok/lf95: all PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: waccm_mozart -- what platforms/compilers: bluesky tested, probably all -- nature of change (roundoff; larger than roundoff but same climate; new - climate): roundoff - -If bitwise differences were observed, how did you show they were no worse -than roundoff? cprnc output shows 2 diffs in an array of 218592 elements; -code change only operates on numbers less than 1.e-300 - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - -=============================================================== - -Tag name: cam3_3_17 -Originator(s): mvr -Date: -One-line Summary: update to clm3_expa_66; work-around for bluevista -compiler bug; update to new pgi compiler and libs - -Purpose of changes: wanted to use new pgi compilers which meant an -update to clm tag with work-around for code the compilers didn't like; -new operating system on bluevista forced some mods in the build -system and test scripts - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: -- removed noopt flag from compile and link commands in debug,smp mode - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: -- added spun-up CAM and CLM initial files for the FV 0.9x1.25 resolution. - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: -M models/atm/cam/test/system/TSB.ccsm.sh -M models/atm/cam/test/system/TCT.ccsm.sh -- modified for ccsm test to work in new bluevista os - -M models/atm/cam/test/system/TBL.sh -M models/atm/cam/test/system/TBR.sh -M models/atm/cam/test/system/TER.sh -M models/atm/cam/test/system/TRX.sh -M models/atm/cam/test/system/TEQ.sh -- test scripts modified to do ALL output file comparisons, even if one fails - -M models/atm/cam/test/system/test_driver.sh -- modified for new bluevista os; updated bangkok libraries and 6.1-3 pgi compiler - -M models/atm/cam/tools/scam/ui/configure -- updated to link with pgi 6.1-3 libraries - -M models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml -M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml -- added spun-up CAM and CLM initial files for the FV 0.9x1.25 resolution. - -M models/atm/cam/bld/Makefile.in -- removed noopt flag from compile and link commands in debug,smp mode (work- - around for bluevista compiler bug) - -M models/atm/cam/bld/run-ibm.csh -- updated to work on bluevista as well as bluesky - -M models/atm/cam/bld/run-pc.csh -- updated bangkok libraries and 6.1-3 pgi compiler - -M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 -- bug fix for out-of-bounds array reference caught by pgi compiler - -M models/SVN_EXTERNAL_DIRECTORIES -- updated to new clm tag (clm3_expa_66) - -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. - -bluesky: -005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 -008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 -010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 7 -013 bl134 TBL.sh e32dh adia 9 .....................................FAIL! rc= 7 -019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 -044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 -047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 -049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 7 -052 bl534 TBL.sh s32dh adia 9 .....................................FAIL! rc= 7 -055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 - --all baseline tests in debug mode running omp fail due to removal of noopt flag --ccsm test fails, but passes when using ccsm sandbox with upcoming mods - -tempest: -all PASS - -bangkok/lf95: -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 5 - --these were deemed acceptable roundoff errors - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: non-debug -- what platforms/compilers: bangkok/lf95 -- nature of change (roundoff; larger than roundoff but same climate; new - climate): roundoff - -If bitwise differences were observed, how did you show they were no worse -than roundoff? analysis of nstep0 differences - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: cam3_3_16 -Originator(s): Will Sawyer, Art Mirin -Date: Wed Jul 19 02:15:17 MDT 2006 -One-line Summary: - -Purpose of changes: Upgrade to newest pilgrim version; - streamlining of FV to remove unneeded allocations; - resynching FV dycore with that from GEOS5; - corrections in namelists for high resolution runs; - update of FV namelist options (removal of set_eta); - update of benergy to run with XY decomposition - -Bugs fixed (include bugzilla ID): (following have no bugzilla ID) - D-resolution runs on Phoenix (reported by Worley) - Conservative-mode bug (reported by Suarez in GEOS5) - Compilation bug tp_core.F90 (reported by Trayanov in GEOS5) - Tracer transpose bug on certain architectures (e.g. Linux) - with mod_method=1 (reported by Mirin, et al.) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - Removed use_eta (comctl) - Added dyn_conservative (comctl) - Changes to the names of Topo, SST and initial files for - 0.9x1.25 and 0.5x0.625 resolutions. - -List any changes to the defaults for the boundary datasets: - RESOLUTION="0.9x1.25">atm/cam/topo/USGS-gtopo30_0.9x1.25_remap_c051027.nc - RESOLUTION="0.5x0.625" >atm/cam/sst/sst_HadOIBl_bc_0.5x0.625_1949_2001_c040402.nc - -Describe any substantial timing or memory changes: - FV memory usage has decreased -- intermediate buffering of - tracers is being avoided. - -Code reviewed by: ourselves - -List all subroutines eliminated: - set_decomp, y_decomp (mod_comm) -- no longer used - create_vars, restore_vars, record_state, record_vars, - destroy_state, destroy_vars (dyn_comp) -- no longer used - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - -M models/utils/pilgrim/parutilitiesmodule.F90 - -- Changes to initialization routine to support revised mod_comm - -- Changed default communication method to mod_method=0 - -- MPI types only initialized for mod_method=1 - -- Updated documentation - -M models/utils/pilgrim/mod_comm.F90 - -- Extensive refactoring and updates to documentation - -- Dynamic allocation of buffers (minimalistic, local allocation) - -- Removal of mod_method=3 (MPI1) - -M models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml -M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml - -- Changed default files for 0.9x1.25 and 0.5x0.625 resolutions. - -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/control/comctl.h - -- Added dyn_conservative, modcomm_gatscat - -- removed use_eta, tracertrans - -M models/atm/cam/src/physics/cam1/phys_grid.F90 - -- Changes to modmax_alltoall method (now method 13) - -M models/atm/cam/src/dynamics/sld/spmd_dyn.F90 -M models/atm/cam/src/dynamics/eul/spmd_dyn.F90 - -- Added dyn_conservative, modcomm_gatscat - -- removed use_eta, tracertrans - -M models/atm/cam/src/dynamics/fv/pmgrid.F90 - -- Added mod_gatscat method, default = 0 - -M models/atm/cam/src/dynamics/fv/benergy.F90 - -- Extensively rewritten to support XY decomposition (instead of YZ) - -M models/atm/cam/src/dynamics/fv/tp_core.F90 - -- Compilation bug fixed (reported by Trayanov in GEOS5) - -M models/atm/cam/src/dynamics/fv/par_xsum.F90 - -- Sequential execution bug fix, refactoring - -M models/atm/cam/src/dynamics/fv/dp_coupling.F90 -M models/atm/cam/src/dynamics/fv/dryairm.F90 - -- Introduced T_TRACERS type for constituents - -M models/atm/cam/src/dynamics/fv/inidat.F90 - -- Introduced T_TRACERS type for constituents - -- T3 array has become i,j,k (was i,k,j) - -M models/atm/cam/src/dynamics/fv/dyn_comp.F90 - -- Introduced T_TRACERS type for constituents - -- Introduced dyn_conservative mode - -- Removed unneeded allocations, removed unneeded subroutines - -- Moved location of call to benergy into XY decomposition section - -M models/atm/cam/src/dynamics/fv/p_d_adjust.F90 - -- Introduced T_TRACERS type for constituents - -M models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - -- Added dyn_conservative, modcomm_gatscat - -- removed use_eta, tracertrans - -- changed location and argument list of parinit() - -M models/atm/cam/src/dynamics/fv/inital.F90 - -- Revised call to dyn_init - -M models/atm/cam/src/dynamics/fv/cd_core.F90 - -- cosmetic changes to FVstart/stopclock - -M models/atm/cam/src/dynamics/fv/sw_core.F90 - -- loop index bug fixed (reported by Putman) - -M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 - -- T3 array has become i,j,k (was i,k,j) - -- Introduced T_TRACERS type for constituents - -M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 - -- Bug fix for conservation mode (now: grid%klastp = km_in+1) - -- Added ACOSU - -M models/atm/cam/src/dynamics/fv/geopk.F90 - -- Changes for mod_geopk mode to reduce MPI_TYPE usage - -M models/atm/cam/src/dynamics/fv/stepon.F90 - -- Removed set_eta code (namelist variable: use_eta) - -- Introduced T_TRACERS type for constituents - -M models/atm/cam/src/dynamics/fv/fv_prints.F90 - -- Introduced T_TRACERS type for constituents - -M models/atm/cam/src/dynamics/fv/restart_dynamics.F90 - -- Introduced T_TRACERS type for constituents - -- Revised call to dyn_init - -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. - -bluesky: All tests pass except the CCSM comparison test - - 055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 - - Justification: was failing in cam3_3_14 and 15. See explanations there. - -tempest: all tests passed - -bangkok/lf95: all tests passed - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - ==> No changes to answers - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: no change - -URL for AMWG diagnostics output used to validate new climate: no change - -=============================================================== -=============================================================== - -Tag name: cam3_3_15 -Originator(s): Erik Kluzek -Date: Thu Jul 13 21:17:44 MDT 2006 -One-line Summary: - -Purpose of changes: Put in top level initialization and clock objects at driver level - for moving forward with sequential CCSM. - - This separates out the driver from the internals of the CAM time-manager. Making - the top level driver separable from CAM itself, and moves it toward a Sequential - CCSM where the sub-components can be swapped for other CCSM components (such - as the CCSM data models or active ice and active ocean models). - -Bugs fixed (include bugzilla ID): 153 - - Fix bug in test_driver.sh where if BL_ROOT was NOT set -- it would erase the - entire contents of your /ptmp/$USER directory after it was finished. - -Describe any changes made to build system: Add csm_share/eshr directory to Filepath - -Describe any changes made to the namelist: Split into 4 namelists. - - ccsm_inparm ----- Sequential CCSM driver level initialization information - (passed to all subcomponent models: atm, lnd, ice, ocn) - timemgr_inparm -- Sequential CCSM driver level clock information - (passed to all subcomponent models: atm, lnd, ice, ocn) - cam_inparm ------ CAM specific namelist - clm_inparm ------ CLM specific namelist - -The ccsm_inparm namelist is managed by the shr_inputInfo_mod.F90 module and objects. -The timemgr_inparm namelist is managed by the eshr_timemgr_mod.F90 module and objects. -These are both sequential CCSM top level driver objects that are passed into -sub-components (atmosphere, land, sea-ice, and ocean) to manage information that is -shared between sub-components. - -CHANGE SO THAT THE NAMELIST IS NO LONGER READ FROM STDIN -- THE NAMELIST NAME IS -ASSUMED AND THE FILE OPENED EXPLICITLY. When namelists read the file is opened, and -namelists are read until the correct one is found, then the file is closed. If the -needed namelist does not exist -- OR THERE IS AN ERROR IN IT -- the program will abort -with an error. - -The interface to build-namelist still uses the input namelists of: camexp and clmexp -and will divide the relevant namelist items to the appropriate namelists. - -Option added to build-namelist: -ignore_ic_date - -by default build-namelist will match the start date/time (start_ymd,start_tod) for -initial condition datasets. If a suitable dataset with the correct starting date -(as well as resolution and other matching criteria) isn't found -- an initial condition -dataset will NOT be provided. - -If you use the -ignore_ic_date option is used datasets will be matched without -examining the starting date/time of the dataset. - -Namelist items removed: - - restart_nsteps --> use restart_option and restart_n - restart_nhours --> use restart_option and restart_n - restart_ndays ---> use restart_option and restart_n - restart_monthly -> use restart_option and restart_n - restart_yearly --> use restart_option and restart_n - no_restart ------> use restart_option and restart_n - nelapse ---------> use stop_option and stop_n - nestep ----------> Functionality removed - nsrest ----------> Use start_type - -Namelist items moved to different namelist: - - Old namelist item New namelist used in - ================= ==================== - archive_dir ccsm_inparm (now refers to the top level archive directory) - aqua_planet ccsm_inparm - brnch_retain_casename ccsm_inparm - mss_irt ccsm_inparm - mss_wpass ccsm_inparm - calendar timemgr_inparm - stop_ymd timemgr_inparm - stop_tod timemgr_inparm - start_ymd timemgr_inparm - start_tod timemgr_inparm - ref_ymd timemgr_inparm - ref_tod timemgr_inparm - perpetual_run timemgr_inparm - perpetual_ymd timemgr_inparm - -Namelist items that changed names: - - Old namelist item New namelist item name New namelist used in - ================= ====================== ==================== - eccen orb_eccen timemgr_inparm - obliq orb_obliq timemgr_inparm - mvelp orb_mvelp timemgr_inparm - iyear_AD orb_iyear_AD timemgr_inparm - ctitle case_desc ccsm_inparm - caseid case_name ccsm_inparm - adiabatic atm_adiabatic ccsm_inparm - ideal_phys atm_ideal_phys ccsm_inparm - -Namelist items added: - - Namelist item Description New namelist used in - ========================= ====================================== ==================== - start_type ---------------> How simulation will startup ccsm_inparm - Valid options: - - startup = Use initial files - continue = Use restart files to continue simulation - branch = Use restart files to branch simulation - - restart_pfile ------------> Driver level restart pointer file name ccsm_inparm - restart_file -------------> Driver level restart file name ccsm_inparm - restart_file_override ----> Override list of items from restart file ccsm_inparm ** - restart_file_TGRoverride -> Override list of items from restart file ccsm_inparm ** - restart_option -----------> Driver level restart frequency type timemgr_inparm - Valid options: - - nsteps ---- Write restarts every restart_n time-steps - ndays ----- Write restarts every restart_n days - nmonths --- Write restarts every restart_n months - nyears ---- Write restarts every restart_n years - monthly --- Write restarts at beginning of each month - yearly ---- Write restarts at beginning of the year - end ------- Write restarts only at end of simulation - none ------ Don't write any restarts - - restart_n ----------------> Driver level restart frequency value timemgr_inparm - stop_option --------------> Driver level restart frequency type timemgr_inparm - Valid options: - - nsteps ---- Stop after stop_n time-steps - ndays ----- Stop after stop_n days - nmonths --- Stop after stop_n months - nyears ---- Stop after stop_n years - date ------ Stop at stop_ymd/stop_tod date/time - - stop_n -------------------> Driver level restart frequency value timemgr_inparm - stop_final_ymd -----------> The final date to run to (YYYYMMDD format) timemgr_inparm - atm_cpl_dt ---------------> Atmosphere coupling frequency (sec) timemgr_inparm - -Example creation of the old and new namelist using build-namelist: - -With cam3_3_14: - - build-namelist -runtype initial -namelist "&camexp nelapse=-1, restart_monthly=.true., iyear_AD=1990/ " - -with cam3_3_15: - - build-namelist -runtype startup -namelist "&camexp stop_option='ndays', stop_n=1, restart_option='monthly' , orb_iyear_AD=1990 /" - -So build-namelist figures out that all of the above options belong in the timemgr_inparm namelist -and deal with it appropriately. And results in the following namelist: - -&ccsm_inparm - case_name = 'camrun' - start_type = "startup" -/ -&timemgr_inparm - atm_cpl_dt = 1200 - orb_iyear_ad = 1950 - restart_option = 'monthly' - start_ymd = 901 - stop_n = 1 - stop_option = 'ndays' -/ -&cam_inparm - absems_data = '/fs/cgd/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' - aeroptics = '/fs/cgd/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' - bnd_topo = '/fs/cgd/csm/inputdata/atm/cam/topo/USGS-gtopo30_64x128_c050520.nc' - bndtvaer = '/fs/cgd/csm/inputdata/atm/cam/rad/AerosolMass_V_64x128_clim_c031022.nc' - bndtvo = '/fs/cgd/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' - bndtvs = '/fs/cgd/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_64x128_clim_c020411.nc' - dtime = 1200 - ncdata = '/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' -/ -&clm_inparm - fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' - fsurdat = '/fs/cgd/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_64x128_c050523.nc' -/ - -How to override information on the restart file from the namelist: ** - - By default for a continue or branch type of simulation -- driver information is - read from the restart file and namelist information is ignored. In order to explicitly - use driver level restart information you have to do the following: - - 1.) Set given namelist item(s) you want to override. - 2.) Set restart_file_override (or restart_file_TGRoverride for timemgr_inparm namelist) - to include the colon delimited list of items you want to override on the namelist. - 3.) To override the case_name -- set the brnch_retain_casename namelist item to true. - - List of ccsm_inparm items that can be overridden: mss_irt, mss_wpass, and case_desc - (and case_name is brnch_retain_casename is set to true) - List of timemgr_inparm items that can be overridden: restart_option, restart_n - - Examples - - build-namelist -runtype continue -namelist \ - "&camexp mss_irt=45, mss_wpass='example', restart_file_override='mss_irt:mss_wpass' /" - - The above example will override the values of mss_irt, mss_wpass from the restart file - with those given on the namelist. Note if restart_file_override were missing, the - values on the restart file would be used an the values on the namelist ignored. - - build-namelist -runtype continue -namelist \ - "&camexp restart_option='nyears', restart_n=2, restart_file_TGRoverride='restart_option:restart_n' /" - - The above example will override the values of restart_option, and restart_n from - the restart file with those given on the namelist. Note if restart_file_override - were missing, the values on the restart file would be used an the values on the - namelist ignored. - -List any changes to the defaults for the boundary datasets: make sure IC file names are - consistent with dates in file. - Also add ic_ymd and ic_tod to describe the date (YYYYMMDD format) and time-of-day (sec) - that the given initial condition file represents. - -Describe any substantial timing or memory changes: none - -Code reviewed by: Brian Eaton, Mariana Vertenstein, Mat Rothstein - -Externals updated: - share3_060710 ------------ Add shr_inputinfo_mod/eshr_timemgr_mod codes. - clm3_expa_65 ------------- Use new share objects. - esmf_wrf_timemgr_060616 -- Same behavior as ESMF, changes needed for new share. - MCT2_2_1_060706 ---------- Changes get_zeits.c to work on new bangkok compiler. - -List all subroutines eliminated: - - In models/atm/cam/src/control/restart.F90 <-- determine if restart from SyncClock - restart_init - restart_is_write_step - update_next_write_time - In models/atm/cam/src/utils/time_manager.F90 <-- remove unused functions. - get_clock - get_curr_ESMF_Time - calc_nestep <---- not needed as SynClock determines stop-time. - -List all subroutines added and what they do: - - runtime_opts_setNLFile (runtime_opts.F90) -- Set the namelist filename. - ccsmini_sendgridgetorb (ccsm_msg.F90) ------ Send grid and get orbit info - at initialization. - get_calendar (time_manager.F90) ------------ Get calendar type using. - timemgr_check_restart (time_manager.F90) --- Check the restart info for consistency. - -List all files eliminated: - - atm/cam/bld/DefaultCLMEXPNamelist.xml (change name) - atm/cam/bld/clm2exp.pm (change name) - atm/cam/bld/CAM_namelist.p (change name) - atm/cam/bld/DefaultCAMEXPNamelist.xml (change name) - -List all files added and what they do: - - atm/cam/test/unit/control/filterhead.pl -- filters unit test log data to compare results - with a different version. - - atm/cam/bld/nl_descrips.pm --------------------- Describes the driver level namelists. - atm/cam/bld/clm_inparm.pm ---------------------- Manages the clm_inparm namelist. - atm/cam/bld/DefaultCAM_INPARM_Namelist.xml ----- Default values for the cam_inparm namelist. - atm/cam/bld/DefaultCLM_INPARM_Namelist.xml ----- Defaults for the clm_inparm - namelist (renamed from old CAMEXP file) - atm/cam/bld/DefaultTIMEMGR_INPARM_Namelist.xml - Default values for the timemgr_inparm namelist. - atm/cam/bld/DefaultCCSM_INPARM_Namelist.xml ---- Default values for the ccsm_inparm namelist. - atm/cam/bld/NamelistsDescriptions.xml ---------- List of items on driver level namelists. - atm/cam/bld/timemgr_inparm.pm ------------------ Manages the timemgr_inparm namelist. - atm/cam/bld/cam_inparm.pm ---------------------- Manages the cam_inparm namelist. - atm/cam/bld/SeqCCSM_namelist.pm ---------------- Manages all namelists needed. - atm/cam/bld/ccsm_inparm.pm --------------------- Manages the ccsm_inparm namelist - -List all existing files that have been modified, and describe the changes: - - Pass CCSMInit and SyncClock objects down to sub-models. - - ocn/dom/ocn_comp_mct.F90 - ocn/som/ocn_comp_mct.F90 - ice/csim4/ice_comp_mct.F90 - - Update unit tests for time_manager module. - - atm/cam/test/unit/control/configure - atm/cam/test/unit/control/run_time_test - atm/cam/test/unit/control/test_time.F90 - - Change test_driver system to work with new build-namelist options and new - namelist behavior and changes to namelist item names. - - atm/cam/test/system/test_driver.sh - atm/cam/test/system/TSB.ccsm.sh - atm/cam/test/system/TBR.sh - atm/cam/test/system/TER.sh - atm/cam/test/system/TRX.sh - atm/cam/test/system/TSM.sh - atm/cam/test/system/nl_files/idphys - atm/cam/test/system/nl_files/ghgrmp - atm/cam/test/system/nl_files/outfrq3s - atm/cam/test/system/nl_files/aqpgro - atm/cam/test/system/nl_files/no_ttrac - atm/cam/test/system/nl_files/off2x2.5 - atm/cam/test/system/nl_files/pghgsul - atm/cam/test/system/nl_files/ttrac_lb1 - atm/cam/test/system/nl_files/ttrac_lb2 - atm/cam/test/system/nl_files/ttrac - atm/cam/test/system/nl_files/ttrac_lb3 - atm/cam/test/system/nl_files/adia - atm/cam/test/system/nl_files/outfrq24h - - Pass CCSMInit and SyncClock objects down as appropriate into scam. Upgrade - make to work with new PGI compiler on bangkok. - - atm/cam/tools/scam/configure - atm/cam/tools/scam/testscript - atm/cam/tools/scam/userdata/crmtest26.out <--- Needed for compiler upgrade on bangkok. - atm/cam/tools/scam/ui/configure - atm/cam/tools/scam/scm_init/init_model.F90 - atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 - atm/cam/tools/scam/scm_init/scam_run.F90 - atm/cam/tools/scam/scm_init/inital.F90 - atm/cam/tools/scam/scm_init/scamMod.F90 - atm/cam/tools/scam/scm_init/setiopupdate.F90 - - Work with new PGI compiler on bangkok. Add eshr to Filepath. - Changes to get Darwin (Mac OS-X) to work. Remove HIDE_SHR_MSG as - unneeded now. - - atm/cam/bld/configure - atm/cam/bld/Makefile.in - - Change to work in the context of the 4 new namelists. Add -ignore_ic_date option - in. Have CAM_config.pm keep track of new items added to the XML configuration file. - - atm/cam/bld/build-namelist - atm/cam/bld/clmexp.pm - atm/cam/bld/namelist.pm - atm/cam/bld/camexp.pm - atm/cam/bld/atmlndnl.pm - atm/cam/bld/CAM_config.pm - - Change run scripts to work with new build-namelist and do NOT redirect stdin. - - atm/cam/bld/run-ibm.csh - atm/cam/bld/run-pc.csh - atm/cam/bld/run-sgi.csh - atm/cam/bld/run-lightning.csh - atm/cam/bld/run-darwin.csh - - Pass CCSMInit and SyncClock objects down as needed. Use them to - initialize CAM internal data. - - atm/cam/src/control/readinitial.F90 - atm/cam/src/control/runtime_opts.F90 - atm/cam/src/control/restart.F90 - atm/cam/src/control/history.F90 - atm/cam/src/control/atm_comp_mct.F90 - atm/cam/src/control/startup_initialconds.F90 - atm/cam/src/control/units.F90 - atm/cam/src/control/filenames.F90 - atm/cam/src/control/ioFileMod.F90 - atm/cam/src/control/cam_comp.F90 - atm/cam/src/utils/time_manager.F90 - atm/cam/src/dynamics/fv/metdata.F90 - - Create CCSMInit and SyncClock driver level data at top level concurrent CAM - driver pass down as needed. Set orbital information in SyncClock from data sent - from coupler. - - atm/cam/src/control/con_cam.F90 - atm/cam/src/control/ccsm_msg.F90 - - Remove dependence on CAM specific data and modules and use CCSMInit - and SyncClock driver level objects. - - drv/seq_mct_drv/seq_ccsm_drv.F90 - drv/seq_mct/mrg_x2a_mct.F90 - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: All tests pass except the CCSM comparison test - - 055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 - - CCSM failed because the new CCSM scripts for this tag don't work with the old CAM - Thus the comparison to the old CCSM tag and cam3_3_14 had to be done by hand. - The comparison is exact if esmf_wrf_timemgr is updated in cam3_3_14 to - esmf_wrf_timemgr_051212. If not the difference is bit-for-bit until the 25th time-step - when the difference is off by roundoff. This was documented in the cam3_3_4 commit - where we had a roundoff difference due to the new esmf_wrf_timemgr. - - For running CCSM test use: - - env CAM_CCSMROOT=/fs/cgd/csm/models/atm/newchg_ccsm3_1_beta34 - -tempest: none - -bangkok/lf95: none - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_3_14 - -Summarize any changes to answers: none (bit-for-bit) - CCSM (changes to roundoff) - - CCSM answers change because esmf_wrf_timemgr updated from an - older version 050309 to the version used here 060616. - -=============================================================== -=============================================================== - -Tag name: cam3_3_14 -Originator(s): mvr -Date: 060612 -One-line Summary: -Update the ccsm tests within cam's test suite to reflect new changes to -ccsm's scripts; minor bug fixes to test scripts; cray x1 mods in newcprnc - -Purpose of changes: new naming conventions were introduced to ccsm's -test scripts; newcprnc required mods for cray x1 - -Bugs fixed (include bugzilla ID): applied fix for bug #43 to cam's newcprnc -code just as it was applied to clm's - -Describe any changes made to build system: none - -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: myself - -List all subroutines eliminated: -D models/atm/cam/tools/newcprnc/cprnc.f90 -- file renamed due to pre-processor directives added for cray x1 - -List all subroutines added and what they do: -A + models/atm/cam/tools/newcprnc/cprnc.F90 -- new file with directives for cray x1 - -List all existing files that have been modified, and describe the changes: -M models/atm/cam/test/system/TSB.ccsm.sh -- mods to reflect name changes introduced in ccsm scripts; added cleanup after - successful ccsm test; minor bug fixes -M models/atm/cam/test/system/TCT.ccsm.sh -- mods to reflect name changes introduced in ccsm scripts; now dumps output -of create_test to output log -M models/atm/cam/test/system/test_driver.sh -- test suite now uses prod queue rather than debug on phoenix -M models/atm/cam/test/system/gen_test_table.sh -- utility updated to include all platforms supported by cam's test driver -M models/atm/cam/test/system/input_tests_master -- mods to reflect name changes introduced in ccsm scripts -M models/atm/cam/test/system/TCB.ccsm.sh -- mods to reflect name changes introduced in ccsm scripts -M models/atm/cam/tools/newcprnc/nfwrappers.f90 -- bug fix for intent of variables in wrap_open (see bug #43) -M models/atm/cam/tools/newcprnc/Makefile -- added mods for cray x1 -M posttag_cron_bangkok.sh -M posttag_cron_bluesky.sh -M posttag_cron_lightning.sh -M posttag_cron_bluevista.sh -- cron scripts modified to make use of "collections" area for cam tags - - -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. - -bluesky: -055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 -- ccsm test fails when comparing to baseline due to changes in naming - conventions...tests were verified by hand - -tempest: all pass - -bangkok/lf95: all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: cam3_3_13 -Originator(s): Jim Edwards -Date: 060606 -One-line Summary: addition of HOMME dynamic core, removal of plat/plon from physics - -Purpose of changes: development of a new dynamic core prototype, generalization of - model to non-rectangular horizontal grids - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: Added support for homme dynamics in configure. - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, Brian Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: a dynamics/homme subdirectory was added - with stubs to interface the (external) homme model -A models/atm/cam/src/dynamics/homme - A models/atm/cam/src/dynamics/homme/initcom.F90 - A models/atm/cam/src/dynamics/homme/pmgrid.F90 - A models/atm/cam/src/dynamics/homme/dp_coupling.F90 - A models/atm/cam/src/dynamics/homme/dycore.F90 - A models/atm/cam/src/dynamics/homme/dyn_comp.F90 - A models/atm/cam/src/dynamics/homme/inidat.F90 - A models/atm/cam/src/dynamics/homme/stepon.F90 - A models/atm/cam/src/dynamics/homme/restart_dynamics.F90 - A models/atm/cam/src/dynamics/homme/commap.F90 - A models/atm/cam/src/dynamics/homme/spmd_dyn.F90 - A models/atm/cam/src/dynamics/homme/dyn_grid.F90 - A models/atm/cam/src/dynamics/homme/README - A models/atm/cam/src/dynamics/homme/inital.F90 - A models/atm/cam/bld/config_cam_homme_defaults.xml -List all existing files that have been modified, and describe the changes: - Changed FV CPP macro STAGGERED to the more appropriate and general DYN_STATE_INTERFACE - - U models/atm/cam/src/control/runtime_opts.F90 - U models/atm/cam/src/control/ccsm_msg.F90 - U models/atm/cam/src/control/startup_initialconds.F90 - U models/atm/cam/src/control/cam_comp.F90 - U models/atm/cam/src/utils/time_manager.F90 - - Removed references to plat and plon. - - U models/atm/cam/src/physics/cam1/comsrf.F90 - U models/atm/cam/src/physics/cam1/dmsbnd.F90 - U models/atm/cam/src/physics/cam1/acbnd.F90 - U models/atm/cam/src/physics/cam1/dust_intr.F90 - U models/atm/cam/src/physics/cam1/tracers_suite.F90 - U models/atm/cam/src/physics/cam1/boundarydata.F90 - U models/atm/cam/src/physics/cam1/drydep_mod.F90 - U models/atm/cam/src/physics/cam1/restart_physics.F90 - U models/atm/cam/src/physics/cam1/stratiform.F90 - U models/atm/cam/src/physics/cam1/water_tracers.F90 - U models/atm/cam/src/physics/cam1/co2_data_flux.F90 - U models/atm/cam/src/physics/cam1/volcanicmass.F90 - U models/atm/cam/src/physics/cam1/physpkg.F90 - U models/atm/cam/src/physics/cam1/wetdep.F90 - U models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 - U models/atm/cam/src/physics/cam1/carbon_intr.F90 - U models/atm/cam/src/physics/cam1/sulchem.F90 - U models/atm/cam/src/physics/cam1/co2_cycle.F90 - U models/atm/cam/src/physics/cam1/sulbnd.F90 - U models/atm/cam/src/physics/cam1/soxbnd.F90 - U models/atm/cam/src/physics/cam1/caerbnd.F90 - U models/atm/cam/src/physics/cam1/aerosol_intr.F90 - U models/atm/cam/src/physics/cam1/advnce.F90 - U models/atm/cam/src/physics/cam1/sulfur_intr.F90 - - Added support for HOMME dycore - - U models/atm/cam/bld/configure - U models/atm/cam/bld/resolution_parameters.xml - - - - -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. - -bluesky: none - tested with CAM_CCSMROOT=/fs/cgd/csm/collections/ccsm3_1_beta29 - -tempest: none - -bangkok/lf95: none - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: cam3_3_12 -Originator(s): mvr, jedwards -Date: 060602 -One-line Summary: test suite now supports phoenix (cray x1); - added testing of coupled model to bluevista; bug fix - for fv coupled runs - -Purpose of changes: wanted test coverage of cray x1; testing - of coupled model had been restricted to just bluesky; - new features in ccsm's scripts available for use - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: -- added DMS_emmissions, oxid, and SOx_emissions files for fv 2x2.5 -- updated to newer SOx_emissions file for T85 - -Describe any substantial timing or memory changes: - -Code reviewed by: myself - -List all subroutines eliminated: -none - - -List all subroutines added and what they do: -A models/atm/cam/test/system/config_files/fmo2m -A models/atm/cam/test/system/config_files/f2c11m -A models/atm/cam/test/system/config_files/e128m -A models/atm/cam/test/system/config_files/e128c11m -A models/atm/cam/test/system/config_files/fm1.9m -A models/atm/cam/test/system/config_files/f1.9pm -A models/atm/cam/test/system/config_files/f1.9m -A models/atm/cam/test/system/config_files/e128pm -- new configuration options for testing on phoenix - -A models/atm/cam/test/system/nl_files/off2x2.5p -- new namelist options for testing on phoenix - -A models/atm/cam/test/system/TCT.ccsm.sh -- new test script needed for testing of coupled model - -A models/atm/cam/test/system/tests_posttag_phoenix -A models/atm/cam/test/system/tests_posttag_robin -- new sets of default posttag tests for robin and phoenix - - -List all existing files that have been modified, and describe the changes: -M models/atm/cam/test/system/TSB.ccsm.sh -M models/atm/cam/test/system/TCB.ccsm.sh -- scripts for testing of coupled model now supports bluevista, phoenix; - build of coupled model can now be done separately prior to run; - updated to take advantage of new features in ccsm scripts - -M models/atm/cam/test/system/tests_posttag_bluesky -M models/atm/cam/test/system/tests_pretag_bluesky -- defaults test sets modified to have fv ccsm test be pretag, eul posttag - -M models/atm/cam/test/system/tests_posttag_bluevista -- default posttag tests on bluevista now include ccsm tests - -M models/atm/cam/test/system/test_driver.sh -- support added for robin/phoenix; MPI_TYPE_MAX now set for all platforms - -M models/atm/cam/test/system/input_tests_master -M models/atm/cam/test/system/CAM_runcmnd.sh -- new tests added to master list for phoenix - -M models/atm/cam/bld/camexp.pm -- mod to allow for casenames of length 80 characters - -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml -- added default input files for fv 2x2.5; updated to a newer T85 file - -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/history.F90 -- bug fixes to remove call to getfil for files not yet in existence - - would fail on phoenix when it tried to find it on mass store - -M models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 -- bug fix for line length exceeding max number of characters - -M models/atm/cam/src/dynamics/fv/dyn_grid.F90 -- bug fix for problem introduced in cam3_3_11 for fv coupled runs - - -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. - -bluesky: -001 sb998 TSB.ccsm.sh ER.01a 1.9x2.5_gx1v3 K ......................FAIL! rc= 6 -055 cs998 TCS.ccsm.sh ER.01a 1.9x2.5_gx1v3 K ......................FAIL! rc= 2 -- failed due to mods in test scripts; test passes when run manually - -tempest: -all pass - -bangkok/lf95: -all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: fv ccsm test used cam3_3_10 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? b4b - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -Tag name: cam3_3_11 -Originator(s): pworley, Jim Edwards -Date: 5/25/2006 -One-line Summary: phys_grid changes for single index method to support non-rectangular grids - -Purpose of changes: to support non-rectangular grids - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, Brian Eaton, Mariana, Pat Worley - -List all subroutines eliminated: - cam_domain, - get_cid_all_p, - get_chunk_coord_owner_p, - get_chunk_owner_p - get_cid_p - get_block_coord_d - get_block_coord_cnt_d - get_block_col_cnt_d - get_lon_d - get_lat_d - - - - -List all subroutines added and what they do: - get_gcol_all_p, get the global column id for all columns in the chunk - get_area_all_p, get the area of all columns in the chunk - get_block_gcol_d get column indices for given block - get_gcol_block_d get global block indices and local columns index for given global column index - get_horiz_grid_d: provides the total number of global columns visible to the physics - the lat, lon location and the surface area of each column - - (functions) - get_area_p : get area of column - get_gcol_p : get gcol id of column - get_gcol_owner_p : get task of column gcol in physics - get_block_gcol_cnt_d : get number of columns in given block - get_gcol_block_cnt_d : get number of blocks containing data - from a given global column index - get_horiz_grid_cnt_d : get number of columns in dynamics grid (visible to physics) - - -List all existing files that have been modified, and describe the changes: - - The cam_domain module was removed and these files modified to - get the mct grid initialization data directly from the physics - chunk on the task. This is both a simplification and a generalization - of the method introduced in cam3_3_9 - - M models/ocn/dom/ocn_comp_mct.F90 - M models/ocn/som/ocn_comp_mct.F90 - M models/ice/csim4/ice_comp_mct.F90 - M models/atm/cam/src/control/ccsm_msg.F90 - M models/atm/cam/src/control/atm_comp_mct.F90 - M models/atm/cam/src/control/cam_comp.F90 - M models/drv/seq_mct/seq_domain_mct.F90 - - Chunks (decomposed grid in the physics) were changed from - 2-D arrays in the horizontal to 1D. - This allows the generalization of cam physics to - non-rectangular grids. - - M models/atm/cam/src/physics/cam1/physics_types.F90 - M models/atm/cam/src/physics/cam1/phys_grid.F90 - M models/atm/cam/src/dynamics/sld/dyn_grid.F90 - M models/atm/cam/src/dynamics/eul/dyn_grid.F90 - M models/atm/cam/src/dynamics/fv/dyn_grid.F90 - - Support for the historical reduced grid method has been removed - if a reduced grid is reintroduced in the future it should use the - more general method introduced here. - M models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_sulf.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 - M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_photo.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 - M models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 - M models/atm/cam/src/chemistry/waccm_mozart/mo_tgcm_ubc.F90 - M models/atm/cam/src/chemistry/waccm_mozart/mo_sulf.F90 - M models/atm/cam/src/chemistry/waccm_mozart/mo_airplane.F90 - M models/atm/cam/src/chemistry/waccm_mozart/mo_drydep.F90 - M models/atm/cam/src/chemistry/waccm_mozart/mo_srf_emissions.F90 - - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: All tests pass - -tempest: All tests pass - -bangkok/lf95: All tests pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_10 -Originator(s): mvr -Date: 060524 -One-line Summary: added gensom option to configure; added test of gensom - vars to test suite; updated externals to new timing files; cleanup - -Purpose of changes: SOM input fields should not be generated and written - to history tapes by default; unused integer return codes of some - timing routines were causing problems on phoenix; write statements - and empty directories were left behind from previous commits - - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: -gensom option added to configure - -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: not including the SOM - input fields by default may show slight improvement - -Code reviewed by: myself, eaton - -List all subroutines eliminated: -D models/atm/cam/test/system/config_files/f4c11dh -- config options file replaced with one that includes -gensom option for testing -D models/atm/cam/src/ocnsice -D models/atm/cam/src/ocnsice/dom -D models/atm/cam/src/ocnsice/som -- removed empty directories left behind from previous commit - -List all subroutines added and what they do: -A models/atm/cam/test/system/config_files/f4c11gdh -- replacement config options file with -gensom option for testing - -List all existing files that have been modified, and describe the changes: -M models/utils/SVN_EXTERNAL_DIRECTORIES -- updating to new timing tag with mods for replacing int return codes with void -M models/atm/cam/test/system/input_tests_master -- adding test of the new configure option (gensom) to an existing test -M models/atm/cam/bld/configure -- modified to handle new option for generating SOM input fields -M models/atm/cam/bld/config_cam_eul_defaults.xml -M models/atm/cam/bld/config_trop_chem_mozart_defaults.xml -M models/atm/cam/bld/config_waccm_ghg_defaults.xml -M models/atm/cam/bld/config_waccm_mozart_defaults.xml -M models/atm/cam/bld/config_cam_fv_defaults.xml -M models/atm/cam/bld/config_cam_sld_defaults.xml -- added default values for gensom -M models/atm/cam/src/control/atm_comp_mct.F90 -M models/drv/seq_mct/mrg_x2a_mct.F90 -M models/drv/seq_mct/seq_domain_mct.F90 -- removed write statements left behind from previous commits - -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. - -bluesky: -019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 -- failed because this is a new test and did not exist in previous tag - -tempest: -021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 -- failed because this is a new test and did not exist in previous tag - -bangkok/lf95: -none - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_9 -Originator(s): Mariana Vertenstein -Date: Wed May 17 13:05:13 MDT 2006 -One-line Summary: created new generate som mode for mct coupling - -Purpose of changes: Remove output of ice/ocn specific fields from - mrg_x2a_mct.F90 and move then to atm_comp_mct.F90. All routines - in mct_drv/ should be devoid of cam specific information. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: default seq_flds_mod.F90 - to be used is currently in drv/seq_flds/gensom. This corresponds - to extra fields being sent to the atm which would only be used - for SOM input fields generation. Changes need to be made to - the testing scripts and configure to support a gensom option. - -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: The extra - fields being sent to atm_comp_mct.F90 might have a very small - performance penalty. However, a fix for this is expected in the - very near future. - -Code reviewed by: Myself (discussed these changes with Brian Eaton) - -List all subroutines eliminated: - -List all subroutines added and what they do: - - A drv/seq_flds/gensom/seq_flds_mod.F90 - sends fields to atm that are needed for SOM input data generation - -List all existing files that have been modified, and describe the changes: - - M atm/cam/src/control/history_defaults.F90 - M atm/cam/src/physics/cam1/diagnostics.F90 - M ocn/som/ocn_comp.F90 - moved history file initialization from diagnostics.F90 and history_defaults.F90 for: - TSOCN&IC, QFLUX, QFLUX_FT, QFLUX_TH, QFLUX_A2, FOCN, OIE, OIERATE, ONF, MLDANN - M ice/csim4/ice_comp.F90 - moved history file initialization from diagnostics.F90 and history_defaults.F90 for: - MELTB ,MELTT ,MELTL ,GROWB ,FRAZIL ,FLOOD ,FRZMLT ,NRGERROR,DELTAICE - NRGICE ,IIERATE ,F_ICE ,F_OCN ,FRZMLTMX,IMBAL ,EICEIN ,EICEOUT , TSICERAD&IC - M atm/cam/src/control/ccsm_msg.F90 - moved history file initialization from diagnostics.F90 and history_defaults.F90 for: - CPLRAINC,CPLRAINL,CPLSNOWC,CPLSNOWL,CPLPRCER - - M atm/cam/tools/scam/scm_init/scam_run.F90 - M drv/seq_mct_drv/seq_ccsm_drv.F90 - removed call to mrg_x2a_run1_mct - renamed call to mrg_x2a_run2_mct as call to mrg_x2a_run_mct - M drv/seq_mct/mrg_x2a_mct.F90 - removed subroutine mrg_x2a_run1_mct - renamed subroutine mrg_x2a_run2_mct as call to mrg_x2a_run_mct - - M atm/cam/bld/configure - set default path for seq_flds to $srcdir/drv/seq_flds/gensom - - M atm/cam/src/control/atm_comp_mct.F90 - added private subroutines atm_gensom1_mct and atm_gensom2_mct - that provide fuctionality previously done in - mrg_x2a_run1_mct and mrg_x2a_run2_mct - they are only invoked - if indices in seq_flds_indices for SOM generation fields are - non-zero (this will only be the case if - $srcdir/drv/seq_flds/gensom/seq_flds_mod.F90 is used. - - M drv/seq_flds_indices/seq_flds_indices.F90 added indices necessary for SOM data generation - -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. - -bluesky: all pass - -tempest: all pass - -bangkok/lf95: all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_8 -Originator(s): Mariana Vertenstein -Date: Sat May 13 17:48:49 MDT 2006 -One-line Summary: to implement MCT domains in each component - -Purpose of changes: To implement MCT domains and implement - a top level domain checker for cam and the surface components - using these domains (this replaces use statements within clm) - Note that cam3_3_7 was identical to this tag - but was tagged - with the wrong land externals - this tag fixes this problem. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -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 - all changes are in the initialization phase - however, - the impact of timing due to initialization has not been tested - -Code reviewed by: Tony Craig and Rob Jacob - -List all subroutines eliminated: None - -List all subroutines added and what they do: - - A models/atm/cam/src/control/cam_domain.F90 - A new routine that can be used by both ccsm_msg.F90 and the - atm_comp_mct.F90 routine to calculate the cam grid and areas - (this code was previously contained in ccsm_msg.F90). - -List all existing files that have been modified, and describe the changes: - - M models/atm/cam/src/control/atm_comp_mct.F90 - M models/ocn/dom/ocn_comp_mct.F90 - M models/ocn/som/ocn_comp_mct.F90 - M models/ice/csim4/ice_comp_mct.F90 - M models/lnd/clm2/src/main/lnd_comp_mct.F90 - M models/atm/cam/tools/scam/scm_init/init_model.F90 - M models/atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 - M models/drv/seq_mct_drv/seq_ccsm_drv.F90 - M models/drv/seq_mct/seq_mct_mod.F90 - D models/drv/seq_mct/seq_mct_init.F90 => A models/drv/seq_mct/seq_init_mct.F90 - In the above routines: - * domains were implemented using the MCT general grid data structures - * the current general grid components that I am defining are - lon,lat,area,mask and maxfrac (maxfrac is the maximum fraction - that the model can have on any gridcell - for the landthis - corresponds to the landfrac, for the ocn and ice this should - correspond to 1.-landfrac when everyone is on the same grid) - * domain checking is only done on the master processor at - initialization (via an MCT gather on the general grid) - * essentially, domains enable grid and fraction checking to be done - at the top level by the master processor and eliminates the use - statements contained in the land model. The consistency check for - fractional land is somewhat different than in the current flux - coupler. Basically, when all the models are on the same grid, you - want the "maximum fraction" from each component to be consistent. - What this boils down to is that the max_frac from the ocn/ice must - equal (1.-landfrac)to within some eps (I have specified 1.e-13). - In the ccsm cpl6 system, the ocn determines the landfrac,and on the - ocean grid maxfrac is either 1 or 0. This is clearly different - than in the current system. - - M models/atm/cam/src/physics/cam1/comsrf.F90 - M models/atm/cam/src/physics/cam1/restart_physics.F90 - M models/atm/cam/src/dynamics/sld/inidat.F90 - M models/atm/cam/src/dynamics/eul/inidat.F90 - M models/atm/cam/src/dynamics/fv/inidat.F90 - -removed landfrac_glob.F90 from above routines - - M models/atm/cam/src/control/ccsm_msg.F90 - - made changes to use cam_domain.F90 for determining grid information - - M models/ocn/dom/ocn_comp.F90 - M models/ocn/som/ocn_comp.F90 - M models/ice/csim4/ice_comp.F90 - M atm/cam/src/physics/cam1/diagnostics.F90 - - moved calls for the following initial file fields: - SNOWHICE&IC, ICEFRAC&IC, SICTHK&IC, TSICERAD&IC - to models/ice/csim4/ice_comp.F90 - - moved calls for the following initial file fields: - TSOCN&IC - to models/ocn/som/ocn_comp.F90 and models/ocn/dom/ocn_comp.F90 - - removed references to initial file file fields TS&IC since this - intiial field it was not being used by any routine - - M atm/cam/src/physics/cam1/restart_physics.F90 - - removed references to landfrac_glob and all COUP_CSM if-defs - -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. - -bluesky: all pass - -tempest: all pass - -bangkok/lf95: all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_7 -Originator(s): Mariana Vertenstein -Date: Sat May 13 17:48:49 MDT 2006 -One-line Summary: to implement MCT domains in each component - -Note that tag had a problem with the land externals - another tag -was made using the correct land externals - -=============================================================== -=============================================================== - -Tag name: cam3_3_6 -Originator(s): eaton, tcraig -Date: Mon May 8 11:26:41 MDT 2006 -One-line Summary: Fix CAM log problem in CCSM runs - -Purpose of changes: - - . Fix problem with CAM log file not being written during CCSM run. The - fix was provide by tcraig in bugzilla bug 102. - - . Set MPI_TYPE_MAX environment variable for testing on tempest - (sgi-o3800). This problem started in cam3_3_3 with FV code updates. - It is only a problem on machines that have a default value which is too - small. Currently setting MPI_TYPE_MAX=100000 is sufficient. The - problem has also been observed on phoenix (cray-x1e). - -Bugs fixed (include bugzilla ID): 102 - -Describe any changes made to build system: none - -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: myself, tcraig - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/src/control/con_cam.F90 - . rearrange initialization as follows: - call cpl_interface_init(cpl_fields_atmname, mpicom) ! call mpi_init - call spmdinit() ! set masterproc - call shr_msg_chdir('atm') ! all PE's chdir - call shr_msg_chStdin('atm') ! all PE's redirect unit 5 - if (masterproc) call shr_msg_chStdout('atm') ! redir unit 6 - call ESMF_Initialize() ! init ESMF time manager - call ccsm_seq_timer_init() ! init timing library - - models/atm/cam/test/system/test_driver.sh - . add "export MPI_TYPE_MAX=100000" for testing on tempest - -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. - -bluesky: Only ran CCSM test -- PASS. - -tempest: All PASS. - -bangkok/lf95: no tests done -- none of the code mods are exercised on bangkok - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_5 -Originator(s): sawyer, eaton -Date: Sun May 7 14:58:53 MDT 2006 -One-line Summary: Fix omega calc for FV offline mode - -Purpose of changes: Fix omega calc for FV offline mode - -Bugs fixed (include bugzilla ID): - - The fix for the FV omega calc added in cam3_3_3 was inadvertently left - out of the offline version of FV. - -Describe any changes made to build system: none - -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: myself, sawyer - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - . call compute_vdot_gradp for both prognostic and offline FV - -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. - -bluesky: All PASS except: - - 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - - This baseline test is expected to fail. Only the OMEGA field is different. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_4 -Originator(s): Erik Kluzek -Date: May/01/2006 -One-line Summary: Update clm, csm_share, and esmf_wrf_timemgr, use shr_file_mod for archiving - -Purpose of changes: First step in moving toward using ESMF clock interface at top level - use shr_file_mod syntax for archive_dir. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: None - -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: Tony Craig, Mariana Vertenstein, Brian Kauffman (csm_share and clm) - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/drv/seq_mct_drv/seq_ccsm_drv.F90 - -M test/unit/control/configure -M test/unit/control/run_time_test -M tools/scam/scm_init/init_model.F90 -M src/control/ccsm_msg.F90 -M src/control/con_cam.F90 -M src/control/history.F90 -M src/control/filenames.F90 -M src/control/ioFileMod.F90 -M src/physics/waccm/chemistry.F90 - -Also use new version of CLM (shrgetput08_cammct05_clm3_expa_58), csm_share (share3_060428) and -esmf_wrf_timemgr (esmf_wrf_timemgr_060501) - -Changes needed to use new versions of above libraries. Make sure a getfil is done before -a open-file. All programs need to do a ESMF_Initialize. ioFileMod uses shr_file_mod.F90 rather -than it's own functionality. filenames sets up archive_dir for shr_file_mod.F90 syntax (with -mss: prescript). Time unit tests use Lahey instead of PGI compiler on Linux. - -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. - -bluesky: None - -tempest: None - -bangkok/lf95: -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - -esmf_wrf_timemgr real-r8 julian day calculations are off by roundoff on Linux platforms. -It's off by roundoff on other platforms after 4-years. According to the unit tests it -remains within roundoff even for a very long simulation time. - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_3_3 - -Summarize any changes to answers, i.e., -- what code configurations: outfrq24 -- what platforms/compilers: Linux lf95/pgi - -If bitwise differences were observed, how did you show they were no worse -than roundoff? cprnc shows RMS difference in the 1e-17-1.e-20 range - Also unit-tests for time-manager shows that answers for julian day remain - bounded within roundoff even for a very long simulation time. - -=============================================================== -=============================================================== - -Tag name: cam3_3_3 -Originator(s): sawyer, eaton -Date: Tue Apr 25 16:17:05 MDT 2006 -One-line Summary: FV dycore improvements, fix omega diagnostic - -Purpose of changes: - o The XY decomposition is now the only one which is - visible to the outside user (YZ is hidden). This - simplifies the CAM-specific part of FV (code inside - the dynamics/fv directory but outside of the portable - FV core) enormously. - - o A dynamical core interface has - been written which is ESMF-like (init, run, final) - using an import and export container, and implementing - a dynamics state. - - o Correct calculation of OMEGA, and related diagnostics. - - o Resynchronized versions of FV dycores and PILGRIM - between GEOS5 and CAM (except GEOS5 vertical remapping). - - o Numerous other software engineering improvements - (all bit-for-bit). - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: - - The timings for the FV dycore are roughly the same on bluevista. There - is about a 10% slowdown on phoenix. - -Code reviewed by: sawyer, eaton - -List all subroutines eliminated: - - models/atm/cam/src/dynamics/fv/FVCAM_GridCompMod.F90 - . renamed dyn_comp.F90 - models/atm/cam/src/dynamics/fv/gmean.F90 - . move this subroutine into the new module mean_module.F90 - models/atm/cam/src/dynamics/fv/prognostics.F90 - . prognostic state info now in dyn_import and dyn_export - -List all subroutines added and what they do: - - models/atm/cam/src/dynamics/fv/diag_module.F90 - . contains the new routine compute_vdot_gradp which supplies a fix for - the OMEGA calculation - models/atm/cam/src/dynamics/fv/dyn_comp.F90 - . was FVCAM_GridCompMod.F90 - models/atm/cam/src/dynamics/fv/mean_module.F90 - . new module contains the old gmean.F90 and new XY version of gmean - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/src/control/history.F90 - . add ability to work with FV fields using XY decomp -- it appears that the - ability to use YZ decomp has been maintained. - . generalize the beg/end index names - . allow history restart write/read to work with XY decomp - - models/atm/cam/src/control/cam_comp.F90 - models/atm/cam/src/control/restart.F90 - models/atm/cam/src/control/startup_initialconds.F90 - . add STAGGERED ifdef to support passing dynamics import/export types through top - level interfaces - - models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 - . use XY decomp only - - models/atm/cam/src/dynamics/fv/dp_coupling.F90 - . use XY decomp only - . use dyn import/export types - - models/atm/cam/src/dynamics/fv/dryairm.F90 - . modify for XY decomp - - models/atm/cam/src/dynamics/fv/dynamics_vars.F90 - . move ESMF code inside GEOS_MODE ifdefs - . remove some tracertrans related code - - models/atm/cam/src/dynamics/fv/epvd.F90 - . update for XY decomp - - models/atm/cam/src/dynamics/fv/fv_prints.F90 - . converted to XY decomp - . ifdef out unused code to find max/min constituent values - - models/atm/cam/src/dynamics/fv/inidat.F90 - . use dyn_import/export_t containers - . remove dependency on prognostics - . input fields now scattered to XY decomp - - models/atm/cam/src/dynamics/fv/inital.F90 - . use dyn_import/export_t containers - . remove dependency on prognostics - - models/atm/cam/src/dynamics/fv/io_dist.F90 - . add methods needed for read/write of XY decomp from/to restart files - - models/atm/cam/src/dynamics/fv/mapz_module.F90 - . add option for cubic interpolation - - models/atm/cam/src/dynamics/fv/metdata.F90 - . remove unneeded ghosting of met_us, met_vs (it's done in cd_core). - - models/atm/cam/src/dynamics/fv/p_d_adjust.F90 - . modify to use XY decomp only - - models/atm/cam/src/dynamics/fv/par_xsum.F90 - . remove CPP conditional surrounding par_xsum_r4 - - models/atm/cam/src/dynamics/fv/pfixer.F90 - . remove SPMD ifdefs that surrounded !$omp directives. - - models/atm/cam/src/dynamics/fv/restart_dynamics.F90 - . remove prognostics module - . add dyn_out as intent(in) arg to write_restart_dynamics - . modify read/write methods to work with XY decomp - . add dyn_in/out as intent(out) args to read_restart_dynamcis - - models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - . remove tracertrans-related variables - - models/atm/cam/src/dynamics/fv/stepon.F90 - . remove prognostics by adding dyn_state to dyn_comp - . use dyn_import_t and dyn_export_t from dyn_comp - . get rid of lots of local xy arrays that are now part of the import/export - states - . add dyn_in, dyn_out dummy args to stepon_init - . the components of dyn_in are being initialized rather than local variables - . add dyn_in, dyn_out as dummy args to stepon_run1 - . replace actual args to diag_dynvar_ic with components of dyn_out - (previously used prognostics module data). - . replace actual args to dyn_run with dyn_state, dyn_in, dyn_out. - Previously passed prognostics module vars and local xy vars. - . use dyn_out as actual arg to d_p_coupling instead of all the local xy - arrays. - . add dyn_in, dyn_out as intent(out) args to stepon_run2 - . use dyn_in as actual arg to p_d_coupling instead of mix of prognostics - and local xy arrays - . add dyn_in, dyn_out as intent(out) args to stepon_run3 - . pass components of dyn_out as actual args to fv_out - - models/atm/cam/src/dynamics/fv/sw_core.F90 - . change an index range in one calc - - models/atm/cam/src/dynamics/fv/te_map.F90 - . added some SPMD ifdefs - - models/atm/cam/src/dynamics/fv/trac2d.F90 - . add local variable frac to private declaration in !$omp and !CSD$ directives - - models/atm/cam/src/dynamics/fv/uv3s_update.F90 - . update to use XY decomp. Note that u3s and v3s are no longer passed with - ghost regions because the ghost region is taken care of in local variables. - - models/atm/cam/src/dynamics/eul/dyn_grid.F90 - models/atm/cam/src/dynamics/fv/dyn_grid.F90 - models/atm/cam/src/dynamics/sld/dyn_grid.F90 - . move ptimelevels from prognostics to here. - - models/atm/cam/src/physics/cam1/phys_buffer.F90 - models/atm/cam/src/physics/cam1/restart_physics.F90 - . get ptimelevels from dyn_grid instead of prognostics - - models/utils/pilgrim/mod_comm.F90 - models/utils/pilgrim/parutilitiesmodule.F90 - models/utils/pilgrim/puminterfaces.F90 - models/utils/pilgrim/redistributemodule.F90 - . merge with GEOS5 version of pilgrim - -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. - -bluesky: All PASS except: - - 019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 - 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 - 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 - 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 - 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 - -tempest: All PASS except: - - 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 - 021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 - 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 7 - 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 - -bangkok/lf95: All PASS except: - - 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 - 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 - 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 - - All the baseline tests that fail on bluesky, tempest, and bangkok do so - due to changes in the diagnostic OMEGA and OMEGAT fields. - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_3_1 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_2 -Originator(s): Jim Edwards -Date: 4/24/2006 -One-line Summary: Eliminate common block comlun - -Purpose of changes: code clean up - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: self - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: -In control directory: -file comlun.h removed -readinitial.F90 - converted to netcdf f90 interface, modified for ncol format - initial file -runtime_opts.F90, history.F90 - removed reference to ncid_ini and ncid_topo -startup_initial_cond.F90 - made ncid_ini and ncid_topo module variables - added function interfaces initial_file_get_id and topo_file_get_id - to allow read only access to these. -ioFileMod.F90 - made info messages print from masterproc only -error_messages.F90 - added an option integer variable in handle_ncerr to - print the error line number -physics/waccm/tgcm_forcing.F90: removed unused reference to comlun.h -physics/waccm/chemistry.F90: removed unused reference to ncid_trc and comlun.h -physics/cam1/co2_data_flux.F90: removed unused reference to comlun.h -physics/cam1/boundarydata.F90: changed calls to handle_ncerr to add line number -dynamics/*/inidat.F90: changed read_inidat to pass in ncid_ini, ncid_topo - {eul,sld}/spegrd.F90 - {eul,sld}/linemsdyn.F90 - sld/tfilt_massfix.F90 - removed unused refs to comlun.h -tools/scam/scm_init/inital.F90 -tools/scam/scm_init/init_model.F90 - removed refs to comlun.h -ice/csim4/ice_comp.F90 -ice/csim4/ice_data.F90 -ocn/som/somini.F90 -ocn/som/ocn_comp.F90 -ocn/som/somint.F90 -ocn/dom/ocn_comp.F90 -ocn/dom/sst_data.F90 - replaced refs to comlun.h with calls to functions or - local variables as appropriate. - - -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. - -bluesky: All pass - -tempest: All pass - -bangkok/lf95: All pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_1 -Originator(s): Mariana Vertnestein -Date: 4/18/2006 -One-line Summary: bug fixes necessary for CCSM phoenix - -Purpose of changes: Implemented several minor bugs fixes necessary - to run CAM in CCSM on phoenix (Cray X1) - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -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: myself, Jon Wolfe, Brian Eaton - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - M src/control/con_cam.F90 - Modifications put in so that only the lead/master MPI process - redirects its stdout to the appropriate component model log file when - running fully coupled, instead of having every process "open" the same - log file. This change solves the problem of logs getting trashed on - phoenix (which has been recently experienced). The only down side is - that warning and error messages generated by other processes - (non-master processes) get stuck in the job's stdout file, so users - may want to archive job output files as well as component model logs. - In addition, when debugging problems with the model system, certain - error messages which may have previously appeared in component model - logs may now appear in the job output. - - M src/dynamics/fv/trac2d.F90 - M src/dynamics/fv/cd_core.F90 - Removed streaming directives for COUP_CSM mode where a routine is called - from within a streaming region. This problem does not exist in stand-alone - CAM mode, but causes the system to hang or crash in coupled mode. This is - bug will be reported to Cray, but a fix has currently been implemented so - that production runs can occur on phoenix. - the following changes was made for cpp directives: - #if defined(USE_OPM => #if (!definedUSE_OMP) && (!defined COUP_CSM) - -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. - -bluesky: no pre-tag testing was done - -tempest: no pre-tag testing was done - -bangkok/lf95: no pre-tag testing was done - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_3_0 -Originator(s): Mariana Vertenstein -Date: 4/18/2006 -One-line Summary: Directory restructuring for sequential ccsm - -Purpose of changes: - Create new directory structure and mct file renaming for - the next step in the creation of a sequential ccsm starting - from stand-alone cam and for the next step in the ESMF stage - 1 evaluation effort. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: - bld/configure was changed to take into account the new directory - structure and to remove the obsolete mode for the sea ice package "ccmice" - -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: Myself, Brian Eaton - -List all subroutines eliminated: -List all subroutines added and what they do: -The following lists the directory restucturing and file renaming that was done - - D atm/cam/src/ocnsice/dom/sst_data.F90 => A models/ocn/dom/sst_data.F90 - D atm/cam/src/ocnsice/dom/ocn_types.F90 => A models/ocn/dom/ocn_types.F90 - D atm/cam/src/ocnsice/dom/albocean.F90 => A models/ocn/dom/albocean.F90 - D atm/cam/src/ocnsice/dom/print_coverage.F90 => A models/ocn/dom/print_coverage.F90 - D atm/cam/src/ocnsice/dom/parpbl.h => A models/ocn/dom/parpbl.h - D atm/cam/src/ocnsice/dom/ocn_comp.F90 => A models/ocn/dom/ocn_comp.F90 - D atm/cam/src/ocnsice/dom/albedo.h => A models/ocn/dom/albedo.h - D atm/cam/src/ocnsice/dom/wtrc_flxoce.F90 => A models/ocn/dom/wtrc_flxoce.F90 - D atm/cam/src/ocnsice/dom/MCT_ocn_comp.F90 => A models/ocn/dom/flxoce.F90 - D atm/cam/src/ocnsice/dom/flxoce.F90 => A models/ocn/dom/ocn_comp_mct.F90 - D atm/cam/src/ocnsice/dom/srfoce.F90 => A models/ocn/dom/srfoce.F90 - - D atm/cam/src/ocnsice/som/ocn_types.F90 => A models/ocn/som/ocn_types.F90 - D atm/cam/src/ocnsice/som/albocean.F90 => A models/ocn/som/albocean.F90 - D atm/cam/src/ocnsice/som/mixed_layer_globalcalcs.F90 => A models/ocn/som/mixed_layer_globalcalcs.F90 - D atm/cam/src/ocnsice/som/ocn_srf.F90 => A models/ocn/som/ocn_srf.F90 - D atm/cam/src/ocnsice/som/parpbl.h => A models/ocn/som/parpbl.h - D atm/cam/src/ocnsice/som/somint.F90 => A models/ocn/som/somint.F90 - D atm/cam/src/ocnsice/som/ocn_comp.F90 => A models/ocn/som/ocn_comp.F90 - D atm/cam/src/ocnsice/som/ocean_data.F90 => A models/ocn/som/ocean_data.F90 - D atm/cam/src/ocnsice/som/somini.F90 => A models/ocn/som/somini.F90 - D atm/cam/src/ocnsice/som/MCT_ocn_comp.F90 => A models/ocn/som/flxoce.F90 - D atm/cam/src/ocnsice/som/flxoce.F90 => A models/ocn/som/ocn_comp_mct.F90 - - D ice/csim4/MCT_ice_comp.F90 => A models/ice/csim4/ice_comp_mct.F90 - - A models/drv/seq_mct/seq_mct_mod.F90 - D atm/cam/src/control/MCT_atmocn_cpl.F90 => A models/drv/seq_mct/map_atmocn_mct.F90 - D atm/cam/src/control/MCT_atmlnd_cpl.F90 => A models/drv/seq_mct/map_atmlnd_mct.F90 - D atm/cam/src/control/MCT_iceocn_cpl.F90 => A models/drv/seq_mct/map_iceocn_mct.F90 - D atm/cam/src/control/MCT_atmice_cpl.F90 => A models/drv/seq_mct/map_atmice_mct.F90 - D atm/cam/src/control/MCT_lndhub_comp.F90 => A models/drv/seq_mct/mrg_x2l_mct.F90 - D atm/cam/src/control/MCT_atmhub_comp.F90 => A models/drv/seq_mct/mrg_x2a_mct.F90 - D atm/cam/src/control/MCT_icehub_comp.F90 => A models/drv/seq_mct/mrg_x2i_mct.F90 - D atm/cam/src/control/MCT_ocnhub_comp.F90 => A models/drv/seq_mct/mrg_x2o_mct.F90 - D atm/cam/src/control/MCT_seq.F90 => A models/drv/seq_mct/seq_mct_init.F90 - D atm/cam/src/control/cam.F90 => A models/drv/seq_mct_drv/seq_ccsm_drv.F90 - D atm/cam/src/control/seq_fields_indices.F90 => A models/drv/seq_flds_indices/seq_flds_indices.F90 - D atm/cam/src/control/seq_fields_mod.F90 => A models/drv/seq_flds/default/seq_flds_mod.F90 - - D atm/cam/src/control/MCT_atm_comp.F90 => A models/atm/cam/src/control/atm_comp_mct.F90 - -List all existing files that have been modified, and describe the changes: - - M atm/cam/tools/scam/configure - M atm/cam/tools/scam/scm_init/init_model.F90 - M atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 - M atm/cam/tools/scam/scm_init/scam_run.F90 - M atm/cam/bld/configure - Modified these files to work with above directory restructuring and file renaming - - M models/SVN_EXTERNAL_DIRECTORIES - Modified to use clm branch tag cammct05_clm3_expa_58 - -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. - -bluesky: None - -tempest: None - -bangkok/lf95: None - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_60 (this is the previous tag) - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_60 -Originator(s): Mariana Vertenstein -Date: 4/11/2006 -One-line Summary: Introduction of MCT CAM-surface coupling - -Purpose of changes: - Incoporate MCT cam-surface component coupling for all - CAM surface components. Introduce the appropriate thin-layer - design for MCT coupling that can also be extended to ESMF. - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -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: - ***These have to still be determined*** - -Code reviewed by: - Erik Kluzek - -List all subroutines eliminated: - D atm/cam/src/physics/cam1/camhub_comp.F90 - -List all subroutines added and what they do: - - A atm/cam/src/control/MCT_atmhub_comp.F90 - A atm/cam/src/control/MCT_lndhub_comp.F90 - A atm/cam/src/control/MCT_ocnhub_comp.F90 - A atm/cam/src/control/MCT_icehub_comp.F90 - -introduced these routines to merge necessary - input for atm, lnd, ocn and ice states - (e.g. MCT_atm_hub_comp.F90 merges lnd,ocn and ice - states and fluxes to create the necessary input - atm attribute vector) - These hub component routines act only on MCT attribute vectors - - A atm/cam/src/control/MCT_atmlnd_cpl.F90 - A atm/cam/src/control/MCT_iceocn_cpl.F90 - A atm/cam/src/control/MCT_atmocn_cpl.F90 - A atm/cam/src/control/MCT_atmice_cpl.F90 - A atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 - -introduced new MCT couplers - (e.g. MCT_atmlnd_cpl.F90 maps between atm and lnd domains) - These couplers act only on MCT attribute vectors - - A atm/cam/src/ocnsice/dom/ocn_types.F90 - -introduced new dom specific data structures (ocn_in, ocn_out) - so that MCT could map directory to the dom input/output states - A atm/cam/src/ocnsice/som/ocn_types.F90 - -introduced new som specific data structures (ocn_in, ocn_out) - so that MCT could map directory to the dom input/output states - A ice/csim4/ice_types.F90 - -introduced new csim specific data structures (ice_in, ice_out) - so that MCT could map directory to the dom input/output states - - A ice/csim4/MCT_ice_comp.F90 - -introduced MCT_ocn_comp.F90 that map MCT attribute vectors - to ice_in and ice_out to MCT attribute vectors - A atm/cam/src/ocnsice/dom/MCT_ocn_comp.F90 - -introduced MCT_ocn_comp.F90 that map MCT attribute vectors - to ocn_in and ocn_out to MCT attribute vectors - A atm/cam/src/ocnsice/som/MCT_ocn_comp.F90 - -introduced MCT_ocn_comp.F90 that map MCT attribute vectors - to ocn_in and ocn_out to MCT attribute vectors - - A atm/cam/src/control/seq_fields_indices.F90 - -contains integer indices for all possible character strings that - represent cam and cam surface model couling - A atm/cam/src/control/con_cam.F90 - -replaced part of cam.F90 that dealt with running cam in COUP_CSM mode - -List all existing files that have been modified, and describe the changes: - - M ice/csim4/ice_data.F90 - -removed srfflx_state2d from input argument and replaced it with frac - (frac a frac_t defined type now specific to ice/csim4) - M ice/csim4/ice_dh.F - -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) - A ice/csim4/print_coverage.F90 -> D atm/cam/src/ocnsice/som/print_coverage.F90 - M ice/csim4/ice_srf.F90 - -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) - M ice/csim4/ice_diagnostics.F - -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) - D ice/csim4/camice.F90-> A ice/csim4/ice_comp.F90 - -renamed camice.F90 -> ice_comp.F90 and introduced ice_in and ice_out - states to replace srfflx_parm2d_ocn, srfflx_state2d. - -added functionality to read landfrac from cam initial file and store it - as a module variable, rather than use it from camsrf. - - M atm/cam/tools/scam/configure - M atm/cam/tools/scam/testscript - M atm/cam/tools/scam/scm_init/init_model.F90 - M atm/cam/tools/scam/scm_init/scam_srfdata.F90 - M atm/cam/tools/scam/scm_init/scam_run.F90 - M atm/cam/tools/scam/scm_init/inital.F90 - M atm/cam/tools/scam/scm_init/scamMod.F90 - M atm/cam/tools/scam/ui/configure - -incorporated changes into above scam routines so that - they could work with new MCT coupling to surface models - - M atm/cam/tools/cprnc/Makefile - - M atm/cam/src/control/MCT_atm_comp.F90 - -introduced MCT_ocn_comp.F90 that map MCT attribute vectors - to cam_in and cam_out to MCT attribute vectors - M atm/cam/src/control/ccsm_msg.F90 - -extended restart functionality to use logic previously in restart_physics - M atm/cam/src/control/cam.F90 - -this is now a top level MCT coupling driver for stand-alone CAM - M atm/cam/src/control/seq_fields_mod.F90 - -generalized routine to account for cam-ice and cam-ocn coupling - M atm/cam/src/control/restart.F90 - -made changes to removed srfflx_parm and srfflx_state from camsrfexch_typees - M atm/cam/src/control/startup_initialconds.F90 - -removed call to close ncid_topo - -removed srfflx_state2d argument to read_inidat and initial_conds - M atm/cam/src/control/cam_comp.F90 - -removed srfflx_parm from camsrfexch_types use - -removed cam_in from call to cam_initial and read_restart - -added call to hub2atm_alloc - - M atm/cam/src/physics/cam1/comsrf.F90 - -removed snowhland, tsocn and renamed landfrac_field->landfrac_glob - M atm/cam/src/physics/cam1/diagnostics.F90 - -removed outfld calls for TBOT,SNOWHLND,TSOCN - -removed comsrf uses for tsocn - -removed snowhland as input argument - M atm/cam/src/physics/cam1/tphysbc.F90 - -removed snowh ans input argument - M atm/cam/src/physics/cam1/restart_physics.F90 - -removed calls to output srfflx_state2d fields - moved these to - ccsm_msg.F90 and MCT_atmhub_comp.F90. - M atm/cam/src/physics/cam1/physpkg.F90 - D atm/cam/src/physics/cam1/camsrfexch_types.F90 -> A atm/cam/src/control/camsrfexch_types.F90 - -removed module routines bounding, verify_fractions, srfflx_parm_reset, - srfcomp2hub_alloc - -renamed atm2srf_alloc->atm2hub->alloc - -removed srfflx_parm derived type and added snowhland as part of srfflx_state - definition - D atm/cam/src/physics/cam1/srfxfer.F90 -> A atm/cam/src/control/srfxfer.F90 - -cosmetic changes only - M atm/cam/src/physics/cam1/tphysac.F90 - -removed snowh as input argument - M atm/cam/src/ocnsice/dom/sst_data.F90 - - removed landfrac from argument list - M atm/cam/src/ocnsice/dom/albocean.F90 - - removed landfrac from argument list - D atm/cam/src/ocnsice/dom/camoce.F90 -> A atm/cam/src/ocnsice/dom/ocn_comp.F90 - -renamed camoce.F90 -> ocn_comp.F90 and introduced ocn_in and ocn_out - states to replace srfflx_parm2d_ocn, srfflx_state2d. - -added functionality to read landfrac from cam initial file and store it - as a module variable, rather than use it from camsrf. - -introuced ocn_IC_OUTPUT routine to output TSOCN to initial file. - - M atm/cam/src/ocnsice/som/albocean.F90 - - removed landfrac from argument list - D atm/cam/src/ocnsice/som/print_coverage.F90 - -removed routine, no longer needed - M atm/cam/src/ocnsice/som/mixed_layer_globalcalcs.F90 - -added landfrac_glob to argument list, replace landfrac_field->landfrac_glob - M atm/cam/src/ocnsice/som/ocn_srf.F90 - -removed Tffresh, rhow, cp_ocn from ice_constants use statement and used - SHR_CONST_ROWSW, SHR_CONST_CPSW and SHR_CONST_TKFREZ from shr_const_mod instead - D atm/cam/src/ocnsice/som/somoce.F90 -> A atm/cam/src/ocnsice/som/ocn_comp.F90 - -renamed somoce.F90 -> ocn_comp.F90 and introduced ocn_in and ocn_out - states to replace srfflx_parm2d_ocn, srfflx_state2d. - -added functionality to read landfrac from cam initial file and store it - as a module variable, rather than use it from camsrf. - -introuced ocn_IC_OUTPUT routine to output TSOCN to initial file. - -added landfrac_glob as argument to gmean and check_conservation calls - -repalce Focn->ocn_out%frzmlt - -removed use of camice (Focn, frzmlt, aice, sicthk, snowhice now obtained - via ocn_in and ocn_out) - -removed ice_constants use for rhow, cp_ocn and used - SHR_CONST_ROWSW, SHR_CONST_CPSW from shr_const_mod instead - - M atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 - M atm/cam/src/chemistry/trop_mozart/chemistry.F90 - -removed snowhland from camsrf use and added to argument list (part of cam_in) - - M atm/cam/src/dynamics/sld/stepon.F90 - M atm/cam/src/dynamics/eul/stepon.F90 - -removed srfflx_state and srfflx_parm use statements - - M atm/cam/src/dynamics/sld/inidat.F90 - M atm/cam/src/dynamics/eul/inidat.F90 - M atm/cam/src/dynamics/fv/inidat.F90 - -changed varialbe names (surface_state->cam_out) - -introduced landfrac_glob and removed use of landfrac from comsrf - -removed srfflx_state use from camsrfexch_types - - M atm/cam/src/dynamics/sld/inital.F90 - M atm/cam/src/dynamics/eul/inital.F90 - M atm/cam/src/dynamics/fv/inital.F90 - -changed varialbe names (surface_state->cam_out) - -removed srfflx_state2d as input argument - -removed call to hub2atm_alloc and renamed atm2srf_alloc->atm2hub_alloc - -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. - -bluesky: - 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 - 019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 - 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 - 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 - 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 - 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 - 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 - 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 - All these tests only contain differences in the following fields - LHFLXOI, SHFLXOI, FSNSOI - with RMS values on the order of 1.e-15 - In addition, TBL.f2h.outfrq24h contained a difference in QFLX on the order of 1.-e23 - So even though the TBL tests fail, this tag does not change answers. - -tempest: - 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 - diffs set in at NSTEP=47 - 021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 - only QRS is different in cprnc.out with an RMS on the order of 3.e-24 - 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 - only SNOWHICE is different in cprnc.out with an RMS on the order of 1.e-23 - 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 - only VD01 is different in cprnc.out with an RMS on the order of 4.e-25 - -bangkok/lf95: - 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 - diffs set in at NSTEP=29 - 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 - differences are only in SHOWHICE with RMS value of 5.e-21 - 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 - diffs set in at nstep=9 - 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - diffs set in at nstep=3 - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_59 -Originator(s): mvr, eaton, edwards -Date: 4/6/06 -One-line Summary: collection of bug fixes - -Purpose of changes: -bug fixes for ccsm testing, cray directive on phoenix, compiler workaround -on bluevista, coupled runs on tempest; added cron scripts to repository - -Bugs fixed (include bugzilla ID): -bug#68 is resolved - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, eaton, edwards - -List all subroutines eliminated: -D models/atm/cam/test/system/td_nightly_aix.sh -D models/atm/cam/test/system/td_nightly_linux.sh -- post-tag cron jobs were renamed - -List all subroutines added and what they do: -A + models/atm/cam/test/system/posttag_cron_bangkok.sh -A + models/atm/cam/test/system/posttag_cron_bluesky.sh -A models/atm/cam/test/system/posttag_cron_lightning.sh -A models/atm/cam/test/system/posttag_cron_bluevista.sh -- post-tag cron job scripts for machine-specific testing of cam - -List all existing files that have been modified, and describe the changes: -M models/atm/cam/test/system/TSB.ccsm.sh -M models/atm/cam/test/system/TCB.ccsm.sh -- mods to make cam's ccsm test scripts compatible with changes in ccsm scripts - -M models/atm/cam/test/system/test_driver.sh -M models/atm/cam/test/system/CAM_runcmnd.sh -- test scripts now use unix utility 'hostname' to determine local machine - -M models/atm/cam/src/physics/cam1/dmsbnd.F90 -- removed debug print statement left behind - trips up coupled runs on tempest - -M models/atm/cam/src/physics/cam1/physpkg.F90 -- added workaround for code introduced in cam3_2_58 which trips xlf bug on bluevista - -M models/atm/cam/src/dynamics/fv/fv_prints.F90 -- fix of bug in cpp definition CPP_PRT_PREFIX on phoenix - - - -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. - -bluesky: all PASS - -tempest: all PASS - -bangkok/lf95: all PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_58 -Originator(s): Jim Edwards -Date: 4/4/2006 -One-line Summary: changes for ncol dataset support - -Purpose of changes: Allows data input on non-rectangular grids using an alternative input file format - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: none, no new boundary datasets - are provided at this time - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, Eaton - -List all subroutines eliminated: renamed file zonalbndydata.F90 to boundarydata.F90 - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - renamed file zonalbndydata.F90 to boundarydata.F90 - dmsbnd.F90 prescribed_aerosols.F90 : added support for ncol based input dataset - chemistry.F90 ozone_data.F90: changed module names from zonalndydata to boundarydata - - -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. - -bluesky: one fails - 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 - - That's due to a change in the CCSM scripts in ccsm3_1_beta24. The test - passes when run in ccsm3_1_beta23. Mat is modifying the CAM test to work - with the new CCSM scripts. - -tempest: all pass - -bangkok/lf95: all pass - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_57 -Originator(s): pworley -Date: Sun Apr 2 12:22:18 MDT 2006 -One-line Summary: Performance optimizations, primarily for Cray-X1E - -Purpose of changes: - - To restore X1E performance lost in recent check-ins; to fix X1E and XT3 - bugs. - -Bugs fixed (include bugzilla ID): - - PGI compile problem; aqua planet error on X1E. - -Describe any changes made to build system: none - -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: - - Performance on X1E doubled compared to 3_2_56 when running T85 on 128 - processors. - -Code reviewed by: myself, eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - a) Vectorized routines chunk_to_buff and buff_to_chunk used by MCT in - land/atmosphere communication and in coupler/atmosphere communication: - - M atm/cam/src/physics/cam1/phys_grid - - buff_to_chunk, chunk_to_buff: interface clean up and vector-friendly - reimplementation - - M atm/cam/src/control/ccsm_msg.F90 - M atm/cam/src/control/MCT_atm_comp - - changed parameters in calls to buff_to_chunk and chunk_to_buff - - b) Fixed bug on X1E caused by diagnostic message output inside streamed - code segment - - M atm/cam/src/dynamics/fv/fill_module.F90 - - surrounded (non fatal) error test with ifdef DEBUG cpp logic - - c) Introduced workaround for PGI compiler bug - - M lnd/clm2/src/biogeophys/Hydrology2Mod.F90 - - removed unnecessary "use" of spmdMod - - d) Optimized performance of MCT Rearranger routine - - M utils/mct/mct/m_Rearranger - - added new optional parameter ALLTOALL and modified code in rearrange_ - to implement an MPI_Alltoallv option for interprocessor communication. - - reordered the send/receive pattern for the non-ALLTOALL implementation - to decrease link and processor contention. - - Reduced number of allocate/deallocate requests. - - M utils/mct/mpi-serial/collective.c - M utils/mct/mpi-serial/mpi.h - - add mpi_alltoallv interfaces (from Ray Loy) - - M lnd/clm2/src/main/MCT_atmlnd_cpl - - added optional parameters VECTOR and ALLTOALL to calls to MCT_Rearrange, - setting VECTOR to .true. if CPP_VECTOR is defined, and setting - ALLTOALL to .true. if SYSUNICOS is defined. Otherwise they are - set to .false. . - - Note that ALLTOALL=.true. may be a better choice for all systems, - but I have only verified this on the X1E. - - e) Improved vector performance in CLM/MCT interface. - - M lnd/clm2/src/main/MCT_lnd_comp - - made minor change to index logic to improve vectorization on the X1E - - f) Improved performance (both vector and nonvector) in routines that - map to/from CLM grid - - M areaMod - - added support for mapping multiple fields in one call to - gridmap_mapparray - - reimplemented gridmap_mapparray to improve vector performance, - incuding changing calling interface - - M clm_atmlnd - - modified logic in clm_mapa2l and clm_mall2a to call gridmap_array once - for all fields - - made other minor modifications to improve vectorization - -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. - -bluesky: All PASS except: - 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 - - That's due to a change in the CCSM scripts in ccsm3_1_beta24. The test - passes when run in ccsm3_1_beta23. Mat is modifying the CAM test to work - with the new CCSM scripts. - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_56 -Originator(s): mvr -Date: 3/27/06 -One-line Summary: -test_driver.sh made to run interactive; test scripts modified for use -on lightning, bluevista; new tests added; some bugs fixes - -Purpose of changes: -wanted to test on lightning, bluevista - -Bugs fixed (include bugzilla ID): -ccsm tests work again - -Describe any changes made to build system: -LAPACK library replaced with ESSL library as default for WACCM_MOZART -configurations on AIX - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself, eaton - -List all subroutines eliminated: -D atm/cam/test/system/input_tests_aix -D atm/cam/test/system/input_tests_linux -D atm/cam/test/system/input_tests_irix -D atm/cam/test/system/input_tests_aix_nightly -D atm/cam/test/system/input_tests_linux_nightly -- these files were renamed - - -List all subroutines added and what they do: -A + atm/cam/test/system/tests_pretag_bluesky -A + atm/cam/test/system/tests_pretag_bangkok -A + atm/cam/test/system/tests_pretag_tempest -A + atm/cam/test/system/tests_posttag_bluesky -A + atm/cam/test/system/tests_posttag_bangkok -- newly renamed files - -A atm/cam/test/system/tests_posttag_bluevista -A atm/cam/test/system/tests_posttag_lightning -- new files containing tests for respective platforms - -A atm/cam/test/system/config_files/f1.9h -- new config options file for testing fv 1.9x2.5 resolution -A atm/cam/test/system/TPF.sh -- new test script for performance testing - - -List all existing files that have been modified, and describe the changes: -M atm/cam/test/system/test_driver.sh -- made to run interactive (ie will create/spawn command file to machine's - batch queue); added support for lightning, bluevista; added env var to - specify ccsm tag to be used for testing -M atm/cam/test/system/CAM_runcmnd.sh -- added logic for setting run command on lightning, bluevista -M atm/cam/test/system/TCB.sh -- uses new env var for setting options to configure -M atm/cam/test/system/TSB.ccsm.sh -- bug with ccsm test now fixed - files/dirs now compatible with ccsm scripts -M atm/cam/test/system/TCB.ccsm.sh -- now specifies resources for ccsm test; general cleanup -M atm/cam/test/system/TBL.sh -- minor cleanup -M atm/cam/test/system/td_nightly_aix.sh -- posttag cron script modified with new call to test_driver.sh; - now spawns testing on lightning, bluevista -M atm/cam/test/system/td_nightly_linux.sh -- posttag cron script modified with new call to test_driver.sh -M atm/cam/test/system/input_tests_master -- added performance test, ccsm test w/bgc, ccsm test w/trop_mozart chemistry -M atm/cam/test/system/tag_email.sh -- posttag cron script now used 'mail' to notify developers of new tag -M atm/cam/bld/configure -- now uses ESSL rather than LAPACK library for waccm_mozart on aix - -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. - -bluesky: -055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 -- compatibility bug w/ccsm scripts fixed, this test should pass going forward - -tempest: -- none - -bangkok/lf95: -004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 5 -008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 5 -010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 5 -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 5 -016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 5 -024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 5 -026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 5 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 5 -032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 5 -036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 5 -038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 5 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 5 -- baseline tests failed due to change in env vars used in testing; these tests - should pass going forward - -CAM tag used for the baseline comparison tests if different than previous -tag: ccsm testing used cam3_2_51 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_55 -Originator(s): Francis Vitt -Date: Fri Mar 24 16:51:04 MST 2006 -One-line Summary: Fixed bug in mo_drydep.F90 - -Purpose of changes: To compile and run on lighting - -Bugs fixed (include bugzilla ID): 60 - -Describe any changes made to build system: none - -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: - -Code reviewed by: Jeff Lee ( Yen-Huei Lee) - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: -U models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - changed parameter n_drydep_species from 52 to 53 - - -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. - -bluesky: - -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - Dry deposition species have changed. Bit for bit comparison to - previous version is expected to fail. -055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 - CCSM scripts have changed causing this test to fail - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_54 -Originator(s): Jim Edwards -Date: 03/21/06 12:36PM -One-line Summary: addresses bug reported in http://bugs.cgd.ucar.edu/show_bug.cgi?id=56 - -Purpose of changes: - -Bugs fixed (include bugzilla ID): 56 ccsm cannot read co2 data file - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - co2_data_flux.F90 changed variable for date and sec to explicitly allocated - arrays. - -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. - -This file is used only with ccsm, no stand-alone tests are available. We have confirmed the -change using ccsm3_1_beta23. - -=============================================================== -=============================================================== - -Tag name: cam3_2_53 -Originator(s): Francis Vitt -Date: Thu Mar 16 09:00:35 MST 2006 - -One-line Summary: - Changes to trop_mozart chemistry for CCSM coupled mode. - -Purpose of changes: - To run CAM with trop_mozart in CCSM and pass acceptance tests - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - New initial coniditions files are used from trop_mozart chemistry. - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/bld/DefaultCAMEXPNamelist.xml - changed IC data files for trop_mozart - - models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - Changed loop indexing where constituent fields are output - to history file to be compatable with BGC package - - models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - Added H2 to the dry deposition species list - - models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 - Initialize surface fluxes to zero before setting to data - - models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 - Increaesed the length of filename to 265 characters - -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. - -bluesky: - -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - These bit-for-bit comparisons to the previous version of trop_mozart - chemistry are expected fail since H2 was added to dry deposition - and different initial conditions are used - -055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 - CCSM scripts have changed causing this test to fail - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name:cam3_2_52 -Originator(s): Jim Edwards -Date: Thu Mar 9 17:11:49 MST 2006 -One-line Summary: netcdf f90 interface, interpaerosols update - -Purpose of changes: non lat/lon grid integration - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: Brian Eaton - -List all subroutines eliminated: copies of bilin and kinds were eleminated from - the interpaerosols directory; subroutine lininterp was overloaded to - avoid several names for the same basic functionality - -List all subroutines added and what they do: lininterp2d1d - interpolate from a 2d lat/lon field to a 1d ncols field - this subroutine is private in interpolate_data.F90 and accesible through the lininterp interface. - -List all existing files that have been modified, and describe the changes: -A host of files were changed in the physics/cam1 directory to move from netcdf f77 interface to the f90 interface. - -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. - -bluesky: - -tempest: - -bangkok/lf95: - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -=============================================================== - -Tag name: cam3_2_51 -Originator(s): eaton -Date: Fri Feb 17 18:27:20 MST 2006 -One-line Summary: configure and Makefile mods - -Purpose of changes: - - . Modify Makefile to enable threading with lf95 and pathf90. - *** N.B. *** lf95 (v6.2) still has severe per thread stacksize limits. - I was only able to get threading to work with the --threadheap option - which puts the thread memory on the heap. That option however doesn't - work with debug flags -g, --chk, or --chkglobal. Set up the Makefile - to allow threading only in non-debug mode. - - . Modify configure so that the checks for include files and libraries are - not done when the -ccsm flag is set since the CAM Makefile is not used - in that case. - - . Modify configure to require that the configure script and all - associated configuration files live in a specified subdirectory of the - source tree for the source being built. This is for robustness. Using - configure with source or configuration files from outside a source tree - that represents a fixed source version is fraught with peril. - - . Add -linker option to the configure script to enable specifying a - linker which is different from the Fortran compiler. This is - particulary useful on Linux platforms where specifying mpif90 as the - linker automatically provides the correct linkage for the MPI - libraries. Note that this depends on the user's PATH being set so that - the correct mpif90 is used, i.e., the one that's consistent with the - Fortran compiler being used. - - . Modify configure to run its tests in a subdirectory of the CAM build - directory. This avoids having the Makefile build the dependency list - for the full CAM just to run the tests, and consequently they run much - faster. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: described above - -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: eaton - -List all subroutines eliminated: - - bld/Makefile -- renamed Makefile.in - -List all subroutines added and what they do: - - bld/Makefile.in -- was Makefile - -List all existing files that have been modified, and describe the changes: - - bld/configure - . Remove -cam_cfg option and CAM_CFGDIR environment variable: require all - configuration files to be in the same directory as the configure script. - . remove -cam_root option and CAM_ROOT environment variable: require - configure to be located in the CAM src tree. - . Modifications for CCSM build: delete setting of locations for all - external include/mod/lib directories. These are only needed for the CAM - Makefile which is not produced when doing a CCSM build. - . Remove -esmf_* options. This was used with the ESMF prototype library - which is no longer supported. Will re-implement ESMF options when we - start linking the new ESMF library. - . add -linker option - . use it to set the USER_LINKER macro in the Makefile - . Run tests in a subdirectory of the CAM build directory. - - bld/Makefile.in - . add "--openmp --threadheap 4096" to FFLAGS and LDFLAGS when SMP is - defined for lf95 compiler - . add -mp to FFLAGS and LDFLAGS when SMP is defined for pathf90 compiler - . Remove default settings of macros that are set by configure. - . Remove ESMF macros except for ESMF_MOD and ESMF_LIB. Currently these are - not set by configure, but they will be when we start linking to the ESMF - library. - . add LINKER macro to be used to link cam executable. - . set LINKER to $(USER_LINKER) if it's defined, otherwise use platform - default which is $(FC) on most platforms, but is "$(CC) -f90lib" on the - SX6 and ES. - - bld/mkDepends - . add fix from Tom Henderson to include Fortran syntax includes in the - dependencies (previously only recognized cpp syntax). - -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. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - NONE - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_50 -Originator(s): eaton -Date: Sat Feb 4 08:28:03 MST 2006 -One-line Summary: Fix FV memory leak & non-adv tracers. SCAM bugfixes. Fix Cray build problem. - -Purpose of changes: - - 1. Fix for FV memory leak found by Siddhartha Ghosh - - 2. Mods FV dycore from Jean-Francois Lamarque to advect only the advected - constituents - - 3. Mod from Rob Jacob to fix the MCT problem on the Cray (replace - "system" call with "ishell") - - 4. Bug fixes for scam from John Truesdale - . Corrects a C++ usage error when using the newest gcc compiler - . Allows the model to use scam generated initial conditions. - . Allows the model to use user generated data for input. - -Bugs fixed (include bugzilla ID): - - Described in Purpose of changes section. The memory leak in FV is - bugzilla ID 26. - -Describe any changes made to build system: - - Define the SYSUNICOS cpp macro when running on Cray. - -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: eaton - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - 1. FV memory leak - dynamics/fv/FVCAM_GridCompMod.F90 - . move allocation of q_internal to top of run method, and deallocation to - bottom of method -- like all the rest of the allocation/deallocation - pairs. - - 2. Mods FV dycore - dynamics/fv/FVCAM_GridCompMod.F90 - . call create_vars with ntotq as actual arg rather than nq - dynamics/fv/inital.F90 - . use pcnst as actual arg corresponding to dummy arg nq in Initialize arg - list - dynamics/fv/restart_dynamics.F90 - . use pcnst as actual arg corresponding to dummy arg nq in Initialize arg - list - - 3. Mod to fix the MCT problem on the Cray - bld/Makefile - . add -DSYSUNICOS to FPPFLAGS for UNICOS/mp build - - 4. Bug fixes for scam - scm_init/runtype.h - scm_init/readsaveinit.F90 - ui/LoadData.ui - ui/plot.h - ui/dataset.cpp - ui/LoadDataImpl.cpp - ui/ncfile.h - - Changes to external code: - - The following fix was made in $SVNREPOS/mct/trunk/mpeu - m_FileResolv.F90 - . use ishell rather than system command when SYSUNICOS is #define'd - - A new tag for MCT was created: $SVNREPOS/mct/mct/trunk_tags/MCT2_2_0_060203 - and CAM's external property for MCT was changed to that tag. - -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. - -bluesky: All PASS - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_49 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_49 -Originator(s): Tony Craig -Date: Thu Feb 2 11:10:17 MST 2006 -One-line Summary: - - Update CLM source code to clm3_expa_56 - -Purpose of changes: - - Bring in a latest version of clm3 which includes changes in - infrastructure to support finemesh integrations. This version - of clm is 100% backward compatable with namelist and datasets - and is bfb with recent version of clm3. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new optional namelist - added to clm, fatmgrid. - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: tcraig, mvr - -List all subroutines eliminated: No changes in CAM - -List all subroutines added and what they do: No changes in CAM - -List all existing files that have been modified, and describe the changes: - No changes in CAM - -models/lnd/clm2/src/main: - initGridIndexMod.F90,lnd2atmMod.F90,CNiniTimeVar.F90, - abortutils.F90,clm_comp.F90,driver.F90,clm_camMod.F90,atmdrvMod.F90, - subgridRestMod.F90,accFldsMod.F90,clmtypeInitMod.F90,initializeMod.F90, - pftdynMod.F90,iniTimeConst.F90,histFileMod.F90,program_csm.F90, - clm_atmlnd.F90,clm_varsur.F90,clm_csmMod.F90,restFileMod.F90, - surfFileMod.F90,controlMod.F90,initSurfAlbMod.F90,initSubgridMod.F90, - clm_varctl.F90,ndepFileMod.F90,initGridCellsMod.F90,MCT_lnd_comp.F90, - program_off.F90,domainMod.F90,decompMod.F90,areaMod.F90,clmtype.F90, - histFldsMod.F90 - -models/lnd/clm2/src/riverroute: - RtmMod.F90 - -models/lnd/clm2/src/biogeochem: - CASAMod.F90,DUSTMod.F90,CNPhenologyMod.F90,STATICEcosysDynMod.F90, - DGVMMod.F90,CNrestMod.F90,VOCEmissionMod.F90,CNNDynamicsMod.F90, - CNVegStructUpdateMod.F90 - -models/lnd/clm2/src/biogeophys: - BalanceCheckMod.F90,SurfaceRadiationMod.F90,SoilTemperatureMod.F90, - Biogeophysics1Mod.F90,Biogeophysics2Mod.F90,FrictionVelocityMod.F90, - Hydrology1Mod.F90,Hydrology2Mod.F90,BiogeophysicsLakeMod.F90, - HydrologyLakeMod.F90,BareGroundFluxesMod.F90,CanopyFluxesMod.F90 - SurfaceAlbedoMod.F90 - -Code changes: *** Only in clm code *** - Merge atm2lnd_state_type, atm2lnd_flux_type. Same for lnd2atm state/flux. - Related changes in clm3 and elsewhere in code. - Add domainMod.F90 and domain_type. Migrate grid data into domain type. - Instantiate adomain(atm/coarse), ldomain(lnd/finemesh), rdomain(rtm), - ddomain(atmdrv external data) in model. - Add lats, latn, lonw, lone 2d arrays and associated code changes. - Cleanup areaMod.F90; merging subroutines, removing redundant code, eliminate - *_point routines. - Remove numlon - Add decomp_type for gcelldc and gcellsn. Remove redundant data in other - arrays related to addressing physical space and logical space. - Clean up interface in set_landunit subroutines. Remove redundant code. - Clean up procs and clumps datatypes, removing redundant data. - Migrate clm3 topology data to pointers from copies - Add gridmap_type for interpolation and associated code and routines to - support the type. - Add clm_atmlnd.F90 file for upscale/downscale code. Add clm_mapa2l - and clm_mapl2a to carry out mapping associated with upscale/downscale. - Add gridmap_setmapsFM for generation of weights for downscale/upscale - routines. - forc_ndep should not be in atm2lnd_type. - Reuse new code as much as possible throughout. - Rename latixy and longxy to latc and lonc. - Remove fullgrid attribute. - Add pftm to domain datatype and history file - Modify coupling to handle coarse <-> finemesh for standlaone, cam, and - ccsm. - Add normalized area to history files - Add lat_a, lon_a, latdeg_a, londeg_a to clm3 datatype for atm lats/lons. - required in SurfaceAlbedo computation where the the zenith angle has - to be based on the atm (coarse) grid, not the fine clm grid. - - -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. - -bluesky: All PASS - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_48 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - Answers are bit-for-bit. - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== - -=============================================================== - -Tag name: cam3_2_48 -Originator(s): Francis Vitt -Date: -One-line Summary: - - Update to the tropospheric chemistry code and fixes to the offline driver. - -Purpose of changes: - - The updates to the tropospheric chemistry code where done to include - into CAM the latest MOZART chemistry and to provide the option to - to use interactive dry deposition and interactive photolysis rates - rather than the prescribed table look up methods. - - Changes to the offline dynamics driver were done to fix a total energy - conservation issue that was evident with simulations longer than two - months. A fix to a bug which occurred in high resolution runs is also - included. - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - -added: - - character(len=256) :: depvel_file - character(len=256) :: depvel_lnd_file - character(len=256) :: clim_soilw_file - character(len=256) :: season_wes_file - character(len=256) :: trop_pause_file - character(len=256) :: lght_landmask_file - real(r8) :: lght_no_prd_factor - logical :: xactive_prates - logical :: xactive_drydep - character(len=256) :: photopath - character(len=8) :: emis_type - integer :: emis_date - integer :: emis_yr_offset - character(len=256) :: met_filenames_list - -removed: - chem_config - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: Brian Eaton - -List all subroutines eliminated: - - models/atm/cam/src/chemistry/trop_mozart/mo_waccm_photo.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_read_chm_sim.F90 - models/atm/cam/src/chemistry/trop_mozart/phtadj.F90 - models/atm/cam/src/chemistry/trop_mozart/rxtmod.F90 - -List all subroutines added and what they do: - - models/atm/cam/src/chemistry/trop_mozart/mo_wavelen.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_cnum.F90 - models/atm/cam/src/chemistry/trop_mozart/mak_grp_vmr.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_phtadj.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_airmas.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_photoin.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setaer.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_trislv.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setair.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_waveall.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_seto2.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_schu.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_rtlink.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_addpnt.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_constants.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_sim_dat.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_lymana.F90 - models/atm/cam/src/chemistry/trop_mozart/time_utils.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setz.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_calcoe.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_zadj.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_pchem.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_ps2str.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_sphers.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setozo.F90 - models/atm/cam/src/chemistry/trop_mozart/m_types.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_photo.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_tuv_inti.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_waveo3.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_rxt_mod.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setcld.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_xsections.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_drydep_tables.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_inter.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_wavelab.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_params.F90 - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/bld/config_trop_chem_mozart_defaults.xml - the number of advected constituents has changed to 99 for the tropospheric chemistry - models/atm/cam/bld/camexp.pm - models/atm/cam/bld/DefaultCAMEXPNamelist.xml - made changes to be consistent with the changes to the namelist variables - models/atm/cam/src/control/readinitial.F90 - moved from stepon the adjustment to the top interface pressure when zero - models/atm/cam/src/control/runtime_opts.F90 - see namelist changes above - models/atm/cam/src/control/wrap_nf.F90 - added subroutines wrap_inq_varndims and wrap_get_vara_text - models/atm/cam/src/control/history.F90 - made module variable fieldname_len public and increase its value to 16 - models/atm/cam/src/utils/string_utils.F90 - made GLC function public - models/atm/cam/src/physics/cam1/comsrf.F90 - added fsds field - models/atm/cam/src/physics/cam1/diagnostics.F90 - increased the length of string variable dcconnam - models/atm/cam/src/physics/cam1/tphysbc.F90 - changed the intent on fsds argument variable to inout - models/atm/cam/src/physics/cam1/check_energy.F90 - don't adjust the total global energy in offline mode - models/atm/cam/src/physics/cam1/restart_physics.F90 - models/atm/cam/src/physics/cam1/constituents.F90 - increased the length of string variable names - models/atm/cam/src/physics/cam1/physpkg.F90 - removed module variable fsds - models/atm/cam/src/physics/cam1/chemistry.F90 - made the chemistry interface consistent with trop_mozart - models/atm/cam/src/physics/cam1/tphysac.F90 - the arguments to subroutine chem_timestep_tend has changed - models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - increased the length of vdiffnam string variable - models/atm/cam/src/physics/waccm/chemistry.F90 - made the chemistry interface consistent with trop_mozart - models/atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_mean_mass.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_adjrxt.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 - models/atm/cam/src/chemistry/trop_mozart/m_rxt_id.F90 - models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 - models/atm/cam/src/chemistry/trop_mozart/chem_mods.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 - models/atm/cam/src/chemistry/trop_mozart/m_het_id.F90 - models/atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 - models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 - update the tropospheric chemistry code to be consistent with MOZART 4 - models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 - made the chemistry interface consistent with trop_mozart - models/atm/cam/src/dynamics/fv/pfixer.F90 - changed variable names and cleaned up code - models/atm/cam/src/dynamics/fv/spmd_dyn.F90 - fixed a bug in compute_gsfactors which occurs when 2D decomposition is used - models/atm/cam/src/dynamics/fv/stepon.F90 - removed the adjustment to the top interface pressure if zero - models/atm/cam/src/dynamics/fv/metdata.F90 - Made changes to get the observed surface pressure at sub-timestep - interval times. This is needed for the high resolution bug fix. - models/atm/cam/src/dynamics/fv/FVCAM_GridCompMod.F90 - Made changes needed to fix the bug in the offline driver used in - high resolution simulations. - -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. - -bluesky: - -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 - -Changes to the trop_mozart chemistry have caused the base line comparison -to fail as expected. - -tempest: All PASS - -bangkok/lf95: All PASS - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_47 -Originator(s): eaton, mvr -Date: Thu Jan 19 12:01:57 MST 2006 -One-line Summary: - - Workaround for xlf90 (v9.1.0.3) bug (on bluevista) & test script updates. - -Purpose of changes: - - The workaround for the compiler bug allows running on bluevista. Note - that there is still an unresolved bug on the platform affecting the - trop_mozart chemistry mode. - - The TBR.sh test script has been modified to work around a GPFS - problem (sometimes files that have just been copied don't appear in the - output from an "ls" command executed in the directory that the files were - just copied to) which causes the branch test to fail intermittently on bluesky. - - Misc changes in the overnight test scripts. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: eaton, mvr - -List all subroutines eliminated: - - models/atm/cam/test/system/update_collections.sh - -List all subroutines added and what they do: - - models/atm/cam/test/system/tag_email.sh - -List all existing files that have been modified, and describe the changes: - - models/atm/cam/src/physics/cam1/physpkg.F90 - . in phys_init pass phys_state(begchunk:endchunk) to chem_init and - ozone_data_init - - models/atm/cam/test/system/TBR.sh - models/atm/cam/test/system/td_nightly_aix.sh - models/atm/cam/test/system/td_nightly_linux.sh - -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. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_46 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - Answers are bit-for-bit. - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_46 -Originator(s): eaton -Date: Mon Jan 9 16:58:42 MST 2006 -One-line Summary: refactor restart logic and fix restart bug - -Purpose of changes: - - Provide control of when restart files are written that is decoupled from - the behavior of CAM's history file writes. - - Also did some cleanup work: - . get rid of anncyc, nlhst, itsst - . move nlres and lbrnch into restart module -- get it out of comctl.h - . call set_restart_filepath from restart_setopts -- remove from runtime_opts - . move the restart filepaths into the restart module -- get them out of filepaths.F90 - -Bugs fixed (include bugzilla ID): - - At cam3_2_24 the restart writes for fields needed by CAM's ocean and sea - ice modules were moved into the run methods for those modules. This broke - the writing of restart files in all situations except at the end of the - model run when the restart triggers off the nlend flag. - - The problem is that the calls to write the restart files for the ocean and - ice models are made before atm_run4 which makes the calls to write CAM's - history file. Since the old logic to determine when it's time to write a - restart file depended on the state in CAM's history module, and that state - was being updated after the calls to write the ocean and ice restart files, - the ocn and ice restarts were out of sync with CAM's restarts except when - nlend=.true. The fix was to implement a separate logic for writing restart - files that doesn't depend on the state of CAM's history module. - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - The namelist variables nrefrq and itsst have been eliminated. - - New namelist variables added: - logical :: no_restart ! true => turn off all restart writes (default: false) - integer :: restart_nsteps ! restart interval in steps - integer :: restart_nhours ! restart interval in hours - integer :: restart_ndays ! restart interval in days - logical :: restart_monthly ! true => write restart at begining of each month (default: true) - logical :: restart_yearly ! true => write restart at begining of each year - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: mvertens reviewed CLM code changes - -List all subroutines eliminated: - - control/rstwr.F90 - . remove this file -- subroutine added to restart module - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - control/cam.F90 - . change rstwr from external to local variable. add init before timestep - loop. - . add rstwr as actual arg to ocn_run, ice_run, atm_run4 - . add rstwr actual arg to clm_camRun (lnd_run) - - control/cam_comp.F90 - . add rstwr dummy arg to cam_run4 and remove the external declaration - . change write_restart call logic to only use rstwr - . set rstwr using restart_is_write_step method - - control/ccsm_msg.F90 - . add rstwr intent(out) arg to ccsm_run and remove the external declaration - . move the logic to set rstwr from the old rstwr function into ccsm_run - . change write_restart_ccsm call logic to only use rstwr - - control/comctl.h - . remove nrefrq - . remove anncyc -- no longer used - . remove nlhst -- it is equivalent to lbrnch - . remove itsst -- obsolete and broken - . move nlres and lbrnch to restart.F90 - - control/filenames.F90 - . remove comctl.h - . remove nrefrq dependence on initializing rest_pfile - . move nrevsn and rest_pfile to restart module - - control/history.F90 - . add rstwr dummy arg to wrapup and remove the external declaration - - control/restart.F90 - . extend functionality of this module to include the control of setting the - restart write time. - . add restart_is_write_step method. This started as the rstwr - function in rstwr.F90. - . add restart_init to initialize the restart write time - . add restart_{default,set}opts methods for namelist - . restart_setopts provides checking of the namelist settings and echos a - summary to the log file. - . add next_write_{ymd,tod} to restart file - . replace use of nlhst with lbrnch - . add nlres and lbrnch control variables (moved here from comctl.h) - . add nsrest as intent(in) arg of the restart_setopts method - it's needed - to set the values of nlres and lbrnch - . remove comctl.h -- no longer needed - - control/runtime_opts.F90 - . remove nrefrq - . add restart write interval namelist variables - . add restart_{default,set}opts calls - . add mpibcast calls - . replace use of nlhst with lbrnch - . add nlres and lbrnch control variables (moved here from comctl.h) - . add nsrest as intent(in) arg of the restart_setopts method - it's needed - to set the values of nlres and lbrnch - . remove comctl.h -- no longer needed - - control/startup_initialconds.F90 - . add restart_init call to setup_initial method - - control/time_manager.F90 - . cleanup some comments - . remove target attribute from tm_cal - . remove public attribute from tm_clock - . add new methods: - timemgr_time_ge ! check if time2 is later than or equal to time1 - timemgr_time_inc ! increment time instant by a given time interval - - dynamics/eul/initcom.F90 - . use nsrest instead of nlres in conditional - - ice/csim4/camice.F90 - . remove comctl.h from camice_write_restart -- not used - . add rstwr dummy arg to camice_run and remove the external declaration - . change camice_write_restart call logic to only use rstwr - . remove unused ref to nrevsn - - ocnsice/dom/camoce.F90 - . add rstwr dummy arg to camoce_run and remove the external declaration - . change camoce_write_restart call logic to only use rstwr - . remove anncyc -- no longer used - . remove itsst -- obsolete and broken - . remove unused ref to nrevsn - - ocnsice/som/somoce.F90 - . add rstwr dummy arg to somoce_run and remove the external declaration - . change somoce_write_restart call logic to only use rstwr - . remove unused ref to nrevsn - - test/system/nl_files/pghgsul - test/system/nl_files/ttrac - . add restart_nsteps setting to match history write frequency (these are - the only namelists used in the TBR tests) - - tools/scam/scm_init/scam_run.F90 - . add rstwr actual arg to ocn_run and ice_run calls. Hardwire value to - .false. (scam doesn't ask cam to write a restart file) - - Mods were made to the following CLM routines. These mods are accessed - via the external code svn:/clm2/branch_tags/clm3_expa_53_brnchT_cam01 - - clm/src/main/clm_camMod.F90 - . add rstwr intent(in) arg to clm_camRun and use it as actual arg in call to - clm_run2 - . remove setting of cam_nhtfrq, cam_mfilt to nhtfrq, mfilt. - - clm/src/main/clm_comp.F90 - . add rstwr intent(in) arg to clm_run2 and use it as actual arg in call to - driver2. - - clm/src/main/clm_varctl.F90 - . remove cam_nhtfrq and cam_mfilt -- no longer used - - clm/src/main/controlMod.F90 - . remove overwritting of hist_nhtfrq, hist_mfilt with cam_nhtfrq, cam_mfilt - - clm/src/main/driver.F90 - . add rstwr optional intent(in) arg to driver2 and use it in conditional for call to - restFile_write. - . check for presence of rstwr arg and use it to set local logical variable, - or use the do_restwrite method if it's not present. This allows driver2 - to continue to be used by the program_csm and program_off drivers. - - *** NOTE *** The following files have been moved from cam/src/control/ - to cam/src/utils/. (The reason is that by moving utility functions into - a separate directory it's easier to build unit testers using CAM's build - procedure which requires that all source files in each specified - directory be built.) - abortutils.F90 - cfort.h - spmd_utils.F90 - string_utils.F90 - time_manager.F90 - -If there were any failures reported from running test_driver.sh on any test -platform, and checkin with these failures has been OK'd by the gatekeeper, -then copy the lines from the td.*.status files for the failed tests to the -appropriate machine below. All failed tests must be justified. - -bluesky: All PASS. - -tempest: All PASS. - -bangkok/lf95: All PASS. - -CAM tag used for the baseline comparison tests if different than previous -tag: cam3_2_45 - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - - Answers are bit-for-bit. - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_45 -Originator(s): eaton -Date: Sun Dec 18 14:55:02 MST 2005 -One-line Summary: Bug fixes for memory leak and misc. - -Purpose of changes: bug fixes - -Bugs fixed (include bugzilla ID): - -1. Fix memory leak introduced in cam3_0_20. Briefly the problem is that the - overloaded .not. operator defined in diffusion_solver.F90 returns an object - of type vdiff_selector for which memory is allocated, but this operator is - used as an actual argument in the call to compute_vdiff in - vertical_diffusion.F90, and so the memory is never assigned to a variable - which can be deallocated. - -2. The T field in initial files for FV when 2D decomp is used are bad. - This was caused by a problem with an array index in - fv/diag_dynvar_ic.F90 - -3. The history restart files were being removed at the end of the run. The - normal CAM behavior is to not remove any files written at the end of the - run. - -4. The filepath for tgcm data was being truncated at 80 characters. - -Describe any changes made to build system: none - -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: - Memory leak fixed. The severity of this problem depends on what the - compiler did with an object returned by a function that was being used as - an actual argument. The problem was most severe with the lf95 compiler. - -Code reviewed by: myself - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -Bug 1. - -physics/cam1/vertical_diffusion.F90 -. replace fieldlist by fieldlist_moist -. add fieldlist_dry to module data and replace .not.fieldlist w/ fieldlist_dry -. add fieldlist_dry as actual arg to init_vdiff -. use fieldlist_dry in 2nd call to compute_vdiff -physics/cam1/diffusion_solver.F90 -. add fieldlist_dry as dummy arg to init_vdiff and initialize it - -Bug 2. - -dynamics/fv/diag_dynvar_ic.F90 -. The outfld call for T&IC needs the array referenced as t3(1,kfirst,j), - not t3(1,1,j). - -Bug 3. - -control/history.F90 -. Change the argument in the putfil call that determines whether the file - is removed after it is archived from .true. to .not.nlend. -. Add nlend as a dummy arg to write_restart_history -control/restart.F90 -. add nlend to the actual args of write_restart_history - -Bug 4. - -physics/waccm/tgcm_forcing.F90 -. Change "character*80 locfn" to "character*256 locfn" at line 158 - -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. - -bluesky: -All PASS except: -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -tempest: -All PASS except: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -bangkok/lf95: -All PASS except: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 - -These tests are all expected to fail due to a bug in the current logic for -writing restart files. - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? Answers are BFB. - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_44 -Originator(s): Mariana Vertenstein, Rob Jacob -Date: 2005-12-16 -One-line Summary: Incorprated MCT for cam-clm coupling - -Purpose of changes: Replaced current cam-clm lp-coupling scheme with - new MCT coupling and interfaces. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: MCT is now built as part of the - CAM executable (since it is all F90 code) - configure was changed so - that the MCT filepath could be incorporated into the CAM build - -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 (from a preliminary - analysis of timing numbers). A more detailed timing analysis is planned. - -Code reviewed by: Mariana Vertenstein, Rob Jacob - -List all subroutines eliminated: none - -List all subroutines added and what they do: - - control/seq_fields_mod.F90 - provides list of fields to be coupled using same mechanism as in - concurrent ccsm mode - - control/MCT_seq.F90 - control/MCT_atm_comp.F90 - provide new MCT coupling interfaces - -List all existing files that have been modified, and describe the changes: - - physics/cam1/camhub_comp.F90 - cleaned up interfaces - - physics/cam1/prescribed_aerosols.F90 - bug fix (provided by Andrew Conley) - does not change answers - in current tests - - atm/cam/tools/scam/configure - atm/cam/tools/scam/scm_init/init_model.F90 - atm/cam/tools/scam/scm_init/scam_run.F90 - changes to SCAM in order to run with MCT cam-clm coupling - and also use new camhub_comp changes - -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. - -bluesky: - - 004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - 018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 - 043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 - -tempest: - - 003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - 020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 - 034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -bangkok/lf95: - - 003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 - 015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 - 031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 - -CAM tag used for the baseline comparison tests if different than previous -tag: previous tag - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): results were bit-for-bit - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -Tag name: cam3_2_43 -Originator(s): Mariana Vertenstein, Mat Rothstein -Date: 2005-12-15 -One-line Summary: Updated clm code to clm3_expa_52 - -Purpose of changes: -Update clm code base to clm3_expa_52 - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: Mariana Vertenstein, Keith Oleson - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - src/biogeochem/CASAMod.F90 - src/biogeochem/DGVMEstablishmentMod.F90 - src/biogeophys/CanopyFluxesMod.F90 - src/main/clm_varcon.F90 - src/main/time_manager.F90 - - - Put in changes to use esmf_wrf_timemgr code base - - Changes to clm_varcon.F90 and CanopyFluxesMod.F90 are - Changes made to the clm hydrology in tag clm3_expa_46 that were - increased the conductance of heat and moisture between the soil and the - canopy air space. This leads to the following changes in land climatology: global - increase in soil evaporation and a decrease in transpiration - and in the soil surface temperature. - -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. - -bluesky: -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 -008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 -015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 -044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 -047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 -054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 - -tempest: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 -007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 -014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 -017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 -038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 -045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 - -bangkok/lf95: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 -008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 -024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 -036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - -CAM tag used for the baseline comparison tests if different than previous -tag: - -Summarize any changes to answers: The above changes to clm lead to a new climate - -If bitwise differences were observed, how did you show they were no worse -than roundoff? NA - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced: - -- source tag (all code used must be in the repository): - cam3_2_40 (with clm source code corresponding to clm3_expa_48) - -- platform/compilers: - bluesky - -- configure commandline: - configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 - -- build-namelist command (or complete namelist): -&camexp -absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' -aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' -bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' -bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' -bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' -bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' -caseid = 'cam3_2_40_fv4x5dom' -dtime = 1800 -iyear_ad = 1950 -ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0000-09-01_4x5_L26_c031217.nc' -nelapse = -1 -nsrest = 0 -/ -&clmexp -fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' -fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' -/ - -- MSS location of output: - /OLESON/csm/cam3_2_40_fv4x5dom - -MSS location of control simulations used to validate new climate - /OLESON/csm/cam3_2_29_fv4x5dom - -URL for AMWG diagnostics output used to validate new climate: -http://www.cgd.ucar.edu/tss/clm/diagnostics/cam_clm2/cam3_2_40_fv4x5dom-cam3229_fv4x5dom/sets.htm - -=============================================================== -=============================================================== - -Tag name: cam3_2_42 -Originator(s): mvr -Date: 051213 -One-line Summary: csm_share, esmf_wrf_timemgr, timing now from -external sources; updated to share3_051205; new ChangeLog format - -Purpose of changes: taking advantage of some subversion features - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -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: mvr, eaton - -List all subroutines eliminated: all csm_share, esmf_wrf_timemgr, and -timing files; -D models/utils/timing -D models/utils/timing/private.h -D models/utils/timing/gptl_papi.c -D models/utils/timing/rtcrate.F90 -D models/utils/timing/gptlutil.c -D models/utils/timing/threadutil.c -D models/utils/timing/gptl.c -D models/utils/timing/f_wrappers.c -D models/utils/timing/gptl.h -D models/utils/timing/README -D models/utils/timing/gptl.inc -D models/utils/esmf_wrf_timemgr -D models/utils/esmf_wrf_timemgr/ESMF_AlarmClockMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_CalendarMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_BaseMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_TimeMgr.inc -D models/utils/esmf_wrf_timemgr/ESMF_Mod.F90 -D models/utils/esmf_wrf_timemgr/c_esmc_subroutines.F90 -D models/utils/esmf_wrf_timemgr/ESMF_BaseTimeMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_ClockMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_AlarmMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_TimeMod.F90 -D models/utils/esmf_wrf_timemgr/ESMF_Macros.inc -D models/utils/esmf_wrf_timemgr/ESMF_Stubs.F90 -D models/utils/esmf_wrf_timemgr/ESMF_TimeIntervalMod.F90 -D models/utils/esmf_wrf_timemgr/wrf_error_fatal.F90 -D models/utils/esmf_wrf_timemgr/ESMF_FractionMod.F90 -D models/utils/esmf_wrf_timemgr/Makefile -D models/csm_share -D models/csm_share/ChangeLog -D models/csm_share/unit_testers -D models/csm_share/unit_testers/test_shr_sys.F90 -D models/csm_share/unit_testers/test_shr_orb.F90 -D models/csm_share/unit_testers/Makefile -D models/csm_share/ChangeSum -D models/csm_share/shr -D models/csm_share/shr/shr_date_mod.F90 -D models/csm_share/shr/shr_map_mod.F90 -D models/csm_share/shr/shr_sys_mod.F90 -D models/csm_share/shr/shr_file_mod.F90 -D models/csm_share/shr/shr_vmath_mod.F90 -D models/csm_share/shr/shr_timer_mod.F90 -D models/csm_share/shr/shr_orb_mod.F90 -D models/csm_share/shr/shr_kind_mod.F90 -D models/csm_share/shr/shr_tInterp_mod.F90 -D models/csm_share/shr/shr_mpi_mod.F90 -D models/csm_share/shr/shr_const_mod.F90 -D models/csm_share/shr/shr_msg_mod.F90 -D models/csm_share/shr/shr_stream_mod.F90 -D models/csm_share/shr/shr_ncread_mod.F90 -D models/csm_share/shr/shr_alarm_mod.F90 -D models/csm_share/shr/shr_cal_mod.F90 -D models/csm_share/shr/shr_vmath_fwrap.c -D models/csm_share/shr/shr_string_mod.F90 -D models/csm_share/README -D models/csm_share/cpl -D models/csm_share/cpl/cpl_kind_mod.F90 -D models/csm_share/cpl/cpl_const_mod.F90 -D models/csm_share/cpl/cpl_infobuf_mod.F90 -D models/csm_share/cpl/cpl_fields_mod.F90.CO2A -D models/csm_share/cpl/cpl_fields_mod.F90.CO2B -D models/csm_share/cpl/cpl_comm_mod.F90 -D models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA -D models/csm_share/cpl/cpl_iobin_mod.F90 -D models/csm_share/cpl/cpl_interface_mod.F90 -D models/csm_share/cpl/cpl_fields_mod.F90 -D models/csm_share/cpl/cpl_domain_mod.F90 -D models/csm_share/cpl/cpl_bundle_mod.F90 -D models/csm_share/cpl/cpl_contract_mod.F90 -D models/csm_share/cpl/cpl_map_mod.F90 -D models/csm_share/cpl/cpl_control_mod.F90 -D models/csm_share/cpl/cpl_mct_mod.F90 -D models/csm_share/cpl/cpl_iocdf_mod.F90 -D models/csm_share/README.scm -- all these replaced with subversion external directories - -D models/atm/cam/doc/BaseModelSum -D models/atm/cam/doc/BaseModelLog -- some documentation cleanup - -List all subroutines added and what they do: -A models/utils/SVN_EXTERNAL_DIRECTORIES -A models/SVN_EXTERNAL_DIRECTORIES -- contain definitions for the external directories - -A + models/atm/cam/doc/Copyright -- copy of the copyright information that'll be picked up by ccsm external pull - -A models/atm/cam/doc/ChangeLog_template -- template for new ChangeLog format - -List all existing files that have been modified, and describe the changes: - M models - M models/utils -- directories modified with properties for the external definitions - -M models/atm/cam/doc/ChangeLog -- added documentation for this tag - -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. - -bluesky: -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -tempest: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -bangkok/lf95: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 - - -CAM tag used for the baseline comparison tests if different than previous -tag: prev - -Summarize any changes to answers, i.e., -- what code configurations: -- what platforms/compilers: -- nature of change (roundoff; larger than roundoff but same climate; new - climate): b4b - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., -- source tag (all code used must be in the repository): -- platform/compilers: -- configure commandline: -- build-namelist command (or complete namelist): -- MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for AMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== - -cam3_2_41 -Originator: jet ( John Truesdale) -Date: Fri Dec 9 11:56:01 MST 2005 -Model: CAM -Version: CAM3.2.41 -One-line Summary: Fixed SCAM bugs, added SCAM tests to testscript, made SCAM datasets consistent with CAM -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no - -Substantial timing or memory changes: no -Requires change in run script: no - -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) - -bangkok: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 - -tempest: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -bluesky: -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 - - -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) - -Changes to CLM land-model: One - fixed bug with scam specific code. - -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -This is basically a bug fix for SCAM as well as adding some -small changes to get rid of autopromotion dependency in SCAM. -Changes are bit for bit for CAM/CCSM. I did update the datasets -used by SCM to by consistent with the latest datasets for CAM -so the CRM test output also needed to be updated to reflect this. - -A list of files changed follows: - -history_defaults.F90 - added cpp def BFB_CAM_SCAM_IOP around cam/scam - bfb specific code -runtime_opts.F90 - scam initializes with the name of the topo and initial - conditions datasets -startup_initialconds.F90 - made changes to include this file in scam - intial calls -inidat.F90 - changed scam specific code to use topo info off of topo dataset -.scam_defaults - updated to use topo file and newer boundary dataset files -scam/configure - Brian's changes to get rid of autopromotion -scam/testscript - added tests to check consistency of .scam_defaults - datasets with CAM namelist. - added tests for scam to run in default mode. -getnetcdfdata.F90 - Brian's changes to get rid of autopromotion -init_model.F90 - add topo dataset to scam -inital.F90 - call cam routine setup_initial from scam specific code. -ipc.h - added topo dataset to scam -runtype.h - added topo dataset to scam -scamMod.F90 - let scam initialize topo and initial conditions dataset names -scam_fifo.c - pass topo dataset to scam initialization -scam_run.F90 - fix bug with scam - don't run lsm if no land present -setlatlon.F90 - fix bug with scam - don't error out in iop run if iop - dataset has different column latitude and longitude than - initial data. -IOPSelectDateDlgImpl.cpp - cleanup -OptionsDlg.ui - add topo dataset to scam dataset tab in gui -OptionsDlgImpl.cpp - add topo dataset to scam dataset tab in gui -crm.cpp - add topo dataset to scam -dataset.cpp - add topo dataset to scam -fifomodel.cpp - add topo dataset to scam -manager.cpp - add topo dataset to scam -rpcmodel.cpp - add topo dataset to scam -crmtest26.out - crm radiation values changed slightly when we changed - the default datasets to match the current cam defaults -clm_camMod.F90 - fix bug with scam - don't run lsm if no land present also - get rid of spurious SCAM returns in this file - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_40 -Originator: jedwards ( James Edwards) -Date: Fri Dec 2 17:24:53 MST 2005 -Model: CAM -Version: CAM3.2.40 -One-line Summary: minor cleanup and extended testing of cam3_2_39 commit -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: testing was repeated against 3_2_38 -bangkok: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 -024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 -026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 - -tempest: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 - -bluesky: -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 -054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 - -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton -Restart files change: no -Changes answers: Yes (same-to-roundoff against 3_2_38) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -All reference to macros __FILE__ and __LINE__ have been removed. -File ozone_data.F90 was cleaned up to remove variables which are no longer used. -A further pergrow test was conducted with chemistry enabled since some of the changes in the previous commit involved chemistry but the pergrow test did not. This is why the test were rerun against 3_2_38 instead of 3_2_39. - -Besides we wanted to close the CVS repository with a nice even number. :-) - -=============================================================== -=============================================================== - -cam3_2_39 -Originator: jedwards ( James Edwards) -Date: Fri Dec 2 10:48:22 MST 2005 -Model: CAM -Version: CAM3.2.39 -One-line Summary: Consolidated zonal data input methods used by cam 1 chemistry and ozone files. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: -bluesky: -015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 -054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 -tempest: -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -bangkok: -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 -024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 -026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 -041 sc999 scamtest.sh .............................................FAIL! rc= 4 - -6+3 tests are expected to fail due to problems in the testing procedure introduced in cam3_2_37. -TBL tests failed due to order of operation changes. A perturbation growth test was conducted and passed to show these are errors are order round-off. -The scamtest does not work for me in the test script, the scamtest was sucessfully run by hand. - -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes (same-to-roundoff - details noted above.) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -Added file physics/cam1/zonalbndrydata.F90 -moved netcdf interface in chemistry.F90 and ozone_data.F90 to this new file. -In the past the chemistry file read a full years data at the initial time and held it in memory while the ozone file read two months data and updated during the run when it needed new data. The new file supports both methods but requires that you choose one or the other at compile time. The second method is now the default. - -Several minor changes were made in other files, mostly removing unused references to plat and plon. The interface was changed for one chemistry routine which required changes in all flavors of the chemistry files and dynamics inidat files. Below is a complete list of changed files: - - models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 - models/atm/cam/src/control/interpolate_data.F90 - models/atm/cam/src/control/runtime_opts.F90 - models/atm/cam/src/dynamics/eul/inidat.F90 - models/atm/cam/src/dynamics/fv/inidat.F90 - models/atm/cam/src/dynamics/sld/inidat.F90 - models/atm/cam/src/physics/cam1/advnce.F90 - models/atm/cam/src/physics/cam1/aerosol_intr.F90 - models/atm/cam/src/physics/cam1/chemistry.F90 - models/atm/cam/src/physics/cam1/drydep_mod.F90 - models/atm/cam/src/physics/cam1/ozone_data.F90 - models/atm/cam/src/physics/cam1/physpkg.F90 - models/atm/cam/src/physics/cam1/ramp_scon.F90 - models/atm/cam/src/physics/cam1/seasalt_intr.F90 - models/atm/cam/src/physics/cam1/stratiform.F90 - models/atm/cam/src/physics/cam1/tphysidl.F90 - models/atm/cam/src/physics/cam1/tracers.F90 - models/atm/cam/src/physics/cam1/volcanicmass.F90 - models/atm/cam/src/physics/waccm/chemistry.F90 - - -=============================================================== -=============================================================== - -cam3_2_38 -Originator: mirin ( Arthur Andrew Mirin) -Date: Tue Nov 29 16:50:01 MST 2005 -Model: CAM -Version: CAM3.2.38 -One-line Summary: (1) Restore FV options; (2) Cray-X1E communications, threading, streaming -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -No changes to file/directory structure -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: TBR.sh (Get clearance for failed tests, enter lines from td.*.status files that fail) -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (bluesky) -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 (bluesky) -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (bluesky) -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (tempest) -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 (tempest) -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (tempest) -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 (bangkok) -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 (bangkok) -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 (bangkok) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer, Worley -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: Cray-X1E OpenMP/CSD compatibility -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: -(1) Restored nonworking FV options (geopktrans, tracertrans, modcomm-transpose, -modcomm_geopk) -(2) Added Shmem capability to Cray-X1E (USE_SHMEM if-def - affects mod_comm.F90) -(3) Allowed coexistence of OpenMP and CSD's on Cray-X1E provided they do not operate -on same loop index -(4) Removed nested OpenMP capability -Files changed: -models/atm/cam/bld: CAM_config.pm, config_trop_chem_mozart_defaults.xml, Makefile, -config_waccm_ghg_defaults.xml, config_cam_eul_defaults.xml, config_waccm_mozart_defaults.xml, -config_cam_fv_defaults.xml, configure, config_cam_sld_defaults.xml -models/atm/cam/src/control: runtime_opts.F90 -models/atm/cam/src/dynamics/eul: dyndrv.F90, realloc4.F90, scan2.F90, scanslt.F90 -models/atm/cam/src/dynamics/fv: FVCAM_GridCompMod.F90, geopk.F90, sw_core.F90, -cd_core.F90, pmgrid.F90, tp_core.F90, dynamics_vars.F90, spmd_dyn.F90, trac2d.F90 -models/atm/cam/src/dynamics/sld: realloc4.F90, scan2.F90 -models/atm/cam/src/physics/cam1: phys_grid.F90, radlw.F90 -models/lnd/clm2/src/main: areaMod.F90, driver.F90, histFileMod.F90, atmdrvMod.F90, -filterMod.F90, initializeMod.F90 -models/lnd/clm2/src/riverroute: RtmMod.F90 -lnd/clm2/tools/mksurfdata: mkdynpftMod.F90, mklaiMod.F90, pmkpftMod.F90, mksoitex.F90, -mkglacier.F90, mklanwat.F90, mksoicol.F90, mkurban.F90 -models/utils/pilgrim: mod_comm.F90 -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_37 -Originator: mvr ( Mathew Rothstein) -Date: Fri Nov 18 16:43:50 MST 2005 -Model: CAM -Version: CAM3.2.37 -One-line Summary: Bug fix for cam in ccsm; removed cam-specific code from csm_share; mod to branch test and other test suite cleanup -cam-bugs Requests resolved: none -Requires change in build system: yes -returned spmd mode to builds for ccsm (mistakenly removed with cam3_2_35) -Substantial timing or memory changes: yes, using spmd again in coupled mode -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: - -bluesky -004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 6 -008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 6 -010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 6 -013 bl134 TBL.sh e32dh adia 9 .....................................FAIL! rc= 6 -015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 6 -018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 6 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 6 -024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 6 -027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 6 -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 6 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 6 -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 6 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 6 -043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 6 -047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 6 -049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 6 -052 bl534 TBL.sh s32dh adia 9 .....................................FAIL! rc= 6 -054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 6 -055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 - -tempest -003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 6 -007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 6 -009 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 6 -012 bl135 TBL.sh e32dh idphys 9 ...................................FAIL! rc= 6 -014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 6 -017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 6 -020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 -021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 6 -024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 6 -026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 6 -029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 6 -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 6 -034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 -035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 6 -038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 6 -040 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 6 -043 bl535 TBL.sh s32dh idphys 9 ...................................FAIL! rc= 6 -045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 6 - -bangkok -003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 6 -008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 6 -010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 6 -012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 6 -015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 -016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 6 -024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 6 -026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 6 -028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 6 -031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 -032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 6 -036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 6 -038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 6 -040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 6 - -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -M models/atm/cam/bld/configure -- bug fix for running cam in coupled mode with spmd - -M models/atm/cam/src/advection/slt/phcs.F90 -M models/atm/cam/src/chemistry/waccm_mozart/apex_subs.F90 -M models/atm/cam/src/control/gauaw_mod.F90 -M models/atm/cam/src/dynamics/fv/cd_core.F90 -M models/atm/cam/src/dynamics/fv/fill_module.F90 -M models/atm/cam/src/dynamics/fv/geopk.F90 -M models/atm/cam/src/dynamics/fv/pft_module.F90 -M models/atm/cam/src/dynamics/fv/sw_core.F90 -M models/csm_share/shr/shr_kind_mod.F90 -- moved cam-specific code out of csm_share - -M models/atm/cam/test/system/TBR.sh -M models/atm/cam/test/system/input_tests_master -- modified branch test to branch from an earlier restart file - -M models/atm/cam/test/system/TCB.ccsm.sh -M models/atm/cam/test/system/TSB.ccsm.sh -M models/atm/cam/test/system/test_driver.sh -- cleaned up use of environment vars CAMROOT and CAM_ROOT - -M models/atm/cam/test/system/td_nightly_aix.sh -M models/atm/cam/test/system/td_nightly_linux.sh -- just updating repository with mods to nightly scripts - -M models/atm/cam/test/system/TCB.ccsm.sh -- ccsm test will now use tags from ccsm3_1_beta* sequence - -M models/atm/cam/test/system/TBL.sh -M models/atm/cam/test/system/nl_files/adia -M models/atm/cam/test/system/nl_files/aqpgro -M models/atm/cam/test/system/nl_files/ghgrmp -M models/atm/cam/test/system/nl_files/idphys -M models/atm/cam/test/system/nl_files/no_ttrac -M models/atm/cam/test/system/nl_files/off2x2.5 -M models/atm/cam/test/system/nl_files/outfrq24h -M models/atm/cam/test/system/nl_files/outfrq3s -M models/atm/cam/test/system/nl_files/pghgsul -M models/atm/cam/test/system/nl_files/ttrac -M models/atm/cam/test/system/nl_files/ttrac_lb1 -M models/atm/cam/test/system/nl_files/ttrac_lb2 -M models/atm/cam/test/system/nl_files/ttrac_lb3 -- test suite now outputting history/restart files for each time sample - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_36 -Originator: jedwards ( James Edwards) -Date: Fri Nov 11 09:58:15 MST 2005 -Model: CAM -Version: CAM3.2.36 -One-line Summary: rework of new interpolation method, bug fix in phys_gmean, clean up in waccm_mozart -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Reworked recently introduced interpolation changes to contain the method within a physics chunk and eliminate dependence on the phys_grid module. - -Fixed a bug in phys_gmean in which the number of fields passed in was hardcoded, and the incoming number of fields argument was ignored. - -Removed unused 'use ' statements in waccm_mozart. -=============================================================== -=============================================================== - -cam3_2_35 -Originator: erik ( Erik Kluzek) -Date: Tue Nov 8 12:41:27 MST 2005 -Model: CAM -Version: CAM3.2.35 -One-line Summary: Remove prototype ESMF and use WRF implimentation of ESMF_2_1_0 API for time-manager, allow build to use external ESMF -cam-bugs Requests resolved: none -Requires change in build system: yes - (Configure changed so that Filepath also points to models/utils/esmf_wrf_timemgr) -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Remove: models/utils/esmf: - Remove all prototype ESMF files. - -Add: models/utils/esmf_wrf_timemgr: - Put in WRF implementation of ESMF_2_1_0 time-manager API. - -Changes to build: - Change build so default is to build with WRF ESMF time-manager. Can also use - externally compiled ESMF_2_1_0. - - Linking with external ESMF: non-default, have to build ESMF externally - and send appropriate command-line options to configure to use this option. - - Get rid of ESMF_ROOT as unneeded now. Now have three - tokens for dealing with ESMF: ESMF_BLD, ESMF_LIB, and ESMF_MOD. - Setting any of those threes means to link with external ESMF. - If ESMF_BLD is set, the Makefile will figure out the path - based on uname and debug option to the default version of ESMF. - If ESMF_LIB and ESMF_MOD are set the full paths will be used - for these two. The external version of ESMF that you link to is - assumed to be a current download of ESMF, which has it's own build - system. The current ESMF does not have a build for several important - platforms: Cray, Pathscale, ES, NEC etc, therefore only the esmf_wrf_timemgr - version can be used there. Also there were bugs with linking that will - need to be worked out on our standard platforms, before this will work - reliably - - Change configure so SPMD information isn't duplicated in configure output - files. - -Changes to time_manager: - - Update time_manager.F90 so uses the ESMF_2_1_0 API instead of the prototype - ESMF API. Create unit-tests in models/atm/cam/tests/unit/control to do - extensive testing of the time-manager interface. Runs different time-intervals and different ways of setting the stop-date, with one simulation period from - year 0 to year 9999. Answers were compared to the previous time-manager and - found to be bit-for-bit on IBM, SGI and Linux-PGI compilers. - - Calendar can not be set to GREGORIAN right now, only NOLEAP is allowed. - esmf_wrf_timemgr could be extended to allow both calendars, or we can start - using ESMF externally to handle both calendars. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_34 -Originator: jedwards ( James Edwards) -Date: Thu Nov 3 17:00:55 MST 2005 -Model: CAM -Version: CAM3.2.34 -One-line Summary: interpolation method changed in waccm chemistry -cam-bugs Requests resolved: none - -Requires change in build system: no - -Substantial timing or memory changes: Yes reduced memory profile of waccm/chemistry -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -plat and plon dependence were removed from waccm/chemistry.F90 -following the same method as cam1/chemistry.F90 -The method in cam1 was modified to read only on the masterproc, this does -not change the memory profile. - -=============================================================== -=============================================================== - -cam3_2_32 -Originator: mvr ( Mathew Rothstein) -Date: Fri Oct 28 16:58:34 MDT 2005 -Model: CAM -Version: CAM3.2.32 -One-line Summary: Update csm_share to share3_051025; update remaining clm files to clm3_expa_45 that were missed with previous tag -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.sh script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM : yes -Tested to work with SCAM : yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes, updated doc files to clm3_expa_45 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -M models/csm_share/ChangeLog -M models/csm_share/ChangeSum -M models/csm_share/cpl/cpl_contract_mod.F90 -M models/csm_share/cpl/cpl_domain_mod.F90 -M models/csm_share/cpl/cpl_fields_mod.F90 -M models/csm_share/cpl/cpl_fields_mod.F90.CO2A -M models/csm_share/cpl/cpl_fields_mod.F90.CO2B -M models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA -M models/csm_share/cpl/cpl_interface_mod.F90 -M models/csm_share/shr/shr_const_mod.F90 -M models/csm_share/shr/shr_map_mod.F90 -M models/csm_share/shr/shr_ncread_mod.F90 -M models/csm_share/shr/shr_stream_mod.F90 -M models/csm_share/shr/shr_timer_mod.F90 -M models/csm_share/unit_testers/test_shr_orb.F90 -M models/csm_share/unit_testers/test_shr_sys.F90 -- these are the files that changed between share3_050909 and share3_051025 - -M models/lnd/clm2/doc/ChangeLog -M models/lnd/clm2/doc/ChangeSum -- these are the files missed in updating between clm3_expa_29 and clm3_expa_45 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_31 -Originator: mvertens ( Mariana Vertenstein) -Date: Wed Oct 26 15:24:06 MDT 2005 -Model: CAM -Version: CAM3.2.31 -One-line Summary: updated clm to clm3_expa_45 (removed condition that clm and cam grid had to be bfb) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes (describe) -Requires change in run script: no -Ran test_driver.shl script: No (does all of the following tests) -Machines tested: IBM (ran 2 climate simulations on IBM - see below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes -Changes answers: Yes (same-climate) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -No cam physics code was modified. Only clm interface code was modified. -Modified models/lnd/clm2/src/main/clm_camMod.F90 (only several lines of clm code -were commented out) so that cam and clm grid do not have to be bfb. The -tolerance is that the grid latitudes/longitudes grids match to 1.e-12. -The fractional land however, must be identical. The clm code base has -now been updated to clm3_expa_45. - -Two 10 year integration for the entire set of physics changes using climatological SSTs -were performed. See: -/MVERTENS/csm/cam3_2_29_fv4x5dom (cam3_2_29 with changes to clm_camMod.F90) - vs -MVERTENs/csm/cam3_2_29_cam3_2_29_fv4x5dom_0 (cam3_2_29 with no changes) - -Diagnostic output is at: -http://www.cgd.ucar.edu/~mvertens/AMWG_diag/cam3229_fv4x5dom-cam3229_fv4x5dom_0/ -=============================================================== - -=============================================================== - -cam3_2_30 -Originator: mvr ( Mathew Rothstein) -Date: Thu Oct 20 09:49:40 MDT 2005 -Model: CAM -Version: CAM3.2.30 -One-line Summary: mods / new scripts added to cam's test suite for automated testing of new tags -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM : yes -Tested to work with SCAM : yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -A models/atm/cam/test/system/input_tests_aix_nightly -- test ids to run as part of nightly testing of new cam tags on bluesky (aix) -A models/atm/cam/test/system/input_tests_linux_nightly -- test ids to run as part of nightly testing of new cam tags on bangkok (linux) -A models/atm/cam/test/system/td_nightly_aix.sh -- cron script for overnight testing of new cam tag on bluesky (aix) -A models/atm/cam/test/system/td_nightly_linux.sh -- cron script for overnight testing of new cam tag on bangkok (linux) -A models/atm/cam/test/system/update_collections.sh -- cron script for overnight loading of latest cam tag on machine sanitas -M models/atm/cam/test/system/TCB.ccsm.sh -- added command to modify directory path to finite volume code in ccsm scripts -M models/atm/cam/test/system/input_tests_master -- added ccsm tests for running coupled model with finite volume dycore - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_29 -Originator: eaton ( Brian Eaton) -Date: Tue Oct 18 10:52:05 MDT 2005 -Model: CAM -Version: CAM3.2.29 -One-line Summary: add LANDFRAC file, move inti.F90 into phys_init -cam-bugs Requests resolved: bugzilla #19 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Added the ability to specify the file that contains the LANDFRAC field. -The namelist variable bnd_landfrac is used to specify the path of this -file. If not specified the default is to use the file that the topography -fields are read from. - -Moved the physics initialization routines into phys_init. Removed -subroutine inti. Also add initialization of grid information to the -physics_state objects that are allocated in phys_init. This information is -needed to be passed to the physics init routines that do spatial -interpolation of boundary data. - -Misc: -. Fix for problem with WACCM_MOZART on SGI: was failing to write abs/ems - restart file. Resolves bugzilla #19. -. Bugfix in lf95 section of Makefile (reference to apex_subs.F changed to - apex_subs.F90). - -=============================================================== -=============================================================== - -cam3_2_28 -Originator: mvertens ( Mariana Vertenstein) -Date: Mon Oct 17 09:35:36 MDT 2005 -Model: CAM -Version: CAM3.2.28 -One-line Summary: updated clm code clm3_expa_44 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes (all clm restarts, other than history restarts, are now NetCDF) -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes - Updated clm code to clm3_expa_44 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - Updated clm code to clm3_expa_44. Interfaces between cam and clm - (in clm_camMod.F90) have been modified to be consistent with - making clm a gridded component. The clm driver routine has now - also been split into two phases as part of this process. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_27 -Originator: jedwards ( James Edwards) -Date: Fri Oct 14 10:20:58 MDT 2005 -Model: CAM -Version: CAM3.2.27 -One-line Summary: consolidated linear interpolation schemes -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Merged lininterp.F90 bilin.F90 vertinterp.F90 and timinterp.F90 into a single module. added use statements for this module where appropriate - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_26 -Originator: pworley ( Patrick H Worley) -Date: Wed Oct 12 21:20:24 MDT 2005 -Model: CAM -Version: CAM3.2.26 -One-line Summary: Cray X1(E) optimizations for FV -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes - much faster on the X1E when using FV -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: failed all baseline comparisons tests for FV on bluesky. -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 -027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 -All other tests passed, and all tests passed on other two systems. pergro test -for FV on bluesky passed, indicating that change was within roundoff. -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Art Mirin, Will Sawyer -Restart files change: no -Changes answers: No for EUL and SLD, No for FV on SGI and Linux-Lahey, Yes for FV on IBM (same-to-roundoff) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -Synchronizing FV with NASA version introduced code that does run -efficiently on the Cray vector system (and probably not on the Earth Simulator -either). These changes bring performance back to what it was before, as well -as vectorizing buffer copies in the communication layer. - -dynamics/fv/cd_core.F90, dynamics/fv/sw_core.F90 - eliminated unnecessary array segment specifications in subroutine calls where it - was causing array copying -dynamics/fv/mapz_module.F90 - restructured recently added code to improve vectorization -dynamics/fv/trac2d.F90 - replaced pointer-based implementation of double buffering algorithm with an - equivalent index-based implementation, working around a problem on the Cray X1E -utils/pilgrim/mod_comm.F90, utils/pilgrim/parutilitiesmodule.F90 - restructured buffer copy loops for improved vectorization; general clean-up and optimization - -Some of the timer logic was also broken in a recent check-in: -control/cam.F90, control/cam_comp.F90 - fixed timer logic -utils/timing/gptl.c - fixed problems in mpi_wtime support in timing routines - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_25 -Originator: jeff ( Yen-Huei Lee) -Date: Fri Oct 7 09:16:46 MDT 2005 -Model: CAM -Version: CAM3.2.25 -One-line Summary: user specified constant co2 when running in ccsm -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton, Mathew Rothstein -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -modified the following files: - -models/atm/cam/src/control/runtime_opts.F90 -models/atm/cam/src/physics/cam1/radiation.F90 -models/atm/cam/src/physics/cam1/chem_surfvals.F90 -models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 -- add one namelist variable to allow user to specify a constant co2 (vmr) - for radiation calculation when running in CCSM, indepedent of other settings - of co2. - -models/atm/cam/src/control/ccsm_msg.F90 -- mod to support 1x1.25 resolution when running in CCSM. - -models/atm/cam/test/systems/TSB.ccsm.sh -- mod to run ccsm test effectively. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_24 -Originator: erik ( Erik Kluzek) -Date: Mon Oct 3 13:21:24 MDT 2005 -Model: CAM -Version: CAM3.2.24 -One-line Summary: Move time-loop to top driver, make multiple run methods in cam_comp and - stepon modules to reduce code duplication -cam-bugs Requests resolved: none -Requires change in build system: no (Remove auto-promotion on Darwin) -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, mvertens, mvr (testscript changes) -Restart files change: yes -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes! (clm_camMod only, move allocation method inside, create final method) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -High level structure changes: - -Make multiple run methods in cam_comp and stepon to reduce duplication and move -the time-loop up to the top level driver seq_ccsm -- still called cam.F90. -Remove nlend from comctl and make local data, passing down to relevant subroutines -and functions that need it. Make Gaussian weights and etamid module data -in cam_comp. Move all initialization calls for ocean or ice into one initialization -call (calls to read_restart_xxx moves to inside relevant initialize subroutine). And -move write_restart_xxx calls for ice and ocn inside of ice and ocean run method. Create -final methods for all component models (ice, ocn, land, atm). Use ncol in derived types -rather than using get_ncols_p method. Move tssub from surface_state derived type to private -data inside of camice. Move allocation of input/output derived types from driver to inside -of relevant component (ice, ocean, or land). Remove the temporary place-holder -restart_camsrf.F90 surface restart file. Remove ice_frac in camice and start using areafrac -and move merge of fractions to camhub_comp. This takes care of CCSM/ESMF Stage 1-2.6, 1.4 -and 1.7, and some work on 1.9.1. This creates drivers and component modules that have the -bulk of the Pre-ESMF work complete. - -See the "CCSM/ESMF Stage-1 Release Schedule" at... - - http://swiki.ucar.edu/start/66 - -SCAM Changes: - -Get SCAM and testscript to run on Darwin. Make Eulerian data dimensioned plat/2 to (plat+1)/2, -so will compile correctly with SCAM. Add "skip" and "noclean" as command-line arguments to -SCAM testscript to skip the CAM build/run and/or don't clean before the build of CAM or SCAM. -These are both useful for using testscript interactively for debugging running SCAM. Add -ability to testscript to run CAM at different resolutions and operate over any point -given (it gets the latitude and longitude needed for SCAM from the IOP file produced). - -CAM Makefile change: - -Get rid of auto-promotion on Darwin compile (Mac-OS-X with Absoft IBM XLF/XLC compilers). - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_23 -Originator: pworley ( Patrick H Worley) -Date: Thu Sep 29 15:42:12 MDT 2005 -Model: CAM -Version: CAM3.2.23 -One-line Summary: Explicitly typed variables and constants and deleted autopromotion of reals in Makefile. -cam-bugs Requests resolved: none -Requires change in build system: Yes - removed autopromotion flags from FFLAGS -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton, Art Mirin, Forrest Hoffman, Michael Ham -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes - Explicitly typed variables and constants -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Nearly every file in CAM standalone was modified, some extensively, but most -changes were "syntactic". Note that this includes most Fortran source in csm_share, ice, -lnd, and utils as well as in atm. Only the tool subdirectories were "spared". - -The steps were as follows: - -a) in atm/cam/src, the routines - -chemistry/waccm_mozart/apex_subs.F -chemistry/waccm_mozart/svdcmp.F -chemistry/waccm_mozart/wei96.F -physics/waccm/msise00.F -utils/fft99.F -utils/sgexx.F - - were all changed from fixed format that used implicit typing - to free free format with "implicit none" - and explicitly typing of all variables. (The suffixes - were all changed from .F to .F90 as well.) - -b) Tom Henderson's tool "addrealkind" was used to - change "real" declarations to "real(r8) and to add - "_r8" to all floating point constants that weren't already typed. - "use shr_kind_mod" was added where needed. - (For csm_share/shr. SHR_KIND_R8 was used instead of r8. - In csm_share/cpl, R8 was used. In ice/csim4, dbl_kind was used.) - - (For Tom's tool to work correctly, the name of the module was appended - to "end module" in a number of files, and "end" was replaced - by "end subroutine xxx" or "end function yyy" in a number of - files as well.) - - complex declarations were also changed to complex(r8) - -c) float(iii) and real(iii) were replaced by real(iii,r8). - cmplx(xxx,yyy) was replaced by cmplx(xxx,yyy,r8). - dble(iii) was replaced by real(iii,r16) if r16 was really necessary, - otherwise it was replaced by real(iii,r8). - Constants of the form xxx.yyyDeee were replaced by xxx.yyyEeee_r16 - if r16 was necessary, otherwise were replaced by xxx.yyy.Eeee_r8. - -d) specific intrinsics were changed to generic intrinsics, - e.g. alog10 was changed to log10, etc. - -e) removed local definitions of r8 and r16 when they were identical to - those in shr_kind_mod, but left the local definitions as is if they - were different. - -f) compiler flags that defined real variables to be double precision (or real*8) - and/or promoted floating point constants and intrinsics to double precision - were removed from the CAM makefile. (Something similar will need to - be done in CCSM.) - -Finally, a new command was added to phys_grid to indicated whether phys_grid -had been called or not. This logical function was used in camhub_comp.F90 -in place of the existing error-prone tests for this condition. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_22 -Originator: erik ( Erik Kluzek) -Date: Tue Sep 20 14:19:53 MDT 2005 -Model: CAM -Version: CAM3.2.22 -One-line Summary: Create cam_comp atmosphere component and make stepon a module, add Darwin (Mac-OS-X) as a platform -cam-bugs Requests resolved: none -Requires change in build system: no - (Did add changes to configure/build system so that can compile on Mac-OS-X with - Absoft XLC/XLF compilers. -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, mvertens -Restart files change: yes -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Interface with cam_comp changes -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Move the cam3_2_21_brnchT_chghilev_8 tag onto cam_dev. - -Add changes to esmf, cam, scam, and cprnc to build/run on Darwin (Mac-OS-X) platform -with the ABSOFT IBM XLF/XLC compilers. On Darwin scam will compile, but not link -at this point. More work needs to be done for it to completely build and run. - -Create a cam_comp component module to encapsulate the atmosphere part -of CAM. Make stepon into a module with initial, run and final methods. -Have scam interface with cam_comp rather than underlying subroutines. -Have scam interface with runtime_options in a more straightforward manner, -that won't require duplication of default settings for SCAM inside scam -initialization. Rename scam_inital to inital module a module for scam replacing -the Eulerian inital. - -The next step is to make cam_comp have multiple run phases, and stepon have -multiple run phases (this is outlined in each stepon). Then bring the time-loop -out of stepon and up to the driver level. The driver is still called cam.F90, but -will soon be refered to as sequential CCSM to distinquish it from cam_comp the -atmosphere only component, of the stand-alone CAM modeling system. - -This is documented as Stage-1.2-6 on the CCSM/ESMF webpages.... - -http://swiki.ucar.edu/start/83 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_21 -Originator: mvr ( Mathew Rothstein) -Date: Mon Sep 12 14:34:15 MDT 2005 -Model: CAM -Version: CAM3.2.21 -One-line Summary: re-work of ccsm test within cam test suite; updated to latest version of share code; mods to help waccm work in ccsm mode -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM: yes -Tested to work with SCAM: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -A models/atm/cam/test/system/gen_test_table.sh -- utility to generate html file with table of tests currently included in cam test suite - -A models/csm_share/cpl/cpl_fields_mod.F90.CO2A -A models/csm_share/cpl/cpl_fields_mod.F90.CO2B -A models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA -A models/csm_share/shr/shr_map_mod.F90 -A models/csm_share/shr/shr_ncread_mod.F90 -A models/csm_share/shr/shr_stream_mod.F90 -A models/csm_share/shr/shr_string_mod.F90 -A models/csm_share/shr/shr_tInterp_mod.F90 -- added as part of update of share code from share3_0_2 to share3_050909 - -M models/atm/cam/bld/configure -- changed filepath for ccsm builds to correct location of waccm src -M models/atm/cam/src/physics/waccm/msise00.F -- changed the name of variable MSS to avoid ccsm pre-processor confusion -M models/atm/cam/test/system/TCB.ccsm.sh -- redirection of ccsm build test output to appropriate log file and some cleanup -M models/atm/cam/test/system/TCS.ccsm.sh -- re-working of ccsm test within cam test suite -M models/atm/cam/test/system/TMC.sh -- added some error checking to mass conservation test script -M models/atm/cam/test/system/TSB.ccsm.sh -- re-working of ccsm test within cam test suite -M models/atm/cam/test/system/test_driver.sh -- remove references to certain job log file if running interactively - -M models/csm_share/ChangeLog -M models/csm_share/ChangeSum -M models/csm_share/cpl/cpl_bundle_mod.F90 -M models/csm_share/cpl/cpl_comm_mod.F90 -M models/csm_share/cpl/cpl_contract_mod.F90 -M models/csm_share/cpl/cpl_control_mod.F90 -M models/csm_share/cpl/cpl_domain_mod.F90 -M models/csm_share/cpl/cpl_fields_mod.F90 -M models/csm_share/cpl/cpl_infobuf_mod.F90 -M models/csm_share/cpl/cpl_interface_mod.F90 -M models/csm_share/cpl/cpl_iobin_mod.F90 -M models/csm_share/cpl/cpl_iocdf_mod.F90 -M models/csm_share/cpl/cpl_map_mod.F90 -M models/csm_share/cpl/cpl_mct_mod.F90 -M models/csm_share/shr/shr_cal_mod.F90 -M models/csm_share/shr/shr_msg_mod.F90 -- modified as part of update of share code from share3_0_2 to share3_050909 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_20 -Originator: jedwards ( James Edwards) -Date: Wed Sep 7 14:22:57 MDT 2005 -Model: CAM -Version: CAM3.2.20 -One-line Summary: removed the comhyb.h commonblock, made hycoef a module. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K -cam3_2_19 fails ccsm build, that failure is carried forward. - -Tested to work coupled with CCSM (create_ccsmcam): no - see above -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -changes made: removed the file comhyb.h and created a module hycoef. subroutine hycoef is renamed hycoef_init and the common block variables from comhyb -are now module variables. Replaced #include with -use hycoef, only : -this change affected a number of files across the structure. - -=============================================================== -=============================================================== - -cam3_2_19 -Originator: pworley (Pat Worley), eaton ( Brian Eaton) -Date: Tue Sep 6 16:01:22 MDT 2005 -Model: CAM -Version: CAM3.2.19 -One-line Summary: cray performance, XT3 support, timing lib mods -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes - restore Cray performance to levels before commit of cam3_2_1; - also, timing lib changes improve SGI Altix performance significantly. -Requires change in run script: no -Ran test_driver.sh script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: The CCSM test is failing because the CCSM scripts don't use CAM's Makefile. Will fix - the test by updating the appropriate CCSM template file. -Tested to work coupled with CCSM (create_ccsmcam): fails -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Worley, Eaton, Conley -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -> Makefile -> - set default C compiler to mpcc_r for AIX (was "cc") -> - added support for Cray XT3 in Linux section. -> (For XT3, set -> USER_FC := ftn -> USER_CC := cc -> and add -DCATAMOUNT to USER_CPPDEFS ). -> -> control/cam.F90 -> - added four timer calls (mpi_wtime), to get basic -> performance data (total, stepon, SYPD based on stepon time) -> even when -DDISABLE_TIMERS is specified. -> - moved first t_start calls to after spmdinit is called, -> to allow mpi_wtime to be used in the timing library -> - moved trunc call to after first t_start call, so as to -> include in measured initialization phase -> - #ifdef CATAMOUNT -> ! Improve performance of writing to standard out and error on XT3 -> ! (using Catamount kernel) by increasing buffer size. -> call usetlbuf() -> #endif -> -> control/get_memusage.c -> - Linux branch of get_memusage breaks the code on the XT3. -> Disabled the routine when CATAMOUNT defined. -> -> #ifdef CATAMOUNT -> return -1; -> #else ... -> -> dynamics/fv/cd_core.F90 -> - added CSD call (Cray Streaming Directive, for use on Cray X1(E) ) -> that was mistakenly not included in earlier check-in. -> -> physics/cam1/aerosol_radiation_interface.F90 -> - promoted local 1D arrays to 2D; added CSD; moved diagnostic output -> to separate loop; in order to recover vectorization and streaming -> lost in cam3_2_1 check-in -> -> physics/cam1/radsw.F90 -> - deleted hanging CSD region delimiter -> -> utils/timing/gptl.c -> - added support for using mpi_wtime instead of gettimeofday when -> SPMD specified. (This improves performance on SGI Altix significantly, -> and allows timers to be used on Cray XT3.) -> - added call to rtcrate on Cray X1(E) systems, removing hardcoded -> ticks_per_sec value (that is different on X1 and X1E). -> - increased number of digits in timing data output -> -> utils/timing/private.h -> - defined fields needed when using mpi_wtime to measure time -> -> 2 files added: -> -> control/uselbuf.c -> -> - set system buffering for output to stdout and stderr. -> Needed on Cray XT3 to workaround performance problem. -> -> utils/timing/rtcrate.F90 -> -> - C-callable Fortran function that calls irtc_rate intrinsic -> and returns the value (when #ifdef UNICOSMP). - - - -=============================================================== -=============================================================== - -cam3_2_18 -Originator: jedwards (Jim Edwards) eaton (Brian Eaton) -Date: Mon Sep 5 09:42:57 MDT 2005 -Model: CAM -Version: CAM3.2.18 -One-line Summary: spmd_utils module mods -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: jedwards, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Consolidate code into spmd_utils.F90 that sets up the generic spmd -environment. In particular, move pmgrid variables masterproc and iam, -spmd_dyn variables npes, nsmps, proc_smp_map, and the subroutines from the -files spmdinit.F90 and swap_comm.F90 into the spmd_utils module. The -subroutine spmdinit has been modified to initialize these public variables -whether SPMD is defined or not. Hence the "ifdef SPMD" conditional has -been removed from the call to spmdinit in the main cam program. - -Because these variables are so widely used this change touches about 150 -files. Most the changes are only one or two lines of modified "use" -association statements. - -=============================================================== -=============================================================== - -cam3_2_17 -Originator: erik ( Erik Kluzek) -Date: Tue Aug 30 16:32:07 MDT 2005 -Model: CAM -Version: CAM3.2.17 -One-line Summary: Resolve special physics modes beneath driver, move surface restart to seperate call -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: ideal-phys bit-for-bit test - 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 7 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) (Except FV ideal_phys test, because was previously broken) -Changes to CLM land-model: Add noland mode for adibatic,ideal_phys, aqua -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Resolve the non-physics modes of CAM (adiabatic, ideal_phys, and aquaplanet) -below the driver level, so that components know the appropriate action, but -the driver isn't aware of it. Continue to use the common block for the data -that signals this behavior, but move the behavior completely inside of ice, -ocean or land surface models. - -Also move the read of surface initial data and restart information outside -of cam_intial and read_restart to methods just before surface model -initialization. This means breaking up the restart so that intht is called -later, the read_history is called later, and the close of nrg is done at this -later step as well. Move the nrg unit numbers to wholy contained within the -relevent restart modules. - -This actually allows CCSM mode to make use of ideal_phys, or adiabatic, -unlike previously where it wasn't a possiblity. - -Documentation fully spelled out at: - -Pre-ESMF Stage-1.2.3 checkin from - - http://swiki.ucar.edu/start/82 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_16 -Originator: jedwards ( James Edwards) -Date: Mon Aug 29 20:40:09 MDT 2005 -Model: CAM -Version: CAM3.2.16 -One-line Summary: added 'only' clause to some and removed other module statements -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.sh script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml - -Changes Made: - minor changes were made to a number of files which use modules from - the dynamics directories. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_15 -Originator: erik ( Erik Kluzek) -Date: Mon Aug 22 11:36:09 MDT 2005 -Model: CAM -Version: CAM3.2.15 -One-line Summary: Split comsrf into three parts move calls to surface models up to cam.F90 and stepon.F90 level -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.sh script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) - License problems with scamtest -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Pass in new structures to it -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Put cam3_2_14_brnchT_chghilev_2 on the main trunk (with some SCAM changes made so -that CRM should operate properly). Didn't test for anything beyond testscript. - -Changes defined in pre-ESMF Stage-1-2 - - http://swiki.ucar.edu/start/73 - -Make physpkg into a module with and initial and 2 run phase methods. -Move the initialization calls of the surface models to cam.F90. -Move the run calls of the surface models to stepon.F90. - -Divide comsrf into 3 parts: - -comsrf.F90 ------- miscellaneous 2D arrays that should be moved into relevant packages (physics, - ice, or ocean) -camhub_comp.F90 --- Responsible for merging surface models (land, ice, ocean) into a merged - surface state -camsrfexch_types -- definition of derived data types for exchange of surface information - between surface models - -Move landfrac, ocnfrac and icefrac into merged surface derived type. - -Move instantiation of surface exchange types to top driver level. Pass down data types -to relevant subroutines. - -Make physpkg into a module with and initial and 2 run phase methods. -Move the initialization calls of the surface models to cam.F90. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_14 -Originator: boville (Byron Boville), eaton (Brian Eaton) -Date: Fri Aug 12 16:12:13 MDT 2005 -Model: CAM -Version: CAM3.2.14 -One-line Summary: history module mods -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: boville, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Some cleanup of the history module - mainly moving addfld and add_default -calls to the modules that are responsible for defining a quantity and -making outfld calls for it. This gets rid of most of bldfld and h_default. -What remains of those subroutines has been merged into bldfld, and bldfld -has been moved into history_defaults.F90 which we expect to eventually go -away. Also, the SCAM specific routines have been put into -history_scam.F90. What's left in the history module is intended to be the -generic history module interface. - -The functionality of the history module has been extended so that the -defined history files don't have to be sequential, e.g., a user can now -remove fincl2 from a namelist that contains specifications for fincl2 and -fincl3 without having to rename fincl3 to fincl2. Previously the renaming -would have been necessary because having the 2nd history file empty when -the 3rd file was not empty was not allowed. However, this new -functionality was not motivated by increased user convenience which is -pretty negligible. The real reason for this change was to allow more -flexibility in where the calls are made to add fields to the initial file -which is just a special history file which is always the last one in the -list. By allowing the list to contain empty files, the index of initial -file can now be terminal list index which is known at compile time, rather -than being the index that follows the last user or code defined history -file which isn't known until after processing all the add_default calls -which can occur at any point during the physics initialization. - -precc_thresh and precl_thresh have been removed from the namelist. - - -=============================================================== -=============================================================== - -cam3_2_13 -Originator: mvr ( Mathew Rothstein) -Date: Thu Aug 11 12:29:05 MDT 2005 -Model: CAM -Version: CAM3.2.13 -One-line Summary: Added tests to default CAM test suite; various bug fixes and cleanup -cam-bugs Requests resolved: none -Requires change in build system: yes -Makefile changed for pathf90; added -ftpp option to handle directive -embedded in multi-line data statement -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM: yes -Tested to work with SCAM: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -R models/atm/cam/test/system/create_ccsmcam -- most stuff was merged into TCB.ccsm.sh - -A models/atm/cam/bld/run-lightning.csh -- new self-contained example run script specifically for lightning platform -A models/atm/cam/test/system/TMC.sh -- new script for the testing of mass conservation parameters -A models/atm/cam/test/system/TSB.ccsm.sh -- new generic script that will submit a specified ccsm test and include a - baseline test if appropriate - -M models/atm/cam/bld/Makefile -- added pathf90 compiler option -ftpp, needed to pre-process a directive - embedded in a multi-line data statement -M models/atm/cam/src/control/history.F90 -- bug fix for the setting of time_bnds for branch runs -- bug fix for the writes of flag_xyfill and flag_isccplev to the restart file -M models/atm/cam/src/control/time_manager.F90 -- added method get_prev_time (analogous to get_curr_time) -M models/atm/cam/src/physics/cam1/qneg3.F90 -- made mods recommened by dave parks for NEC efficiency -M models/atm/cam/test/system/TBL.sh -- will now skip entirely if not testing vs baseline -- bug fix for mkdir validation -M models/atm/cam/test/system/TBR.sh -- reordering of algorithm for efficiency -- bug fix for mkdir validation -M models/atm/cam/test/system/TCB.ccsm.sh -- complete overhaul; is now just a wrapper script for ccsm's create_test with - some sed commands -M models/atm/cam/test/system/TCB.sh -- bug fix for mkdir validation -M models/atm/cam/test/system/TCS.ccsm.sh -- major overhaul to work with new script TSB.ccsm.sh -M models/atm/cam/test/system/TEQ.sh -- bug fix for mkdir validation -M models/atm/cam/test/system/TER.sh -- reordering of algorithm for efficiency -- bug fix for mkdir validation -M models/atm/cam/test/system/TRX.sh -- reordering of algorithm for efficiency -- bug fix for mkdir validation -M models/atm/cam/test/system/TSM.sh -- bug fix for mkdir validation -M models/atm/cam/test/system/input_tests_aix -- replaced TCB.ccsm.sh with TSB.ccsm.sh in default list -M models/atm/cam/test/system/input_tests_linux -- added the tests for mass conservation to defaul list -M models/atm/cam/test/system/input_tests_master -- added mass conservatin tests, ccsm submit test, most smoke tests now 9 steps -M models/atm/cam/test/system/scamtest.sh -- bug fix for mkdir validation -M models/atm/cam/test/system/test_driver.sh -- now using newcprnc - required to recognize isccp variables -M models/atm/cam/test/system/nl_files/ghgrmp -- added namelist variable to turn on isccp simulator for testing - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_12 -Originator: erik ( Erik Kluzek) -Date: Wed Aug 10 12:53:31 MDT 2005 -Model: CAM -Version: CAM3.2.12 -One-line Summary: Get rid of #ifdefs refering to CAMSURF from cam3.2.3 commit -cam-bugs Requests resolved: none -Requires change in build system: no (but you can get rid of references to CAMSURF in misc.h) -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: Most bit-for-bit tests fail as this is an answer changing commit -On bangkok: -004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 -007 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 -011 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 -015 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 -022 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 -026 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -030 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 -033 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 -037 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 -On bluesky: -005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 -008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 -015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 -019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -030 bl336 TBL.sh wm4h outfrq3s 9..................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 -040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 -044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 -047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 -054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 -On tempest: -004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 -007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 -014 bl152 TBL.sh e64o outfrq24h -2................................FAIL! rc= 7 -017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 -021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 -024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 -038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 -045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, eaton -Restart files change: no -Changes answers: Yes (same-physics) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - Get rid of all the #ifdef's refering to CAMSURF that went in with - the cam3.2.3 tag. - Basically, this tag gets the same answers as cam3.2.11 if you set - - #define CAMSURF CLIMATE_CAMSURF - - in misc.h and in configure script. - - The exception to this is that in this tag newiceproperties is - still called at initialization - in camice in camice_init. The reason for this is because there is - some initializion - that's important to do in newiceproperties. - - The code changes answers compared to cam3.2.11, and the changes - were validated with - simulations with FV and DOM at 4x5 resolution. Answers also change - for SOM, but this - wasn't verified. - - /ERIK/csm/cam324_fv4x5dom_camsurf_1 --- Experiment based - off cam3.2.4 (10 years) - vs. - /ERIK/csm/cam321_fv4x5dom_1 -- control of cam3.2.1 (10 - years) - - Plots are available from - - http://www.cgd.ucar.edu/~erik/AMWG_diag/cam324_fv4x5dom_camsurf_1-cam321_fv4x5dom_1/ - - The difference in the code is primarily to unify the merging of - surface fields at - timestep==0 with that done while time-stepping. And to unify how - the ocean-ice - diagnostic fluxes are calculated at time-step==0 with when - time-stepping. Also in - order to remove a dependency on the order that ocean and ice are - called, I also use - 1-landfrac rather than ocnfrac as a mask for certain - calculations. This changes - answers for SOM at each time-step. - - The tests that fail have to do with bit-for-bit comparisions with - cam3.2.11. Some - of the bit-for-bit tests pass, if they run ideal-phys, adiabatic, - or aqua-planet. - Also error-growth tests are identical as error-growth is run in - aqua-planet mode. - -See: -http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_11 -Originator: sawyer (Will Sawyer), eaton (Brian Eaton) -Date: Fri Aug 5 11:47:16 MDT 2005 -Model: CAM -Version: CAM3.2.11 -One-line Summary: Cleanup and performance mods for FV -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes (performance improvements for FV on Cray and NEC SX) -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: -on bluesky: -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 -034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 -on bangkok: -026 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: sawyer, eaton -Restart files change: no -Changes answers: no, except roundoff introduce into FV -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Replace the original dynamics_vars.F90 by the new version. - -Add performance mods for both Cray X1 and NEC SX (from Art Mirin and Pat Worley). - -Clean up implementation of options for using platform optimized FFT -libraries (from Art Mirin and Pat Worley). - -Remove SAVEd variables in cd_core. This will come close to making the code -reentrant. - -Explain failed tests: - -These tests all failed due to a roundoff level changed introduced in the FV dycore. Since no -tests that had debug enabled failed, we assume this is an optimization issue. The roundoff level -changes were verified by perturbation growth tests on both bluesky and bangkok, but only for -the configuration of tests bl351 and bl353. Test bl336 is a waccm_mozart configuration and -the pergro test does not currently work there. - -=============================================================== -=============================================================== - -cam3_2_10 -Originator: sawyer (Will Sawyer), eaton ( Brian Eaton) -Date: Tue Aug 2 18:02:15 MDT 2005 -Model: CAM -Version: CAM3.2.10 -One-line Summary: Bug fix for FV in OMP-only mode -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: sawyer, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -dynamics/fv/p_d_adjust.F90 -. add "pole" to private variables in first OMP directive - -=============================================================== -=============================================================== - -cam3_2_9 -Originator: dcn (David Noone), eaton ( Brian Eaton) -Date: Tue Jul 26 17:57:28 MDT 2005 -Model: CAM -Version: CAM3.2.9 -One-line Summary: mods for water isotopes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) -on tempest: -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: dcn, eaton -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -This is an incremental commit of mods to incorporate water isotopes into -CAM. Added mods to manage the water isotope constituents. Added mods to -allow the cloud sedimentation and ocean evaporation processes to act on -these constituents. - -The regression test that fails is due to a bug in the FV dycore introduced -in cam3_2_8. It has only been observed in pure OMP mode on the SGI. - - -=============================================================== -=============================================================== - -cam3_2_8 -Originator: sawyer, eaton ( Brian Eaton) -Date: Thu Jul 21 13:37:42 MDT 2005 -Model: CAM -Version: CAM3.2.8 -One-line Summary: update FV dycore, part 1 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no (only tested IBM) -Requires change in run script: no -Ran test_driver.sh script: yes -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: -On tempest: -031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: spectral dycores are bit-for-bit, fv has roundoff change -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Update the FV dycore to contain new code from the GEOS5 version. The new -code includes derived types to encapsulate grid and state information. -Currently we've only used the grid type. The dynamics state remains module -data in the prognostics module. The new grid type replaces most of the -previous uses of the pmgrid and spmd_dyn modules although there is still -cleanup work to be done. There was also a change in the polar filtering -code which introduces a roundoff level change in the FV simulations. The -change was implemented as a bug fix to the problem that answers were -depending on the X decomposition when the 2D decomp option was used. - - -=============================================================== -=============================================================== - -cam3_2_7 -Originator: mvr ( Mathew Rothstein) -Date: Tue Jul 19 11:31:59 MDT 2005 -Model: CAM -Version: CAM3.2.7 -One-line Summary: Fix for CCSM testing within CAM test suite; other test suite enhancements, cleanup -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -R models/atm/cam/bld/CAM.pm -R models/atm/cam/bld/CAM_lab.pm -R models/atm/cam/bld/CAM_run.pm -R models/atm/cam/bld/Design.tex -R models/atm/cam/bld/Requirements.tex -R models/atm/cam/bld/bldtex.csh -R models/atm/cam/bld/condense-path.pl -R models/atm/cam/bld/fvtest.sh -R models/atm/cam/bld/graphgrowth.csh -R models/atm/cam/bld/lab_default.pm -R models/atm/cam/bld/run-model.pl -- cleaned up obsolete files from bld directory - -R models/atm/cam/test/system/TER.ccsm.sh -- script made more generic and renamed - see the new file TCS.ccsm.sh - -A models/atm/cam/test/system/TCS.ccsm.sh -- generic script to check the status of a coupled cam run - -M models/atm/cam/test/system/TBL.sh -- status file renamed for consistency, algorithm re-ordered for efficiency -M models/atm/cam/test/system/TBR.sh -- status file renamed for consistency, algorithm re-ordered for efficiency -M models/atm/cam/test/system/TCB.ccsm.sh -- will now configure build and submit ccsm run for specified test/config -M models/atm/cam/test/system/TCB.sh -- status file renamed for consistency -M models/atm/cam/test/system/TEQ.sh -- status file renamed for consistency -M models/atm/cam/test/system/TER.sh -- status file renamed for consistency, algorithm re-ordered for efficiency -M models/atm/cam/test/system/TRX.sh -- status file renamed for consistency, algorithm re-ordered for efficiency -M models/atm/cam/test/system/TSM.sh -- status file renamed for consistency -M models/atm/cam/test/system/create_ccsmcam -- modified to use CAM sandbox for coupled test rather than CAM of CCSM tag -M models/atm/cam/test/system/input_tests_aix -- new testid for ccsm check status test -M models/atm/cam/test/system/input_tests_master -- new argument lists for ccsm tests (test, resolution, component set) -M models/atm/cam/test/system/scamtest.sh -- status file renamed for consistency -M models/atm/cam/test/system/test_driver.sh -- now allows batch jobs to run from their own directory if env var CAMROOT set -M models/atm/cam/test/system/CAM_runcmnd.sh -- corrected documentation in the comments -M models/atm/cam/tools/scam/testscript -- removed unnecessary output file - -M models/atm/cam/test/system/nl_files/adia -M models/atm/cam/test/system/nl_files/aqpgro -M models/atm/cam/test/system/nl_files/ghgrmp -M models/atm/cam/test/system/nl_files/idphys -M models/atm/cam/test/system/nl_files/no_ttrac -M models/atm/cam/test/system/nl_files/off2x2.5 -M models/atm/cam/test/system/nl_files/outfrq24h -M models/atm/cam/test/system/nl_files/outfrq3s -M models/atm/cam/test/system/nl_files/ttrac -M models/atm/cam/test/system/nl_files/ttrac_lb1 -M models/atm/cam/test/system/nl_files/ttrac_lb2 -M models/atm/cam/test/system/nl_files/ttrac_lb3 -- namelists now specify secondary history tape names, freqs, and use 64-bit - -M models/atm/cam/bld/run-ibm.csh -M models/atm/cam/bld/run-pc.csh -M models/atm/cam/bld/run-sgi.csh -- updated the self-contained example run scripts - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_6 -Originator: fvitt ( Francis Vitt) -Date: Wed Jul 13 09:34:52 MDT 2005 -Model: CAM -Version: CAM3.2.6 -One-line Summary: Fixed bug in earth-sun distance factor used in waccm -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -bluesky, tempest, bangkok -Test id's that fail: -on bluesky -- bug fix in waccm resulted in failure of base line comparison -030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 6 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Stacy Walters -Restart files change: no -Changes answers: no (bit-for-bit) or Yes -bit-for-bit except for waccm -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 -models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_5 -Originator: mvr ( Mathew Rothstein) -Date: Mon Jul 11 15:56:16 MDT 2005 -Model: CAM -Version: CAM3.2.5 -One-line Summary: Removal of params.h and misc.h (clm code excluded) -cam-bugs Requests resolved: none -Requires change in build system: yes -#defines of misc.h and params.h now passed to Makefile via cppdefs -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: -cb999, er999 (ccsm test on bluesky) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -M models/atm/cam/bld/configure -- moved #define's of params.h and misc.h into cppdefs -- removed creation of params.h (misc.h still temporarily remains for clm code) -M models/atm/cam/bld/Makefile -- no longer looks for SPMD specification in misc.h - -**also modified all fortran and c files to remove #include of misc.h and -params.h (excluding clm code) - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_4 -Originator: jeff ( Yen-Huei Lee) -Date: Sun Jul 3 13:48:55 MDT 2005 -Model: CAM -Version: CAM3.2.4 -One-line Summary: fix tro_mozart to allow extra tracers, bug fix to run in ccsm, output co2 fluxes to history tape, add index for fdms -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 - allow trop_mozart to run with extra tracers, i.e. CO2. - -M models/atm/cam/src/physics/cam1/physpkg.F90 - bug fix to allow ccsm to run - -M models/atm/cam/src/physics/cam1/co2_cycle.F90 -M models/atm/cam/src/control/ccsm_msg.F90 - output co2 fluxes to history tape - -M models/atm/cam/src/physics/cam1/comsrf.F90 - add index for fdms - -M models/atm/cam/src/dynamics/fv/fv_prints.F90 - bug fix - -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml - use new data sad_file for waccm_mozart - -=============================================================== -=============================================================== - -cam3_2_3 -Originator: erik ( Erik Kluzek) -Date: Thu Jun 30 00:18:39 MDT 2005 -Model: CAM -Version: CAM3.2.3 -One-line Summary: Move cam3_2_2_brnchT_srfsimp6 to cam_dev -- makes surface (ocean, land, sea-ice) more modular -Requires change in build system: yes -(Requires CAMSURF defines in misc.h) -Substantial timing or memory changes: no -Requires change in run script: no -Ran test_driver.shl script: yes (does all of the following tests) -Machines tested: IBM, SGI, Linux-Lahey -Test id's that fail: Bluesky: 1, 5,8,15,22,30,34,37,40,44,47,54,55 - 5-54 fail because diagnostic fields change - 001 cb999 TCB.ccsm.sh .............................................FAIL! rc= 4 - 055 er999 TER.ccsm.sh .............................................FAIL! rc= 2 -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, mvertens -Restart files change: yes -Changes answers: no (bit-for-bit) (some ocean/ice diagnostic fields - change to roundoff at time=0) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Add following to misc.h: - -#define B4B_CAMSURF -2 -#define RND_CAMSURF -1 -#define CLIMATE_CAMSURF 0 -#define CAMSURF B4B_CAMSURF - -This allows answers to be the same as current model, while allowing -ifdefs that can provide changes to roundoff or climate-changing. - -Move tsnam and plevmx to ice_constants - -Shorten initext and remove tangled dependencies of surface models. -Create initialization methods for sea-ice and oceanm that are called by -initext. Move surface methods in physpkg to run methods in ocean, and ice. - -Make camice and somocn, and camocn into modules with various methods. -Move ice_read from inidat to camice. Move write_restart, read_restart -of ice to camice methods. - -Make comsrf more modular. Move data specific to ocean, ice, or land -out of comsrf. Create merge method, and make some methods private. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_2 -Originator: mvr ( Mathew Rothstein) jeff, mvertens, eaton -Date: Wed Jun 15 16:37:19 MDT 2005 -Model: CAM -Version: CAM3.2.2 -One-line Summary: configure/build-namelist mods for calls from ccsm and a plethora of bug fixes -cam-bugs Requests resolved: none -Requires change in build system: yes - now enabled for ccsm -Substantial timing or memory changes: no -Requires change in run script: yes - now enabled for ccsm -Tested to work coupled with CCSM (create_ccsmcam): not create_ccsmcam, but other -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey,pgi -Ran test_driver.shl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself,eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes - logical restart writes changed to ints -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: -R models/atm/cam/tools/icesst/bcgen/namelist.T42 -R models/atm/cam/tools/icesst/bcgen/namelist.T42.oldtt -R models/atm/cam/tools/icesst/bcgen/namelist.T5 -- cleanup of files resulting from regeneration of sst datasets - -A models/atm/cam/tools/icesst/bcgen/namelist -- new file required of modified method to generate sst datasets -A models/atm/cam/test/system/config_files/wm4h -- new configuration options file for waccm test without debug - -M models/atm/cam/bld/CAM_namelist.pm -M models/atm/cam/bld/build-namelist -M models/atm/cam/bld/namelist.pm -- mods required for CAM's build-namelist script to be called from within CCSM - -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml -M models/atm/cam/bld/DefaultCLMEXPNamelist.xml -- new defaults for 1.9x2.5 topo datasets - -M models/atm/cam/bld/configure -- mods required for CAM's configure script to be called from within CCSM - -M models/atm/cam/src/chemistry/waccm_mozart/mo_setrxt.F90 -- bug fix to achieve b4b restart of waccm_mozart - -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/history.F90 -M models/atm/cam/src/control/restart.F90 -M models/atm/cam/src/control/time_manager.F90 -M models/lnd/clm2/src/main/histFileMod.F90 -- all logical restart writes are now integers (workaround to pathscale bug) - -M models/atm/cam/src/physics/cam1/co2_cycle.F90 -M models/atm/cam/src/physics/cam1/radiation.F90 -- change co2 tracer from moist to dry - -M models/atm/cam/src/control/ccsm_msg.F90 -- change unit of co2 flux from kgC/m2/s to kgCO2/m2/s - -M models/atm/cam/src/physics/cam1/srfxfer.F90 -- bug fix for computation of netsw in coupled mode - -M models/atm/cam/test/system/input_tests_master -- modified to now test waccm_mozart in non-debug mode - -M models/atm/cam/test/system/scamtest.sh -- bug fix for output of test results - -M models/atm/cam/tools/definesurf/fmain.f90 -- land fractions < .001 set to zero; metadata now complies with CF conventions - -M models/atm/cam/tools/icesst/README -- describe -g option for reading grid info from file - -M models/atm/cam/tools/icesst/bcgen/bcgen.f90 -- pass the history attribute to setup_outfile - -M models/atm/cam/tools/icesst/bcgen/driver.f90 -- input & output filepaths now specified on command-line -- generate the history attribute - -M models/atm/cam/tools/icesst/bcgen/setup_outfile.f90 -- add history attribute to both output files - -M models/atm/cam/tools/icesst/regrid/regrid.f90 -- Modify so that output grid coordinates can be read from the new grid files - -M models/atm/cam/tools/icesst/regrid/wrap_nf.f90 -- add wrap_nf_put_var_int - -M models/atm/cam/tools/scam/ui/crm.cpp -- updated aerosol optics file to be used for column radiation model test -M models/atm/cam/tools/scam/userdata/crmtest26.out -- updated validation file for column radiation model test - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_2_1 -Originator: aconley ( Andrew J. Conley) -Date: Fri Jun 3 17:29:46 MDT 2005 -Model: CAM -Version: CAM3.2.1 -One-line Summary: Improve interface between radiation (LW and SW) and aerosols -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: Yes (problems for vector architecture) -Requires change in run script: Yes - Added new data to AerosolsOptics file. So CAM namelist has changed -Tested to work coupled with CCSM (create_ccsmcam): No: ccsm namelist is now out of date -Tested to work with SCAM (tools/scam/testscript): No: crm part of test fails now because of change to Aerosol Optics -Machines tested: IBM, SGI, Lahey -Ran test_driver.shl script: No: ran test_driver.sh -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: not for waccm -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: Yes (no change to climate, but larger than roundoff changes) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - - - New files: aerosol_radiation_interface.F90 - aerosol_index.F90 - Deleted: volcrad.F90 - Changed: DefaultCAMExpNamelist - runtime_opts.F90 - advnce.F90 - aer_optics.F90 - aerosol_intr.F90 - inti.F90 - prescribed_aerosols.F90 - radae.F90 - radiation.F90 - radsw.F90 - volcanicmass.F90 - - -=============================================================== -=============================================================== - -cam3_2_0 -Originator: mvertens ( Mariana Vertenstein) -Date: Mon May 30 15:53:48 MDT 2005 -Model: CAM -Version: CAM3.2.0 -One-line Summary: incorporated clm3_expa_29 into stand-alone cam -cam-bugs Requests resolved: none -Requires change in build system: yes (new clm cpp variable added) -Substantial timing or memory changes: no (unless CN code is activated) -Requires change in run script: all clm surface datasets have changed -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, -Restart files change: no -Changes answers: new-climate -Changes to CLM land-model: Yes (see below) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -The following code changes accompany the incorporation -of new CLM code - clm_expa_29 - into the stand-alone CAM -development code base. As part of these changes, new CLM -raw datasets were used to create the clm model surface -datasets. All CLM surface datasets were regenerated using -the new raw datasets. In addition, clm3_expa_29 also contains the -the incorporation of the carbon-nitrogen cycle into the CLM code base -(both Peter Thornton's CN model and the CASA carbon cycle model). -A detailed summary of climate changing modifications appears below. -Finally, clm3_expa_29, contains the flexibility, for the first time, -to run dynamic land use runs using prescribed land use datasets. - -Note that generating clm surface datasets is now accomplished -via an offline tool in mksrfdata/tools/mksrfdat. This is not -part of the standard cam clm/tools directory yet -due to the current structure of the cam cvs module. -This will be incorporated into cam in a subsequent cam checkin. - -Validation simulations were carried out for 1979-2000 with annually varying SSTs. - -The tags used for hyd_clm3_1 were cam3_1_7 and clm3_expa_29 -(camroot = /fis/cgd/cseg/people/mvertens/src/cam/cam3_1_7_clm3_expa_29) - -The changes between hyd_clm3_1 and hyd_con were: -o New SST dataset (amipbc_sst_T42_1949_2004.nc as opposed to sst_HadOIBl_bc_64x128_1949_2001_c020411.nc) -o Albedo calculation in CLM moved to end of second biophysics loop -o Peter Thornton's 2-leaf canopy model -o Peter Lawrence's MODIS-based surface dataset (distribution of plant - functional types, LAI, and soil color) -o David Lawrence's and Peter Thornton's hydrology modifications (includes - new formulations for interception, infiltration (surface runoff), soil - moisture effects on stomatal conductance, soil to canopy air space transfer - coefficients, soil hydraulic conductivity, and baseflow. - -=============================================================== -=============================================================== - -cam3_1_9 -Originator: boville, eaton -Date: Fri May 27 09:55:54 MDT 2005 -Model: CAM -Version: CAM3.1.9 -One-line Summary: WACCM bugfix -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: boville -Restart files change: no -Changes answers: no (bit-for-bit) except WACCM_MOZART changes answers -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -chemistry/waccm_mozart/chemistry.F90 -. Fix initialization of qmin. - -=============================================================== -=============================================================== - -cam3_1_8 -Originator: boville, eaton ( Brian Eaton) -Date: Tue May 17 18:33:16 MDT 2005 -Model: CAM -Version: CAM3.1.8 -One-line Summary: Merge latest WACCM development code -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: boville, eaton -Restart files change: no -Changes answers: CAM is bit-for-bit, WACCM has a new climate. -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Merge latest WACCM development code. - -There is a new feature in the FV tracer code (trac2d.F90) which allows the -timestep splitting to differ in different vertical layers. This feature is -currently only enabled for the WACCM_MOZART configuration since it can -introduce answer changes into the standard CAM FV configurations. - -Add LAPACK_LIBDIR macro to Makefile to allow specifying the location of the -LAPACK and BLAS libraries. Optional use is made of these libraries in -WACCM specific code (on AIX only). - -Add the use of the massv library to the AIX section of the Makefile. The -use of this library introduces roundoff level differences into the -simulation when changing the parallel configuration. This library is only -used in WACCM_MOZART specific code. - -In the IRIX64 section of the Makefile the -cpp option was replaced with --macro_expand. A WACCM_MOZART ifdef which was including code in a -multi-line data statement was failing to compile otherwise. - -=============================================================== -=============================================================== - -cam3_1_7 -Originator: mvr ( Mathew Rothstein) -Date: Wed May 4 12:14:23 MDT 2005 -Model: CAM -Version: CAM3.1.7 -One-line Summary: Updating the new cam test framework with new tests and other enhancements -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -A models/atm/cam/test/system/TEQ.sh -- new generic script to test the equivalence of two cam smoke runs -A models/atm/cam/test/system/TRX.sh -- new script to test the restart of cam using fv 2d decomposition -A models/atm/cam/test/system/scamtest.sh -- new script to test scam and crm -A models/atm/cam/test/system/config_files/f10dm -A models/atm/cam/test/system/config_files/fm2dh -A models/atm/cam/test/system/config_files/fmo2dh -A models/atm/cam/test/system/config_files/wg10dh -A models/atm/cam/test/system/config_files/wm4dh -- new configuration options files for added tests -A models/atm/cam/test/system/nl_files/no_ttrac -A models/atm/cam/test/system/nl_files/off2x2.5 -A models/atm/cam/test/system/nl_files/ttrac_lb1 -A models/atm/cam/test/system/nl_files/ttrac_lb2 -A models/atm/cam/test/system/nl_files/ttrac_lb3 -- new namelist options files for added tests - -M models/atm/cam/test/system/CAM_compare.sh -M models/atm/cam/test/system/TBL.sh -M models/atm/cam/test/system/TBR.sh -M models/atm/cam/test/system/TCB.ccsm.sh -M models/atm/cam/test/system/TCB.sh -M models/atm/cam/test/system/TER.ccsm.sh -M models/atm/cam/test/system/TER.sh -M models/atm/cam/test/system/TSM.sh -M models/atm/cam/test/system/input_tests_aix -M models/atm/cam/test/system/input_tests_irix -M models/atm/cam/test/system/input_tests_linux -M models/atm/cam/test/system/input_tests_master -M models/atm/cam/test/system/test_driver.sh - -mods and enhancements to the new cam test framework scripts including: -- added waccm tests -- added test for load balancing -- added test for the fv offline driver -- added test for fv 2d decomposition -- moved scam/crm test into default tests -- will now stop on first failure for interactive runs by default and - added environment variable CAM_SOFF to override default behavior -- cleaned up handling of shell string variables -- now backs up directories of failed tests when reattempting - -M README -- updated with the wording used for release - - - (Put your detailed description of the changes you made here...) - (You will get your edited copy e-mailed to you. It will also be) - (sent to cam-dev@cgd.ucar.edu.) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_1_6 -Originator: jeff ( Yen-Huei Lee) -Date: Sat Apr 30 12:25:17 MDT 2005 -Model: CAM -Version: CAM3.1.6 -One-line Summary: allow model year to be different from ghg data year -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 -M models/atm/cam/src/physics/cam1/chem_surfvals.F90 -M models/atm/cam/src/physics/cam1/advnce.F90 -M models/atm/cam/src/physics/cam1/srfxfer.F90 -M models/atm/cam/src/physics/cam1/radiation.F90 -M models/atm/cam/src/physics/cam1/co2_cycle.F90 -D models/atm/cam/src/physics/cam1/co2_data_scalar.F90 - -Function add: - -use the following namelists to set model start year and ghg data start year, - - ghg_yearStart_model = 1 - ghg_yearStart_data = 1950 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_1_5 -Originator: eaton ( Brian Eaton) -Date: Mon Apr 25 18:17:11 MDT 2005 -Model: CAM -Version: CAM3.1.5 -One-line Summary: fix CCSM test, update definesurf tool -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): no -Machines tested: IBM -Ran test_driver.shl script: Only ran CCSM test -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None (one-line description) - -Changes made: - -Fix the CCSM test. - -Also add some modifications to the definesurf tool from Byron. These mods -relax the previous restriction that the same filter be applied to both SGH -and PHIS. - -=============================================================== -=============================================================== - -cam3_1_4 -Originator: jeff ( Yen-Huei Lee) -Date: Sat Apr 23 11:20:36 MDT 2005 -Model: CAM -Version: CAM3.1.4 -One-line Summary: add co2 tracer transport and using 2D co2 for radiation -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): no -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test_driver.shl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton -Restart files change: no -Changes answers: Yes (same-to-roundoff) -(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -The constant co2 value used for radiation computation was replaced by -2D co2 distribution (column-mean). This is responsible for the roundoff. - -Function added: - -co2 tracer can be transported with co2 fluxes from land (through coupler), -from ocean (through data file) and from fossil fuel (through data file). - -co2 scalar data can be read from data file and can be used as data-cycling -type operation. - -M models/atm/cam/src/control/cam.F90 -M models/atm/cam/src/control/initext.F90 -M models/atm/cam/src/control/ccsm_msg.F90 -M models/atm/cam/src/control/restart.F90 -M models/atm/cam/src/control/runtime_opts.F90 -M models/atm/cam/src/dynamics/fv/inidat.F90 -M models/atm/cam/src/dynamics/sld/inidat.F90 -M models/atm/cam/src/dynamics/eul/inidat.F90 -M models/atm/cam/src/physics/cam1/advnce.F90 -M models/atm/cam/src/physics/cam1/initindx.F90 -M models/atm/cam/src/physics/cam1/restart_physics.F90 -M models/atm/cam/src/physics/cam1/comsrf.F90 -M models/atm/cam/src/physics/cam1/inti.F90 -M models/atm/cam/src/physics/cam1/srfxfer.F90 -M models/atm/cam/src/physics/cam1/rad_constituents.F90 -M models/atm/cam/src/physics/cam1/radiation.F90 -M models/atm/cam/src/physics/cam1/radsw.F90 -M models/atm/cam/src/physics/cam1/radlw.F90 -M models/atm/cam/src/physics/cam1/radae.F90 -A models/atm/cam/src/physics/cam1/co2_cycle.F90 -A models/atm/cam/src/physics/cam1/co2_data_flux.F90 -A models/atm/cam/src/physics/cam1/co2_data_scalar.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_1_3 -Originator: eaton ( Brian Eaton) -Date: Thu Mar 31 08:51:32 MST 2005 -Model: CAM -Version: CAM3.1.3 -One-line Summary: move control of rad calcs into rad module. pathscale & g95 builds -cam-bugs Requests resolved: bugzilla IDs 4, 10, 13 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): no, currently broken -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Consolidate control of radiation calculations in the radiation module. -This includes resposibility for maintaining the namelist variables iradsw, -iradlw, iradae, and irad_always, and providing a function for the values -dosw, dolw, doabsems, and aeres. These variables have all been removed -from comctl.h. - -Add bugfix for turbulent mountain stress code. - -Add files to DefaultCAMEXPNamelist.xml needed for WACCM runs at 1.9x2.5 -resolution. - -Add Makefile sections and ESMF build to support pathscale and g95 compilers -on linux systems. - -Replace the PGF90 CPP macro with NO_R16. The PGF90 macro was being used to -indicate that the compiler doesn't support quad precision. But that's also -the case for the pathscale and g95 compilers. The use of a generic CPP -token allows new compilers to be supported by modifying the the Makefile to -specify the compiler properties without requiring source code modification. - -The g95 compiler doesn't recognize the cray pointer syntax in fv/geopk.F90. -The use of cray pointers there can't be trivially replaced by F90 pointers. -Since the cray pointers only appear in the geopk16 routine which is not -used by default, a CPP token NO_CRAY_POINTERS is defined for g95 and used -to stub out geopk16. endrun is called if the user sets the namelist -variable (geopktrans) to use geopk16 when NO_CRAY_POINTERS is defined. - -Add bugfix to cmfmca pointed out by David Noone. This only affects the -simulation of tracers using dry mixing ratio (none by default). The set of -test tracers enabled by setting the namelist variable -tracers_flag=.true. use a dry mixing ratio and are affected by this fix. - - -=============================================================== -=============================================================== - -cam3_1_2 -Originator: mvr ( Mathew Rothstein) -Date: Fri Mar 25 16:41:11 MST 2005 -Model: CAM -Version: CAM3.1.2 -One-line Summary: New testing framework for CAM - replaces test-model; and a few minor bug fixes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey, Linux-PGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -...and much, much more! -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - - -R models/atm/cam/test/system/babyblue.test-model.pl.log -R models/atm/cam/test/system/CAM_test.pm -R models/atm/cam/test/system/cam_timing.pm -R models/atm/cam/test/system/check-timing.pl -R models/atm/cam/test/system/dao_batch.csh -R models/atm/cam/test/system/default_tests.test-model.xml -R models/atm/cam/test/system/llnl_blue.csh -R models/atm/cam/test/system/llnl_compass.csh -R models/atm/cam/test/system/llnl_frost.csh -R models/atm/cam/test/system/namelist-config.test-model.dbg.log -R models/atm/cam/test/system/ncar_batch.csh -R models/atm/cam/test/system/nersc_batch.csh -R models/atm/cam/test/system/ornl_batch.csh -R models/atm/cam/test/system/specs-testslist.test-model.xml -R models/atm/cam/test/system/test-examples.pl -R models/atm/cam/test/system/test-model.pl -R models/atm/cam/test/system/test-production.pl -- cleanup of old test-model files - -A models/atm/cam/test/system/CAM_compare.sh -- utility script for comparison of results -A models/atm/cam/test/system/CAM_runcmnd.sh -- utility script for constructing platform dependent run command -A models/atm/cam/test/system/input_tests_aix -- required aix tests for cam commit -A models/atm/cam/test/system/input_tests_irix -- required irix tests for cam commit -A models/atm/cam/test/system/input_tests_linux -- required linux tests for cam commit -A models/atm/cam/test/system/input_tests_master -- master list of tests -A models/atm/cam/test/system/TBL.sh -- generic script for baseline tests -A models/atm/cam/test/system/TBR.sh -- generic script for branch tests -A models/atm/cam/test/system/TCB.ccsm.sh -- script for configure and build test of cam in coupled model -A models/atm/cam/test/system/TCB.sh -- generic script for configure and build tests -A models/atm/cam/test/system/TER.ccsm.sh -- script for exact restart test of cam in coupled model -A models/atm/cam/test/system/TER.sh -- generic script for exact restart tests -A models/atm/cam/test/system/test_driver.sh -- driver script for all tests -A models/atm/cam/test/system/TSM.sh -- generic script for smoke tests -A models/atm/cam/test/system/nl_files/adia -A models/atm/cam/test/system/nl_files/aqpgro -A models/atm/cam/test/system/nl_files/ghgrmp -A models/atm/cam/test/system/nl_files/idphys -A models/atm/cam/test/system/nl_files/outfrq24h -A models/atm/cam/test/system/nl_files/outfrq3s -A models/atm/cam/test/system/nl_files/pghgsul -A models/atm/cam/test/system/nl_files/ttrac -- files containing non-default namelist options being tested -A models/atm/cam/test/system/config_files/e32c11dh -A models/atm/cam/test/system/config_files/e32dh -A models/atm/cam/test/system/config_files/e32pdh -A models/atm/cam/test/system/config_files/e32sdh -A models/atm/cam/test/system/config_files/e64h -A models/atm/cam/test/system/config_files/e64m -A models/atm/cam/test/system/config_files/e64o -A models/atm/cam/test/system/config_files/e8c8mdm -A models/atm/cam/test/system/config_files/e8pdm -A models/atm/cam/test/system/config_files/e8sdm -A models/atm/cam/test/system/config_files/f10c8mdm -A models/atm/cam/test/system/config_files/f10pdm -A models/atm/cam/test/system/config_files/f10sdm -A models/atm/cam/test/system/config_files/f2h -A models/atm/cam/test/system/config_files/f2m -A models/atm/cam/test/system/config_files/f2o -A models/atm/cam/test/system/config_files/f4c11dh -A models/atm/cam/test/system/config_files/f4dh -A models/atm/cam/test/system/config_files/f4pdh -A models/atm/cam/test/system/config_files/f4sdh -A models/atm/cam/test/system/config_files/s32c11dh -A models/atm/cam/test/system/config_files/s32dh -A models/atm/cam/test/system/config_files/s32pdh -A models/atm/cam/test/system/config_files/s32sdh -A models/atm/cam/test/system/config_files/s64h -A models/atm/cam/test/system/config_files/s64m -A models/atm/cam/test/system/config_files/s64o -A models/atm/cam/test/system/config_files/s8c8mdm -A models/atm/cam/test/system/config_files/s8pdm -A models/atm/cam/test/system/config_files/s8sdm -- files containing configuration options being tested - -M models/atm/cam/src/physics/cam1/sulfur_intr.F90 -- fixed declaration and setting of array totcond -M models/atm/cam/src/physics/cam1/dmsbnd.F90 -- initialized arrays dmsin and dms to 0._r8 -M models/atm/cam/src/dynamics/eul/inidat.F90 -- added explicit setting of phis_hires -M models/atm/cam/src/dynamics/fv/inidat.F90 -- modified the array assignments where it depended upon ncol -M models/atm/cam/src/dynamics/sld/inidat.F90 -- added explicit setting of phis_hires -M models/atm/cam/src/control/initext.F90 -- modified the array assignments where it depended upon ncol -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml -- modified the default settings for fv 4x5 sulpher datasets - - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_1_1 -Originator: fvitt ( Francis Vitt) -Date: Mon Mar 21 12:39:28 MST 2005 -Model: CAM -Version: CAM3.1.1 -One-line Summary: Added a tropospheric chemistry package. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -Files added: - -models/atm/cam/bld/config_trop_chem_mozart_defaults.xml -models/atm/cam/src/chemistry/trop_mozart/chem_mods.F90 -models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 -models/atm/cam/src/chemistry/trop_mozart/m_het_id.F90 -models/atm/cam/src/chemistry/trop_mozart/m_rxt_id.F90 -models/atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_adjrxt.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_exp_sol.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_jpl.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_jshort.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_mass_xforms.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_mean_mass.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_negtrc.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_read_chm_sim.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_regrider.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_setext.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_setinv.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_setsoa.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_setsox.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_sulf.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_tracname.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_waccm_photo.F90 -models/atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 -models/atm/cam/src/chemistry/trop_mozart/phtadj.F90 -models/atm/cam/src/chemistry/trop_mozart/rxtmod.F90 - -Files modified: - -models/atm/cam/bld/DefaultCAMEXPNamelist.xml - - added files needed for trop_mozart chemistry package -models/atm/cam/bld/camexp.pm - - added trop_mozart input files to the namelist -models/atm/cam/bld/configure - - added trop_mozart chemistry package option -models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 - - changed interface to be consistent with trop_mozart chemistry -models/atm/cam/src/control/history.F90 - - increased tbl_hash_oflow_percent -models/atm/cam/src/control/runtime_opts.F90 - - added input files to namelist for trop_mozart chemistry -models/atm/cam/src/physics/cam1/aerosol_intr.F90 - - added aerosol feedback capability for trop_mozart chemistry -models/atm/cam/src/physics/cam1/chemistry.F90 - - changed interface to be consistent with trop_mozart chemistry -models/atm/cam/src/physics/cam1/physpkg.F90 - - enabled lightning production of NO for trop_mozart chemistry -models/atm/cam/src/physics/cam1/stratiform.F90 - - added total precip/evap fields to physics buffer needed by trop_mozart -models/atm/cam/src/physics/waccm/chemistry.F90 - - changed interface to be consistent with trop_mozart chemistry -models/atm/cam/tools/scam/testscript - - removed "-test" option from configure invocation - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_1 -Originator: eaton ( Brian Eaton) -Date: Tue Mar 15 20:14:48 MST 2005 -Model: CAM -Version: CAM3.1 -One-line Summary: cam3_1 same as cam3_0_34 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): no -Tested to work with SCAM (tools/scam/testscript): no -Machines tested: none -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? no - -Changes made: none. - -Add tag cam3_1. This is the branch point for the CAM3.1 release - -=============================================================== -=============================================================== - -cam3_0_34 -Originator: pworley ( Patrick H Worley) -Date: Tue Mar 15 18:01:47 MST 2005 -Model: CAM -Version: CAM3.0.34 -One-line Summary: Cray X1 optimizations -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes on X1: recovers performance lost due to changes since cam3.0 -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): no - broken in earlier check-in -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes - added support for SSP execution mode -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -added models/utils/esmf/cray_x1_ssp/ - Identical to cray_x1 except that compiler options in the file base_variables were modified - so that esmf routines could be used in SSP mode. - -models/atm/cam/bld/Makefile - - in UNICOSMP section: added support for SSP mode and higher optimization levels for 4 routines, - recovering performance lost in earlier check-in that lowered optimization - -models/atm/cam/src/control/history.F90, wrap_nf.F90 - - deleted CRAY ifdefs - -models/atm/cam/src/physics/cam1/convect_deep.F90 - - modified calls to convtran, replacing ":" array indices with "1", to improve performance - -models/atm/cam/src/physics/cam1/qneg3.F90 - - modified to improve vectorization and streaming - -models/atm/cam/src/physics/cam1/radiation.F90 - - modified calls to radcswmx and radclwmx, - replacing ":" array indices with "1", to improve performance - - added Cray compiler directives - -models/atm/cam/src/physics/cam1/zm_conv.F90 - - added Cray compiler directives - -models/lnd/clm2/src/main/controlMod.F90 - - added ifdef to define default clump_pproc value for SSP mode - -models/lnd/clm2/src/main/driver.F90 - - added ifdef to disable OpenMP directive around "loop2" for SSP mode (a bug work around) - -models/utils/timing/gptl.c - - added ifdef to not disable timers unnecessarily in SSP mode - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_33 -Originator: rosinski ( Jim Rosinski) -Date: Thu Mar 10 14:05:47 MST 2005 -Model: CAM -Version: CAM3.0.33 -One-line Summary: Enable new timing lib. -cam-bugs Requests resolved: none -Requires change in build system: Maybe for CCSM. -Substantial timing or memory changes: Yes: on IBM timer overhead decreases - by as much as 10x. On SGI by 2x. On - Cray X1 by 3x. No speedup on Linux. -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes but it failed. Told - to go ahead with commit. -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: timer init calls and fortran include file changed. -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -o Replace timer code in utils/timing with new more effecient version. Better - performance results from replacing a linked list search for timer names - with a simple hash table. The new library now prints per-timer overhead - estimates. It can also interface with the PAPI low level performance - counter library. A brief description of how to do so is included in - utils/timing/README. - -o The old interface names (t_xxx) were retained. But these should be changed - to the new names (gptlxxx) as soon as possible. - -o Modify CAM Makefile for optimal performance on Cray X1. - -=============================================================== -=============================================================== - -cam3_0_32 -Originator: eaton ( Brian Eaton) -Date: Tue Mar 8 10:08:10 MST 2005 -Model: CAM -Version: CAM3.0.32 -One-line Summary: topo fields in separate file -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes - namelist includes bnd_topo -- build-namelist provides defaults -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Topography fields (mods from Byron Boville) -=========================================== - -These mods are to read the topo fields (PHIS, SGH, SGH30, LANDFRAC, -LANDM_COSLAT) from their own file. They are no longer written to the -output initial files. Backwards compatibility is maintained by looking for -the topo fields on the initial file if a topo file is not specified using -the new namelist variable bnd_topo. There are also mods to write the names -of the initial, topo, and sst files into global attributes of the history -files. - -An initial set of topo files have been created by extracting the topo -fields from the initial files currently specified in -DefaultCAMEXPNamelist.xml. The topo files are in the data directory -$CSMDATA/atm/cam/topo/. These files will eventually be replaced by a set -of standard files that contain detailed metadata describing how the fields -were produced. - -There are also modifications and cleanup in the definehires and definesurf -utilities. Added alot of information to the README files for both utils. - -Misc -==== - -. Re-insert a fix in phys_grid.F90 (transpose_chunk_to_block) - changing the chunk_buffer arg to intent(in). - -. In history.F90 increase pflds to 2000 and tbl_hash_oflow_percent to 10. - - - -=============================================================== -=============================================================== - -cam3_0_31 -Originator: bundy ( Dani Bundy Coleman) -Date: Wed Mar 2 13:56:13 MST 2005 -Model: CAM -Version: CAM3.0.31 -One-line Summary: Add mass conservation for dry tracers in Eularian dycore; restore same in SLD -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes (bluesky) -Tested to work with SCAM (tools/scam/testscript): yes (bangkok) -Machines tested: IBM (bluesky), SGI (tempest), Linux-Lahey (bangkok) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton -Restart files change: no (pdeld added only when run with dry-type constituents) -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -A models/atm/cam/src/dynamics/eul/massfix.F90 -Currently a module that just holds hw1, hw2, hw3, alpha. Could facilitate -a separation between mass fix and the timefilter. - -M slt/qmassa.F90 -Now a module, old subroutine qmassa is now qmassarun. Added an -optional argument pdeld to be used to calculate hw1lat for dry -mixing-ratio constituents. - -M control/history.F90 -moved addfld and add_defualt for PDELDRY from here to physics/cam1/diagnostics.F90 - -M eul/dp_coupling.F90 -Added transfer of pdeld from p->d,d->p. Calculation of pdeld moved to -tfilt_massfix.F90 instead of call to set_state_pdry. - -M eul/inital.F90 -added initialization of dynamics variable pdeld - -M eul/prognostics.F -added dynamics variable pdeld, only allocated when dry constituents -are present - -M eul/restart_dynamics.F90 -added pdeld to restart files - -M eul/scan2.F90 -moved public hw1, hw2, hw3, alpha to new module massfix.F90 -pass pdeld to tfilt_massfixrun() - -M eul/scandyn.F90 -pass pdeld to qmassarun - -M eul/scanslt.F90 -pass pdeld to qmassarun - -M eul/stepon.F90 -pass pdeld to d_p_coupling - -M eul/tfilt_massfix.F90 -Calculate time filtered value of pdeldry; use this to time-filter dry -constituents conservatively. - -M sld/scanslt.F90 -change qmassa call to new name: qmassarun - -M sld/tfilt_massfix.F90 -save water vapor for use in next timestep; this was inadvertently -removed in cam3_0_28 and is necessary for dry mass conservation - -M physics/constituents.F90 -new public logical cnst_need_pdeldry. Default is flase, set to true if -any constituents are dry. - -M physics/convect_deep.F90 -only use pdeldry when needed - -M physics/diagnostics.F90 -addfld and outfld calls for PSDRY and PDELDRY only when needed - -M physics/icarus_scops.F90 -added r8 to reals - -M physics/physics_types.F90 -added state%pdeldry and related to methods only when needed -added optional argument pdeld_calc (default=true) to subroutine -set_state_pdry, setting false still calculates related fields but -doesn't change state%pdeldry itself. - -M physics/physpkg.F90 -diagnostic subroutine gavglook only calculates dry quantities when -needed - -M physics/tracers_suite.F90 -added missing r8 -Now a module, old subroutine qmassa is now qmassarun. Added an -optional argument pdeld to be used to calculate hw1lat for dry -mixing-ratio constituents. - -M control/history.F90 -moved addfld and add_defualt for PDELDRY from here to physics/cam1/diagnostics.F90 - -M eul/dp_coupling.F90 -Added transfer of pdeld from p->d,d->p. Calculation of pdeld moved to -tfilt_massfix.F90 instead of call to set_state_pdry. - -M eul/inital.F90 -added initialization of dynamics variable pdeld - -M eul/prognostics.F -added dynamics variable pdeld, only allocated when dry constituents -are present - -M eul/restart_dynamics.F90 -added pdeld to restart files - -M eul/scan2.F90 -moved public hw1, hw2, hw3, alpha to new module massfix.F90 -pass pdeld to tfilt_massfixrun() - -M eul/scandyn.F90 -pass pdeld to qmassarun - -M eul/scanslt.F90 -pass pdeld to qmassarun - -M eul/stepon.F90 -pass pdeld to d_p_coupling - -M eul/tfilt_massfix.F90 -Calculate time filtered value of pdeldry; use this to time-filter dry -constituents conservatively. - -M sld/scanslt.F90 -change qmassa call to new name: qmassarun - -M sld/tfilt_massfix.F90 -save water vapor for use in next timestep; this was inadvertently -removed in cam3_0_28 and is necessary for dry mass conservation - -M physics/constituents.F90 -new public logical cnst_need_pdeldry. Default is flase, set to true if -any constituents are dry. - -M physics/convect_deep.F90 -only use pdeldry when needed - -M physics/diagnostics.F90 -addfld and outfld calls for PSDRY and PDELDRY only when needed - -M physics/icarus_scops.F90 -added r8 to reals - -M physics/physics_types.F90 -added state%pdeldry and related to methods only when needed -added optional argument pdeld_calc (default=true) to subroutine -set_state_pdry, setting false still calculates related fields but -doesn't change state%pdeldry itself. - -M physics/physpkg.F90 -diagnostic subroutine gavglook only calculates dry quantities when -needed - -M physics/tracers_suite.F90 -added missing r8 - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_30 -Originator: mvr ( Mathew Rothstein) -Date: Wed Feb 9 16:34:12 MST 2005 -Model: CAM -Version: CAM3.0.30 -One-line Summary: Cleanup of copyright info; minor bug fixes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -R LICENSE -- update to the copyright info and renaming of the file for - consistency with ccsm -A Copyright -- new file to replace LICENSE file that was removed -M models/atm/cam/src/control/cam.F90 -- slight mod to the info on where to find copyright notice -M models/atm/cam/src/control/history.F90 -- bug fix for the variable "vid" whose intent needed to be out rather than in -M models/atm/cam/src/physics/cam1/icarus_scops.F90 -- removed copyright info already contained in Copyright file -M models/atm/cam/test/system/create_ccsmcam -- replaced blackforest with bluesky as default machine -M models/atm/cam/test/system/ncar_batch.csh -- default load-leveller queue now for bluesky rather than blackforest -M models/atm/cam/tools/scam/testscript -- bug fix for how the TESTSCRIPTDIR was determined -M models/atm/cam/tools/scam/ui/Platform.Notes -- removed copyright info already contained in Copyright file -M models/atm/cam/tools/scam/ui/c.h -- removed copyright info already contained in Copyright file -M models/atm/cam/tools/scam/ui/ncarg/c.h -- removed copyright info already contained in Copyright file - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_29 -Originator: rosinski ( Jim Rosinski) -Date: Sun Feb 6 12:50:13 MST 2005 -Model: CAM -Version: CAM3.0.29 -One-line Summary: Reduced grid mods for CAM and interpaerosols boundary dataset generation code. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Modify eul/initcom.F90 to abort in SCAM mode if reduced grid enabled. -o Enable "mkrgrid" utility to work under lf95, ifort, and Cray X1. -o Enable "interpaerosols" utility for reduced grid, and Cray X1. -o Add new utility "mkrgridnew", which can replace "mkrgrid" when IC files - are xyz. The new utility is simpler, and unlike mkrgrid works on ISCCP - history files and on Cray X1. -o Check for reduced grid in optional boundary dataset reading routines - for which reduced grid capability is not yet enabled (e.g. dust module) - and abort in reduced grid mode. -o When CAM reads SST and aerosol data, ensure that boundary dataset grids - match cam grid. -o Delete threading directives from ccsm_msg.F90 per mvertens. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_28 -Originator: olson ( Jerry Olson) -Date: Thu Jan 27 11:11:47 MST 2005 -Model: CAM -Version: CAM3.0.28 -One-line Summary: Add new diagnostics to history file. Other misc mods. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: - -- Changes are round-off for EUL (except for aqua-planet which has a new climate - because of a change in the dry airmass constant) - Changes are BFB for SLD (except for aqua-planet which has a new climate) - Changes are BFB for FV (except for aqua-planet which has a new climate) - -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - - - Add fields to the master field list which complete the heat, moisture, cloud - liquid water, cloud liquid ice, and precip budgets - - (no new *default* fields are added to the History file) - - - Add an attribute ("sampling_seq") to those fields on a NetCDF History File - which are *not* based on an every-time-step sampling frequency. The - attribute would have a descriptive value indicating its sampling sequence. - Currently only one value is added: "rad_lwsw" (for fields that are only - sampled at LW/SW radiation time steps). No code is currently being added to - fill these fields with "missing" values. - - - Replace the "RAD_FIRST_HOUR" namelist variable with "IRAD_ALWAYS". - "RAD_FIRST_HOUR" was a logical that was too inflexible. "IRAD_ALWAYS" is an - integer that specifies length of time in timesteps (positive) or hours - (negative) that the SW/LW radiation will be run continuously from the start - of an initial run. - - - For aqua-planet runs, dry mass is hard-wired to 101325.-245. ( = 101080.) Pa - - - Bug fixes: - - - Fix a potential bug in the history module that would end up clobbering - the creation of the IC file if *all* the fields added to an auxiliary - history file through "add_default" calls are then excluded via FEXCL in - the namelist. - - - Fix bug that corrupts high resolution runs: promote "n" to I8 when - doing n**4 and n**3 math in hdinti, hordif1, and phcs. - - - Correct the logic in the aerosol data interpolator as reported by - Jim Boyle on the CGD forum - - - make "jstrt_p" private in SCAN2 and REALLOC7 loops - - - bugfix for adiabatic restarts - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_27 -Originator: mvr ( Mathew Rothstein) and mirin -Date: Thu Jan 20 16:16:39 MST 2005 -Model: CAM -Version: CAM3.0.27 -One-line Summary: Vectorization mods for finite volume; clarification of pgf90 optimization level -cam-bugs Requests resolved: none -Requires change in build system: yes -set pgf90 optimization explicitly to -O1; vectorization mods (see below) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey, Linux-pgi, cray x1 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mirin, eaton -Restart files change: no -Changes answers: b4b except for fv on cray x1, ibm, and linux-pgi, which are -round-off (pergro test passed on ibm) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M models/atm/cam/bld/Makefile -M models/atm/cam/src/control/cam.F90 -M models/atm/cam/src/control/spmdinit.F90 -M models/atm/cam/src/dynamics/fv/cd_core.F90 -M models/atm/cam/src/dynamics/fv/dp_coupling.F90 -M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 -M models/atm/cam/src/dynamics/fv/dynpkg.F90 -M models/atm/cam/src/dynamics/fv/fill_module.F90 -M models/atm/cam/src/dynamics/fv/fv_prints.F90 -M models/atm/cam/src/dynamics/fv/mapz_module.F90 -M models/atm/cam/src/dynamics/fv/pft_module.F90 -M models/atm/cam/src/dynamics/fv/spmd_dyn.F90 -M models/atm/cam/src/dynamics/fv/stepon.F90 -M models/atm/cam/src/dynamics/fv/sw_core.F90 -M models/atm/cam/src/dynamics/fv/te_map.F90 -M models/atm/cam/src/dynamics/fv/tp_core.F90 -M models/atm/cam/src/physics/cam1/check_energy.F90 -M models/atm/cam/src/physics/cam1/constituents.F90 -M models/csm_share/shr/shr_msg_mod.F90 -M models/utils/pilgrim/mod_comm.F90 - -please reference corresponding documentation in cam checkin list for details - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_26 -Originator: mvr ( Mathew Rothstein) and eaton -Date: Tue Jan 18 13:58:51 MST 2005 -Model: CAM -Version: CAM3.0.26 -One-line Summary: Collection of bug fixes and enhancements for Cray X1 -cam-bugs Requests resolved: none -Requires change in build system: yes -pgi fortran optimization set to O by default; Cray X1 mods; dependency cleanup -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes -removal of equivalences; bug fix for offline mode -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M cam1/models/atm/cam/bld/Makefile -- changed default optimization of pgi fortran compiler to O from O2 -- added Cray X1 mods and cleaned up some dependencies -M cam1/models/atm/cam/src/control/ccsm_msg.F90 -- added mods for Cray X1 -M cam1/models/atm/cam/src/control/history.F90 -- removed equivalences; removed addfld for unused var; added gregorian - calendar type to output; removed some unneeded date checking -M cam1/models/atm/cam/src/control/runtime_opts.F90 -- added code required with removal of equivalence in history.F90; - added phys_buffer mods -M cam1/models/atm/cam/src/dynamics/fv/dp_coupling.F90 -- removed beglev from declaration of var ps -M cam1/models/atm/cam/src/dynamics/fv/fv_prints.F90 -- fixed bug in write statements -M cam1/models/atm/cam/src/dynamics/fv/stepon.F90 -- add call to shr_sys_flush -M cam1/models/atm/cam/src/physics/cam1/phys_buffer.F90 -- added mods to physics buffer -M cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 -- fixed bug in date comparison -M cam1/models/atm/cam/tools/scam/configure -- fixed bug with input file location for scam (created with cam3_0_25) -M cam1/models/lnd/clm2/src/main/areaMod.F90 -- bug fix for offline mode -M cam1/models/lnd/clm2/src/main/histFileMod.F90 -- removal of equivalences - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_25 -Originator: jet ( John Truesdale) -Date: Mon Jan 10 16:43:43 MST 2005 -Model: CAM -Version: CAM3.0.25 -One-line Summary: Updated SCAM INSTALL text and added data directory to fix bug with scam configure script. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): no -Tested to work with SCAM (tools/scam/testscript): no -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: n/a -Tested multiple constituents: n/a -Tested that different domain decompositions match bit-for-bit: n/a -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? no this is a nontesting tag, only edited text files (INSTALL and REAME) no code -modified. - -Changes made: - -Added words to the INSTALL file for SCAM to let the user know to set the -CSMDATA environment variable. Also added a directory under scam (/data). -The scam configure script assumes this directory exists and links all -scam data files here. The previous release didn't have this directory. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_24 -Originator: pworley ( Patrick H Worley) -Date: Thu Jan 6 11:20:57 MST 2005 -Model: CAM -Version: CAM3.0.24 -One-line Summary: reduced grid support for spectral dycores and miscellaneous bug fixes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no for full grid, yes (improved) for reduced grid -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: fixed reduced grid support in one routine -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Fixed support for reduced grid (Jim Rosinski): - - control/readinitial.F90 - - physics/cam1/prescribed_aerosols.F90 - - dynamics/eul/initcom.F90 - - lnd/clm2/src/main/surfFileMod.F90 - -Additional reduced grid support modifications (for the X1 -only?). Zeroing out unused locations in the FFT buffers is required -on the X1. - - dynamics/eul/linemsdyn.F90 - - dynamics/eul/spegrd.F90 - - dynamics/sld/spegrd.F90 - - dynamics/sld/scanslt.F90 - -Added new runtime option, dyn_equi_by_col, to improve performance of -spectral dycores when using reduced grid. When set to .true., it -attempts to allocate the same number of columns to each process in the -dynamics rather than the same number of latitude lines. For a full -grid, these goals are identical. The option is on by default. However, -it is not necessarily the best choice when using a reduced grid on a -vector system. Setting it to .false. executes the old code, -equidistributing the number of latitude lines whether using a full or -a reduced grid. - 1) Moved decompinit out of cam, into readinitial.F90 and restart.F90, - so that reduced grid option could be identifed before computing - dynamics decomposition - - control/cam.F90 - - control/readinitial.F90 - - control/restart.F90 - 2) Added dyn_equi_by_col runtime option - - control/runtime_opts.F90 - - dynamics/eul/spmd_dyn.F90 - - dynamics/sld/spmd_dyn.F90 - - dynamics/fv/spmd_dyn.F90 - 3) Added dyn_equi_by_col domain decomposition - - dynamics/eul/spmd_dyn.F90 - - dynamics/sld/spmd_dyn.F90 - -The SLD dycore does not have all of the modifications made to EUL in -Jan.-March, 2004 to, for example, decrease memory requirements in the -spectral domain. The following files were modified as a step toward -implementing these changes. The motivation is that including these -changes allows the SLD version of spmd_dyn.F90 to be almost identical -to that used in EUL. - - dynamics/sld/comspe.F90 - - dynamics/sld/scanslt.F90 - -The current Co-Array Fortran logic in CAM requires that the two -communication buffers allocated in the spectral dycores be the same -size. This is currently true when the number of processors divides the -latitudes, but not otherwise. Since this may be important for other -one-sided messaging systems as well, the following files have been -modified to require that all processes allocate the same size -communcation buffers. Note that this has no performance impact in -normal CAM usage (and probably never has an impact). - - control/mpishorthand.F - - control/spmdinit.F90 - - control/wrap_mpi.F90 - - dynamics/eul/spmd_dyn.F90 - - dynamics/sld/spmd_dyn.F90 - -Reinsert compiler directive fixing Cray X1 bug that was lost in -a previous check-in - - control/history.F90 - -The routine sort_chunks is called in create_chunks and -orders the columns assigned to a chunk. -It was added to phys_grid.F90 back when we were looking for -alternatives to the buffer copies introduced into radcswmx.F90 for -vectorization. A bug in this code was recently identified. Rather than -fix it, we have decided that sort_chunks does nothing useful even when -working correctly. Thus the routine sort_chunks has been removed. - - - physics/cam1/phys_grid.F90 - -Miscellaneous bug fixes: - - 1) A typo in the existing "equidistribute by latitudes" - decomposition logic was fixed. Fortunately, this bug - was never seen in practice. - - - dynamics/eul/spmd_dyn.F90 - - dynamics/sld/spmd_dyn.F90 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_23 -Originator: fvitt ( Francis Vitt) -Date: Tue Dec 21 10:13:50 MST 2004 -Model: CAM -Version: CAM3.0.23 -One-line Summary: Add ability to use offline data to drive finite volume dynamics core. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: yse -Requires OFFLINE_DYN C preprocessor flag to be set. -Substantial timing or memory changes: no -Requires change in run script: yes -Namelist varibles are added. See below. -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton -Restart files change: yes -Offline data file names added to restart file. -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -Added files: - models/atm/cam/src/dynamics/fv/metdata.F90 - models/atm/cam/src/dynamics/fv/pfixer.F90 - -Modified files: - models/atm/cam/src/dynamics/fv/cd_core.F90 - models/atm/cam/src/dynamics/fv/dp_coupling.F90 - models/atm/cam/src/dynamics/fv/dryairm.F90 - models/atm/cam/src/dynamics/fv/dynpkg.F90 - models/atm/cam/src/dynamics/fv/inidat.F90 - models/atm/cam/src/dynamics/fv/restart_dynamics.F90 - models/atm/cam/src/dynamics/fv/stepon.F90 - models/atm/cam/src/dynamics/fv/sw_core.F90 - models/atm/cam/src/dynamics/fv/uv3s_update.F90 - models/atm/cam/src/physics/cam1/inti.F90 - models/atm/cam/src/physics/cam1/physpkg.F90 - models/atm/cam/src/control/runtime_opts.F90 - models/atm/cam/src/control/string_utils.F90 - -Modifications are effective only if CAM is configured to use -offline meteorology data. To configure to use offline data -set OFFLINE_DYN C preprocessor flag. - -Namelist variables added: - - met_data_file The filepath of the netCDF file - containing the meteorology data - - met_cell_wall_winds Set to true if the meteorology winds are - defined on model cell walls. - Default is false. - - met_remove_file Set to true to have the offline data file be - removed from the local file system. - Default is false. - -The offline meteorology data can be read from a sequence of files -provided the files are named stringNNN.nc, where NNN is an integer -of any number of digits. If the data is contained in a series of -files, the files need to be named sequentially, e.g., metdata001.nc, -metdata002.nc, metdata003.nc, etc. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_22 -Originator: jeff ( Yen-Huei Lee) -Date: Fri Dec 10 10:20:33 MST 2004 -Model: CAM -Version: CAM3.0.22 -One-line Summary: add WACCM physics and chemistry -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Brian Eaton -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -Add two new direstories for WACCM: - models/atm/cam/src/physics/waccm/ - models/atm/cam/src/chemistry/waccm_mozart/ - -Change the following files: - A models/atm/cam/bld/config_cam_eul_defaults.xml - A models/atm/cam/bld/config_cam_fv_defaults.xml - A models/atm/cam/bld/config_cam_sld_defaults.xml - A models/atm/cam/bld/config_waccm_ghg_defaults.xml - A models/atm/cam/bld/config_waccm_mozart_defaults.xml - D models/atm/cam/bld/config_cache_defaults.xml - M models/atm/cam/bld/CAM_config.pmonfig.pm - M models/atm/cam/bld/DefaultCAMEXPNamelist.xml - M models/atm/cam/bld/DefaultCLMEXPNamelist.xml - M models/atm/cam/bld/camexp.pm - M models/atm/cam/bld/clm2exp.pm - M models/atm/cam/bld/configure - M models/atm/cam/bld/resolution_parameters.xml - M models/atm/cam/src/dynamics/eul/dp_coupling.F90 - M models/atm/cam/src/dynamics/eul/inital.F90 - M models/atm/cam/src/dynamics/eul/stepon.F90 - M models/atm/cam/src/dynamics/sld/dp_coupling.F90 - M models/atm/cam/src/dynamics/sld/inital.F90 - M models/atm/cam/src/dynamics/fv/dp_coupling.F90 - M models/atm/cam/src/dynamics/fv/dycore.F90 - M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 - M models/atm/cam/src/dynamics/fv/inital.F90 - D models/atm/cam/src/physics/cam1/ghg_surfvals.F90 - A models/atm/cam/src/physica/cam1/chem_surfvals.F90 - M models/atm/cam/src/physics/cam1/advnce.F90 - M models/atm/cam/src/physics/cam1/aerosol_intr.F90 - M models/atm/cam/src/physics/cam1/check_energy.F90 - M models/atm/cam/src/physics/cam1/chemistry.F90 - M models/atm/cam/src/physics/cam1/cloud_fraction.F90 - M models/atm/cam/src/physics/cam1/constituents.F90 - M models/atm/cam/src/physics/cam1/convect_deep.F90 - M models/atm/cam/src/physics/cam1/convect_shallow.F90 - M models/atm/cam/src/physics/cam1/diagnostics.F90 - M models/atm/cam/src/physics/cam1/diffusion_solver.F90 - M models/atm/cam/src/physics/cam1/ghg_defaults.F90 - M models/atm/cam/src/physics/cam1/gw_drag.F90 - M models/atm/cam/src/physics/cam1/initindx.F90 - M models/atm/cam/src/physics/cam1/inti.F90 - M models/atm/cam/src/physics/cam1/molec_diff.F90 - M models/atm/cam/src/physics/cam1/physics_types.F90 - M models/atm/cam/src/physics/cam1/physpkg.F90 - M models/atm/cam/src/physics/cam1/qneg3.F90 - M models/atm/cam/src/physics/cam1/rad_constituents.F90 - M models/atm/cam/src/physics/cam1/radae.F90 - M models/atm/cam/src/physics/cam1/radheat.F90 - M models/atm/cam/src/physics/cam1/radiation.F90 - M models/atm/cam/src/physics/cam1/radlw.F90 - M models/atm/cam/src/physics/cam1/radsw.F90 - M models/atm/cam/src/physics/cam1/stratiform.F90 - M models/atm/cam/src/physics/cam1/sulfur_intr.F90 - M models/atm/cam/src/physics/cam1/tphysac.F90 - M models/atm/cam/src/physics/cam1/tphysbc.F90 - M models/atm/cam/src/physics/cam1/tracers.F90 - M models/atm/cam/src/physics/cam1/upper_bc.F90 - M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - M models/atm/cam/src/control/history.F90 - M models/atm/cam/src/control/restart.F90 - M models/atm/cam/src/control/runtime_opts.F90 - M models/atm/cam/src/control/time_manager.F90 - M models/atm/cam/tools/scam/scm_init/scam_inital.F90 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_21 -Originator: pworley ( Patrick H Worley) -Date: Mon Nov 1 07:40:57 MST 2004 -Model: CAM -Version: CAM3.0.21 -One-line Summary: Communication optimizations (MPI1, MPI2, Co-Array Fortran) for spectral dycores and dp_coupling; physics chunking bug fix. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes, improves performance on Earth Simulator when using MPI-2 one-sided option; may improve performance on Cray X1 -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): no -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -1) Fixed bug in assign_chunks identified by Steve Ghan and Tim Shippert. This - bug did not affect execution in the standard modes of operation. - -2) Fixed UNICOS/MP Makefile option for cam3_0_20 changes. - -3) Communication optimizations: - - - eliminated overlap implementations of realloc and dp_coupling - communications. All that was being overlapped was buffer copies, - which did not appear to be useful on the current target platforms. - - - added "alternative" implementations of alltoall and allgather - (used in realloc routines and dp_coupling), using - 1) one of a large number of MPI-2 point-to-point commands, - controlled by swap_comm_order, swap_comm_protocol, and - swap_comm_maxreq. The first two parameters have the same - meaning as before. swap_comm_maxreq controls the maximum number - of outstanding send/receive requests allowed in the - implementation of alltoall/allgather. This can be used to tune - performance or work around bugs on systems that do - not tolerate large numbers of outstanding requests well. - 2) MPI-2 put commands - 3) Co-Array Fortran remote writes - - #2 is important for performance on the Earth Simulator. The others - represent defensive programming, for situations in which the MPI - collectives are not implemented efficiently. #2 also seems to be - fastest on the Cray X1, but I haven't not done a careful study yet. - - - To support the MPI-2 implementation, replaced original - communication buffer logic - * call spmdbuf in spmdinit_dyn to allocate communication buffers; - call spmdbuf_resize in d_p_coupling or in p-d_coupling to - reallocate communication buffers is they are not large enough - with - * call spmdbuf in inital or in restart, after phys_grid_init, to - allocate communication buffers of the appropriate size the - first time, then use MPI_WINCREATE to enable remote - read/write from/to these buffers. - - - For the SLD dycore, added minor modifications originally - introduced into the EUL dycore to improve vectorization. This - makes realloc5, realloc5, and realloc7 almost identical between - the EUL and SLD dycores again, and should improve vectorization - for the SLD dycore. - - The new runtime options for dyn_alltoall, dyn_allgather, and - phys_alltoall are: - - 0: use collectives - 1: use MPI-2 point-to-point, as specified by swap_comm_order, - swap_comm_protocol, swap_comm_maxreq. (swap_comm_maxreq default - is -1, meaning no limit; >0 sets the upper bound) - 2: if compiled with -DMPI2, then use MPI-2 put implementation, else - use an MPI_SENDRECV implementation - 3: if compiled with -DCAF, then use Co-Array remote write - implementation, else use an MPI_SENDRECV implementation - - Files modified are as follows: - -control/restart.F90 - added call to spmdbuf -control/runtime_opts.F90 - added swap_comm_maxreq parameter -control/swap_comm.F90 - added swapm, swap_comm_maxreq; - removed swap1, swap2, swap3, swap1m, swap3m, do_swap1, do_swap3, - delayed_swap_recv -control/wrap_mpi.F90 - added mpialltoallint, altalltoallv, mpiwincreate -eul/dp_coupling.F90, sld/dp_coupling.F90 - added MPI2 window parameter to transpose call; - replaced spmdbuf_resize call with an spmdbuf_size test -eul/inital.F90, sld/inital.F90 - added smpdbuf call -eul/realloc4.F90, sld/realloc4.F90 - added altalltoall, removed swap routine calls -eul/realloc7.F90, sld/realloc7.F90, eul/scan2.F90, sld/scan2.F90 - added altalltoall, removed swap routine calls -eul/spmd_dyn.F90, sld/spmd_dyn.F90 - removed spmdbuf_resize and modified spmdbuf; - moved local_dp_map, block_buf_nrecs, and chunk_buf_nrecs from phys_grid; - added support for MPI2 and CAF. -fv/dp_coupling.F90 - side effect of moving local_dp_map, block_buf_nrecs, and - chunk_buf_nrecs from phys_grid to spmd_dyn -fv/spmd_dyn.F90 - moved local_dp_map, block_buf_nrecs, and chunk_buf_nrecs from phys_grid -sld/comspe.F90, scanslt.F90, spegrd.F90, trunc.F90 - vectorization modifications ported from EUL -physics/cam1/phys_grid.F90 - added altalltoall, removed swap routine calls - fixed assign_chunk bug. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_20 -Originator: jmccaa ( James McCaa) -Date: Mon Oct 18 11:58:59 MDT 2004 -Model: CAM -Version: CAM3.0.20 -One-line Summary: Refactored vertical diffusion module. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and Brian Eaton -Restart files change: no -Changes answers: Yes (same-to-roundoff) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Refactored the vertical diffusion module: - - new interface names - - new molecular diffusion module - - new turbulent mountain stress module - - new eddy diffusion module - - new diffusion solver module - - removed turbulence module - -Cleaned up unused variables from interfaces to convect_deep, -convect_shallow, cloud_fraction, stratiform modules. - -Added a T42 30-level ic file to the CAM defaults file. - -Added a function form of vqsatd to the wv_saturation module. - -Assorted small fixed to scam, plus modified the scam -configure and test scripts to allow running from a working -directory outside the distribution. - -Files added/deleted/modified: -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml -M models/atm/cam/doc/ChangeLog -M models/atm/cam/src/physics/cam1/advnce.F90 -M models/atm/cam/src/physics/cam1/cloud_fraction.F90 -M models/atm/cam/src/physics/cam1/convect_deep.F90 -M models/atm/cam/src/physics/cam1/convect_shallow.F90 -A models/atm/cam/src/physics/cam1/diffusion_solver.F90 -A models/atm/cam/src/physics/cam1/hb_diff.F90 -M models/atm/cam/src/physics/cam1/initindx.F90 -M models/atm/cam/src/physics/cam1/inti.F90 -A models/atm/cam/src/physics/cam1/molec_diff.F90 -M models/atm/cam/src/physics/cam1/physconst.F90 -M models/atm/cam/src/physics/cam1/stratiform.F90 -M models/atm/cam/src/physics/cam1/tphysac.F90 -M models/atm/cam/src/physics/cam1/tphysbc.F90 -M models/atm/cam/src/physics/cam1/tphysidl.F90 -A models/atm/cam/src/physics/cam1/trb_mtn_stress.F90 -R models/atm/cam/src/physics/cam1/turbulence.F90 -M models/atm/cam/src/physics/cam1/upper_bc.F90 -M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 -M models/atm/cam/src/physics/cam1/wv_saturation.F90 -M models/atm/cam/tools/scam/GNUmakefile -M models/atm/cam/tools/scam/configure -M models/atm/cam/tools/scam/testscript -M models/atm/cam/tools/scam/obj/Makefile -M models/atm/cam/tools/scam/scm_init/c_outfld.c -M models/atm/cam/tools/scam/scm_init/init_model.F90 -M models/atm/cam/tools/scam/scm_init/scam.c -M models/atm/cam/tools/scam/ui/GNUmakefile -M models/atm/cam/tools/scam/ui/configure -M models/atm/cam/tools/scam/ui/ncfile.h - -=============================================================== -=============================================================== - -cam3_0_19 -Originator: erik ( Erik Kluzek) -Date: Thu Sep 23 11:49:07 MDT 2004 -Model: CAM -Version: CAM3.0.19 -One-line Summary: Isolate extended grid information to just spectral dycores and just inside of SLT advection inside SLD and Eul dycores. -cam-bugs Requests resolved: 147 -(See http://wreq.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: see below -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, olson, mvr -Restart files change: yes (Eul and SLD) -Changes answers: bit-for-bit with Eul and FV dycores - same to roundoff for SLD dycore (on IBM and Linux/Lahey, - answers identical if you run with -debug compiler options) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Move cam3_0_18_brnchT_nohalo9 to cam_dev. - - Isolate extended grid information to SLT advection to only - within Spectral dy-cores. - -Use plon(regular grid) instead of plond(extended grid) except for -SLT variables, inside of relevent dynamics. - -Eulerian: - - scanslt becomes a module with alloc, initial, run and final phases. - - Remove comslt and move data to inside of scanslt or scan2. - - scanslt has a advection_state data-type to keep track of all extended - grid information. All data on the extended grid are kept inside of this - state. Dynamics data iscopied into and then out of this state for advection. - - New dimension for FFT -- plondfft. - - spetru has new temporary variables inside of it so it can be dimensioned - the right size for FFT (plondfft). - - linemsdyn becomes a module and scan2 becomes a module - - Make grdini, grdxy, sltb1, and sltini module subroutines of scanslt. - -SLD: - scanslt becomes a module with: alloc, initial, run_setup, run, and - final phases. Extended grid parameters moved from pmgrid and rgrid to - inside of this module. Much of the data becomes private inside of - scanslt module. Create advection_state data type to keep track of all - extended grid data, copy data into this structure and then out of - for the rest of the dynamics - - comslt removed and data moved to inside of scanslt. grmult becomes a module. - Use inf instead of nan for initialization. - - Spmd_dyn data only used for bndexch moved as private data inside of scanslt. - - Make bndexch, grdini, grdxy, sltlinint, slttraj, sltwgts, and trajdp - module subroutines of scanslt. - -test-model.pl - - Fix problem where couldn't change resolution on comand line - with -skip option (cam-bug 147). - - Add -cppdefs option - - Restart tests done at default compiler option rather than explicitly - set to production compiler settings. This allows the use of the "-debug" - option to override the default setting for testing where this is - useful. - -SCAM: - Improve readability of testscript, send output to log files - and have the script clean up after itself better. Use plon instead - of plond. - -Performance changes: (Following tests were done with earlier versions - on no-halo branch based off of cam3_0_9 for eul and - cam3_0_15 for sld test) - Eul@T42 on IBM same - Eul@T85 on IBM with 11 constituents 3% slower - Sld@T42 on IBM 2% faster - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_18 -Originator: mvr ( Mathew Rothstein), eaton, mirin -Date: Fri Sep 17 11:01:58 MDT 2004 -Model: CAM -Version: CAM3.0.18 -One-line Summary: A collection of bug fixes and portability enhancements -cam-bugs Requests resolved: none -Requires change in build system: yes -Makefile changed for pgi compile defaults -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes -mss system calls now go through csm_share code -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M models/atm/cam/bld/Makefile -- mods to pgi compiler defaults: -O2 optimization (non-debug), -Mrecursive - only in debug mode -- mod to ifort name for intel builds -M models/atm/cam/src/control/abortutils.F90 -- fix for ibm jobs hanging in xl__trbk routine -M models/atm/cam/src/control/ccsm_msg.F90 -- fix for ccsm with FV 2D composition -M models/atm/cam/src/control/ioFileMod.F90 -- now calls csm_share code for mss system calls -M models/atm/cam/src/control/runtime_opts.F90 -- fix to properly communicate the input vars kmxhdc, dif2, dif4 -R models/atm/cam/src/control/system_cmd.c -- no longer needed - now using csm_share code -M models/atm/cam/src/physics/cam1/cldwat.F90 -- fix for non-default vertical resolution extending top of model above 1mb -M models/atm/cam/src/physics/cam1/phys_grid.F90 -- corrected routine argument from intent out to intent in -M models/atm/cam/test/system/CAM_test.pm -- bug fix for "-skip" options in test-model -M models/ice/csim4/ice_data.F90 -- fixed out of bounds array reference -M models/lnd/clm2/src/main/fileutils.F90 -- now call csm_share code for mss system calls -R models/lnd/clm2/src/main/system_cmd.c -- no longer needed - now using csm_share code - -M models/utils/esmf/README -M models/utils/esmf/build/common -A models/utils/esmf/build/Darwin_absoft/ESMF_conf.h -A models/utils/esmf/build/Darwin_absoft/base -A models/utils/esmf/build/Darwin_absoft/base.site -A models/utils/esmf/build/Darwin_absoft/base_variables -A models/utils/esmf/build/Darwin_absoft/fix.h -A models/utils/esmf/build/Darwin_xlf/ESMF_conf.h -A models/utils/esmf/build/Darwin_xlf/base -A models/utils/esmf/build/Darwin_xlf/base.site -A models/utils/esmf/build/Darwin_xlf/base_variables -M models/utils/esmf/src/Infrastructure/Error/ESMC_Error.c -M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Alarm.c -M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Calendar.c -M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Date.c -M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_TOD.c -M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Time.c -- upgrade to esmf_0_0_8 - -M models/utils/timing/t_pclstr.c -M models/utils/timing/t_stop.c - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_17 -Originator: jeff ( Yen-Huei Lee) -Date: Mon Sep 13 14:41:57 MDT 2004 -Model: CAM -Version: CAM3.0.17 -One-line Summary: bug fix -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - - Add one file - - A models/atm/cam/src/physics/cam1/upper_bc.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_16 -Originator: jeff ( Yen-Huei Lee) -Date: Mon Sep 13 13:22:44 MDT 2004 -Model: CAM -Version: CAM3.0.16 -One-line Summary: modified vertical diffusion -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Tested to work with SCAM (tools/scam/testscript): yes -Machines tested: IBM, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - - Modified the following files: - M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - M models/atm/cam/src/physics/cam1/tphysac.F90 - M models/atm/cam/src/physics/cam1/rad_constituents.F90 - M models/atm/cam/src/physics/cam1/ghg_defaults.F90 - M models/atm/cam/src/physics/cam1/constitueadvnce.F90 - M models/atm/cam/src/physics/cam1/advnce.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_15 -Originator: eaton ( Brian Eaton) -Date: Thu Sep 2 08:14:58 MDT 2004 -Model: CAM -Version: CAM3.0.15 -One-line Summary: new radiation/constituents interface -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, boville, conley -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Create an new radiation/constituent interface. This functionality (for gas -phase constituents) previously resided in the chemistry module. It has -been reimplemented in it's own module (rad_constituents.F90) to facilitate -swapping in new chemistry code without having to duplicate the control -logic in another chemistry module. Also, the new module can be extended to -coordinate control of the aerosol constituents. - -Modified the constituents module: -1) Add an optional argument to cnst_add to allow specifying that the - default outfld calls for that constituent should not be made. This - allows, for example, the chemistry module to output volume mixing - ratios rather than the default mass mixing ratios. -2) Add an optional argument to cnst_get_ind to allow it to return an error - status rather than just aborting if the requested name is not found in - the constituent array. - -Add a bugfix to cldwat.F90. Some variables needed initializers. Only -caused a problem if the top of the model was above 1mb. - -Create a new module (ghg_defaults.F90) for the default ghg distributions -computed by trcmix. - -Added lat and lon (radians) to the physics_state data type. - -Add a method to the ozone_data module to return a pointer to the -interpolated data. - -Returned the chemistry module to its previous functionality of just -providing prognostic ghg distributions using a simple production/loss -chemistry. - - -=============================================================== -=============================================================== - -cam3_0_14 -Originator: jmccaa ( James Mccaa) -Date: Wed Aug 25 19:58:09 MDT 2004 -Model: CAM -Version: CAM3.0.14 -One-line Summary: Introduction of definehires utility and use of 30 second topographic variance (SGH30) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -This checkin introduces a new utility, definehires, that can be used to process -USGS 30 second topographic data and produce a 10-minute dataset suitable for -use with definesurf. -It is located in the directory: -cam1/models/atm/cam/tools/definehires/README - -The following files were modified to accomodate a new input dataset - field (SGH30) that represents the variance of the 30-second - height data on the 10-minute grid. This supplements the field - SGH, which represents the variance of the 10-minute mean heights - on the model grid. Both definesurf and CAM can still use the - old datasets with no change in answers from the current code. - In the case of CAM, if SGH30 is not present, the model will use - SGH in its place (as it currently does), but SGH30 will be used - if found. ->> cam1/models/atm/cam/src/dynamics/eul/inidat.F90 ->> cam1/models/atm/cam/src/dynamics/sld/inidat.F90 ->> cam1/models/atm/cam/src/dynamics/fv/inidat.F90 ->> cam1/models/atm/cam/src/physics/cam1/comsrf.F90 ->> cam1/models/atm/cam/src/physics/cam1/diagnostics.F90 ->> cam1/models/atm/cam/src/physics/cam1/physpkg.F90 ->> cam1/models/atm/cam/src/physics/cam1/restart_physics.F90 ->> cam1/models/atm/cam/src/physics/cam1/tphysac.F90 ->> cam1/models/atm/cam/src/control/history.F90 ->> cam1/models/atm/cam/tools/definesurf/Makefile ->> cam1/models/atm/cam/tools/definesurf/fmain.f90 ->> cam1/models/atm/cam/tools/definesurf/sghphis.f90 - - -=============================================================== -=============================================================== - -cam3_0_13 -Originator: eaton ( Brian Eaton) -Date: Tue Aug 24 15:28:21 MDT 2004 -Model: CAM -Version: CAM3.0.13 -One-line Summary: add single interface for radiation to access trace gases -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes, same-to-roundoff -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -The non-water gas phase constituents that are required by the radiation -codes are O3, CO2, CH4, N2O, CFC11, CFC12. All these constituents, except -CO2, are now accessed only via the chemistry module. A single method, -chem_get_cnst, returns constituent values regardless of whether they are -prognostic variables from the constituent array, or are diagnosed or -interpolated from a dataset. So all the logic for determining where a -constituent comes from now lives in the top level chemistry interface and -not in the top level radiation interface. - -CO2 is a special case because it is assumed by the radiation algorithms to -be a single global value. For now it is still accessed directly from the -ghg_surfvals module. We expect this to change in the future. - -These changes are roundoff due to the decision that chem_get_cnst should -return values as mass mixing ratio. Previously O3 values were accessed -from the interpolation routine as volume mixing ratio and converted to -mass mixing ratio as needed. The change in where this conversion happens -introduced a roundoff level difference. - - -=============================================================== -=============================================================== - -cam3_0_12 -Originator: jmccaa ( James McCaa) -Date: Thu Aug 19 09:06:13 MDT 2004 -Model: CAM -Version: CAM3.0.12 -One-line Summary: Addition of a column radiation model and various fixes to SCAM. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -This checkin adds a column radiation model to the SCAM, and also -contains a variety of general fixes/enhancements to SCAM, mostly -centered around allowing it to work with nonstandard numbers of model -levels. Details follow... - - -Addition of the column radiation model: ---------------------------------------- - -The CRM can operate on old-style text CRM input files, or on a model -state initialized via any of scam's existing methods. - -The CRM has both non-gui and gui modes. The gui version is accessed -via a new page under scam's "Options" tab. The non-gui version is -accessed via a shell script named crm. - -I modified testscript to test the crm. -The following output from the test script indicates a pass (both lines -must be present): - -scam passed its bfb test. -CRM passed. - - -General scam modifications: ---------------------------- - -Scam now honors the use_srfprop flag. - -To facilitate running at nonstandard numbers of levels: - scam now guesses the appropriate level-dependent pressure file to use. - ncdio_atm.F90 has been modified to interpolate/extrapolate data to - the scam levels if necessary. - -Handling of defaults files and quickstart files is slightly more robust. - -Scam now plots interface level fields correctly. - -Buffer sizes have been increased to allow scam to use up to 300 levels. - -The gui's configure script has been modified to remove an unnecessary -dependency on libg2c when not using ncar graphics - -I fixed an unitialized value problem in readiopdata.F90. - -I modified init_model.F90 to handle C-to-fortran string passing -according to the unix standard. - -I modified the scam testscript to retry (up to 10 times) on -compilation failures to try to overcome our persisent license server -problems. - -I added a sanity check on precab(i) to cldwat.F90. - -Updated init_model.F90 to reference ozone_data.F90 instead of comozp.F90. - -Lastly, I removed 7 Mb of apparently unneeded ncar graphics files from -the repository. - -=============================================================== -=============================================================== - -cam3_0_11 -Originator: eaton ( Brian Eaton) -Date: Fri Aug 13 12:06:12 MDT 2004 -Model: CAM -Version: CAM3.0.11 -One-line Summary: add fv 1.9x2.5 resolution; sst dataset generation tools -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Add 1.9x2.5 (96 lats, 144 lons) resolution for finite volume. Configure -using: - configure -dyn fv -res 1.9x2.5 - -Add sst dataset generation tools from Jim Rosinski. - - -=============================================================== -=============================================================== - -cam3_0_10 -Originator: eaton ( Brian Eaton) -Date: Mon Aug 9 12:11:12 MDT 2004 -Model: CAM -Version: CAM3.0.10 -One-line Summary: add new modules for radiation and ozone data -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -. Created modules for ozone datasets (ozone_data.F90), longwave radiation - (radlw.F90), and shortwave radiation (radsw.F90). - - The old radini which initialized the old common block crdcon contained a - couple of constants which differed from the share constants. In order to - have a bit-for-bit commit the old values have been maintained. - -. Add pointer variables inside radiation_tend to provide flexible method of - passing either prescribed or prognostic constituents to the radiation - calcs. - -. Removed the common block ptrrgrid.h which was not being used. - -. Added some FV 10x15 datasets to the Default*Namelist.xml files. - -. Added back 13 files that were lost during the cam3_0_9 commit. - -=============================================================== -=============================================================== - -cam3_0_9 -Originator: rosinski ( Jim Rosinski) -Date: Sun Jul 25 14:14:34 MDT 2004 -Model: CAM -Version: CAM3.0.9 -One-line Summary: Enable CAM to build and run using Intel compiler suite -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): no -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, CLM changes by Vertenstein -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -CVS says: - -M atm/cam/bld/Makefile -M lnd/clm2/src/biogeophys/Hydrology2Mod.F90 -M lnd/clm2/src/main/decompMod.F90 -M lnd/clm2/src/main/histFileMod.F90 -A utils/esmf/build/linux_altix/ESMF_conf.h -A utils/esmf/build/linux_altix/base -A utils/esmf/build/linux_altix/base.site -A utils/esmf/build/linux_altix/base_variables -A utils/esmf/build/linux_altix/fix.h -A utils/esmf/build/linux_intel/ESMF_conf.h -A utils/esmf/build/linux_intel/base -A utils/esmf/build/linux_intel/base.site -A utils/esmf/build/linux_intel/base_variables -A utils/esmf/build/linux_intel/fix.h -M utils/timing/t_pr.c - -Minor mods (listed above) to CAM Makefile, timing print routine, CLM -routines, and ESMF to enable CAM to build and run on Linux machines using -Intel compiler suite. 2-day error growth test using ifort and icc passed at -T42 in EUL configuration. - -ESMF upgraded to ESMF_0_0_6 per Erik Kluzek. No code changes, but support -added for linux_intel and linux_altix. Note that linux_intel assumes that -Fortran and C compilers are both Intel (ifort and icc respectively). Though -CAM can be configured (and will run) with gcc, there is little point in doing -this as of this commit since ESMF will still require icc. - -Minor mods to CLM routines to allow compilation with ifort. - -Addition of an "fclose" to timing print routine t_pr.c to force a buffer -flush. Without it icc was truncating its printed output of model timers. - - -IMPORTANT: the only configurations of Intel compiler suite and underlying -glibc library that proved successful were: - -ifort >= 8.0.046 -icc >= 8.0.055 -glibc >= 2.3.x - -Tests in which not all these conditions were met resulted in various -failures, including general compiler errors, internal compiler errors, and -segmentation faults. - -Notes: - -o In general the Intel compilers create code that runs fast. Compile times -for optimized code (-O2) can be fairly long. - -o The debugger (idb) is line-based. Hopefully it can be used in conjunction -with ddd to give a window-based option. - -o Hybrid OpenMP/MPI configuration with Intel compilers was tested and does -work. Little timing difference compared with pure-MPI was observed. -Depending on model conifiguration, manipulation of environment variable -KMP_STACKSIZE may be required to avoid seg faults when threading is enabled. - -o Tests enabling floating point traps (-fpe0) did not work in SPMD mode, so -this option was not included in Makefile mods. Hopefully the code changes -required to enable this option will be minor. - - -=============================================================== -=============================================================== - -cam3_0_8 -Originator: jeff ( Yen-Huei Lee) -Date: Wed Jul 21 11:53:53 MDT 2004 -Model: CAM -Version: CAM3.0.8 -One-line Summary: ntoplw changes to radiation arrays -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe)no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate)no -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - - M models/atm/cam/src/physics/cam1/crdcon.h - M models/atm/cam/src/physics/cam1/radae.F90 - M models/atm/cam/src/physics/cam1/radclwmx.F90 - M models/atm/cam/src/physics/cam1/radini.F90 - M models/atm/cam/src/physics/cam1/restart_physics.F90 - M models/atm/cam/src/physics/cam1/trcplk.F90 - M models/atm/cam/src/physics/cam1/trcpth.F90 - -See: http://www.cgd.ucar.edu/cgi-binradae.F90/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_7 -Originator: mvr ( Mathew Rothstein), eaton, bundy -Date: Tue Jul 20 10:03:47 MDT 2004 -Model: CAM -Version: CAM3.0.7 -One-line Summary: Added new physics interface (deep & shallow convection, stratiform, radiation) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: to be determined -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton, bundy -Restart files change: no -Changes answers: Yes (same-to-roundoff) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -R models/atm/cam/src/physics/cam1/cldcond.F90 -R models/atm/cam/src/physics/cam1/cldnrh.F90 -R models/atm/cam/src/physics/cam1/convtran.F90 -R models/atm/cam/src/physics/cam1/moistconvection.F90 -R models/atm/cam/src/physics/cam1/radctl.F90 -A models/atm/cam/src/physics/cam1/convect_deep.F90 -A models/atm/cam/src/physics/cam1/convect_shallow.F90 -A models/atm/cam/src/physics/cam1/hk_conv.F90 -A models/atm/cam/src/physics/cam1/radiation.F90 -A models/atm/cam/src/physics/cam1/stratiform.F90 -M models/atm/cam/src/control/history.F90 -M models/atm/cam/src/dynamics/eul/inidat.F90 -M models/atm/cam/src/dynamics/fv/inidat.F90 -M models/atm/cam/src/dynamics/sld/inidat.F90 -M models/atm/cam/src/physics/cam1/aerosol_intr.F90 -M models/atm/cam/src/physics/cam1/buffer.F90 -M models/atm/cam/src/physics/cam1/carbon_intr.F90 -M models/atm/cam/src/physics/cam1/diagnostics.F90 -M models/atm/cam/src/physics/cam1/dust_intr.F90 -M models/atm/cam/src/physics/cam1/initindx.F90 -M models/atm/cam/src/physics/cam1/inti.F90 -M models/atm/cam/src/physics/cam1/param_cldoptics.F90 -M models/atm/cam/src/physics/cam1/phys_adiabatic.F90 -M models/atm/cam/src/physics/cam1/phys_idealized.F90 -M models/atm/cam/src/physics/cam1/physics_types.F90 -M models/atm/cam/src/physics/cam1/physpkg.F90 -M models/atm/cam/src/physics/cam1/restart_physics.F90 -M models/atm/cam/src/physics/cam1/srfxfer.F90 -M models/atm/cam/src/physics/cam1/sulfur_intr.F90 -M models/atm/cam/src/physics/cam1/tphysbc.F90 -M models/atm/cam/src/physics/cam1/zm_conv.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_6 -Originator: mvr ( Mathew Rothstein) -Date: Fri Jul 16 16:54:46 MDT 2004 -Model: CAM -Version: CAM3.0.6 -One-line Summary: Added SOM tools; Modified CLM log output to version 3.0; Bug fix for system command strings -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes...updated log output to version 3.0 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - ----added files needed to create SOM tools -A models/atm/cam/tools/definemld/Makefile -A models/atm/cam/tools/definemld/README -A models/atm/cam/tools/definemld/binf2c.f90 -A models/atm/cam/tools/definemld/definemld1x1.c -A models/atm/cam/tools/definemld/definemld1x1.h -A models/atm/cam/tools/definemld/definemldbdy.f90 -A models/atm/cam/tools/definemld/err_exit.c -A models/atm/cam/tools/definemld/neighborfill.f90 -A models/atm/cam/tools/definemld/precision.f90 -A models/atm/cam/tools/definemld/sm121.f90 -A models/atm/cam/tools/definemld/wrap_nc.c -A models/atm/cam/tools/definemld/wrap_nf.f90 -A models/atm/cam/tools/defineqflux/Makefile -A models/atm/cam/tools/defineqflux/README -A models/atm/cam/tools/defineqflux/backsolve.c -A models/atm/cam/tools/defineqflux/check_consistent.c -A models/atm/cam/tools/defineqflux/defineqflux.c -A models/atm/cam/tools/defineqflux/defineqflux.h -A models/atm/cam/tools/defineqflux/definesomic.h -A models/atm/cam/tools/defineqflux/err_exit.c -A models/atm/cam/tools/defineqflux/gepp.c -A models/atm/cam/tools/defineqflux/mksith.c -A models/atm/cam/tools/defineqflux/printeq.c -A models/atm/cam/tools/defineqflux/timediddle_mavg.c -A models/atm/cam/tools/defineqflux/wrap_nc.c - -M models/lnd/clm2/src/main/initializeMod.F90 - - updated log output to version 3.0 -M models/atm/cam/src/control/system_cmd.c - - bug fix for handling of system command strings - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_5 -Originator: jet ( John Truesdale) -Date: Thu Jun 24 13:17:43 MDT 2004 -Model: CAM -Version: CAM3.0.5 -One-line Summary: Updated SCAM files to match cam3.0 distribution -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: mostly documentation) -(Detailed description below) -Tested to work coupled with CCSM (create_ccsmcam): no -Machines tested: none -Ran test-model.pl script: no -Tested on fv dynamics: na -Tested on eul dynamics:na -Tested on sld dynamics:na -Tested that restarts are bit-for-bit: na -Tested multiple constituents: na -Tested that different domain decompositions match bit-for-bit: na -Tested in adiabatic mode: na -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM -CRB? yes - -Changes made: - -Added data directory and README file -deleted duplicate INSTALL and scam.html file in html directory -updated userguide.html -corrected but in testscript - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_4 -Originator: mvr ( Mathew Rothstein), truesdale, vertenstein -Date: Mon Jun 21 10:19:32 MDT 2004 -Model: CAM -Version: CAM3.0.4 -One-line Summary: Cleanup of default settings of CAM/CLM input datasets; SCAM updated; Fixed two CLM bugs -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, truesdale, vertenstein -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes -fixed bug in code to exclude fields from history tape; fixed bug in code that -generates land surface datasets for fv -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -R models/atm/cam/tools/scam/scm_init/scam_rpc.h -A models/atm/cam/tools/scam/testscript - - new validation test script -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml - - modified entry for fv2x2.5 input dataset, removed references to linked - files, modified some comments -M models/atm/cam/bld/DefaultCLMEXPNamelist.xml - - new entry for fv2x2.5 input dataset, modified some comments -M models/atm/cam/tools/scam/.scam_defaults -M models/atm/cam/tools/scam/configure -M models/atm/cam/tools/scam/ui/configure -M models/atm/cam/tools/scam/ui/manager.cpp -M models/lnd/clm2/src/main/histFileMod.F90 - - fixed bug in code that allows user to exclude fields from primary - history tape -M models/lnd/clm2/src/mksrfdata/mksrfdatMod.F90 - - fixed bug in generation of land surface datasets for fv - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_3 -Originator: olson ( Jerry Olson) -Date: Thu Jun 17 14:33:44 MDT 2004 -Model: CAM -Version: CAM3.0.3 -One-line Summary: new initial conditions input/output -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton -Restart files change: no -Changes answers: no (bit-for-bit) except: - a) answers change in aqua-planet mode for all dycores - (new climate) - b) round-off for SLD on IBMs -Changes to CLM land-model: yes. trivial mods to comments -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - - --------------- - - Description of changes: - - - The history.F90 module is modified to include the Initial Conditions file as - part of the general history file build process. Details: - - - the IC file is formatted exactly like a history file. - - just as in other history files, the IC file is filled via calls to - "outfld". - - no time averaging; fields are always instantaneous - - only one time sample written to file - - accumulation/output is in double precision - - "ptapes" increased from 6 to 7 - - IC file is indexed "mtapes" in the history module (always at end of - active history file list) - - name of file includes ".i." rather than ".hX." - - - two namelist parameters control the building of the IC file: - - - INITHIST: controls frequency of IC file writes (for both land and - atmosphere): '6-HOURLY, 'DAILY', 'MONTHLY', 'YEARLY' or - 'NONE' - - INITHIST_ALL: .false.: dump ONLY required fields to IC file - .true. : dump required AND optional fields to IC - file (DEFAULT) - - setting "EMPTY_HTAPES = .true." does NOT prevent the IC file from being - created. - - only setting INITHIST = 'NONE' prevents the IC file from being created. - - no space allocated on history buffer if INITHIST = 'NONE' - - the old IC file build routine, "write_inithist" is removed - - - Note: - In an Eulerian run, the new code does not produce identical IC - files as the old code. The values for QCWAT, TCWAT, LCWAT, and - CLD will be different. - - - In adiabatic mode, the FV dycore *still* does not create an IC - file with the proper temperature on it. In adiabatic mode, FV - does not update temperature. Therefore, the IC file will - contain the wrong temperature. - - - History (and IC) fieldnames can be up to 16 characters long - - - inidat.F90 re-written for all dycores. All fields are now read and processed - one at a time, reducing memory costs. All reads are done via a call to a - single netCDF interface (modified version of module written for the Land - Model by Mariana Vertenstein). - - - inidat.F90 is backward compatible with OLD IC files. - - - EUL and SLD spetru.F90 modules modified to be identical to eachother - - - another new namelist variable: - - RAD_FIRST_HOUR: Flag to force model to compute full radiation every - timestep in the first model hour (for use in - "forecast/analysis" runs) - Default: .false. - - - restart files will change (because of extra characters for each field) - - - Removed code associated with HADVTEST and VADVTEST cpp tokens ("blob" test) - - - Bugfixes in aqua-planet mode: - - - the field "landm" is now set to 0. Changes answers; new climate for - aqua-planet. - - fixed bug in analytical SST specification (in a branch of code not run - by default model) - - Bugfix to test-model.pm provided by Erik. - - --------------- - - Files modified: - - M models/atm/cam/bld/CAM_run.pm - - Bugfix provided by Erik - M models/atm/cam/src/control/comctl.h - - added namelist variable, "rad_first_hour" - M models/atm/cam/src/control/filenames.F90 - - deleted old IC file logic - M models/atm/cam/src/control/history.F90 - - extensive changes to add IC file as - part of the history file set (ptapes = 7) - - history file field names can be up to - 16 characters long - M models/atm/cam/src/control/readinitial.F90 - - added logic to trap possible model and IC file inconsistencies in the - grid/spectral resolutions - M models/atm/cam/src/control/runtime_opts.F90 - - added new namelist variables - M models/atm/cam/src/dynamics/eul/dyndrv.F90 - - removed blob test code - M models/atm/cam/src/dynamics/eul/grmult.F90 - - removed blob test code - M models/atm/cam/src/dynamics/eul/inidat.F90 - - cleanup - M models/atm/cam/src/dynamics/eul/linemsdyn.F90 - - removed blob test code - M models/atm/cam/src/dynamics/eul/spetru.F90 - - modified so that "eul" and "sld" spetru routines are identical - M models/atm/cam/src/dynamics/eul/stepon.F90 - - removed logic associated with old IC file code - - added call to dump state field values to IC file buffer - M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 - - removed blob test code - - fix to qneg3 diagnostic print - M models/atm/cam/src/dynamics/fv/inidat.F90 - - cleanup - M models/atm/cam/src/dynamics/fv/inital.F90 - - modified a "use" statement - M models/atm/cam/src/dynamics/fv/stepon.F90 - - removed logic associated with old IC file code - - added call to dump state fields to IC file buffer - M models/atm/cam/src/dynamics/sld/dyndrv.F90 - - removed blob test code - M models/atm/cam/src/dynamics/sld/grmult.F90 - - removed blob test code - M models/atm/cam/src/dynamics/sld/inidat.F90 - - cleanup - M models/atm/cam/src/dynamics/sld/restart_dynamics.F90 - - removed unused fields from restart file - M models/atm/cam/src/dynamics/sld/scan2.F90 - - removed logic associated with old IC file code - M models/atm/cam/src/dynamics/sld/scanslt.F90 - - removed blob test code - M models/atm/cam/src/dynamics/sld/sltwgts.F90 - - removed blob test code - M models/atm/cam/src/dynamics/sld/spetru.F90 - - modified so that "eul" and "sld" spetru routines are identical - M models/atm/cam/src/dynamics/sld/stepon.F90 - - added call to dump state fields to IC file buffer - M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 - - removed blob test code - - fixed diagnostics bug in qneg3 - M models/atm/cam/src/ocnsice/dom/sst_data.F90 - - fixed bug in analytical SST specification (used in "aqua-planet" mode) - M models/atm/cam/src/physics/cam1/advnce.F90 - - Do full radiation every timestep of first model hour if "rad_first_hour" - is .true. - M models/atm/cam/src/physics/cam1/diagnostics.F90 - - add routine to dump physics fields to IC file buffer - M models/atm/cam/src/physics/cam1/phys_adiabatic.F90 - - cleanup - M models/atm/cam/src/physics/cam1/physics_types.F90 - - fix to qneg3 diagnostic print - M models/atm/cam/src/physics/cam1/phys_idealized.F90 - - cleanup - M models/atm/cam/src/physics/cam1/physpkg.F90 - - call routine to dump physics fields to IC file buffer - M models/atm/cam/src/physics/cam1/qneg3.F90 - - fix to qneg3 diagnostic print - M models/atm/cam/src/physics/cam1/restart_physics.F90 - - fix to quell compiler complaint - M models/atm/cam/src/physics/cam1/tphysbc.F90 - - fix to qneg3 diagnostic print - M models/lnd/clm2/src/main/clm_varctl.F90 - M models/lnd/clm2/src/main/inicFileMod.F90 - --------------- - - Files added: - - A models/atm/cam/src/control/ncdio_atm.F90 - - Wrapper for reading a 2-D or 3-D field from a netCDF IC file - A models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 - - "outfld" dynamics state variables to history buffer (for IC file) - A models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 - - "outfld" dynamics state variables to history buffer (for IC file) - A models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 - - "outfld" dynamics state variables to history buffer (for IC file) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_2 -Originator: erik ( Erik Kluzek) -Date: Wed Jun 9 10:29:42 MDT 2004 -Model: CAM -Version: CAM3.0.2 -One-line Summary: Major test-model.pl update, bug fix for DGVM in clm code -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton, Matt Rothstein, and Tom Henderson -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: DGVMMod.F90, and driver.F90 from Mariana for DGVM bug-fix -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Synopsis: - -Overall this is a major refactoring of test-model.pl. This is the version -of test-model.pl that was on the subroutinization branch for the last year. -This improves the default behavior of test-model.pl and makes it easier -and more flexible to use. It also provides for the ability to test the -test-model.pl test harness. - -Files changed and a description of the changes: - -M models/atm/cam/bld/CAM.pm -M models/atm/cam/bld/CAM_config.pm -M models/atm/cam/bld/CAM_namelist.pm -M models/atm/cam/bld/CAM_run.pm -R models/atm/cam/bld/check-namelist.pl -R models/atm/cam/bld/lsmexp.pm -M models/atm/cam/bld/run-model.pl - -Add abilities needed by new test-model.pl. Don't delete *.f90 files. -Delete lsmexp.pm file. Make run options more clear. Add printlev and test -option to namelist. Build_namelist always does a new on a namelist -object. Get rid of check-namelist.pl as not used. - -M models/atm/cam/test/system/CAM_test.pm -M models/atm/cam/test/system/README -A models/atm/cam/test/system/babyblue.test-model.pl.log ! testonly mode results -M models/atm/cam/test/system/dao_batch.csh -A models/atm/cam/test/system/default_tests.test-model.xml ! XML default tests -A models/atm/cam/test/system/namelist-config.test-model.dbg.log ! file of - configuration/namelists from testonly mode -M models/atm/cam/test/system/ncar_batch.csh -A models/atm/cam/test/system/specs-testslist.test-model.xml ! XML file of - specifications of fields expected in testslist XML files -M models/atm/cam/test/system/test-model.pl - -New version of test-model.pl as described below. - -M models/atm/cam/tools/newcprnc/Makefile - -Allow use of env variables needed by test-model.pl. Still not used in -test-model.pl as newcprnc doesn't do a proper mass weighting of the -differences. - -M models/lnd/clm2/src/biogeochem/DGVMMod.F90 -M models/lnd/clm2/src/main/driver.F90 - -Bug-fixes from Mariana for DGVM. - -Details of changes to test-model.pl - -test-model.pl -- new version with XML files to control tests that - are run. This is the version of test-model.pl that was - used on the subroutinization branch. Modified batch scripts - to correspond to new command line options. - -Default is changed so that if you are comparing and a test is -NOT bit-for-bit to the comparision code -- test-model.pl will -stop. - -New command line options to test-model.pl - --cleanonly = only clean files out --help_defaults = Create file with configuration/namelist information - for all tests -allow_nonb4bcompare = Allow comparisions not bit-for-bit to continue. --[no]spmd = Turn on [off] SPMD mode --[no]smp = Turn on [off] SMP mode --nocompareifskipped = If you are skipping tests a comparision will NOT - be run if a given test is skipped. -namelist "namelist" = Reads in namelist and adds these options to the - namelists that are used. --testonly = Only test test-model.pl running configure and - build-namelist for all tests to demonstrate what - test-model.pl would have produced. --testslist filename = Use the given XML file of tests rather - than the default file. - -Information on all command-line options is given with - -test-model.pl -help - -newcprnc -- Add ability to use the env variables needed for test-model.pl - VPATH, EXEDIR. To use this in test-model.pl change the path - in test-model.pl and change CAM_test.pm to NOT use the "-m" option - as the behavior of this flag was reversed in newcprnc from cprnc. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0_1 -Originator: erik ( Erik Kluzek) -Date: Tue May 25 16:40:56 MDT 2004 -Model: CAM -Version: CAM3.0.1 -One-line Summary: Get rid of ncdata_vers stuff, and fix SOM comparision bug in test-model.pl -cam-bugs Requests resolved: 118 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes -(ncdata_vers is no longer needed) -Tested to work coupled with CCSM (create_ccsmcam): yes -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Get rid of ncdata_vers stuff in the build-namelist scripts. - -Fix bug in SOM comparisions, so test-model.pl will flag a difference -if SOM code changes. Previously this aspect was broken and the comparisions -files were mislabled. Now the files are properly labeled, SOM control -tests are made in a seperate directory, and namelist and configuration -variables are consistent such that the comparision is valid. This problem -was documented as cam-bug #118. - -No code was changed only build and configuration and test scripts. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam3_0 -Originator: eaton ( Brian Eaton) -Date: Mon May 24 15:33:43 MDT 2004 -Model: CAM -Version: CAM3.0 -One-line Summary: remove old CAM2 documentation -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: none -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no - -Changes made: - -Remove old CAM2 documentation. - -=============================================================== -=============================================================== - -cam2_0_2_dev86 -Originator: mvertens ( Mariana Vertenstein) -Date: Thu May 20 10:56:00 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev86 -One-line Summary: updated clm code clm3_deva_14 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes (TER.01a.T31_gx3v5.K.blackforest) -Machines tested: IBM, SGI, Linux(lf95) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -1) Updated clm code to clm3_deva_14 -2) Updated clm documentation to clm3_deva_14 -3) One line modification to - atm/src/control/ioFileMod.F90 - clm2/src/main/fileutils.F90 - to fix file removal problem associated with mss writes - -=============================================================== -=============================================================== - -cam2_0_2_dev85 -Originator: jet ( John Truesdale) -Date: Tue May 18 14:53:15 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev85 -One-line Summary: Added SCAM to cam_dev -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Added cpp delimeted code to allow clm to work - in single column mode. - -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -My check-in includes 3 sets of modifications to CAM code. -1) modifications to allow it to work in single column mode -2) additional source code and configuration files to create GUI - for the Single-Column CAM (SCAM). -3) modification to CAM to allow it to produce a history file that - can be used by SCAM to run in a pseudo-iop mode using model - data. - -Most of the modifications to CAM source have been delimited by cpp -tokens (#defined SCAM and #defined BFB_CAM_SCAM_IOP) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev84 -Originator: mvr ( Mathew Rothstein) -Date: Fri May 14 09:43:26 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev84 -One-line Summary: Replaced numerical recipes routines for random# generation and findvalue; modified Makefile to eliminate double comma problem; other small bug fixes -cam-bugs Requests resolved: none -Requires change in build system: yes -- replaced the use of function subst in Makefile with patsubst to eliminate - double comma problem -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, pjr -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -R models/atm/cam/src/utils/findvalue.F90 - - removing old find routine based on numerical recipe algorithm -A models/atm/cam/src/utils/marsaglia.F90 - - new random number generator for cloud simulator -M models/atm/cam/src/physics/cam1/cloudsimulator.F90 - - modified to seed new random number generator -M models/atm/cam/src/physics/cam1/icarus_scops.F90 - - now uses new random number generator rather than algorithm from - numerical recipes -M models/atm/cam/src/physics/cam1/radclwmx.F90 - - added r8 declaration to array aer_trn_ttl -M models/atm/cam/src/physics/cam1/radcswmx.F90 - - now uses fortran intrinsic for finding an array minimum rather - than a routine from numerical recipes -M models/atm/cam/bld/Makefile - - replaced the use of function subst with patsubst to eliminate ,, -M models/atm/cam/test/system/CAM_test.pm - - modified error message in test-model - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev83 -Originator: mvr ( Mathew Rothstein) -Date: Thu May 13 09:56:08 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev83 -One-line Summary: Replaced sort routine; modified handling of namelist vars for computing run stop date; modifed input dataset path strings -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: same-to-roundoff -Changes to CLM land-model: yes -- modified strings of default input datasets to include full path from csmdata -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -R models/atm/cam/src/utils/sortarray.F90 - - removing old sort routine based on numerical recipe algorithm -A models/atm/cam/src/utils/quicksort.F90 - - replacing sort routine with new quick-sort algorithm -M models/atm/cam/src/physics/cam1/radclwmx.F90 - - modified to call new sort routine -M models/atm/cam/src/physics/cam1/radcswmx.F90 - - modified to call new sort routine -M models/atm/cam/src/control/time_manager.F90 - - modified handling of namelist parameters for computing stop date -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml - - modified input dataset strings to include full path from csmdata -M models/atm/cam/bld/DefaultCLMEXPNamelist.xml - - modified input dataset strings to include full path from csmdata -M models/atm/cam/bld/camexp.pm - - modified to use new input dataset strings -M models/atm/cam/bld/clm2exp.pm - - modified to use new input dataset strings - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev82 -Originator: jmccaa ( James Mccaa) -Date: Mon May 10 15:40:39 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev82 -One-line Summary: Tuning modifications for the finite volume dycore. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, intel -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes, for FV -- bit-for-bit for EUL and SLD -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -Modified tuning for FV 2x2.5, and introduced tuning settings for FV 4x5 -and FV 1x1.25. -A new i.c. file for FV 4x5 was introduced. -These files were modified: -M cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml -M cam1/models/atm/cam/src/dynamics/fv/dycore.F90 -M cam1/models/atm/cam/src/physics/cam1/cldwat.F90 -M cam1/models/atm/cam/src/physics/cam1/cloud_fraction.F90 -M cam1/models/atm/cam/src/physics/cam1/moistconvection.F90 -M cam1/models/atm/cam/src/physics/cam1/zm_conv.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev81 -Originator: mvertens ( Mariana Vertenstein) -Date: Tue May 4 10:40:20 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev81 -One-line Summary: updated clm code to clm3_deva_10 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes (TER.01a.T31_gx3v5.K.blackforest) -Machines tested: IBM, SGI, Linux(lf95) -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Forrest Hoffman -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes (see below) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -1) Updated clm code to clm3_deva_10 - This primarily includes the addition of CrayX1 directives to the code - as well as changes to DGVM to make it effectively work on the Cray X1 - Also changed the name of the clm file changed in cam2_0_2_dev80 back - to its original name for the sake of cvs history continuity -2) Modified history.F90 to use (ieor,iand) rather than (xor,and) - -=============================================================== -=============================================================== - -cam2_0_2_dev80 -Originator: eaton ( Brian Eaton) and Pat Worley -Date: Wed Apr 28 17:44:37 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev80 -One-line Summary: merge vector branch -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux/lf95, Linux/pgi -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Pat Worley -Restart files change: no -Changes answers: Yes (same-to-roundoff) -Changes to CLM land-model: rename STATICEcosysDynMod.F90 --> STATICEcosystemDynMOD.F90 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -1. Merge of vector and scalar code branches: - -The mods for the NEC that didn't change answers (bit-for-bit) were -committed previously. This set of mods introduces a roundoff level -change into the simulation. The main modifications are: - -. A new version of radcswmx. This code runs a little slower on the IBM - (about 4% of total run time). It introduces roundoff level changes - which affects all dycores. - -. Large sections of code have been changed which reorder the spectral - calculations in the EUL dycore. We observed no performance degradation - on the IBM from this change. - -. Most of the Cray optimizations have been included as well. They are mainly - compiler directives. - -2. Rename a CLM file which didn't match the module name it contained (this - breaks the dependency generator) - -3. Some cleanup in ncar_batch.csh - -=============================================================== -=============================================================== - -cam2_0_2_dev79 -Originator: eaton ( Brian Eaton) -Date: Fri Apr 23 07:56:47 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev79 -One-line Summary: T31 tuning; T31 and T85 datasets; diagnostics -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, Linux/lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -. Tuning mods for T31 -. New datasets for T31 and T85 -. Diagnostics: - - AIX specific traceback call added to abortutils - - Check for NaNs in timeinterp - -=============================================================== -=============================================================== - -cam2_0_2_dev78 -Originator: eaton ( Brian Eaton) and Mat Rothstein -Date: Tue Apr 20 10:52:58 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev78 -One-line Summary: misc configure/Makefile/test-model changes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes, on Blackforest -Machines tested: IBM, Linux/lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvr -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -. Fix hack in test-model that set F_OPTIMIZATION_OVERRIDE for certain PGI - tests. The hack was broken by the inclusion of a commandline option to - configure for setting the F_OPTIMIZATION_OVERRIDE macro in the Makefile. -. Add print in test-model output to tells which log contains NOT BFB - message. -. Various configure/Makefile changes: - - Temporarily remove -Mbounds from PGI debug options. CLM2 is not working - with this option. - - Add -cppdefs option to configure for defining CPP tokens. These cpp - definitions are appended to the Makefile defaults. Remove the -precomp - option which was adding #define lines to misc.h. - - Add capability to configure to determine the name of the MPI library - being used. This is currently most useful for Linux which may use - either mpi or mpich as the library name. - - Clean up Linux section of Makefile. Fixed a bug which broke the build - if the user specified the option '-fc pgf90' to configure. Remove - options for compilers that don't have corresponding builds of the ESMF - library. -. Add missing addfld call for H2O2DRY in sulfur_intr.F90 - -=============================================================== -=============================================================== - -cam2_0_2_dev77 -Originator: mvr ( Mathew Rothstein) and Brian Eaton -Date: Tue Apr 6 10:38:51 MDT 2004 -Model: CAM -Version: CAM2.0_2.dev77 -One-line Summary: Update cloud simulator; T31 mods; Enable cloud overlap scenarios; Bug fix in masterlist lookups; Re-commit of infnan mods -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes -replaced infnan mods of dev65, mistakenly removed -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -R models/atm/cam/src/physics/cam1/cloudsimulatorparms.F90 - - put data in icarus_scops.h, put doisccp into cloudsimulator.F90 -A models/atm/cam/src/physics/cam1/icarus_scops.F90 - - new module containing subroutine isccp_cloud_types (converted to free - format) and subroutine ran0_vec - - change output types to r8 - - replace "STOP" with endrun calls - - add diagnostic for meanttop - - add icarus_scops_init routine to read in tautab and invtau arrays -M models/atm/cam/bld/DefaultCAMEXPNamelist.xml - - added default value for dataset isccpdata, needed for isccp simulator -M models/atm/cam/bld/camexp.pm - - modified to handle namelist parameters related to the isccp simulator -M models/atm/cam/src/control/cam.F90 - - remove call to initialization routine -M models/atm/cam/src/control/history.F90 - - use icarus_scops instead of use cloudsimulatorparms - - remove addfld and add_default calls for diagnostic fields (move to - cloudsimulator_init) - - remove unnecessary addfld for aermmr - - added endrun calls for hash table lookups of fields not on masterlist -M models/atm/cam/src/control/runtime_opts.F90 - - use cloudsimulator instead of cloudsimulatorparms -M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 - - removed outfield calls and related code for fields not on masterlist -M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 - - removed outfield calls and related code for fields not on masterlist -M models/atm/cam/src/physics/cam1/check_energy.F90 - - removed unneeded code to fix bug identified by SX6 machine -M models/atm/cam/src/physics/cam1/cldwat.F90 - - added special setting of physical constants for T31 runs -M models/atm/cam/src/physics/cam1/cloud_fraction.F90 - - added special setting of physical constants for T31 runs -M models/atm/cam/src/physics/cam1/cloudsimulator.F90 - - rename isccptab --> cloudsimulator_init - - rename ccm_isccp --> cloudsimulator_run - - add state to cloudsimulator_run args - - add addfld and add_default calls for diagnostic fields - - change arguments to isccp_cloud_types from single columns to chunks - - use the totalcldarea diagnostic from isccp_cloud_types rather than the - cltot diagnostic from cam to decide whether it's cloudy or not. This - avoids assigning fillvalues inside the isccp_cloud_types code -M models/atm/cam/src/physics/cam1/constituents.F90 - - commented out code for fields no longer in use -M models/atm/cam/src/physics/cam1/initindx.F90 - - commented out code for fields no longer in use -M models/atm/cam/src/physics/cam1/inti.F90 - - call cloudsimulator_init -M models/atm/cam/src/physics/cam1/moistconvection.F90 - - added special setting of physical constants for T31 runs -M models/atm/cam/src/physics/cam1/param_cldoptics.F90 - - add_default call for icldiwp - - modify long name attribute for icldlwp -M models/atm/cam/src/physics/cam1/radclwmx.F90 - - uncommented line and modified associated array declaration in LW - cloud-overlap code (critical for certain cloud overlap assumptions) -M models/atm/cam/src/physics/cam1/tphysbc.F90 - - use cloudsimulator instead of cloudsimulatorparms - - update cloudsimulator_run args - - removed outfield calls and related code for fields not on masterlist -M models/atm/cam/src/physics/cam1/zm_conv.F90 - - added special setting of physical constants for T31 runs -M models/lnd/clm2/src/main/nanMod.F90 - - replaced mods for quiet/signalling NaN's of dev65 that were - mistakenly overwritten with dev75 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev76 -Originator: rosinski ( Jim Rosinski) -Date: Tue Mar 30 15:11:23 MST 2004 -Model: CAM -Version: CAM2.0_2.dev76 -One-line Summary: bit-for-bit NEC vector branch changes. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit). PC is only roundoff -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Merged cam2.0.2.dev67.brnchT.nec15 (vector branch) changes that do not affect - answers onto cam_dev. Opted for Pat Worley's dev68 communication mods over NEC - communication mods where conflicts occurred. A few NEC_SX ifdefs still - exist in the committed code. Most involve reversing "do k" and "do i" - loops in dynamics routines for vectorization. An inner loop over k results - in a non-unit-stride situation on scalar machines and should be avoided. - That is why these code portions were left ifdef'd - -o Note 1: The code appears to be good to roundoff on IBM machines when NEC_SX is - #define'd. To test this on an IBM, "! defined AIX" needs to be added in 2 - obvious places in cfort.h and abortutils.F90 - -o Note 2: An odd behavior was discovered whereby inconsistent chunck indices are - printed from ice_srf.F90 at times when the ice temperature profile is reset to - linear. This behavior appears to only manifest when threads * tasks exceeds - the number of physical CPUs available. It was decided to commit without - resolving this discrepancy because the behavior occurs in the base model and - in earlier libraries, i.e. independent of the NEC vector mods. - -=============================================================== -=============================================================== -cam2_0_2_dev75 -Originator: mvertens ( Mariana Vertenstein) -Date: Fri Mar 26 15:07:40 MST 2004 -Model: CAM -Version: CAM2.0_2.dev75 -One-line Summary: updated clm to clm3_deva_08 -cam-bugs Requests resolved: none -Requires change in build system: no (can removed atmlnd_share from Filepath howeer) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, (Brian Eaton revied cam time_manager.F90) -Restart files change: yes -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes - updated to clm3_deva_08 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -1) added perpetual model to cam-clm - - updated clm/src to clm3_deva_09 which had perpetual mode changes. - - modified models/atm/cam/src/control/time_manager.F90 to add offset argument to - subroutine get_perp_date(..) -2) changes to models/atm/cam/bld/: - - removed setting of reset_csim_iceprops in DefaultCAMEXPNamelist.xml - - removed atmlnd_share from configure -3) chages to atmlnd_share/: - atmlnd_share no longer needed - atmlnd_share/cfort.h updated and moved to models/atm/cam/src/control and models/lnd/clm2/src/main - atmlnd_share/datetime.F90 moved to models/atm/cam/src/control - atmlnd_share/infnan.F90 moved to models/atm/cam/src/control - atmlnd_share/linebuf_stdout.c moved to models/atm/cam/src/control - atmlnd_share/mpishorthand.F moved to models/atm/cam/src/control - atmlnd_share/string_utils.F90 moved to models/atm/cam/src/control - atmlnd_share/wrap_nf.F90 moved to models/atm/cam/src/control -4) other changes: - removed all files in following directories - they are now obsolete:following obsolete files: - models/bld/ - scripts/gui/ - scripts/gui_run/ - scripts/system_test/ - scripts/test.a1/ - scripts/test.a2/ - scripts/tests/cpl_check/ - scripts/tests/gprof/ - scripts/tests/sub_sgi/ - scripts/tests/test_scripts/ - scripts/tests/timing/ -=============================================================== -=============================================================== - -cam2_0_2_dev74 -Originator: mvr ( Mathew Rothstein) -Date: Thu Mar 18 11:51:59 MST 2004 -Model: CAM -Version: CAM2.0_2.dev74 -One-line Summary: Add fields to master list for radiation diagnostics; fixes to build-namelist for "naked decimal" and handling of raw land surface datasets -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes -clm2exp.pm: now properly handles user-specified raw land surface datasets -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M cam1/models/atm/cam/bld/clm2exp.pm - - now properly handles user-specified raw land surface datasets -M cam1/models/atm/cam/bld/namelist.pm - - added ability to read "naked" decimal entries -M cam1/models/atm/cam/bld/script_tests/namelist.pl - - added namelist tests for "naked" decimal entries and more -M cam1/models/atm/cam/src/control/history.F90 - - add addfld calls for ASDIR, ASDIF, ALDIR, ALDIF - - remove old addfld call for REL - - add addfld call for SST -M cam1/models/atm/cam/src/physics/cam1/comsrf.F90 - - init trefmxav, trefmnav - - init lchnk and ncol in srfflx_state_2d -M cam1/models/atm/cam/src/physics/cam1/diagnostics.F90 - - change diag_surf to use srfflx_state and surface_state types - - add outfld calls for ASDIR, ASDIF, ALDIR, ALDIF - - add outfld call for SST -M cam1/models/atm/cam/src/physics/cam1/param_cldoptics.F90 - - add addfld and outfld calls for EMIS, CICEWP, REI, REL -M cam1/models/atm/cam/src/physics/cam1/physpkg.F90 - - pass srfflx_state and surface_state types to diag_surf instead of the - individual fields -M cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 - - remove old outfld call for REL - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev73 -Originator: mirin ( Arthur Andrew Mirin) -Date: Mon Mar 15 09:16:02 MST 2004 -Model: CAM -Version: CAM2.0_2.dev73 -One-line Summary: Mod_comm and related updates. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: new test on blackforest -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -(A) mod_comm has been significantly streamlined to make it easier to -understand the coding; module mod_irreg has been combined into mod_comm; -option to dynamically allocate target window has been added. -More work still needs to be done. Most of the changes in the FV routines -are due to the new linkage. - -(B) the utils/pilgrim subdirectory can now be included for all 3 dycores; -this requires setting the if-def MODCM_DP_TRANSPOSE. Consequently, -the mod_comm option for the dynamics/physics transposes in phys_grid -is now operational with all 3 dycores; - -(C) namelist variable modcomm_method has been fissioned into 2 new -namelist variables - modcomm_transpose and modcomm_geopk; these are -applicable to the FV dycore. - -(D) the namelist variable phys_alltoall is now overloaded when applicable -to mod_comm; its new value is 11 + (mod_comm method), where (mod_comm method) -can have values from 0 to 3; see code documentation in phys_grid. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev72 -Originator: bundy ( Danielle R. B. Coleman) -Date: Fri Mar 12 12:13:22 MST 2004 -Model: CAM -Version: CAM2.0_2.dev72 -One-line Summary: fix FV mass conservation problem -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux (Lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Phil Rasch -Restart files change: no -Changes answers: changes answers in FV only -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -models/atm/cam/src/dynamics/fv/fill_module.F90 - -fix mass conservation for small mixing ratios by scaling tiny fill value -to magnitude of mixing ratio. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev71 -Originator: bundy ( Danielle R. B. Coleman) -Date: Wed Mar 10 16:13:03 MST 2004 -Model: CAM -Version: CAM2.0_2.dev71 -One-line Summary: Add dry mixing ratio formulation, suite of test tracers -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux (Lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Phil Rasch -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - a. A list of any subroutines eliminated; -models/atm/cam/src/physics/cam1/test_tracers.F90 -models/atm/cam/src/physics/cam1/rnozunit.F90 - - b. A list of any subroutines added and what they do; and -models/atm/cam/src/physics/cam1/tracers.F90 -replaces eliminated file test_tracers.F90 -an interface for a generic suite of tracers specified in tracers_suite.F90 - -models/atm/cam/src/physics/cam1/tracers_suite.F90 -replaces eliminated rnozunit.F90 -contains all the specifications for a suite -of tracers, and is interfaced to the model via tracers.F90. - - c. For existing files that have been modified, an itemized list - of the changes and where they can be found - -models/atm/cam/src/physics/cam1/advnce.F90 - add call to tracers_timestep_init -models/atm/cam/src/physics/cam1/check_energy.F90 - add check_tracers mass capability -models/atm/cam/src/physics/cam1/constituents.F90 - add mixtype (wet or dry) field to constituent description - add functions to get type by index or name -models/atm/cam/src/physics/cam1/convtran.F90 -/models/atm/cam/src/physics/cam1/diagnostics.F90 - outfld call for PDELDRY -models/atm/cam/src/physics/cam1/initindx.F90 -models/atm/cam/src/physics/cam1/inti.F90 - change namelist variables that control tracers -models/atm/cam/src/physics/cam1/moistconvection.F90 -models/atm/cam/src/physics/cam1/physics_types.F90 - add capability for wet or dry mixtype tracers -models/atm/cam/src/physics/cam1/physpkg.F90 - calculates pdeldry for dry mixtypes - added gavglook subroutine for checking mass conservation -models/atm/cam/src/physics/cam1/tphysac.F90 - change tracer namelist variables, subroutine calls - check mass of tracers - for LR dyn, convert dry to wet at end -models/atm/cam/src/physics/cam1/tphysbc.F90 - calculate and write out dry surface pressure PSDRY - check mass of tracers -models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - calculate tend wrt dry pressure for dry mixtype tracers - by calling vdiff for again only if there are dry tracersm -models/atm/cam/src/physics/cam1/turbulence.F90:trbintr() - add optional argument to skip outfld calls - ( used on 2nd call to subroutine from 2nd call to vdiff) -models/atm/cam/src/control/filenames.F90 - add boundary file for test tracers: bndtvsf6 -models/atm/cam/src/control/runtime_opts.F90 - change namelist variables for tracers: - [new] bndtvsf6 - [mod] tracers_flag [replaces trace_test{1-3}] -models/atm/cam/src/control/history.F90 - addfld PSDRY -models/atm/cam/src/advection/slt/qmassa.F90 -models/atm/cam/src/advection/slt/xqmass.F90 - add capability for dry mixtype tracers -models/atm/cam/src/dynamics/eul/dp_coupling.F90 -models/atm/cam/src/dynamics/sld/dp_coupling.F90 - only change wet mixtype tracers to dry/wet mr for dyn/phys -models/atm/cam/src/dynamics/fv/dp_coupling.F90 - convert dry mixtype tracers to wet/dry for dyn/phys -models/atm/cam/src/dynamics/fv/stepon.F90 - before 1st call to dynamics, convert dry tracers to wet -models/atm/cam/src/dynamics/eul/inidat.F90 -models/atm/cam/src/dynamics/sld/inidat.F90 -models/atm/cam/src/dynamics/fv/inidat.F90 - name changes test_tracers -> tracers -models/atm/cam/src/dynamics/eul/scanslt.F90 -models/atm/cam/src/dynamics/sld/scanslt.F90 - pass vars (n3,q3) to slt interface -models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 -models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 - modify qneg threshold (corm) for dry mixtypes to conserve mass -/models/atm/cam/src/dynamics/eul/comslt.F90 - add trcavg variable - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev70 -Originator: pworley ( Patrick H Worley) -Date: Tue Mar 9 08:30:43 MST 2004 -Model: CAM -Version: CAM2.0_2.dev70 -One-line Summary: replaced use of mpi_comm_world with mpicom in initialization of swap_comm module -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux/Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -modified control/swap_comm.F90: - replaced mpi_comm_world with mpicom when duplicating communicators (for use in - swap_comm module routines). Without this, CAM does not work with CCSM. - -added test/system/create_ccsmcam: - script provided by Mariana Vertenstein to test CAM with CCSM - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev69 -Originator: mvr ( Mathew Rothstein) -Date: Thu Mar 4 17:35:12 MST 2004 -Model: CAM -Version: CAM2.0_2.dev69 -One-line Summary: Fix for DMS bug; Fix for co2 ramping with rate<0; Added co2vmr to history output -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M models/atm/cam/src/physics/cam1/acbnd.F90 - - move allocate outside of masterproc conditional in acbndint() -M models/atm/cam/src/physics/cam1/dmsbnd.F90 - - fix bug reading new time sample in dmsbndint() - - move allocate outside of masterproc conditional in dmsbndint() -M models/atm/cam/src/physics/cam1/soxbnd.F90 - - move allocate outside of masterproc conditional in soxbndint() -M models/atm/cam/src/physics/cam1/ghg_surfvals.F90 - - fixed the handling of co2 ramping when the rate is less than zero -M models/atm/cam/src/control/history.F90 - - added co2vmr (co2 volume mixing ratio) to the history output files - - -=============================================================== -=============================================================== - -cam2_0_2_dev68 -Originator: pworley ( Patrick H Worley) -Date: Wed Mar 3 12:55:10 MST 2004 -Model: CAM -Version: CAM2.0_2.dev68 -One-line Summary: communication optimizations and removal of PVP ifdefs -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: not with default settings -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux cluster -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself (earlier version reviewed by Tom Henderson) -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - -1) Removed PVP ifdefs (to make merge with vector branches cleaner). Files affected: - control/cam.F90, rgrid.F90 - - dynamics/eul/comspe.F90, dyn.F90, dyndrv.F90, grcalc.F90, hordif.F90, - inital.F90, initcom.F90, quad.F90, settau.F90, spetru.F90, - trunc.F90, tstep.F90 - - dynamics/fv/initcom.F90 - - dynamics/sld/dyn.F90, dyndrv.F90, dynpkg.F90, grcalc.F90, hordif.F90, - initcom.F90, quad.F90, spetru.F90, trunc.F90, tstep.F90, - tstep1.F90, vertnm.F90 - -2) Reimplemented communication algorithms in spectral dycore realloc routines - and in the physics load balancing, using either MPI collectives or - point-to-point implementations that use the swap_comm module. swap_comm - was imported from PSTSWM and PCCM, and supports 28 different options. The default - is to use collectives. When not using collectives, the default is to use the - original point-to-point algorithm (using mpi_sendrecv). Runtime options - dyn_alltoall, dyn_allgather, phys_alltoall, swap_comm_order, and swap_comm_protocol - were added to runtime_options to specify these. For example, - dyn_alltoall == 0 means to use MPI_Alltoallv in realloc4a and realloc4b. - dyn_alltoall == 1 means to use one of the point-to-point algorithms. - - Physics load balancing was also changed to use the same communication buffer - as that used by the realloc routines. Finally, the physics load balancing - options were tweaked, primarily to remove a high complexity initialization algorithm - that was dominating runtime for short runs at high resolution. Files affected: - - control/runtime_opts.F90, spmd_utils.F90, spmdinit.F90, swap_comm.F90, mpi_wrap.F90 - - dynamics/eul/dp_coupling.F90, realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 - - dynamics/fv/spmd_dyn.F90 - - dynamics/sld/dp_coupling.F90, realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 - - physics/cam1/phys_grid.F90 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev67 -Originator: mvr ( Mathew Rothstein) -Date: Fri Feb 27 08:53:27 MST 2004 -Model: CAM -Version: CAM2.0_2.dev67 -One-line Summary: Implemented co2 ramping; Enabled lf95/debug checking with sulfates on; fix for 200MB radiation diagnostics -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI(pending), Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M models/atm/cam/src/control/runtime_opts.F90 - - added new option to namelist var scenario_ghg: RAMP_CO2_ONLY - - added new namelist variables: ramp_co2_annual_rate, ramp_co2_cap, - ramp_co2_start_ymd -M models/atm/cam/src/control/time_manager.F90 - - added new routine to calculate #of days between dates: timemgr_datediff -M models/atm/cam/src/physics/cam1/acbnd.F90 - - mods to enable lf95/debug checking with sulfates on -M models/atm/cam/src/physics/cam1/dmsbnd.F90 - - mods to enable lf95/debug checking with sulfates on -M models/atm/cam/src/physics/cam1/soxbnd.F90 - - mods to enable lf95/debug checking with sulfates on -M models/atm/cam/src/physics/cam1/ghg_surfvals.F90 - - formally implemented ability to ramp co2 -M models/atm/cam/src/physics/cam1/radcswmx.F90 - - added fix for 200MB radiation diagnostics - - uses new function to retrieve co2 mass mixing ratio -M models/atm/cam/src/physics/cam1/trcpth.F90 - - uses new function to retrieve co2 mass mixing ratio - - -=============================================================== -=============================================================== - -cam2_0_2_dev66 -Originator: eaton ( Brian Eaton) -Date: Mon Feb 23 16:40:39 MST 2004 -Model: CAM -Version: CAM2.0_2.dev66 -One-line Summary: misc performance improvements -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes (performance improvement validated by G. Carr) -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Carr, Edwards -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - ->> models/atm/cam/src/dynamics/eul/herxin.F90 ->> . "rolled" a loop for better cache performance (Edwards) ->> ->> models/atm/cam/src/dynamics/eul/limdy.F90 ->> models/atm/cam/src/dynamics/eul/limdz.F90 ->> . inlined scm0 by hand into limdy and limdz (Carr) ->> ->> models/atm/cam/src/dynamics/eul/sltini.F90 ->> . remove SPMD ifdefs and thread a loop that was previously unthreaded ->> when SPMD was defined. (Eaton) - -=============================================================== -=============================================================== - -cam2_0_2_dev65 -Originator: hender ( Tom Henderson) -Date: Thu Feb 12 16:18:09 MST 2004 -Model: CAM -Version: CAM2.0_2.dev65 -One-line Summary: IPCC performance upgrade in prognostic sulfate interpolation -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Intel-Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Jim McCaa, Brian Eaton, Jim Rosinski, Mathew Rothstein -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Restored signalling Nan except for pgf90 -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: ->> Performance fix to scale computations in linintp. Speedup = ~12% for ->> stand-alone CAM at T85 with IPCC scenario configurations for prognostic ->> sulfates and greenhouse gasses: ->> models/atm/cam/bld/run-ibm.csh ->> models/atm/cam/src/physics/cam1/acbnd.F90 ->> models/atm/cam/src/physics/cam1/dmsbnd.F90 ->> models/atm/cam/src/physics/cam1/soxbnd.F90 ->> models/atm/cam/src/physics/cam1/sulchem.F90 ->> models/atm/cam/src/physics/cam1/sulemis.F90 ->> models/atm/cam/src/physics/cam1/sulfur_intr.F90 ->> models/atm/cam/src/control/error_messages.F90 ->> Jim Rosinski's new timers: ->> models/atm/cam/src/physics/cam1/comsrf.F90 ->> models/atm/cam/src/physics/cam1/convtran.F90 ->> models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 ->> models/atm/cam/src/physics/cam1/tphysbc.F90 ->> models/atm/cam/src/control/intp_util.F90 ->> Brian Eaton's change to remove broadcasts from chemistry.F90 that were ->> happening every time step: ->> models/atm/cam/bld/DefaultCAMEXPNamelist.xml ->> models/atm/cam/bld/DefaultCLMEXPNamelist.xml ->> models/atm/cam/src/physics/cam1/chemistry.F90 ->> Mathew Rothstein's change to use quiet NaN for pgf90 and signalling NaN for ->> all other compilers. ->> models/lnd/clm2/src/main/nanMod.F90 ->> models/atmlnd_share/infnan.F90 ->> Jim McCaa's addition of 200mb fields. ->> models/atm/cam/src/physics/cam1/radclwmx.F90 ->> models/atm/cam/src/physics/cam1/radcswmx.F90 ->> models/atm/cam/src/physics/cam1/radctl.F90 ->> models/atm/cam/src/control/history.F90 ->> By default, this change produces no new output fields; however, it allows ->> one to fincl the following: ->> FSN200: Clearsky shortwave flux at 200 mb ->> FSN200C: Shortwave flux at 200 mb ->> FLN200: Clearsky longwave flux at 200 mb ->> FLN200C: Longwave flux at 200 mb - -=============================================================== -=============================================================== - -cam2_0_2_dev64 -Originator: mvr ( Mathew Rothstein) -Date: Mon Feb 2 11:13:05 MST 2004 -Model: CAM -Version: CAM2.0_2.dev64 -One-line Summary: patch to enable runs using portland group compiler; removal of mprun2d.pm -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: yes - - modified definition of parameter nan to enable runs using portland group compiler -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -M cam1/models/lnd/clm2/src/main/nanMod.F90 - - modified definition of parameter nan to enable run using portland - group comiler -R cam1/models/atm/cam/bld/mprun2d.pm - - -=============================================================== -=============================================================== - -cam2_0_2_dev63 -Originator: rosinski ( Jim Rosinski) -Date: Tue Jan 27 10:15:42 MST 2004 -Model: CAM -Version: CAM2.0_2.dev63 -One-line Summary: Eliminate dead code, more flexible endrun, more "intent" attributes, - better lf95 strict error checking compliancy -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Mariana checked this. -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Vertenstein -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o endrun is now in a module and takes an optional character string argument. - If present, this string is printed before the model aborts. -o Eliminated dead code, including the old "dataicemodel". Mods were made to - ncar_batch.csh to eliminate the dataicemodel tests. This was done by passing - -skip all:1-17 to test-model. -o Also eliminated dead logic related to sulfur variables. -o Better strict error checking compliancy under lf95. But "lf95 -x" cannot be - used because lf95 warns that all underlying libraries must also be compiled - with this option in order for it to work properly. -o Added "intent" clause to arguments where the proper value was clear. The code - was already in pretty good shape w.r.t. all arguments having their intent - declared. There are still a few places where intent needs to be added though. -=============================================================== -=============================================================== - -cam2_0_2_dev62 -Originator: hender ( Tom Henderson) -Date: Fri Jan 23 10:49:42 MST 2004 -Model: CAM -Version: CAM2.0_2.dev62 -One-line Summary: IPCC scenario changes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes, new namelist variables, new data files -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC-Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Conley, Bundy, Rosinski -Restart files change: no -Changes answers: no (bit-for-bit) for runs that do not use prognostic sulfates, -Yes otherwise -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - - 1. Complete documentation of the changes, including: - a. A list of any subroutines eliminated; ->> cam1/models/atm/cam/src/physics/cam1/Population.F90 ->> cam1/models/atm/cam/src/physics/cam1/aerosols.F90 ->> cam1/models/atm/cam/src/physics/cam1/ramp_ghg_bau.h ->> cam1/models/atm/cam/src/physics/cam1/ramp_ghg_stab.h ->> cam1/models/atm/cam/src/physics/cam1/ramp_scon.h - - b. A list of any subroutines added and what they do; and ->> cam1/models/atm/cam/src/physics/cam1/carbonscales.F90 ->> Formerly Population.F90 ->> cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 ->> Formerly aerosols.F90 ->> cam1/models/atm/cam/src/utils/timeinterp.F90 ->> Combined repeated code bits into a new subroutine. - - c. For existing files that have been modified, an itemized list - of the changes and where they can be found - (NOTE: A cvs command that generates all of the above information can be - provided in place of individual answers. For example, "cvs -nq - update ..." or "cvs rdiff ...".) ->> cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml ->> cam1/models/atm/cam/bld/camexp.pm ->> cam1/models/atm/cam/bld/run-model.pl ->> cam1/models/atm/cam/src/physics/cam1/advnce.F90 ->> cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 ->> cam1/models/atm/cam/src/physics/cam1/chemistry.F90 ->> cam1/models/atm/cam/src/physics/cam1/dmsbnd.F90 ->> cam1/models/atm/cam/src/physics/cam1/ghg_surfvals.F90 ->> cam1/models/atm/cam/src/physics/cam1/inti.F90 ->> cam1/models/atm/cam/src/physics/cam1/radae.F90 ->> cam1/models/atm/cam/src/physics/cam1/radcswmx.F90 ->> cam1/models/atm/cam/src/physics/cam1/radctl.F90 ->> cam1/models/atm/cam/src/physics/cam1/ramp.h ->> cam1/models/atm/cam/src/physics/cam1/ramp_scon.F90 ->> cam1/models/atm/cam/src/physics/cam1/ramp_so4_mod.F90 ->> cam1/models/atm/cam/src/physics/cam1/soxbnd.F90 ->> cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 ->> cam1/models/atm/cam/src/physics/cam1/volcanicmass.F90 ->> cam1/models/atm/cam/src/physics/cam1/volcrad.F90 ->> cam1/models/atm/cam/src/control/filenames.F90 ->> cam1/models/atm/cam/src/control/oznint.F90 ->> cam1/models/atm/cam/src/control/runtime_opts.F90 ->> cam1/models/atm/cam/src/control/so4bnd.F90 ->> cam1/models/atm/cam/src/ocnsice/dom/sst_data.F90 ->> cam1/models/atm/cam/src/ocnsice/som/somint.F90 ->> cam1/models/lnd/clm2/src/main/lp_coupling.F90 ->> ->> See below for details of changes. - - 2. Complete documentation of these changes in the code by comments. ->> DONE - - 3. On what machines did you successfully run test-model.pl? - a. blackforest ->> YES - b. chinook ->> YES - c. anchorage-lf95 ->> YES - - 4. For all of the runs in #3 above, which version of cam did you - compare to (which tag)? ->> cam2_0_2_dev61, using hand-tests since test-model does not support ->> "-compare" when namelist has changed. - - 5. If bitwise differences were observed, how did you prove they were no - worse than roundoff? ->> bit-for-bit - - 6. Does the CAM Users Guide need to be updated due to these changes? - (Possible reasons include changes to the namelist, history output, - configure script, build or run process, etc.) ->> Yes - If so, has the CAM Users Guide been updated in the CVS repository? ->> No - - ->> ->> Source: http://www.cgd.ucar.edu/cseg/plans/ipcc_plan2.txt 01/23/04 ->> ->> IPCC Features in CAM ->> ->> Requirements ->> . thoroughly tested ->> . releaseable, reproducible, community usable ->> . usable for 1990, 1870, historicals, future, paleo ->> (without changing source code, only namelist?) ->> . no hacks, no magic dates in code ->> . datasets available to support T85 resolution (T42?, T31?) ->> . implementation must be general, namelist and dataset must be ->> robust for the specified use cases below. that means making ->> sure that 1870-2000 datasets can be used robustly in the model ->> on Jan 1, 1870 and Jan 1, 2000, and that future datasets can ->> be used in the model robustly on Jan 1, 1990. ->> ->> ------------------------------- ->> ->> Present 1870 control run mods relative to 1990 controls ->> Add CAM namelists f11vmr, f12vmr, co2vmr, ch4vmr, n2ovmr ->> Add CAM namelist carscl=0.3 ->> Add CAM namelist sulscl=0.0 ->> ->> ------------------------------- ->> ->> Dust, Sea Salt ->> . seasonal cycle of monthly averages, data(x,y,z,12) ->> . dataset is resolution dependent, requires T42 and T85 datasets ->> . same datasets will be used for all runs ->> . can be scaled, scaling will always be 1 ->> . this has always been on ->> . file name AerosolMass* ->> . file also includes carbon which is also always on ->> Tasks ->> + Review dataset, verify supports all resolutions; T85, T42, T31, 2x2.5 ->> (Andrew, Bill, Jim R) ->> - Verify correct datasets in CAM scripts (Andrew, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana) ->> Namelist ->> bndtvaer ->> ->> Carbon ->> . carbon dataset is in same file as Dust, Sea Salt, same format (x,y,z,12) ->> . in file AerosolMass ->> . always on, carscl can scale, default 1.0 ->> . carscl=0.3 for 1870 run, continuous with pop dataset ->> . historical will be based on population dataset (t) ->> . time interpolation is flexible, can have varying dt in dataset ->> . dataset "easy to generate" ->> . endruns if date outside dataset ->> . dataset will cover 1870 to 2000 ->> . 2000 to 2300 constant carscl at 2000 (1.0) ->> . 1870 and future will use carscl, historical will use dataset ->> . "ramp year" namelist implementation is defered ->> Tasks ->> + Rename carbon_by_pop to scenario_carbon_scale, char string input ->> (Andrew) ->> + Rename bndtvpop to bndtvcarbonscale (Andrew) ->> + Generate a 1870-2000 dataset (Andrew) ->> + Verify carbon will call endrun if date is outside dataset boundaries ->> (Andrew) ->> - Verify correct datasets and namelist in CAM scripts (Andrew, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana) ->> Namelist ->> bndtvaer ->> carscl ->> scenario_carbon_scale (RAMPED, FIXED), ramped will turn on use of ->> dataset, fixed ->> means use carscl. ->> bndtvcarbonscale ->> ->> Solar ->> . normally a constant, namelist (scon) can override default ->> . can turn on ramping via scenario_scon ->> . ramping data is implemented as data statement and include file ->> . 1870-2000 dataset ->> . all runs with using ramping feature, 1870 will use rampyear_scon ->> set to 1870, future runs will use rampyear_scon set to "2005" ->> Tasks ->> - Create solar dataset, end solar cycle in middle of 11 year cycle ->> around 2005, verify dataset, (Lawrence, Caspar) ->> + Remove include file and data statement, add read of netcdf dataset (Tom) ->> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) ->> + Verify solar calls endrun if using ramped feature and date is outside ->> dataset range (Tom) ->> + Implement in source code ability to use new namelist convention ->> (bndtvscon) (Tom) ->> - Verify correct datasets and namelist in CAM scripts (Lawrence, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana, Lawrence) ->> - Verify functionality of scenario and rampYear via code review ->> or validation runs (Tom, Lawrence) ->> Namelist ->> scon (won't be used) ->> scenario_scon (RAMPED) ->> bndtvscon ->> rampYear_scon ->> ->> GHGs ->> . 5 tracers, f11, f12, co2, ch4, n2o ->> . normally a constant, namelist can override the constants ->> . can turn on ramping ->> . ramping data is implemented as data statement and include file, ->> . turns on some ghg chemistry, IPCC will use that feature, automatically ->> turned on when ramped feature is used ->> . future scenarios will be time varying ->> . Use scenario_ghg = RAMPED always ->> . set rampYear_ghg to 1870 for 1870 control ->> . there will be multiple datasets, 1870-2000 for historical, several ->> 1990 to future datasets. ->> . requires pcnst=pcnst+4 ->> Tasks ->> + Talk to Byron or Jeff about ghg chemistry (Bill) ->> + Generate 1870-2000 netcdf ghg dataset (Lawrence) ->> - Generate 1990-future netcdf ghg datasets (Lawrence, Gary) ->> + Remove include file and data statement, add a dataset (Tom) ->> + Verify ghg code calls endrun if year outside dataset for ramped ->> usage (Tom) ->> + Implement in source code ability to use new namelist convention ->> (bndtvghg) (Tom) ->> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) ->> - Verify correct datasets and namelist in CAM scripts (Lawrence, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana, Lawrence) ->> Namelist ->> f11vmr (won't be used) ->> f12vmr (won't be used) ->> co2vmr (won't be used) ->> ch4vmr (won't be used) ->> n2ovmr (won't be used) ->> scenario_ghg (RAMPED) ->> rampYear_ghg ->> bndtvghg ->> trace_gas ->> read_trace ->> ->> Volcanics ->> . one field, mvolc(x,y,z,t), 1 sample per month ->> . flexible time interpolation, won't handle years outside dataset bounds ->> . turned off by default ->> . should be on for historicals only, datafile for 1870-2000 ->> . will do spatial interpolation ->> Tasks ->> + Generate 1870-2000 dataset and review for historical runs, make ->> sure volcanics go to 0.0 at edges of dataset, make sure model ->> calls endrun if strat_volc=true and date is outside bounds of ->> dataset (Andrew, Caspar) ->> + Move datasets to inputdata and verify naming convention (Andrew) ->> - Verify correct datasets and namelist in CAM scripts (Andrew, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana) ->> Namelist ->> strat_volc = .true. ->> bndtvvolc = 'dataset' ->> ->> Sulfate ->> . three different tracers in three datasets, dms, oxidants, sox ->> . dms is f(x,y,t), seasonal cycle with 12 time samples ->> . oxidants is f(x,y,z,t) seasonal cycle with 12 time samples ->> . dms and oxidants are seasonally repeating, not a function of "year" ->> . sox(x,y,2,t) is 4 samples/year, varying over different years ->> . sox time interpolation works fine, no extrapolation currently ->> . dataset must be generated on CAM grid ->> . REQUIRES pcnst = pcnst+4 (not 3) ->> . historical and future will use ramped feature with time varying data ->> . 1870 run will use ramped feature with rampyear_prognostic_sulfur set to ->> 1870 ->> . some sort of huge(int) intrinsic value needs to be default for rampyear ->> Tasks ->> + Design new namelist, prescribed_sulfur and prognostic_sulfur ->> and usage/features (Bill, Andrew, Phil) ->> + Remove dead namelist, aero_sulfur, aero_feedback_sulfur, implement new ->> namelist and features (see below) (Andrew and Dani) ->> + Remove (3) old dataset namelist (dms_emis, oxid, sox_emis) and add ->> (3) new dataset namelists (see below) (Dani) ->> + Verify endrun is called if date outside sox datasets (Dani) ->> + Generate 1870-2000 sox dataset for T85 (Dani, Gary) ->> + Generate future datasets for sulfur (Dani, Lawrence, Gary) ->> + Move all datasets to inputdata and verify naming convention ->> (Andrew, Dani) ->> - Verify correct datasets and namelist in CAM scripts (Andrew, Dani, Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana) ->> Namelist ->> bndtvdms ->> bndtvoxid ->> bndtvsox ->> scenario_prescribed_sulfur (FIXED (DEFAULT), RAMPED) ->> rampyear_prescribed_sulfur ->> prescribed_sulfur (off, passive, direct (DEFAULT)) ->> scenario_prognostic_sulfur (FIXED (DEFAULT), RAMPED) ->> rampyear_prognostic_sulfur ->> prognostic_sulfur (off (DEFAULT), passive, direct) ->> ->> Ozone ->> . ozone function of (x,y,z,t) with seasonal cycle ->> . use T42 dataset with monthly data, 1870-2000, (850Mb) ->> . ozone dataset not CAM grid dependent, does space interpolation ->> . for 1870, use 1870 only dataset with cycling set to true ->> . for historical, use 1870-2000 with cycling set to false ->> . for future, use 2000 dataset with cycling set to true ->> . tropopause consistency issue ->> . defer namelist changes ->> Tasks ->> - Generate 1870-2000 monthly dataset on T42, spoof to 1870 (Lawrence) ->> - Generate 1870 and 2000 cycling datasets (Lawrence) ->> - Create, review, and validate datasets, dataset continuity between ->> 1870 cycling dataset, 1870-2000 dataset, 2000 cycling dataset (Lawrence) ->> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) ->> - Verify correct datasets and namelist in CAM scripts (Tom) ->> + Implement changes to CCSM scripts as needed (Tony, Mariana) ->> Namelist ->> bndtvo ->> ozncyc ->> ->> ------------------------------- ->> ->> Tony will monitor overall task progress ->> Tom will collect code mods and CAM script mods and coordinate checkin ->> Tony will coordinate changes in CCSM scripts ->> ->> ------------------------------- ->> ->> Use Cases: ->> ->> 1990 control - runs out of the box without above turned on, ->> this is not the same as historical run at 1990 or 1990 control ->> done similar to 1870. use pcnst = 3 ->> ->> (no source code mods required to switch between 1870, 1990, ->> historical, future cases below, pcnst = 11 for all cases) ->> ->> 1870 control, pcnst = 11 in build, standard namelist plus, ->> X means not needed or current default inside model (included ->> for clarity) ->> ->> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc ->> X scenario_carbon_scale = 'FIXED' ->> carscl = 0.3 ->> X bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc ->> scenario_scon = 'RAMPED' ->> rampYear_scon = 1870 ->> bndtvscon = *.nc (1870-2005 dataset TBD) ->> scenario_ghg = 'RAMPED' ->> rampYear_ghg = 1870 ->> bndtvghg = ghg_1870_2100_c040122.nc ->> trace_gas = .true. ->> read_trace = .false. ->> X strat_volcanic = .false. ->> X bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc ->> bndtvdms = DMS_emissions_128x256_clim_c040122.nc ->> bndtvoxid = oxid_128x256_L26_clim_c040112.nc ->> bndtvsox = SOx_emissions_128x256_L2_c040109.nc ->> scenario_prescribed_sulfur = 'FIXED' ->> prescribed_sulfur = 'passive' ->> scenario_prognostic_sulfur = 'RAMPED' ->> rampYear_prognostic_sulfur = 1870 ->> prognostic_sulfur = 'direct' ->> X ozncyc = .true. ->> bndtvo = *.nc (1870 dataset) ->> ->> historical (1870-2000), hybrid startup at year 1870, run to 2000 ->> pcnst = 11 in build, set namelist as follows, X means not needed or ->> current default, * indicate changes from 1870 control ->> ->> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc ->> * scenario_carbon_scale = 'RAMPED' ->> *X carscl (remove) ->> bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc ->> scenario_scon = 'RAMPED' ->> *X rampYear_scon (remove) ->> bndtvscon = *.nc (1870-2005 dataset TBD) ->> scenario_ghg = 'RAMPED' ->> *X rampYear_ghg (remove) ->> bndtvghg = ghg_1870_2100_c040122.nc ->> trace_gas = .true. ->> * strat_volcanic = .true. ->> bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc ->> bndtvdms = DMS_emissions_128x256_clim_c040122.nc ->> bndtvoxid = oxid_128x256_L26_clim_c040112.nc ->> bndtvsox = SOx_emissions_128x256_L2_c040109.nc ->> scenario_prescribed_sulfur = 'FIXED' ->> prescribed_sulfur = 'passive' ->> scenario_prognostic_sulfur = 'RAMPED' ->> * rampYear_prognostic_sulfur = (remove) ->> prognostic_sulfur = 'direct' ->> * ozncyc = .false. ->> * bndtvo = *.nc (1870-2000 dataset TBD) ->> ->> future (1990-), hybrid startup at year 1990 from historical 1990, ->> pcnst = 11 in build, set namelist as follows, X means not needed or ->> current default, * indicate change from historical run ->> ->> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc ->> *X scenario_carbon_scale = 'FIXED' ->> *X carscl = 1.0 ->> X bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc ->> scenario_scon = 'RAMPED' ->> * rampYear_scon = 2005 ->> bndtvscon = *.nc (1870-2006 dataset TBD) ->> scenario_ghg = 'RAMPED' ->> X rampYear_ghg (remove) ->> * bndtvghg = *.nc (future dataset TBD) ->> trace_gas = .true. ->> *X strat_volcanic = .false. ->> X bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc ->> bndtvdms = DMS_emissions_128x256_clim_c040122.nc ->> bndtvoxid = oxid_128x256_L26_clim_c040112.nc ->> bndtvsox = SOX_T85_future ->> scenario_prescribed_sulfur = 'FIXED' ->> prescribed_sulfur = 'passive' ->> scenario_prognostic_sulfur = 'RAMPED' ->> prognostic_sulfur = 'direct' ->> *X ozncyc = .true. ->> * bndtvo = *.nc (2000 dataset TBD) ->> ->> --------------------------------- ->> ->> Available (and validated) Datasets: ->> ->> bndtvaer: (rad dir) ->> AerosolMass_V_128x256_clim_c031022.nc T85 ->> AerosolMass_V_64x128_clim_c031022.nc T42 ->> AerosolMass_V_48x96_clim_c031022.nc T31 ->> AerosolMass_V_2x2.5_clim_c031022.nc 2x2.5 ->> ->> bndtvdms: (scyc dir) ->> DMS_emissions_64x128_c030722.nc T42 ->> DMS_emissions_128x256_clim_c040122.nc T85 ->> ->> bndtvoxid: (scyc dir) ->> oxid_3d_64x128_L26_c030722.nc T42 ->> oxid_128x256_L26_clim_c040112.nc T85 ->> ->> bndtvsox: (scyc dir) ->> SOx_emissions_64x128_L2_c031219.nc T42 (1870+historical) ->> - T42 (A1) ->> - T42 (A2) ->> - T42 (B1) ->> - T42 (B2) ->> SOx_emissions_128x256_L2_c040109.nc T85 (1870+historical) ->> SOx_emissions_A1_128x256_L26_1990-2100_c030121.nc T85 (A1) ->> SOx_emissions_A2_128x256_L26_1990-2100_c030121.nc T85 (A2) ->> SOx_emissions_B1_128x256_L26_1990-2100_c030121.nc T85 (B1) ->> SOx_emissions_B2_128x256_L26_1990-2100_c030121.nc T85 (B2) ->> ->> bndtvo: (ozone dir) ->> pcmdio3.r8.64x1_L60_clim_c970515.nc (present day cycling ->> dataset) ->> - (1870 cycling) ->> - (1870-2000) ->> - (2000 cycling) ->> ->> bndtvvolc: (rad dir) ->> VolcanicMass_1870-1999_64x1_L18_c040115.nc (1870-2000 dataset) ->> ->> bndtvcarbonscale: (rad dir) ->> carbonscaling_1870-1999_c040114.nc (1870-2000 dataset) ->> ->> bndtvscon: (rad dir) ->> scon_1870_2100_c040122.nc (CAM default, do not ->> use) ->> - (1870-2006 dataset) ->> ->> bndtvghg: (ggas dir) ->> ghg_1870_2100_c040122.nc (CAM default, ->> 1870+historical) ->> - (A1) ->> - (A2) ->> - (B1) ->> - (B2) - -=============================================================== -=============================================================== - -cam2_0_2_dev61 -Originator: mirin ( Arthur Andrew Mirin) -Date: Wed Jan 14 11:51:56 MST 2004 -Model: CAM -Version: CAM2.0_2.dev61 -One-line Summary: Finite Volume and Transpose Improvements (2 of 2) -This is the second of two successive archive updates. The only changed -routine is dynamics/fv/geopk.F90. Due to reordering of computations, -there are roundoff differences. - -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer -Restart files change: no -Changes answers: Yes (same to roundoff for FV), EUL and SLD are bit-for-bit. -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -Reordering of computations in FV geopk.F90 causes roundoff changes. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev60 -Originator: mirin ( Arthur Andrew Mirin) -Date: Wed Jan 14 11:39:22 MST 2004 -Model: CAM -Version: CAM2.0_2.dev60 -One-line Summary: Finite Volume and transpose improvements (1 of 2) -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes -Mprun2d namelist no longer exists; relevant variables in CAMEXP namelist. -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer, Eaton -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -This is the first of two successive archive updates. These changes are -bit-fot-bit. - -Summary of changes: - -Removal of mprun2d namelist. This involved creating routines -spmd_dyn_defaultopts and spmd_dyn_setopts with optional arguments. I -mimicked the procedure in phys_grid.F90. In runtime_opts.F90 I put -"dycore_is" test around the calls, and I created dummy versions in -dynamics/eul and dynamics/sld. The initial dummy versions were just -subroutine and end statements, with no arguments. However, the code would -not compile; there were complaints about inaccessible routines and -needing explicit interfaces with optional arguments. I ended up putting -'public' declarations in the EUL and SLD versions and using the same -argument list as with the FV version. (I think the key problem was the -argument list more than the public declaration.) I know it is our -intention to have different versions (with different arguments) of these -routines for the different dycores, but that clearly didn't work; the -present solution is out of expediency. I suspect that the fact that the -arguments are optional is central to the problem. I used optional -arguments only because that is what was done in phys_grid.F90. Also, one -of the namelist variables (modcomm_method) will eventually apply outside -of FV once we use mod_comm transposes outside of FV, so it will -eventually have to be moved or replicated. - -Single coding path for 1-D and 2-D decompositions for FV dycore. TWOD_YZ -ifdef eliminated. The "xy" variables are always invoked (e.g., ptxy). The -twod_decomp variable now refers to whether or not transposes (versus -copies) are called to go between yz and xy decompositions; naturally -copies are relevant only for 1-D decomposition; for debugging purposes, -one can force transposes even with 1-D decomposition (see new namelist -variable force_2d). Also, there is a new FV runtime diagnostic (not -input) variable (called spmd_on) that indicates SPMD versus non-SPMD. - -Method for FV transposes now runtime rather than compile time (although -the choice between ordinary MPI and MPI-2 is still compile-time). For -ordinary MPI, the choice is between invoking temporary contiguous buffers -versus using MPI derived types. The relevant namelist variable is -modcomm_method (0 for contiguous buffers, 1 for derived types (default)). -MPI-2 presently has 4 options (0,1(default),2,3) (options 0,1,2 use -contiguous buffer at target; 0 is for contiguous source buffers; 1 is for -direct MPI_put's of contiguous segments, with threading over the -segments; 2 is for MPI derived types at the source with threading over -target; option 3 is for MPI derived types at source and target, with -threading over target; option 3 involves re-definition of windows and is -probably not optimal). For MPI-2, one specifies "USE_MPI2" precompile -flag when configuring. - -New configure option "-precomp ", where string is a non-empty -list of precompile flags to be placed in misc.h. For example, one can -specify "-precomp USE_MPI2" for MPI-2 mod_comm transposes. - -Option to use nested OpenMP constructs for FV dycore on IBM. This must be -specified at compile time using new configure option "-nested_omp"; this -has effect on misc.h and the Makefile. In sw_core.F90 and tp_core.F90 -(which are already threaded with respect to z), latitude loops are -threaded. The number of inner threads is the new namelist variable -"ompnest", which must divide evenly into the total number of threads; the -number of outer threads will be the total number of threads divided by -"ompnest". IBM's implementation is non-standard. - -Option to use mod_comm for dynamics/physics transposes when using -load-balanced chunking. In phys_grid.F90, the "alltoall" flag is replaced -by new namelist variable "phys_transpose" (1 for original alltoall -(default), 2 for Pat Worley's send_and_receive, 3 for mod_comm). Because -mod_comm is presently compiled and linked only for FV, the mod_comm -option is presently valid only for FV; it must be activated at compile -time with the MODCM_DP_TRANSPOSE if-def (use precomp option in -configure). - -Miscellaneous transpose improvements and code cleaning. - -Deletion of configure_fv.pl and script.m4. - -I also created the necessary surface data and aerosol files to support -the FV 0.5x0.625 resolution. The CAM and CLM default namelists were -updated accordingly. This required updating -tools/interpaerosols/REGRID.pl as well. - -***************************************************************** -With the removal of the TWOD_YZ if-def and mprun2d namelist, the -interactive configuration procedure no longer queries for the 2-D -decompositions, and test-model contains no references to 2-D -decompositions. The validity of 2-D decompositions is checked in -spmd_dyn.F90. To impart 2-D decompositions in test-model, one needs to -set the camexp namelist accordingly. A decision needs to be made on which -decompositions are to be used, and the necessary changes must be made in -the namelist specification. -***************************************************************** - -Changed files: - -utils/pilgrim: mod_comm.F90, mod_irreg.F90, parutilitiesmodule.F90 - -bld: CAM_config.pm, CAM_namelist.pm, CAM_run.pm, configure, Makefile, -DefaultCAMEXPNamelist.xml, DefaultCLMEXPNamelist.xml, -config_cache_defaults.xml, mprun2d.pm (deleted), configure_fv.pl -(deleted), script.m4 (deleted) - -test/system: CAM_test.pm, test-model.pl - -tools/interpaerosols: REGRID.pl - -src/physics/cam1: phys_grid.F90 - -src/control: cam.F90, history.F90, runtime_opts.F90 - -src/dynamics/fv: cd_core.F90, d2a3dijk.F90, d2a3dikj.F90, -dp_coupling.F90, dyn_grid.F90, dynamics_vars.F90, dynpkg.F90, geopk.F90, -pmgrid.F90, spmd_dyn.F90, stepon.F90, sw_core.F90, te_map.F90, -tp_core.F90, trac2d.F90, uv3s_update.F90 - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== -cam2_0_2_dev59 -Originator: mvertens ( Mariana Vertenstein) -Date: Thu Jan 8 13:52:37 MST 2004 -Model: CAM -Version: CAM2.0_2.dev59 -One-line Summary: updated clm code to clm3_deva_01 (vector version of clm) - Requires change in build system: no (see below) - ecosysdyn/ is no longer needed in clm Filepath (will not - trigger error if it is there) -Substantial timing or memory changes: Yes (describe) - 3-5% performance improvement should be obtained -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Forrest Hoffman, Dave Parks, Keith Oleson -Restart files change: yes (for clm) - Backwards compatilibity with older restart files have been incorporated -Changes answers: Yes (same-climate) -Changes to CLM land-model: Yes (see below) -Have you filled out the pre-check-in documentation as required by the CAM CRB? no, I plan to. -Changes made: -1) Updated the clm code to clm3_dev_01 (the vector version of clm). - Both offline and cam-clm stand-alone runs showed that the new code - resulted in the same climate. For the cam-clm validation diagnostic - results see: - http://www.cgd.ucar.edu/tss/clm/diagnostics/cam_clm2/cam202d39clm2d47a-cam202d39clm2d36a/sets.htm -2) Modified models/atm/cam/bld/configure to removed ecosysdyn/ from - the clm filepath. -=============================================================== -=============================================================== - -cam2_0_2_dev58 -Originator: aconley ( Andrew J. Conley) -Date: Wed Jan 7 13:53:42 MST 2004 -Model: CAM -Version: CAM2.0_2.dev58 -One-line Summary: added volcanic aerosols and population based carbonaceous aerosol scaling -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes (same-to-roundoff, same-physics) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? no, I plan to. -Changes made: -New documentation: -UG-20.html -UG-20a.html -UG-27.html -UG-45.html -table_of_contents.html - -addition of filenames for volcanic mass, new optics, and population data -as well as namelist variables for strat_volcanic and carbon_by_pop -filenames.F90 -DefaultCAMEXPNamelist.xml -camexp.pm -runtime_opts.F90 - -advnce.F90 initialization for volcanics and population - -aer_optics.F90 added volcanic optics -aerosols.F90 added massfields for volcanics -volcanicmass.F90 (new file) read, interpolate volcanic masses -radctl.F90 added diagnostics for volcanic masses and effects of volcanics - -radcswmx.F90 added volcanic mass shortwave effects - - -Added effects of volcanics -radclwmx.F90 -radae.F90 -trcab.F90 -trcabn.F90 -trcems.F90 -volcrad.F90 (new file) - -Population.F90 (new file) read population history and provide carbonaceous aerosol scaling factor based on population - -New data files -bndtvvolc: historical masses from volcanic eruptions -bndtvpop: estimates of global total population - -appended new volcanic shortwave optics to aeroptics - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev57 -Originator: mvr ( Mathew Rothstein) -Date: Fri Jan 2 12:03:34 MST 2004 -Model: CAM -Version: CAM2.0_2.dev57 -One-line Summary: Upgrade CSM share; Upgrade ESMF; Add namelist option brnch_retain_casename; Update ccsm_msg to remove chunks and knuhcs; caseid now length 80; Remove goto from aerosols.F90. -cam-bugs Requests resolved: none -Requires change in build system: yes --references to directory csm_share now point to csm_share/shr -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux (Lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, tcraig, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -- Updated ESMF to ESMF0_0_4 -- Updated CSM_SHARE to share3_0_2 -- added function get_chunk_owner_p in src/physics/cam1/phys_grid.F90: returns - the owner of a chunk given the lat, lon -- modified bld/configure: references to directory csm_share now point to - csm_share/shr -- modified bld/configure_fv.pl: references to directory csm_share now point - to csm_share/shr -- modified src/control/ccsm_msg.F90: utilize new function get_chunk_owner_p - rather than vars chunks, knuhcs -- modified src/control/filenames.F90: modified length of caseid to 80 from 33; - now using shr_kind_cs and shr_kind_cl for strings of length 80 and 256; - defined new namelist var brnch_retain_casename -- modified src/control/restart.F90: modified var tcase to same length as - caseid (shr_kind_cs); implemented new namelist var brnch_retain_casename to - allow branch runs without a change in casename -- modified src/control/runtime_opts.F90: added var brnch_retain_casename to - namelist camexp -- modified src/physics/cam1/phys_grid.F90: added new function - get_chunk_owner_p -- modified src/physics/cam1/aerosols.F90: replaced "goto" statement with code - friendlier to compiler optimization -- updated users guide to reflect new namelist option - -=============================================================== -=============================================================== - -cam2_0_2_dev56 -Originator: rosinski ( Jim Rosinski) -Date: Mon Dec 29 15:35:44 MST 2003 -Model: CAM -Version: CAM2.0_2.dev56 -One-line Summary: Enable restarting coupled model from dev51 restart file. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes (done by mvertens) -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes (in coupled mode they now look like dev51 restart files) -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Modified coupled-mode CAM restart file to be identical to dev51. -o NOTE: Standalone and SOM restart files are NOT the same. - -=============================================================== -=============================================================== - -cam2_0_2_dev55 -Originator: jmccaa ( James McCaa) -Date: Mon Dec 22 14:11:07 MST 2003 -Model: CAM -Version: CAM2.0_2.dev55 -One-line Summary: Tuning mods for finite volume 2x2.5. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes - new-climate for FV -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -Model parameters have been adjusted for runs using the finite volume -dycore. Changes occurred in the following routines: -cldwat.F90 -cloud_fraction.F90 -gw_drag.F90 -vertical_diffusion.F90 -moistconvection.F90 -zm_conv.F90 - -The turbulence mountain stress parameterization is now turned off. Also, -the parameters governing gravity wave drag are now the same for FV as for -the spectral dycores. - -=============================================================== -=============================================================== - -cam2_0_2_dev54 -Originator: pworley ( Patrick H Worley) -Date: Thu Dec 18 09:27:25 MST 2003 -Model: CAM -Version: CAM2.0_2.dev54 -One-line Summary: Improved existing and added SMP-aware physics load balancing schemes -cam-bugs Requests resolved: none -Requires change in build system: maybe -To exploit alternative EUL and SLD latitude decomposition, need to add -DMIRROR_DECOMP to Makefile -Substantial timing or memory changes: Yes - benchmarks by Rory Kelley indicate that new opt=0 load balancing improves performance -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC cluster -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Tom Henderson -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -1) Added Henderson, et al's modification to call spmdinit_dyn after runtime_options, - so that future modifications can use namelist input to decide how to decompose - dynamics data structures. - added: control/decompinit.F90 - modified: control/cam.F90, control/spmdinit.F90 -2) Added Henderson, et al's modification to move duplicate code (ceil_2, pair) - to a new spmd_util module. - added: control/spmd_utils.F90 - modified: dynamics/eul - realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 - dynamics/sld - realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 - physics/cam1 - phys_grid.F90 -3) Determined number of SMPs and process/SMP map. For EUL and SLD, equidistributed extra - latitudes (when mod(NLAT/npes) /= 0) over the SMPs. (This is useful when using option 1 - load balancing. See below.) - modified: control/spmdinit.F90, dynamics/eul/spmd_dyn.F90, dynamics/sld/spmd_dyn.F90, - dynamics/fv/spmd_dyn.F90 -4) For EUL and SLD, added an option to assign latitudes to processes so that southern - hemisphere latitudes and their "mirrors" in the northern hemisphere are assigned - to consecutive processes. This is useful when using load balancing options 1 and 3 (see below). - Currently, this is a compile time option. It will be changed to a runtime option - in the near future. To enable now, the CPP token MIRROR_DECOMP must be added to the - FPPFLAGS in the Makefile. - modified: dynamics/eul - spmd_dyn.F90, bndexch.F90; dynamics/sld - spmd_dyn.F90, bndexch.F90 -5) Redesigned load balancing options and implementation. The new options are - -1: each latitude line is a single chunk, same as 1D dynamics decompositions. - (UNCHANGED) - 0: split local longitude/latitude blocks into chunks, - while attempting to create load-balanced chunks. - (IMPROVED) - 1: split SMP-local longitude/latitude blocks into chunks, - while attempting to create load-balanced chunks. - (NEW) - 2: load balance chunks with respect to diurnal and - seaonsal cycles and wth respect to latitude, - and assign chunks to processor - in a way that attempts to minimize communication costs - (UNCHANGED) - 3: load balance chunks with respect to diurnal and - seasonal cycles (but not latitude), and assign chunks to - processor in a way that attempts to minimize communication - costs - (NEW) - - The implementation was significantly modified. The heuristic for - load balancing is now identical for options 0-3. The only difference - between the options is which processes are allowed to communicate - when load balancing.` - - Performance comparisons on the IBM indicate that the new option 0 is an improvement - over the old option 0. The other options (especially option 3) are now - competitive with option 0, but are not noticeably better. These results are for T85L26 - on 128 processors of Bluesky, and different results may hold on other systems or - for other problem sizes. - - modified: physics/cam1/phys_grid.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev53 -Originator: hender ( Tom Henderson) -Date: Mon Dec 15 11:55:00 MST 2003 -Model: CAM -Version: CAM2.0_2.dev53 -One-line Summary: Improve and extend prototype of new run-time options module. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, anchorage-lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton. Design reviewed by Eaton and Rosinski -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: -Files removed: -models/atm/cam/src/control/comhd.h -models/atm/cam/src/control/parse_namelist.F90 -models/atm/cam/src/control/preset.F90 - -Files added: -models/atm/cam/src/control/comhd.F90 -models/atm/cam/src/control/runtime_opts.F90 - -Files Modified: -models/atm/cam/src/dynamics/eul/courlim.F90 -models/atm/cam/src/dynamics/eul/grcalc.F90 -models/atm/cam/src/dynamics/eul/hdinti.F90 -models/atm/cam/src/dynamics/eul/hordif.F90 -models/atm/cam/src/dynamics/eul/spegrd.F90 -models/atm/cam/src/dynamics/sld/courlim.F90 -models/atm/cam/src/dynamics/sld/grcalc.F90 -models/atm/cam/src/dynamics/sld/hdinti.F90 -models/atm/cam/src/dynamics/sld/hordif.F90 -models/atm/cam/src/dynamics/sld/spegrd.F90 -models/atm/cam/src/physics/cam1/aerosol_intr.F90 -models/atm/cam/src/physics/cam1/phys_grid.F90 -models/atm/cam/src/control/cam.F90 -models/atm/cam/src/control/history.F90 - - - -=============================================================== -=============================================================== - -cam2_0_2_dev52 -Originator: rosinski ( Jim Rosinski) and John Truesdale -Date: Fri Dec 12 15:56:44 MST 2003 -Model: CAM -Version: CAM2.0_2.dev52 -One-line Summary: Improve handling of surface fractions, especially in coupled mode (SOM and CCSM) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Rosinski, Truesdale -Restart files change: yes -Changes answers: no (bit-for-bit) except SOM which is roundoff. There is a #define in somoce.F90 - that if defined will make SOM bfb. If the "puny" criterion of ice_srf.F90 is - ever met (aice <= puny = 1.e-12) then there is a possibility that prescribed-ice - mode could be good only to roundoff, but we were unable to generate such a case. -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Install a more permanent fix to erroneous surface fraction calculations -than the quick fix of dev50. The original bug which dev50 addressed was that -surface fractions were being changed in an incorrect way by calls to -update_srf_fractions in coupled mode (both SOM and CCSM). At various points -during a timestep, variable ICEFRAC contained either ice fraction of the grid -box or ice fraction of the non-land portion of the grid box. Routine -update_srf_fractions implicity assumed it was being called to convert a -non-land fraction into a grid box fraction. In coupled mode, -update_srf_fractions was being called by ccsmrcv every timestep after -receiving surface fraction information from the coupler. Since ICEFRAC held -ice fraction of the grid box at this point, an erroneous calculation thus -resulted. The dev50 quick fix was to install ifdefs around the ICEFRAC -recomputation in update_srf_fractions. In the more permanent fix, array AICE -always represents ice fraction of the non-land portion of the grid box, and -ICEFRAC always represents the ice fraction of the entire grid box. - -The updating of surface fractions and verifying their validity is now -segregated into two subroutines, comsrf.F90 routines update_ocnice and -verify_fractions, respectively. ccsm_msg.F90 routines ccsmrcv and -ccsm_msg_getalb now call verify_fractions, instead of a routine which will -actually change the surface fractions. If update_ocnice is ever called in -coupled mode it will result in an endrun() call. Instead, ccsmrcv and -ccsm_msg_getalb now contain explicit code to compute new fractions -(correctly) rather than make calls to update_ocnice. This resetting should -be unnecessary, but was retained to obtain bit-for-bit reproducibility with -earlier libraries and to avoid concerns about restartability. We believe the -calls to update_srf_fractions were originally installed to address bizarre -restartability issues in the coupled model. Ultimately the recomputation of -fractional information (especially landfrac every timestep) should be removed -from these routines. These spots are currently delimited with "bit-for-bit" -comments. - -For further details see details on the CAM checkin list. -=============================================================== -=============================================================== - -cam2_0_2_dev51 -Originator: mvr ( Mathew Rothstein) -Date: Mon Dec 8 11:29:27 MST 2003 -Model: CAM -Version: CAM2.0_2.dev51 -One-line Summary: add -Q to Makefile for IBM, added XLSMPOPTS back into run-ibm.csh -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, hender -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - ->> Makefile: ->> Add "-Q" for ~1% speedup. ->> ->> run-ibm.csh: ->> Add XLSMPOPTS do avoid thread-stack limits that cause seg-fault when ->> prognostic sulfates, carbon, sea salt, and dust are all turned on. ->> ->> ## suggestion from Jim Edwards to reintroduce XLSMPOPTS on 11/13/03 ->> setenv XLSMPOPTS "stack=256000000" - -=============================================================== -=============================================================== - -cam2_0_2_dev50 -Originator: jmccaa ( James Mccaa) -Date: Wed Dec 3 15:35:26 MST 2003 -Model: CAM -Version: CAM2.0_2.dev50 -One-line Summary: Small change to prevent CAM from incorrectly modifying sea ice fractions in SOM/CCSM mode. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -A small change was made to comsrf.F90 to prevent CAM from incorrectly -modifying sea ice fractions in SOM/CCSM mode. This corrects an error -introduced in dev47, and therefore the tags dev47, dev48, and dev49 -should not be used for SOM or CCSM runs. - -=============================================================== -=============================================================== - -cam2_0_2_dev49 -Originator: hender ( Tom Henderson) -Date: Tue Nov 18 12:26:08 MST 2003 -Model: CAM -Version: CAM2.0_2.dev49 -One-line Summary: New T85 surface data set with pre-computed fields, fixed SST data sets at T85 and T170, T85 tuning. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -- Modified DefaultCLMEXPNamelist.xml to point to new T85 surface data set from - Jim McCaa. This data set contains pre-computed surface fields and cuts more - than 10 minutes off of T85 initialization. - -- Modified DefaultCAMEXPNamelist.xml to point to new climatological sst files - for T85 and T170 from Jim McCaa. - Details from Jim McCaa: - On Fri, 31 Oct 2003, Jim McCaa wrote: -> These two files are intended to replace broken climatological sst files for -> T85 and T170, respectively, in /fs/cgd/csm/inputdata/atm/cam2/sst. -> -> /fs/cgd/data0/jmccaa/sst_HadOIBl_bc_128x256_clim_c031031.nc -> /fs/cgd/data0/jmccaa/sst_HadOIBl_bc_256x512_clim_c031031.nc -> -> -> The defaults xml file should be updated to point to these new files, -> replacing> any entries pointing to either of -> /fs/cgd/csm/inputdata/atm/cam2/sst/sst_HadOIBl_bc_128x256_clim_c020812.nc -> /fs/cgd/csm/inputdata/atm/cam2/sst/sst_HadOIBl_bc_256x512_clim_c020812.nc -> -> This will primarily affect anyone trying to run Jim R.'s defineqflux -> program, -> i.e. anyone trying to set up a T85 or T170 SOM run. -> -> I produces these new files using the old ones and the command: -> ncks -d time,0,11 - -- T85 tuning in cloud_fraction.F90 from Jim McCaa: -49c49 -< rhminl = .92 ---- -> rhminl = .91 - - -=============================================================== -=============================================================== - -cam2_0_2_dev48 -Originator: rosinski ( Jim Rosinski) -Date: Tue Nov 11 09:12:51 MST 2003 -Model: CAM -Version: CAM2_0_2_dev48 -One-line Summary: Save memory in aerosol code by holding in-core only 2 time levels of data. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes. per MPI task memory saved @ T42 = 190 MB/ntask -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit), except only roundoff under PC/pgf90 -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Revised aerosol reading to be like SST and ozone, keeping in-core only 2 - time levels of data to save memory. Initialization should speed up lots, - since 2 time levels of aerosol data are read in instead of 12. - - It is now feasible from a memory use standpoint to run T85 using 2 MPI - tasks on a machine with 2 GB of memory. - - BYPASS ifdef was removed since the speedup renders it unnecessary. - - Minor mods were made to sst and ozone interpolation routines for clarity - and consistency. - - There are still some differences between the new code and ozone/SST - handling. There is no "aercyc = .false." namelist option. Date info is - gotten from an internal Fortran "data" statement rather than read from a - boundary dataset. Existing routine "aerosol_initialize" takes the role of - what otherwise would be called "aerini" (instead of being named like - "sstini" and "oznini"), and is called from "inti" instead of "initext". - There is a new routine "aerint" in aerosols.F90 a la "sstint" and "oznint" - which is called from "advnce". Like these routines it reads in a new time - slice of data when needed. But the actual time interpolation is done in - "get_aerosol". The reasons for these differences have mainly to do with - maintaining minimal intrusiveness, and the fact that there are plans - to modify the way time and vertical interpolation of aerosols is done. - - -=============================================================== -=============================================================== - -cam2_0_2_dev47 -Originator: jet ( John Truesdale) -Date: Wed Nov 5 15:41:05 MST 2003 -Model: CAM -Version: CAM2.0_2.dev47 -One-line Summary: cam usage of boundary dataset ice fraction made consistant with HADISST data. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no - -Substantial timing or memory changes: no -Requires change in run script: no - -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: yes. Ice extent is now reduced around land. - -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -After computing the ice area of the original datasets and comparing it to -the ice area produced by our t42 model, it became apparent that CAM was -over estimating the ice area. The ice fraction on the boundary dataset was -intrepreted as being the fraction of ice covering an entire gridbox. A more -accurate way of determining the ice coverage is to regard the boundary -dataset ice fraction as the fraction of ice covering the *non-land* portion -of the grid box. So - -gridbox ice fraction = boundary dataset ice fraction * (1-land fraction) - -The ice area produced by cam with this change is now very close to the -original datasets and to the ice area produced by CSM. The overall effect -is a reduction of ice coverage in those grid boxes with some land fraction. - -This change is a one line mod to comsrf.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev46 -Originator: pworley ( Patrick H Worley) -Date: Tue Nov 4 15:26:37 MST 2003 -Model: CAM -Version: CAM2.0_2.dev46 -One-line Summary: Decreased memory requirements in dynamics/eul/inidat and added new load balancing scheme to phys_grid (same as dev39). -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes - decreased number of full 3D fields needed in inidat from 9+(pcnst+pnats) to 4 -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Linux cluster -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes (same as dev39) -Changes made: - - The cam2_0_2_dev39 commit failed (on Sep. 29, 2003). This commit reintroduces those changes. - The following is identical to the dev39 documentation ... - - 1) restructured dynamics/eul/inidat.F90 to minimize the memory requirements. - In the original version, masterproc allocates (9+pcnst+pnats) 3D fields - and 16 2D fields. It then reads in or generates the initial data, - scatters the data, and finally deallocates the arrays. In the revised - version, subsets of arrays are allocated, initialized, scattered, and - deallocated together, decreasing the maximum memory requirements to 4 3D fields. - Note that I implemented the logic that Brian Eaton used in FV inidat (for WACCM) - to treat each species in q3 separately. - - 2) added a new load balancing algorithm in physics/cam1/phys_grid.F90. - The original global balancing algorithm (opt = 1) eliminates - imbalances due to the diurnal and seasonal cycles. However, it still - assigns all polar latitdues to the same processors, the mid-latitudes - to the same processors, and the equatorial latitudes to the same processors. - The new algorithm (opt = 2) mixes up the latitudes as well, achieving - almost perfect load balance. It comes at a cost of increased communication cost - compared to opt = 1, and may or may not be a performance enhancer for - a given system, problem size, and processor count. - - 3) added an option to physics/cam1/phys_grid.F90 to implement the transpose_block_to_chunk - and transpose_chunk_to_block routines using point-to-point MPI commands rather - than mpi_alltoallv. This has been important on some systems in the past, - and is included here as an aid to experimentation. This option is currently - disabled in the code. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev45 -Originator: hender ( Tom Henderson) -Date: Fri Oct 31 11:24:43 MST 2003 -Model: CAM -Version: CAM2.0_2.dev45 -One-line Summary: Performance optimization for IBM. -cam-bugs Requests resolved: none -Requires change in build system: yes -Fortran compiler optimization for IBM "xlf90" has changed from -"-O2 -qmaxmem=-1 -Q" to "-O3 -qstrict". The "-lmass" library is now -linked in unless DEBUG is on. -Substantial timing or memory changes: yes, it runs ~5% faster. -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Linux-lf95 -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Jim McCaa -Restart files change: no -Changes answers: Yes, same-physics -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Changed optimization in Makefile for IBM. -Changed "sanity checks" in pcond() (cldwat.F90) to make IBM compiler -happy (bfb). -Changed "rliq1 sanity check" in pcond() (cldwat.F90) to use Jim McCaa's -fix (bfb). - -=============================================================== -=============================================================== - -cam2_0_2_dev44 -Originator: jmccaa ( James McCaa) -Date: Fri Oct 31 09:48:06 MST 2003 -Model: CAM -Version: CAM2.0_2.dev44 -One-line Summary: T85 tuning, removal of many default history file fields, modification of dif4 initialization. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit at all resolutions except T85) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -This tag supplies three changes to the model: - -1) The tuning of the T85 Eulerian model has been modified through the - addition of the relative humidity cloud threshold ramp in - cloud_fraction.F90. Tuning parameters were also modified in - zm_conv.F90, moistconvection.F90, and cldwat.F90. - -2) The number of fields on the default monthly history files has been - reduced substantially. All fields continue to be available via the - fincl namelist facility. Also, default daily history files have - been eliminated. - -3) The initialization of the diffusion parameters dif4 and dif2 have - been moved out of build-namelist and into the model. The default - dif4 value for T85 has been modified. - -The files that were modified are: ->> M models/atm/cam/bld/DefaultCAMEXPNamelist.xml ->> M models/atm/cam/src/control/history.F90 ->> M models/atm/cam/src/control/preset.F90 ->> M models/atm/cam/src/dynamics/eul/dycore.F90 ->> M models/atm/cam/src/dynamics/sld/dycore.F90 ->> M models/atm/cam/src/physics/cam1/cldcond.F90 ->> M models/atm/cam/src/physics/cam1/cldwat.F90 ->> M models/atm/cam/src/physics/cam1/cloud_fraction.F90 ->> M models/atm/cam/src/physics/cam1/gw_drag.F90 ->> M models/atm/cam/src/physics/cam1/moistconvection.F90 ->> M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 ->> M models/atm/cam/src/physics/cam1/zm_conv.F90 - -=============================================================== -=============================================================== - -cam2_0_2_dev43 -Originator: rosinski ( Jim Rosinski) -Date: Wed Oct 29 14:02:46 MST 2003 -Model: CAM -Version: CAM2.0_2.dev43 -One-line Summary: cos(lat) now applied to LANDM field offline. Since all IC files now require this - field (LANDM_COSLAT), new IC fields were generated. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes. Same-to-roundoff T42. Changes answers other resolutions (due to LANDM). -Changes to CLM land-model: None (except sfc datasets must be generated). -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Migrated multiplication of LANDM field by cos(lat) offline. One reason to do this was that -model-written IC files were invalid, due to erroneous multiple applications of the above-mentioned -cosine function. Also, for horizontal resolutions other than T42 there was an undesirable -resolution-dependent behavior of the LANDM specification algorithm. In the new approach, -linear interpolation to the target resolution is done from a "master" LANDM dataset, which was -built at T42 (per pjr). The resulting LANDM_COSLAT field now looks similar regardless of resolution. - -The "master" LANDM_COSLAT dataset lives in /fs/cgd/csm/inputdata/atm/cam2/hrtopo/landm_coslat.nc -It is read in by offline tool "definesurf", which has been modified to read it. - -Since new IC files are now required for all resolutions, it was decided to introduce consistency -to these files by using the newest 10-minute hi-res topography dataset when creating them. The -newest topography file is /fs/cgd/csm/inputdata/atm/cam2/hrtopo/topo10min.merged_c030506.nc -As a consequence of using this new file, existing resolution-specific surface datasets and IC -files for CLM also are invalid. Thus for many resolutions (though not T42), CLM must be spun -up for any runs done with cam2.0.2.dev43 and beyond. These changes are reflected in the xml -files which are used to build CAM and CLM namelists. - -=============================================================== -=============================================================== - -cam2_0_2_dev42 -Originator: rosinski ( Jim Rosinski) -Date: Tue Oct 28 16:02:07 MST 2003 -Model: CAM -Version: CAM2.0_2.dev42 -One-line Summary: Eliminate global TS print from physpkg and other minor speedups. - Add T85 and 2x2.5 aerosol datasets to xml file. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Minor speedup (see below). -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -o Eliminated global TS calculation and printout from physpkg. This code was left over -from long ago and the output is now more easily obtainable by other means. Minor speedup. - -o Moved calculation of tsice_rad to threaded region. Minor speedup on IBM, potentially -more significant when OMP_NUM_THREADS is a larger number (e.g. SGI). Unfortunately this -calculation is needed to create v2 IC files so it cannot be eliminated entirely. But it is -only needed when an IC file is generated, not every timestep. So further speedup is -possible. - -o Made srfflx_state_reset callable by chunk to enable fusing threaded loops. - -o Added reference to T85 and 2x2.5 aerosol datasets to CAM namelist xml file. - -=============================================================== -=============================================================== - -cam2_0_2_dev41 -Originator: jmccaa ( James Mccaa) -Date: Thu Oct 23 15:54:52 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev41 -One-line Summary: Climate tuning mods for T42 and T85. - -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes, new-climate -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Modifications have been made to allow the code to run using different -physics tuning parameters for different dycores and resolutions. -The values of these parameters have been adjusted following numerous -sensitivity experiments. - -The file cldfrc.F90 has been converted to a module named cloud_fraction.F90, and -an initialization routine has been added. -The files closure.F90, guang.h, and q1q2.F90 have merged into zm_conv.F90. -Minor code modifications have been made to allow greater optimization levels on -the IBM. - -Changed files: ->> M models/atm/cam/src/advection/slt/hordif1.F90 ->> M models/atm/cam/src/control/cam.F90 ->> M models/atm/cam/src/control/history.F90 ->> M models/atm/cam/src/control/preset.F90 ->> M models/atm/cam/src/control/spmdinit.F90 ->> M models/atm/cam/src/dynamics/eul/dycore.F90 ->> M models/atm/cam/src/dynamics/fv/dycore.F90 ->> M models/atm/cam/src/dynamics/sld/dycore.F90 ->> M models/atm/cam/src/physics/cam1/cldnrh.F90 ->> M models/atm/cam/src/physics/cam1/cldwat.F90 ->> M models/atm/cam/src/physics/cam1/geopotential.F90 ->> M models/atm/cam/src/physics/cam1/inti.F90 ->> M models/atm/cam/src/physics/cam1/moistconvection.F90 ->> M models/atm/cam/src/physics/cam1/pkg_cld_sediment.F90 ->> M models/atm/cam/src/physics/cam1/radae.F90 ->> M models/atm/cam/src/physics/cam1/sulchem.F90 ->> M models/atm/cam/src/physics/cam1/tphysbc.F90 ->> M models/atm/cam/src/physics/cam1/zm_conv.F90 ->> M models/csm_share/shr_vmath_mod.F90 - -Removed files: ->> R models/atm/cam/src/physics/cam1/cldfrc.F90 ->> R models/atm/cam/src/physics/cam1/closure.F90 ->> R models/atm/cam/src/physics/cam1/guang.h ->> R models/atm/cam/src/physics/cam1/q1q2.F90 - -Added files: ->> A models/atm/cam/src/physics/cam1/cloud_fraction.F90 - -=============================================================== -=============================================================== - -cam2_0_2_dev40 -Originator: rosinski ( Jim Rosinski) -Date: Wed Oct 22 16:54:16 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev40 -One-line Summary: Move horizontal aerosol interpolation offline. Modify print_memusage for readability and portability. -cam-bugs Requests resolved: none -Requires change in build system: yes: resolution-specific aerosol dataset required -Substantial timing or memory changes: yes: faster, uses less memory -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Andrew Conley -Restart files change: no -Changes answers: Yes (same-to-roundoff) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - -Changes made: - -o Moved horizontal aerosol interpolation to CAM grid offline. The main reason for -this was to speed up initialization and reduce memory usage when running CAM. At T42 -using 2 MPI tasks, the memory hi-water mark for MPI task 0 is reduced by about 50%. -Memory reduction for MPI task 1 is around 20%. - -Since the boundary aerosol dataset is now resolution-specific, the amount of speedup vs. -dev39 will be resolution-dependent, with lower resolutions seeing the biggest benefit. -There will also be some speedup during the time-integration phase due to reordering loops -and array structure for cache efficiency in aerosol routine vert_interpolate. Since -the aerosol initialization code still reads a full 12 months of data, the startup time -overhead and memory overheads are not insignificant. We may want to further restructure -the code to read in aerosols the same way as SST and Ozone, keeping just 2 bounding -months of data in-core at any given time. In the meantime, if time spent reading -the aerosol boundary data still proves to be an annoyance, things can be sped up dramatically -if the aerosol dataset is made local rather than read from an NFS-mounted file system. -Alternatively, #define BYPASS is still available from earlier libs. - -The new boundary dataset generation code lives in cam/tools/interpaerosols. A -README in that directory explains the procedure to generate an aerosol boundary -dataset at the target model resolution. Resolution-specific aerosol datasets have -already been created for resolutions needed by test-model, and some other common -resolutions. - -Mods were also made to the main CAM Makefile. LAPACK/BLAS routines are only used by the -aerosol initialization procedure, so library references to these routines now only -exist in the offline code. - - -o Rewrote utility routine print_memusage for readability of output and portability. It now -works on Linux as well as SGI and IBM. The point of the routine is to print -memory use information at whatever point in the code the user wishes. On most machines -the numbers printed refer to hi-water mark, but on Linux they refer to current use (i.e. -on Linux the numbers do not necessarily increase monotonically with time). Also on -most machines, the printed numbers refer to KB of memory used. But this is not necessarily -true on all machines (e.g. Linux). Refer to "man getrusage" on most machines, and "man proc" -on Linux machines for details. The output from print_memusage now goes to Fortran unit 0, -which in most cases translates to stderr. So memory use information can be segregated from -stdout by for example: (cam < namelist >! out) >&! err. This code is far from perfect, e.g. -printed output can still be jumbled between MPI tasks. - - -Misc. notes: - -o To get bit for bit vs. dev39, created a 64-bit aerosol dataset, pasted lon and lat -coordinate variables from a dev39 run into the input/output file required by interpaerosols. -Under pgf90 this is bfb. Unfortunately this procedure did not yield bfb results on IBM or SGI. - -o Input aerosol dataset variable names and output history variable names are as before, but -with an "_V" appended to their name. This reflects the fact that these variables have -undergone a vertical sum. The different names will also cause the model to crash if an -incorrect boundary dataset is used. - -=============================================================== -=============================================================== - -cam2_0_2_dev39 -Originator: pworley ( Patrick H Worley) -Date: Mon Sep 29 13:44:01 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev39 -One-line Summary: Decreased memory requirements in dynamics/eul/inidat and added new load balancing scheme to phys_grid. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes - decreased number of full 3D fields needed in inidat from 9+(pcnst+pnats) to 4 -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux cluster -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - 1) restructured dynamics/eul/inidat.F90 to minimize the memory requirements. - In the original version, masterproc allocates (9+pcnst+pnats) 3D fields - and 16 2D fields. It then reads in or generates the initial data, - scatters the data, and finally deallocates the arrays. In the revised - version, subsets of arrays are allocated, initialized, scattered, and - deallocated together, decreasing the maximum memory requirements to 4 3D fields. - Note that I implemented the logic that Brian Easton used in FV inidat (for WACCM) - to treat each species in q3 separately. - - 2) added a new load balancing algorithm in physics/cam1/phys_grid.F90. - The original global balancing algorithm (opt = 1) eliminates - imbalances due to the diurnal and seasonal cycles. However, it still - assigns all polar latitdues to the same processors, the mid-latitudes - to the same processors, and the equatorial latitudes to the same processors. - The new algorithm (opt = 2) mixes up the latitudes as well, achieving - almost perfect load balance. It comes at a cost of increased communication cost - compared to opt = 1, and may or may not be a performance enhancer for - a given system, problem size, and processor count. - - 3) added an option to physics/cam1/phys_grid.F90 to implement the transpose_block_to_chunk - and transpose_chunk_to_block routines using point-to-point MPI commands rather - than mpi_alltoallv. This has been important on some systems in the past, - and is included here as an aid to experimentation. This option is currently - disabled in the code. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev38 -Originator: hender ( Tom Henderson) -Date: Mon Sep 22 11:46:03 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev38 -One-line Summary: Bug fix for prognostic aerosols, SE improvements. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux-lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Phil Rasch, Brian Eaton, Erik Kluzek -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Fixed bugs and added namelist variables to control prognostic aerosols. -(Bug fix for prognostic aerosols was provided by Phil Rasch.) -Improved design of parse_namelist(), prototype implementation is included -subject to review. So far design and implementation have been reviewed -only by Brian Eaton and Erik Kluzek. -Brought physics performance tuning parameters out to CAMEXP namelist. - -New namelist variables are: - -PHYSICS CONTROLS - -AERO_SULFUR -Type: Logical -Default: .FALSE. -Description: If true, turn on sulfur prognostic aerosols. - -AERO_FEEDBACK_SULFUR -Type: Logical -Default: .FALSE. -Description: If true, turn on feedback of sulfur prognostic aerosols. May -only be true if AERO_SULFUR is also true. - -AERO_CARBON -Type: Logical -Default: .FALSE. -Description: If true, turn on carbon prognostic aerosols. - -AERO_FEEDBACK_CARBON -Type: Logical -Default: .FALSE. -Description: If true, turn on feedback of carbon prognostic aerosols. May -only be true if AERO_CARBON is also true. - -AERO_SEA_SALT -Type: Logical -Default: .FALSE. -Description: If true, turn on sea salt prognostic aerosols. - -AERO_FEEDBACK_SEA_SALT -Type: Logical -Default: .FALSE. -Description: If true, turn on feedback of sea salt prognostic aerosols. May -only be true if AERO_SEA_SALT is also true. - - -PERFORMANCE TUNING - -PHYS_LOADBALANCE -Type: Integer -Default: 0 -Description: Select different options for organization of physics chunks. -Each uses a different scheme for static load balancing. - -PHYS_CHNK_PER_THD -Type: Integer -Default: 1 -Description: Select target number of chunks per thread. Must be positive - - -CHANGED FILES: - cam1/models/atm/cam/doc/UsersGuide/UG-20.html - cam1/models/atm/cam/src/dynamics/eul/inidat.F90 - cam1/models/atm/cam/src/dynamics/sld/inidat.F90 - cam1/models/atm/cam/src/dynamics/fv/inidat.F90 - cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 - cam1/models/atm/cam/src/physics/cam1/carbon_intr.F90 - cam1/models/atm/cam/src/physics/cam1/dust_intr.F90 - cam1/models/atm/cam/src/physics/cam1/phys_grid.F90 - cam1/models/atm/cam/src/physics/cam1/radctl.F90 - cam1/models/atm/cam/src/physics/cam1/seasalt_intr.F90 - cam1/models/atm/cam/src/physics/cam1/sulchem.F90 - cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 - cam1/models/atm/cam/src/physics/cam1/wetdep.F90 - cam1/models/atm/cam/src/control/cam.F90 - cam1/models/atm/cam/src/control/comhd.h - cam1/models/atm/cam/src/control/parse_namelist.F90 - - - -=============================================================== -=============================================================== - -cam2_0_2_dev37 -Originator: mirin ( Arthur Andrew Mirin) -Date: Wed Sep 17 16:30:30 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev37 -One-line Summary: Transpose and other FV improvements -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: no (unless test_model did that) -Code reviewed by: myself, Will Sawyer -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -This update accomplishes improvements to the finite-volume transposes and to -the FV dycore itself, as undertaken by Art Mirin and Will Sawyer. Specifically: - -(A) The irregular communication routines of the mod_comm library -have been placed in their own module (mod_irreg), to enable use of a unified -version of mod_comm in CAM2 and FVGCM (NASA Goddard). This facilitates making use -of ongoing improvements at Goddard (such as support for SHMEM). - -(B) The transpose calls directly reference mod_irreg routines as opposed to -going through the Pilgrim layer. This is true for use of mpi derived types as -well as contiguous buffers. Pilgrim's main function is to set up communication -patterns; mod_irreg then accomplishes the transposes. - -By default, the transposes gather/scatter data from/to contiguous buffers. We -have found mpi derived types to be very slightly superior on the IBM. -One can implement use of mpi derived types at compile time by activating the line -"FPPFLAGS += -WF,-DUSE_MPI_TYPES" in the AIX section of the Makefile. -Support for one-sided (MPI2) communications when using MPI derived types has not -yet been implemented. - -(C) There have been other miscellaneous improvements to Pilgrim / mod_comm. - -(D) The Held-Suarez, Rayleigh friction and high-pressure mode have been removed -from the FV dycore. - -(E) The FV version of inidat.F90 has been rewritten to minimize use of global 3D -arrays. - -(F) Additional sectional timing diagnostics have been added, as well as an additional -optional timing barrier in the physics. - -(G) There have been other miscellaneous improvements. - -The following routine was added: - cam1/models/utils/pilgrim/mod_irreg.F90 - -The following routines were deleted: - cam1/models/atm/cam/src/dynamics/fv: hswf.F90, highp2.F90, dry_adj.F90, rayl_fric.F90 - -The following routines were modified: - cam1/models/utils/pilgrim: Makefile, mod_comm.F90, parutilitiesmodule.F90 - cam1/models/atm/cam/bld/Makefile - cam1/models/atm/cam/src/physics/cam1/physpkg.F90 - cam1/models/atm/cam/src/dynamics/fv: cd_core.F90, d2a3dikj.F90, dp_coupling.F90, - dynamics_vars.F90, dynpkg.F90, geopk.F90, inidat.F90, inital.F90, mapz_module.F90, - p_d_adjust.F90, pft_module.F90, pmgrid.F90, restart_dynamics.F90, spmd_dyn.F90, - stepon.F90, te_map.F90, uv3s_update.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev36 -Originator: jmccaa ( James McCaa) -Date: Fri Sep 12 14:32:06 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev36 -One-line Summary: Merge of physics tuning branch onto cam_dev branch. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux cluster -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers:Yes -- new climate -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -The following changes apply to all dycores: -* The fall velocity of large (400 micron) ice crystals has been reduced - from 3.5 m/s to 1 m/s. -* There is a lapse-rate reduction of the SST used for stratus diagnosis - when the sea surface elevation is not 0. -* The temperature ramp used to compute the effective radius of warm - clouds over land now goes from -20 C to 0 C. -* The land fraction ramp over the ocean goes from cos(lat) near the - coast to 0 at 1000 km from the coast. -* The effective radius and CCN of warm clouds over land now depend - on snow depth (linear ramp from 0 to 0.1 m liquid water equivalent). -* The evaporative efficiency for rain falling from cumulus has been - lowered from 3.0e-6 to 2.0e-6. -* Formulae for cloud fraction associated with moist convection have - been changed. -* Adjustments have been made to the aerosol optics. - -The following modifications only apply to the finite volume dycore: -(They are in addition to the changes described above.) -* A new energy fixer has been added. -* The parameterization of gravity wave drag has been modified. -* A new parameterization of orographic form drag has been added. -* The Hack scheme now detrains cloud liquid. -* Evaporation efficiency for stratiform rain has been halved. -* Evaporation efficiency for convective rain has been halved. -* Formulae for cloud fraction associated with moist convection have - been changed. - -The following modififications have been made to keep the standalone -CAM consistent with recent coupled runs: -* The snow fraction on land as a function of snow depth has been - changed. -* Both visible and near-ir albedos of snow on sea ice have been - lowered by 0.02. -* Albedos of bare sea ice have been lowered by 0.10 for visible and - 0.06 for near-ir. - -There is one infrastructure change: -* ncar_batch.csh now overrides any previously set values of the environment - variables INC_NETCDF and LIB_NETCDF to point to 64 bit versions - -=============================================================== -=============================================================== -cam2_0_2_dev35 -Originator: mvertens ( Mariana Vertenstein) -Date: Wed Sep 10 10:37:47 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev35 -One-line Summary: fix clm bug that caused problems at very high mpi task number -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Forrest Hoffman -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - Fixed bug in clm code (lnd_grid.F90) that caused problems to occur at very - high mpi task number -=============================================================== -=============================================================== - -cam2_0_2_dev34 -Originator: hender ( Tom Henderson) -Date: Tue Sep 2 12:41:50 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev34 -One-line Summary: AIX 64-bit addressing and a bunch of other stuff -cam-bugs Requests resolved: 98, (127), 128 -Requires change in build system: AIX build now uses 64-bit addressing -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux-lf95 -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, contributors -Restart files change: no -Changes answers: Yes (same-to-roundoff for AIX, bfb for all others) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - Bunch-o-fixes II: - - Jim Edwards' performance fix for estblf - - wv_saturation.F90 - - change Makefile (etc.) to use 64-bit on AIX - - Modified Makefile, run-ibm.csh, CAM_lab.pm - - From Jim McCaa - The code already exists in history.F90, but is CPPed out. So, what I'm - requesting is to remove the two CPP lines, thereby enabling the code. - They are: - line 2501: #if ( defined CNTL_FORSOM ) - line 2506: #endif - This won't affect answers, but will add fields to the monthly history - tape. - - From John Truesdale: - In diagnostics.F90 the outfld call for TSICERAD needs to be removed (per - Jerry O.) In tphysbc.F90 the DQCOND outfld call needs to be removed - (duplicate of outfld call using dcconnam). - - Jim Rosinski kindly offered to add a summary message to cprnc indicating - how many fields were compared and how many passed bfb. - - only one file changed: - /fs/cgd/data0/rosinski/newcprnc/cam1/models/atm/cam/tools/cprnc/cpr.F - - Fixed bug in fv 2D decomposition (From Art Mirin) - - Changed dp_coupling.F90 for fv - - Fixed CAM bug #98 (originally reported by Woo Sun Yang) - - Francis Vitt (ACD) provided the bug fix for writing staggered 'US' grid - from history.F90. - - Attempted to remove undocumented Lahey compiler option from Makefile as - suggested by Jim Rosinski - "For some reason the default CAM Makefile includes an undocumented compiler - flag (-CcdRR8) when using lf95 on the PC. The documented flag --dbl used - to suffice for auto-promotion of real to real*8, and has been removed. - Does anyone know why this was changed? If not, I propose changing back to - the documented flag if identical answers can be obtained. Undocumented - flags are a bad idea all around, I think. - JR" - - Can't make this change because "--dbl" promotes real*4's too (which - will break MPI communications and history output). - - Corrected misleading comments about this in Makefile. - - Implemented Brian Eaton's fix for incorrect override of qmin from namelist - - Modified all three flavors of initcom.F90 - - Removed ccm366 physics from Default*Namelist.xml. - - Added new data file for Jerry Olson to DefaultCAMEXPNamelist.xml. - eul/ncdata_vers=2: cami_0000-09-01_64x128_L26_c030624.nc - sld/ncdata_vers=2: cami_0000-09-01_64x128_L26_c030624.nc - eul/ncdata_vers=1: cami_0000-09-01_64x128_L26_030506.nc - sld/ncdata_vers=1: cami_0000-09-01_64x128_L26_030506.nc - - Fix CAM bug #128 (fv build problems on Compaq and SGI) with bug fixes - from Tony Craig and Wei Yu. - - Modified cd_core.F90, and ccsm_msg.F90 (physpkg.F90 already fixed) - - dev34 is bfb vs. dev33 on non-AIX machines, but - roundoff on AIX machines. AIX perturbation growth of cam2_0_2_dev33 is - nearly identical to error growth of difference between cam2_0_2_dev33 and - cam2_0_2_dev34 for all three dycores. roundoff is entirely due to change - in AIX compiler options to use 64-bit addressing in Makefile and in cprnc - Makefile. This was tested by comparing dev33+(new Makefiles) vs. dev33 - (roundoff differences observed) and comparing dev34-(new Makefiles) vs. - dev33 (bfb exact). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== -cam2_0_2_dev33 -Originator: mvertens ( Mariana Vertenstein) -Date: Mon Aug 25 12:06:15 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev33 -One-line Summary: updated clm code from clm2_deva_30 to clm2_deva_36 -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes (new-physics (clm only) -Changes to CLM land-model: Yes -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -Only clm changes have been made in this tag. - -cam2_0_2_dev32 contains clm2_deva_30 (with some changes on the cam branch for dust -that are only invoked when the cpp variable DUST is defined). - -cam_0_2_dev33 contains clm2_deva_36 (which has incorporated the above dust mods). - -The following summarizes the changes between clm2_deva_30 and clm2_deva_36. -The changes that lead to greater than roundoff differences are denoted by (*). - - 1) Put in dust mods in cam2_0_2_dev32. -*2*) Put in bug fix to BareGroundFluxesMod.F90 so that z0hg and z0qg at the column - level would not be set by pft level quantities. This changes answers to more - than roundoff. - 3) Put in bug fix in Biogeophysics2Mod.F90 so that would not divide by - zero when calculating the ratio of soil evaporation for a pft relative - to the total of all evaporating PFTs. This would occur if the weight - became 0. in the dgvm calculation. This results in bfb answers in non-dgvm mode. - 4) Put in bug fix to BareGroundFluxesMod.F90 so that z0hg and z0qg at the column - level would not be set by pft level quantities. This changes answers to more - than roundoff. - 5) Put in bug fix in Biogeophysics2Mod.F90 so that would not divide by - zero when calculating the ratio of soil evaporation for a pft relative - to the total of all evaporating PFTs. This would occur if the weight - became 0. in the dgvm calculation. This results in bfb answers in non-dgvm mode. - 6) Put in a change to DGVMMod.F90 to fix a bug in history file output - in compete mode (the default now). -*7*) Reversion to old fraction snow cover algorithm (clm2_deva_32) - 8) Made clmtype variables relating to soil hydraulic and thermal properties - column physical state properties rather than land physical state properties - 9) Fixed DGVM restart problem in compete mode: - Modified restFileMod.F90 and DGVMMod.F90 so that average over all - column pfts for h2ocan (needed by begwb computation in routine - driver.F90) is done in restfileMod.F90 only for non-DGVM mode and in - resetWeightstDGVM (in module DGVMMod.F90) for DGVM mode (since this - needs to be done after the weights are reset in the DGVM case). - 10) Modified tssbef dimension in clmtype.F90 to be consistent. -=============================================================== - -=============================================================== - -cam2_0_2_dev32 -Originator: pworley ( Patrick H Worley) -Date: Tue Aug 19 20:38:06 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev32 -One-line Summary: Chunking data structures and optimizing interprocessor communication in ozone routines -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes (performance improves for large process counts) -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -The original version of oznini reads in two timelevels of ozone data -and saves them in masterproc. masterproc then interpolates the data to the -current timelevel and broadcasts the entire field to each process. -Each shortwave or longwave timestep, advnce calls oznint. -In oznint, masterproc again interpolates the ozone data -to the current timelevel and broadcasts the entire field to each process. -(Every month or so, oznint also reads a new timelevel of -ozone data into masterproc.) - -In the new version, oznini reads in the two timelevels, then distributes -both timelevels to all of the processes, so that they can do the interpolation -on their own. Moreover, the ozone data has been chunked, and each process -holds only the data that it needs for the columns that it is responsible for. -The performance impact is a significant decrease in the number of times -masterproc sends ozone data to the other processes, and a decrease in the -amount of data sent in each remaining communication. Routines modified were -comozp.F90, oznini.F90, oznint.F90, and radozn.F90, all in control/ . - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev31 -Originator: rosinski ( Jim Rosinski) -Date: Thu Aug 14 21:54:00 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev31 -One-line Summary: Bugfix from Natalie M. for sulfur fields. Consistent treatment of r4 vs. r8 in function calls -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -o Sulfur bugfix from Natalie M. addresses negative concentrations. -o Consistent treatment of constants as r8. - -=============================================================== -=============================================================== - -cam2_0_2_dev30 -Originator: pworley ( Patrick H Worley) -Date: Wed Aug 13 15:23:59 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev30 -One-line Summary: Replaced global spectral arrays and indices with local arrays in EUL dycore, to decrease memory requirements. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes:Yes (spectral memory requirements now decrease as number of MPI processes increase) -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux cluster -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: No (bit-for-bit) for SGI and Linux cluster, Yes (same-to-roundoff) for IBM -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -The primary goal of this update is to decrease the memory requirements -in the spectral Eulerian dycore by allocating space only for the -spectral coefficients that each processor is responsible for. While -we earlier decomposed the work, we have still been allocating the -full spectral arrays on each processor. This modification is important -for higher horizontal resolutions (T85, T170) as it decreases the memory -required for each process and may improve performance by improving memory -locality. To this end, the following files in dynamics/eul were modified: - -comspe, spmd_dyn, trunc, initcom, inital, dynpkg, grcalc, hordif, -quad, and tstep - -The routine spetru was also divided into 4 routines (in a new spetru module): -spetru_u., spetru_t, spetru_ps, and spetru_phis, spectrally truncating -the fields u and v, t, ps, and phis, respectively. The old spetru used -the global spectral arrays vz, d, t, and phis, which have been eliminated. -The new routines use at most a few single level global spectral arrays to -truncate the fields, again decreasing the required memory. - -Finally a few random changes were included in this update: - -Makefile - - Added -lcxml to the LDFLAGS for OSF, to link in DGETRF and DGETRS - on the Pittsburgh AlphaServer SC (needed by aerosols.F90) - -caerbnd.F90, dmsbnd.F90: - Moved declaration for ncol so that it appears before its use in - array declarations. (HP/Compaq compiler complained.) - -physpkg.F90: - Removed redundant USE of time_manager variables. (HP/Compaq compiler - complained.) - -carbon_intr.F90, seasalt_intr.F90 - Removed redundant USE of shr_const_mod variables. (HP/Compaq compiler - complained.) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev29 -Originator: aconley ( Andrew J. Conley) -Date: Thu Aug 7 10:25:49 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev29 -One-line Summary: linearly interp asym and ssa parameters, Do not extrap optics beyond rh = 1.0 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, chinooke, anchorage -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers:Yes new-physics ( < 10^-3 relative change in aerosol heating) - -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - Aerosol optics are no longer extrapolated beyond rh = 1.0. - Asymmetry and single scattering albedo are now linearly interpolated - in rh rather than exponentially interpolated. -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev28 -Originator: rosinski ( Jim Rosinski) -Date: Wed Aug 6 11:49:49 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev28 -One-line Summary: Back out nf90 interface from sulfur codes. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: - -o Backed out the Fortran 90 interface from sulfur codes per CRB. -o IMPORTANT NOTE: There is a reproducibility problem on the IBM when the sulfur routines are - enabled. This problems exists both in the previous library (2.0.2.dev27) and this commit. - Only the sulfur fields are affected, and the impact appears to be minor. The problem is - likely related to threading, since 1-day test runs on IBM machines with OMP_NUM_THREADS=1 - give reproducible answers. Threaded tests on chinook (SGI) were successful. Note that - test-model does not enable the sulfur routines, so results were bit-for-bit. - -=============================================================== -=============================================================== - -cam2_0_2_dev27 -Originator: hender ( Tom Henderson) -Date: Wed Jul 30 15:10:50 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev27 -One-line Summary: First cut at getting dust to work with physics chunking. -cam-bugs Requests resolved: none -Requires change in build system: no - -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, anchorage-lf95 -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Hacks for dust, see "#if (defined DUST)" -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: -Updated Natalie Mahowald's dust package (including her land model changes) to -work with PCOLS=16. It does not crash on anchorage but does crash on -blakcforest when cpp token DUST is defined (by default, dust, sulfates, -sea salt, and carbon packages are turned off via cpp tokens). MORE WORK NEEDS -TO BE DONE. - -This tag is identical to cam2_0_2_dev25_brnchT_paero7. - -Note that pgf90-pgcc and pgf90-gcc are known to fail because the Makefile has -not been updated to deal with the new F90 netcdf interfaces used in the new -code. The next tag should replace the F90 interfaces with the standard CAM -wrap_ncf() calls, if possible. - -=============================================================== -=============================================================== - -cam2_0_2_dev26 -Originator: hender ( Tom Henderson) -Date: Mon Jul 28 18:18:26 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev26 -One-line Summary: Added Phil Rasch's prognostic SOx aerosols. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux-lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - (If not abort this tag and follow the procedures in) - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: -Added prognostic aerosols. All four packages (sulfates, carbon, sea salt, and -dust) are independently #ifdef'd out in aerosol_intr.F90. Sulfates have -been tested with the other three off. Results are bfb with cam2_0_2_dev25 -when all four are off. Feedback to radiation is disabled in radctl.F90 (see -commented-out calls to set_aerosol_from_prognostics). - -Time constraints forced the choice of cpp and comments instead of namelist -variables... - -NEW FILES: -cam1/models/atm/cam/src/physics/cam1/acbnd.F90 -cam1/models/atm/cam/src/physics/cam1/acsf.F -cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 -cam1/models/atm/cam/src/physics/cam1/caerbnd.F90 -cam1/models/atm/cam/src/physics/cam1/caer.F90 -cam1/models/atm/cam/src/physics/cam1/carbon_intr.F90 -cam1/models/atm/cam/src/physics/cam1/dmsbnd.F90 -cam1/models/atm/cam/src/physics/cam1/drydep_mod.F90 -cam1/models/atm/cam/src/physics/cam1/dust.F90 -cam1/models/atm/cam/src/physics/cam1/dust_intr.F90 -cam1/models/atm/cam/src/physics/cam1/dust_sediment_mod.F90 -cam1/models/atm/cam/src/physics/cam1/scyc.F90 -cam1/models/atm/cam/src/physics/cam1/seasalt_intr.F90 -cam1/models/atm/cam/src/physics/cam1/soxbnd.F90 -cam1/models/atm/cam/src/physics/cam1/sulbnd.F90 -cam1/models/atm/cam/src/physics/cam1/sulchem.F90 -cam1/models/atm/cam/src/physics/cam1/sulemis.F90 -cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 -cam1/models/atm/cam/src/physics/cam1/surface.F -cam1/models/atm/cam/src/physics/cam1/volcemission.F -cam1/models/atm/cam/src/physics/cam1/wetdep.F90 - -CHANGED FILES: -cam1/models/atm/cam/doc/UsersGuide/UG-20.html -cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml -cam1/models/atm/cam/bld/camexp.pm -cam1/models/atm/cam/bld/run-ibm.csh -cam1/models/atm/cam/bld/run-pc.csh -cam1/models/atm/cam/src/dynamics/eul/inidat.F90 -cam1/models/atm/cam/src/physics/cam1/advnce.F90 -cam1/models/atm/cam/src/physics/cam1/aerosols.F90 -cam1/models/atm/cam/src/physics/cam1/cldcond.F90 -cam1/models/atm/cam/src/physics/cam1/comsrf.F90 -cam1/models/atm/cam/src/physics/cam1/initindx.F90 -cam1/models/atm/cam/src/physics/cam1/inti.F90 -cam1/models/atm/cam/src/physics/cam1/physpkg.F90 -cam1/models/atm/cam/src/physics/cam1/radctl.F90 -cam1/models/atm/cam/src/physics/cam1/tphysac.F90 -cam1/models/atm/cam/src/physics/cam1/tphysbc.F90 -cam1/models/atm/cam/src/control/filenames.F90 -cam1/models/atm/cam/src/control/intp_util.F90 -cam1/models/atm/cam/src/control/parse_namelist.F90 -cam1/models/atm/cam/test/system/ncar_batch.csh - - -=============================================================== -=============================================================== - -cam2_0_2_dev25 -Originator: jmccaa ( James Mccaa) -Date: Thu Jul 17 15:38:48 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev25 -One-line Summary: Introduction of orographic form drag and modification of gravity wave drag routines. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, linux-lf95, linux-pgf90 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes, new-physics -Changes to CLM land-model: None (one-line description) -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Modified three files: -models/atm/cam/src/physics/cam1/gw_drag.F90 -models/atm/cam/src/physics/cam1/tphysac.F90 -models/atm/cam/src/physics/cam1/vertical_diffusion.F90 - -Introduced orographic form drag in vertical_diffusion module. -Modified gravity wave drag in gw_drag module. -These changes necessitated changes to the interfaces in tphysac. - -Form drag and the new gravity wave drag algorithm are implemented only -when using the finite volume dycore. However, for the spectral dycores -the gravity wave algorithm was changed to disallow the formation of -gravity waves over pure ocean points with non-zero orographic standard -deviation. - -==================================================== -==================================================== - -cam2_0_2_dev24 -Originator: eaton ( Brian Eaton) -Date: Fri Jul 11 12:48:54 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev24 -One-line Summary: dycore independent energy fixer, only active for FV -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, pc-lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: roundoff changes in spectral dycores, fv has new physics -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Reinsert changes made at cam2_0_2_dev21 (dycore independent energy fixer active -for fv only). - -Fix bad error growth (add PERGRO condition in cldfrc.F90) - -Fix namelist problem for 64x128 sld (new dataset in DefaultCAMEXPNamelist.xml). - - -=============================================================== -=============================================================== - -cam2_0_2_dev23 -Originator: hender ( Tom Henderson) -Date: Sat Jun 21 09:41:17 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev23 -One-line Summary: Fixes for coupled runs, removal of CCM366 and LSM, other minor fixes. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Intel-Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Tony Craig, Art Mirin, and a cast of thousands -Restart files change: no -Changes answers: no (bfb with dev22) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - - Bug fix #122. (outfld calls from Jerry Olson's commit) - Modified routine diag_surf() in diagnostics.F90 so fields TSICE - and TSICE_RAD are excluded from the history files during a coupled - run. - - bugfix for ccsm_msg from Tony for fractional land - /fs/cgd/data0/tcraig/ccsm2_runs/f22.006/src.atm/ccsm_msg.F90 - - Strip out CCM366 code now that test-model tests are no longer run... - Removed all files in models/atm/cam/src/physics/ccm366/ (CCM366 - physics) and models/lnd/lsm/src/ (LSM). - - Deal with huge volume of print statements - Commented out print of "TIMEFILTER" messages per CAM CRB meeting on - 6/20/03. Modified tfilt_massfix.F90 - - Restore fv_prints.F90 as per Art Mirin's email - Got new fv_prints.F90 from sunray3:/home/mirin/outgoing/. - - Added Art Mirin's "one-line-change" to resolution_parameters.xml - Added new line for resolution=".5x.625" - - -=============================================================== -=============================================================== - -cam2_0_2_dev22 -Originator: hender ( Tom Henderson) -Date: Fri Jun 20 15:50:11 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev22 -One-line Summary: Rolled back dev21 changes (per CAM CRB). -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: none. I verified that the entire cam1 module is identical to -dev20. Testing will be done for dev23 -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: dev22 is identical to dev20 -=============================================================== -=============================================================== - -cam2_0_2_dev21 -Originator: eaton ( Brian Eaton) -Date: Wed Jun 18 13:15:50 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev21 -One-line Summary: dycore independent energy fixer, only active for FV -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC/lf95 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, boville -Restart files change: no -Changes answers: Yes. spectral dycores change to round-off. FV dycore has a physics change. -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes -Changes made: - -Add dycore independent energy fixer. Currently it is only applying an energy fix when run -with the FV dycore. For the spectral dycores it is diagnostic. - -A round-off level change was introduced into the spectral dycores due to 2 changes: -1. The definition of dry static energy was changed to include the surface geopotential. -2. The conversion between dry and wet constituent mixing ratios was moved into the coupling layer, - and an extraneous conversion that previously happened at the end of tphysbc and at the beginning - of tphysac has been removed. - -See http://www.cgd.ucar.edu/~cam/cam_checkins/ for details. - -=============================================================== -=============================================================== - -cam2_0_2_dev20 -Originator: erik ( Erik Kluzek) -Date: Mon Jun 16 12:54:27 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev20 -One-line Summary: Get rid of ccm366/lsm test in test-model.pl, clean more files in $MODEL_BLDDIR, send *.cprout files in test-model to $MODEL_EXEDIR -cam-bugs Requests resolved: 112, 118(partial) -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux(lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, hender -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB?no - -Got rid of the ccm366/lsm test in test-model.pl. - -Clean more files in the $MODEL_BLDDIR when using test-model.pl or run-model.pl -(fixes bug #112) - -Send all *.cprout files to $MODEL_EXEDIR instead of $SCRIPT_DIR this prevents -overwrites of files by different machines. This is a partial fix to bug #118. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. - http://www.cgd.ucar.edu/~cam/cam_checkins/ - for most recent and proposed checkins - -=============================================================== -=============================================================== - -cam2_0_2_dev19 -Originator: hender ( Tom Henderson) -Date: Fri Jun 13 10:28:19 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev19 -One-line Summary: Merged "science" branch into "dev" branch. -cam-bugs Requests resolved: none -Requires change in build system: Yes (see science branch documentation) -Substantial timing or memory changes: Yes (see science branch documentation) -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: many -Restart files change: yes -Changes answers: Yes (new-climate) -Changes to CLM land-model: Yes -Have you filled out the pre-check-in documentation as required by the CAM CRB? yes - http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml -Changes made: -See http://www.cgd.ucar.edu/~cam/cam_checkins/ for details of all changes -made on the science branch. - -=============================================================== -=============================================================== - -cam2_0_2_dev18 -Originator: rosinski ( Jim Rosinski) -Date: Tue Apr 8 17:09:30 MDT 2003 -Model: CAM -Version: CAM2.0_2.dev18 -One-line Summary: Speedup mods. Particularly for large number of threads (e.g. typical SGI) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes. Speedup mods. See below for details. -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Have you filled out the pre-check-in documentation as required by the CAM CRB? no but I will -Changes made: - -o Speedup mods. Should see order 10% speedup on SGI, 3% on IBM. Even better than that for - more than 32 threads on SGI. Specifics were: - - fuse threaded loops to minimize threading overhead - - Don't dereference pointers in expensive history calculations. - - Thread some calculations called from physpkg that were previously single-threaded. This - likely is the reason for such a big speedup on SGI. - -o Changed ifdef DEBUG to HDEBUG inside history.F90. Reason was model barfed somewhere in - physics when DEBUG ifdef was set. - -o Fix max/min combined with flag_xyfill=.true. pathological history case (prv commit). - -=============================================================== -=============================================================== - -cam2_0_2_dev17 -Originator: rosinski ( Jim Rosinski) -Date: Sat Apr 5 11:48:41 MST 2003 -Model: CAM -Version: CAM2.0_2.dev17 -One-line Summary: Added ISCCP cloud simulator -cam-bugs Requests resolved: none -Requires change in build system: yes (new namelist variables) -Substantial timing or memory changes: history speedup. -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -o Added ISCCP cloud simulator. Cost overhead is around 5%. You need to set - namelist variable doisccp = .true. to enable the simulator. Then - isccpdata = '/fs/cgd/csm/inputdata/atm/cam2/rad/isccp.tautab_invtau.nc' - to tell the simulator where the required boundary dataset is. - - Had to set default doisccp = .false. because test-model will barf when cprnc - gets confused at the different values of the "levels" coordinate variable. - This needs to be fixed. - - Output from the simulator is 6 fields. The key field is FISCCP1, dimensioned - lon x 49 x lat x time. The 49 is really 7 pressure levels by 7 optical - depths. Pressure and optical depth of each "level" can be determined from - dimension variable "isccp_prstau". Pressure is the number to the left of - the decimal point in mb. Optical depth is the number to the right of the - decimal point times 1000. - - The simulator is only called during daytime (coszrs > 0). As a consequence, - routine outfld in history.F90 was modified to ignore input array locations - set to fillvalue. To enable this feature, a new argument to addfld named - flag_xyfill was added. Set it to .true. to enable outfld ignoring fillvalue - input. Currently this is only done for appropriate ISCCP fields. If this - feature is enabled, for multilevel fields the setting of fillvalue MUST be - invariant in the z-direction. The reason is that the accumulator (nacs) is - currently only dimensioned x-y. The history handler checks for this - consistency and barfs if it is not met. Changing the accumulator to be - x-y-z capable would not be too hard, but might have severe performance - ramifications. - -=============================================================== - -cam2_0_2_dev16 -Originator: tcraig ( Anthony Craig) -Date: Thu Apr 3 15:51:34 MST 2003 -Model: CAM -Version: CAM2.0_2.dev16 -One-line Summary: Updates for CCSM coupling with cpl6, CCSM coupling with FV, rain/snow in coupling -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - - ccsm_msg.F90 - - Significant rewrite for cpl6, has no impact on stand-alone CAM - (Rob Jacob). - - Fixed bug in outfld call for CPLRAIN*, CPLSNOW*, CPLPRCER - (Mariana Vertenstein). - - Removed artificial repartitioning of snow and rain in fields - sent to coupler to be ready for CLM2.2. - - Fixed bug in read/write of precca, precla, precsca, precsla - (Mariana Vertenstein, Bryon Boville) - - Modified coupling for LR dycore, removed special mods for LR - dycore in sendgrid setting mask to zero at most pole latitudes. - This was required for CCSM coupled runs with the LR dycore. - - spmdinit.F90 - - Removed the MPI_INIT call for COUP_CSM mode, cpl6 now handles this. - - Removed use of shr_msg_comm_atm (cpl5). Added a call to - cpl_interface_init (cpl6) to return the MPI communicator group. - - cam.F90 - - Modified some code on COUP_CSM definitions, remove calls to - shr_msg_init, shr_msg_groups, and shr_msg_finalize (cpl5). - Added call to cpl_interface_finalize (cpl6). - - phys_grid.F90 - - Added two new routines, buff_to_chunk and chunk_to_buff (Rob Jacob). - These are used in ccsm_msg to rearrange data from a lon-lat buffer - into chunk structure. - - -=============================================================== -=============================================================== - -cam2_0_2_dev15 -Originator: jet ( John Truesdale) -Date: Wed Apr 2 08:27:51 MST 2003 -Model: CAM -Version: CAM2.0_2.dev15 -One-line Summary: Added capability to output history tape fields on a column by column basis -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Changes made: - -I've added code and a set of namelist variables that allow fields for -a particular history tape to be written on a column by column basis. -The new namelist variables are named fincl1lonlat ... fincl6lonlat and -are used in conjunction with the fincl1 ... fincl6 namelist variables. - -Here is an example of how to use the new variables to define individual -columns or a lat/lon range of columns for output. - -1. Define a history tape with a set of fields that you would like to see - output at specific columns - - ex. fincl3 = 'LHFLX','SHFLX','PS','T','U' - -2. Define the columns for that history tape using fincl[1..6]lonlat - Like the fincl[1..6] specifiers all of the column identifiers are strings. - Specify the longitude in degrees followed by a single character - (e)ast/(w)est modifier. Follow this with an underscore ('_') and then - specify the latitude in degrees followed by a single character - (n)orth/(s)outh modifier. - - ex. fincl3lonlat = '30.5e_45.5n' - - will output the model column closest to 30.5 degrees east longitude - and 45.5 degrees north latitude for all fields defined by history tape - 3. - - You can specify a range of longitudes (or latitudes) by separating - the min and max values with a colon (':') like so - - ex. fincl3lonlat = '30e:40e_45n' - - will output the closest model columns from 30 to 40 degrees east - and at 45 degrees north for all fields defined on history tape 3. - - The latitudes/longitudes must be positive (real or integer). - - longitude values range from [0w to 180w] and [0e to 180e] - latitude values range from [90s to 0s] and [0n to 90n] - -3) Variables will be put on the history tape with the longitude and latitude - coded as part of the name. - - Ex. Using these namelist variables - - fincl3 = 'LHFLX','SHFLX','PS','T','U' - fincl3lonlat = '30.5e_45.5n','30e:40e_45n' - - will produce the following fields on history tape 3. - - LHFLX_30.5e_45.5n - LHFLX_30e_to_40e_45n - PS_30.5e_45.5n - PS_30e_to_40e_45n - SHFLX_30.5e_45.5n - SHFLX_30e_to_40e_45n - T_30.5e_45.5n - T_30e_to_40e_45n - U_30.5e_45.5n - U_30e_to_40e_45n - - The netcdf attributes for each field will be set to include the - actual latitude and longitude. This allows tools like ferret - to correctly plot the correct part of the world grid. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev14 -Originator: eaton ( Brian Eaton) -Date: Thu Mar 27 15:07:31 MST 2003 -Model: CAM -Version: CAM2.0_2.dev14 -One-line Summary: fix fv restart under lf95/debug and fix bug in pseudo-ozone test tracer -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, pc-linux-lf95 -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - ->> physics/cam1/restart_physics.F90 - in subroutine read_restart_physics add ->> calls to get_ncols_p inside the chunk loops and only assign the correct ->> number of columns worth of restart data into srfflx_state2d and ->> surface_state2d member arrays. ->> ->> physics/cam1/test_tracers.F90 - fix bug in subroutine test_tracers_timestep_tend. ->> All levels of the pseudo-O3 were being zeroed rather than just the bottom level. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev13 -Originator: hender ( Tom Henderson) -Date: Tue Mar 25 10:17:12 MST 2003 -Model: CAM -Version: CAM2.0_2.dev13 -One-line Summary: Fixes and upgrades to test scripts, change for omega in history output. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux-lf95 -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Erik Kluzek, Jim McCaa -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - - 1) Fixes to test-model.pl so -compare works (Kluzek). - 2) Shorten run length for SOM tests in test-model.pl (Kluzek). - 3) Script improvements to allow Wei to easily test lf95, pgf90-pgcc, and - pgf90-gcc in his automated runs (Henderson). - 4) Makefile changes to make pgf90 bfb restarts with different number of - processes work with the fv dycore (Henderson). - 5) Makefile changes to add Fortran optimization override environment - variable F_OPTIMIZATION_OVERRIDE (Henderson). - 6) test-model.pl upgrade to use F_OPTIMIZATION_OVERRIDE when pgf90 is - used for fv04-fv06 and fv10-fv13 tests (Henderson). - 7) test-model.pl upgrade to allow multiple test-model.pl incarnations to - be launched simultaneously from ncar_batch.csh (i.e. via queuing - systems) (Henderson, Kluzek). - 8) Modified ncar_batch.csh to pass the "-unique_id" option to - test-model.pl (Henderson). - 9) Changed $COMPARE_DIR/cam1 to $COMPARE_DIR in ncar_batch.csh to help - folks who use non-standard directory naming (Henderson). - 10) Upgraded CAM XML parser to latest version (Kluzek). - 11) Modified history file output to replace Omega@600mb with Omega@500mb - (McCaa and Henderson). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev12 -Originator: erik ( Erik Kluzek) -Date: Thu Mar 20 15:48:06 MST 2003 -Model: CAM -Version: CAM2.0_2.dev12 -One-line Summary: Fix bug in test-model with -compare and update XML::Lite from 0.11 to 0.14 -cam-bugs Requests resolved: 104 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Sun, Linux-PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, hender, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Update XML::Lite from 0.11 to 0.14. Creator of XML::Lite, gave us -a newer version as he said the old version had "a significant bug" -in it. - -Fix bug in -compare option for test-model.pl (bug #104). Previously -worked ok if you specified the dynamics, or for eul dynamics. It would -fail when it changed dynamics. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev11 -Originator: mirin ( Arthur Andrew Mirin) -Date: Thu Mar 13 17:21:11 MST 2003 -Model: CAM -Version: CAM2.0_2.dev11 -One-line Summary: Changes to transposes for 2D FV decomposition. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no; however one can now make with 64-bit addressing on IBM. -Substantial timing or memory changes: no -Requires change in run script: no; however, there are some new input options. -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes; however, bug in script, so could not verify. -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Will Sawyer -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None -Changes made: - - The main changes are in the area of transposes for the 2D FV decomposition. - - a. Transposes now include ghost points, which obviates extra ghost point - communication following the transposes. This improves performance, - but with limited impact because so few of the transposes involve ghost - points. - - b. Transposes now use the NASA/Goddard mod_comm package, which lies underneath - Pilgrim. This enables use of one-sided MPI-2 communications as well as - standard MPI. NASA/Goddard personnel report substantial gains on - the SGI when MPI-2 is used in place of standard MPI. - - c. Arrays containing extra points in any of the dimensions still cannot - be handled and must be copied into (out of) arrays without extra - points. Instead, the associated copies are, to the extent possible, - overlapped with other messages. This improves performance. - - d. The number of tracers to be transposed simultaneously is now specifiable. - Formerly, all tracers had to be transposed together. This facilitates - overlapping copying with communication (see above point). If there are - N tracers altogether, to be transposed in groups of M, one solves - N = Q * M + R, and does Q groups of M and 1 group of R. Preliminary - tests indicate that M=1 is good for coarse domain decompositions, - but that as the decomposition becomes finer, the latency of multiple - transpose calls outweighs the computation/communicaiton overlap - benefit. The default is M=6. - - e. A new method for initializing the transposes has been implemented. - Unlike the old methodology, this new method works for ghost points. - The method scales fine spatially but very poorly with the number of - tracers to be simultaneously transposed. Until this is fixed, - one would best limit M (see above point) to 6 (the default). - - f. We have been experimenting with MPI derived types, versus the current - method of copying data in and out of contiguous buffers. At present - we are getting mixed results. This option has been implemented for - MPI-1 only (not MPI-2). Further testing is underway. - - The files affected are: - Directory ...../src/dynamics/fv, files cd_core.F90, dp_coupling.F90, - dynamics_vars.F90, dynpkg.F90, geopk.F90, inidat.F90, - p_d_adjust.F90, pmgrid.F90, spmd_dyn.F90, stepon.F90, trac2d.F90. These are virtually all transpose-related changes. - - Directory ...../src/control, files cam.F90, spmdinit.F90. - The change to cam.F90 is to make sure TWOD_YZ is not set when SPMD - is unset. The change to spmdinit.F90 has to do with MPI - initialization on SGI machines when using MPI-2. - - Directory ...../utils/pilgrim, files Makefile, Makefile.conf.AIX, - Makefile.conf.IRIX64, decompmodule.F90, ghostmodule.F90, memstuff.c, - mod_comm.F90, parutilitiesmodule.F90, puminterfaces.F90, - redistributemodule.F90. - - Directory ...../utils/pilgrim/unit_testers, files Makefile, - decomptest.F90, ghosttest.F90, parpatterntest.F90, - parutilitiestest.F90, redistributetest.F90, unstructured.F90. - - Directory ...../bld, files Makefile, configure_fv.pl, script.m4. - The change to Makefile is to provide option for 64-bit addressing - on IBM. To do so, switch actual and commented lines to set - ADDRESS := Q64. The other two files are NASA/Goddard-specific. - - Directory ...../test/system, file llnl_frost.csh. - - A full diff of changes is on goldhill in ~mirin/diffs/diff_archive_cam2_0_2_dev10. - - Here is some information on new, as well as existing knobs: - - Two parameters have been added to the mprun2d namelist (used for 2D FV - decomposition) - geopktrans and tracertrans. Geopktrans refers to the - geopotential computation/communication method in geopk.F90. A value - of 0 (default), which results in the setting of geopk16byte false, - means that transposes are computed before and after the calls to - geopk (from cd_core) in order to do the vertical indefinite integrals - in geopk. A value of 1 causes geopk16byte to be set to true, - meaning that instead of computing transposes, partial sums in each - vertical subdomain are calculated and then communicated in z as - needed; 16-byte arithmetic may be used to guarantee bit-for-bit agreement - across domain decomposition; the default (for purposes of speed) is - 8-byte arithmethic. One can change to 16-byte arithmetic by editing - geopk.F90 to change DSIZE from 8 to 16 (switch actual and commented - statements). For performance purposes, the code should be used - as is with geopktrans equal to 1. The other parameter, tracertrans, - refers to the number of tracers simultaneously transposed (denoted by - M above); the default is 6 and in general need not be changed. - - One can implement MPI derived types in the transposes by activating - USE_MPI_TYPES in models/utils/pilgrim/parutilitiesmodule.F90. - This is unsupported - do so at your own risk. This bypasses mod_comm - and works for only MPI-1. One can make use of MPI-2 in mod_comm by - activating MPI2 at the beginniing of mod_comm.F90. Use of this is - definitely at your own risk. - - To run waccm configuration tests, please see instructions on goldhill - in ~mirin/waccm. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev10 -Originator: hender ( Erik Kluzek, tagged by Tom Henderson) -Date: Wed Mar 12 13:46:38 MST 2003 -Model: CAM -Version: CAM2.0_2.dev10 -One-line Summary: Added SOM test to test-model.pl. Various bug fixes. Update to ESMF_0_0_2p8 -cam-bugs Requests resolved: 101, 100, 99 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: yes, if running with new SOM --som option in configure now works. Default will behave as before. -Substantial timing or memory changes: no -Requires change in run script: yes, if running with new SOM -Must use initial and SST datasets that are compatible with SOM. See -/ftp/pub/erik/cam2_0_2.scidac-atm.datasets.tar.gz -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Intel-Linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Jim Rosinski, Erik Kluzek, Brian Eaton, Tom Henderson -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes to ESMF library: Update to ESMF_0_0_2p8, a pruned version of ESMF_0_0_2p5 -Changes made: - -Added SOM test to test-model.pl and fixed bugs: - -Add a SOM test for all dycores and for the control library. -Add new datasets needed for running with SOM. Reset namelist -each test in test-model.pl to make test-model.pl more robust. -Add a no-fail option to cam_timing so that when using -nofail -if a simulation aborts test-model.pl won't stop. Fix reporting -problem of different history files with -nofail. Improve the -diagnostic output of test-model.pl especially for the -nofail -case. Also be more careful at cleaning up data, such that data files -are deleted only after needed comparisions are done. - -New datasets are available under "datasets" on the cam developers -web page. - -Put, support message about ESMF in Makefile. - -U atm/cam/bld/DefaultCAMEXPNamelist.xml -U atm/cam/bld/Makefile -U atm/cam/doc/UsersGuide/test-model.html -U atm/cam/test/system/CAM_test.pm -U atm/cam/test/system/cam_timing.pm -U atm/cam/test/system/test-model.pl - -Bug fixes to make Lahey compiler happy: -U atm/cam/src/ocnsice/som/ocn_srf.F90 -U atm/cam/src/dynamics/fv/inidat.F90 -U atm/cam/bld/configure - -Changed these ESMF files to allow for removal of lots and lots of other -ESMF files: - -Update to ESMF_0_0_2p8, so can prune out unused files and directories. -Also turn off dependency of OMP, PCL, and MPI libraries. This simplifies, -shortens, and makes the ESMF make more robust. It also removes half of the -amount of disk storage for ESMF than was used before, several of the unused -code directories were removed and only the minimal set needed for using -the ESMF time manager. - -U utils/esmf/README -U utils/esmf/build/IRIX/ESMF_conf.h -U utils/esmf/build/IRIX64/ESMF_conf.h -U utils/esmf/build/alpha/ESMF_conf.h -U utils/esmf/build/linux_gnupgf90/ESMF_conf.h -U utils/esmf/build/linux_lf95/ESMF_conf.h -U utils/esmf/build/linux_pgi/ESMF_conf.h -U utils/esmf/build/rs6000_64/ESMF_conf.h -U utils/esmf/build/rs6000_64/base_variables -U utils/esmf/build/rs6000_sp/ESMF_conf.h -Ripped out lots and lots of ESMF files: -... - -Upgraded to simplify automated testing on anchorage with pgf90-pgcc and -pgf90-gcc: -U atm/cam/test/system/ncar_batch.csh - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev9 -Originator: rosinski ( Jim Rosinski) -Date: Wed Feb 26 17:59:48 MST 2003 -Model: CAM -Version: CAM2.0_2.dev9 -One-line Summary: Added SOM capability. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) except Linux-pgf90 is only roundoff -Changes to CLM land-model: None -Changes made: - -o Added Slab Ocean Model (SOM) capability. To enable, change som/ to dom/ -in Filepath, and add #define COUP_SOM in misc.h. - -For prescribed-ice control runs that will create fluxes for SOM, to get -good results CNTL_FORSOM must also be #defined. - -Climates have only been examined in EUL mode. SLD and FV do compile, but they -have not yet been tested. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev8 -Originator: jet ( John Truesdale) -Date: Wed Feb 19 16:51:27 MST 2003 -Model: CAM -Version: CAM2.0_2.dev8 -One-line Summary: fix bug in srface diagnostic variables - fsnslnd fsnsocn etc -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no - -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Changes made: -These mods were to fix a bug with the newly added surface diagnostics. -They were not giving bit for bit when restarting fv and sld runs. To -fix this I had to add some variables to the restart dataset -as well as put a n-1 timelevel of landfrac,ocnfrac,and icefrac into the -physics buffer. These n-1 timelevel values are used from the physics -buffer on restart. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev7 -Originator: hender ( Tom Henderson) -Date: Mon Feb 10 09:49:09 MST 2003 -Model: CAM -Version: CAM2.0_2.dev7 -One-line Summary: Grab bag -- Makefile, script, and source code fixes for SGI, Linux (PGI and Lahey), IBM -cam-bugs Requests resolved: 92, 88 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Lots of accumulated minor fixes for SGI, Linux, IBM. All bfb. Biggest change -is support for Linux-Lahey in source code and ncar_batch.csh. Brian Eaton, -Pat Worley, John Truesdale, Jim Rosinski, and Erik Kluzek contributed various -bits. -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Makefile, run-ibm.csh, ncar_batch.csh, ice_srf.F90, comsrfdiag.F90, -fv_prints.F90, test-model.pl (and files it uses) -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux-Lahey -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Brian Eaton (SGI bits in Makefile), Jim Rosinski -(Linux-Lahey bits in Makefile), John Truesdale (John made the fixes for -ice_srf.F90, comsrfdiag.F90, and fv_prints.F90), Erik Kluzek (Erik made the -fixes for test-model.pl) -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: -Note: This is item #018 on CAM Check-in List "Fix performance bug in Makefile - for SGI (formerly CAM task list #02.12.19.5)". It's scope has expanded - a bit. -A- Modified Makefile for SGI so LDFLAGS has options and libraries in the - correct order ( -mp -lmp -lmpi ) as described by Pat Worley. -B- Added Brian Eaton's fix for run-ibm.csh: - "On the IBM there are 3 environment variables that allow you to specify the - node/task configuration. The 2 that are set in the run-ibm.csh file imply - that the total number of mpi tasks (procs) is 2. It's likely that your job - has procs=1 due to the 3rd environment variable, MP_PROCS, being set - somewhere else, like your .cshrc or .profile file (perhaps by the SCD - supplied default version of these files). The fix I'd suggest is to add - the command "unsetenv MP_PROCS" to run-ibm.csh file in the POE Environment - settings section." -- Brian Eaton -C- Added Brian Eaton's fix for run-ibm.csh to ncar_batch.csh too. -D- Added support for the Lahey compiler on anchorage to ncar_batch.csh. PGI - becomes an option, Lahey the default. -E- Added John Truesdale's fixes for ice_srf.F90, comsrfdiag.F90, and - fv_prints.F90. This allows versions cam2_0_2_dev1 and later to work - with the Lahey compiler. Prior to these fixes, lf95 was complaining about - unintialized variables (etc.). -F- Erik Kluzek fixed test-model.pl to work around a problem on bluesky. -G- Changed pgf90 optimization from -fast to -O1 in Makefile to fix bfb problem - with test-model.pl test #fv06 (compare initial run to restart run with - different number of processors for fv dycore). All other tests were - passing bfb with -fast. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev6 -Originator: pworley ( Patrick H Worley) -Date: Wed Feb 5 15:19:36 MST 2003 -Model: CAM -Version: CAM2.0_2.dev6 -One-line Summary: New 1D decomposition for Fourier and Spectral domains in SLD dycore, for improved performance -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes, faster for large processor counts -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: No (bit-for-bit) on SGI and Compaq; Yes (same-to-roundoff) on IBM -Changes to CLM land-model: changed division by parameter to division by local copy in lnd_grid, to eliminate compiler complaint -Changes made: - -Implemented a consistent wavenumber decomposition for Fourier -and Spectral domains in SLD dycore, decreasing MPI communication and -storage requirements. Wavenumber decomposition also modified, -to improve load balance and decrease amount of communication. -This modification is similar to that in cam2_0_1_dev3, except for -SLD instead of EUL. - -Routines modified in dynamics/sld: comspe, courlim, dyn, dyndrv, -dynpkg, grcalc, hordif, quad, realloc4, realloc7, scan2, scandyn, -scanslt, spegrd, spmd_dyn, trunc, tstep, tstep1, vertnm. -Routines deleted in dynamics/sld: realloc3, realloc6 . - -Also, changed division by parameter to division by a local -copy of the parameter in two places in lnd_grid, to eliminate -a compilation failure with some versions of the IBM compiler. -(Fix provided by Art Mirin.) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev5 -Originator: eaton ( Brian Eaton) -Date: Tue Jan 21 12:33:04 MST 2003 -Model: CAM -Version: CAM2.0_2.dev5 -One-line Summary: makefile/configure changes -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, pc-linux -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Add ability to specify additional flags to the C compiler and to the loader -(this ability already exists for the Fortran compiler). This provides -flexibility in porting to new platforms. - -Change Makefile so that the Filepath, Srcfiles, and Depends files are -explicitly in the current directory. This fixes a bug which occurs when -make finds a Srcfiles file in the VPATH, and that Srcfiles is newer than -the Filepath (which results in Srcfiles not being created in the current -directory and the command to build the Depends file fails). - -Add an option to configure to allow the configuration cache file to be -created in a different directory than the CAM build directory. The default -behavior of configure is unchanged. - -Fix a broken configuration. The combination of omp on linux using pgf90 -and gcc resulted in the timing library being built without threading -enabled. Removed the setting of the THREADED_PTHREADS and THREADED_OMP cpp -macros from utils/timing/gpt.h and set these in the Makefile. This also -allows them to be set only when SMP is true. They were previously set to -use threads whether the rest of the model was threaded or not. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev4 -Originator: hender ( Tom Henderson) -Date: Fri Jan 17 11:23:15 MST 2003 -Model: CAM -Version: CAM2.0_2.dev4 -One-line Summary: ncar_batch.csh: added support for test-model.pl with -compare option -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - -The new ncar_batch.csh can be used to do bitwise comparison with a previous -source version. The test-model.pl script is run internally with the -compare -option. - -For NQS or PBS, the new usage is: ->> env SCRIPT_DIR=`pwd` COMPARE_DIR=$MYBASEDIR qsub ncar_batch.csh - -For LoadLeveler, the new usage is: -env SCRIPT_DIR=`pwd` COMPARE_DIR=$MYBASEDIR llsubmit ncar_batch.csh - -In both cases, directory $MYBASEDIR should contain the source code for the -previous version. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev3 -Originator: jet ( John Truesdale) -Date: Mon Jan 13 08:53:33 MST 2003 -Model: CAM -Version: CAM2.0_2.dev3 -One-line Summary: Added diagnostics for surface budget calculation, moved sst/ocn interpolation to correct minor flux bug -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Apache -Ran test-model.pl script: yes: Only on IBM -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: Yes (new-physics) -Changes to CLM land-model: None (one-line description) -Changes made: - -Added diagnostics to allow for surface energy budget calculations. The -following diagnostics were added: - -FSNSLND,FSNSOCN,FSNSICE,FLNSLND,FLNSOCN,FLNSICE,SHFLXLND,SHFLXOCN,SHFLXICE, -LHFLXLND,LHFLXOCN,LHFLXICE. - -Also added the following diagnostics to provide ocean/ice forcing for som -model - -FSNSOI,FLNSOI,SHFLXOI,LHFLXOI - -Moved the interpolation of ocean and ice right before the surface routines -that use them. SSTINT and ICEINT were previously at the top of the time -loop before tphysbc in the routine advnce. I removed them from advnce and -placed them after tphysbc right before camocn and camice. This corrected -a minor bug in the models use of fluxes calculated by camocn and camice. -Previously new fluxes were computed by camocn and camice with a set of -land, ocean, and ice fractions. The time loop ended, advnce was called, -new surface fractions computed and then tphysbc used the fluxes calculated -the previously time around only using the new fractions instead of the -surface fractions used to compute the fluxes. tphysbc now uses the time -level of fractions appropriate for the fluxes that are being read in. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev2 -Originator: rosinski ( Jim Rosinski) -Date: Thu Jan 9 17:16:38 MST 2003 -Model: CAM -Version: CAM2.0_2.dev2 -One-line Summary: Add evap bugfix to ice_srf.F90 per C. Bitz -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Changes made: - -o One-line chage adds sublimation over sea ice to evaporative flux in ice model. - Changes answers beyond roundoff. Analysis of effects of this change available at: - www.cgd.ucar.edu/cms/rosinski/analysis/20shrconstevap-cam20shrconst/sets.htm - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_2_dev1 -Originator: hender ( Tom Henderson) -Date: Mon Jan 6 15:25:38 MST 2003 -Model: CAM -Version: CAM2.0_2.dev1 -One-line Summary: Minor improvements to batch execution of test-model and User's Guide updates -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and Erik -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Description: - CAM_lab.pm Update linux defaults - CAM_test.pm Fixed bug so "FAIL" is printed when a test fails (instad of - "ran"). Only affected the -nofail option. - ncar_batch.csh Updated to chinook "ded_16" queue and added PBS stuff for - anchorage. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev17 -Originator: erik ( Erik Kluzek) -Date: Fri Dec 20 15:42:18 MST 2002 -Model: CAM -Version: CAM2.0_1.dev17 -One-line Summary: Small script change for testing, Makefile change to run on Compaq -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, Sun, Linux-Lahey, Linux-PGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - -Point to new test-production.pl baseline. - -Change Makefile to run on Compaq. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev16 -Originator: mvertens ( Mariana Vertenstein) -Date: Thu Dec 19 14:31:58 MST 2002 -Model: CAM -Version: CAM2.0_1.dev16 -One-line Summary: updated cam documentation for cam2_0_2 release -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: None -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: -Updated cam documentation for cam2_0_2 release. -Clm documentation has already been updated. -Did not modify any code. -=============================================================== -=============================================================== - -cam2_0_1_dev15 -Originator: mvertens ( Mariana Vertenstein) -Date: Wed Dec 18 21:19:12 MST 2002 -Model: CAM -Version: CAM2.0_1.dev15 -One-line Summary: updated clm to clm2_deva_08 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: (see below) - tested that clm2_deva_08 worked with CCSM -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes -Changes made: -1) Updated clm user's guide to clm2.1 -2) Fixed restart problem for clm2.1 auxiliary history files -=============================================================== -=============================================================== - -cam2_0_1_dev14 -Originator: erik ( Erik Kluzek) -Date: Tue Dec 17 16:14:46 MST 2002 -Model: CAM -Version: CAM2.0_1.dev14 -One-line Summary: Fix script problems use new datasets, update to ccsm2_0_beta61 -cam-bugs Requests resolved: 76, 79, 84, 85 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes (IBM) -Machines tested: IBM, SGI, Sun, Linux (PGI,Lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -- Except Z050 field changes! -Changes to CLM land-model: None - -New datasets: - - Add capability for 1x1.25 for FV. Use new datasets for FV 2x2.5. - Download the new cam2.0.2 set of SCIDAC datasets for use with - this version of the model. - -Fix test-model.pl bug in comparision: - - Fix comparision problem in test-model.pl. Also fix so that - doesn't use as much disk-space. And change so that does - a error-growth test with the control code. - -Fix build-namelist bug: - - Fix bug in writing out long lists. - -Fix bug in Z050: - - Z050 was 5 mbar surface rather than 50 mbar surface. - -Fix PGI bug for open-MP processing: - - Delete a specific OpenMP loop in dynamics/fv/inidat.F90 that - caused answers to change with number of processors. - -Update to ccsm2_0_beta61: - - Update models/bld and scripts to ccsm2_0_beta61. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev13 -Originator: mvertens ( Mariana Vertenstein) -Date: Mon Dec 9 09:49:17 MST 2002 -Model: CAM -Version: CAM2.0_1.dev13 -One-line Summary: clm code updated to development tag clm2_deva_07 (clm2.1 code) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -New (converted) clm initial datasets must be used -see DefaultCLMEXPNamelist.xml -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, Sun, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: Yes (for clm only) -Changes answers: Yes (same-to-roundoff, same-climate) -Changes to CLM land-model: YES (updated to clm2.1 data structures) -Changes made: - -1) clm2.1 has replaced clm2.0 in the current code. - updated models/lnd/clm to clm development tag clm2_deva_07 - The differences are roundoff. - Two climate simulations were done to verify this commit. - case: /OLESON/csm/eul_201dev10 - cam2_0_1_dev10 (clm2.0) - case: /OLESON/csm/eul_201dev10_06 - cam2_0_1_dev10 (clm2.1 - tag clm2_deva_06) - The two cases were been compared with the standard climatological SST simulation - using CAM2.0.dev24 (case eul20dev24_a) and show the same climate - Performance on blackforest is effectively the same. - -2) initial clm datasets used with clm2.0 are no longer compatible with clm2.1 - surface datasets used with clm2.0 will work with clm2.1 - restart files used with clm2.0 are not compatible with clm2.1 - a conversion tool has been created (see directory models/lnd/clm2/tools/convert_inic) - running gmake in this directory will generate the conversion tool executable, convert_inic - datasets needed by configure have already been converted and have been placed in the - directory /fs/cgd/csm/inputdata/lnd/clm2/inidata_2.1/cam - -3) the xml file DefaultCLMEXPNamelist.xml in models/atm/cam/bld has been modified - to point to the converted clm2.1 initial datasets - -4) the following tests were done using test-model.pl: - tests platform status - ------------------------------------------------------------------ - eul:1-6:64x128L26 ibm (blackforest) success - eul:1-6:64x128L26 sgi (chinookfe) success - eul:1-6:64x128L26 linux (apache) lf95, pgf90 success - eul:1-6:64x128L26 sun (flagstaf) success - eul:1-6:64x128L26 compaq (ornl-colt) cannot test due to know problem starting with - cam2_0_1_dev10 on compaq - eul:1-6:48x96L26 ibm (blackforest) success - eul:1-6:48x96L26 sgi (chinookfe) success - eul:1-6:48x96L26 linux (apache) pgf90 success - eul:1-6:48x96L26 sun (flagstaf) success - eul:1-6:48x96L26 compaq (ornl-colt) cannot test due to know problem starting with - cam2_0_1_dev10 on compaq - fv:1-6:2x2.5L26 ibm (blackforest) success - fv:1-6:2x2.5L26 sgi (chinookfe) success - fv:1-6:2x2.5L26 linux (apache) lf95 success (know problem with pgf90 on restart due to openmp) - fv:4-6:2x2.5L26 sun (flagstaf) success - fv:1-6:2x2.5L26 compaq (ornl-colt) cannot test due to know problem starting with - cam2_0_1_dev10 on compaq - sld:1-6 ibm (blackforest) success - sld:1-6 sgi (chinookfe) success - sld:1-6 linux (apache) lf95 success - sld:1-6 sun (flagstaf) success - sld:1-6 compaq (ornl-colt) cannot test due to know problem starting with - cam2_0_1_dev10 on compaq - sld:1-6:64x128L26 ibm (blackforest) success - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev12 -Originator: eaton ( Brian Eaton) -Date: Tue Nov 26 17:48:40 MST 2002 -Model: CAM -Version: CAM2.0_1.dev12 -One-line Summary: new physics buffer and misc makefile changes -cam-bugs Requests resolved: none -Requires change in build system: yes -ccm366 physics now requires pnats=0 (done by configure) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, pc-linux-lf95 -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: yes, one fewer timelevel saved for cld, tcwat, qcwat, -and lcwat fields. -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Implement new physics buffer (phys_buffer.F90) to manage fields that -persist across timesteps or that are communicated between different physics -packages within a time step. Eventually the buffer.F90 module will be -replaced. For now only the fields used by the stratiform cloud condensate -scheme are being managed by the physics buffer. - -The new module in cldcond.F90 is the start of an implementation of the new -physics interface for the cloud condensate parameterization. It currently -just deals with the fields that use the physics buffer. These fields save -a dycore dependent number of timelevels in the buffer, and that number has -been reduced by one from the buffer.F90 implementation (i.e., eul saves 2 -old timelevels while fv and sld just save one). - -Removed the need to declare pnats=1 for a cloud water constituent which -wasn't used when running with ccm366 physics. The configure script now -sets pnats=0 in that case. - -Modify Makefile, configure, and config_cache_defaults.xml to support using -netCDF f90 interface. The environment variable MOD_NETCDF should be set to -the directory that contains the netCDF module files. This capability is not yet -required as CAM isn't currently using the netCDF Fortran 90 interface. - -Added -qmaxmem=-1 to the AIX fflags for optimization. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev11 -Originator: eaton ( Brian Eaton) -Date: Thu Nov 21 19:12:10 MST 2002 -Model: CAM -Version: CAM2.0_1.dev11 -One-line Summary: constituent initialization mods -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, pc-linux-lf95 -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no, except for a specific non-production configuration described below -Changes to CLM land-model: None -Changes made: - -Implemented mods to allow specifying for each constituent whether the -initial values are to be read from the initial file or set by an -initialization routine. The namelist variable readtrace now serves to set -the default value for all constituents except water vapor (its default -value is .true.). The default may be overridden by an optional argument in -the calls that register the constituents. The optional argument may be set -by namelist variables that are managed by the constituent's package, or may -be hardwired in the call. The ghg chemistry package uses the default value -determined by readtrace. The test_tracers package hardwires the initial -values to be set by an initialization routine. Thus it is no longer -necessary to set readtrace=.false. to run the test_tracer package in CAM. -The namelist variables nusr_adv and nusr_nad have been disabled. - -In the FV dycore only, the initialization of constituents has been modified -to initialize one constituent at a time. This is to reduce the memory -requirements since we couldn't fit the waccm configuration (2x2.5, 66 -levels, 50 constituents) on the ibm-winterhawk2 nodes. - -The mods do not change answers in the production model. However the -following configuration has non-bfb changes: When the ghg chemistry is run -using initial values that are set by its initialization routine (rather -than being read from the initial file), the answers change due to changed -initial values. The ghg initial values are set with uniform distributions -rather than having a decay in the stratosphere as was previously done. -Byron believes this distribution will spin up to an equilibrium state more -quickly than the previous initial distribution. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev10 -Originator: eaton ( Brian Eaton) -Date: Thu Nov 14 19:03:59 MST 2002 -Model: CAM -Version: CAM2.0_1.dev10 -One-line Summary: fix some uninitialized variables so lf95 debug mode works -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, pc-linux-lf95 -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself. Pat Worley provided the mods. -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - -These mods fix a couple of references to uninitialized variables that caused a -runtime error in executables built w/ lf95 and strict error checking. -The test-model.pl debug test (test 1) now works on all dycores with lf95. -Also fixed a couple of incorrect intent attributes. - -Mods: -dynamics/{eul,sld}/linemsdyn.F90 - init vcour to 0. -vmax2d, vmax2dt, and vcour declared intent(inout) in -1) sld/realloc7.F90 -2) sld/dyndrv.F90 (in both PVP and nonPVP branches) -3) sld/courlim.F90 -cam1/radctl.F90 - fix outfld call for qrl - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev9 -Originator: eaton ( Brian Eaton) -Date: Thu Nov 14 09:31:24 MST 2002 -Model: CAM -Version: CAM2.0_1.dev9 -One-line Summary: change AIX optimization from O3 to O2 -cam-bugs Requests resolved: 75 -Requires change in build system: no -Substantial timing or memory changes: didn't do performance tests -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - -Makefile changes for AIX only: -O3 --> O2, and remove -qstrict which is only needed with -O3 -Use -qsmp=omp:noopt in debug mode. - -Surprisingly (at least to me) the answers are bfb when changing from "-O3 -qstrict" to "-O2". - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev8 -Originator: forrest ( Forrest Hoffman) -Date: Wed Nov 13 12:37:22 MST 2002 -Model: CAM -Version: CAM2.0_1.dev8 -One-line Summary: Fix for new code introduced in cam2_0_1_dev7 that caused run-time failures on SGI and Linux -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM (cheetah), SGI (thanks to Mariana Vertenstein) -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Mariana Vertenstein -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Fixes to lp_coupling -Changes made: - -Replaced intent(out) with intent(inout) for srfflx to avoid passing -undefined elements back to the atmosphere physics since only land point -values are filled. This problem was exhibited under SGI IRIX and -Linux. - -Added working scalars to the private clause of the OpenMP do parallel -statements to assure appropriate scope. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev7 -Originator: forrest ( Forrest Hoffman) -Date: Fri Nov 8 15:46:07 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: introduced clump land model decomposition and implemented new alltoall comm between atm and lnd -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes, about 7x speedup in cam<->clm communications (only) -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Mariana Vertenstein, Pat Worley -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: New land model decomposition on clumps and alltoall comunication for CAM+CLM configuration -Changes made: - -1. Added new subroutine get_chunk_coord_owner_p() to phys_grid for - both cam1 and ccm366 versions. - -2. Added lnd_grid module containing the following: - - public surface_grid_init ! initializes land surface decomposition - public get_nclumps ! returns the number of clumps defined - public get_clump_cell_id_coord ! returns clump/cell ids based on lon/lat - public get_clump_owner_id ! returns clump owner based on clump id - public get_clump_ncells_proc ! returns number of cells for process - public get_clump_ncells_id ! returns number of cells in clump - public get_clump_tpatch_proc ! returns number of patches for process - public get_clump_tpatch_id ! returns number of patches in clump - public get_clump_coord_id ! returns lon/lat coordinates based on id - public get_clump_patchinfo ! returns patch id and number of patches - public get_clump_patchwt ! returns patch weight based on patch num - - surfage_grid_init() performs the land model domain decomposition into - clumps of grid cells containing patches. Clumps are private derived - data types which may be accessed through a suite of functions and - subroutines also contained in lnd_grid (see above). - -3. Added lp_coupling module containing the following: - - public lp_coupling_init ! initialize clump<-->chunk mapping - public lp_coupling_finalize ! destroy clump<-->chunk mapping - public alltoall_clump_to_chunk_init ! communicate fluxes from lnd to atm - public alltoall_clump_to_chunk ! communicate fluxes from lnd to atm - public alltoall_chunk_to_clump ! communicate fluxes from atm to lnd - - lp_coupling_init() initializes the mapping between atmosphere - physics chunks and land model clumps. It also allocates buffers - for use by subroutines within the module which perform the alltoallv - communication/transposition of surface state and fluxes between the - atmosphere and the land. This coupling is used when CAM and CLM are - run together as a single executable (when COUP_CAM is defined). - -4. Removed lnd_atmMod module which previously did processor mapping - for coupling. - -5. Modified atm_lndMod module to use routines from lp_coupling for coupling. - Added TIMING_BARRIERS barriers for communications timing tests. - -6. Modified clm_map subroutine to call surface_grid_init() (lnd_grid) for - domain decomposition and lp_coupling_init() (lp_coupling) to initialize - the atm<->lnd coupling. - -7. Added npes=1 definition even for the case when SPMD is undefined so - that new domain decomposition works correctly when running SMP-only. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev6 -Originator: pworley ( Patrick H Worley) -Date: Wed Nov 6 22:34:11 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: Fixed minor bugs introduced in cam2_0_1_dev3 that were found with Lahey and SGI compilers -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - - All changes in dynamics/eul only: - - 1) Modified courlim and dyndrv to change intent of vmax2d, - vmax2dt, and vcour from in to inout. - 2) Modified grcalc to set dalpn(2) to zero on processors - that do not calculate it. This eliminates a failure in - the SGI test-model DEBUG tests from using an uninitialized - variable. (dalpn(2) is used to calculate zurcor, which is - used only on the processor which also calculates dalpn(2). ) - 3) Moved an array initialization using array syntax - out of an OpenMP loop, as a - work around for a pgf90 compiler error. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev5 -Originator: bshen ( Bo-Wen Shen) -Date: Wed Nov 6 09:22:18 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: Changed DAO scripts -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: Yes (in DAO scripts) -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) - -Changes to CLM land-model: None (one-line description) -Changes made: - - - Modified DAO scripts (configure_fv.pl and script.m4) to run -the model on DAO SGI machines. - - 1. Defined SMP in Make.macros when OpenMP is used - to run a hybrid mode on SGI. - 2. Changed the way to call system_cmd, which is - written in C and does not accept a function name - (trim in this case) as an argument on DAO SGI. - 3. Modified mswrite/msread which will generated at run time - 4. Calculated total # of CPUs and passed the # to PBS - directives - - -=============================================================== -=============================================================== - -cam2_0_1_dev4 -Originator: eaton ( Brian Eaton) -Date: Wed Oct 30 07:46:47 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: implement ghg surface values module -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, pc-linux -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -This set of mods is in preparation for further mods to implement the new -physics interface design for initializing constituents. The current loop -to initialize constituents that are not read from the initial file (in -{eul,fv,sld}/inidat.F90) contains a call to ramp_ghg(). This function sets -surface values for the ghg constituents which are used by the radiation -codes as well as by the ghg chemistry code. The mods being committed -gather the code which is responsible for setting surface values of the ghg -constituents, and time interpolating them (ramping) from an annual dataset -if requested, into the single module in the file ghg_surfvals.F90. - -The new module ghg_surfvals does the following: -. maintains the values co2vmr, co2mmr, n2ovmr, ch4vmr, f11vmr, and f12vmr - as public data -. maintains the namelist variables scenario_ghg and rampyear_ghg. The - meaning of these variables has not changed. -. provides ramping functionality (time interpolation) when scenario_ghg is - set to 'RAMPED'. The data used by the ramp is determined by an include - statement in the module. Either file ramp_ghg_bau.h or ramp_ghg_stab.h - may be included. These .h files contain data formated as module data. - When using ramped data the default is to interpolate to the current - time. This may be modified by setting the rampyear_ghg variable to a - valid year which is then used to produce values that will cycle within - that fixed year. - -Files added: -physics/{cam1,ccm366}/ghg_surfvals.F90 - -Files removed: -physics/{cam1,ccm366}/ramp_ghg.F90 -physics/ccm366/comvmr.F90 - -Files changed: -control/preset.F90 -control/parse_namelist.F90 -control/comctl.h -control/restart.F90 -physics/cam1/constituents.F90 -physics/cam1/{chemistry.F90,radae.F90,radini.F90,trcmix.F90} -physics/cam1/ramp.h -physics/cam1/{ramp_ghg_bau.h,ramp_ghg_stab.h} -physics/cam1/crdcon.h -physics/cam1/radini.F90 -physics/cam1/{radcswmx.F90,trcpth.F90} -physics/cam1/advnce.F90 -physics/ccm366/ramp_ghg.F90 -physics/ccm366/{ramp_ghg_bau.F90,ramp_ghg_stab.F90} -physics/ccm366/constituents.F90 -physics/ccm366/{radabs.F90,radems.F90,radinp.F90} -physics/ccm366/radini.F90 -physics/ccm366/crdcon.h -physics/ccm366/{radcsw.F90,trcpth.F90} -physics/ccm366/trcmix.F90 -physics/ccm366/chemistry.F90 -physics/ccm366/physconst.F90 -physics/ccm366/inidat.F90 -physics/ccm366/advnce.F90 -dynamics/{eul,fv,sld}/inital.F90 -dynamics/{eul,fv,sld}/inidat.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev3 -Originator: pworley ( Patrick H Worley) -Date: Sun Oct 27 18:17:22 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: New 1D decomposition for Fourier and Spectral domains in EUL dycore, for improved performance -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: Yes, faster for large processor counts -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: John Drake, Michael Ham -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - Implemented a consistent wavenumber decomposition for Fourier - and Spectral domains in EUL dycore, decreasing MPI communication and - storage requirements. Wavenumber decomposition also modified, - to improve load balance and decrease amount of communication. - Routines modified: comspe, dp_coupling, dyn, dyndrv, - dynpkg, grcalc, hordif, linemsdyn, quad, realloc4, realloc7, scan2, - scandyn, scanslt, spegrd, spmd_dyn, trunc, and tstep. Also, - realloc3 and realloc6 no longer needed and deleted. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev2 -Originator: pworley ( Patrick H Worley) -Date: Sun Oct 27 09:10:31 MST 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: In-lined two temporaries in grcalc, so that new EUL dom. decomp. will be bit_for_bit on the IBM in next check-in -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and Jim Rosinski -Restart files change: no -Changes answers: no on Compaq, yes on IBM (same-to-roundoff, same-physics) -Changes to CLM land-model: None -Changes made: - - Eliminated tmpr and tmpi in grcalcs and grcalca in dynamics/eul/grcalc.F90: - - tmpr = alps(ir)*alp(mr+n,irow) - tmpi = alps(ii)*alp(mr+n,irow) - - in-lining the expressions in the two places where each - of them is used.This causes roundoff level changes to the solution - on the IBM, but not on the HP/Compaq. With this change, the restructuring - of the domain decomposition used in the spectral Eulerian (next check-in) - will be bit-for-bit. This check-in is used to isolate and document - the source of the roundoff change. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_1_dev1 -Originator: sawyer ( William Barton Sawyer) -Date: Sun Oct 20 00:53:30 MDT 2002 -Model: CAM -Version: CAM2.0.1 -One-line Summary: Bug fix for tracer advection (from S.-J. Lin) -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit -Changes to CLM land-model: None -Changes made: - - Retagged cam2_0_dev26 to confirm with new tagging scheme. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev26 -Originator: sawyer ( William Barton Sawyer) -Date: Fri Oct 18 07:48:14 MDT 2002 -Model: CAM -Version: CAM2.0.dev26 -One-line Summary: Bug fix from FVGCM for multiple advected constituents (S.-J. Lin) -cam-bugs Requests resolved: unlisted -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Lin -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - src/dynamics/fv/trac2d.F90: bug fix, dp2 copy to dp1 - moved from above label 5000 to between labels 5000 and 6000 - - bld/script.m4: changes to avoid runtime errors in DAO runs - which resulted from bug fix 64 (shell cmd now returns error code). - - Note: test-model.pl is successful but does not test the - multiple advected constituent case. This change will be - further tested by DAO runs. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev25 -Originator: erik ( Erik Kluzek) -Date: Wed Oct 2 08:33:38 MDT 2002 -Model: CAM -Version: CAM2.0.dev25 -One-line Summary: Fix run-pc.csh script. -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: Linux-PGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - -Fix run-pc.csh so will run without a core-dump on apache. To do this -I changed it from pur-SPMD to pure-OpenMP mode. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev24 -Originator: erik ( Erik Kluzek) -Date: Tue Sep 24 22:42:42 MDT 2002 -Model: CAM -Version: CAM2.0.dev24 -One-line Summary: Fix minor problems (tau units, SGI system call, FV array) -cam-bugs Requests resolved: 64,65,66 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! (SGI, IBM) -Machines tested: IBM, SGI, lf95, PGIF90, Solaris -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself,mvertens,boville (units) -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Use "C" wrapper for SGI system call -Changes made: - -Units change: (cam-bugs 66) - - Surface stress was identified as N, consistently use N/m^2. - -FV fix: (cam-bugs 65) - - Make cut array allocatable and dimension acording to npes. - -SGI System routine: (cam-bugs 64) - - Use a "C" wrapper to system call on SGI so that the return -code can be queried. - -INT long-name: - - Change long-name on PRECCINT and PRECLINT to note that to -get intensity (average precipitation of precipitating events), you -divide by PRECCFRQ or PRECLFRQ respectively. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev23 -Originator: eaton ( Brian Eaton) -Date: Fri Sep 20 15:41:12 MDT 2002 -Model: CAM -Version: CAM2.0.dev23 -One-line Summary: updates to User Guide -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: none -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - -Made changes to the sections on configuring and building CAM. Added new -material on the run scripts. Edited details of config files and make -procedure in appendix B. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev22 -Originator: rosinski ( Jim Rosinski) -Date: Fri Sep 20 14:50:14 MDT 2002 -Model: CAM -Version: CAM2.0.dev22 -One-line Summary: fix potential memory overwrite bug in radae.F90 -cam-bugs Requests resolved: 63 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -o Fixed potential memory overwrite bug in radae.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev21 -Originator: erik ( Erik Kluzek) -Date: Mon Sep 16 23:41:41 MDT 2002 -Model: CAM -Version: CAM2.0.dev21 -One-line Summary: Add new output fields: PRECCINT, PRECCFRQ, PRECLINT, PRECLFRQ, and Z050 -cam-bugs Requests resolved: 46, 61 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! (IBM) -Machines tested: IBM, SGI, Linux-PGI, Linux-Lahey, Solaris -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -New output fields and namelist items: - - PRECCINT, PRECCFRQ, PRECLINT, and PRECLFRQ. Precipitation that -exceeds a given threshold (PRECC_THRESH = 0.1mm/hr and PRECL_THRESH=0.05mm/hr -by default, both can be set on the namelist). - -Fix minor problem with FV with Lahey: - -Update ccsm scripts to ccsm2_0_beta54: - -Fix so Solaris would work: - - Reduce optimization level. - -Minor changes to test-production.pl: - - Remove files after completion, new reference simulation. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev20 -Originator: rosinski ( Jim Rosinski) -Date: Mon Sep 16 14:38:10 MDT 2002 -Model: CAM -Version: CAM2.0.dev20 -One-line Summary: Implement shared constants in ice code. NOTE: no control run for this tag yet exists. -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, PC -Ran test-model.pl script: not yet. -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode:no -Code reviewed by: myself -Restart files change: no -Changes answers: Yes (new-climate) -Changes to CLM land-model: None (one-line description) -Changes made: - -o Use shared constants in CSIM4 ice code. -o Have not yet run test-model, but will today. Wanted to get commit in - because folks are waiting for it. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev19 -Originator: eaton ( Brian Eaton) -Date: Sat Sep 14 10:24:24 MDT 2002 -Model: CAM -Version: CAM2.0.dev19 -One-line Summary: implement the Makefile SMP option for linux-pgf90 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: pc-linux-pgf90 -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - - Added SMP option to the pc-linux-pgf90 section of the Makefile. Set - the default value of SMP to true since that replicates previous Makefile - behavior (the -mp flags were hardwired into the pgf90 settings). But - note that the default in the configure script sets SMP false for pc-linux. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev18 -Originator: olson ( Jerry Olson) -Date: Fri Sep 6 17:29:17 MDT 2002 -Model: CAM -Version: CAM2.0.dev18 -One-line Summary: bugfix in sld/scan2.F90 -cam-bugs Requests resolved: none -Requires change in build system: no -(one-line description of changes: fixed treatment of non-advected tracers in sld/scan2.F90 -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: no -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - - sld/scan2.F90 was copying cloud water from one time level to - another. Loop was generalized to copy *all* non-advected - tracers. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev17 -Originator: sawyer ( William Barton Sawyer) -Date: Thu Sep 5 06:48:57 MDT 2002 -Model: CAM -Version: CAM2.0.dev17 -One-line Summary: Allowed 3 latitudes per process; improvements from fvgcm-1_3_71 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, S.-J. Lin -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - In src/dynamics/fv: - - spmd_dyn.F90 Test for >= 4 latitudes now - >= 3 latitudes per process; tested - 72x46x26 with 12 processes and - 144x91x26 with 24 processes. Works. - cd_core.F90 Integrated optimizations and restructuring - from fvgcm-1_3_71. Zero diff changes. - Note that some experimental changes - from FVGCM (HIGH_P, value of tau) - have not yet been integrated. - sw_core.F90 Now includes upol5, vpol5 - upol5.F90 Removed - vpol5.F90 Removed - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev16 -Originator: erik ( Erik Kluzek) -Date: Wed Aug 28 11:22:02 MDT 2002 -Model: CAM -Version: CAM2.0.dev16 -One-line Summary: Fix deadlock with scenario_so4, fix various bugs, - T85, T170 in scripts, update to clm2_3_dev32, ccsm2_0_beta53 -cam-bugs Requests resolved: 37, 49, 51, 52 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! (IBM) -Machines tested: IBM, SGI, Compaq, Solaris, PGF90 -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: update to clm2_3_dev32 -Changes made: - -Build changes: - - Fix bug in "configure -test", so that tests will be done -in cam_bld directory, and then return to pwd. Add ability to do -T85, and T170 resolutions. Change prun in CAM_lab.pm for running -in hybrid mode. - -History restart fix: - - History restart files weren't going to mass store -- now -they do. - -Decomposition set in phys_grid_init rather than in call to it: - - Previously there were four locations to determine the -chunking decomposition type. - - Also remove the "is_lsm" and "is_phys366" methods. Always -assume that lsm will ONLY be run with phys366 and CLM will ONLY be -run with the new physics. - -Update CLM to CLM2_3_dev32 - - This fixes a problem with getting clmi files at T170. - -Fix deadlock problem with scenario_so4: - - A parameter was only set on masterproc that needed to be -set on all nodes. - -Update to ccsm2_0_beta53 and scripts_a020822 - - both scripts and models/bld directories. scripts_a020822 fixes -a minor problem in ccsm2_0_beta53 scripts. - -Test scripts: - - Add test-example.pl script to run the examples from the -users guide. Does limited checking to ensure things work as expected. -This is setup to run on blackforest. - - Add ability to set the remote lab in the "-errgro" option -in test-model.pl. This allows for port validation for remote -machines. Also delete more files that test-model.pl produces when -running in the default "clean" configuration. This prevents having -lots of wasted disk space for test-model.pl tests. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev15 -Originator: sawyer ( William Barton Sawyer) -Date: Wed Aug 7 07:58:09 MDT 2002 -Model: CAM -Version: CAM2.0.dev15 -One-line Summary: Completed merge of fvgcm-1_3_56 te_map, cleaned up remaining t3/tvm arrays -cam-bugs Requests resolved: none -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - src/dynamics/fv: - - te_map.F90: completed merge of fvgcm-1_3_56 te_map.F90 - code is same except for 2D decomposition - additions - dynpkg.F90: removed tvm, tvmxy arguments (information is - in pt, ptxy) - dp_coupling.F90:Use pt/ptxy instead of t3/t3xy - stepon.F90: remove t3xy entirely, t3 from d_p_coupling - arguments - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev14 -Originator: sawyer ( William Barton Sawyer) -Date: Tue Aug 6 09:01:22 MDT 2002 -Model: CAM -Version: CAM2.0.dev14 -One-line Summary: Patched FV communicator bug in coupled mode; T3 reset to phys_state%t in p_d_coupling; config. improvments -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - models/utils/pilgrim: - - parutilitiesmodule.F90, mod_comm.F90: extended initialization - routines to accept an optional communicator from which - the FV global communicator is determined. - - models/atm/cam/bld - - configure_fv.pl, fvtest.sh, script.m4: for DAO - code execution, renamed run script fvcam.j, - number of threads, processes renamed to DAO - convention AGCM_N_PROCESSES, AGCM_N_THREADS_PER_PROCESS - - models/atm/cam/src/dynamics/fv - - dp_coupling.F90 : t3 reset to phys_state%t in p_d_coupling - (suggestion from Brian). - - stepon.F90 : modified arg list to p_d_coupling, removed - explicit transpose of T3XY->T3 for 2D decomp. - - spmd_dyn.F90 : pass mpicom to ParInit. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev13 -Originator: jet ( John Truesdale) -Date: Thu Aug 1 16:03:16 MDT 2002 -Model: CAM -Version: CAM2.0.dev13 -One-line Summary: Fix initialization problem with fractional land, doesn't affect climate, only for CAM not CCSM -cam-bugs Requests resolved: 43 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: no (does all of the following tests) -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: Yes ( new-physics) -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Changes made: -initext now uses the ts value from the land initialization routine instead -of the value returned from the update surface fluxes routine. I added an -array to save off these values and apply them after iceint is called. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev12 -Originator: erik ( Erik Kluzek) -Date: Wed Jul 31 14:20:10 MDT 2002 -Model: CAM -Version: CAM2.0.dev12 -One-line Summary: Add 2D-decomp for FV to bld, Fix Solaris climate, add production test, add timing parser, fix various bugs -cam-bugs Requests resolved: 17, 20, 27, 30, 31, 33, 35, 36, 37, 39 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: yes - (makes use of the _OPENMP CPP token when SMP on, compiler options - must set this) -Substantial timing or memory changes: no -Requires change in run script: Yes - (dif4 now required on namelist if Eulerian and not T42) -Tested to work coupled with CCSM: Yes! (IBM) -Machines tested: IBM, SGI, Solaris, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -FV 2D parallel decomposition option added to bld scripts: - - Requires a new namelist (mprun2d). - Also added a "-fv2d" option to test-model.pl to run fv tests - with 2D decompostion. Also fix the constraint in src/dynamics/fv - so that the npr_yz array from the namelist is checked properly. - -Solaris: - Change Makefile so that model gives climate similar to IBM. - -Makefile: - Add CPPDEF for CPP definitions used by all platforms. Also - include a new token "CAM" declared when compling code with CAM. - Remove "-d" on AIX, and turn on "-g, -qfullpath" in - production mode so that when the model core-dumps you can - query the core files to find where it died. - -dif4: - Now require dif4 to be set on namelist for Eulerian dynamics not - at T42 resolution. - -restart-pointer files: - Get rid of getfil for restart-pointer file and add an optional - argument to opnfil, so that "old" can be given for type so that - the model will die if a restart pointer file doesn't exist. - -Fix some problems with using scenario_so4: - Fix write statements before "call endrun" so that they will be - written even if not on masterproc. Also broadcast sulfdata to all - nodes. There still seems to be other problems with this configuration. - -namelist: - Fix namelist parsing so that repeat declarations can be used - (i.e. mfilt = 4*1). Also update the change method so that it parses - as a regular namelist which allows arrays to be entered and more - complex namelist entries. -test/system: - Add ccm366 test and SMP=FALSE test to test-model.pl (unless on - AIX, ensure that SMP test gives same answers as SPMD). Add "-fv2d" - option to test-model.pl to check FV 2D decompostion. Add some simple - performance checking to test-model.pl. Add test-production.pl - a script to run the production model from Sep to Feb/1 weekly - to ensure the model is running as expected. - -check-timing.pl: - Add a script to do straight forward parsing of timing.* files to - look at performance. Simplist operation is as follows: - - check-timing.pl directory1 directory2 - - Options also exist to load the log-files in, and casenames, as - well as a list of timers to parse in the file. To get help invoke - it with "-help" or without any arguments. - -ESMF: Update to ESMF_0_0_2p5 (fixes problem with compiling on Sanitas) - This small update changes the name of "conf.h" to ESMF_conf.h - so that it won't find the wrong file in the search path. It also - removes the hard-wired use of /usr/local/include. Also previous - model versions didn't have all files updated to ESMF_0_0_2p4, and - this update fixes that problem. - -FV now passes LF95 strict checking tests with test-model.pl: - - Arrays in restart_physics:write_restart were going over pcols - rather than cols for FV. By having the arrays only go to ncols - this worked with LF95 and FV. - -phys_grid.F90: - Change a difficult to understand OMP loop used to get the - number of threads to a more straight-forward OMP subroutine call. -CCSM: - Update to ccsm2_0_beta50. Add table for dif4 to atm.setup.csh. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev11 -Originator: sawyer ( William Barton Sawyer) -Date: Tue Jul 30 09:22:20 MDT 2002 -Model: CAM -Version: CAM2.0.dev11 -One-line Summary: te_map.F90 aligned with latest FVGCM version; optimizations: overlapping communication/computation -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, W. Putman -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - src/dynamics/fv/te_map.F90 - - o Removed CPP token OLDWAY - o Aligned with latest FVGCM version - o Restructured communication (particularly for 2D - decomposition) to overlap communication with computation - as much as possible. Slight performance gains conceivable. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev10 -Originator: sawyer ( William Barton Sawyer) -Date: Mon Jul 15 10:20:32 MDT 2002 -Model: CAM -Version: CAM2.0.dev10 -One-line Summary: Merged latest work from DAO FVGCM version fvgcm-1_3_44 -cam-bugs Requests resolved: none -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Lin, Putman, Shen -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - atm/cam/src/dynamics/fv - - sw_core.F90, tp_core.F90, upol5.F90, vpol5.F90 -- - changes by Putman allow runs with only 3 - latitudes per PE - - trac2d.F90 -- cache optimizations by Lin for tracer advection - - utils/pilgrim - - mod_comm.F90 -- latest version from FVGCM - Makefile.conf.IRIX64 -- support recent change #include - unit_testers/Makefile rather than #include "file.h" - - atm/cam/test/system - - dao_batch.csh -- batch script to run test-model.pl on DAO - machines (currently tropic and dycore) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev9 -Originator: sawyer ( William Barton Sawyer) -Date: Thu Jul 4 14:12:43 MDT 2002 -Model: CAM -Version: CAM2.0.dev9 -One-line Summary: Bug fixes for 2D domain decomposition, LF95 strict error checking -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - - in src/dynamics/fv: - - inidat.F90 : chunking patch suggested by Pat Worley - - restart_dynamics.F90: bufres now allocated on all PEs - (for LF95 strict error checking) - - sw_core.F90, tp_core.F90 : revision by S.-J. Lin - crx in tpcc now ghosted +/- ng_c latitudes - - benergy.F90, cd_core.F90, trac2d.F90, uv3s_update.F90: - fix for 2D domain decomposition on IBM -- - pole PEs now do not accidently send data - to lower or upper levels. Code still does - not work on all IBM 2D configurations but - it is getting closer. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev8 -Originator: sawyer ( William Barton Sawyer) -Date: Mon Jun 24 02:12:01 MDT 2002 -Model: CAM -Version: CAM2.0.dev8 -One-line Summary: FV patches for Lahey strict error checking -Requires change in build system: no -ubstantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - src/dynamics/fv: - - mapz_module.F90:Q2 now INOUT in map1_ppm, mapn_ppm, - because Q1 (IN) and Q2 (was OUT) - were being passed same array - - sw_core.F90: crx now declared (im,jfirst-ng_d:jlast+ng_d) - passed to tpcc crx(1,jfirst-ng_d). - No error when ng_d == 0 (SMP-only) - - tp_core.F90: In tpcc, dummy argument crx now declared - crx(im,jfirst-ng:jlast+ng). No error when - ng (== ng_d) == 0. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev7 -Originator: erik ( Erik Kluzek) -Date: Thu Jun 20 23:48:55 MDT 2002 -Model: CAM -Version: CAM2.0.dev7 -One-line Summary: #include "" to <>, Fix Solaris make, Fix SLD for Lahey, change coupled restarts, fix sort, update csm_share/bld/scripts, fix clm restart -cam-bugs Requests resolved: 19, 18, 25, 26 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes! (IBM, restarts tested as well) -Machines tested: IBM, SGI (some testing on Solaris, and Linux/Lahey) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, olson (sld) -Restart files change: yes (but only if COUP_CSM set) -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Fix restart pointer files for long casenames -Changes made: - -SLD changes for Lahey strict error checking: - - Small changes to q arrays sent to a few routines so that - dimension of arrays would pass strict error checking in Lahey - compiler. - -Restarts: - - Change restarts when running coupled (COUP_CSM on), so that - data not used for coupled runs not output/read. This also allows - model to use the restart files from the b20.007 simulation. - -Sort routines: - - Change sort routines in responce to bug found by Phil Rasch. - -csm_share: - - Update csm_share to share2.1.3. - -Misc: - - #include "" to #include <> - Initialize ctitle and let it be up to 256 characters. - Put "if (masterproc)" around write(6 statements for ramping. - test-model.pl, get rid of global data used for setting up tests. - Replace it with methods. This is a better more robust solution. - Add -qfullpath when debug on for IBM. - Update models/bld, and scripts directories to ccsm2_0_beta47. - Get coupled scripts to work with CAM directory structure, and - change so that restart can work. - -CLM: - Don't limit length on string read in from restart pointer file, - as this causes problem when casenames are long. - -Solaris: - - Change Makefile so that model will work, get rid of special - F77 compilation and use new autopromotion flag in the new compiler. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev6 -Originator: mvertens ( Mariana Vertenstein) -Date: Thu Jun 20 15:31:15 MDT 2002 -Model: CAM -Version: CAM2.0.dev6 -One-line Summary: put chunking into coupled model -Requires change in build system: no -cam-bugs Requests resolved: 24 -(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) -Substantial timing or memory changes: Yes - (significant performance improvement when chunking is turned on) -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI -Ran test-model.pl script: no (does all of the following tests) - Changes only affected coupled model model -Code reviewed by: myself, erik -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - - Put chunking into coupled model - - Verified bfb with ccsm2_0 and that PCOLS=16 and PCOLS=128 was bfb the same - on the SGI and IBM in coupled mode - - Verified that coupled model restarts and branches correctly - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev5 -Originator: eaton ( Brian Eaton) -Date: Wed Jun 19 19:49:37 MDT 2002 -Model: CAM -Version: CAM2.0.dev5 -One-line Summary: build procedure mods, memory allocation mods -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Erik -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - - Remove ccm366/cldwat.F90 - not used - - Add capability to bld/build-namelist to build LSM namelists - - bld/configure - Add -[no]smp option - Add -pcols option - - Makefile: - Add SMP macro to allow enabling/disabling openMP without having - to edit Makefile. Currently only implemented for AIX and SGI. - Get rid of the -macro_expand option to SGI f90 because - it's not needed when you use -cpp. - - physics/cam1/phys_grid.F90 - move globalfield allocation from stack to heap - in write_field_from_chunk and read_chunk_from_field - - dynamics/{eul,fv,sld}/stepon.F90 - move stack memory allocation of - 3-D physics and dynamics data structures to heap - - models/ice/csim4/ice_tstm.F - change first character of comment lines - starting with c to ! - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev4 -Originator: erik ( Erik Kluzek) -Date: Sat Jun 15 08:04:21 MDT 2002 -Model: CAM -Version: CAM2.0.dev4 -One-line Summary: Remove precision module, and use csm_share/shr_kind_mod - instead with renames to r8,r4,i8 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, eaton -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes, same change to precision as above. -Changes made: - -Precision change: - - Remove precision module and use csm_share shr_kind_mod module - to get precision types. Use the rename feature to get the names - that were used in the precision module. - -Tools change: - - Make same change to the tools: cprnc, definesurf, interpic, mkrgrid, - and cprlndnc. In this case keep a local copy of shr_kind_mod for - their use. Made sure each tool changed would build after the change. - -Bug-Fix: - - Added definition of CPP_INTEGER4 to pilgrim.h as was needed to - get fv to build. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev3 -Originator: sawyer ( William Barton Sawyer) -Date: Thu Jun 13 07:39:36 MDT 2002 -Model: CAM -Version: CAM2.0.dev3 -One-line Summary: Solved SUN compilation problem; further merging of FVGCM into CAM; bug fix for SMP-only -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, SUN -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Putman, Mirin -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - models/atm/cam/bld: - configure_fv.pl, script.m4, revised for cam2_0 data sets (Mirin) - - models/atm/cam/src/dynamics/fv: - - pft_module.F90 : merged from FVGCM (minor additions) - sw_core.F90 : merged from FVGCM - cd_core.F90 : bug fix in call of c_sw - modified to use pft_module and sw_core - - models/atmlnd_share: - - precision.F90 : added i4 needed by DAO (mod_comm) - - models/utils/pilgrim: - - mod_comm.F90 : fixed SUN compilation problem, upgrade (Putman) additions for STAND_ALONE mode (Sawyer) - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev2 -Originator: sawyer ( William Barton Sawyer) -Date: Tue Jun 4 09:40:49 MDT 2002 -Model: CAM -Version: CAM2.0.dev2 -One-line Summary: Merge of FVGCM (DAO) software engineering improvements into CAM2 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM (test-model.pl) SGI (DAO A26, B26 cases) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Bill Putman, others -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - - This merges cam1_8_dev6_brnch_fvgcm_merge with cam2_0_dev1. - - models/utils/pilgrim: - - Newest version of mod_comm (but does not yet solve - real -> real(r8) promotion problem on SUN). - Upgrade of other modules for use in CAM-DAS - restructuring and upgrades of unit testers. - - models/atm/cam/src/dynamics/fv: - - Software engineering improvements from FVGCM (DAO) - - benergy.F90 cd_core.F90 d2a3dijk.F90 d2a3dikj.F90 - dp_coupling.F90 dynpkg.F90 highp2.F90 hswf.F90 - p_d_adjust.F90 te_map.F90 trac2d.F90 uv3s_update.F90 - use new mod_comm interface. - - mod_mpi.F90 removed. - - mapz_module.F90 consolidates vertical interpolation routines: - kmppm.F90 map1_ppm.F90 map3_ppm.F90 ppm2m.F90 steepz.F90 - - inidat.F90 initcom.F90 pmgrid.F90 spmd_dyn.F90 trunc.F90 - minor structural changes - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam2_0_dev1 -Originator: erik ( Erik Kluzek) -Date: Mon Jun 3 14:10:23 MDT 2002 -Model: CAM -Version: CAM2.0.dev1 -One-line Summary: Fix test-model.pl problems, fix problems running Lahey - for Eul dy-core, add T31 namelist options -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM (some testing on Linux with Lahey--lf95) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -T31: - - Add namelist options and datasets needed to run T31. - -test-model.pl - - Fix a couple problems with test-model.pl. Will now properly -run through the list of all dynamics. Start refactoring to a more -general way to run through the tests with object methods rather than -global data. Put quotes around run env variables, allow setting of -interactive option in CAM_namelist, make sure CAM objects have everything -properly set withe either setenv or setcfg. - -Lahey fix: - - A few changes to dynamics/eul so that qfcst arrays can be properly -dimensioned. Inside spegrd and tfilt_massfix copy qfcst from i1 to nlon+i1-1, -so that strange things with memory don't have to be done. This allows -tests 1 and 2 with test-model.pl to work for Eulerian dynamics. Test 13 fails. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev11 -Originator: erik ( Erik Kluzek) -Date: Fri May 17 10:37:16 MDT 2002 -Model: CAM -Version: CAM1.8.dev11 -One-line Summary: License update, icefrac bug-fix, build fixes, dataset name changes, fix test-model.pl so that validation could be done -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes - (dataset names change) -Tested to work coupled with CCSM: yes! (IBM) -Machines tested: IBM, SGI, Linux-PC-PGI - (some testing on Compaq, Linux-Lahey, and Solaris) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -License update: - Update to CAM license as reviewed by Bill Collins and Catherine - Shea (NCAR lawyer). - -icefrac bug-fix: - Fix problem introduced in cam1_8_dev10 on initialization of - icefrac. - -Build fixes: - Various fixes to build scripts to work on machines at ORNL. - -Name changes: - - Dataset names change to be consistent with the following format: - - _YYYY-MM-DD__L__.nc - - resolution for spectral dycores is refered to as nlatxnlon, with - the spectral truncation following. So for example, Eulerian T42 is - refered to as: 64x128_T42, SLD T63 is 64x128_T63. Datasets that - don't have a specific spectral truncation associated with them - leave off the spectral truncation part (so initial datasets run - through definesurf or most land datasets). - - Example: - - cami_0000-09-01_64x128_L26_c020514.nc - -test-model.pl - - Fix test-model.pl so that release version of the model could be - validated. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev10 -Originator: erik ( Erik Kluzek) -Date: Mon May 13 12:01:17 MDT 2002 -Model: CAM -Version: CAM1.8.dev10 -One-line Summary: Replace Numerical-Recipe code, Lahey fixes for multiple constituents, Update to ccsm2_0_beta45, update to clm2_3_dev30, some Solaris and Compaq fixes -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes -Machines tested: IBM, SGI, Linux-PGI, Linux-PGI/GCC - Some testing with Solaris and Compaq, but not everything works. -Ran test-model.pl script: yes (does all of the following tests) - (test-model.pl currently broken test-model ran with previous version) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Update to clm2_3_dev30 -Changes made: - -Known problem: - This model core-dumps in the standard configuration due -to a problem with the initialization of icefrac. - -Lahey fixes: - - Do some fixes for strict error checking with Lahey compiler when -using multiple constituents. - -Numerical Recipes sorting routines replaced: - - Numerical Recipes routines CAN NOT be publically released, so -they were replaced by Tony Craig's implementation of the same alogrithm. - -cprnc: - - Fix cprnc so it would work on Solaris. Solution was a Kludge to -get it to work. More work should be done to find the underlying problem. - -CCSM2_0_beta45 update: - - Update models/bld and scripts to ccsm2_0_beta45. - -CLM2_3_dev30 update: - - Update CLM to clm2_3_dev30. - -test-model.pl - - With the new build stuff in place test-model.pl is currently -broken. It will be fixed as soon as possible (which may be after the -model release). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev9 -Originator: eaton ( Brian Eaton) -Date: Mon May 13 11:22:15 MDT 2002 -Model: CAM -Version: CAM1.8.dev9 -One-line Summary: merge newbld branch -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: none -Ran test-model.pl script: no - it's officially broken -Tested on fv dynamics: no -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: no -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself, Erik -Restart files change: no -Changes answers: no -Changes to CLM land-model: None (one-line description) -Changes made: - -Added new build scripts and user docs. - -atm/cam/bld/configure produces the Filepath, misc.h, params.h, preproc.h files, -and a Makefile. - -atm/cam/bld/build-namelist produces a namelist file - -test-model.pl is currently broken because Erik's mods to have it use CAM_namelist.pm -have not been completed. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev8 -Originator: erik ( Erik Kluzek) -Date: Wed May 8 17:41:26 MDT 2002 -Model: CAM -Version: CAM1.8.dev8 -One-line Summary: Fix CCSM restart problem -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes! IBM -Machines tested: IBM -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes (eul coupled only) -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - -Fix problem where restarts when running coupled were not bit-for-bit. -All changes are isolated to ccsm_msg.F90. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev7 -Originator: jet ( John Truesdale) -Date: Wed May 8 16:22:05 MDT 2002 -Model: CAM -Version: CAM1.8.dev7 -One-line Summary: definesurf to extend ross ice shelf by default, clean up csim error messages -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no or Yes (describe) -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: yes -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Restart files change: no -Changes answers: no -(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) -Changes to CLM land-model: None (one-line description) -Changes made: -Fix to definesrf to make it extend ross ice shelf by default. Non-land -below S79 is set to land so that land will treat the area as glacier. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev6 -Originator: sawyer ( William Barton Sawyer) -Date: Wed May 8 07:59:26 MDT 2002 -Model: CAM -Version: CAM1.8.dev6 -One-line Summary: FV patches to help pass lf95 strict error checking, Erik's fix of tphysbc.F90 to pass FV test 1 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI, Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, erik -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - - bld: configure_fv.pl and script.m4 upgraded for cam1_8 - - src/physics/cam1: tphysbc.F90 fix by Erik to pass FV test 1 - - src/dynamics/fv: - - avgc.F90 : retired - cd_core.F90 : inlined avgc.F90 - dp_coupling.F90 : intent(inout) u3s (it's updated during ghost) - dynamics_vars.F90: temporary arrays allocated for SPMD only - dynpkg.F90: 2D decomposition arrays now allocated consistently - pmgrid.F90: initialize 2D decomp variables for non-2D case - stepon.F90: 2D decomposition arrays now allocated consistently - - utils/pilgrim: - - mod_comm.F90: intent(inout) q in BufferUnPack*D - -Note: it will pass lf95 strict error checking in SPMD mode on Linux - only if following routines are compiled with DEBUG FALSE: - fv_prints.F90, restart_dynamics.F90 and restart_physics.F90. - Strict error checking yields errors in those routines which - may be related to the chunking mechanism. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev5 -Originator: erik ( Erik Kluzek) -Date: Tue May 7 13:03:41 MDT 2002 -Model: CAM -Version: CAM1.8.dev5 -One-line Summary: Fix problem with restarts when running coupled. -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: yes! IBM (full "K" test suite) -Machines tested: IBM -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: No -- not when running coupled! -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - -Change ONLY ccsm_msg.F90 so that restarts would work. Ran the -full CCSM test GUI on the BIM (blackforest). - -This version has a bug in it where restarts are not exact when -running coupled. This problem is fixed in cam1_8_dev8. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev4 -Originator: rosinski ( Jim Rosinski) -Date: Thu May 2 15:12:01 MDT 2002 -Model: CAM -Version: CAM1.8.dev4 -One-line Summary: xlf90 bugfix for h_override. make clean deletes esmf. flint complaints. modified timing calls. Added lf95 to definesurf makefile. -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None (one-line description) -Changes made: - -o Bug in xlf90 caused h_override to behave improperly. -o "make clean" now deletes esmf/ directory as well as .o, etc. files -o Fixed some flint complaints. -o Added lf95 entry to definesurf makefile. -o Modified some of the calls to the timing library. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev3 -Originator: erik ( Erik Kluzek) -Date: Wed May 1 22:25:25 MDT 2002 -Model: CAM -Version: CAM1.8.dev3 -One-line Summary: Output field changes, cam1 to cam2, FLAND to LANDFRAC, - fix vertinterp, longname for constituents -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: yes - (Restart pointer files are now cam2 instead of cam1, restart files have cam2 in name) -Tested to work coupled with CCSM: Yes! (SGI and IBM) -Machines tested: IBM, SGI, Linux-PGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens (and input from wcollins, pjr, and boville) -Restart files change: no -Changes answers: no (bit-for-bit) (although DTCOND different) -Changes made: - -Output field changes: - - DTCOND -- Changed to be defined by dry static energy instead of - temperature to be more consistent with current alogrithms. - This change is from Fabrizio Sassi. - New fields: - WSPEED -- Wind speed (default maximum) - FSDSC --- Clearsky downwelling solar flux at surface - PRECTMX - Maximum precipitation rate - (Add above to monthly files) - Put TREFMNAV and TREFMXAV on output monthly files for non-coupled case. - - These changes are in ccsm-bugs as request 19. - -Change instances of cam1 to cam2: - - Change occurances of cam1 to cam2 in output file names and code comments. - -FLAND on initial files is now LANDFRAC: - - Have initial files that are produced use the name LANDFRAC instead -of FLAND to be consistent with history files. This also put attributes on -the field which didn't happen with the FLAND name. For backwards compatability -allow the names on the initial files to be either LANDFRAC or FLAND. - -vertinterp: - Apply a fix to vertinterp as found by Art Mirin. This fixes a problem - if the interpolation pressure happens to exactly equal the pressure - at a data-point. Recorded in ccsm-bugs as request 29. - -Constituents module now has longname data element: - - Add longname to constiuents module and set it as an optional argument - in add_cnst. When add_cnst called if appropriate set longname to - something useful. - -Coupled: - Change scripts to look at inputdata/atm/cam2 input directory. - Fix log-file output problem by adding a if( masterproc) on - the "stopping at end of day" print. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev2 -Originator: erik ( Erik Kluzek) -Date: Sat Apr 27 09:39:39 MDT 2002 -Model: CAM -Version: CAM1.8.dev2 -One-line Summary: Update to cam1_8_dev1_brnchT_esmfup4 -- - Update to ESMF_0_0_2p4, clm2_3_dev29, ccsm2_0_beta41, simple fixes, - nix scatter/gather aliasing for CCSM -Requires change in build system: Yes (ESMF build changes) -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! (SGI and IBM) -Machines tested: Some testing on all platforms: - IBM, SGI, Compaq, Solaris, Linux-PGI, Linux-Lahey, Linux-PGI/GCC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Update to clm2_3_dev29 -Changes to ESMF: Update to ESMF_0_0_2p4 -Changes made: - -ESMF update: Update to newer version of ESMF with name changes from - mf_ to esmf_. The newer ESMF simplifies the build by not needing - dependence on OMP or MPI, so nothing is referenced outside the - ESMF distribution. - -CLM2 update: Update to clm2_3_dev29 which works with ESMF version above. - -CCSM Update: Update models/bld and scripts directories to ccsm2_0_beta41 - version of the scripts. Also put PCOLS define in CCSM scripts rather - than hardcoded in ppgrid.F90. Ran csm.csh test on babyblue and utefe. - Bit-for-bit with non-SPMD version and bit-for-bit with previous - model. - -CCSM Scatter/Gather aliasing: Get rid of the aliasing (using the same array - for input and output) in the mpigather and mpiscatter calls in - ccsm_msg.F90. In the process create a new allocatable array allocated - on masterproc and an old array allocatable so that only dimensioned - from beglat:endlat. This reduces the total amount of memory needed - for the mpi scatters and gathers. - -Solaris: Fix a couple subscript problems caught on solaris in history.F90. - Then as a particularly difficult problem was caught, turn subscript - checking off for solaris when DEBUG=TRUE. - -phys_grid.F90: Get updates from Pat Worley and Art Mirin to generalize - phys_grid.F90 in cam1 for odd numbers for FV dynamics. Tried same - routine in ccm366 physics, but results in problems. - -ORNL -Colt: Add settings needed to CAM_lab.pm to run on colt.ccs.ornl.gov. - -Testing: Ran at least some test-model.pl tests on all platforms: - - Linux-PGI (Apache, longs), Linux-Lahey (Apache, compile test on longs) - Linux-PGI/GCC (Apache, longs), SGI (utefe), IBM (babyblue, eagle@ornl), - Solaris (sanitas, test 1 works), Compaq (colt@ornl tests 2-5 with SPDM off) - - There are problems with some of the standard tests in test-model.pl - on particular platforms. These problems will need to be cleanup in - before model release. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_8_dev1 -Originator: erik ( Erik Kluzek) -Date: Mon Apr 22 13:11:18 MDT 2002 -Model: CAM -Version: CAM1.8.dev1 -One-line Summary: Move cam1_7_dev34_brnchT_fractional_8 branch to the development branch -Requires change in build system: Yes! - Filepath requires new directories -Substantial timing or memory changes: Yes (running with new ice-model is slower) -Requires change in run script: Yes - New set of SST and Initial condition files are required. -Tested to work coupled with CCSM: Yes! (IBM and SGI) - (bit-for-bit with ccsm2_0_beta38) -Machines tested: IBM, SGI, Compaq, Sun, Linux-Lahey, Linux-PGI - (Sun compiles but doesn't run, Compaq core-dumps on error-growth - test, Linux-PGI core-dumps on error-growth test with fv dynamics) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, John Truesdale, Mariana Vertenstein, Jim Rosinski -Restart files change: yes! -Changes answers: new-physics -Changes to CLM land-model: Interface changes -Control cases: - /EATON/csm/fv2x-fland05 -- Finite-Volume with PCMDI SST's. - /JET/csm/sldnewicefrac01 -- SLD dynamics with PCMDI SST's. - /ROSINSKI/csm/newsstclim03 - Eulerian dynamics with Hurrell - Hadley Center OI / Reynolds blended SST data climatology. - /ROSINSKI/csm/newsstamip02 - Eulerian dynamics with Hurrell - blended monthly SST data. -Changes made: - -Physics: - - Fractional land and ocean: Old binary ORO flag is gone replaced - by the fractions: landfrac, icefrac, and ocnfrac. Also the old - flag on SST datasets is done away with and ice-cov is used for - sea-ice concentrations. comsrf.F90 was reworked as part of this change. - Also the offline tool "definesurf" was changed to work with the - new datasets. "interpic" continues to work with IC files as well. - - New ice-model: A modified version of the CCSM Sea-Ice model - Community Sea-Ice Model (csim4) is included with the model - now in the "models/ice/csim4" directory. The old ice-model is - included in the new directory "models/atm/cam/src/ocnsice/dataicemodel". - -CCM3.6.6 Physics: - - The CCM3.6.6 physics is still supported although now it can ONLY - be run with Eulerian dynamics/LSM and the old data ice/sst model. - The old version of the data ice model codes are in the "physics/ccm366" - directory. - -Namelist changes: - - prognostic_icesnow -- If TRUE determine snow-depth over ice prognostically - otherwise use a climatology. - reset_csim_iceprops -- Reset the CSIM ice-model initial properties - (used on a new initial run if the model blows up). - -Script / Makefile changes: - - Filepath, datasets and new variable "ICEMODEL" added to deal with - the two ice-models (CSIM4 or CCMDATA). Lahey error-checking added - to Makefile. Initial datasets now require the land-fraction on - them in the variable "FLAND". When using the new ice model - SST datasets are required to have the variables "SST_cpl" (for SST), and "ice_cov" for sea-ice concentration. - - "NEWBUILD=TRUE" option now the only way to use the standard makefile. - The old "makdep" dependency generator logic ripped out of the Makefile - and deleted from the "tools/makdep" directory. - - Users guide updated to reflect changes. DatasetLog updated with - new datasets. - -New datasets: - To obtain the new tar-ball of datasets: - - ftp ftp.cgd.ucar.edu - cd pub/erik - bin - get cam1_8.scidac-atm.datasets.tar.gz - -Error-growth: - - Error-growth is much faster than previous versions of the model. - Error-growth is still high using the dataicemodel and active-land. - Using prognostic_icesnow=.false. improves error-growth, and using - standard T42L26 datasets provides reasonable error-growth. Also - running error-growth with aqua_planet on provides reasonable error-growth. - -Coupled model: - - landfrac, and ocnfrac are now binary values of 0.0 or 1.0 in - accordance to how ORO was previously assigned in the model. This - should eventually be changed to use the values the coupler send - explicitly. - -test-model.pl: - - Change restart tests to restart after 5 time steps. - Change error-growth full-physics test to use prognostic_icesnow=.false. - and aqua_planet=.true. and use date from dataset rather than Dec/31. - Delete the SOM test and add a new test to make sure using the - dataicemodel works. - Fix problem with recognizing old files. - -interpsst gone: - - The old tools/interpsst code removed as it will not work with the - new SST files. Also new tools for creating SST datasets are in - development. The new tools use the Hurrell SST datasets and also - modify data so that when a linear time-interpolation is applied - to the mid-monthly datapoints the observed monthly average is - reconstructed. It's unclear when the new tools will become part - of the distribution. - -Changes to make most of the model Lahey compliant: - - Small changes to large amounts of the code so that strict error-checking - with the Lahey compiler can be performed on most of the model. The - files: binary_io.F90, wrap_nf.F90, wrap_mpi.F90 have not been converted. - As part of this change the routines bouyan, and cldprp where moved - to inside the zm_conv.F90 file. - -Bug-fixes: - - Fix in phys_grid.F90 for SGI. - Fix in filenames.F90 for IBM. - -Known problems: - - IBM -- history.F90 still doesn't always compile when DEBUG=TRUE. - Compaq -- Model core-dumps with "floating invalid" when running - error-growth test on Compaq (Colt @ ORNL) - The model compiles but has trouble running on the Sun. Subscript overflow - problem when running compiler checking (Sanitas @ NCAR). - Linux-PGI -- fv: When running FV dynamics and Error-growth the model - aborts with an error - "DEALLOCATE: memory at 43d18c10 not allocated" - (Apache @ NCAR) - - SOM -- New model does not work with the slab-ocean model. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev34 -Originator: rosinski ( Jim Rosinski) -Date: Fri Mar 29 16:44:22 MST 2002 -Model: CAM -Version: CAM1.7.dev34 -One-line Summary: Bugfix to tphysbc.F90 to keep uninitialized data (in ptend) from being used. -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, PC -Ran test-model.pl script: yes (does all of the following tests) - NOTE: fv tests on IBM failed for both this commit and the comparison - previous library due to compiler bugs. But all ran OK on PC. -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) presuming the short tests are sufficient to ensure no garbage - from stack being used -Changes to CLM land-model: None -Changes made: - -o Contents of local variable ptend in tphysbc were being used uninitialized. No ill symptoms were - noticed in the dev branch, but the fractional branch was randomly seg faulting or encountering - a floating point error when restarting on 16 nodes on blackforest. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev33 -Originator: pworley ( Patrick H Worley) -Date: Tue Mar 12 14:30:32 MST 2002 -Model: CAM -Version: CAM1.7.dev33 -One-line Summary: load-balanced physics option; PCOLS cpp token for setting pcols; SOM chunking bug fix -Requires change in build system: yes -PCOLS cpp token required to set pcols in ppgrid.F90. params.h.in.csh modified to do this automatically. -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM and Compaq at ORNL -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and Marcia Branstetter -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -1) Changed phys_grid_init call. Instead of specifying number of - columns per chunk, now specify number of chunks per thread. - This then sets the number of columns per chunk appropriately, - guaranteeing that the same number of chunks can be assigned - to each processor. Files affected: - - control/restart.F90 - control/wrap_mpi.F90 - dynamics/eul/inital.F90 - dynamics/sld/inital.F90 - dynamics/fv/inital.F90 - physics/cam1/phys_grid.F90 - physics/ccm366/phys_grid.F90 - -2) Augmented physics domain decomposition options: - opt == -1: same as before (latitude-slice chunk, for compatibility - with ccm366 physics, lsm1, and CSM) - opt == 0: For a given MPI process, all chunks have the same number - of columns, and each thread associated with a process has - the same number of chunks. Columns are assigned to chunks - to improve load balance between chunks (compared to - the default ordering), but without requiring - interprocessor communication in dp_coupling. - opt == 1: All chunks have the same number of columns and each - thread has the same number of chunks, across all MPI - processes. Columns are assigned to chunks to balance - day/night, summer/winter "static" load imbalances. - Chunks are assigned to processes to minimize interprocessor - communication in dp_coupling, but it will occur - anyway unless the dynamics decomposition is compatbile. - Files affected: - - - dynamics/eul/dp_coupling.F90 - dynamics/eul/dyn_grid.F90 - dynamics/eul/inital.F90 - - dynamics/fv/dp_coupling.F90 - dynamics/fv/dyn_grid.F90 - dynamics/fv/inital.F90 - - dynamics/sld/dp_coupling.F90 - dynamics/sld/dyn_grid.F90 - dynamics/sld/inital.F90 - - physics/cam1/phys_grid.F90 - physics/ccm366/phys_grid.F90 - - control/wrap_mpi.F90 - control/restart.F90 - -3) Added PCOLS cpp token, used to set pcols parameter in ppgrid.F90 . - When running coupled, pcols (still) set to PLOND. params.h.in.csh - modified to set PCOLS default, taking care of LSM1 and CCM366 physics - special cases. (Code courtesy of Erik Kluzek.) - - Files affected: - - ../bld/README - ../bld/params.h.in.csh - physics/cam1/ppgrid.F90 - physics/ccm366/ppgrid.F90 - -4) Fixed chunking bug in SOM. Files affected: - - ocnsice/som/somoce.F90 - ocnsice/som/srfsomi.F90 - ocnsice/som/srfsomo.F90 - ocnsice/som/srftsbi.F90 - -5) Miscellaneous clean-up (removing pchnk and pchnkd parameters, - renaming a phys_grid routine). Files affected: - - physics/cam1/physgrid.F90 - physics/cam1/ppgrid.F90 - physics/cam1/cldwat.F90 - physics/ccm366/physgrid.F90 - physics/ccm366/ppgrid.F90 - control/history.F90 - - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev32 -Originator: erik ( Erik Kluzek) -Date: Thu Mar 7 23:00:41 MST 2002 -Model: CAM -Version: CAM1.7.dev32 -One-line Summary: Bug-fix to cam1_7_dev30 snowfall rates, also fix interpret_filename_spec -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! -Machines tested: IBM, SGI (some testing on Linux, SunOS as well) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, tcraig -Restart files change: no -Changes answers: Yes (fixes bug from cam1_7_dev30 where everything appears as snow) -Changes to CLM land-model: fix problem where numpatch was "use"'d twice -Changes made: - -tphysbc.F90: - - Fix bad merge from cam1_7_dev30 that caused all precipitation to fall -as snow. - -filenames.F90: - - Check if prev is present before using. Without this the SGI and Compaq -would seg-fault when running the model. - -test-model.pl: - - Fix problem in test 6. Tests skipped don't build-namelist. - -run-model.pl: - - Don't resubmit till year 1 after first simulation. - -clm: - - Fix double "use" of numpatch. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev31 -Originator: mirin ( Arthur Andrew Mirin) -Date: Thu Mar 7 10:11:37 MST 2002 -Model: CAM -Version: CAM1.7.dev31 -One-line Summary: Completed full history capability for 2D FV decomposition -Known bug: All precipitation appears as snowfall! -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Added 32-bit accumulation buffers and initial history file capability for 2D FV decomposition. This involved a number of changes to history.F90, minor changes to stepon.F90, enhancements to restart_dynamics.F90, and enhancements (made by Will Sawyer) to the Pilgrim library (puminterfaces.F90, pilgrim.h, parutilitiesmodule.F90, redistributemodule.F90). Also made a minor unrelated improvement to trac2d.F90 (elimination of 2D temporary array). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev30 -Originator: erik ( Erik Kluzek) -Date: Wed Mar 6 08:58:37 MST 2002 -Model: CAM -Version: CAM1.7.dev30 -One-line Summary: Fix labels on monthly files, physics changes from mzh6, - fix CCSM logs, update to ccsm2_0_beta38 -Known bug: All precipitation appears as snowfall! -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! -Machines tested: IBM, Linux (PGI) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens -Restart files change: no -Changes answers: Yes! (same-physics -- less snowfall, reduced Cn over sea-ice) - Case names for changes: /CCSM/csm/b20.001 -Changes made: - -Bug introduced: - - This version introduces a bug where all precipitation appears as snow. -This was due to incorrectly resolving a conflict in the merge from mzh5 to -mzh6. - -Fix labels on monthly files: - -Monthly files were labeled with the current time-stamp. Now they are labeled -with the previous month. Also don't output a monthly file, if nstep == 0, -as it will just be an instantaneous time-sample rather than an average. - -Get code updates from ccm3_12_47_brnchT_mzh6: - -Snowfall is reduced by requring average temperature to be -2C. Reduce cloud -condensation nuclei over sea-ice from 40 to 5. These code changes were tested -coupled, but not stand-alone yet. Both a new coupled and uncoupled simulation -will be run shortly. - -Fix log-files when running coupled: - -Only redirect masterproc output to atm.log file. Redirecting all output was -causing conflicts in the log file and causing most of the information -to be lost. Also add more checks on masterproc for output when running coupled. - -Update CCSM scripts to ccsm2_0_beta38: - -Update the "models/bld" and "scripts" directories to point to the "beta38" -version of CCSM2.0. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev29 -Originator: erik ( Erik Kluzek) -Date: Fri Mar 1 20:53:28 MST 2002 -Model: CAM -Version: CAM1.7.dev29 -One-line Summary: Fix initial filenames and increase caseid from 16 to 32 characters -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM (eul,sld,fv), SGI (eul only) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Increase caseid from 16 to 32 -Changes made: - -Increase caseid from 16 to 32 characters. - -Fix filenames of initial files (the .nc extension was dropped off). - -Change test-model.pl. SOM test now run on all platforms (AIX was left -off before). $CASE is a little longer and more descriptive. Filewildcard -more explicit (solves a simple problem I ran into, where the old file -was found). - -Ran run-model.pl with a 32-character caseid (both with CLM and LSM) -producing initial files to make sure worked with long caseid, and -initial files had proper name. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev28 -Originator: erik ( Erik Kluzek) -Date: Fri Feb 15 17:56:56 MST 2002 -Model: CAM -Version: CAM1.7.dev28 -One-line Summary: Add new flexible filenames with CCSM names as defaults, update to CLM2.3.17 -Requires change in build system: yes - (SHELL_MSS is no longer required) -Substantial timing or memory changes: no -Requires change in run script: no - (namelist options changed: rirt, nrmvn, nsmvn removed, irt => mss_irt, - nswrps => mss_wpass, add hfilename_spec, archive_dir option) -Tested to work coupled with CCSM: yes! -Machines tested: IBM, SGI (some testing on Linux PGI, Sun) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, mvertens, eaton -Restart files change: yes! -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Update to CLM2.3.17, get to work with changes -Changes made: - -Flexible filenames: - - New namelist option, hfilename_spec to specify filenames, newly -adopted CCSM standard filenames are the default. Filename specifiers set -the filenames, with the following interpretations: - - %c = casid - %t = tape number - %y = current year - %m = month - %d = day - %s = seconds into current day - %% = % character - -By default non-monthly files have a hfilename_spec of: "%c.cam1.h%t.%y-%m-%d-%s.nc" -Hence, for example, with a caseid="test", tape number 2, writing it's first data -for 12/1 UT 0:0 for year 1, will have the filename: -"test.cam1.h1.0001-12-01-00000.nc". - -Namelist: - - nsmvn, nrmvn, and rirt removed from namelist. - old irt renamed to mss_irt - old nswrps renamed to mss_wpass - - Added hfilename_spec filename specifyer to history filenames. - Added archive_dir to give MSS archive directory - - (now defaults to /USERNAME/caseid/csm/atm). - -Filenames module: - - New module to deal with filenames, and MSS options and interpret -filename specifiers (as above). Unit-test for this module was created. - -Restarts: - - history and abs-ems restart full filepaths added to master restart file. -Restart pointer file changed to include information on all files needed to -successfully do a restart. Restart files are disposed to MSS when closed -rather than in wrapup. - -History: - - History filenames are created and opened when data is first written to -them. Added methods: get_mtapes, get_hist_restart_filepath, get_hfilepath -to get private data in history module. Increase length of filenames to 256. - -CCSM scripts: - - models/bld updated to ccsm2_0_beta35, scripts updated to -scripts_a011228_brnchT_a020201. system_test script updated to changes in these -scripts. atm.setup.csh updated for new namelist changes. - -test-model.pl: - - New SOM dataset names added. Changed test-model.pl to use NEWBUILD -mechanism which should speedup build, changed so that error-growth tests -run without trace-gas, but with readtrace to exercise more code options. Set -nhtfrq(1) for restart tests so that all history files produce restart files. -Change Makefile so that explicit path to mkSrcfiles and mkDepends scripts -is given (using Rootdir). - -CLM: - - CLM updated to CLM2.3.17 (uses new CCSM filename convention). Update -to filenames module and namelist change. - -Move files unused by CLM from atmlnd_share to control: - (Testing of files in atmlnd_share is insufficient to work with - CLM2. So we are working on seperating the two.) - ioFileMod.F90, gauaw_mod.F90, wrap_mpi.F90 - ioFileMod.F90 changes so that comments, and mvn is not needed, and - SHELL_MSS option becomes standard. - -MSS: - - Remove MSS comments when mswrite done, and remove SHELL_MSS CPP token, -since always used. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev27 -Originator: eaton ( Brian Eaton) -Date: Fri Feb 8 18:19:23 MST 2002 -Model: CAM -Version: CAM1.7.dev27 -One-line Summary: bugfix for CAM makefile -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC-Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Erik -Restart files change: no -Changes answers: no -Changes to CLM land-model: None -Changes made: - -The CAM build was failing when the new ESMF macro MF_BUILD was set to a -relative path. Added fix to CAM makefile to convert the relative pathname -to an absolute one. - -Misc: modified bld/condense-path.pl to look for CAM.pm in $MODEL_CFGDIR. -This allows bld/configure.csh to be used in a directory other than bld. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev26 -Originator: eaton ( Brian Eaton) -Date: Wed Feb 6 14:52:17 MST 2002 -Model: CAM -Version: CAM1.7.dev26 -One-line Summary: update esmf to MF_LLU_0_0_12p1 and add fixes for lf95 -Requires change in build system: yes -CAM Makefile modified to set MF_BUILD macro used by esmf makefile. -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC-Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -David Neckels' summary of changes in MF_LLU_0_0_12p1: -> Version: MF_LLU_0.0.12 -> One-line summary: Added relocatable build support. -> Changes made: -> -> -Added variable MF_BUILD, which allows the code to be built in a -> directory other than the default. To use, invoke: -> gmake BOPT=g MF_BUILD=/tmp/esmf_build -> This will build the library under "/tmp/esmf_build". The object files, -> the library and the mod files will all be created under the new -> directory. -> -> -Added an install target to makefile. The variables MF_LIB_INSTALL -> and MF_MOD_INSTALL determine where the libraries and mod files are -> copyed during the install: (e.g) -> gmake BOPT=g MF_BUILD=/tmp/esmf_build MF_LIB_INSTALL=/usr/lib \ -> MF_MOD_INSTALL=/usr/mod install -> (Notice that once the MF_BUILD is used, it must be passed to the -> subsequent make commands). - -The CAM Makefile was changed to set the MF_BUILD directory to $(MODEL_EXEDIR)/esmf. - -The latest lf95 compiler (lf9561) required the following changes to the source code: - -physics/cam1/{radae.F90,chemistry.F90} - removed save attribute in variable -declarations that were in the same scope as a save statement. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev25 -Originator: eaton ( Brian Eaton) -Date: Tue Feb 5 12:04:52 MST 2002 -Model: CAM -Version: CAM1.7.dev25 -One-line Summary: remove prognostic sulfur cycle stubs -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, PC-Linux -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes made: - -Only the interface to the prognostic sulfur cycle is being removed. The -following independent features have not been removed: 1) a specified -sulfate aerosol distribution may be read from a dataset, 2) a ramp function -may be applied to the specified sulfate distribution, and 3) the indirect -radiative effects of sulfate aerosols may be estimated. - -Modify files: -control/history.F90 -control/initext.F90 -control/parse_namelist.F90 -control/restart.F90 -dynamics/eul/inidat.F90 -dynamics/fv/inidat.F90 -dynamics/sld/inidat.F90 -physics/cam1/advnce.F90 -physics/cam1/initindx.F90 -physics/cam1/inti.F90 -physics/cam1/moistconvection.F90 - left icwmr in arg list of cmfmca. -physics/cam1/radctl.F90 -physics/cam1/tphysac.F90 -physics/cam1/tphysbc.F90 -physics/cam1/tracers.F90 -physics/cam1/zm_conv.F90 -physics/ccm366/advnce.F90 -physics/ccm366/initindx.F90 -physics/ccm366/tracers.F90 - -Remove files: -control/acbnd.F90 -control/clddiag.F90 -control/dmsbnd.F90 -control/drydep.F90 -control/massbgt.F90 -control/scyc.F90 - move the indirect flag into comctl.h. Use this flag - directly rather than via the doindirect query method. -control/soxbnd.F90 -control/sulbnd.F90 -control/sulchem.F90 -control/sulemis.F90 -control/wetdep.F90 - -Misc: - Change variable count to count1 in history.F90(wshist) to fix a problem - with the pgf90 compiler. count is the name of an F90 intrinsic function - and apparently using it as a local variable was causing a problem. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev24 -Originator: olson ( Jerry Olson) -Date: Thu Jan 31 17:06:44 MST 2002 -Model: CAM -Version: CAM1.7.dev24 -One-line Summary: modifications and bufixes to eulerian, sld, and physics - routines -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (IBM only) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Restart files change: no -Changes answers: EUL: no (bit-for-bit; unless "DIVDAMPN" is used in namelist) - SLD: Yes (same-physics) -Changes to CLM land-model: None -Changes made: - - bugfixes: - - divergence damper in Eulerian code - src/dynamics/eul/hordif.F90 - - SLD energy fixer - src/physics/cam1/comsrf.F90 - src/physics/cam1/physpkg.F90 - src/physics/cam1/radctl.F90 - src/physics/cam1/tphysbc.F90 - - other mods - - SLD vector-field advection routine - src/dynamics/sld/nunv1.F90 - - src/advection/sld/engy_tdif.F90 - - removed an option from idealized physics - src/physics/cam1/phys_idealized.F90 - src/physics/cam1/tphysidl.F90 - - modified "test_trace3" tracer - src/physics/cam1/tphysac.F90 - -=============================================================== -=============================================================== - -cam1_7_dev23 -Originator: sawyer ( William Barton Sawyer) -Date: Wed Jan 16 13:46:35 MST 2002 -Model: CAM -Version: CAM1.7.dev23 -One-line Summary: Upgraded fvCAM to newest mod_comm primitives -Requires change in build system: no -Substantial timing or memory changes: possibly faster -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Putman (mod_comm primitives) -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: (For changes that change answers) -Changes to CLM land-model: None (one-line description) -Changes made: - - models/utils/pilgrim: - - removed bufferpack/unpack 2d,3d,4d primitives (in mod_comm) - mod_comm.F90: added generic mp_send/recv primitives - - models/atm/cam/src/dynamics/fv - - cd_core.F90 d2a3dijk.F90 d2a3dikj.F90 dynpkg.F90 - highp2.F90 hswf.F90 p_d_adjust.F90 te_map.F90 uv3s_update.F90 - - replaced parbegin/endtransfer primitives with mp_send/recv - primitives from mod_comm. The only tricky part about this - was determining the proper source and destination PE numbers: - in the 2D decomposition this depends on the ordering of - the mapping of the decomposition to the PEs (row-major or - column-major). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev22 -Originator: mirin ( Arthur Andrew Mirin) -Date: Tue Jan 15 14:49:36 MST 2002 -Model: CAM -Version: CAM1.7.dev22 -One-line Summary: Support history files for 2D FV decomposition -Requires change in build system: no -(one-line description of changes: Makefile, include files, directories, etc.) -(Detailed description below) -Substantial timing or memory changes: no -Requires change in run script: no -(one-line description of changes: data files, run-scripts, namelist etc.) -(Detailed description below) -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation:not-applicable -Changes answers: no (bit-for-bit) -(Note: test-model.pl only does checks this -- if you run it with the "-c" option) -Name of tests cases on NCAR Mass-Store: (For changes that change answers) -Changes to CLM land-model: None (one-line description) -Changes made: - -Changed history.F90, uv3s_update.F90 and restart_dynamics.F90. -Also changed CAM_lab.pm and script.m4. - -Main changes were to history.F90, in order to support 2D FV decomposition. -The field_info structure was generalized to include a vertical extent. Support -for dynamics variables having global vertical extent 1, plev and plevp was added; -however, only tested variables had global extent plev. New coding supports 64-bit -accumulation buffers. 32-bit accumulation buffers are still not supported for -2D FV but are supported for 1D FV decomposition. - -Previous coding had bug involving non-preservation of subscript array -range for associated pointers. That bug affected the hbuf_accum routines and -hbuf_compute_avg. Bug has been fixed; inside those routines relevant arrays -have beginning subscript equal to 1. - -uv3s_update.F90 needed minor fix to properly call the history routine. - -restart_dynamics.F90 had a minor bug involving 2D FV decomposition. - -script.m4 (DAO) was given 1-line change involving ccm to cam transition. - -CAM_lab.pm had 1-character change involving working directory on LLNL frost. - - - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev21 -Originator: sawyer ( William Barton Sawyer) -Date: Mon Jan 7 07:38:50 MST 2002 -Model: CAM -Version: CAM1.7.dev21 -One-line Summary: Merge of current DAO fvGCM FV dycore into CAM baseline: ghosting of variables, mod_comm for communication -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Linux -Ran test-model.pl script: no (test-model.pl -l dao not currently working) -Tested on fv dynamics: yes -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: no -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): no -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: n/a -Changes to CLM land-model: None (one-line description) -Changes made: - - Phase 2 of fvGCM-CAM fv dycore merge: ghosted prognostic - variables U3S, V3S, Q3. Uses mod_comm for communication - (as well as pilgrim). More consistent use of "only" statement - in "use" lines. Upgrade of pilgrim (synchronized with DAO - Chemistry Transport Model development) and mod_comm (should - compile on Compaq now). - - models/utils/pilgrim: - - pilgrim.h, parutilitiesmodule.F90, ghostmodule.F90: - synchronized with DAO CTM development. - mod_comm.F90 : should now compile on Compaq (sorry, - not tested -- no access to a Compaq) - - models/atm/cam/src/control: - - history.F90: rather ugly code to support write of - ghosted U3S array. Well be improved in later version. - - models/atm/cam/src/dynamics/fv - - prognostics : ghosted variables U3S, V3S, Q3 - - cd_core.F90, trac2d.F90 : ghosting of U, V, Q3, replaced many - pilgrim calls with mod_comm. - - benergy.F90, dryairm.F90, inidat.F90, restart_dynamics.F90 - map1_ppm.F90, d2a3dijk.F90, d2a3dikj.F90, dynpkg.F90, - te_map.F90, fv_prints.F90, p_d_adjust.F90, dp_coupling.F90, - hswf.F90, uv3s_update.F90 : accommodated ghosted variables. - - mod_mpi.F90 : retired (now uses mod_comm) - - dynamics_vars.F90 : new temporary unghosted variables as - interim solution for 2D decomposition redistributions. - - stepon.F90 : ghosted variable u3sxy - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev20 -Originator: rosinski ( Jim Rosinski) -Date: Wed Jan 2 16:48:01 MST 2002 -Model: CAM -Version: CAM1.7.dev20 -One-line Summary: Mods to SOM: MLD renamed MLDANN on SST dataset., and contains - yearly values. SPMD SOM indexing fix. No resetting SICTHK, - SNOWH, TSSUB in SOMINI -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, PC -Ran test-model.pl script: no -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: no (bit-for-bit) at least for non-SOM configurations -Changes to CLM land-model: None -Changes made: - -NOTE: All changes are to slab ocean model (SOM) code. - -o Changed name of mixed layer depths to MLDANN on SST boundary file -o Fixed indexing bug in SPMD mode (SOMINI, SOMINT) -o Removed code from SOMINI which reset SICTHK, SNOWH, TSSUB, ORO. - -=============================================================== - -cam1_7_dev19 -Originator: sawyer ( William Barton Sawyer) -Date: Thu Dec 27 07:47:01 MST 2001 -Model: CAM -Version: CAM1.7.dev19 -One-line Summary: FV core upgrade: Q3 indexing changed to (i,j,k,iq); no changes in order on history/restart files -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Art Mirin -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: (For changes that change answers) -Changes to CLM land-model: None (one-line description) -Changes made: - - Changed indexing of prognostic var. Q3 from (i,k,iq,j) to - (i,j,k,iq) in FV dynamical core. This change affected - numerous files in FV, - - cd_core.F90 fv_prints.F90 pmgrid.F90 stepon.F90 - dp_coupling.F90 inidat.F90 prognostics.F90 sw_core.F90 - dryairm.F90 mod_mpi.F90 restart_dynamics.F90 te_map.F90 - dynpkg.F90 p_d_adjust.F90 spmd_dyn.F90 trac2d.F90 - - and one common file: src/control/history.F90. - - The section in history is protected by an "if ( dycore_is('LR) ) then" - line (and is also embedded in an #ifdef STAGGERED CPP statement -- - does any other dycore use STAGGERED?) - - The order of Q3 on the initial/restart files has *not* changed. - For the time-being there is logic to read and write Q3 in the - original order. This might change (in restart_dynamics.F90) later on. - - - models/util/pilgrim/mod_comm.F90 has also been upgraded with - new routines; which are not yet used by the FV core. A code - review/revision of these changes by Putman/Shen is pending. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev18 -Originator: eaton ( Brian Eaton) -Date: Tue Dec 18 12:40:35 MST 2001 -Model: CAM -Version: CAM1.7.dev18 -One-line Summary: changes for share constants -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, sun, pc/linux/pgf -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: Erik, myself, and Mariana -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: Yes, new constants sometimes agree to only 2 digits with old ones. This tag requires scientific validation. -Name of tests cases on NCAR Mass-Store: Erik will do production runs. -Changes to CLM land-model: Updated to clm2_3_dev10. -Changes made: - - Update CLM to clm2_3_dev10. - - The following changes were implemented by Erik and reviewed by me. - - Use values of constants from models/csm_share/shr_const_mod.F90 for - consistency with other CCSM component models. The changes are mainly in - the physics/cam1/physconst.F90 module. - - Also changed some hard-wired constants in individual parameterizations: - - ocnsice/dom/srftsb.F90 - cmair = cpair (was 1.00e3) - cmice = shr_const_cpice (was 2.07e3) - rhair = shr_const_rhodair (was 1.25) - rhice = shr_const_rhoice (was 9.20e2) - - ocnsice/som/oceanconst.F90 - tof = shr_const_tkfrz -1.9_r8 (was 271.26) - rhoocn = shr_const_rhosw (was 1.026e3) same - cpocn = shr_const_cpsw (now 3.996e3, was 3.930e3) - tsm = shr_const_tkfrz (was 273.16) - - physics/cam1/cldwat.F90 - rhonot = rhodair/1000. (was 1.275e-3) - t0 = tmelt (was 273.16) - replace hard-wired 273.16 with t0 - - physics/cam1/esinti.F90 - pass tmelt as an arg - - physics/cam1/gffgch.F90 - replace hard-wired 273.16 with tmelt - - physics/cam1/radae.F90 - amd = mwdry (now 28.966, was 28.9644) - - Made some interface changes to provide initialization routines for - setting constants in parameterizations. - - Moved routines for water vapor pressure calcs into new wv_saturation - module. - - Moved routines for shallow convection into moistconvection module. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev17 -Originator: sawyer ( William Barton Sawyer) -Date: Tue Dec 18 07:25:41 MST 2001 -Model: CAM -Version: CAM1.7.dev17 -One-line Summary: Bug fix of mod_comm library for AIX and Linux -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, Linux -Ran test-model.pl script: no -Tested on fv dynamics: yes -Tested on eul dynamics: no -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: no -Tested that different domain decompositions match bit-for-bit: no -Tested in adiabatic mode: no -Code reviewed by: myself, Shen -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: N/A -Changes to CLM land-model: None -Changes made: - - models/utils/pilgrim: memstuff.c, mp_assign_to_cpu.c mod_comm.F90 - - Minor bug fixes to get mod_comm to compile and run on AIX and Linux - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev16 -Originator: sawyer ( William Barton Sawyer) -Date: Mon Dec 17 03:19:29 MST 2001 -Model: CAM -Version: CAM1.7.dev16 -One-line Summary: FV dycore improvements: mod_comm comm. library; more support for 2D decomposition -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: SGI -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Putman, Lin -Updated the DatasetLog (for new input data-files): no -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: N/A -Changes to CLM land-model: None -Changes made: - - model/utils/pilgrim: - - mod_comm.F90: optimized comm. library (Lin, Putman, Shen) - memstuff.c: related utilities for MLP parallelism - mp_assign_to_cpu.c: CPU pinning utility (MLP and MPI modes) - - model/atm/cam/bld - - CAM_lab.pm: improvements for -l dao - configure_fv.pl, script.m4: Additional support for 2D decomp. - - model/atm/cam/src/dynamics/fv - - benergy.F90, cd_core.F90, dynpkg.F90, geopk.F90, - hswf.F90. prognostics.F90, restart_dynamics.F90, - spmd_dyn.F90, stepon.F90, te_map.F90: - - Phase 1 of transition to mod_comm library, - mod_mpi replaced by mod_comm in cd_core.F90. - Variable PT ghosted throughout various routines. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev15 -Originator: rosinski ( Jim Rosinski) -Date: Thu Dec 6 11:47:59 MST 2001 -Model: CAM -Version: CAM1.7.dev15 -One-line Summary: Add per-tape averaging flag. Delete inlining for SGI -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, PC -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): no or Yes or not-applicable -Updated the documentation: no -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: (For changes that change answers) -Changes to CLM land-model: None -Changes made: - -o Added namelist option avgflag_pertape. Usage ex: if set avgflag_pertape(2) = 'I', - all fields on history file 2 will by default be instantaneous. Can still - be overridden (for example) with fincl2 = 'T:A' - -o Deleted inlining for SGI (a mod to bld/Makefile). Inlining slowed compilation - down by 60% and resulted in zero or negative speedup. Could also delete for - other machines, but Makefile mods, compilation time and execution time effects - of including inlining were not nearly as obnoxious as on SGI so left alone for now. - -o Added addfld call for NSTEP. Writing this field to history file is often useful - for diagnosing mods to history.F90. By default this field is not written. - -o Moved dycore print from parse_namelist.F90 to cam.F90 - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev14 -Originator: mvertens ( Mariana Vertenstein) -Date: Tue Dec 4 09:08:53 MST 2001 -Model: CAM -Version: CAM1.7.dev14 -One-line Summary: put in esmf calendar manager into clm2 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, erik -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: Yes (for clm2 only) -Changes answers: On utefe(sgi) and prospect (compaq) the result were -bfb when running test-model.pl with the -c option. On the ibm, -the changes were roundoff compared with cam1_7_dev13 when running with -the esmf libO version and bfb when running with the esmf libg version -(differences only appeared after 98 times steps and were due to -roundoff differences in the computation of the calendar day) -Changes to CLM land-model: Yes - -1) Put in the esmf time manager into clm2 - Brought cam code up to date with clm2_3_dev6. - Only clm2 code was changed. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== - -=============================================================== - -cam1_7_dev13 -Originator: eaton ( Brian Eaton) -Date: Sun Dec 2 15:54:13 MST 2001 -Model: CAM -Version: CAM1.7.dev13 -One-line Summary: make history files conform to CF metadata conventions -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, sun, linux-pgf -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: -Changes to CLM land-model: None -Changes made: - - Changes are all in history.F90 except for some units changes in addfld - calls in gw_drag.F90. The modifications are: - .Fix units attributes. - .Fix convention attribute. - .Fix description of hybrid vertical coordinates. - .Write all coordinate variables as type double. - .Fix description of time averaged values. - .Add time interval boundaries. - .Remove _FillValue attribute for variables on a full grid. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev12 -Originator: eaton ( Brian Eaton) -Date: Thu Nov 29 19:08:09 MST 2001 -Model: CAM -Version: CAM1.7.dev12 -One-line Summary: update ESMF lib to MF_LLU_0_0_11p3 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, sun, linux/pgf -Ran test-model.pl script: yes -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: David Neckels -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: -Changes to CLM land-model: None -Changes made: - - Update the ESMF library from version MF_LLU_0_0_11p2 to MF_LLU_0_0_11p3. - Date increment incorrectly normalized itself when on the first month of the - year. The time management increment function did not completely construct - itself. These bugs were uncovered during unit testing of the ESMF library - by David Neckels. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev11 -Originator: mirin ( Arthur Andrew Mirin) -Date: Wed Nov 28 23:02:45 MST 2001 -Model: CAM -Version: CAM1.7.dev11 -One-line Summary: Changes for multi-2D decomposition for FV dycore -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Sawyer -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: Yes (minor roundoff differences in FV dycore routine te_map.F90) -(Note: test-model.pl only does checks this -- if you run it with the "-c" option) -Name of tests cases on NCAR Mass-Store: (For changes that change answers) -Changes to CLM land-model: None (one-line description) -Changes made: -Changed 13 files in dynamics/fv; most changes were fairly minor. -Changed control/spmdinit.F90. -Changes 3 files in physics/cam1, to allow more general chunking. These changes were actually made by Pat Worley. -Changed 2 files in Pilgrim (minor). -Added batch capability for test-model.pl for LLNL IBM Frost. -Minor change to CAM_lab.pm for LLNL Frost. -Minor changes to DAO scripts configure_fv.pl, script.m4. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev10 -Originator: mvertens ( Mariana Vertenstein) -Date: Mon Nov 26 08:32:45 MST 2001 -Model: CAM -Version: CAM1.7.dev10 -One-line Summary: changed mpi distribution of subgrid patches in clm2 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq -Ran test-model.pl script: yes (does all of the following tests) -On Compaq only tested eul dynamics -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Ran test-model.pl with -compare optio -Changes to CLM land-model only: -Brought cam code up to date with clm2_3_dev4 -1) changed the distribution of subgrid patches among processors - so that patches for a given land point must all be on the same processor -2) changed all mpi gather/scatter calls to mpi gatherv/scatterv calls - and introduced subroutines to determine the asymmetric vector lengths -3) Put in CF1.0 conventions into clm history file -4) removed rtm_doavg from namelist - rtm averaging is now done - if rtm_nsteps is set to greater than 1 (this does not appply - to cam model unless cam is run with RTM - by default this is - not the case) - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev9 -Originator: erik ( Erik Kluzek) -Date: Wed Nov 21 16:02:10 MST 2001 -Model: CAM -Version: CAM1.7.dev9 -One-line Summary: Get coupled model to work, update to scripts_a011121 - and bld_b011121 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: Yes! (IBM only) -Machines tested: IBM -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Terminate string in clm_csmMod.F90 so would compile. -Changes made: - -Make changes needed to get CAM to work with coupled with CCSM. Update models/bld -to bld_b011121, and scripts/test.a1 to scripts_a011121. Run csm.csh on babyblue -to make sure would work. Also ran on utefe, but lnd.setup.csh failed due to -a "getdata" problem, the compile of CAM was successful however. Update "csm.csh" -coupled version to ccsm2_0_beta26. - -Change ccsm_msg.F90 to use time_manager to get nstep (from Lawrence Buja). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev8 -Originator: eaton ( Brian Eaton) -Date: Wed Nov 21 08:47:35 MST 2001 -Model: CAM -Version: CAM1.7.dev8 -One-line Summary: add perpetual calendar option to time manager -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, pc-linux, sun -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): no -Updated the documentation: Yes -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: -Changes to CLM land-model: None -Changes made: - -Add namelist variables to enable perpetual calendar: - -logical perpetual_run - Set to .true. to specify that a perpetual run is - being done (default is .false.). If perpetual_ymd - is not set then read the perpetual date from the - initial file. - -integer perpetual_ymd - Perpetual date specified as (year*1000 + month*100 - + day). This overrides value from initial file. - -If aqua_planet=.true. then the values of perpetual_run and perpetual_ymd -are ignored. aqua_planet mode uses a perpetual date of 321. - -Modify files: - -control/time_manager.F90 - add perpetual_run, perpetual_ymd to public data. -add is_perpetual method to indicate that perpetual calendar is in use. -Modify internal logic so that perpetual calendar doesn't depend on -aqua_planet mode. Add an optional argument to specify an offset in the -get_curr_date method (needed by the CLM). - -control/parse_namelist.F90 - add perpetual_run, perpetual_ymd. - -Modify code in the following files to use the perpetual date when -interpolating boundary datasets if perpetual calendar is in use. -control/initext.F90 -control/oznini.F90 -control/oznint.F90 -control/so4bnd.F90 -dom/sst_data.F90 -physics/advnce.F90 -physics/chemistry.F90 -physics/tphysac.F90 - -Misc: -control/initext.F90 - There was code in a #ifdef COUP_CSM section that was -nested inside a #if (!defined COUP_CSM) section. Remove this code which -wasn't being executed anyway. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev7 -Originator: eaton ( Brian Eaton) -Date: Fri Nov 16 17:35:37 MST 2001 -Model: CAM -Version: CAM1.7.dev7 -One-line Summary: update ESMF library -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, pc, sun -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and David Neckels -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: -Changes to CLM land-model: None -Changes made: - - Update the ESMF library from version MF_LLU_0_0_11 to MF_LLU_0_0_11p2. - This includes bugfixes for the mfm_datedecrement and mfm_timemgrlaststep - functions. - - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev6 -Originator: erik ( Erik Kluzek) -Date: Fri Nov 16 09:37:28 MST 2001 -Model: CAM -Version: CAM1.7.dev6 -One-line Summary: Update ESMF to MF_LLU_0_0_11, change test-model.pl interface, fix problem with run-model.pl -Requires change in build system: Yes -(Changed Makefile on sun to be compatable with new ESMF) -(Changed Makefile for Linux-PGF90 so sgexx.F doesn't get compiled with -fast) -Substantial timing or memory changes: no -Requires change in run script: Yes (run-model.pl scripts need to use - setup_directories( "support" ) -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, Sun, Linux-PGI (NERSC-IBM, ORNL-IBM) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Mariana Vertenstein -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes to ESMF: Update to MF_LLU_0_0_11 -Changes made: - -ESMF Update: - - Get newer version of ESMF library. This fixes a problem with calculating -the ending date (which fixes a problem that the CLM had in writing out restart -files at the end of the run). It also fixes problems in building on several -platforms. The previous version did not build on the DAO SGI (tropic) for -example. - -Makefile changes: - - SUN: Use -dalign for DEBUG, and otherwise -fast to be compatable - with the new version of ESMF. - - Linux-PGF90: Set to compile sgexx.F withotu -fast, so that SLD - simulations won't hang. - -run-model.pl change: - Change so that CAM_run.pm sets up a directory to build makdep in - like test-model.pl does. This allows run-model.pl to use the same - source directory, but submit to different machines simultaneously. - The change requires the setup_directories( "support" ) method to - be called from run-model.pl type scripts. - -test-model.pl changes: - - Change interface from mixed short names like "-l" and "-nofail" to -consistent longer names: "-lab", "-compare", "-help" etcetera. - - -l ==> -lab - -c ==> -compare - -h ==> -help - -t ==> Eliminated you now get the list of test from -help - -r ==> -resume - -dirty ==> -noclean - -e ==> -errgro - -s ==> -skip - -For backwards compatability, -l, -c, -r, -e, and -s are still allowed, although -the longer names are prefered. - -ornl: Change default CASE_DIR to a GPFS directory so that builds will work. -llnl: Change default SPMG_CMND depending on whether machine has prun or dmpirun. - Will now automatically detect which exists and use the one that works. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev5 -Originator: eaton ( Brian Eaton) -Date: Tue Nov 13 10:19:40 MST 2001 -Model: CAM -Version: CAM1.7.dev5 -One-line Summary: makefile changes for ESMF library build -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq, PC/linux-pgf -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself and Erik -Updated the DatasetLog (for new input data-files): no -Updated the documentation: no -Changes answers: no (bit-for-bit) -Name of tests cases on NCAR Mass-Store: -Changes to CLM land-model: None -Changes made: - -Modified the CAM Makefile to prevent unnecessary rebuilding of the ESMF -library. - -The ESMF Makefile has been improved (by David Neckels) to include support for -more Fortran compilers under Linux, and to allow simultaneous builds of the -library from different platforms with access to the same source on a shared -filesystem. There is also a README file for the ESMF build in -top_dir/models/utils/esmf/README. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev4 -Originator: erik ( Erik Kluzek) -Date: Fri Nov 9 11:44:51 MST 2001 -Model: CAM -Version: CAM1.7.dev4 -One-line Summary: Fix problem with run-model.pl, add condense-path utility, - update ESMF to MF_LLU_0_0_10p1 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI, Compaq (partial tests on Linux and Sun) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Known problems: SOM test fails on AIX, LSM/phys366 test fails on Linux - SLD test 3 (in test-model.pl) hangs on Linux-PGf90 -Code reviewed by: myself, Brian Eaton -Changes answers: no (bit-for-bit) -Changes to CLM land-model: None -Changes to ESMF: Update to MF_LLU_0_0_10p1 -Changes made: - -Fix path problems with run-model.pl - - Add a condense-path.pl utility to shorten pathnames with "/.." in them. -This is important since the longer directory names of CAM and the multiple -levels cause line length problems when building. - -test-model.pl: Turn SOM test on for all platforms but AIX - - Let the SOM test happen for all platforms except the IBM where it fails. -Once this is fixed we should re-enable it. - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -cam1_7_dev3 -Originator: mvertens ( Mariana Vertenstein) -Date: Wed Nov 7 13:00:31 MST 2001 -Model: CAM -Version: CAM1.7.dev3 -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: no -Tested to work coupled with CCSM: no -Machines tested: IBM -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: no -Tested on eul dynamics: yes -Tested on sld dynamics: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: no (bit-for-bit) -Simulations: - /ERIK/csm/eul17dev3_a ---- 5 year simulation with - PCMDI climatological SST's -Changes made: - -1) put in restart consistency checks between cam and clm2 - i.e ensure that both models restart with same time step - -=============================================================== -=============================================================== - -cam1_7_dev2 -Originator: mvertens ( Mariana Vertenstein) -Date: Wed Nov 7 10:16:12 MST 2001 -Model: CAM -Version: CAM1.7.dev2 -One-line Summary: Put in three clm2 bug fixes that change answers -Requires change in build system: no -Substantial timing or memory changes: no -Requires change in run script: Yes - CLM2 namelist must have the following changes: - 1) fpftcon = $LM_DATDIR/pftdata/pft-physiology-vegdyn-cleanup-ratio - 2) remove mksrf_firr from namelist -Tested to work coupled with CCSM: no -Machines tested: IBM, SGI -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Erik Kluzek -Updated the DatasetLog (for new input data-files): not-applicable -Updated the documentation: not-applicable -Changes answers: Yes (new-physics - bug fixes) -Changes to CLM land-model: YES -Changes made (CLM2 code): -Put in changes from clm2_2_12, clm2_2_13, clm_2_14 - -clm2_2_12: -1) Update to clm2 changes from CCM3.12.62, from Brian Eaton - "Use public data and methods from time_manager mod for initialization." - -clm2_2_13: -1) cleaned up pft physiology file and related code - removed anything related to biogeochemistry when DGVM is off (not defined) -2) used ratio of roughness length and displacement height to canopy top height - instead of actual values for roughness lenght and displacement height -3) fixed openmp bug in RtmMod.F90 -4) fixed branch bug in AccumulMod.F90 -5) fixed DGVM bug in Fire.F90 - -clm2_2_14: -The clm2 code in this tag is clm2_2_14 with Erik's cam1_7_1 mods -where ccm->cam in various files min the clm2/main directory -1) (Biogeophysics_Lake.F90) - Fixed bug in lake model where latent heat of - fusion was being used (incorrect) instead of latent heat of sublimation - (correct). - Also Fixed two "problems" noticed in the b202.20.0 simulations: -2) (CombineSnowLayers.F90) - Global water and ice contents in the - top soil layer were increasing with time. Eliminated ponding in - wetlands by assigning snow melt to runoff. -3) (SurfaceRunoff.F90) - Eliminated formation and growth of basal ice layer - beneath snow cover by assigning snow melt reaching impermeable ground - surface to surface runoff. - The above three fixes were tested by examining output from several single - point and 21-year standalone simulations. No trends in surface soil - water and ice were noted. Lake bug fix has small effects on surface - fluxes from grid cells with lakes that have snow cover. -4) Put in volr in initial dataset -5) Put in restart id tag on restart file for consistency - - if restart file is modified, the parameter rest_id in restFileMod.F90 - must be updated. -6) Set maximum number of auxillary history files to 2 to be - consistent with parameter settings. - -=============================================================== -=============================================================== - -cam1_7_dev1 -Originator: erik ( Erik Kluzek) -Date: Wed Nov 7 09:11:22 MST 2001 -Model: CAM -Version: CAM1.7.dev1 -One-line Summary: Move from CCM to CAM, mask error-growth problems by not - letting CLM see snowfall, Change build -Requires change in build system: Yes! - (Change COUP_CCM to COUP_CAM for CLM, Makefile uses Rootdir file for - ESMF build, ESMF build is done from within Makefile, directory - structure different) -Substantial timing or memory changes: no -Requires change in run script: Yes! - (namelist is now camexp instead of ccmexp, input data files directory - changed, Env variable for datasets is now $CSMDATA) -Tested to work coupled with CCSM: no (need to update CCSM build for ESMF) -Machines tested: IBM, SGI, Compaq, Sun, Linux-PGF90 - (SOM test fails on IBM, LSM/PHYS366 test fails on Linux) -Ran test-model.pl script: yes (does all of the following tests) -Tested on fv dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Code reviewed by: myself, Mariana Vertenstein, Brian Eaton (som changes) -Updated the DatasetLog (for new input data-files): no (but need to) - Did create 26 level T21 datasets for testing, and got test-datasets - at T42L18 for SOM - (new datasets at ftp.cgd.ucar; cd pub/erik; - get cam1_7.scidac-atm.datasets.tar.gz) -Updated the documentation: Yes (first pass at changes from CCM to CAM) -Changes answers: no (bit-for-bit) -Changes to CLM land-model: Yes (COUP_CCM to COUP_CAM, nix references to ccm) -Changes made: - -Change references from CCM to CAM. - -datafiles: ccmr and ccmi files are now camr and cami -filenames: ccm3, conv_ccm, ccmoce, are now cam, conv_cam, camoce -lnd filenames: ccm_lndMod, lnd_ccmMod, are now atm_lndMod, and lnd_atmMod -CPP Tokens: COUP_CCM is now COUP_CAM -Directory structure: New directory structure compatable with the "cam1" - cvs module rather than the "ccm" cvs module. -Other references in code and comments to CCM were changed to CAM. - -New build: - - Build changed to create a Rootdir file with the top level directory -of "cam1". This is used by the Makefile to figure out the location of the ESMF -directory. The Makefile then builds the ESMF library directly from the -Makefile. This new build system comes from David Neckels via Brian Eaton. -It is a much easier more robust way of building the model. The env variable -DYNAMICS for Lin-Rood should now be set to "fv" in agreement with the new directory name. For the SUN take out the "-fast" option to be compatible with the -ESMF library build (put this back in when ESMF build is updated). - -Run scripts: - -Run scripts use "CSMDATA" instead of MODEL_DATDIR. AM_DATDIR, and LM_DATDIR -env variables removed. New directory structure for cam with subdirectories -for: inic, ggas, rad, hrtopo, ozone, scyc, and sst for initial conditions, -greenhouse gas, radiation, high-resolution topography, ozone, sulfur-cycle -and sea surface temperatures respectively. The environment variable OCEAN -was added to refer to the ocean model to use "dom" or "som". The env variable -PHYSICS now either should be "cam" or "ccm366" to refer to the type of physics -used. - -Error-growth problem: - - Mask the current error-growth problem to some extent by only letting -CLM see rain and not snowfall. Error-growth for FV still seems to be large. - -Remove Sulfur-cycle codes: - - Remove the sulfur-cycle codes (they are still accessible on the -cam_brnch_scyc branch and with the cam1_scyc module). In their place the -dummy stubs from dscyc were put into the control directory. Eventually, we -will rip these out of the main development and only leave them on the -sulfur-cycle branch. - -Changes to test-model.pl: - - Change vertical resolution of the sld and eul tests to 26, in agreement -with the vertical resolution used for production simulations (the difference -in vertical resolution can have an impact on how changes to physics are -perceived). Remove "-clean" option and make cleaning old directories out the -default, add the option "-dirty" to not clean files before the build. - -Users Guide: - - Users Guide now part of the distribution, first pass on moving from -CCM3.12 to CAM was completed. Namelist documentation is up to date, directory -structure is outlined. Further updates should update documentation at the -same time that code is changed. - -SOM: - - SOM now part of the distribution, SOM was updated to use the new -timing routines. "test-model.pl" has a test for SOM that is currently commented -out since it doesn't run on the IBM (does complete on other platforms however). - -See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog - for latest version of this file on the web. -=============================================================== -=============================================================== - -ccm3_12 -Originator: erik ( Erik Kluzek) -Date: Wed Jun 13 11:35:28 MDT 2001 -Model: CCM -Version: CCM3.12 -One-line Summary: New H2O LW abs/ems, geo-potential, precip evap, cloud-water changes, no oro-drag over ocean -Requires change in build system: no (but, Makefile updated for in-lining, see below) -Substantial timing or memory changes: no -Requires change in run script: Yes (New abs_ems_dataset, see below) -Tested to work coupled with CSM: Yes (IBM and SGI) -Machines tested: IBM, SGI, Compaq, Sun, Linux (see below) -Ran test-model.pl script: yes (does all of the following tests) -Tested on lr dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: yes -Updated the DatasetLog (for new input data-files): Yes -Updated the documentation: no (but need to) -Changes answers: Yes (new-physics) -Name of tests cases on NCAR Mass-Store: - /JET/csm/zm31139evap06 ---- Climatological SST's T42L26, Eulerian dynamics - /JET/csm/amipevap06 ------- AMIP2 SST's T42L26, Eulerian dynamics - /JET/csm/amipevap06_3h ---- Daily output same as above. - /CCSM/csm/b202.02 --------- Coupled simulations, T42L26, Eulerian dynamics -Changes made: - -IMPORTANT: Problems on SUN, and Linux, problems on batch submission to: - blue, eagle, gseaborg (see below). Need new datasets (see below). ----------------------------------------------------------------------------- -Physical changes: - Precipitation evaporation: J.J. Hack. - Cloud water changes for mid-atm.: P.J. Rasch - LW water-vapor abs/ems changes: W. Collins - no orographic drag over ocean: B.B. Boville - fix to geo-potential: B.B. Boville - -Land-model: - Tested with both LSM1 and CLM2 land-models (see below). CLM2 - was updated to CLM2.1.20. -Interface changes: - Makefile changed so that in-lining is done. - radems/radabs became a module. - LINUX CPP token changed to Linux (so you can use uname -s) - Block data removed (except for phys366). - Check that ORO is valid from IC file. -Testing: - Code was tested both on many NCAR platforms and several off-site - platforms as well. test-model.pl was primarily used to validate - that the model started/restarted for all dynamics as well as - both the "physics" and "phys366" physics directories and "lsm1" - and "clm2" land models. It also verified that restarts give exact - answers to the history files (both average and instant values), - and that changing the decomposition gives the same answers and - that SPMD and non-SPMD gives the same answers. It also checks - that the code can run with bounds checking on (on Sun and Linux), - and with the compiler initializing variables to indefinite. - - CCSM tests run ccm/test/csm.csh to ensure that the model works - with the CCSM coupler. This version of the model works with - ccsm2_0_beta11. - -Machine lsm1-physics CCSM clm2-physics clm2-phys366 lsm1-phys366 -babyblue(aix) X X X X X -blackforest(aix) X X -gseaborg(aix) X -eagle(aix) X -blue(aix) X -longs(PC) X X X -prospect(osf) X X X X -compass(osf) X -utefe(sgi) X X X X -tropic(sgi) X X X -sanitas(sun) X X X - -Error growth: - The error-growth is faster than the previous model, especially - SLD but, it was deemed acceptable. HOWEVER, - THE ERROR-GROWTH ON THE SUN IN COMPARISON TO THE IBM IS - UNACCEPTABLE. Until this is fixed the Sun should not be - used for simulations. - -Script changes: - test-model.pl was made more robust. Tests - to compare SPMD non-SPMD were added and to check both avg - and instant history files for restart tests, and new - input options added: - - set the env variables: - - LANDMODEL --- to define whether to use LSM1 or CLM2 - PHYSICS ----- to define whether to use "phys366" or "physics". - - skip option (-s) now allows an end-point and allows resolution - to be specified. So - - -s eul:3-5:T42L26 - - Will run tests 3-5 with Eulerian dynamics at T42 and 26 levels. - - Error-growth option. To do a port validation you can validate - against a given trusted machine. To do this use something like: - - -e "blackforest.ucar.edu(aix)" - - This assumes you already ran test-model.pl on blackforest (and - left everything in the standard locations). Then the "errg*.cprout" - files will contain a comparison to the above machine. - -New datasets: - Bundle of datasets needed to run the model and use "test-model.pl". - - ftp.cgd.ucar.edu; cd pub/erik; bin; - get ccm3.12.acpi-atm.datasets.tar.gz - - abs_ems_factors_fastvx.052001.nc --- Required for use with - the new LW code. - clm datasets ---- In order to run with clm2. - fv.4x5L18 -------- 4x5 degree resolution dataset with 18 levels - for LR dynamics from Sharon Nebuda. -Known-Bugs: - Linux: S.-J. had trouble with 10x15 on Linux with LR and the - Portland group compiler. I had trouble with Linux at - 2x2.5 with LR. - Sun: Error-growth was bad. Ran out of memory at some resolutions, - especially when doing SPMD, or when using CLM2. - Batch: Had trouble with batch submission on the IBM-SP machines: - blue, gseaborg, and eagle. Interactive, didn't have the - same trouble, so I'm unclear why this is the case. - test-model.pl: When using "-s all:" option you can't give an - end-point or it will only run for the first dynamics. -Changes since CCM3.11: - Many enhancements, bug-fixes, and progress on 2D-decompostion to LR - dynamics. Update to F90 and initial Protex pass for LR. - Replace Rayleigh friction with 1st order upwind transport. - Revised mapping algorithm near the surface for winds. - - slaveio namelist item removed. Namelist variable "IDEALDYN" - changed to "IDEAL_PHYS" - - Support for Lahey and Fujitsu compilers on Linux. Work on chunking. - Columns given by phys_grid methods. timing library added. - Ability for bounds-checking added. FORTFFT cpp parameter deleted - use USEFFTLIB if library available. SPMD now doesn't require that - the number of MPI tasks evenly divide into the number of latitudes. - - History modularized. Progress on physics/dynamics split. Restart - dyanmics and physics split out better. Sulfur-cycle codes fixed. - SLD energy fixer added. - - phys366 and clm2 directories added. Generic interface to both - land-models. - - Options added to scripts: PHYSICS, LANDMODEL, tests to run. - NO_SWITCH option for LLNL Compaq. "-clean", "-nofail" and "-t" - options added. Fix interpic for multiple times if available in file. - -=============================================================== -=============================================================== - -ccm3_11 -Originator: erik ( Erik Kluzek) -Date: Thu Dec 21 16:22:20 MST 2000 -Model: CCM -Version: CCM3.11 -One-line Summary: New LW absorption,new vertical diffusion,SLD energy fixer, - scripts,Lin/Rood fixes,split dynamics -Requires change in build system: yes, new build system, use 26 level model -Tested on lr dynamics: yes -Tested on eul dynamics: yes -Tested on sld dynamics: yes -Tested to work coupled with CSM: no -Tested that restarts are bit-for-bit: yes -Tested multiple constituents: yes -Tested that different domain decompositions match bit-for-bit: yes -Tested in adiabatic mode: no (currently broken) -Substantial timing or memory changes: no -Machines tested: IBM, SGI, Sun, PC -Requires change in run script: yes - (New namelist parameter: absems_data) - (New namelist parameter for Lin-Rood: nsplit) - (New namelist parameter: empty_htapes) - (New namelist parameter: aqua-planet) - (New build/run environment provided) - (Need to use new 26 level datasets) -Updated the DatasetLog (for new input data-files): Yes -Updated the documentation: no (will need to though) -Changes answers: Yes (improved physics) -Name of tests cases on NCAR Mass-Store: See CCM3.10.60 below -Changes made: - -Physics changes from CCM3.10: - - New LW absorption of water vapor as per Dr. William Collins. - New vertical diffusion on dry static energy as per Dr. Byron Boville. - - Energy fixer for SLD from Dr. David Williamson and Jerry Olson. - Many bug-fixes to Lin/Rood dynamics. - Many routines migrated to modules. - -New build run environment provided: - - A completly new set of scripts provided to configure, build, and - run the model. Also a test script provided for testing before - committing code changes. - - A script provided to help with the process of interpolating and - creating new initial condition datasets. - -Code changes: - - Work to split dynamics and physics better. - Initial work on 2D decomposition. - Open MP works on PC. - More platforms supported with LR. - Add version, revision_id to history files. - Fix floating point trapping on Compaq. - Various bug-fixes. - -=============================================================== -=============================================================== - -ccm3_10 -Originator: erik ( Erik Kluzek) -Date: Tue Jun 20 08:35:26 MDT 2000 -Model: CCM -Version: CCM3.10 -One-line Summary: Update code to F90 and coding standard, - optimize radcsw, fix bugs, new LR core, - Finish reduced grid tools -Requires change in build system: no -Tested on lr dynamics: Yes -Tested on eul dynamics: Yes -Tested on sld dynamics: Yes -Tested to work coupled with CSM: Yes -Requires change in run script: Yes (requires I/C files with LANDM) -Updated the DatasetLog (for new input data-files): Yes -Updated the documentation: Yes -Changes answers: Yes (different climate) -Name of tests cases on NCAR Mass-Store: /JET/csm/ccm3911 (full grid Eulerian) - /ROSINSKI/csm/ccm3911_r1up (reduced grid Eul) -Changes made: - - Double tagged as CCM3.9.28. - - Update code to F90 free-form and coding standard. - New optimized version of radcsw. Fix bug with CSM with flxave on. Fix bug - with first time-step on Eulerian. Get offline tools to work with reduced - grid and L/R dynamics. Change so LANDM is calculated in offline tool rather - than inside model. Update L/R to new version, add "precision" changes. Fix - Linux Makefile for F90 files. Fix bug with SLD and hortal smoothing and hordif. - Fix problems with SLD on Sun, IBM and Compaq. Fix PHIS filter bug. - -=============================================================== -=============================================================== - -ccm3_9 -Originator: erik ( Erik Kluzek) -Date: Thu Apr 27 15:04:53 MDT 2000 -Model: CCM -Version: CCM3.9 -One-line Summary: New cloud overlap, reduced grid option, addition of Lin-Rood dynamics. -Requires change in build system: Yes -Requires change in run script: Yes -(New options for reduced grid, or Lin-Rood) -Updated the DatasetLog (for new input data-files): not-applicable -Updated the CCM development schedule: no -Updated the documentation: Yes -Changes answers: Yes (new-climate) -Name of tests cases on NCAR Mass-Store: /JET/csm/bill30e -Changes made: - - Added new cloud overlap assumptions from Bill Collins (random overlap when gap - between clouds in column, maximum overlap when clouds exist in both adjoining - layers). - - Added the reduced grid option from Dave Williamson. - - Added Lin-Rood dynamics as a new dynamics configuration. - - Output cleanup. Code cleanup. Two default output streams monthly and daily - files. - - Support IBM and Compaq. Will compile/run on Cray, but radiation changes - turned on. - (a fix is on the way soon). - -=============================================================== +???LINES MISSING From 8c3f7bdb77ed92251595f02ced0998e8ccf9fcbc Mon Sep 17 00:00:00 2001 From: adamrher Date: Wed, 8 Oct 2025 09:53:11 -0600 Subject: [PATCH 441/466] revert fix cosp fix --- bld/build-namelist | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/bld/build-namelist b/bld/build-namelist index 8e53241fbf..5763078f58 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -4467,17 +4467,15 @@ for my $i (0 .. $#interp_output) { } } -#+++arh -- below is a bug, comment out for now -## Currently, interpolated output does not work with the COSP fields that use -## more than 1 mdims. -#my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); -#if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} -#if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { -# die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . -# " to direct COSP output to a history file that is not interpolated. COSP output is\n" . -# " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; -#} -#---arh +# Currently, interpolated output does not work with the COSP fields that use +# more than 1 mdims. +my $cosp_histfile_num = $nl->get_value('cosp_histfile_num'); +if (!defined $cosp_histfile_num) {$cosp_histfile_num = 1;} +if ($interp_output[$cosp_histfile_num-1] =~ /$TRUE/io) { + die "$ProgName - ERROR: interpolate_output does not work with COSP. Use cosp_histfile_num\n" . + " to direct COSP output to a history file that is not interpolated. COSP output is\n" . + " currently on cosp_histfile_num=$cosp_histfile_num which contains interpolated output."; +} my $offline_drv = $cfg->get('offline_drv'); if ($offline_drv ne 'stub') { From 1a6f9f6414000fa6c9c3c735e25ebbeedb0f42e8 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 8 Oct 2025 11:13:33 -0600 Subject: [PATCH 442/466] update externals --- .gitmodules | 6 +++--- ccs_config | 2 +- src/atmos_phys | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 114484b244..56ba0ded94 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/ESCOMP/atmospheric_physics - fxtag = atmos_phys0_18_001 + url = https://github.com/sjsprecious/atmospheric_physics + fxtag = 5b48970 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics @@ -138,7 +138,7 @@ fxDONOTUSEurl = https://github.com/ESCOMP/mizuRoute [submodule "ccs_config"] path = ccs_config url = https://github.com/ESMCI/ccs_config_cesm.git -fxtag = ccs_config_cesm1.0.61 +fxtag = ccs_config_cesm1.0.63 fxrequired = ToplevelRequired fxDONOTUSEurl = https://github.com/ESMCI/ccs_config_cesm.git diff --git a/ccs_config b/ccs_config index b20a207bc9..6c22a0f514 160000 --- a/ccs_config +++ b/ccs_config @@ -1 +1 @@ -Subproject commit b20a207bc918b956b8dad44c14c4471aff9331ee +Subproject commit 6c22a0f514cb8ab1d4bcf403b22109b561c42955 diff --git a/src/atmos_phys b/src/atmos_phys index 6f38b7ce08..5b48970d3c 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 6f38b7ce083d599146921fde33b045e9ae39a97b +Subproject commit 5b48970d3ce794b178c858308a5157e6c3f0efd9 From 65e2a8a7a10b3743592ecb890ba4fa778fadc678 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 8 Oct 2025 14:08:23 -0600 Subject: [PATCH 443/466] fix changelog --- doc/ChangeLog | 25899 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 25897 insertions(+), 2 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 44224a7f00..0b361a9478 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,3 @@ - =============================================================== Tag name: cam6_4_123 @@ -168,6 +167,7 @@ derecho/intel/aux_cam: All PASS derecho/nvhpc/aux_cam: FAIL ERS_Ln9.ne30pg3_ne30pg3_mt232.FHISTC_LTso.derecho_nvhpc.cam-outfrq9s_gpu_default RUN time=441 - pre-existing failure -- might be related to https://github.com/ESCOMP/CAM/issues/1383 + izumi/nag/aux_cam: All PASS izumi/gnu/aux_cam: All PASS @@ -129037,4 +129037,25899 @@ Purpose of changes: ncdata but not start_ymd. This is because build-namelist has default values for start_ymd which correspond to the default datasets used for ncdata. If the user overrides the default ncdata, then the default -???LINES MISSING + start_ymd should also be overridden since the default may be inconsistent + with the dataset specified for ncdata. + +. add fix to XML::Lite parser code to recognize attributes when there is + optional white space between the equals sign and the value. Also allow + the attribute values to be enclosed in single quotes as well as double + quotes. + +. modify build for a homme run + +. Add some initializers for index values in FV (from Art Mirin). + +. replace deprecated float() intrinsic with real(). + +. fix for spaces in the name of the spmdstats file (from Pat Worley). + +. update mct external to trunk tag MCT2_3_0_070112 + +Bugs fixed (include bugzilla ID): + +. Bugzilla bug 89: + Change to cd_core.F90 required to enable the ifort compiler to compile the + omp directive surrounding "do 4500" loop. + +. Bugzilla bug 65: + Remove a informative print statement from inside an CSD region (caused + problem on Cray-X1E). + +. add fix for intermittent problem Tony found running in coupled mode on + bassi (NERSC IBM p5). Add initializer for srfflx_state2d%qref. + +. fix ctl_nl.pm (a homme namelist) so that it doesn't ignore the resolution + found in the config_cache.xml file. Remove the hardcoded value of "ne" + from Default_CTL_NL_Namelist.xml. + +. NOTE -- initial commit and tag contained problem with svn external + definitions. Deleted that tag, fixed definitions, recommitted and + retagged. + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + +. Add checks to build-namelist to fail if ncdata is specified without + specifying start_ymd. + +List any changes to the defaults for the boundary datasets: + +. New CLM datasets for FV, 1.9x2.5. These datasets are consistent with the + landfraction used for CCSM runs (1.9x2.5_gx1v4). + +Describe any substantial timing or memory changes: none + +Code reviewed by: myself + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +. update mct external to trunk tag MCT2_3_0_070112 + SVN_EXTERNAL_DIRECTORIES + +. Mods to add 1/4 and 1/2 degree FV grids + models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml + models/atm/cam/bld/resolution_parameters.xml + models/atm/cam/src/physics/cam1/cldwat.F90 + models/atm/cam/src/physics/cam1/cloud_fraction.F90 + models/atm/cam/src/physics/cam1/hk_conv.F90 + models/atm/cam/src/physics/cam1/zm_conv.F90 + models/atm/cam/src/dynamics/fv/dycore.F90 + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + +. modify warning about extrapolating too much of grid + models/atm/cam/src/control/interpolate_data.F90 + +. bug fix for CAM banner in output log + models/drv/seq_mct/seq_ccsm_drv.F90 + +. Modify build-namelist defaults for FV, 1.9x2.5. + models/atm/cam/bld/cam_inparm.pm + models/atm/cam/bld/clm_inparm.pm + models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml + +. add check to force user to also specify start_ymd if ncdata has been + specified. + models/atm/cam/bld/SeqCCSM_namelist.pm + +. add fix to XML::Lite parser code to recognize attributes when there is + optional white space between the equals sign and the value. Also allow + the attribute values to be enclosed in single quotes as well as double + quotes. + models/atm/cam/bld/XML/Lite/Element.pm + +. add missing initializer for srfflx_state2d%qref. + models/atm/cam/src/control/camsrfexch_types.F90 + +. mods for homme build + models/atm/cam/bld/config_cam_homme_defaults.xml + models/atm/cam/bld/ctl_nl.pm + models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + models/atm/cam/bld/DefaultCTL_NL_Namelist.xml + models/atm/cam/bld/DefaultTIMEMGR_INPARM_Namelist.xml + +. add some initializers for index values in FV (from Art Mirin). + models/atm/cam/src/dynamics/fv/d2a3dijk.F90 + models/atm/cam/src/dynamics/fv/d2a3dikj.F90 + models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + +. Replace deprecated float() intrinsic with real(): + models/atm/cam/src/physics/cam1/mcshallow.F90 + models/atm/cam/src/physics/cam1/convect_ke.F + models/atm/cam/src/physics/cam1/uw_conv.F + +. Bugzilla bug 89: + models/atm/cam/src/dynamics/fv/cd_core.F90 + +. Bugzilla bug 65 + models/atm/cam/src/dynamics/fv/fill_module.F90 + +. Put shr_sys_flush calls inside "#ifndef UNICOSMP" as a workaround for a bug + on the Cray-X1E. +. fix spmdstats filename so that it doesn't contain spaces + models/atm/cam/src/control/cam_comp.F90 + +. Mods to remove the "non-advected" species option. Remove all occurances + of pnats and ppcnst, and change the cnst_add interface to remove the + 'type' argument. + models/ocn/som/mixed_layer.F90 + models/utils/pilgrim/mod_comm.F90 + models/atm/cam/test/unit/control/file_test.pl + models/atm/cam/test/unit/ocnsice/dom/params.h + models/atm/cam/tools/scam/configure + models/atm/cam/tools/scam/scm_init/forecast.F90 + models/atm/cam/tools/scam/obj/Makefile + models/atm/cam/bld/CAM_config.pm + models/atm/cam/src/control/ccsm_msg.F90 + models/atm/cam/src/control/wtrc_flxoce.F90 + models/atm/cam/src/control/srfxfer.F90 + models/atm/cam/src/control/history_scam.F90 + models/atm/cam/src/control/cam_history.F90 + models/atm/cam/src/control/history_defaults.F90 + models/atm/cam/src/control/camsrfexch_types.F90 + models/atm/cam/src/control/ncdio_atm.F90 + models/atm/cam/src/control/iop.F90 + models/atm/cam/src/physics/cam1/tphysidl.F90 + models/atm/cam/src/physics/cam1/tphysbc.F90 + models/atm/cam/src/physics/cam1/drydep_mod.F90 + models/atm/cam/src/physics/cam1/restart_physics.F90 + models/atm/cam/src/physics/cam1/hk_conv.F90 + models/atm/cam/src/physics/cam1/constituents.F90 + models/atm/cam/src/physics/cam1/water_tracers.F90 + models/atm/cam/src/physics/cam1/hb_diff.F90 + models/atm/cam/src/physics/cam1/convect_shallow.F90 + models/atm/cam/src/physics/cam1/convect_deep.F90 + models/atm/cam/src/physics/cam1/buffer.F90 + models/atm/cam/src/physics/cam1/zm_conv.F90 + models/atm/cam/src/physics/cam1/qneg4.F90 + models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + models/atm/cam/src/physics/cam1/initindx.F90 + models/atm/cam/src/physics/cam1/seasalt_intr.F90 + models/atm/cam/src/physics/cam1/tracers.F90 + models/atm/cam/src/physics/cam1/progseasalts_intr.F90 + models/atm/cam/src/physics/cam1/dust_intr.F90 + models/atm/cam/src/physics/cam1/stratiform.F90 + models/atm/cam/src/physics/cam1/carbon_intr.F90 + models/atm/cam/src/physics/cam1/co2_cycle.F90 + models/atm/cam/src/physics/cam1/chemistry.F90 + models/atm/cam/src/physics/cam1/aerosol_intr.F90 + models/atm/cam/src/physics/cam1/sulfur_intr.F90 + models/atm/cam/src/physics/cam1/tracers.F90 + models/atm/cam/src/physics/cam1/radiation.F90 + models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 + models/atm/cam/src/physics/cam1/cam_diagnostics.F90 + models/atm/cam/src/physics/cam1/upper_bc.F90 + models/atm/cam/src/physics/cam1/physics_types.F90 + models/atm/cam/src/physics/cam1/physpkg.F90 + models/atm/cam/src/physics/cam1/constituent_burden.F90 + models/atm/cam/src/physics/cam1/tphysac.F90 + models/atm/cam/src/physics/waccm/tracers.F90 + models/atm/cam/src/physics/waccm/chemistry.F90 + models/atm/cam/src/physics/waccm/gw_drag.F90 + models/atm/cam/src/physics/waccm/upper_bc.F90 + models/atm/cam/src/physics/waccm/mo_msis_ubc.F90 + models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 + models/atm/cam/src/chemistry/waccm_mozart/upper_bc.F90 + models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 + models/atm/cam/src/chemistry/waccm_mozart/mo_tgcm_ubc.F90 + models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 + models/atm/cam/src/chemistry/waccm_mozart/mo_snoe.F90 + models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 + models/atm/cam/src/dynamics/sld/linemsdyn.F90 + models/atm/cam/src/dynamics/sld/spegrd.F90 + models/atm/cam/src/dynamics/sld/prognostics.F90 + models/atm/cam/src/dynamics/sld/scanslt.F90 + models/atm/cam/src/dynamics/sld/scan2.F90 + models/atm/cam/src/dynamics/sld/restart_dynamics.F90 + models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 + models/atm/cam/src/dynamics/sld/dp_coupling.F90 + models/atm/cam/src/dynamics/sld/inidat.F90 + models/atm/cam/src/dynamics/sld/dyn_comp.F90 + models/atm/cam/src/dynamics/sld/spmd_dyn.F90 + models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 + models/atm/cam/src/dynamics/eul/linemsdyn.F90 + models/atm/cam/src/dynamics/eul/spegrd.F90 + models/atm/cam/src/dynamics/eul/scanslt.F90 + models/atm/cam/src/dynamics/eul/prognostics.F90 + models/atm/cam/src/dynamics/eul/scandyn.F90 + models/atm/cam/src/dynamics/eul/restart_dynamics.F90 + models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 + models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 + models/atm/cam/src/dynamics/eul/dp_coupling.F90 + models/atm/cam/src/dynamics/eul/dyn_comp.F90 + models/atm/cam/src/dynamics/eul/inidat.F90 + models/atm/cam/src/dynamics/eul/spmd_dyn.F90 + models/atm/cam/src/dynamics/fv/stepon.F90 + models/atm/cam/src/dynamics/fv/dp_coupling.F90 + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + models/atm/cam/src/dynamics/fv/inital.F90 + models/atm/cam/src/dynamics/fv/restart_dynamics.F90 + models/atm/cam/src/advection/slt/qmassa.F90 + models/atm/cam/src/dynamics/homme/dp_coupling.F90 + + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluevista: all PASS except: +035 bl375 TBL.sh f1.9h outfrq24h 2d ...............................FAIL! rc= 7 +059 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 + +tempest: all PASS except +031 bl376 TBL.sh f1.9o outfrq24h 2d ...............................FAIL! rc= 7 + +bangkok/lf95: all PASS except: +031 bl377 TBL.sh f1.9m outfrq24h 2d ...............................FAIL! rc= 7 + +The failure of the FV, 1.9x2.5 baseline comparisons are expected due to a +change in the default landfrac file for that case. + +The failure of the CCSM restart test is still under investigation. The +latest CCSM tag in collections (ccsm3_1_beta42) is also failing with +cam3_3_46 which means the failure is not associated with the mods in this +commit. + + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: BFB + +=============================================================== +=============================================================== + +Tag name: cam3_3_46 +Originator(s): mvr,jet,eaton,aconley +Date: 10 Jan 2007 +One-line Summary: test_driver mods, consolidation of external +definitions in top directory, various bug fixes + +Purpose of changes: +-having external definitions in multiple places led to some confusion +-previously had no pretag tests at fv 1.9x2.5, an important production res +-wanted some posttag testing to occur on calgary as alternative linux cluster +-testing of fv 2d decomposition needed bolstering and multiple platforms +-needed test of an extended run (several months) to catch certain run-time bugs +-added lightning test environment setting to override that of users +-branch test again branches from an earlier restart file than the last created + (broken since cam3_3_15) + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself,eaton + +List all subroutines eliminated: +D models/utils/SVN_EXTERNAL_DIRECTORIES +D models/SVN_EXTERNAL_DIRECTORIES +- files no longer needed with consolidation of external defs to top dir +D models/atm/cam/test/system/config_files/f2h +D models/atm/cam/test/system/config_files/f2m +D models/atm/cam/test/system/config_files/f2o +- fv tests at "production" settings moved from fv2x2.5 to fv1.9x2.5 +D models/atm/cam/test/system/tests_posttag_bangkok +- posttag testing of linux cluster moved from bangkok to calgary +D models/atm/cam/test/system/TRX.sh +- restart test while toggling fv 2d decomp settings merged with TER.sh + +List all subroutines added and what they do: +A models/atm/cam/test/system/config_files/f4h +- new configuration options file for performance/extended-run test +A models/atm/cam/test/system/config_files/f1.9o +- new configuration options file for "production" setting on tempest +A models/atm/cam/test/system/nl_files/fv2d_4tsk +A models/atm/cam/test/system/nl_files/fv2d_8tsk +- new namelist options files for testing of fv 2d decomposition +A models/atm/cam/test/system/tests_posttag_calgary +- posttag testing of linux cluster moved from bangkok to calgary +A SVN_EXTERNAL_DIRECTORIES +- new, consolidated list of all cam external definitions + +List all existing files that have been modified, and describe the changes: + M . +- set externals property on top level dir + M models + M models/utils +- deleted externals properties where they previously existed +M models/atm/cam/test/system/TBR.sh +M models/atm/cam/test/system/TSM.sh +- modified to handle new syntax for run length +M models/atm/cam/test/system/TER.sh +- modified to handle new syntax for run length; restart now toggles resources + appropriately if running fv 2d decompostion +M models/atm/cam/test/system/tests_pretag_tempest +- now running "production" test at fv 1.9x2.5 +M models/atm/cam/test/system/tests_pretag_bangkok +M models/atm/cam/test/system/tests_posttag_lightning +- added test for fv 2d decomp and now running "production" test at fv 1.9x2.5 +M models/atm/cam/test/system/tests_posttag_bluesky +M models/atm/cam/test/system/tests_pretag_bluesky +M models/atm/cam/test/system/tests_pretag_bluevista +- changed test for fv 2d decomp and now running "production" test at fv 1.9x2.5 +M models/atm/cam/test/system/tests_posttag_bluevista +- added extended run (two months) and moved the performance test from 10d to 2m +M models/atm/cam/test/system/test_driver.sh +- modified settings for calgary; bug fix for lightning environment +M models/atm/cam/test/system/nl_files/pghgsul +- added namelist settings for freq of restart writes +M models/atm/cam/test/system/input_tests_master +- modified syntax for run length of tests - needed to specify something other + than timesteps or days; addition and deletion of tests mentioned +M models/atm/cam/test/system/CAM_runcmnd.sh +- modified setting for calgary +M models/atm/cam/src/control/getnetcdfdata.F90 +- SCM bug fix for setlatlonidx routine when determining closest model column to + given lat/lon pair +M models/atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 +- fix to memory bug when calling radforce with omp enabled +M models/atm/cam/src/physics/cam1/phys_gmean.F90 +- fix to memory leak introduced in cam3_3_35; whitespace cleanup +M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +- fixed bug in reading PS data from Match. Bug introduced in cam3_3_43 + +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. + +bluevista: +- all baseline tests failed due to the changes in the testing scripts and in + some cases the fixing of bugs - when a baseline was set up with the same + script changes and bug fixes, all baseline tests passed + +tempest: +- all baseline tests failed due to the changes in the testing scripts and in + some cases the fixing of bugs - when a baseline was set up with the same + script changes and bug fixes, all baseline tests passed + +bangkok/lf95: +- all baseline tests failed due to the changes in the testing scripts and in + some cases the fixing of bugs - when a baseline was set up with the same + script changes and bug fixes, all baseline tests passed + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_45 +Originator(s): Dani Bundy Coleman, Jerry Olson +Date: 8 Jan 2007 +One-line Summary: Alternative convection & PBL schemes, forecast mode + +Purpose of changes: Allow users to run the UW PBL scheme or the Emanuel + deep convection scheme. Add rough code to run in forecast mode. + + The UW PBL scheme requires: + configuration option: nlev = 30 + namelist options: shallow_scheme = 'UW' + eddy_scheme = 'diag TKE' + The Emanuel deep convection requires: + namelist options: deep_scheme = 'KE' + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + +character(len=16) :: shallow_scheme ! 'Hack' (default),'UW','off' +! 'Hack' = Hack shallow convection (default) +! 'UW' = original McCaa UW pbl scheme, modified by Sungsu Park +! 'off' = no shallow convection +! +character(len=16) :: deep_scheme ! 'ZM' (default), 'KE', 'off' +! 'ZM' = Zhang-McFarlane (default) +! 'KE' = Kerry Emanuel's scheme +! 'off' no deep convection +! +character(len=16) :: eddy_scheme ! 'HB' (default), 'diag TKE' +! 'HB' = Holtslag and Boville (default) +! 'diag TKE' = diagnostic tke version of Grenier and Bretherton + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: + +A models/atm/cam/src/utils/error_function.F90 + provides an erfc function for the UW PBL scheme +A models/atm/cam/src/physics/cam1/phys_control.F90 + Control interface to CAM physics packages +A models/atm/cam/src/physics/cam1/mcshallow.F90 + UW PBL shallow convection package +A models/atm/cam/src/physics/cam1/convect_ke_intr.F90 + Interface to Kerry Emanuel's deep convection scheme +A models/atm/cam/src/physics/cam1/convect_ke.F + Kerry Emanuel's deep convection scheme +A models/atm/cam/src/physics/cam1/zm_conv_intr.F90 + Interface to Zhang-McFarlane deep convection scheme + (used to be convect_deep.F90) +A models/atm/cam/src/physics/cam1/eddy_diff.F90 + UW PBL eddy diffusivity package +A models/atm/cam/src/physics/cam1/uw_conv.F90 + UW PBL shallow convection package + +List all existing files that have been modified, and describe the changes: + +Forecast mode changes: +M models/atm/cam/src/control/cam_history.F90 +M models/atm/cam/src/physics/cam1/check_energy.F90 +M models/atm/cam/src/physics/cam1/cam_diagnostics.F90 +M models/atm/cam/src/dynamics/sld/spegrd.F90 +M models/atm/cam/src/dynamics/sld/linemsdyn.F90 +M models/atm/cam/src/dynamics/sld/scanslt.F90 +M models/atm/cam/src/dynamics/sld/dyn_comp.F90 +M models/atm/cam/src/dynamics/sld/inidat.F90 +M models/atm/cam/src/dynamics/sld/grmult.F90 +M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 +M models/atm/cam/src/dynamics/eul/linemsdyn.F90 +M models/atm/cam/src/dynamics/eul/inidat.F90 +M models/atm/cam/src/dynamics/eul/dyn_comp.F90 +M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 +M models/atm/cam/src/dynamics/fv/initcom.F90 +M models/atm/cam/src/dynamics/fv/inidat.F90 +M models/atm/cam/src/dynamics/fv/dyn_comp.F90 +M models/atm/cam/src/dynamics/fv/commap.F90 +M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 +M models/atm/cam/src/dynamics/fv/uv3s_update.F90 +M models/atm/cam/src/dynamics/fv/stepon.F90 + +Convection option changes: +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/physics/cam1/initindx.F90 +M models/atm/cam/src/physics/cam1/param_cldoptics.F90 +M models/atm/cam/src/physics/cam1/physpkg.F90 +M models/atm/cam/src/physics/cam1/cloud_fraction.F90 +M models/atm/cam/src/physics/cam1/gw_drag.F90 +M models/atm/cam/src/physics/cam1/phys_buffer.F90 +M models/atm/cam/src/physics/cam1/zm_conv.F90 +M models/atm/cam/src/physics/cam1/cldwat.F90 +M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 +M models/atm/cam/src/physics/cam1/convect_shallow.F90 + This is now the interface to all shallow convection schemes +M models/atm/cam/src/physics/cam1/convect_deep.F90 + This is now the interface to all deep convection schemes + +Convection and Forecast-mode changes: +M models/atm/cam/src/physics/cam1/tphysbc.F90 +M models/atm/cam/src/physics/cam1/stratiform.F90 +M models/atm/cam/src/physics/cam1/constituents.F90 +M models/atm/cam/src/physics/cam1/tphysac.F90 + +Miscellaneous changes: +M models/atm/cam/test/system/TBL.sh + Add more information to output +M models/atm/cam/test/system/test_driver.sh + Change bluevista gmake option from "-j" to "-j8" +M models/atm/cam/src/physics/cam1/acbnd.F90 + Check that oxidant file has correct vertical dimensions +M models/atm/cam/src/physics/cam1/radiation.F90 +M models/atm/cam/src/physics/cam1/radsw.F90 +M models/atm/cam/src/physics/cam1/radlw.F90 + Calculate clearsky solor & longwave heating rates + New output fields: QRSC, QRSC_RF, QRLC +M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 + stdout + +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. + +bluevista: +Some code was moved from timestepping routines to initialization +routines. In cldwat.F90, this causes a roundoff change +on bluevista that causes the following baseline tests to fail: +005 bl131 TBL.sh e32c11dh pghgsul 9 +008 bl132 TBL.sh e32sdh ghgrmp 9 +015 bl151 TBL.sh e64h outfrq24h -2 +019 bl331 TBL.sh f4c11gdh pghgsul 9 +022 bl332 TBL.sh f4sdh ghgrmp 9 +030 bl336 TBL.sh wm4h outfrq3s 9 +034 bl351 TBL.sh f2h outfrq24h -2 +037 bl354 TBL.sh fm2dh outfrq3s 9 +040 bl355 TBL.sh fmo2dh off2x2.5 9 +054 bl551 TBL.sh s64h outfrq24h -2 + +tempest: +The roundoff difference as seen on bluevista seems to +show up in a waccm test that fails: +017 bl314 TBL.sh wg10dh outfrq3s 9 + +The baseline model field DTCOND included the effects of the energy +fixer (which is actually a fix to the nonconservation of the +dynamics). We moved the call to diag_conv_tend_ini from its position +above the energy fixer to below it, which makes the field different +and allows the heat budget to work out. This causes the following tests to +fail (only DTCOND is different): +021 bl331 TBL.sh f4c11gdh pghgsul 9 +024 bl332 TBL.sh f4sdh ghgrmp 9 +031 bl352 TBL.sh f2o outfrq24h -2 + + +bangkok/lf95: +Failed because of fixed DTCOND (only DTCOND is different) +016 bl311 TBL.sh f10c8mdm ttrac 9 +024 bl312 TBL.sh f10sdm ghgrmp 9 +028 bl353 TBL.sh f2m outfrq24h -2 + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_3_44 + +Summarize any changes to answers, i.e., +- what code configurations: + Any configuration on bluevista, although the sulfur cycle is particularly sensitive. + WACCM on tempest was also sensitive to the roundoff change + +- what platforms/compilers: + bluevista, tempest + +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + roundoff +If bitwise differences were observed, how did you show they were no worse +than roundoff? + pergro test, tracking roundoff change to culprit code + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_44 +Originator(s): Jim Edwards +Date: 12-13-2006 +One-line Summary: Update of homme dynamics, update of tests and timing utils + +Purpose of changes: Merge homme dynamics development branch. + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + Added a default homme core build + M 2606 models/atm/cam/bld/config_cam_homme_defaults.xml + M 2606 models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + M 2606 models/atm/cam/bld/DefaultCTL_NL_Namelist.xml + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself Brian Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: + updated for new timings tag: + models/utils/SVN_EXTERNAL_DIRECTORIES + + added a homme test and updated the CCSM test: + A 0 models/atm/cam/test/system/config_files/h5x8dm + M 2606 models/atm/cam/test/system/TCT.ccsm.sh + M 2606 models/atm/cam/test/system/tests_pretag_bluevista + M 2606 models/atm/cam/test/system/input_tests_master + + ccsm tests will now pull in share code from tester's sandbox by default... + added environment variable (CAM_USE_SHR) to control behavior + + Added support for homme grid in energy calculation + M 2606 models/atm/cam/src/physics/cam1/phys_gmean.F90 + Replaced some data statements with parameter declarations + M 2606 models/atm/cam/src/physics/cam1/radae.F90 + + Removed some debugging code + M 2606 models/atm/cam/src/physics/cam1/physpkg.F90 + M 2606 models/atm/cam/src/physics/cam1/qneg3.F90 + + Removed some timers that were causing a problem on bluevista - + this is a hack, it looks like there is a memory problem associated + with fmo2dh - I will continue to investigate. + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluevista: 056 bl711 TBL.sh h5x8dm adia 9 FAIL (no existing baseline) + + 058 cs998 TCS.ccsm.sh ERS f19_g13 K + 040 bl355 TBL.sh fmo2dh off2x2.5 9 + FAILED against cam3_3_43 PASS against cam3_3_42 this is due to + problems introduced in 3_3_42 + +tempest: none + +bangkok/lf95: none + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_43 +Originator(s): John Truesdale +Date: 4 Dec 2006 +One-line Summary: Added single column mode to CAM + +Purpose of changes: + + This commit adds a single column mode (SCM) to CAM. The scam + GUI is being refactored and has been removed from the + trunk. The CAM single column mode is controlled via the + standard cam namelist. Additional namelist parameters allow + cam to be forced using a standard IOP dataset. Future commits + will add back much of the original scam and column radiation + capablity as well as an updated GUI. + + To run cam in single column mode you need to invoke the standard + cam configure script with the -scam option and compile the model + as usual. Although single column mode only runs with the eularian + dynamics most other options for configuring cam (resolution, external + libraries, etc) will work. Next invoking the build-namelist + script will provide a namelist template for running with the + default ARM IOP. The build-namelist procedure requires the user + to supply namelist values for the latitude and longitude of the + IOP column using the namelist variables scmlat and scmlon. + In practice though the user must also specify the starting date + and timesteps to run as well as an appropriate initial condition. + The following parameters to the build-namelist script may be used for + running with the various IOP datasets. The initial data being read + in and used as a background for each of the IOPs is the standard + SEP 1 initial condition. It is suggested that the user generate an + initial condition closer to the starting date of the IOP. + Once the namelist is generated the user may run cam and analyze the + standard history tape produced for the IOP column with any netcdf + visualization tool. + + The relavent namelist parameters for use with the single column mode + of cam are: + + single_column = .true. + scmlat = xxx ! scm latitude to use for the model run + scmlon = xxx ! scm longitude to use for the model run + iopfile = 'xxx' ! iop boundary condition file + + +build-namelist script params for the ARM IOP + +build-namelist -namelist \ +"&camexp \ +mss_irt=0 \ +scmlat=36.6 \ +scmlon=262.5 \ +start_ymd=19950718 \ +start_tod=19800 \ +stop_n=1259 \ +stop_option='nsteps' \ +iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/arm0795v1.2.nc' \ +ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ +mfilt=1400 \ +nhtfrq=1/" + +build-namelist script params for the Gate IOP + +build-namelist -namelist \ +"&camexp \ +mss_irt=0 \ +scmlat=9. \ +scmlon=336. \ +start_ymd=19740830 \ +start_tod=0 \ +stop_n=1440 \ +stop_option='nsteps' \ +iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/gate0874v1.2.nc' \ +ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ +mfilt=1500 \ +nhtfrq=1/" + +build-namelist script params for GCSS IOP + +build-namelist -namelist \ +"&camexp \ +mss_irt=0 \ +scmlat=-2. \ +scmlon=155. \ +start_ymd=19921220 \ +start_tod=0 \ +stop_n=505 \ +stop_option='nsteps' \ +iopfile='/fs/cgd/csm/inputdata/atm/cam/scam/iop/gcss1292v1.2.nc' \ +ncdata ='/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' \ +mfilt=1500 \ +nhtfrq=1/" + + + In addition to the standard IOP datasets the single column version + of CAM may be forced with an intial condition file and a "pseudo + IOP" history file generated from a previous global CAM run. This + mode is useful for getting a feel for how new physics modules + behave given forcing from an actual CAM run. To generate an + initial condition and IOP style forcing data from a standard cam + run configure the model using the new -camiop option of the + configure script. The build-namelist script has been modified to + generate a namelist which will create an initial condition for a + scm model run as well as an auxillary history tape containing the + IOP fields needed to drive a single column version of CAM. Both + the initial conditions file and the IOP forcing history tape are 3 + dimensional. When running with these datasets in SCM mode the + user can choose which column will be used via the namelist + parameters scmlat and scmlon. + + The relavent namelist parameters for generating an CAMIOP are + + fincl2 = 'Ps','u','v','t','q','omega','phis','Prec','lhflx','shflx',\ + 'Tsair','Tg','divq3d','divT3d','dcldice','dcldliq','beta',\ + 'fixmas','afixq','afixcldl','afixcldi','dqfxq','dqfxcldl',\ + 'dqfxcldi','CLAT','T','Q' + inithist = 'CAMIOP' + mfilt = 1,10 + nhtfrq = 0,1 + + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: Added -scam and -camiop options + to configure script. The -scam option will configure cam for + single column mode. The -camiop option will configure cam to produce + an iop initial condition file and a boundary forcing history tape + to be used in single column mode. + +Describe any changes made to the namelist: Added namelist parameters for + single column mode. Since all surface models need single column + control information the following namelist variables were added + to ccsm_inparm + + ! enable single_column mode + logical :: single_column ! default false set to true to + ! enable single column mode + + ! single column longitude + real(r8) :: scmlon ! longitude setting used by cam in + ! scm mode + ! single column latitude + real(r8) :: scmlat ! latitude setting used by cam in + ! scm mode + + The following namelist variable was added to the cam_inparm namelist + + ! iop boundary file + integer, parameter :: max_chars = 128 + character(len=max_chars) iopfile !IOP Boundary condition file + + + Added the CAMIOP option to the inithist namelist variable. This + option will produce an initial condition for use with a cam + generated iop forcing history tape. + + ! inithist Generate initial dataset as auxillary history file + ! can be set to '6-HOURLY', 'DAILY', 'MONTHLY', + ! 'YEARLY', 'CAMIOP', or 'NONE'. + ! default: 'YEARLY' + + +List any changes to the defaults for the boundary datasets: + Added a namelist option to specify an IOP file for SCM mode. + +Describe any substantial timing or memory changes: + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: + + configuration/namelist/script files for testing of scm cam mode: + + models/atm/cam/test/system/config_files/scm64bfbiop + models/atm/cam/test/system/config_files/e64bfbiop + models/atm/cam/test/system/nl_files/scm_prep + models/atm/cam/test/system/nl_files/scm_b4b_o1 + models/atm/cam/test/system/TSC.sh + + Files adding scm capability to cam: + models/atm/cam/src/control/scamMod.F90 + models/atm/cam/src/control/getnetcdfdata.F90 + models/atm/cam/src/dynamics/eul/forecast.F90 + models/atm/cam/src/dynamics/eul/getinterpnetcdfdata.F90 + models/lnd/clm2/src/main/getnetcdfdata.F90 + +List all existing files that have been modified, and describe the changes: +The majority of the modifications had to do with removing the +#define SCAM sections of code. There is still some duplication of +functionality that will be cleaned up in future commits (reading of +netcdf data). The pieces of independent single column mode code +are delineated now by a run time 'if (single_column)' test. The single_column +logical is defined in the ccsm_inparm namelist and is available to all component +models. Files in the test and bld subdirectories were modified to allow +bit for bit testing of scam against a control run of the 3d model as well +as adding functionality to the build-namelist and configure scripts to make +running in single column mode easier. + + models/ocn/dom/sst_data.F90 + models/ice/csim4/ice_data.F90 + models/atm/cam/test/system/tests_pretag_bangkok + models/atm/cam/test/system/TPF.sh + + TPF.sh: the script for testing performance problems was modified to + reflect the move to a single timing file introduced in cam3_3_42 + + models/atm/cam/test/system/tests_pretag_bluevista + models/atm/cam/test/system/nl_files/scm_prep + models/atm/cam/test/system/nl_files/scm_b4b_o1 + models/atm/cam/test/system/input_tests_master + models/atm/cam/test/system/TSC.sh + models/atm/cam/test/system/TCT.sh + + TCT.sh: all ccsm tests through cam's test suite will now use the + csm_share and clm code from the cam sandboxes rather than that + from the latest ccsm tag (up to now it used just the cam code) + + models/atm/cam/test/system/tests_posttag_lightning + models/atm/cam/bld/configure + models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + models/atm/cam/bld/cam_inparm.pm + models/atm/cam/bld/NamelistsDescriptions.xml + models/atm/cam/bld/resolution_parameters.xml + models/atm/cam/bld/CAM_config.pm + models/atm/cam/bld/ccsm_inparm.pm + models/atm/cam/src/control/readinitial.F90 + models/atm/cam/src/control/history_defaults.F90 + models/atm/cam/src/control/runtime_opts.F90 + models/atm/cam/src/control/ncdio_atm.F90 + models/atm/cam/src/control/rgrid.F90 + models/atm/cam/src/control/interpolate_data.F90 + models/atm/cam/src/control/con_cam.F90 + models/atm/cam/src/control/atm_comp_mct.F90 + models/atm/cam/src/control/startup_initialconds.F90 + models/atm/cam/src/control/history_scam.F90 + models/atm/cam/src/control/cam_comp.F90 + models/atm/cam/src/control/cam_history.F90 + models/atm/cam/src/physics/cam1/initindx.F90 + models/atm/cam/src/physics/cam1/radiation.F90 + models/atm/cam/src/physics/cam1/radsw.F90 + models/atm/cam/src/physics/cam1/cam_diagnostics.F90 + models/atm/cam/src/physics/cam1/physics_types.F90 + models/atm/cam/src/physics/cam1/radlw.F90 + models/atm/cam/src/physics/cam1/physpkg.F90 + models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 + models/atm/cam/src/physics/cam1/aerosol_index.F90 + models/atm/cam/src/physics/cam1/gw_drag.F90 + models/atm/cam/src/chemistry/trop_mozart/mz_aerosols_intr.F90 + models/atm/cam/src/dynamics/sld/dyn_comp.F90 + models/atm/cam/src/dynamics/eul/sphdep.F90 + models/atm/cam/src/dynamics/eul/initcom.F90 + models/atm/cam/src/dynamics/eul/scanslt.F90 + models/atm/cam/src/dynamics/eul/inidat.F90 + models/atm/cam/src/dynamics/eul/getinterpnetcdfdata.F90 + models/atm/cam/src/dynamics/eul/inital.F90 + models/atm/cam/src/dynamics/eul/dycore.F90 + models/atm/cam/src/dynamics/eul/iop.F90 + models/atm/cam/src/dynamics/eul/dynpkg.F90 + models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 + models/atm/cam/src/dynamics/eul/scan2.F90 + models/atm/cam/src/dynamics/eul/stepon.F90 + models/atm/cam/src/dynamics/eul/restart_dynamics.F90 + models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 + models/SVN_EXTERNAL_DIRECTORIES + models/drv/seq_mct_drv/seq_ccsm_drv.F90 + models/drv/seq_mct/mrg_x2a_mct.F90 + models/csm_share/shr/shr_inputinfo_mod.F90 + models/lnd/clm2/src/main/inicFileMod.F90 + models/lnd/clm2/src/main/driver.F90 + models/lnd/clm2/src/main/ncdio.F90 + models/lnd/clm2/src/main/initializeMod.F90 + models/lnd/clm2/src/main/iniTimeConst.F90 + models/lnd/clm2/src/main/restFileMod.F90 + models/lnd/clm2/src/main/controlMod.F90 + models/lnd/clm2/src/main/lnd_comp_mct.F90 + models/lnd/clm2/src/main/surfrdMod.F90 + models/lnd/clm2/src/biogeochem/STATICEcosysDynMod.F90 + models/lnd/clm2/src//main/clm_varctl.F90 + + The following files were deleted. As stated above + the GUI version of SCAM is being refactored. An + impoved GUI will be added in the future. + + scam + scam/configure + scam/crm + scam/GNUmakefile + scam/.scam_defaults + scam/README + scam/tools + scam/tools/sdev + scam/tools/sdev/sdev + scam/tools/sdev/sdev.C + scam/tools/sdev/Makefile + scam/tools/sdev/README + scam/tools/ncmult + scam/tools/ncmult/ncmult.C + scam/tools/ncmult/Makefile + scam/tools/ncmult/README + scam/tools/nctrans + scam/tools/nctrans/nctrans + scam/tools/nctrans/nctrans.C + scam/tools/nctrans/Makefile + scam/tools/nctrans/README + scam/tools/diurnal_ave + scam/tools/diurnal_ave/diurnal_ave + scam/tools/diurnal_ave/diurnal_ave.C + scam/tools/diurnal_ave/Makefile + scam/tools/diurnal_ave/README + scam/tools/intercomparison-post-processing + scam/tools/intercomparison-post-processing/ncfile.C + scam/tools/intercomparison-post-processing/field.C + scam/tools/intercomparison-post-processing/post + scam/tools/intercomparison-post-processing/ncfile.H + scam/tools/intercomparison-post-processing/post.C + scam/tools/intercomparison-post-processing/field.H + scam/tools/intercomparison-post-processing/intercompare.scm + scam/tools/intercomparison-post-processing/Makefile + scam/tools/intercomparison-post-processing/process + scam/tools/ncadd + scam/tools/ncadd/ncadd + scam/tools/ncadd/ncadd.C + scam/tools/ncadd/Makefile + scam/tools/ncadd/README + scam/tools/pdf + scam/tools/pdf/ferret.jnl + scam/tools/pdf/pdf + scam/tools/pdf/pdf.C + scam/tools/pdf/Makefile + scam/tools/pdf/README + scam/tools/ccm2iop + scam/tools/ccm2iop/ncfile.C + scam/tools/ccm2iop/ncfile.cpp + scam/tools/ccm2iop/ioerr.h + scam/tools/ccm2iop/ncfile.h + scam/tools/ccm2iop/Makefile + scam/tools/ccm2iop/ccm2iop.C + scam/tools/ccm2iop/test.nc + scam/getlatlon.pl + scam/testscript + scam/html + scam/html/userguide.html + scam/html/tdiff-cam2.gif + scam/html/gif + scam/html/gif/tdiff-cam2.gif + scam/html/gif/plot.gif + scam/html/gif/tdiff3.2.gif + scam/html/gif/tdiff3.6.gif + scam/html/gif/post.gif + scam/html/gif/formula1.gif + scam/html/gif/formula2.gif + scam/html/gif/iop.gif + scam/html/gif/formula3.gif + scam/html/gif/formula4.gif + scam/html/gif/qdiff.gif + scam/html/gif/formula5.gif + scam/html/gif/formula6.gif + scam/html/gif/tdiff.gif + scam/html/gif/mainwnd.gif + scam/html/gif/qls.gif + scam/html/gif/global.gif + scam/html/gif/sls.gif + scam/html/gif/mainwin.gif + scam/html/gif/uls.gif + scam/html/gif/vls.gif + scam/html/gif/w.gif + scam/html/gif/option.gif + scam/html/gif/g2.gif + scam/html/gif/uphys.gif + scam/html/gif/selectdata.gif + scam/html/gif/vphys.gif + scam/html/tdiff3.6.gif + scam/html/index.html + scam/scm_init + scam/scm_init/init_model.F90 + scam/scm_init/misc.h + scam/scm_init/scam_srfdata.F90 + scam/scm_init/drand48_.c + scam/scm_init/get_levels.F90 + scam/scm_init/scam_srfdata_MCT.F90 + scam/scm_init/runtype.h + scam/scm_init/scam_rpc.x + scam/scm_init/calcdate.F90 + scam/scm_init/comfrc.h + scam/scm_init/fortran.h + scam/scm_init/ipc.h + scam/scm_init/setlatlon.F90 + scam/scm_init/forecast.F90 + scam/scm_init/scam_run.F90 + scam/scm_init/myhandler.F + scam/scm_init/realtype.h + scam/scm_init/inital.F90 + scam/scm_init/readpressdata.F90 + scam/scm_init/c_outfld.c + scam/scm_init/scamMod.F90 + scam/scm_init/c_outfld.h + scam/scm_init/interplevs.F90 + scam/scm_init/getnetcdfdata.F90 + scam/scm_init/preproc.h + scam/scm_init/setiopupdate.F90 + scam/scm_init/scam.c + scam/scm_init/scam_fifo.c + scam/scm_init/getinterpncdata.F90 + scam/scm_init/readiopdata.F90 + scam/scm_init/readsaveinit.F90 + scam/scm_init/max.h + scam/scm_init/scam_fifo.h + scam/INSTALL + scam/mymods + scam/mymods/README + scam/userdata + scam/userdata/crmtest18.in + scam/userdata/crmtest26.out + scam/userdata/crmdarwintest26.out + scam/userdata/crmtest200.in + scam/userdata/README + scam/userdata/crmtest26.in + scam/data + scam/data/README + scam/obj + scam/obj/makdep.linux + scam/obj/makdep + scam/obj/Makefile + scam/ui + scam/ui/timeconvert.cpp + scam/ui/PostPlottingDlg.h + scam/ui/OptionsDlg.ui.h + scam/ui/LoadData.ui + scam/ui/utils.h + scam/ui/history.h + scam/ui/IOPSelectDateDlg.ui + scam/ui/PlistDlgImpl.h + scam/ui/rpcmodel.h + scam/ui/defaults.h + scam/ui/map.cpp + scam/ui/PlistDlg.ui + scam/ui/datasetselector.cw + scam/ui/plot.cpp + scam/ui/manager.h + scam/ui/map.xbm + scam/ui/msgdlg.h + scam/ui/field.cpp + scam/ui/globalmap.cw + scam/ui/crm.h + scam/ui/fieldlistbox.cpp + scam/ui/dataset.h + scam/ui/Platform.Notes + scam/ui/ncarg.cpp + scam/ui/observer.h + scam/ui/IOPSelectDateDlg.ui.h + scam/ui/PostPlottingDlg.cpp + scam/ui/IOPSelectDateDlgImpl.cpp + scam/ui/ncfile.cpp + scam/ui/PlotDlg.ui + scam/ui/LoadDataImpl.h + scam/ui/history.cpp + scam/ui/ascii_dataset.h + scam/ui/globalmap.h + scam/ui/fifomodel.cpp + scam/ui/rpcmodel.cpp + scam/ui/plot.cw + scam/ui/GNUmakefile + scam/ui/defaults.cpp + scam/ui/ncarg + scam/ui/ncarg/c.h + scam/ui/SelectGlobalDataDlg.ui + scam/ui/msgdlg.cpp + scam/ui/sicfile.cpp + scam/ui/list.h + scam/ui/crm.cpp + scam/ui/dbgmodel.h + scam/ui/plot.h + scam/ui/PostPlottingDlgImpl.h + scam/ui/dataset.cpp + scam/ui/MainWnd.ui + scam/ui/world.xbm + scam/ui/LoadDataImpl.cpp + scam/ui/PlotDlgImpl.h + scam/ui/fieldlistbox.h + scam/ui/ncarg.h + scam/ui/model.cpp + scam/ui/configure + scam/ui/IOPSelectDateDlgImpl.h + scam/ui/map.cw + scam/ui/OptionsDlgImpl.cpp + scam/ui/ChangeAxisScaleDlg.ui + scam/ui/ncfile.h + scam/ui/SelectGlobalDataDlgImpl.h + scam/ui/fifomodel.h + scam/ui/ncarg_stubs.cpp + scam/ui/fieldplotwidget.cw + scam/ui/dbgmodel.cpp + scam/ui/PostPlottingDlgImpl.cpp + scam/ui/fortran.h + scam/ui/numlined.h + scam/ui/sicfile.h + scam/ui/images + scam/ui/images/editcopy + scam/ui/images/editcut + scam/ui/images/fileopen + scam/ui/images/editpaste + scam/ui/images/textbold + scam/ui/images/undo + scam/ui/images/searchfind + scam/ui/images/filenew + scam/ui/images/redo + scam/ui/images/print + scam/ui/images/filesave + scam/ui/main.cpp + scam/ui/MainWndImpl.h + scam/ui/ioerr.h + scam/ui/PlotDlgImpl.cpp + scam/ui/ld.man + scam/ui/ChangeAxisScaleDlgImpl.h + scam/ui/utils.cpp + scam/ui/SelectGlobalDataDlgImpl.cpp + scam/ui/configure.works + scam/ui/PlistDlgImpl.cpp + scam/ui/timeconvert.h + scam/ui/model.h + scam/ui/OptionsDlgImpl.h + scam/ui/manager.cpp + scam/ui/OptionsDlg.ui + scam/ui/fieldlistbox.cw + scam/ui/MainWndImpl.cpp + scam/ui/c.h + scam/ui/field.h + scam/ui/sst + scam/ui/max.h + scam/ui/ChangeAxisScaleDlgImpl.cpp + +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. + +bluevista: + +The following test failed as part of the cam3_3_42 commit and also fail as part +of this commit. + +038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 +039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 + + All ccsm tests through cam's test suite will now use the + csm_share and clm code from the cam sandboxes rather than that + from the latest ccsm tag (up to now it used just the cam code) + + +tempest: + +bangkok/lf95: + +CAM tag used for the baseline comparison tests if different than previous +tag:cam3_3_42 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + NONE + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + + NA + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + + NA + +MSS location of control simulations used to validate new climate: + + NA + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +Tag name: cam3_3_42 +Originator(s): Patrick Worley +Date: 24 Nov 2006 +One-line Summary: refactored timer instrumentation and support for single timing output file + +Purpose of changes: + + To update timing instrumentation to reflect recent model changes, + and to improve 'coverage' by adding timers for all top level events. + + To improve usability on large numbers of processes by decreasing number + of process count-dependent files and lines of output: + - added option to generate single timing and spmdstats files + (containing all of the information that had been spread between + multiple files before) + - added option to restrict reporting of many runtime options and + memory usage statistics to process 0 + These new options are enabled by default + +Bugs fixed (include bugzilla ID): + 'debugging' shr_sys_flush call in seq_domain_mct.F90 erroneously left in + during earlier check-in caused error on Cray X1E + +Describe any changes made to build system: + Added new CPP flags: + - MULTIPLE_PERF_FILES: if defined, timing and output files will be + created for each process (the previous default) + - WRAP_MPI_TIMING: if defined, timing events are defined for each MPI + call in wrap_mpi.F90 (the previous default) + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: Patrick Worley + +List all subroutines eliminated: + +List all subroutines added and what they do: + t_pr_onef in utils/timing/f_wrappers.c: + variant of t_prf that write all timing data in one file + t_enablef in utils/timing/f_wrappers.c, + GPTL_enable in utils/timing/gptl.c: + runtime timing routine enabler + t_disablef in utils/timing/f_wrappers.c, + GPTL_disable in utils/timing/gptl.c: + runtime timing routine disabler + +List all existing files that have been modified, and describe the changes: + + SVN_EXTERNAL_DIRECTORIES + using clm3_expa_79 + + utils/SVN_EXTERNAL_DIRECTORIES + using timing_061124 + + atm/cam/src/control/atm_comp_mct.F90 + atm/cam/src/control/cam_comp.F90 + atm/cam/src/control/wrap_mpi.F90 + atm/cam/src/dynamics/eul/dp_coupling.F90 + atm/cam/src/dynamics/eul/dyndrv.F90 + atm/cam/src/dynamics/eul/dynpkg.F90 + atm/cam/src/dynamics/eul/scan2.F90 + atm/cam/src/dynamics/eul/scandyn.F90 + atm/cam/src/dynamics/eul/scanslt.F90 + atm/cam/src/dynamics/eul/stepon.F90 + atm/cam/src/dynamics/fv/cd_core.F90 + atm/cam/src/dynamics/fv/dp_coupling.F90 + atm/cam/src/dynamics/fv/dyn_comp.F90 + atm/cam/src/dynamics/fv/mapz_module.F90 + atm/cam/src/dynamics/fv/stepon.F90 + atm/cam/src/dynamics/fv/trac2d.F90 + atm/cam/src/dynamics/sld/dp_coupling.F90 + atm/cam/src/dynamics/sld/dyndrv.F90 + atm/cam/src/dynamics/sld/dynpkg.F90 + atm/cam/src/dynamics/sld/scan2.F90 + atm/cam/src/dynamics/sld/scandyn.F90 + atm/cam/src/dynamics/sld/scanslt.F90 + atm/cam/src/dynamics/sld/stepon.F90 + atm/cam/src/physics/cam1/convect_deep.F90 + atm/cam/src/physics/cam1/convect_shallow.F90 + atm/cam/src/physics/cam1/diffusion_solver.F90 + atm/cam/src/physics/cam1/physpkg.F90 + atm/cam/src/physics/cam1/radiation.F90 + atm/cam/src/physics/cam1/tphysac.F90 + atm/cam/src/physics/cam1/tphysbc.F90 + atm/cam/src/physics/cam1/vertical_diffusion.F90 + atm/cam/src/physics/cam1/zm_conv.F90 + drv/seq_mct_drv/seq_ccsm_drv.F90 + ice/csim4/ice_comp.F9 + ice/csim4/ice_comp_mct.F90 + ice/csim4/ice_srf.F90 + lnd/clm2/src/main/clm_comp.F90 + lnd/clm2/src/main/driver.F90 + lnd/clm2/src/main/lnd_comp_mct.F90 + ocn/dom/ocn_comp.F90 + ocn/dom/ocn_comp_mct.F90 + ocn/som/ocn_comp.F90 + ocn/som/ocn_comp_mct.F90 + modified performance timer logic + + atm/cam/src/control/cam_comp.F90 + single spmdstats output file option + + atm/cam/src/control/cam_history.F90 + process 0-only reporting (eliminating unnecessary output) + + atm/cam/src/control/print_memusage.F90 + process 0-only reporting memory usage. Old default restored + by defining DEBUG. + + atm/cam/src/dynamics/eul/spmd_dyn.F90 + atm/cam/src/dynamics/sld/spmd_dyn.F90 + process 0-only reporting of SPMD buffer allocation. + + atm/cam/src/physics/cam1/chem_surfvals.F90 + atm/cam/src/physics/cam1/prescribed_aerosols.F90 + process 0-only reporting of runtime options + + drv/seq_mct/seq_domain_mct.F90 + deleted 'call shr_sys_flush(25+iam)' + + drv/seq_mct_drv/seq_ccsm_drv.F90 + disabled CATAMOUNT-specific call to usetlbuf; I/O buffering is now + the system default, and usetlbuf is unecessary + added option to create a single timing output file + + lnd/clm2/src/main/restFileMod.F90 + (ask T. Craig or M. Vertenstein) + + utils/timing/f_wrappers.c + added t_pr_onef, t_enablef, t_disablef + + utils/timing/gptl.c + utils/timing/gptl.h + added GPTL_enable, GPTL_disable + modified GPTLpr to create either one timer output file, + or one file per process + process 0-only reporting timing options. Old default restored + by defining DEBUG. + + utils/timing/gptl_papi.c + modified error message (mod. from J. Edwards) + + utils/timing/private.h + increased timing event name length + +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. + +bluevista: All PASSED + +tempest: All PASSED + +bangkok/lf95: All PASSED + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +Tag name: cam3_3_41 +Originator(s): Francis Vitt +Date: 15 Nov 2006 +One-line Summary: Added functionality and flexibility to the trop_mozart chemistry. + +Purpose of changes: + + To implement flexibility in the chemical mechanism used in trop_mozart + chemistry package. This flexibility is provided + via: + - flexible namelist variables + - helper functions which use data provided by the chemical preprocessor + + Use cam implemented prognostic sea salt and dust with the trop_mozart + chemistry package. + + Use cam implemented rain out of trop_mozart aerosols. + + Provide the ability to use cam sulfur chemistry routines with trop_mozart + chemistry package. + + Provide the ability to use prescribed chemical constituents and sources + in trop_mozart chemistry package. + + Fix bug in the offline driver on bluevista. + +Bugs fixed (include bugzilla ID): + #239 fv offline driver fails in cam on bluevista + +Describe any changes made to build system: + +Describe any changes made to the namelist: + + Added several namelist variables for trop_mozart chemistry package + for the flexable chemical mechanism implementation. These are: + + ! trop_mozart surface emissions: + character(len=256) :: srf_emis_specifier(pcnst) ! string array where each + ! string contains the constituent name and filepath separated by "->", e.g. + ! srf_emis_specifier = 'CO -> /path/CO_emis_file.nc','NO -> /path/NO_emis_file.nc',... + character(len=8) :: emis_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' + integer :: emis_date ! yyyymmdd for SERIAL(yyyy) or FIXED + integer :: emis_yr_offset ! yrs added to current model year for CYCLICAL + + ! trop_mozart chem sources(sinks): + character(len=256) :: ext_frc_specifier(pcnst) ! string array where each + ! string contains the constituent name and filepath separated by "->", e.g. + ! ext_frc_specifier = 'CO -> /path/CO_extfrc_file.nc','NO -> /path/NO_extfrc_file.nc',... + character(len=8) :: ext_frc_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' + integer :: ext_frc_date ! yyyymmdd for SERIAL(yyyy) or FIXED + integer :: ext_frc_yr_offset ! yrs added to current model year for CYCLICAL + + ! trop_mozart fixed lower boundary: + character(len=16) :: flbc_list(pcnst) ! list of constituents + character(len=256) :: flbc_file ! lower boundary data file + character(len=8) :: flbc_type ! 'CYCLICAL' | 'SERIAL' | 'FIXED' + integer :: flbc_date ! yyyymmdd for SERIAL(yyyy) or FIXED + integer :: flbc_yr_offset ! yrs added to current yr for CYCLICAL + + ! trop_mozart constituents that have dry deposition + character(len=16) :: drydep_list(pcnst) + + ! trop_mozart constituents that are constrained in the stratosphere + character(len=16) :: fstrat_list(pcnst) ! list of constituents + character(len=256) :: fstrat_file ! data file for fixed stratosphere constituents + character(len=256) :: trop_pause_file + + ! trop_mozart aerosol constituents that have wet deposition + character(len=16) :: aer_wetdep_list(pcnst) + + ! trop_mozart use CAM sulfur chemistry driver rather than mo_setsox + logical :: use_cam_sulfchem + ! trop_mozart use CAM prescribed ozone for radiation rather than trop_moz prescribed data + logical :: use_cam_ozone_data + ! trop_mozart use CAM prescribed green house gases for radiation rather than trop_moz prescribed data + logical :: use_cam_ghg_data + + ! trop_mozart prescribed constituents + character(len=256) :: tracer_cnst_file ! prescribed data file + character(len=256) :: tracer_cnst_filelist ! list of prescribed data files (series of files) + character(len=256) :: tracer_cnst_specifier(pcnst) ! string array where each + ! string contains the prescribed constituent name and field name in the data file separated by ":", e.g. + ! ext_frc_specifier = 'CO : CO_VMR','OH : OH_VMR',... + logical :: tracer_cnst_rmfile ! remove data file from local disk (default .false.) + integer :: tracer_cnst_ymd ! yyyymmdd - start date of the prescribed data (default is current model date) + integer :: tracer_cnst_tod ! start time of day (seconds) of the prescribed data (default is current model time) + + ! trop_mozart prescribed constituent sourrces/sinks + character(len=256) :: tracer_srcs_file ! prescribed data file + character(len=256) :: tracer_srcs_filelist ! list of prescribed data files (series of files) + character(len=256) :: tracer_srcs_specifier(pcnst) ! string array where each + ! string contains the constituent source name and field name in the data file separated by ":", e.g. + ! ext_frc_specifier = 'CO : CO_SRC','OH : OH_SRC',... + logical :: tracer_srcs_rmfile ! remove data file from local disk (default .false.) + integer :: tracer_srcs_ymd ! yyyymmdd - start date of the prescribed data (default is current model date) + integer :: tracer_srcs_tod ! start time of day (seconds) of the prescribed data (default is current model time) + + Replaced the namelist variables for the individual species emissions + files with the srf_emis_specifier variable. + + Replaced trop_mozart ub and lb variables for individual species with + corresponding specifier variables as described above. + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: + + atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 + atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 + atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 + atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 + +List all subroutines added and what they do: + + atm/cam/src/chemistry/trop_mozart/mo_chem_utls.F90 + provides helper functons to allow easier changes in chemical mechanisms + + atm/cam/src/chemistry/trop_mozart/mo_extfrc.F90 + provides the ability to include external (or prescribed) sources (or sinks) + + atm/cam/src/chemistry/trop_mozart/mo_flbc.F90 + applies fixed lower boundary conditions to constituents + + atm/cam/src/chemistry/trop_mozart/mo_fstrat.F90 + applies constraints to constituents in the stratosphere + + atm/cam/src/chemistry/trop_mozart/mo_sethet.F90 + replaces mo_wetdep module -- set heterogeneous reaction rates + + atm/cam/src/chemistry/trop_mozart/mo_synoz.F90 + implements synthetic ozone scheme in the stratosphere + + atm/cam/src/chemistry/trop_mozart/mz_aerosols_intr.F90 + handles the wet depostion of trop_mozart aerososl as well as the + operation of cam implemented sulfur chemistry routines on trop_mozart + constituents + + atm/cam/src/chemistry/trop_mozart/tracer_cnst.F90 + atm/cam/src/chemistry/trop_mozart/tracer_data.F90 + atm/cam/src/chemistry/trop_mozart/tracer_srcs.F90 + These provide the ability to use prescribed constituents as well as + sources for the trop_mozart chemical mechanism. + + atm/cam/src/chemistry/trop_mozart/rad_cnst_data_interface.F90 + Overrides the cam routines that set radiative constituents to prescribed + data to use trop_mozart prescribed data. + + atm/cam/src/physics/cam1/rad_cnst_data_interface.F90 + provides the chemistry packages the opportunity to override procedures + that set the radiative constituents from prescribed data + + atm/cam/src/dynamics/fv/advect_tend.F90 + Handles the computation and history output of advection tendency. + +List all existing files that have been modified, and describe the changes: + + atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + Change defualt upper boundary data files and dust input files. + + atm/cam/bld/cam_inparm.pm + Made changes to accommodate the namelist changes for the trop_mozart + chemistry package. + Set default aero_feedback=.false. since a special aerosol optics + file is required for dust. + + atm/cam/bld/config_trop_chem_mozart_defaults.xml + set prog_aero="dust,seasalt" and nadv=98 for default trop_mozart chemistry + + atm/cam/bld/configure + - allow prog_aero seasalt without dust for trop_mozart chemistry + - set cppdef DUST for seasalt or dust when trop_mozart is used + - disallow prog_aero sulfur and caer (carbon aerosols) when + trop_mozart is used + + atm/cam/src/chemistry/trop_mozart/chem_mods.F90 + atm/cam/src/chemistry/trop_mozart/chemistry.F90 + atm/cam/src/chemistry/trop_mozart/m_het_id.F90 + atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 + atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 + atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 + atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 + atm/cam/src/chemistry/trop_mozart/mo_constants.F90 + atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + atm/cam/src/chemistry/trop_mozart/mo_exp_sol.F90 + atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 + atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 + atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 + atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 + atm/cam/src/chemistry/trop_mozart/mo_jshort.F90 + atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 + atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 + atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 + atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 + atm/cam/src/chemistry/trop_mozart/mo_mass_xforms.F90 + atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 + atm/cam/src/chemistry/trop_mozart/mo_photo.F90 + atm/cam/src/chemistry/trop_mozart/mo_photoin.F90 + atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 + atm/cam/src/chemistry/trop_mozart/mo_rtlink.F90 + atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 + atm/cam/src/chemistry/trop_mozart/mo_setaer.F90 + atm/cam/src/chemistry/trop_mozart/mo_setext.F90 + atm/cam/src/chemistry/trop_mozart/mo_setinv.F90 + atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 + atm/cam/src/chemistry/trop_mozart/mo_setsoa.F90 + atm/cam/src/chemistry/trop_mozart/mo_setsox.F90 + atm/cam/src/chemistry/trop_mozart/mo_sim_dat.F90 + atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 + atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 + atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 + atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 + Changes in the trop_mozart chemistry are mostly for: + - the addition to SYNOZ/O3RAD ozone formulation and NH4/H2SO4 chemistry + - flexible namelist variables + - addition of helper functions to allow flexibility in terms of + chemical mechanisms facilitated by the chemical preprocessor + + atm/cam/src/chemistry/waccm_mozart/chemistry.F90 + interface changes that correspond to the interface changes of + trop_mozart/chemistry.F90 + + atm/cam/src/control/atm_comp_mct.F90 + Added a check to insure that dust constituents are in the + simulation before setting the dust surface fluxes. + + atm/cam/src/control/runtime_opts.F90 + Added several namelist variables for trop_mozart chemistry package + for the flexible chemical mechanism implementation (see above). + Added a check to not allow trace_gas = .true. when trop_mozart + chemistry package is used. + + atm/cam/src/dynamics/fv/dyn_comp.F90 + Changed the actual argument "dyn_state%grid" to "grid" to + subroutines metdata_dyn_init, get_met_fields and adjust_press. + + atm/cam/src/dynamics/fv/metdata.F90 + Removed the unnecessary ghosting of US and VS in the get_us_vs + subroutine. + + atm/cam/src/dynamics/fv/stepon.F90 + Added calls to compute and output advection tendencies. + + atm/cam/src/physics/cam1/aerosol_intr.F90 + Moved the call to hub2atm_sepopts to aerosol_register_cnst + from the dust_intr module -- this is to allow one to have + sea salt constituents without dust constituents. + Disabled the register call for dust and sea salts when + trop_mozart chemistry package is used. + Added the invocation of wet deposition of trop_mozart aerosols. + + atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 + added optical depth history outputs of carbon and dust + + atm/cam/src/physics/cam1/chemistry.F90 + interface changes that correspond to the interface changes of + trop_mozart/chemistry.F90 + + atm/cam/src/physics/cam1/convect_deep.F90 + add prognostics outputs of convective mass fluxes + + atm/cam/src/physics/cam1/drydep_mod.F90 + don't allow surface friction velocity returned from calcram + to be equal to zero -- zero fv causes a float point exception + in the dry deposition calculation of dust and sea salt + + atm/cam/src/physics/cam1/dust_intr.F90 + changes dust names + a lot of code cleanup + added the public interfaces: + dust_set_idx, dust_names, and dust_has_wet_dep + + atm/cam/src/physics/cam1/progseasalts_intr.F90 + changes sea salt names + a lot of code cleanup + added the public interfaces: + progseasalts_set_idx, progseasalt_names, and progseasalt_has_wet_dep + + atm/cam/src/physics/cam1/rad_constituents.F90 + added string variables to be used for radiative constituent names + + atm/cam/src/physics/cam1/radiation.F90 + replaced hard wired radiative constituent names with string + variables defined on the rad_constituents module + + atm/cam/src/physics/cam1/restart_physics.F90 + added a call to write and read chemistry data to restart file + + atm/cam/src/physics/cam1/sulchem.F90 + created a sulfur chemistry driver seperate from the wet deposition + -- this gives the trop_mozart chemistry the opportunity to use + the "cam" sulfur chemistry routines without the wet deposition. + + atm/cam/src/physics/cam1/sulfur_intr.F90 + moved some of the addfld calls to sulchem.F90 -- where the + fields are output to history + + atm/cam/src/physics/waccm/chemistry.F90 + interface changes that correspond to the interface changes of + trop_mozart/chemistry.F90 + + drv/seq_flds/dust/seq_flds_mod.F90 + corrected fortran syntax errors and made changes for ibm compile + +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. + +bluevista: + +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 5 +These failures are expected due to changes in trop_mozart chemistry package. + +tempest: All Pass + +bangkok/lf95: All Pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_40 +Originator(s): eaton +Date: Tue Nov 7 10:19:16 MST 2006 +One-line Summary: Misc updates + +Purpose of changes: + +. Replace all occurances of 273.16 either by SHR_CONST_TKFRZ or by tmelt + which is the CAM specific constant that's set to SHR_CONST_TKFRZ in the + physconst module. + +. Remove the cfort.h file -- put the Fortran name mangling CPP macro into + CAM and SCAM's configure. + +. Remove cfort.h from the timing library. This required creating a new + trunk_tag for the timing library (timing_061028) and updating CAM's + external property to use it. + +. Update MCT to trunk_tag MCT2_2_3_061018. + +. Update CLM to trunk_tag clm3_expa_76. + +. Remove excessive info/debug print statements (there is more to do). + +. Fix bug (introduced at cam3_3_34) to enable running w/ HOMME dycore. + + +Bugs fixed (include bugzilla ID): + +. bugID 224 -- fix for SHR_CONST_TKFRZ + +Describe any changes made to build system: none + +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: + +. possible performance improvements on certain platforms due to update of + MCT and CLM externals + +Code reviewed by: eaton + +List all subroutines eliminated: + + atm/cam/src/utils/cfort.h + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +. SHR_CONST_TKFRZ mods in: + models/atm/cam/src/physics/cam1/stratiform.F90 + models/atm/cam/src/physics/cam1/wetdep.F90 + models/atm/cam/src/physics/cam1/sulchem.F90 + models/atm/cam/src/physics/cam1/water_isotopes.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + +. mods to remove cfort.h in: + models/atm/cam/bld/configure + models/atm/cam/bld/Makefile.in + models/atm/cam/tools/scam/configure + models/atm/cam/src/control/get_memusage.c + models/atm/cam/src/control/linebuf_stdout.c + models/atm/cam/src/control/uselbuf.c + models/utils/timing/f_wrappers.c # create trunk_tag timing_061028 + +. update external for timing library, MCT, and CLM + models/SVN_EXTERNAL_DIRECTORIES + models/utils/SVN_EXTERNAL_DIRECTORIES + +. remove excessive info print statements + models/atm/cam/src/physics/cam1/phys_grid.F90 + models/atm/cam/src/control/cam_history.F90 + +. Replace deprecated float intrinsic by real + models/atm/cam/src/control/interpolate_data.F90 + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluevista: All PASS except expected failures of offline trop_mozart tests: + +038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 +039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: BFB + +=============================================================== +=============================================================== + +Tag name: cam3_3_39 +Originator(s): mvertens +Date: Fri Nov 3 16:40:37 MST 2006 +One-line Summary: Top level driver now invokes cam as one run phase + +Purpose of changes: To have CAM called as one run phase from the top level driver. +This is necessary if the surface components are to couple to cam at frequencies +other than the cam time step (a feature that will be required for a sequential CCSM). + +Bugs fixed (include bugzilla ID): #255 + +Describe any changes made to build system: None + +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: eaton + +List all subroutines eliminated: None + +List all subroutines added and what they do: None + +List all existing files that have been modified, and describe the changes: + M atm/cam/tools/scam/scm_init/init_model.F90 + M atm/cam/tools/scam/scm_init/scam_run.F90 + M atm/cam/src/control/atm_comp_mct.F90 + M drv/seq_mct_drv/seq_ccsm_drv.F90 + - Seq_ccsm_drv.F90 and scam_run.F90 will now call only one run phase of cam. + The basic idea is that the first time the cam run phase is called outside + of the time loop, it will only call tphysbc. Within the run loop the cam + mct levelrun phase will call tphysac, update the cam time and then call tphysbc. + + M drv/seq_mct/seq_domain_mct.F90 + - removed extra writes + + M drv/seq_mct/seq_flux_mct.F90 + - fixed bug #255 + + M drv/seq_flds/dust/seq_flds_mod.F90 + M drv/seq_flds/default/seq_flds_mod.F90 + M drv/seq_flds/gensom/seq_flds_mod.F90 + M drv/seq_flds_indices/seq_flds_indices.F90 + - Added Foxx_salt to drv->ocn fields + Note needed now, but will be needed when pop is used for active ocn + + M drv/seq_mct/mrg_x2o_mct.F90 + - Fixed bugs for fields needed in merging when active ocean will be + utilized + + M ice/csim4/ice_data.F90 + M ice/csim4/ice_dh.F + M ice/csim4/ice_srf.F90 + M ice/csim4/ice_comp.F90 + M atm/cam/src/control/runtime_opts.F90 + M atm/cam/src/control/cam_control_mod.F90 + - moved input namelist variables prognostic_icesnow and reset_csim_iceprops + from ice_dh to cam_control_mod.F90. This will make it possible to replace + cam-csim with cice4. + +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. + +bluevista: +019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 +- this test failed due to a sign change implemented for the latent/sensible + oi gensom fluxes (this was a bug introduced in cam3_3_37 that did not get picked + up in the testing. +038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 +039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 +- these tests began failing with the upgrade of the compilers on bluevista + around 060918...a retest of a previous tag (cam3_3_28) where these tests + had passed, showed these tests now fail as well...it fails run-time as it + tries to read in the met data...see bug #239 + +tempest: All tests passed except for +021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 +- this tested failed due to the same gensom bug fix as appeared in bluevista + test 19 + +bangkok/lf95: All tests passed + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: None, answers are bfb except for gensom oi diagnostics + +=============================================================== +=============================================================== + +Tag name: cam3_3_38 +Originator(s): mvr +Date: 20061027 +One-line Summary: mods to resolve naming conflict when cam is used in +a ccsm single-executable; bluevista replaces bluesky as required pretag +test platform; mods to conform to changes in ccsm's test scripts + +Purpose of changes: one more naming conflict in ccsm single-executable +that was overlooked; bluesky is scheduled for decommission by the end +of the year, so bluevista will now be the platform required for testing +cam prior to commits; ccsm changed its default behavior for cleanup +of files after successful tests - a change was made to specifically +turn off this cleanup and let cam's test scripts handle the cleanup + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: myself + +List all subroutines eliminated: +D models/atm/cam/src/control/restart.F90 +- just a rename required to clear up name conflict in ccsm single-executable + +List all subroutines added and what they do: +A + models/atm/cam/src/control/cam_restart.F90 +- newly named file and mods to clear up name conflict in ccsm single-executable +A models/atm/cam/test/system/tests_pretag_bluevista +- new file with test ids to run by default for pretag testing on bluevista + +List all existing files that have been modified, and describe the changes: +M models/ocn/dom/ocn_comp.F90 +M models/ocn/som/ocn_comp.F90 +M models/ice/csim4/ice_comp.F90 +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/cam_comp.F90 +M models/drv/seq_mct/mrg_x2a_mct.F90 +- files modified to reflect name change: restart -> cam_restart + +M ChangeLog_template +M models/atm/cam/test/system/TSB.ccsm.sh +M models/atm/cam/test/system/TCT.ccsm.sh +M models/atm/cam/test/system/tests_posttag_bluesky +M models/atm/cam/test/system/test_driver.sh +M models/atm/cam/test/system/tests_posttag_bluevista +- mods to test scripts to have bluevista replace bluesky as the required + platform for pretag testing, utilize mods in ccsm scripts for the bluevista16 + machine definition, and turned off ccsm's cleanup functionality + +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. + +bluevista: +038 sm355 TSM.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 8 +039 er355 TER.sh fmo2dh off2x2.5 4+5 ..............................FAIL! rc= 5 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 4 +- these tests began failing with the upgrade of the compilers on bluevista + around 060918...a retest of a previous tag (cam3_3_28) where these tests + had passed, showed these tests now fail as well...it fails run-time as it + tries to read in the met data...see bug #239 + +tempest: +all pass + +bangkok/lf95: +all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_37 +Originator(s): mvertens +Date: Tue Oct 24 22:58:04 MDT 2006 +One-line Summary: use cpl6 ocn/atm flux calculation and surface flux sign convention + +Purpose of changes: To bring the current sequential system in line with the + concurrent system atm/ocn flux calculation, ocn and ice and merge functionalities, + and ccsm surface flux sign convention. In addition, to remove the need for the ice + and ocean components to know pass any landfrac information to the top level driver. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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 (to the best of my knowledge) + +Code reviewed by: mvertens, rjacob, tcraig + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + M ocn/dom/ocn_comp.F90 + - Removed all references to lwup + M ocn/dom/ocn_comp_mct.F90 + - Removed latr and lonr from dom_o - conversion is now done in seq_flux_mct.F90 + - Removed o2x_o(index_o2x_Faoo_lwup,ig) - (now done in atm/ocn flux calc) + - Removed setting of maxfrac to 1.-landfrac in dom_o + + M ocn/som/ocn_types.F90 + - Removed lwup from ocn_out type + M ocn/som/ocn_comp.F90 + - Removed computation of lwup (now done in atm/ocn flux calc) + - Removed lwup from restart file + M ocn/som/ocn_comp_mct.F90 + - Removed latr and lonr from dom_o - conversion is now done in seq_flux_mct.F90 + - Removed o2x_o(index_o2x_Faoo_lwup,ig) - (now done in atm/ocn flux calc) + - Removed setting of maxfrac to 1.-landfrac in dom_o + - Set sign convention to fluxes are positive downwards + - Moved multiplication of fswabs, shflx, lhflx, lwdn and lwup by (1.-aice) + to mrg_x2o_mct.F90 (this is consistent now with ocn merging in cpl6) + + M ice/csim4/ice_types.F90 + - Made cflx component of ice_out one-dimensional + - Made qbot component of ice_in one-dimensional + - Removed reference to pcnst + M ice/csim4/ice_srf.F90 + - Fluxes are now positive downwards for lwup, shflx, lhflx, taux, tauy, qflx + - Removed setting of non-water constituent fluxes to zero + - Arguemnts qbot and qflx no longer depend on pcnst+pnats + M ice/csim4/ice_diagnostics.F + - Made qbot component of ice_in one-dimensional + M ice/csim4/ice_comp.F90 + - Sign convention for lwup is now that fluxes are positive downwards + - Removed references to aqua-planet + M ice/csim4/ice_comp_mct.F90 + - Removed i2x_i%rAttr(index_i2x_Si_aice,ig) and set i2x_i%rAttr(index_i2x_Si_ifrac,ig) + to now correspond to fraction of ice with respect to ocean part of gridcell + + M atm/cam/test/system/test_driver.sh + - Updates to lightning and bluevista tests + - Replaced x2a_a%rAttr(index_x2a_Faoo_lwup,n) with x2a_a%rAttr(index_x2a_Faox_lwup,n) + + M atm/cam/src/control/atm_comp_mct.F90 + - Sign convention is that all fluxes from driver are positive downwards + + M drv/seq_flds/dust/seq_flds_mod.F90 + M drv/seq_flds/default/seq_flds_mod.F90 + M drv/seq_flds/gensom/seq_flds_mod.F90 + M drv/seq_flds_indices/seq_flds_indices.F90 + - Added fields and indices to get closer to cpl_fields_mod. This involved adding: + 'So_u' ! velocity, zonal DEF + 'So_v' ! velocity, meridional DEF + 'So_s' ! salinity DEF + 'So_dhdx' ! surface slope, zonal DEF + 'So_dhdy' ! surface slope, meridional DEF + 'Si_ifrac' ! state: ice fraction wrt ocean DEF + 'Sa_pslv' ! state: sea level pressure DEF + 'Foxx_lwup' ! heat flux: long-wave up DEF + 'Foxx_prec' ! water flux: rain+snow DEF + 'Foxx_snow' ! water flux: snow DEF + 'Foxx_rain' ! water flux: rain DEF + 'Foxx_evap' ! water flux: evap DEF + 'Foxx_meltw' ! water flux: melt DEF + 'Forr_roff' ! water flux: runoff DEF + 'Faoo_lwup' ! shortwave: net absorbed DEF + 'Faox_lwup' ! upward longwave heat flux DEF + and removed Si_aice and changed the previous functionality of Si_ifrac + Some of the above fields are not currently used - but are place holders for + when the ccsm components will be put in. + + M atm/cam/tools/scam/scm_init/init_model.F90 + - Added domain information to mapping initialization + + M drv/seq_mct_drv/seq_ccsm_drv.F90 + - Added domain information to mapping initialization + + M drv/seq_mct/mrg_x2a_mct.F90 + - Replaced index_o2x_Faoo_lwup with index_xao_Faox_lwup + + M drv/seq_mct/mrg_x2o_mct.F90 + - Merging functionality for input to ocn component is now same as cpl6 + + M drv/seq_mct/seq_domain_mct.F90 + - maxfrac_o = 1.- maxfrac_l is set for points where maxfrac_l > 0 and + maxfrac_l < 1. The same is true for maxfrac_i. As a result, the ocean + and ice components need not know the land fraction in the gridcell. + Furthermore, the ice fraction need only be scaled as that relative to + the total gridcell for merging functionality from drv->atm. The ice fraction + is only needed relative to the ocean part of the gridcell for merging + functionality from drv->ocn. + + M drv/seq_mct/seq_flux_mct.F90 + - xao_o%rAttr(index_xao_Faox_lwup,n) is now used (instead of lwup + being calculated by the ocean components) + - flux_albo is not identical to cpl6 code + + M drv/seq_mct/flux_ao.F90 + - This code is now the same as the flux_atmOcn routine in the cpl6 flux_mod.F90. + Both this routine and flux_atmOcn will be migrated to a csm_share/shr/shr_flux_mod.F90 + code base in upcoming tags. + + M drv/seq_mct/seq_mct_mod.F90 + - Added use aliases for mct_aVectimport Rattr and mct_aVect_exportRattr + + M drv/seq_mct/map_atmice_mct.F90 + - Obtain maxfrac_ice on atmosphere decomp, needed for merging to atmosphere grid + when all components are on same grid and when partial land cover in ice gridcell. + - Added domain information to initialization phase + + M drv/seq_mct/map_atmlnd_mct.F90 + M drv/seq_mct/map_iceocn_mct.F90 + M drv/seq_mct/map_atmocn_mct.F90 + - Added domain information to initialization phases + + SVN_EXTERNALS has been updated to clm3_expa_75 + M lnd/clm2/src/main/clm_time_manager.F90 + - Removed write statement to fort.30 + M lnd/clm2/src/main/lnd_comp_mct.F90 + - Changed sign convention of fluxes sent to driver to be consistent + with those used by concurrent ccsm + +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. + +bluesky: all tests passed except for + + 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 + 019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 + 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 + 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 + 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 + 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 5 + + the above were bfb except for the TREFHT output (which is not totally different) + + 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + + the above represent round-off level diffs for som tests + +tempest: all tests passed except for + + 004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 + 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 + 021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 + 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 + 035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 + + the above were bfb except for the TREFHT output (which is not totally different) + + 007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 + + the above represent round-off level diffs for som tests + +bangkok/lf95: all tests passed except for + + 004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 + 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 + 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 + 032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 + + the above were bfb except for the TREFHT output (which is not totally different) + + 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 + 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 + 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + + the above represent round-off level diffs due to higher optimization levels + than the 9 timestep tests + + 008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 + 036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 + + the above represent round-off level diffs for som tests + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- nature of change (larger than roundoff but same climate) + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., + +- source tag (all code used must be in the repository): + cam3_3_37 +- platform/compilers: + ibm (bluesky) +- configure commandline: + configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 -gensom +- build-namelist command (or complete namelist): + &ccsm_inparm + case_name = 'cam3_3_34_nonbfb_fv4x5dom' + start_type = "startup" + / + &timemgr_inparm + atm_cpl_dt = 1800 + orb_iyear_ad = 1950 + restart_option= 'monthly' + start_ymd = 10101 + stop_n = 4000 + stop_option = 'ndays' + / + &cam_inparm + absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' + aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' + bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' + bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' + bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' + bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' + dtime = 1800 + ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0001-01-01_4x5_L26_c060608.nc' + / + &clm_inparm + dtime = 1800 + fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' + fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' + / + +MSS location of output: + /MVERTENS/csm/cam3_3_34_nonbfb_fv4x5dom + +MSS location of control simulations used to validate new climate: + /MVERTENS/csm/cam3_3_34_nonbfb_fv4x5dom_0 + +URL for AMWG diagnostics output used to validate new climate: +http://www.cgd.ucar.edu/cms/rneale/runs/cam/cam3_3_34_nonbfb_fv4x5dom-cam3_3_34_nonbfb_fv4x5dom_0/ +=============================================================== +=============================================================== + +Tag name: cam3_3_36 +Originator(s): mvertens +Date: Tue Oct 24 21:58:40 MDT 2006 +One-line Summary: non-bfb changes corresponding to cam3_3_37 + +Purpose of changes: to create the minimal code base that generates the + greater than round-off changes in cam3_3_37. Since cam3_3_37 will + contain number round-off level changes for som, it is useful to isolate + the few pieces of code that produced the greater than round-off differences.a + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: mvertens + M models/ocn/dom/ocn_comp.F90 + - Computation of lwup is occuring before temperature is updated. This is + now consistent with obtaining lwup from atm/ocn flux computation. This + will ensure that all fluxes in atm/ocn flux computation (including lwup) + are based on the same surface temperature. + M models/ocn/som/ocn_comp.F90 + - No longer multiplying onf by 1.-aice. Now doing this to each component of + onf in ocn_comp_mct.F90 + M models/ocn/som/ocn_comp_mct.F90 + - Now multiplying Foxx_melth, Foxx_swnet, Foxx_sen, Foxx_lat and Foxx_lwdn, + and lwup by 1.-aice. + M models/atm/cam/src/control/atm_comp_mct.F90 + - At first time step determine the longwave up flux from the surface + temperature. This is identical to what is being done in ccsm_msg.F90 + M models/drv/seq_mct/seq_flux_mct.F90 + - Put in computation to no longer require lat/lon to be passed in radians + from the ocean domain. Ocean domain will now pass lat/lon in degrees and + will convert to radians. + - Set ocean albedos to 1. when coszen < 0. + M models/drv/seq_mct/flux_ao.F90 + - Set umin to 0.5_r8 + This is the only answer changing modification between this code and the + atm/ocn flux calcuation code in cpl6. The goal is for both the concurrent + and sequential ccsm to use the same atm/ocn flux calculation code base. + Note that the diagnostic TREF will be totally different when the cpl6 + atm/ocn flux calculation is utilized + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +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. + +bluesky: all passed except for following baseline comparisons + 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 7 + 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 + 019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 + 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 + 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 + 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 + 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 + 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 7 + 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 + +tempest: all passed except for following baseline comparisons + 004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 5 + 007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 5 + 009 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 5 + 012 bl135 TBL.sh e32dh idphys 9 ...................................FAIL! rc= 5 + 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 5 + 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 5 + 021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 + 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 5 + 026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 5 + 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 5 + 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 5 + 035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 5 + 038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 5 + 040 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 5 + 043 bl535 TBL.sh s32dh idphys 9 ...................................FAIL! rc= 5 + 045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 5 + +bangkok/lf95: all passed except for following baseline comparisons + 004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 + 008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 + 010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 7 + 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 + 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 + 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 + 026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 + 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 + 032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 + 036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 + 038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 7 + 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- nature of change (larger than roundoff but same climate) + see complete documentation of runs to evaluate changes in cam3_3_37 tag info + +=============================================================== +=============================================================== + +Tag name: cam3_3_35 +Originator(s): Jim Edwards +Date: 10-11-2006 +One-line Summary: homme dycore development, replacement of cam common blocks + +Purpose of changes: development, code clean-up + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: refined build support for target_os=bgl + +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: + +Code reviewed by: self + +List all subroutines eliminated: +D 2094 models/atm/cam/src/control/comtfc.h +D 2094 models/atm/cam/src/control/comfft.h +D 2094 models/atm/cam/src/control/comctl.h +D 2094 models/atm/cam/src/control/comqfl.h +D 2094 models/atm/cam/src/control/perturb.h +D 2094 models/atm/cam/src/physics/cam1/comsol.h +D 2094 models/atm/cam/src/physics/cam1/comtsc.h +D 2094 models/atm/cam/src/physics/cam1/comadj.h + +List all subroutines added and what they do: +These are data modules which replace the common blocks eliminated above, +because the fv_control_mod contains namelist variables it needs to be compiled +regardless of dycore - thus it's location in the control directory. + +A + - models/atm/cam/src/control/cam_control_mod.F90 +A + - models/atm/cam/src/control/fv_control_mod.F90 +A + - models/atm/cam/src/dynamics/sld/sld_control_mod.F90 +A + - models/atm/cam/src/dynamics/eul/eul_control_mod.F90 + + +List all existing files that have been modified, and describe the changes: +Changes related to the continuing development of the homme dycore: +M 2094 models/atm/cam/src/dynamics/homme/external/forcing_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/parallel_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/prim_state_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/element_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/prim_advection_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/dof_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/bndry_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/diffusion_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/prim_advance_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/baroclinic_inst_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/external/edge_mod.F90 +M 2094 models/atm/cam/src/dynamics/homme/README +M 2094 models/atm/cam/src/dynamics/homme/dp_coupling.F90 +M 2094 models/atm/cam/src/dynamics/homme/stepon.F90 +M 2094 models/atm/cam/src/dynamics/homme/inidat.F90 +M 2094 models/atm/cam/src/dynamics/homme/dyn_comp.F90 +M 2094 models/atm/cam/src/dynamics/homme/restart_dynamics.F90 +M 2094 models/atm/cam/src/dynamics/homme/inital.F90 +C 2094 models/ocn/dom/sst_data.F90 +M 2094 models/atm/cam/tools/interpic_new/README +M 2094 models/atm/cam/bld/configure +M 2094 models/atm/cam/bld/Makefile.in +M 2094 models/atm/cam/src/control/cam_history.F90 +M 2094 models/atm/cam/src/utils/abortutils.F90 +M 2094 models/atm/cam/src/physics/cam1/tphysidl.F90 + +Changes related to the elemination of common blocks (note: there is some overlap in these lists): +C 2094 models/ocn/dom/sst_data.F90 +M 2094 models/ocn/dom/ocn_comp.F90 +M 2094 models/ocn/som/somint.F90 +M 2094 models/ocn/som/ocn_comp.F90 +M 2094 models/ocn/som/somini.F90 +M 2094 models/ice/csim4/ice_data.F90 +C 2094 models/ice/csim4/ice_comp.F90 +M 2094 models/atm/cam/tools/scam/scm_init/init_model.F90 +M 2094 models/atm/cam/tools/scam/scm_init/forecast.F90 +M 2094 models/atm/cam/tools/scam/scm_init/inital.F90 +M 2094 models/atm/cam/tools/scam/scm_init/readiopdata.F90 +M 2094 models/atm/cam/src/control/readinitial.F90 +M 2094 models/atm/cam/src/control/history_defaults.F90 +M 2094 models/atm/cam/src/control/runtime_opts.F90 +M 2094 models/atm/cam/src/control/ncdio_atm.F90 +M 2094 models/atm/cam/src/control/srfxfer.F90 +M 2094 models/atm/cam/src/control/restart.F90 +M 2094 models/atm/cam/src/control/startup_initialconds.F90 +M 2094 models/atm/cam/src/control/history_scam.F90 +C 2094 models/atm/cam/src/control/cam_comp.F90 +M 2094 models/atm/cam/src/control/cam_history.F90 +M 2094 models/atm/cam/src/physics/cam1/initindx.F90 +M 2094 models/atm/cam/src/physics/cam1/zenith.F90 +M 2094 models/atm/cam/src/physics/cam1/radiation.F90 +M 2094 models/atm/cam/src/physics/cam1/tphysbc.F90 +M 2094 models/atm/cam/src/physics/cam1/check_energy.F90 +M 2094 models/atm/cam/src/physics/cam1/restart_physics.F90 +M 2094 models/atm/cam/src/physics/cam1/cam_diagnostics.F90 +M 2094 models/atm/cam/src/physics/cam1/phys_gmean.F90 +M 2094 models/atm/cam/src/physics/cam1/stratiform.F90 +M 2094 models/atm/cam/src/physics/cam1/physics_types.F90 +M 2094 models/atm/cam/src/physics/cam1/radlw.F90 +M 2094 models/atm/cam/src/physics/cam1/tsinti.F90 +M 2094 models/atm/cam/src/physics/cam1/co2_data_flux.F90 +M 2094 models/atm/cam/src/physics/cam1/physpkg.F90 +M 2094 models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +M 2094 models/atm/cam/src/physics/cam1/dadadj.F90 +M 2094 models/atm/cam/src/physics/cam1/chemistry.F90 +M 2094 models/atm/cam/src/physics/cam1/phys_buffer.F90 +M 2094 models/atm/cam/src/physics/cam1/ramp_scon.F90 +M 2094 models/atm/cam/src/physics/cam1/phys_grid.F90 +M 2094 models/atm/cam/src/physics/cam1/advnce.F90 +M 2094 models/atm/cam/src/physics/cam1/tphysac.F90 +M 2094 models/atm/cam/src/physics/cam1/zm_conv.F90 +M 2094 models/atm/cam/src/physics/cam1/cldwat.F90 +M 2094 models/atm/cam/src/physics/waccm/nlte_fomichev.F90 +M 2094 models/atm/cam/src/physics/waccm/chemistry.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/solvar_interface.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_apex.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/efield.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 +M 2094 models/atm/cam/src/chemistry/waccm_mozart/exbdrift.F90 +M 2094 models/atm/cam/src/dynamics/sld/spegrd.F90 +M 2094 models/atm/cam/src/dynamics/sld/linemsdyn.F90 +M 2094 models/atm/cam/src/dynamics/sld/initcom.F90 +M 2094 models/atm/cam/src/dynamics/sld/scanslt.F90 +M 2094 models/atm/cam/src/dynamics/sld/inidat.F90 +M 2094 models/atm/cam/src/dynamics/sld/dyn_comp.F90 +M 2094 models/atm/cam/src/dynamics/sld/hordif.F90 +M 2094 models/atm/cam/src/dynamics/sld/spetru.F90 +M 2094 models/atm/cam/src/dynamics/sld/scan2.F90 +M 2094 models/atm/cam/src/dynamics/sld/restart_dynamics.F90 +M 2094 models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 +M 2094 models/atm/cam/src/dynamics/eul/spegrd.F90 +M 2094 models/atm/cam/src/dynamics/eul/initcom.F90 +M 2094 models/atm/cam/src/dynamics/eul/linemsdyn.F90 +M 2094 models/atm/cam/src/dynamics/eul/scanslt.F90 +M 2094 models/atm/cam/src/dynamics/eul/inidat.F90 +M 2094 models/atm/cam/src/dynamics/eul/dyn_comp.F90 +M 2094 models/atm/cam/src/dynamics/eul/hordif.F90 +M 2094 models/atm/cam/src/dynamics/eul/spetru.F90 +M 2094 models/atm/cam/src/dynamics/eul/scan2.F90 +M 2094 models/atm/cam/src/dynamics/eul/restart_dynamics.F90 +M 2094 models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 +M 2094 models/atm/cam/src/dynamics/fv/pmgrid.F90 +M 2094 models/atm/cam/src/dynamics/fv/initcom.F90 +M 2094 models/atm/cam/src/dynamics/fv/dryairm.F90 +M 2094 models/atm/cam/src/dynamics/fv/inidat.F90 +M 2094 models/atm/cam/src/dynamics/fv/dyn_comp.F90 +M 2094 models/atm/cam/src/dynamics/fv/inital.F90 +M 2094 models/atm/cam/src/dynamics/fv/stepon.F90 +M 2094 models/atm/cam/src/dynamics/fv/restart_dynamics.F90 +M 2094 models/atm/cam/src/dynamics/fv/metdata.F90 +M 2094 models/atm/cam/src/advection/slt/difcor.F90 +C 2094 models/drv/seq_mct/mrg_x2l_mct.F90 + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: none + +tempest: none + +bangkok/lf95: none + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., + - what code configurations: - what platforms/compilers: - nature + of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_34 +Originator(s): Will Sawyer +Date: Wed Oct 11 03:05:07 MDT 2006 +One-line Summary: Reduce init time (#213), clean up FV constants (#214), allocate status (#166) + +Purpose of changes: + + o PILGRIM initialization time has been reduced (Bug #213). This has + been achieved by removing the communications for XZY index and replacing + them by XYZ communication patterns. These are assembled by generating + an XY decomposition comm. pattern, then extending it to 3D in the + (undistributed) Z direction. This reduces initialization time, drastically + in the case of high resolution. Note that this change required extensive + restructuring of cam_history. + + o The status of allocation of large 3-D arrays in FV is checked (Bug #166) + + o FV constants were cleaned up in a consistent way (Bug #214), e.g., + + real(r8), parameter :: D0_0 = 0.0_r8 + real(r8), parameter :: D0_5 = 0.5_r8 + real(r8), parameter :: D1_0 = 1.0_r8 + real(r8), parameter :: D1_5 = 1.5_r8 + +Bugs fixed (include bugzilla ID): #166, #213, #214 + +Describe any changes made to build system: none + +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: FV initialization time is + now much faster, especially so for high resolutions. + +Code reviewed by: myself + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/src/control/cam_history.F90: Extensive changes to use + XYZ indexing to gather and scatter arrays. Now only one type of + PILGRIM gather/scatter operation (fv_gather_??, fv_scatter_??) + is used. Addition of routines to copy the *local* portion of the + array from XYZ -> XZY (loc_xyz_to_xzy) and XZY -> XYZ (loc_xzy_to_xyz) + decompositions. Performing this local give a minor performance + improvement. Overall this reduces the length and complexity of the + module. Treats the writing of the staggered U-winds field (which + has 1 less latitude than other fields) in a cleaner way. Now + writes all fields to restart consistently in XYZ indexing. + + models/atm/cam/src/dynamics/fv/benergy.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/cd_core.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/d2a3dijk.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/d2a3dikj.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/dp_coupling.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/dyn_grid.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/dynconst.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/epvd.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/fill_module.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/fv_prints.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/geopk.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/inital.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/initcom.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/mapz_module.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/mean_module.F90: new treatment of constants, e.g., + models/atm/cam/src/dynamics/fv/metdata.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/p_d_adjust.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/par_vecsum.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/pfixer.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/pft_module.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/stepon.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/sw_core.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/te_map.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/trac2d.F90: new treatment of constants + models/atm/cam/src/dynamics/fv/tp_core.F90: new treatment of constants, cleaning + models/atm/cam/src/dynamics/fv/xpavg.F90: new treatment of constants + + models/atm/cam/src/dynamics/fv/dyn_comp.F90: new treatment of constants, test return + status of allocations + + models/atm/cam/src/dynamics/fv/inidat.F90: new treatment of constants, test return + status of allocations, use new naming scheme for scatter/gather comm. patterns + + models/atm/cam/src/dynamics/fv/restart_dynamics.F90: new treatment of constants; + use new naming scheme for scatter/gather comm. patterns + + models/atm/cam/src/dynamics/fv/io_dist.F90: extensive cleaning. Removed old + methods for writing and reading; scheme is now consistent with + fv_read/write_r4/r8/i4 and fv_scatter/gather_r4/r8/i4 routines. + + models/atm/cam/src/dynamics/fv/dynamics_vars.F90: removed (unused) ESMF code + revised naming scheme for gather/scatter comm. patterns now consistent, + added PI argument to dynamics_init, dynpkg_init; XYZ patterns generated + by XY pattern with extension in Z; new treatment of constants + +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. + +bluesky: Failed on tests 030 (bl336), 034 (bl351), 055 (cs998), probably + because of new treatment of constants, specifically removal of + 4.0*atan(1.0) as definition of PI. Perturbation growth tests by + Brian Eaton indicate that these are roundoff differences. Check-in + OK'ed by Mathew Rothstein. + +tempest: passes all tests + +bangkok/lf95: passes all tests + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_3_33 (previous tag) + +Summarize any changes to answers, i.e., +- what code configurations: WACCM, FV +- what platforms/compilers: Bluesky +- nature of change (roundoff; larger than roundoff but same climate; new + climate): roundoff + +If bitwise differences were observed, how did you show they were no worse +than roundoff? perturbation growth test (by Eaton) + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +=============================================================== + +Tag name: cam3_3_33 +Originator(s): eaton +Date: Fri Oct 6 16:22:01 MDT 2006 +One-line Summary: Enable linking to external ESMF library + +Purpose of changes: + +. Changes to configure and Makefile.in to allow linking to ESMF library + This can be done by: + 1. setting the new -esmf_libdir option, + or + 2. by setting the environment variable ESMF_LIBDIR. + + Either of these methods will cause configure to check that the + files libesmf.a or libesmf.so and esmf.mk are present in the specified + directory. The esmf.mk file is produced when the ESMF library is built + and contains Makefile macros that CAM's Makefile will reference when + compiling and linking to the external library. + +. Remove interactive mode from configure. + +. Cleanup of Makefile.in. Remove untested SUN and OSF1 sections. + +Bugs fixed (include bugzilla ID): + +. Fix bug in fv/inidat.F90 applying perturbation to initial temperature + field. + +. Fixed SCAM build on bangkok. + +Describe any changes made to build system: + +. Add ability to link to an external ESMF library. The default remains to use + the WRF_ESMF time manager code. + +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: eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +models/atm/cam/bld/configure +. Add capability to specify that an external ESMF library should be used. +. Add test for linking to the ESMF library to test suite invoked by + configure's -test option. +. Add ability to try running a successfully built test. This helps to + identify problems related shared libraries not being found. +. Remove interactive mode. +. Simplify verbose mode; now set by "-v" option without a numeric argument. + +models/atm/cam/bld/Makefile.in +. Include the esmf.mk file if ESMF_LIBDIR is defined. +. use ESMF_F90COMPILEPATHS from esmf.mk to set search path for esmf module file . +. Use ESMF_F90LINKPATHS and ESMF_F90ESMFLINKLIBS from esmf.mk to set search + path and library name for linking to external esmf lib. +. Remove 32-bit addressing option for AIX. If this is needed somewhere it + should be re-implemented in configure rather than by requiring editing of the + Makefile. +. Remove unused SUN and OSF1 sections. +. Substantial cleanup. Tried to eliminate duplicated code from the + architecture specific sections of the Makefile. Tried to organize the + architecture specific sections to more or less follow the same order of + setting macros. + +models/atm/cam/src/dynamics/fv/inidat.F90 +. fix bug in how perturbation was applied to initial temperature field. + +models/atm/cam/test/system/test_driver.sh +. increase to bluevista time limit from 2:28 to 4:28 to account for + slowdown in compilation times +. update pathscale compiler version to 2.4 from 2.2.1 (on lightning) + +models/atm/cam/tools/scam/ui/configure +. add -lpgc to the LINK_LIBS macro in the Linux section. + +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. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_32 +Originator(s): mvertens +Date: Mon Oct 2 21:03:25 MDT 2006 +One-line Summary: Have SCAM driver determine the fractional + land cover in any gridcell. + +Purpose of changes: remove SCAM if-defs in lnd_comp_mct.F90 + and put the logic in SCAM driver. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: erik, eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + M ocn/dom/ocn_comp_mct.F90 + - removed SCAM if-def + M ocn/som/ocn_comp_mct.F90 + - removed SCAM if-def + M atm/cam/tools/scam/scm_init/init_model.F90 + M atm/cam/tools/scam/scm_init/scamMod.F90 + - changes enable SCAM to read in landfrac for the gridcell and determine + if the land model should be called + M SVN_EXTERNAL_DIRECTORIES + - updated to clm_exp_73 + M drv/seq_mct_drv/seq_ccsm_drv.F90 + - formatting change + M lnd/clm2/src/main/lnd_comp_mct.F90 + - removed SCAM if-defs + +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. + +bluesky: ALL TESTS PASSED +tempest: ALL TESTS PASSED +bangkok/lf95: ALL TESTS PASSED + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE +=============================================================== +=============================================================== + +Tag name: cam3_3_31 +Originator(s): mvertens +Date: Tue Sep 26 19:48:56 MDT 2006 +One-line Summary: made surface components mpi utilities and clm time manager independent of cam + +Purpose of changes: cam surface components no longer "use" cam communicator group settings + and clm no longer uses cam time manager when in COUP_CAM mode + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + M atm/cam/bld/clm_inparm.pm + M atm/cam/bld/SeqCCSM_namelist.pm + - added dtime to clm namelist input + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: eaton, tcraig, robj + +List all subroutines eliminated: none + +List all subroutines added and what they do: + + A ocn/dom/ocn_spmd.F90 + - determine communicator group and masterproc, iam, npes for ocn + A ocn/som/ocn_spmd.F90 + - determine communicator group and masterproc, iam, npes for ocn + A ice/csim4/ice_spmd.F90 + - determine communicator group and masterproc, iam, npes for ice + A drv/seq_mct/seq_communicator.F90 + - determine communicator group and masterproc, iam, npes for drv routines + +List all existing files that have been modified, and describe the changes: + + M ocn/dom/sst_data.F90 + - replace "use mpishorthand" with "use ocn_utils" + - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand + M ocn/dom/ocn_comp.F90 + - replace "use spmd_utils" with "use ocn_utils" + - ocn_mpicom now passed in as argument and used to initialize ocn communicator + group, masterproc, iam and npes + M ocn/dom/ocn_comp_mct.F90 + - ocn_mpicom now passed in as argument + - replaced call to module routine seq_init_SetgsMap with call to mct routine + mct_gsMap_init in order to initialize gsmap + + M ocn/som/mixed_layer.F90 + - replace "use mpishorthand" with "use ocn_utils" + - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand + M ocn/som/ocn_comp.F90 + - replace "use spmd_utils" with "use ocn_utils" + - ocn_mpicom now passed in as argument and used to initialize ocn communicator + group, masterproc, iam and npes + - fixed bug in conservation check equation (this is turned off in all tests) + ocn_in(c)%netfocn replaced with ocn_in(c)%melth + M ocn/som/somini.F90 + - replace "use mpishorthand" with "use ocn_utils" + - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand + M ocn/som/ocn_comp_mct.F90 + - ocn_mpicom now passed in as argument + - replaced call to module routine seq_init_SetgsMap with call to mct routine + mct_gsMap_init in order to initialize gsmap + + M ice/csim4/ice_data.F90 + - replace "use spmd_utils" with "use ice_utils" + - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand + M ice/csim4/print_coverage.F90 + - replace "use spmd_utils" with "use ice_utils" + M ice/csim4/ice_comp.F90 + - replace "use spmd_utils" with "use ice_utils" + - made explicit calls to mpi_bcast rather than the interfaces in mpishorthand + M ice/csim4/ice_comp_mct.F90 + - added ICEID and mpicom_ice to input arguments + - replaced call to module routine seq_init_SetgsMap with call to mct routine + mct_gsMap_init in order to initialize gsmap + + M atm/cam/tools/scam/scm_init/init_model.F90 + - put in changes analogous to those in seq_ccsm_drv.F90 + M atm/cam/tools/scam/scm_init/scam_run.F90 + - separated calls to ocn_run_mct and atm/ocn flux calculation into two separate blocks + M atm/cam/tools/scam/scm_init/scamMod.F90 + - added dtime_out as argument to scam_clm_default_opts (see clm notes below + + M atm/cam/src/control/con_cam.F90 + - removed call to cam_init2 (call to cam_init1 now is call to cam_init) + - removed call to spmdinit + - mpicom now passed as argument to cam_init + M atm/cam/src/control/atm_comp_mct.F90 + M atm/cam/src/control/cam_comp.F90 + - removed cam_init2 and replaced cam_init1 with cam_init + - call to intht is now done on first call of cam_comp + M atm/cam/src/utils/spmd_utils.F90 + - no longer calls mpi_init when COUP_CSM ins not defined + - removed code-block for if-defined IRIX (no longer needed) + - mpicom_atm passed as now as argument + M atm/cam/src/utils/time_manager.F90 + - removed module variables perpetual_ymd and perpetual_run (no longer needed) + + M SVN_EXTERNAL_DIRECTORIES + - now using clm3_expa_73 + - clm3_expa_73 no longer uses the cam time manager and as a result dtime needs to be + specified explicitly in the clm namelist + - clm3_expa_73 also no longer obtains irad from the call to the cam routine radiation_get + as a result bugzilla #228 has been added + + M drv/seq_mct_drv/seq_ccsm_drv.F90 + - removed call to atm_init2 + - mpi now initialized in seq_ccsm_drv.F90 rather than in the cam routine spmdinit + - currently it is assumed that cam and all the surface components will utilize the global + communicator group + - mpicom_glob now passed as an argument to cam and the surface components + - replaced calls to mrg_x2*_alloc_mct with mrg_x2*_init_mct, and removed the original calls + to mrg_x2* + + M drv/seq_mct/seq_init_mct.F90 + - now calls mpi_init (rather than in cam routine spmdinit) + - removed routine seq_init_setgsmap (see above) + M drv/seq_mct/seq_domain_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + - removed explicit setting of mpicom=1 when SPMD is not defined + M drv/seq_mct/seq_flux_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + - removed explicit setting of mpicom=1 when SPMD is not defined + M drv/seq_mct/mrg_x2a_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + - replaced hard-wired copies for each field with mct call to mct_aVect_copy. + M drv/seq_mct/mrg_x2i_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + all common attribute vector components from one attribute vector to another. + - replaced hard-wired copies for each field with mct call to mct_aVect_copy (only + rain and snow are now hard-wired in the copy command). mct_aVect_copy will copy + - removed explicit setting of mpicom=1 when SPMD is not defined + M drv/seq_mct/mrg_x2l_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + - removed explicit setting of mpicom=1 when SPMD is not defined + - replaced hard-wired copies for each field with mct call to mct_aVect_copy. + M drv/seq_mct/mrg_x2o_mct.F90 + - replaced "use mpishorthand" with "use seq_comunicator" + - removed explicit setting of mpicom=1 when SPMD is not defined + +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. + +bluesky: ALL PASS +tempest: ALL PASS +bangkok/lf95: ALL PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE + +=============================================================== +=============================================================== + +Tag name: cam3_3_30 +Originator(s): Jim Edwards + Pat Worley (phys_grid) +Date: 09-21-2006 +One-line Summary: homme dycore development + +Purpose of changes: homme dycore development + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: added build for bluegene + +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: Edwards, Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: added dynamics/homme/external + +List all existing files that have been modified, and describe the changes: + + Improved documentation for creating initial and boundary files + for the homme dycore +M models/atm/cam/tools/interpic_new/README + + Added support for bluegene system at NCAR (frost) + and improved support for homme dycore. +M models/atm/cam/bld/configure +M models/atm/cam/bld/Makefile.in +M models/atm/cam/bld/namelist.pm +A + models/atm/cam/bld/filter_nl.pm +M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml +M models/atm/cam/bld/system_defaults.xml +A + models/atm/cam/bld/DefaultCTL_NL_Namelist.xml +M models/atm/cam/bld/cam_inparm.pm +M models/atm/cam/bld/resolution_parameters.xml +A + models/atm/cam/bld/ctl_nl.pm +M models/atm/cam/bld/config_cam_homme_defaults.xml +M models/atm/cam/bld/SeqCCSM_namelist.pm +A + models/atm/cam/bld/DefaultFILTER_NL_Namelist.xml + + Improved the interface that allows reading multiple namelists from multiple source code files. + Fixed a problem with the dyn_grid -> phys_grid mapping apparent in the homme dycore. + +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/control/con_cam.F90 +M models/atm/cam/src/control/atm_comp_mct.F90 +M models/atm/cam/src/control/cam_comp.F90 +M models/atm/cam/src/control/cam_history.F90 +M models/atm/cam/src/physics/cam1/boundarydata.F90 +M models/atm/cam/src/physics/cam1/physpkg.F90 +M models/atm/cam/src/physics/cam1/phys_grid.F90 +M models/atm/cam/src/physics/cam1/cldwat.F90 +M models/atm/cam/src/dynamics/fv/inital.F90 + +Continued development of the homme dycore: the external directory represents a + mirror of the files in repository + https://svn-homme-model.cgd.ucar.edu/trunk/src/share + +A + models/atm/cam/src/dynamics/homme/external +A + models/atm/cam/src/dynamics/homme/external/flops_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/filter_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/math_constants.F90 +A + models/atm/cam/src/dynamics/homme/external/forcing_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/stats.h +A + models/atm/cam/src/dynamics/homme/external/preq_init_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/interface.h +A + models/atm/cam/src/dynamics/homme/external/schedule_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/reduction_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/parallel_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/spacecurve_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/utils_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/derivative_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_state_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/dimensions_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/locate.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_restart_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/torus_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/quadrature_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/coordinate_systems_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/global_norms_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/control_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/element_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/time_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_si_ref_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/stats.F90 +A + models/atm/cam/src/dynamics/homme/external/hybvcoord_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/checksum_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_advection_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/directions.F90 +A + models/atm/cam/src/dynamics/homme/external/thread_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/dof_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/physical_constants.F90 +A + models/atm/cam/src/dynamics/homme/external/kinds.F90 +A + models/atm/cam/src/dynamics/homme/external/solver_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/restart_io_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/namelist_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/perfmodel_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/bndry_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/metis_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/params_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/field_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/diffusion_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/mass_matrix_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_advance_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/cg_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/prim_si_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/types_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/domain_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/gridgraph_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/metagraph_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/generic_list.F90 +A + models/atm/cam/src/dynamics/homme/external/ref_state_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/vertex_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/cube_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/physics_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/rotation_init.F90 +A + models/atm/cam/src/dynamics/homme/external/interpolate_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/linear_algebra_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/baroclinic_inst_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/edge_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/ll_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/vertical_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/timer.h +A + models/atm/cam/src/dynamics/homme/external/timer_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/state_mod.F90 +A + models/atm/cam/src/dynamics/homme/external/hybrid_mod.F90 +A + models/atm/cam/src/dynamics/homme/io_dist.F90 +M models/atm/cam/src/dynamics/homme/dyn_grid.F90 +M models/atm/cam/src/dynamics/homme/dp_coupling.F90 +M models/atm/cam/src/dynamics/homme/dyn_comp.F90 +M models/atm/cam/src/dynamics/homme/inidat.F90 +M models/atm/cam/src/dynamics/homme/stepon.F90 +M models/atm/cam/src/dynamics/homme/spmd_dyn.F90 +M models/atm/cam/src/dynamics/homme/inital.F90 + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: passed + +tempest: passed + +bangkok/lf95: passed + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_28 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +Tag name: cam3_3_29 +Originator(s): jwolfe, eaton +Date: Wed Sep 20 17:08:08 MDT 2006 +One-line Summary: fix for single executable CCSM + +Purpose of changes: fix for single executable CCSM + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +In con_cam.F90 change this: + +#ifdef SINGLE_EXEC + call MPH_get_argument("THREADS", nthreads, "atm") + call OMP_SET_NUM_THREADS(nthreads) +#endif + +to this: + +#ifdef SINGLE_EXEC + call MPH_get_argument("THREADS", nThreads, "atm") +#ifdef _OPENMP + call OMP_SET_NUM_THREADS(nThreads) +#endif +#endif + +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. + +bluesky: not done + +tempest: not done + +bangkok/lf95: not done + +Tests not done because this change is inside an ifdef that isn't turned on +for any of CAM's current regression tests. + +=============================================================== +=============================================================== + +Tag name: cam3_3_28 +Originator(s): mvr, jwolfe +Date: 060914 +One-line Summary: implemented last remaining items needed for cam to +be included in a ccsm single-executable; bug fix to enable scam to compile + +Purpose of changes: ccsm single-executable required a few more mods, +including one name conflict that was overlooked; a compile-time bug was +introduced to the scam build in cam3_3_27 + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, eaton, mvertens + +List all subroutines eliminated: +D models/atm/cam/src/physics/cam1/diagnostics.F90 +- just a rename required to clear up name conflict in ccsm single-executable + +List all subroutines added and what they do: +A + models/atm/cam/src/physics/cam1/cam_diagnostics.F90 +- newly named file and mods to clear up name conflict in ccsm single-executable + +List all existing files that have been modified, and describe the changes: +M models/ice/csim4/ice_comp.F90 +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/control/con_cam.F90 +M models/atm/cam/src/physics/cam1/tphysbc.F90 +M models/atm/cam/src/physics/cam1/physpkg.F90 +- files modified to reflect name change: diagnostics -> cam_diagnostics + +M models/atm/cam/tools/scam/scm_init/init_model.F90 +- bug fix to enable scam to compile + +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. + +bluesky: +ALL PASS + +tempest: +ALL PASS + +bangkok/lf95: +ALL PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_27 +Originator(s): mvertens +Date: Mon Sep 11 21:44:10 MDT 2006 +One-line Summary: moved atm/ocn flux calculation to top level + +Purpose of changes: + +Moved the atmosphere/ocean flux calculation out of the ocn (dom/som) +models and up to the top level driver. This is a necessary stop in constructing +a sequential ccsm system. It will also enable the use of the cpl6 atm/ocn flux +calculation to be utilized in both the sequential and concurrent system. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: None + +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: Probably none (this should be checked) + +Code reviewed by: eaton, erik (briefly) + +List all subroutines eliminated: + + D ocn/dom/albocean.F90 + - calculation now done in seq_flux_mct.F90 (see below) + D ocn/dom/print_coverage.F90 + - not used by any code in dom/ + D ocn/dom/parpbl.h + - only used in flxoce.F90 - which is no longer utilized + D ocn/dom/albedo.h + - not used by any code in dom/ + D ocn/dom/wtrc_flxoce.F90 + - moved to atm/cam/src/control + D ocn/dom/flxoce.F90 + - replaced by flux_ao routine (see below) + D ocn/dom/srfoce.F90 + - see below + + D ocn/som/albocean.F90 + - calculation now done in seq_flux_mct.F90 (see below) + D ocn/som/mixed_layer_globalcalcs.F90 + D ocn/som/ocn_srf.F90 + - ocn_srf.F90 and mixed_layer_globalcalcs.F90 merged into mixed_layer.F90 + D ocn/som/parpbl.h + - only used in flxoce.F90 - which is no longer utilized + D ocn/som/flxoce.F90 + - replaced by flux_ao routine (see below) + +List all subroutines added and what they do: + + A ocn/som/mixed_layer.F90 + - merge of mixed_layer_globalcalcs.F90 and ocn_srf.F90 + + A atm/cam/src/control/wtrc_flxoce.F90 + - moved computation of water tracer exchange from ocean into atmospheric code base + to reduce number of fields that need to be exchanged between ocean and atmosphere + + A drv/seq_mct/seq_flux_mct.F90 + A drv/seq_mct/flux_ao.F90 + - performs calculation previously done in dom/flxocn.F90 and som/flxocn.F90 + - also calculates ocean albedo and net shortwace absorbed by surface + +List all existing files that have been modified, and describe the changes: + + M ocn/dom/sst_data.F90 + M ocn/dom/ocn_types.F90 + M ocn/dom/ocn_comp.F90 + M ocn/dom/ocn_comp_mct.F90 + - see below + + M ocn/som/ocn_types.F90 + M ocn/som/ocn_comp.F90 + M ocn/som/ocn_comp_mct.F90 + - see below + + M atm/cam/tools/scam/scm_init/init_model.F90 + M atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 + M atm/cam/tools/scam/scm_init/scam_run.F90 + - put in changes to incorporate xao_o and xao_a along with calls to ocean/atmosphere + flux calculation from top level driver + + M atm/cam/src/control/ccsm_msg.F90 + M atm/cam/src/control/camsrfexch_types.F90 + - added "rho, netsw, ustar, re, ssq" as cam_out components in camsrfexch_types.F90 + M atm/cam/src/control/srfxfer.F90 + - removed rho and netsw as module variables in ccsm_msg.F90 + M atm/cam/src/control/atm_comp_mct.F90 + - introduced call to wtrc_flxoce if trace_water is true + - replace call to atm_init1_mct with atm_init_mct + - added ustar, re and ssq to x1a_a input + + M drv/seq_flds/dust/seq_flds_mod.F90 + M drv/seq_flds/default/seq_flds_mod.F90 + M drv/seq_flds/gensom/seq_flds_mod.F90 + - see below + + M drv/seq_mct_drv/seq_ccsm_drv.F90 + M drv/seq_mct/mrg_x2a_mct.F90 + - replaced o2x_a components that are now calculated in seq_flux_mct with xao_a components + M drv/seq_mct/mrg_x2i_mct.F90 + - removed index_o2x_So_tsocn from o2x_i and x2i_i + M drv/seq_mct/mrg_x2o_mct.F90 + - removed unnecessary a2x_o (this is now utilized in atm/ocn flux calculatin in seq_flux_mct) + M drv/seq_flds_indices/seq_flds_indices.F90 + - put in changes necessary for new atm/ocn flux computation at top level (see below) + + Summary: New attribute vectors xao_o and xao_a were introduced at the top level + to account for the calculation of the atm/ocn flux calculation. + + The routines dom/srfoce.F90, dom/flxoce.F90 and som/flxoce.F90 were replaced with + drv/seq_mct/flux_ao.F90 and drv/seq_mct/seq_flux_mct.F90. + The current form of flx_ao.F90 is such that it can be replaced with + the equivalent coupler code once sign conventions are addressed. (Note, + to increase clarity som/ocn_srf.F90 and som/mixed_layer_globalcalcs.F90 were + merged to create som/mixed_layer.F90). + + The ocean albedo calculation was also moved out of the ocean code and + put into seq_flux_mct.F90. As a result, ocn/som/albocean.F90 and + ocn/dom/albedo.h are no longer needed). The new routine to calculate ocean albedos, + seq_flux_albo_mct, is now contained in seq_flux_mct.F90. + + Ocean input information was significantly altered as a result of bringing the atm/ocn + flux calculation out of the ocean code base. The CAM DOM code now does not need any + input information. The CAM SOM code also requires significantly less input information + (only netsw from the atmosphere). + + It is important to note that lwup is still being computed in the ocean code. The + impact on SOM needs to be evaluated when moving this calculation to the + atm/ocean flux routine (as is done in the cpl6 code). + + The routine, wtrc_flxoce.F90 (isotope calculation) was moved out of the ocean model + and into atm/cam/src/control. The extra fields necessary to do this + computation (ustar, re, ssq) were added to the x2a attribute vector. + Note that this feature is currently not tested. + +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. + +bluesky: ALL PASSED +tempest: ALL PASSED +bangkok/lf95: ALL PASSED except for + 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 + 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 + 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + - the above difference appear to be roundoff errors that set in very early + - note that all other tests (including on all other platforms) produced bfb + baseline comparisons + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE +=============================================================== +=============================================================== + +Tag name: cam3_3_26 +Originator(s): mvertens +Date: Sun Sep 10 20:22:42 MDT 2006 +One-line Summary: Changes necessary for moving atm/ocn flux calc to top level + +Purpose of changes: + +Incorporated changes necessary to move the atm/ocn flux calculation out of the dom/som +ocean code and into the top level application driver. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: None + +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: eaton + +List all subroutines eliminated: None + +List all subroutines added and what they do: None + +List all existing files that have been modified, and describe the changes: + + M ocn/dom/ocn_comp.F90 + - Moved update of ocean temperature to after calculation of ocean surface/fluxes + This was done to be consistent with SOM update and to be able to move the atm/ocean + surface flux calculation to the top level driver without introducint cpp ifdefs. + This change also required writing the surface temperature to the ocean restart file. + This modification will result in greater than round-off level differences with cam3_3_25. + - removed the call to sstan and made the conversion from degees K to C explicit + + M ice/csim4/ice_types.F90 + M ice/csim4/ice_comp.F90 + M ice/csim4/ice_diagnostics.F + - Removed "precsc, precsl, precc, precl" as ice_in types and replaced them with "snow" + since only snow is needed as input to csim. This change should only result in round-off + level differences with cam3_3_25. + M ice/csim4/ice_comp_mct.F90 + - In addition to only using "snow" as input from the application driver, also removed + x2i_i%rAttr(index_x2i_So_tsocn,g) as input and instead used + x2i_i%rAttr(index_x2i_So_t,g)-SHR_CONST_TKFRZ. This change should only result in + round-off level differences with cam3_3_25. + + M drv/seq_flds/dust/seq_flds_mod.F90 + M drv/seq_flds/default/seq_flds_mod.F90 + M drv/seq_flds/gensom/seq_flds_mod.F90 + M drv/seq_mct/mrg_x2i_mct.F90 + M drv/seq_flds_indices/seq_flds_indices.F90 + - replaced 'Faxa_rainc', Faxa_rainl','Faxa_snowc','Faxa_snowl' as input to ice + with 'Faxa_rain' and :Faxa_snow' + + M drv/seq_mct/mrg_x2a_mct.F90 + - Removed calculation of ts for non-fractional grid box + This makes the merge consistent with that done in cpl6. + +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. + +bluesky: All tests passed (no baseline compare was done) +tempest: All tests passed (no baseline compare was done) +bangkok/lf95: All tests passed (no baseline compare was done) + +Summarize any changes to answers, i.e., +- what code configurations: see above +- what platforms/compilers: effects all platforms +- nature of change: larger than roundoff but same climate + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., + +- source tag (all code used must be in the repository): cam3_3_26 +- platform/compilers: bluesky + +- configure commandline: +configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 + +- build-namelist command (or complete namelist): +&ccsm_inparm + case_name = 'cam3_3_24_fluxao_fv4x5dom' + start_type = "continue" +/ +&timemgr_inparm + atm_cpl_dt = 1800 + orb_iyear_ad = 1950 + restart_option = 'monthly' + start_ymd = 10101 + stop_n = 720 + stop_option = 'ndays' +/ +&cam_inparm + dtime = 1800 + absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' + aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' + bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' + bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' + bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' + bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' + ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0001-01-01_4x5_L26_c060608.nc' +/ +&clm_inparm + fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' + fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' +/ + +- MSS location of output: +/MVERTENS/csm/cam3_3_24_fluxao_fv4x5dom/hist (cam3_3_24+ current mods) + +MSS location of control simulations used to validate new climate: +/MVERTENS/csm/cam3_3_24_fluxao_fv4x5dom_0/hist (cam3_3_24) + +URL for AMWG diagnostics output used to validate new climate: +http://www.cgd.ucar.edu/cms/rneale/runs/cam/cam3_3_24_fluxao_fv4x5dom-cam3_3_24_fluxao_fv4x5dom_0/ + +=============================================================== +=============================================================== + +Tag name: cam3_3_25 +Originator(s): eaton +Date: Tue Sep 5 08:53:01 MDT 2006 +One-line Summary: add spun-up CLM initial files + +Purpose of changes: + +. add spun-up CLM initial files for FV 1.9x2.5. There are files for both + 0000-01-01 and 0000-09-01 + +. Fixed syntax of some attributes in the default XML files. XML requires + that attribute values are quoted, and there were unquoted values in the + files. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +Describe any changes made to the namelist: none + +List any changes to the defaults for the boundary datasets: + +. add spun-up CLM initial files for FV 1.9x2.5. There are files for both + 0000-01-01 and 0000-09-01 + +Describe any substantial timing or memory changes: none + +Code reviewed by: eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +. models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml +. models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml + +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. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE + +=============================================================== +=============================================================== + +Tag name: cam3_3_24 +Originator(s): mvr, jwolfe +Date: 060830 +One-line Summary: mods to eliminate naming conflicts in the ccsm +single executable; increased max fields for history tapes; +minor test driver enhancements + +Purpose of changes: the move to a single executable for running +cam as part of ccsm introduced some naming conflicts that needed +to be resolved; running cam in ccsm and turning on the chemistry +and co2 blew out the maximum allowed fields on a history tape + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, eaton + +List all subroutines eliminated: +D models/atm/cam/src/control/history.F90 +- renamed due to conflict in the ccsm single executable + +List all subroutines added and what they do: +A + models/atm/cam/src/control/cam_history.F90 +- newly named to work with the ccsm single executable +- also modified the maximum number of fields allowed on history tapes + +List all existing files that have been modified, and describe the changes: +M models/atm/cam/test/system/TSB.ccsm.sh +- modified to use resource settings returned from ccsm scripts +- ccsm tests now use default queue on phoenix + +M models/atm/cam/test/system/test_driver.sh +- machine calgary now supported by test driver; +- increased wall clock limit for default testing on bluevista + +M models/atm/cam/test/system/CAM_runcmnd.sh +- added code in support of machine calgary + +M models/ocn/dom/ocn_comp.F90 +M models/ocn/som/ocn_srf.F90 +M models/ocn/som/ocn_comp.F90 +M models/ice/csim4/ice_srf.F90 +M models/ice/csim4/ice_comp.F90 +M models/atm/cam/tools/scam/scm_init/init_model.F90 +M models/atm/cam/tools/scam/scm_init/forecast.F90 +M models/atm/cam/src/control/history_defaults.F90 +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/srfxfer.F90 +M models/atm/cam/src/control/restart.F90 +M models/atm/cam/src/control/atm_comp_mct.F90 +M models/atm/cam/src/control/filenames.F90 +M models/atm/cam/src/control/history_scam.F90 +M models/atm/cam/src/control/cam_comp.F90 +M models/atm/cam/src/utils/time_manager.F90 +M models/atm/cam/src/physics/cam1/seasalt_intr.F90 +M models/atm/cam/src/physics/cam1/tphysidl.F90 +M models/atm/cam/src/physics/cam1/progseasalts_intr.F90 +M models/atm/cam/src/physics/cam1/tracers.F90 +M models/atm/cam/src/physics/cam1/param_cldoptics.F90 +M models/atm/cam/src/physics/cam1/diagnostics.F90 +M models/atm/cam/src/physics/cam1/radiation.F90 +M models/atm/cam/src/physics/cam1/dust_intr.F90 +M models/atm/cam/src/physics/cam1/tphysbc.F90 +M models/atm/cam/src/physics/cam1/aerosol_radiation_interface.F90 +M models/atm/cam/src/physics/cam1/radsw.F90 +M models/atm/cam/src/physics/cam1/check_energy.F90 +M models/atm/cam/src/physics/cam1/stratiform.F90 +M models/atm/cam/src/physics/cam1/water_tracers.F90 +M models/atm/cam/src/physics/cam1/radlw.F90 +M models/atm/cam/src/physics/cam1/ozone_data.F90 +M models/atm/cam/src/physics/cam1/physpkg.F90 +M models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +M models/atm/cam/src/physics/cam1/convect_shallow.F90 +M models/atm/cam/src/physics/cam1/convect_deep.F90 +M models/atm/cam/src/physics/cam1/carbon_intr.F90 +M models/atm/cam/src/physics/cam1/sulchem.F90 +M models/atm/cam/src/physics/cam1/co2_cycle.F90 +M models/atm/cam/src/physics/cam1/chemistry.F90 +M models/atm/cam/src/physics/cam1/gw_drag.F90 +M models/atm/cam/src/physics/cam1/sulemis.F90 +M models/atm/cam/src/physics/cam1/aerosol_intr.F90 +M models/atm/cam/src/physics/cam1/cloudsimulator.F90 +M models/atm/cam/src/physics/cam1/zm_conv.F90 +M models/atm/cam/src/physics/cam1/sulfur_intr.F90 +M models/atm/cam/src/physics/cam1/constituent_burden.F90 +M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 +M models/atm/cam/src/physics/waccm/iondrag.F90 +M models/atm/cam/src/physics/waccm/tracers.F90 +M models/atm/cam/src/physics/waccm/nlte_lw.F90 +M models/atm/cam/src/physics/waccm/chemistry.F90 +M models/atm/cam/src/physics/waccm/ctem.F90 +M models/atm/cam/src/physics/waccm/radheat.F90 +M models/atm/cam/src/physics/waccm/gw_drag.F90 +M models/atm/cam/src/physics/waccm/tgcm_forcing.F90 +M models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 +M models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 +M models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 +M models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 +M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 +M models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_aero_settling.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_airglow.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_jlong.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_setext.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_photo.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_jshort.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_cph.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_chm_diags.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_aurora.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_apex.F90 +M models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 +M models/atm/cam/src/chemistry/waccm_mozart/iondrag.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 +M models/atm/cam/src/chemistry/waccm_mozart/mo_jeuv.F90 +M models/atm/cam/src/chemistry/waccm_mozart/exbdrift.F90 +M models/atm/cam/src/dynamics/sld/spegrd.F90 +M models/atm/cam/src/dynamics/sld/linemsdyn.F90 +M models/atm/cam/src/dynamics/sld/dyn_comp.F90 +M models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 +M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 +M models/atm/cam/src/dynamics/eul/spegrd.F90 +M models/atm/cam/src/dynamics/eul/linemsdyn.F90 +M models/atm/cam/src/dynamics/eul/dyn_comp.F90 +M models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 +M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 +M models/atm/cam/src/dynamics/fv/inidat.F90 +M models/atm/cam/src/dynamics/fv/dyn_comp.F90 +M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 +M models/atm/cam/src/dynamics/fv/uv3s_update.F90 +- mods to eliminate naming conflicts when used in the ccsm single executable: + (mods included 'use' statements, documentation, and whitespace formatting) + subroutine write_restart -> cam_write_restart + subroutine read_restart -> cam_read_restart + module history -> cam_history + + +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. + +bluesky: +ALL PASS +tempest: +ALL PASS +bangkok/lf95: +ALL PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_23 +Originator(s): eaton +Date: Sun Aug 27 14:17:37 MDT 2006 +One-line Summary: fix some intent attributes in various high level interfaces + +Purpose of changes: + +. Some of the intents for derived types that contain pointer components are + wrong in the FV interface routines. In this situation the intent refers to + the association status of the pointer, not to the target of the pointer. + Fix these intents in fv/stepon.F90 and fv/dyn_comp.F90. + +. cam_run1 has args cam_in and cam_out declared intent(inout). Most of the + components of these user defined types are arrays of length pcols, but + we're adding components that are pointers, and probably all the + components should be pointers. Since for pointer components the + intent(inout) doesn't make sense, and for non-pointer components it's the + default, this intent has been removed. Also switched the order of these + args to match the convention of listing input args first. + +. replace the variables surface_state2d and srfflx_state2d by cam_out and + cam_in respectively in physpkg. There are alot of other places where + this still needs to happen. + +. utils/timing/f_wrappers.c was missing the header file string.h. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + models/utils/timing/f_wrappers.c + . add missing include of string.h + + models/atm/cam/src/dynamics/fv/stepon.F90 + . remove the intent(out) attributes of dummy args dyn_in and dyn_out in + both stepon_init and stepon_run1. That intent + implies that the pointer components should be associated in this + routine. But the pointers were previously associated in + dyn_create_interface and the targets are what is being set here. + + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + . remove the intent(inout) attributes of dummy args dyn_in and dyn_out in + dyn_run + + models/atm/cam/src/control/cam_comp.F90 + . remove the intent(inout) attribute of args cam_in and cam_out in + cam_run1 interface. Also switched the order of these + args to match the convention of listing input args first. + . order actual args (.., cam_in, cam_out) in call to phys_run1 + + models/atm/cam/src/control/con_cam.F90 + . switch order of actual args in call to cam_run1 + + models/atm/cam/src/control/atm_comp_mct.F90 + . switch order of actual args in call to cam_run1 + + models/atm/cam/src/physics/cam1/physpkg.F90 + . replace surface_state2d by cam_out and replace srfflx_state2d by cam_in + . order dummy args (.., cam_in, cam_out) in definition of phys_run1 + +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. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE + +=============================================================== +=============================================================== + +Tag name: cam3_3_22 +Originator(s): erik +Date: Fri Aug 18 10:18:32 MDT 2006 +One-line Summary: fix restart_option=end, get_perp_date bugs + +Purpose of changes: + +Bugs fixed (include bugzilla ID): 107, 185 + +Describe any changes made to build system: None + +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: self + +List all subroutines eliminated: None + +List all subroutines added and what they do: None + +List all existing files that have been modified, and describe the changes: + +M cam/test/unit/control/run_time_test + Add tests for perpetual case and other restart_options +M atm/cam/test/unit/control/test_time.F90 + Add tests for perpetual case and other restart_options +M atm/cam/src/utils/time_manager.F90 + Add ability to use offset optional argument for get_perp_date + +Externals updated: + + csm_share to share3_060814 + clm2 to clm3_expa_69 + +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. + +bluesky: All PASS + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: bit-for-bit + +=============================================================== +=============================================================== + +Tag name: cam3_3_21 +Originator(s): eaton, klindsay, mirin +Date: 2006-08-17 +One-line Summary: Update icesst tools; add column burden diags; FV fixes/cleanup. + +Purpose of changes: + +. Update the icesst tool to recognize the new datasets being provided by + Dennis Shea. These have a CF-conforming time coordinate and the date + information in YYYYMMDD format is moved to a new date variable. + Also needed to change some fixed sizes in bcgen/solver.f90 to allow for + the new datasets starting from 1870 rather than 1949. + +. Add hist_fld_active query function to history.F90. Returns whether or + not a field is active on any history file. This enables the ability to + not perform expensive diagnostic calculations if they aren't being asked + for in the history output. (Contributed by Keith Lindsay.) + +. Add column burden diagnostics for all constituents except water vapor. + These are not put on the history tapes by default. The names of the + output variables are of the form 'TM'//cnst_name. Not enabled for SCAM. + (Contributed by Keith Lindsay.) + +. Add modcomm_gatscat to namelist (bugfix); fix defaults for some modcomm + options; cleanup of comments. (Contributed by Art Mirin.) + +Bugs fixed (include bugzilla ID): + +. Add modcomm_gatscat to namelist + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + +. Add modcomm_gatscat to namelist + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: eaton + +List all subroutines eliminated: + + models/atm/cam/tools/icesst/README.bfb + +List all subroutines added and what they do: + +. column burden diagnostics for all constituents except water vapor + models/atm/cam/src/physics/cam1/constituent_burden.F90 + +List all existing files that have been modified, and describe the changes: + +. enable icesst tools to read new input datasets + models/atm/cam/tools/icesst/README + models/atm/cam/tools/icesst/bcgen/solver.f90 + models/atm/cam/tools/icesst/regrid/regrid.f90 + models/atm/cam/tools/icesst/regrid/wrap_nf.f90 + +. add column burden diagnostics + models/atm/cam/src/physics/cam1/diagnostics.F90 + +. add new query function to history + models/atm/cam/src/control/history.F90 + +. FV and modcomm bugfixes and cleanup + models/atm/cam/src/control/runtime_opts.F90 + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + models/utils/pilgrim/mod_comm.F90 + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: All PASS + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: NONE + +=============================================================== +=============================================================== + +Tag name: cam3_3_20 +Originator(s): erik +Date: Wed Aug 16 09:34:33 MDT 2006 +On-line Summary: Fix bugs from cam3_3_15 for working on phoenix + +Purpose of changes: Changes needed for CCSM to work on phoenix. + +Bugs fixed (include bugzilla ID): 204 and 205 + +Describe any changes made to build system: none + +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: self, jwolfe + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +M models/atm/cam/test/unit/control/run_time_test + Remove old style namelists for comparision, add netcdf directories + explicitly for bangkok. +M models/atm/cam/src/control/con_cam.F90 + Move start of timers to earlier in program. +M models/SVN_EXTERNAL_DIRECTORIES + Update to share3_060814. Fixes problem in shr_file_mod for phoenix. + +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. + +bluesky: all tests pass + +tempest: all tests pass + +bangkok/lf95: all tests pass + +Summarize any changes to answers: bit-for-bit + +=============================================================== +=============================================================== + +Tag name: cam3_3_19 +Originator(s): Jim Edwards (homme, history, phys_grid), + Rory Kelly (homme), + Pat Worley (phys_grid) +Date: 8-14-2006 +One-line Summary: Moved dynamic core specific functions from history + to specific cores. + +Purpose of changes: Continuing work on general dynamics/physics API + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: None + +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: Originators, Brian Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: + + The dynamics fields that were previously added to the history output from + the history_defaults file have been moved to dyn_init so that each dycore + is responsible for declaring the fields for which outfld calls will be made + using the dynamics decomposition. + + Moving addfld calls into dyn_init created a circular dependency, i.e., + + dyn_comp -> history -> io_dist -> dyn_comp + + io_dist uses dyn_state (in dyn_comp) to access the decomposition info + needed for gathers. We broke the chain by putting dyn_state in a separate + module, i.e., + + dyn_comp -> history -> io_dist -> dyn_internal_state + + Another side effect of moving addfld calls into dyn_init was to require + moving the setting of the dyngrid_set variable (and give it the more + appropriate name dyndecomp_set) to a place in front of these calls. It was + previously being set in initcom which is after the dyn_init call. It + should be set as soon as the parameters that determine the dynamics + decomposition are known. It can probably still be set earlier than it is + currently. + + The gather/scatter methods in phys_grid have been modified to work when the + global field is on either a lat/lon grid or an unstructured grid. + (Contributed by Pat Worley.) + + The wrapper routines in wrap_nf have been moved into a module. This + provides interface checking for these routines. + + More work has been done to the dycore interface for HOMME in the + dynamics/homme directory. This work is still in progress. + + +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. + +bluesky: all tests pass + +tempest: all tests pass + +bangkok/lf95: all tests pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_18 +Originator(s): bundy (Dani Bundy Coleman) +Date: Aug 11 2006 +One-line Summary: Fix and improve prognostic aerosol packages + +Purpose of changes: Some of the existing prognostic aerosol packages +did not function out-of-the-box. Furthermore, the dust package was +outdated, the sea salt was actually diagnostic and the carbon +offered only one simple scenerio. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: +Added configure option for prognostic aerosol packages + -prog_aero sulfur,caer4,caer16,dust,seasalt +Invoke with comma-separated list of any combination of the above. +This adds the correct number of advected constituents to the build and +defines cpp tokens required for dust, seasalt and the new 16-constituent +carbon aerosol package. + +Describe any changes made to the namelist: +The configure option for prognostic aerosols is used by build-namelist to + set namelist variables related to the aerosol packages. +Added namelist variables to control implementation & feedback of dust & sea salt. + aero_progsslt + Set to .TRUE. to turn on prognostic seal salt aerosols + should be set by build-namelist, as needs cppdefs too + aero_feedback_progsslt + Set to .TRUE. to enable feedback of prognostic sea salt + aerosols. NOT YET IMPLEMENTED + aero_dust + Set to .TRUE. to turn on dust prognostic aerosols + should be set by build-namelist, as needs cppdefs too + aero_feedback_dust + Set to .TRUE. to enable feedback of dust + prognostic aerosols. + +To avoid confusion with the existing co_emis_file namelist variable, + renamed emissions file for prognostic carbon aerosol: +OLD co_emis +NEW caer_emis + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none +When run without aerosols, there are no changes. + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: +models/atm/cam/src/physics/cam1/dust.F90 + module information moved to (existing) dust_intr.F90 + +List all subroutines added and what they do: +models/atm/cam/src/physics/cam1/progseasalts_intr.F90 + new module includes methods for registering, initializing, setting + indices, and calculating sinks of prognostic sea salt aerosol + progseasalts_register_cnst + progseasalts_init_cnst + set_progseasalts_idx + progseasalts_initialize + progseasalts_time_interp + ProgseasaltsDryDep +models/atm/cam/src/control/camsrfexch_types.F90 + hub2atm_setopts + called by dust.F90:dust_register_cnst to allocate ram1 & fv in srfflx_state +models/atm/cam/src/physics/cam1/aerosol_intr.F90 + aerosol_getopts ! get runtime options + +Also added +models/drv/seq_flds/dust +models/drv/seq_flds/dust/seq_flds_mod.F90 + add tokens for new exchange components in x2a and l2x strings + +List all existing files that have been modified, and describe the changes: + +M models/atm/cam/bld/CAM_config.pm + add AEROSOLS attribute + +M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + changed co_emis to caer_emis + add caer_emis_16 + +M models/atm/cam/bld/cam_inparm.pm + Add AEROSOLS attribute to namelist object + Use settings from config_cache to set aero_carbon and caer_emis + All carbon surface emissions in caer_emis + Use config_cache to set prognostic_sulfur and prescribed_sulfur + Use config_cache to set soil_erod + +M models/atm/cam/bld/config_cam_eul_defaults.xml +M models/atm/cam/bld/config_cam_fv_defaults.xml +M models/atm/cam/bld/config_cam_homme_defaults.xml +M models/atm/cam/bld/config_cam_sld_defaults.xml +M models/atm/cam/bld/config_trop_chem_mozart_defaults.xml +M models/atm/cam/bld/config_waccm_ghg_defaults.xml +M models/atm/cam/bld/config_waccm_mozart_defaults.xml + add prog_aero to defaults xml files + +M models/atm/cam/bld/configure + add "-prog_aero " option + add consistency check for specified packages + increment nadv with the number of constituents in specified packages + +M models/atm/cam/src/control/atm_comp_mct.F90 + transfer fv, ram1 & dust fluxes if dust or progseasalt is running + +M models/atm/cam/src/control/camsrfexch_types.F90 + add ram1,fv to srfflx_state type definition + add subroutine hub2atm_setopts( aero_dust_in ) + called by dust.F90:dust_register_cnst + to allocate ram1 & fv pointers + +M models/atm/cam/src/control/runtime_opts.F90 + change namelist var co_emis to caer_emis + changed comments about sea salt to diagnostic + added namelist variables for prognostic sea salt & dust + +M models/atm/cam/src/physics/cam1/aer_optics.F90 + if prognostic dust is running, use different optics + +M models/atm/cam/src/physics/cam1/aerosol_intr.F90 + new subroutine aerosol_getopts to get run-time settings + add dust & progseasalt implementation & control flags + take out old ifdef DUSTs + initialize dry deposition module if any aerosol is running + generalize interfaces to carbon_intr + +M models/atm/cam/src/physics/cam1/caer.F90 + add new carbon aerosol scenario with 16 constituents + invoke with configure -prog_aero caer16 + +M models/atm/cam/src/physics/cam1/caerbnd.F90 + add new caer16 carbon emission scenario + +M models/atm/cam/src/physics/cam1/carbon_intr.F90 + generalize interface for both caer4 & caer16 packages + +D models/atm/cam/src/physics/cam1/dust.F90 + moved information into dust_intr.F90 + +M models/atm/cam/src/physics/cam1/dust_intr.F90 + move calcarm, d3ddflux subroutines to drydep_mod.F90 + moved dust.F90 information into dust_intr.F90 + +M models/atm/cam/src/physics/cam1/hk_conv.F90 + modify checks for small constituent values + causes roundoff diffs to any constituent with mixing ration < 1.e-300 + +M models/atm/cam/src/physics/cam1/physpkg.F90 + remove ram1, fv from comsrf + +A models/atm/cam/src/physics/cam1/progseasalts_intr.F90 + new module to handle prognostic sea salt aersols + +M models/atm/cam/src/physics/cam1/seasalt_intr.F90 + added method to return ixsslt + +M models/atm/cam/src/physics/cam1/sulchem.F90 + add wet deposition diagnostics to dummy args of chemwdepdr + +M models/atm/cam/src/physics/cam1/sulfur_intr.F90 + add SO4 wet deposition diagnostics to history (not default) + remove call to inidrydep (now down in aerosol_intr if any aerosol is running) + move outfld calls to sulfur_wet_intr from chemwdepdr + +M models/atm/cam/src/physics/cam1/tphysac.F90 + remove fv and ram1 dummy args (in srfflx_state2d?) + pass srfflx_state2d to aerosol_drydep_intr instead of its components + +M models/atm/cam/src/physics/cam1/wetdep.F90 + add optional args to wetdepa + +A models/drv/seq_flds/dust +A models/drv/seq_flds/dust/seq_flds_mod.F90 + added directory for configure-time dust options + add tokens for new exchange components in x2a and l2x strings + +M models/drv/seq_flds_indices/seq_flds_indices.F90 + add indices for fv, ram1, flxdst[1-4] in x2a, l2x sections (no ifdefs here) + +M models/drv/seq_mct/mrg_x2a_mct.F90 + copy from surface attribute vectors to atm attvec + +NOTE these land mods were checked into the clm trunk with clm3_expa_64 +M src/biogeochem/DUSTMod.F90 + OLD dmt_vma = 2.524e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 + NEW dmt_vma = 3.500e-6_r8 ! [m] Mass median diameter analytic +M src/main/clm_atmlnd.F90 + add land-to-atmosphere communication of fv,ram1 & dust fluxes + (only active if defined DUST or PROGSEASALT ) +M src/main/lnd_comp_mct.F90 + add land-to-atmosphere communication of fv,ram1 & dust fluxes + (only active if defined DUST or PROGSEASALT ) + +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. + +bluesky: +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! + Round-off changes to chemistry constituents Np and N2p are caused + by a modification to the Hack shallow convection scheme + models/atm/cam/src/physics/cam1/hk_conv.F90 + +tempest: all PASS + +bangkok/lf95: all PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: waccm_mozart +- what platforms/compilers: bluesky tested, probably all +- nature of change (roundoff; larger than roundoff but same climate; new + climate): roundoff + +If bitwise differences were observed, how did you show they were no worse +than roundoff? cprnc output shows 2 diffs in an array of 218592 elements; +code change only operates on numbers less than 1.e-300 + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., + +=============================================================== + +Tag name: cam3_3_17 +Originator(s): mvr +Date: +One-line Summary: update to clm3_expa_66; work-around for bluevista +compiler bug; update to new pgi compiler and libs + +Purpose of changes: wanted to use new pgi compilers which meant an +update to clm tag with work-around for code the compilers didn't like; +new operating system on bluevista forced some mods in the build +system and test scripts + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: +- removed noopt flag from compile and link commands in debug,smp mode + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: +- added spun-up CAM and CLM initial files for the FV 0.9x1.25 resolution. + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: +M models/atm/cam/test/system/TSB.ccsm.sh +M models/atm/cam/test/system/TCT.ccsm.sh +- modified for ccsm test to work in new bluevista os + +M models/atm/cam/test/system/TBL.sh +M models/atm/cam/test/system/TBR.sh +M models/atm/cam/test/system/TER.sh +M models/atm/cam/test/system/TRX.sh +M models/atm/cam/test/system/TEQ.sh +- test scripts modified to do ALL output file comparisons, even if one fails + +M models/atm/cam/test/system/test_driver.sh +- modified for new bluevista os; updated bangkok libraries and 6.1-3 pgi compiler + +M models/atm/cam/tools/scam/ui/configure +- updated to link with pgi 6.1-3 libraries + +M models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml +M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml +- added spun-up CAM and CLM initial files for the FV 0.9x1.25 resolution. + +M models/atm/cam/bld/Makefile.in +- removed noopt flag from compile and link commands in debug,smp mode (work- + around for bluevista compiler bug) + +M models/atm/cam/bld/run-ibm.csh +- updated to work on bluevista as well as bluesky + +M models/atm/cam/bld/run-pc.csh +- updated bangkok libraries and 6.1-3 pgi compiler + +M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 +- bug fix for out-of-bounds array reference caught by pgi compiler + +M models/SVN_EXTERNAL_DIRECTORIES +- updated to new clm tag (clm3_expa_66) + +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. + +bluesky: +005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 +008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 +010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 7 +013 bl134 TBL.sh e32dh adia 9 .....................................FAIL! rc= 7 +019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 +044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 +047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 +049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 7 +052 bl534 TBL.sh s32dh adia 9 .....................................FAIL! rc= 7 +055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 + +-all baseline tests in debug mode running omp fail due to removal of noopt flag +-ccsm test fails, but passes when using ccsm sandbox with upcoming mods + +tempest: +all PASS + +bangkok/lf95: +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 5 + +-these were deemed acceptable roundoff errors + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: non-debug +- what platforms/compilers: bangkok/lf95 +- nature of change (roundoff; larger than roundoff but same climate; new + climate): roundoff + +If bitwise differences were observed, how did you show they were no worse +than roundoff? analysis of nstep0 differences + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== +Tag name: cam3_3_16 +Originator(s): Will Sawyer, Art Mirin +Date: Wed Jul 19 02:15:17 MDT 2006 +One-line Summary: + +Purpose of changes: Upgrade to newest pilgrim version; + streamlining of FV to remove unneeded allocations; + resynching FV dycore with that from GEOS5; + corrections in namelists for high resolution runs; + update of FV namelist options (removal of set_eta); + update of benergy to run with XY decomposition + +Bugs fixed (include bugzilla ID): (following have no bugzilla ID) + D-resolution runs on Phoenix (reported by Worley) + Conservative-mode bug (reported by Suarez in GEOS5) + Compilation bug tp_core.F90 (reported by Trayanov in GEOS5) + Tracer transpose bug on certain architectures (e.g. Linux) + with mod_method=1 (reported by Mirin, et al.) + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + Removed use_eta (comctl) + Added dyn_conservative (comctl) + Changes to the names of Topo, SST and initial files for + 0.9x1.25 and 0.5x0.625 resolutions. + +List any changes to the defaults for the boundary datasets: + RESOLUTION="0.9x1.25">atm/cam/topo/USGS-gtopo30_0.9x1.25_remap_c051027.nc + RESOLUTION="0.5x0.625" >atm/cam/sst/sst_HadOIBl_bc_0.5x0.625_1949_2001_c040402.nc + +Describe any substantial timing or memory changes: + FV memory usage has decreased -- intermediate buffering of + tracers is being avoided. + +Code reviewed by: ourselves + +List all subroutines eliminated: + set_decomp, y_decomp (mod_comm) -- no longer used + create_vars, restore_vars, record_state, record_vars, + destroy_state, destroy_vars (dyn_comp) -- no longer used + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + +M models/utils/pilgrim/parutilitiesmodule.F90 + -- Changes to initialization routine to support revised mod_comm + -- Changed default communication method to mod_method=0 + -- MPI types only initialized for mod_method=1 + -- Updated documentation + +M models/utils/pilgrim/mod_comm.F90 + -- Extensive refactoring and updates to documentation + -- Dynamic allocation of buffers (minimalistic, local allocation) + -- Removal of mod_method=3 (MPI1) + +M models/atm/cam/bld/DefaultCLM_INPARM_Namelist.xml +M models/atm/cam/bld/DefaultCAM_INPARM_Namelist.xml + -- Changed default files for 0.9x1.25 and 0.5x0.625 resolutions. + +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/control/comctl.h + -- Added dyn_conservative, modcomm_gatscat + -- removed use_eta, tracertrans + +M models/atm/cam/src/physics/cam1/phys_grid.F90 + -- Changes to modmax_alltoall method (now method 13) + +M models/atm/cam/src/dynamics/sld/spmd_dyn.F90 +M models/atm/cam/src/dynamics/eul/spmd_dyn.F90 + -- Added dyn_conservative, modcomm_gatscat + -- removed use_eta, tracertrans + +M models/atm/cam/src/dynamics/fv/pmgrid.F90 + -- Added mod_gatscat method, default = 0 + +M models/atm/cam/src/dynamics/fv/benergy.F90 + -- Extensively rewritten to support XY decomposition (instead of YZ) + +M models/atm/cam/src/dynamics/fv/tp_core.F90 + -- Compilation bug fixed (reported by Trayanov in GEOS5) + +M models/atm/cam/src/dynamics/fv/par_xsum.F90 + -- Sequential execution bug fix, refactoring + +M models/atm/cam/src/dynamics/fv/dp_coupling.F90 +M models/atm/cam/src/dynamics/fv/dryairm.F90 + -- Introduced T_TRACERS type for constituents + +M models/atm/cam/src/dynamics/fv/inidat.F90 + -- Introduced T_TRACERS type for constituents + -- T3 array has become i,j,k (was i,k,j) + +M models/atm/cam/src/dynamics/fv/dyn_comp.F90 + -- Introduced T_TRACERS type for constituents + -- Introduced dyn_conservative mode + -- Removed unneeded allocations, removed unneeded subroutines + -- Moved location of call to benergy into XY decomposition section + +M models/atm/cam/src/dynamics/fv/p_d_adjust.F90 + -- Introduced T_TRACERS type for constituents + +M models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + -- Added dyn_conservative, modcomm_gatscat + -- removed use_eta, tracertrans + -- changed location and argument list of parinit() + +M models/atm/cam/src/dynamics/fv/inital.F90 + -- Revised call to dyn_init + +M models/atm/cam/src/dynamics/fv/cd_core.F90 + -- cosmetic changes to FVstart/stopclock + +M models/atm/cam/src/dynamics/fv/sw_core.F90 + -- loop index bug fixed (reported by Putman) + +M models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 + -- T3 array has become i,j,k (was i,k,j) + -- Introduced T_TRACERS type for constituents + +M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 + -- Bug fix for conservation mode (now: grid%klastp = km_in+1) + -- Added ACOSU + +M models/atm/cam/src/dynamics/fv/geopk.F90 + -- Changes for mod_geopk mode to reduce MPI_TYPE usage + +M models/atm/cam/src/dynamics/fv/stepon.F90 + -- Removed set_eta code (namelist variable: use_eta) + -- Introduced T_TRACERS type for constituents + +M models/atm/cam/src/dynamics/fv/fv_prints.F90 + -- Introduced T_TRACERS type for constituents + +M models/atm/cam/src/dynamics/fv/restart_dynamics.F90 + -- Introduced T_TRACERS type for constituents + -- Revised call to dyn_init + +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. + +bluesky: All tests pass except the CCSM comparison test + + 055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 + + Justification: was failing in cam3_3_14 and 15. See explanations there. + +tempest: all tests passed + +bangkok/lf95: all tests passed + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + ==> No changes to answers + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: no change + +URL for AMWG diagnostics output used to validate new climate: no change + +=============================================================== +=============================================================== + +Tag name: cam3_3_15 +Originator(s): Erik Kluzek +Date: Thu Jul 13 21:17:44 MDT 2006 +One-line Summary: + +Purpose of changes: Put in top level initialization and clock objects at driver level + for moving forward with sequential CCSM. + + This separates out the driver from the internals of the CAM time-manager. Making + the top level driver separable from CAM itself, and moves it toward a Sequential + CCSM where the sub-components can be swapped for other CCSM components (such + as the CCSM data models or active ice and active ocean models). + +Bugs fixed (include bugzilla ID): 153 + + Fix bug in test_driver.sh where if BL_ROOT was NOT set -- it would erase the + entire contents of your /ptmp/$USER directory after it was finished. + +Describe any changes made to build system: Add csm_share/eshr directory to Filepath + +Describe any changes made to the namelist: Split into 4 namelists. + + ccsm_inparm ----- Sequential CCSM driver level initialization information + (passed to all subcomponent models: atm, lnd, ice, ocn) + timemgr_inparm -- Sequential CCSM driver level clock information + (passed to all subcomponent models: atm, lnd, ice, ocn) + cam_inparm ------ CAM specific namelist + clm_inparm ------ CLM specific namelist + +The ccsm_inparm namelist is managed by the shr_inputInfo_mod.F90 module and objects. +The timemgr_inparm namelist is managed by the eshr_timemgr_mod.F90 module and objects. +These are both sequential CCSM top level driver objects that are passed into +sub-components (atmosphere, land, sea-ice, and ocean) to manage information that is +shared between sub-components. + +CHANGE SO THAT THE NAMELIST IS NO LONGER READ FROM STDIN -- THE NAMELIST NAME IS +ASSUMED AND THE FILE OPENED EXPLICITLY. When namelists read the file is opened, and +namelists are read until the correct one is found, then the file is closed. If the +needed namelist does not exist -- OR THERE IS AN ERROR IN IT -- the program will abort +with an error. + +The interface to build-namelist still uses the input namelists of: camexp and clmexp +and will divide the relevant namelist items to the appropriate namelists. + +Option added to build-namelist: -ignore_ic_date + +by default build-namelist will match the start date/time (start_ymd,start_tod) for +initial condition datasets. If a suitable dataset with the correct starting date +(as well as resolution and other matching criteria) isn't found -- an initial condition +dataset will NOT be provided. + +If you use the -ignore_ic_date option is used datasets will be matched without +examining the starting date/time of the dataset. + +Namelist items removed: + + restart_nsteps --> use restart_option and restart_n + restart_nhours --> use restart_option and restart_n + restart_ndays ---> use restart_option and restart_n + restart_monthly -> use restart_option and restart_n + restart_yearly --> use restart_option and restart_n + no_restart ------> use restart_option and restart_n + nelapse ---------> use stop_option and stop_n + nestep ----------> Functionality removed + nsrest ----------> Use start_type + +Namelist items moved to different namelist: + + Old namelist item New namelist used in + ================= ==================== + archive_dir ccsm_inparm (now refers to the top level archive directory) + aqua_planet ccsm_inparm + brnch_retain_casename ccsm_inparm + mss_irt ccsm_inparm + mss_wpass ccsm_inparm + calendar timemgr_inparm + stop_ymd timemgr_inparm + stop_tod timemgr_inparm + start_ymd timemgr_inparm + start_tod timemgr_inparm + ref_ymd timemgr_inparm + ref_tod timemgr_inparm + perpetual_run timemgr_inparm + perpetual_ymd timemgr_inparm + +Namelist items that changed names: + + Old namelist item New namelist item name New namelist used in + ================= ====================== ==================== + eccen orb_eccen timemgr_inparm + obliq orb_obliq timemgr_inparm + mvelp orb_mvelp timemgr_inparm + iyear_AD orb_iyear_AD timemgr_inparm + ctitle case_desc ccsm_inparm + caseid case_name ccsm_inparm + adiabatic atm_adiabatic ccsm_inparm + ideal_phys atm_ideal_phys ccsm_inparm + +Namelist items added: + + Namelist item Description New namelist used in + ========================= ====================================== ==================== + start_type ---------------> How simulation will startup ccsm_inparm + Valid options: + + startup = Use initial files + continue = Use restart files to continue simulation + branch = Use restart files to branch simulation + + restart_pfile ------------> Driver level restart pointer file name ccsm_inparm + restart_file -------------> Driver level restart file name ccsm_inparm + restart_file_override ----> Override list of items from restart file ccsm_inparm ** + restart_file_TGRoverride -> Override list of items from restart file ccsm_inparm ** + restart_option -----------> Driver level restart frequency type timemgr_inparm + Valid options: + + nsteps ---- Write restarts every restart_n time-steps + ndays ----- Write restarts every restart_n days + nmonths --- Write restarts every restart_n months + nyears ---- Write restarts every restart_n years + monthly --- Write restarts at beginning of each month + yearly ---- Write restarts at beginning of the year + end ------- Write restarts only at end of simulation + none ------ Don't write any restarts + + restart_n ----------------> Driver level restart frequency value timemgr_inparm + stop_option --------------> Driver level restart frequency type timemgr_inparm + Valid options: + + nsteps ---- Stop after stop_n time-steps + ndays ----- Stop after stop_n days + nmonths --- Stop after stop_n months + nyears ---- Stop after stop_n years + date ------ Stop at stop_ymd/stop_tod date/time + + stop_n -------------------> Driver level restart frequency value timemgr_inparm + stop_final_ymd -----------> The final date to run to (YYYYMMDD format) timemgr_inparm + atm_cpl_dt ---------------> Atmosphere coupling frequency (sec) timemgr_inparm + +Example creation of the old and new namelist using build-namelist: + +With cam3_3_14: + + build-namelist -runtype initial -namelist "&camexp nelapse=-1, restart_monthly=.true., iyear_AD=1990/ " + +with cam3_3_15: + + build-namelist -runtype startup -namelist "&camexp stop_option='ndays', stop_n=1, restart_option='monthly' , orb_iyear_AD=1990 /" + +So build-namelist figures out that all of the above options belong in the timemgr_inparm namelist +and deal with it appropriately. And results in the following namelist: + +&ccsm_inparm + case_name = 'camrun' + start_type = "startup" +/ +&timemgr_inparm + atm_cpl_dt = 1200 + orb_iyear_ad = 1950 + restart_option = 'monthly' + start_ymd = 901 + stop_n = 1 + stop_option = 'ndays' +/ +&cam_inparm + absems_data = '/fs/cgd/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' + aeroptics = '/fs/cgd/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' + bnd_topo = '/fs/cgd/csm/inputdata/atm/cam/topo/USGS-gtopo30_64x128_c050520.nc' + bndtvaer = '/fs/cgd/csm/inputdata/atm/cam/rad/AerosolMass_V_64x128_clim_c031022.nc' + bndtvo = '/fs/cgd/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' + bndtvs = '/fs/cgd/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_64x128_clim_c020411.nc' + dtime = 1200 + ncdata = '/fs/cgd/csm/inputdata/atm/cam/inic/gaus/cami_0000-09-01_64x128_L26_c030918.nc' +/ +&clm_inparm + fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' + fsurdat = '/fs/cgd/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_64x128_c050523.nc' +/ + +How to override information on the restart file from the namelist: ** + + By default for a continue or branch type of simulation -- driver information is + read from the restart file and namelist information is ignored. In order to explicitly + use driver level restart information you have to do the following: + + 1.) Set given namelist item(s) you want to override. + 2.) Set restart_file_override (or restart_file_TGRoverride for timemgr_inparm namelist) + to include the colon delimited list of items you want to override on the namelist. + 3.) To override the case_name -- set the brnch_retain_casename namelist item to true. + + List of ccsm_inparm items that can be overridden: mss_irt, mss_wpass, and case_desc + (and case_name is brnch_retain_casename is set to true) + List of timemgr_inparm items that can be overridden: restart_option, restart_n + + Examples + + build-namelist -runtype continue -namelist \ + "&camexp mss_irt=45, mss_wpass='example', restart_file_override='mss_irt:mss_wpass' /" + + The above example will override the values of mss_irt, mss_wpass from the restart file + with those given on the namelist. Note if restart_file_override were missing, the + values on the restart file would be used an the values on the namelist ignored. + + build-namelist -runtype continue -namelist \ + "&camexp restart_option='nyears', restart_n=2, restart_file_TGRoverride='restart_option:restart_n' /" + + The above example will override the values of restart_option, and restart_n from + the restart file with those given on the namelist. Note if restart_file_override + were missing, the values on the restart file would be used an the values on the + namelist ignored. + +List any changes to the defaults for the boundary datasets: make sure IC file names are + consistent with dates in file. + Also add ic_ymd and ic_tod to describe the date (YYYYMMDD format) and time-of-day (sec) + that the given initial condition file represents. + +Describe any substantial timing or memory changes: none + +Code reviewed by: Brian Eaton, Mariana Vertenstein, Mat Rothstein + +Externals updated: + share3_060710 ------------ Add shr_inputinfo_mod/eshr_timemgr_mod codes. + clm3_expa_65 ------------- Use new share objects. + esmf_wrf_timemgr_060616 -- Same behavior as ESMF, changes needed for new share. + MCT2_2_1_060706 ---------- Changes get_zeits.c to work on new bangkok compiler. + +List all subroutines eliminated: + + In models/atm/cam/src/control/restart.F90 <-- determine if restart from SyncClock + restart_init + restart_is_write_step + update_next_write_time + In models/atm/cam/src/utils/time_manager.F90 <-- remove unused functions. + get_clock + get_curr_ESMF_Time + calc_nestep <---- not needed as SynClock determines stop-time. + +List all subroutines added and what they do: + + runtime_opts_setNLFile (runtime_opts.F90) -- Set the namelist filename. + ccsmini_sendgridgetorb (ccsm_msg.F90) ------ Send grid and get orbit info + at initialization. + get_calendar (time_manager.F90) ------------ Get calendar type using. + timemgr_check_restart (time_manager.F90) --- Check the restart info for consistency. + +List all files eliminated: + + atm/cam/bld/DefaultCLMEXPNamelist.xml (change name) + atm/cam/bld/clm2exp.pm (change name) + atm/cam/bld/CAM_namelist.p (change name) + atm/cam/bld/DefaultCAMEXPNamelist.xml (change name) + +List all files added and what they do: + + atm/cam/test/unit/control/filterhead.pl -- filters unit test log data to compare results + with a different version. + + atm/cam/bld/nl_descrips.pm --------------------- Describes the driver level namelists. + atm/cam/bld/clm_inparm.pm ---------------------- Manages the clm_inparm namelist. + atm/cam/bld/DefaultCAM_INPARM_Namelist.xml ----- Default values for the cam_inparm namelist. + atm/cam/bld/DefaultCLM_INPARM_Namelist.xml ----- Defaults for the clm_inparm + namelist (renamed from old CAMEXP file) + atm/cam/bld/DefaultTIMEMGR_INPARM_Namelist.xml - Default values for the timemgr_inparm namelist. + atm/cam/bld/DefaultCCSM_INPARM_Namelist.xml ---- Default values for the ccsm_inparm namelist. + atm/cam/bld/NamelistsDescriptions.xml ---------- List of items on driver level namelists. + atm/cam/bld/timemgr_inparm.pm ------------------ Manages the timemgr_inparm namelist. + atm/cam/bld/cam_inparm.pm ---------------------- Manages the cam_inparm namelist. + atm/cam/bld/SeqCCSM_namelist.pm ---------------- Manages all namelists needed. + atm/cam/bld/ccsm_inparm.pm --------------------- Manages the ccsm_inparm namelist + +List all existing files that have been modified, and describe the changes: + + Pass CCSMInit and SyncClock objects down to sub-models. + + ocn/dom/ocn_comp_mct.F90 + ocn/som/ocn_comp_mct.F90 + ice/csim4/ice_comp_mct.F90 + + Update unit tests for time_manager module. + + atm/cam/test/unit/control/configure + atm/cam/test/unit/control/run_time_test + atm/cam/test/unit/control/test_time.F90 + + Change test_driver system to work with new build-namelist options and new + namelist behavior and changes to namelist item names. + + atm/cam/test/system/test_driver.sh + atm/cam/test/system/TSB.ccsm.sh + atm/cam/test/system/TBR.sh + atm/cam/test/system/TER.sh + atm/cam/test/system/TRX.sh + atm/cam/test/system/TSM.sh + atm/cam/test/system/nl_files/idphys + atm/cam/test/system/nl_files/ghgrmp + atm/cam/test/system/nl_files/outfrq3s + atm/cam/test/system/nl_files/aqpgro + atm/cam/test/system/nl_files/no_ttrac + atm/cam/test/system/nl_files/off2x2.5 + atm/cam/test/system/nl_files/pghgsul + atm/cam/test/system/nl_files/ttrac_lb1 + atm/cam/test/system/nl_files/ttrac_lb2 + atm/cam/test/system/nl_files/ttrac + atm/cam/test/system/nl_files/ttrac_lb3 + atm/cam/test/system/nl_files/adia + atm/cam/test/system/nl_files/outfrq24h + + Pass CCSMInit and SyncClock objects down as appropriate into scam. Upgrade + make to work with new PGI compiler on bangkok. + + atm/cam/tools/scam/configure + atm/cam/tools/scam/testscript + atm/cam/tools/scam/userdata/crmtest26.out <--- Needed for compiler upgrade on bangkok. + atm/cam/tools/scam/ui/configure + atm/cam/tools/scam/scm_init/init_model.F90 + atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 + atm/cam/tools/scam/scm_init/scam_run.F90 + atm/cam/tools/scam/scm_init/inital.F90 + atm/cam/tools/scam/scm_init/scamMod.F90 + atm/cam/tools/scam/scm_init/setiopupdate.F90 + + Work with new PGI compiler on bangkok. Add eshr to Filepath. + Changes to get Darwin (Mac OS-X) to work. Remove HIDE_SHR_MSG as + unneeded now. + + atm/cam/bld/configure + atm/cam/bld/Makefile.in + + Change to work in the context of the 4 new namelists. Add -ignore_ic_date option + in. Have CAM_config.pm keep track of new items added to the XML configuration file. + + atm/cam/bld/build-namelist + atm/cam/bld/clmexp.pm + atm/cam/bld/namelist.pm + atm/cam/bld/camexp.pm + atm/cam/bld/atmlndnl.pm + atm/cam/bld/CAM_config.pm + + Change run scripts to work with new build-namelist and do NOT redirect stdin. + + atm/cam/bld/run-ibm.csh + atm/cam/bld/run-pc.csh + atm/cam/bld/run-sgi.csh + atm/cam/bld/run-lightning.csh + atm/cam/bld/run-darwin.csh + + Pass CCSMInit and SyncClock objects down as needed. Use them to + initialize CAM internal data. + + atm/cam/src/control/readinitial.F90 + atm/cam/src/control/runtime_opts.F90 + atm/cam/src/control/restart.F90 + atm/cam/src/control/history.F90 + atm/cam/src/control/atm_comp_mct.F90 + atm/cam/src/control/startup_initialconds.F90 + atm/cam/src/control/units.F90 + atm/cam/src/control/filenames.F90 + atm/cam/src/control/ioFileMod.F90 + atm/cam/src/control/cam_comp.F90 + atm/cam/src/utils/time_manager.F90 + atm/cam/src/dynamics/fv/metdata.F90 + + Create CCSMInit and SyncClock driver level data at top level concurrent CAM + driver pass down as needed. Set orbital information in SyncClock from data sent + from coupler. + + atm/cam/src/control/con_cam.F90 + atm/cam/src/control/ccsm_msg.F90 + + Remove dependence on CAM specific data and modules and use CCSMInit + and SyncClock driver level objects. + + drv/seq_mct_drv/seq_ccsm_drv.F90 + drv/seq_mct/mrg_x2a_mct.F90 + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: All tests pass except the CCSM comparison test + + 055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 + + CCSM failed because the new CCSM scripts for this tag don't work with the old CAM + Thus the comparison to the old CCSM tag and cam3_3_14 had to be done by hand. + The comparison is exact if esmf_wrf_timemgr is updated in cam3_3_14 to + esmf_wrf_timemgr_051212. If not the difference is bit-for-bit until the 25th time-step + when the difference is off by roundoff. This was documented in the cam3_3_4 commit + where we had a roundoff difference due to the new esmf_wrf_timemgr. + + For running CCSM test use: + + env CAM_CCSMROOT=/fs/cgd/csm/models/atm/newchg_ccsm3_1_beta34 + +tempest: none + +bangkok/lf95: none + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_3_14 + +Summarize any changes to answers: none (bit-for-bit) + CCSM (changes to roundoff) + + CCSM answers change because esmf_wrf_timemgr updated from an + older version 050309 to the version used here 060616. + +=============================================================== +=============================================================== + +Tag name: cam3_3_14 +Originator(s): mvr +Date: 060612 +One-line Summary: +Update the ccsm tests within cam's test suite to reflect new changes to +ccsm's scripts; minor bug fixes to test scripts; cray x1 mods in newcprnc + +Purpose of changes: new naming conventions were introduced to ccsm's +test scripts; newcprnc required mods for cray x1 + +Bugs fixed (include bugzilla ID): applied fix for bug #43 to cam's newcprnc +code just as it was applied to clm's + +Describe any changes made to build system: none + +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: myself + +List all subroutines eliminated: +D models/atm/cam/tools/newcprnc/cprnc.f90 +- file renamed due to pre-processor directives added for cray x1 + +List all subroutines added and what they do: +A + models/atm/cam/tools/newcprnc/cprnc.F90 +- new file with directives for cray x1 + +List all existing files that have been modified, and describe the changes: +M models/atm/cam/test/system/TSB.ccsm.sh +- mods to reflect name changes introduced in ccsm scripts; added cleanup after + successful ccsm test; minor bug fixes +M models/atm/cam/test/system/TCT.ccsm.sh +- mods to reflect name changes introduced in ccsm scripts; now dumps output +of create_test to output log +M models/atm/cam/test/system/test_driver.sh +- test suite now uses prod queue rather than debug on phoenix +M models/atm/cam/test/system/gen_test_table.sh +- utility updated to include all platforms supported by cam's test driver +M models/atm/cam/test/system/input_tests_master +- mods to reflect name changes introduced in ccsm scripts +M models/atm/cam/test/system/TCB.ccsm.sh +- mods to reflect name changes introduced in ccsm scripts +M models/atm/cam/tools/newcprnc/nfwrappers.f90 +- bug fix for intent of variables in wrap_open (see bug #43) +M models/atm/cam/tools/newcprnc/Makefile +- added mods for cray x1 +M posttag_cron_bangkok.sh +M posttag_cron_bluesky.sh +M posttag_cron_lightning.sh +M posttag_cron_bluevista.sh +- cron scripts modified to make use of "collections" area for cam tags + + +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. + +bluesky: +055 cs998 TCS.ccsm.sh ERS f19_g13 K ...............................FAIL! rc= 2 +- ccsm test fails when comparing to baseline due to changes in naming + conventions...tests were verified by hand + +tempest: all pass + +bangkok/lf95: all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +Tag name: cam3_3_13 +Originator(s): Jim Edwards +Date: 060606 +One-line Summary: addition of HOMME dynamic core, removal of plat/plon from physics + +Purpose of changes: development of a new dynamic core prototype, generalization of + model to non-rectangular horizontal grids + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: Added support for homme dynamics in configure. + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, Brian Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: a dynamics/homme subdirectory was added + with stubs to interface the (external) homme model +A models/atm/cam/src/dynamics/homme + A models/atm/cam/src/dynamics/homme/initcom.F90 + A models/atm/cam/src/dynamics/homme/pmgrid.F90 + A models/atm/cam/src/dynamics/homme/dp_coupling.F90 + A models/atm/cam/src/dynamics/homme/dycore.F90 + A models/atm/cam/src/dynamics/homme/dyn_comp.F90 + A models/atm/cam/src/dynamics/homme/inidat.F90 + A models/atm/cam/src/dynamics/homme/stepon.F90 + A models/atm/cam/src/dynamics/homme/restart_dynamics.F90 + A models/atm/cam/src/dynamics/homme/commap.F90 + A models/atm/cam/src/dynamics/homme/spmd_dyn.F90 + A models/atm/cam/src/dynamics/homme/dyn_grid.F90 + A models/atm/cam/src/dynamics/homme/README + A models/atm/cam/src/dynamics/homme/inital.F90 + A models/atm/cam/bld/config_cam_homme_defaults.xml +List all existing files that have been modified, and describe the changes: + Changed FV CPP macro STAGGERED to the more appropriate and general DYN_STATE_INTERFACE + + U models/atm/cam/src/control/runtime_opts.F90 + U models/atm/cam/src/control/ccsm_msg.F90 + U models/atm/cam/src/control/startup_initialconds.F90 + U models/atm/cam/src/control/cam_comp.F90 + U models/atm/cam/src/utils/time_manager.F90 + + Removed references to plat and plon. + + U models/atm/cam/src/physics/cam1/comsrf.F90 + U models/atm/cam/src/physics/cam1/dmsbnd.F90 + U models/atm/cam/src/physics/cam1/acbnd.F90 + U models/atm/cam/src/physics/cam1/dust_intr.F90 + U models/atm/cam/src/physics/cam1/tracers_suite.F90 + U models/atm/cam/src/physics/cam1/boundarydata.F90 + U models/atm/cam/src/physics/cam1/drydep_mod.F90 + U models/atm/cam/src/physics/cam1/restart_physics.F90 + U models/atm/cam/src/physics/cam1/stratiform.F90 + U models/atm/cam/src/physics/cam1/water_tracers.F90 + U models/atm/cam/src/physics/cam1/co2_data_flux.F90 + U models/atm/cam/src/physics/cam1/volcanicmass.F90 + U models/atm/cam/src/physics/cam1/physpkg.F90 + U models/atm/cam/src/physics/cam1/wetdep.F90 + U models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 + U models/atm/cam/src/physics/cam1/carbon_intr.F90 + U models/atm/cam/src/physics/cam1/sulchem.F90 + U models/atm/cam/src/physics/cam1/co2_cycle.F90 + U models/atm/cam/src/physics/cam1/sulbnd.F90 + U models/atm/cam/src/physics/cam1/soxbnd.F90 + U models/atm/cam/src/physics/cam1/caerbnd.F90 + U models/atm/cam/src/physics/cam1/aerosol_intr.F90 + U models/atm/cam/src/physics/cam1/advnce.F90 + U models/atm/cam/src/physics/cam1/sulfur_intr.F90 + + Added support for HOMME dycore + + U models/atm/cam/bld/configure + U models/atm/cam/bld/resolution_parameters.xml + + + + +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. + +bluesky: none + tested with CAM_CCSMROOT=/fs/cgd/csm/collections/ccsm3_1_beta29 + +tempest: none + +bangkok/lf95: none + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +Tag name: cam3_3_12 +Originator(s): mvr, jedwards +Date: 060602 +One-line Summary: test suite now supports phoenix (cray x1); + added testing of coupled model to bluevista; bug fix + for fv coupled runs + +Purpose of changes: wanted test coverage of cray x1; testing + of coupled model had been restricted to just bluesky; + new features in ccsm's scripts available for use + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: none + +Describe any changes made to the namelist: none + +List any changes to the defaults for the boundary datasets: +- added DMS_emmissions, oxid, and SOx_emissions files for fv 2x2.5 +- updated to newer SOx_emissions file for T85 + +Describe any substantial timing or memory changes: + +Code reviewed by: myself + +List all subroutines eliminated: +none + + +List all subroutines added and what they do: +A models/atm/cam/test/system/config_files/fmo2m +A models/atm/cam/test/system/config_files/f2c11m +A models/atm/cam/test/system/config_files/e128m +A models/atm/cam/test/system/config_files/e128c11m +A models/atm/cam/test/system/config_files/fm1.9m +A models/atm/cam/test/system/config_files/f1.9pm +A models/atm/cam/test/system/config_files/f1.9m +A models/atm/cam/test/system/config_files/e128pm +- new configuration options for testing on phoenix + +A models/atm/cam/test/system/nl_files/off2x2.5p +- new namelist options for testing on phoenix + +A models/atm/cam/test/system/TCT.ccsm.sh +- new test script needed for testing of coupled model + +A models/atm/cam/test/system/tests_posttag_phoenix +A models/atm/cam/test/system/tests_posttag_robin +- new sets of default posttag tests for robin and phoenix + + +List all existing files that have been modified, and describe the changes: +M models/atm/cam/test/system/TSB.ccsm.sh +M models/atm/cam/test/system/TCB.ccsm.sh +- scripts for testing of coupled model now supports bluevista, phoenix; + build of coupled model can now be done separately prior to run; + updated to take advantage of new features in ccsm scripts + +M models/atm/cam/test/system/tests_posttag_bluesky +M models/atm/cam/test/system/tests_pretag_bluesky +- defaults test sets modified to have fv ccsm test be pretag, eul posttag + +M models/atm/cam/test/system/tests_posttag_bluevista +- default posttag tests on bluevista now include ccsm tests + +M models/atm/cam/test/system/test_driver.sh +- support added for robin/phoenix; MPI_TYPE_MAX now set for all platforms + +M models/atm/cam/test/system/input_tests_master +M models/atm/cam/test/system/CAM_runcmnd.sh +- new tests added to master list for phoenix + +M models/atm/cam/bld/camexp.pm +- mod to allow for casenames of length 80 characters + +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml +- added default input files for fv 2x2.5; updated to a newer T85 file + +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/history.F90 +- bug fixes to remove call to getfil for files not yet in existence - + would fail on phoenix when it tried to find it on mass store + +M models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 +- bug fix for line length exceeding max number of characters + +M models/atm/cam/src/dynamics/fv/dyn_grid.F90 +- bug fix for problem introduced in cam3_3_11 for fv coupled runs + + +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. + +bluesky: +001 sb998 TSB.ccsm.sh ER.01a 1.9x2.5_gx1v3 K ......................FAIL! rc= 6 +055 cs998 TCS.ccsm.sh ER.01a 1.9x2.5_gx1v3 K ......................FAIL! rc= 2 +- failed due to mods in test scripts; test passes when run manually + +tempest: +all pass + +bangkok/lf95: +all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: fv ccsm test used cam3_3_10 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? b4b + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +Tag name: cam3_3_11 +Originator(s): pworley, Jim Edwards +Date: 5/25/2006 +One-line Summary: phys_grid changes for single index method to support non-rectangular grids + +Purpose of changes: to support non-rectangular grids + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, Brian Eaton, Mariana, Pat Worley + +List all subroutines eliminated: + cam_domain, + get_cid_all_p, + get_chunk_coord_owner_p, + get_chunk_owner_p + get_cid_p + get_block_coord_d + get_block_coord_cnt_d + get_block_col_cnt_d + get_lon_d + get_lat_d + + + + +List all subroutines added and what they do: + get_gcol_all_p, get the global column id for all columns in the chunk + get_area_all_p, get the area of all columns in the chunk + get_block_gcol_d get column indices for given block + get_gcol_block_d get global block indices and local columns index for given global column index + get_horiz_grid_d: provides the total number of global columns visible to the physics + the lat, lon location and the surface area of each column + + (functions) + get_area_p : get area of column + get_gcol_p : get gcol id of column + get_gcol_owner_p : get task of column gcol in physics + get_block_gcol_cnt_d : get number of columns in given block + get_gcol_block_cnt_d : get number of blocks containing data + from a given global column index + get_horiz_grid_cnt_d : get number of columns in dynamics grid (visible to physics) + + +List all existing files that have been modified, and describe the changes: + + The cam_domain module was removed and these files modified to + get the mct grid initialization data directly from the physics + chunk on the task. This is both a simplification and a generalization + of the method introduced in cam3_3_9 + + M models/ocn/dom/ocn_comp_mct.F90 + M models/ocn/som/ocn_comp_mct.F90 + M models/ice/csim4/ice_comp_mct.F90 + M models/atm/cam/src/control/ccsm_msg.F90 + M models/atm/cam/src/control/atm_comp_mct.F90 + M models/atm/cam/src/control/cam_comp.F90 + M models/drv/seq_mct/seq_domain_mct.F90 + + Chunks (decomposed grid in the physics) were changed from + 2-D arrays in the horizontal to 1D. + This allows the generalization of cam physics to + non-rectangular grids. + + M models/atm/cam/src/physics/cam1/physics_types.F90 + M models/atm/cam/src/physics/cam1/phys_grid.F90 + M models/atm/cam/src/dynamics/sld/dyn_grid.F90 + M models/atm/cam/src/dynamics/eul/dyn_grid.F90 + M models/atm/cam/src/dynamics/fv/dyn_grid.F90 + + Support for the historical reduced grid method has been removed + if a reduced grid is reintroduced in the future it should use the + more general method introduced here. + M models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_sulf.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 + M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_photo.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 + M models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 + M models/atm/cam/src/chemistry/waccm_mozart/mo_tgcm_ubc.F90 + M models/atm/cam/src/chemistry/waccm_mozart/mo_sulf.F90 + M models/atm/cam/src/chemistry/waccm_mozart/mo_airplane.F90 + M models/atm/cam/src/chemistry/waccm_mozart/mo_drydep.F90 + M models/atm/cam/src/chemistry/waccm_mozart/mo_srf_emissions.F90 + + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: All tests pass + +tempest: All tests pass + +bangkok/lf95: All tests pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_10 +Originator(s): mvr +Date: 060524 +One-line Summary: added gensom option to configure; added test of gensom + vars to test suite; updated externals to new timing files; cleanup + +Purpose of changes: SOM input fields should not be generated and written + to history tapes by default; unused integer return codes of some + timing routines were causing problems on phoenix; write statements + and empty directories were left behind from previous commits + + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: -gensom option added to configure + +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: not including the SOM + input fields by default may show slight improvement + +Code reviewed by: myself, eaton + +List all subroutines eliminated: +D models/atm/cam/test/system/config_files/f4c11dh +- config options file replaced with one that includes -gensom option for testing +D models/atm/cam/src/ocnsice +D models/atm/cam/src/ocnsice/dom +D models/atm/cam/src/ocnsice/som +- removed empty directories left behind from previous commit + +List all subroutines added and what they do: +A models/atm/cam/test/system/config_files/f4c11gdh +- replacement config options file with -gensom option for testing + +List all existing files that have been modified, and describe the changes: +M models/utils/SVN_EXTERNAL_DIRECTORIES +- updating to new timing tag with mods for replacing int return codes with void +M models/atm/cam/test/system/input_tests_master +- adding test of the new configure option (gensom) to an existing test +M models/atm/cam/bld/configure +- modified to handle new option for generating SOM input fields +M models/atm/cam/bld/config_cam_eul_defaults.xml +M models/atm/cam/bld/config_trop_chem_mozart_defaults.xml +M models/atm/cam/bld/config_waccm_ghg_defaults.xml +M models/atm/cam/bld/config_waccm_mozart_defaults.xml +M models/atm/cam/bld/config_cam_fv_defaults.xml +M models/atm/cam/bld/config_cam_sld_defaults.xml +- added default values for gensom +M models/atm/cam/src/control/atm_comp_mct.F90 +M models/drv/seq_mct/mrg_x2a_mct.F90 +M models/drv/seq_mct/seq_domain_mct.F90 +- removed write statements left behind from previous commits + +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. + +bluesky: +019 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 +- failed because this is a new test and did not exist in previous tag + +tempest: +021 bl331 TBL.sh f4c11gdh pghgsul 9 ...............................FAIL! rc= 5 +- failed because this is a new test and did not exist in previous tag + +bangkok/lf95: +none + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_9 +Originator(s): Mariana Vertenstein +Date: Wed May 17 13:05:13 MDT 2006 +One-line Summary: created new generate som mode for mct coupling + +Purpose of changes: Remove output of ice/ocn specific fields from + mrg_x2a_mct.F90 and move then to atm_comp_mct.F90. All routines + in mct_drv/ should be devoid of cam specific information. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: default seq_flds_mod.F90 + to be used is currently in drv/seq_flds/gensom. This corresponds + to extra fields being sent to the atm which would only be used + for SOM input fields generation. Changes need to be made to + the testing scripts and configure to support a gensom option. + +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: The extra + fields being sent to atm_comp_mct.F90 might have a very small + performance penalty. However, a fix for this is expected in the + very near future. + +Code reviewed by: Myself (discussed these changes with Brian Eaton) + +List all subroutines eliminated: + +List all subroutines added and what they do: + + A drv/seq_flds/gensom/seq_flds_mod.F90 + sends fields to atm that are needed for SOM input data generation + +List all existing files that have been modified, and describe the changes: + + M atm/cam/src/control/history_defaults.F90 + M atm/cam/src/physics/cam1/diagnostics.F90 + M ocn/som/ocn_comp.F90 + moved history file initialization from diagnostics.F90 and history_defaults.F90 for: + TSOCN&IC, QFLUX, QFLUX_FT, QFLUX_TH, QFLUX_A2, FOCN, OIE, OIERATE, ONF, MLDANN + M ice/csim4/ice_comp.F90 + moved history file initialization from diagnostics.F90 and history_defaults.F90 for: + MELTB ,MELTT ,MELTL ,GROWB ,FRAZIL ,FLOOD ,FRZMLT ,NRGERROR,DELTAICE + NRGICE ,IIERATE ,F_ICE ,F_OCN ,FRZMLTMX,IMBAL ,EICEIN ,EICEOUT , TSICERAD&IC + M atm/cam/src/control/ccsm_msg.F90 + moved history file initialization from diagnostics.F90 and history_defaults.F90 for: + CPLRAINC,CPLRAINL,CPLSNOWC,CPLSNOWL,CPLPRCER + + M atm/cam/tools/scam/scm_init/scam_run.F90 + M drv/seq_mct_drv/seq_ccsm_drv.F90 + removed call to mrg_x2a_run1_mct + renamed call to mrg_x2a_run2_mct as call to mrg_x2a_run_mct + M drv/seq_mct/mrg_x2a_mct.F90 + removed subroutine mrg_x2a_run1_mct + renamed subroutine mrg_x2a_run2_mct as call to mrg_x2a_run_mct + + M atm/cam/bld/configure + set default path for seq_flds to $srcdir/drv/seq_flds/gensom + + M atm/cam/src/control/atm_comp_mct.F90 + added private subroutines atm_gensom1_mct and atm_gensom2_mct + that provide fuctionality previously done in + mrg_x2a_run1_mct and mrg_x2a_run2_mct - they are only invoked + if indices in seq_flds_indices for SOM generation fields are + non-zero (this will only be the case if + $srcdir/drv/seq_flds/gensom/seq_flds_mod.F90 is used. + + M drv/seq_flds_indices/seq_flds_indices.F90 added indices necessary for SOM data generation + +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. + +bluesky: all pass + +tempest: all pass + +bangkok/lf95: all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_8 +Originator(s): Mariana Vertenstein +Date: Sat May 13 17:48:49 MDT 2006 +One-line Summary: to implement MCT domains in each component + +Purpose of changes: To implement MCT domains and implement + a top level domain checker for cam and the surface components + using these domains (this replaces use statements within clm) + Note that cam3_3_7 was identical to this tag - but was tagged + with the wrong land externals - this tag fixes this problem. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: None + +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 + all changes are in the initialization phase - however, + the impact of timing due to initialization has not been tested + +Code reviewed by: Tony Craig and Rob Jacob + +List all subroutines eliminated: None + +List all subroutines added and what they do: + + A models/atm/cam/src/control/cam_domain.F90 + A new routine that can be used by both ccsm_msg.F90 and the + atm_comp_mct.F90 routine to calculate the cam grid and areas + (this code was previously contained in ccsm_msg.F90). + +List all existing files that have been modified, and describe the changes: + + M models/atm/cam/src/control/atm_comp_mct.F90 + M models/ocn/dom/ocn_comp_mct.F90 + M models/ocn/som/ocn_comp_mct.F90 + M models/ice/csim4/ice_comp_mct.F90 + M models/lnd/clm2/src/main/lnd_comp_mct.F90 + M models/atm/cam/tools/scam/scm_init/init_model.F90 + M models/atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 + M models/drv/seq_mct_drv/seq_ccsm_drv.F90 + M models/drv/seq_mct/seq_mct_mod.F90 + D models/drv/seq_mct/seq_mct_init.F90 => A models/drv/seq_mct/seq_init_mct.F90 + In the above routines: + * domains were implemented using the MCT general grid data structures + * the current general grid components that I am defining are + lon,lat,area,mask and maxfrac (maxfrac is the maximum fraction + that the model can have on any gridcell - for the landthis + corresponds to the landfrac, for the ocn and ice this should + correspond to 1.-landfrac when everyone is on the same grid) + * domain checking is only done on the master processor at + initialization (via an MCT gather on the general grid) + * essentially, domains enable grid and fraction checking to be done + at the top level by the master processor and eliminates the use + statements contained in the land model. The consistency check for + fractional land is somewhat different than in the current flux + coupler. Basically, when all the models are on the same grid, you + want the "maximum fraction" from each component to be consistent. + What this boils down to is that the max_frac from the ocn/ice must + equal (1.-landfrac)to within some eps (I have specified 1.e-13). + In the ccsm cpl6 system, the ocn determines the landfrac,and on the + ocean grid maxfrac is either 1 or 0. This is clearly different + than in the current system. + + M models/atm/cam/src/physics/cam1/comsrf.F90 + M models/atm/cam/src/physics/cam1/restart_physics.F90 + M models/atm/cam/src/dynamics/sld/inidat.F90 + M models/atm/cam/src/dynamics/eul/inidat.F90 + M models/atm/cam/src/dynamics/fv/inidat.F90 + -removed landfrac_glob.F90 from above routines + + M models/atm/cam/src/control/ccsm_msg.F90 + - made changes to use cam_domain.F90 for determining grid information + + M models/ocn/dom/ocn_comp.F90 + M models/ocn/som/ocn_comp.F90 + M models/ice/csim4/ice_comp.F90 + M atm/cam/src/physics/cam1/diagnostics.F90 + - moved calls for the following initial file fields: + SNOWHICE&IC, ICEFRAC&IC, SICTHK&IC, TSICERAD&IC + to models/ice/csim4/ice_comp.F90 + - moved calls for the following initial file fields: + TSOCN&IC + to models/ocn/som/ocn_comp.F90 and models/ocn/dom/ocn_comp.F90 + - removed references to initial file file fields TS&IC since this + intiial field it was not being used by any routine + + M atm/cam/src/physics/cam1/restart_physics.F90 + - removed references to landfrac_glob and all COUP_CSM if-defs + +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. + +bluesky: all pass + +tempest: all pass + +bangkok/lf95: all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_7 +Originator(s): Mariana Vertenstein +Date: Sat May 13 17:48:49 MDT 2006 +One-line Summary: to implement MCT domains in each component + +Note that tag had a problem with the land externals - another tag +was made using the correct land externals + +=============================================================== +=============================================================== + +Tag name: cam3_3_6 +Originator(s): eaton, tcraig +Date: Mon May 8 11:26:41 MDT 2006 +One-line Summary: Fix CAM log problem in CCSM runs + +Purpose of changes: + + . Fix problem with CAM log file not being written during CCSM run. The + fix was provide by tcraig in bugzilla bug 102. + + . Set MPI_TYPE_MAX environment variable for testing on tempest + (sgi-o3800). This problem started in cam3_3_3 with FV code updates. + It is only a problem on machines that have a default value which is too + small. Currently setting MPI_TYPE_MAX=100000 is sufficient. The + problem has also been observed on phoenix (cray-x1e). + +Bugs fixed (include bugzilla ID): 102 + +Describe any changes made to build system: none + +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: myself, tcraig + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/src/control/con_cam.F90 + . rearrange initialization as follows: + call cpl_interface_init(cpl_fields_atmname, mpicom) ! call mpi_init + call spmdinit() ! set masterproc + call shr_msg_chdir('atm') ! all PE's chdir + call shr_msg_chStdin('atm') ! all PE's redirect unit 5 + if (masterproc) call shr_msg_chStdout('atm') ! redir unit 6 + call ESMF_Initialize() ! init ESMF time manager + call ccsm_seq_timer_init() ! init timing library + + models/atm/cam/test/system/test_driver.sh + . add "export MPI_TYPE_MAX=100000" for testing on tempest + +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. + +bluesky: Only ran CCSM test -- PASS. + +tempest: All PASS. + +bangkok/lf95: no tests done -- none of the code mods are exercised on bangkok + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_5 +Originator(s): sawyer, eaton +Date: Sun May 7 14:58:53 MDT 2006 +One-line Summary: Fix omega calc for FV offline mode + +Purpose of changes: Fix omega calc for FV offline mode + +Bugs fixed (include bugzilla ID): + + The fix for the FV omega calc added in cam3_3_3 was inadvertently left + out of the offline version of FV. + +Describe any changes made to build system: none + +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: myself, sawyer + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + . call compute_vdot_gradp for both prognostic and offline FV + +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. + +bluesky: All PASS except: + + 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + + This baseline test is expected to fail. Only the OMEGA field is different. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_4 +Originator(s): Erik Kluzek +Date: May/01/2006 +One-line Summary: Update clm, csm_share, and esmf_wrf_timemgr, use shr_file_mod for archiving + +Purpose of changes: First step in moving toward using ESMF clock interface at top level + use shr_file_mod syntax for archive_dir. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: None + +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: Tony Craig, Mariana Vertenstein, Brian Kauffman (csm_share and clm) + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +M models/drv/seq_mct_drv/seq_ccsm_drv.F90 + +M test/unit/control/configure +M test/unit/control/run_time_test +M tools/scam/scm_init/init_model.F90 +M src/control/ccsm_msg.F90 +M src/control/con_cam.F90 +M src/control/history.F90 +M src/control/filenames.F90 +M src/control/ioFileMod.F90 +M src/physics/waccm/chemistry.F90 + +Also use new version of CLM (shrgetput08_cammct05_clm3_expa_58), csm_share (share3_060428) and +esmf_wrf_timemgr (esmf_wrf_timemgr_060501) + +Changes needed to use new versions of above libraries. Make sure a getfil is done before +a open-file. All programs need to do a ESMF_Initialize. ioFileMod uses shr_file_mod.F90 rather +than it's own functionality. filenames sets up archive_dir for shr_file_mod.F90 syntax (with +mss: prescript). Time unit tests use Lahey instead of PGI compiler on Linux. + +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. + +bluesky: None + +tempest: None + +bangkok/lf95: +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + +esmf_wrf_timemgr real-r8 julian day calculations are off by roundoff on Linux platforms. +It's off by roundoff on other platforms after 4-years. According to the unit tests it +remains within roundoff even for a very long simulation time. + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_3_3 + +Summarize any changes to answers, i.e., +- what code configurations: outfrq24 +- what platforms/compilers: Linux lf95/pgi + +If bitwise differences were observed, how did you show they were no worse +than roundoff? cprnc shows RMS difference in the 1e-17-1.e-20 range + Also unit-tests for time-manager shows that answers for julian day remain + bounded within roundoff even for a very long simulation time. + +=============================================================== +=============================================================== + +Tag name: cam3_3_3 +Originator(s): sawyer, eaton +Date: Tue Apr 25 16:17:05 MDT 2006 +One-line Summary: FV dycore improvements, fix omega diagnostic + +Purpose of changes: + o The XY decomposition is now the only one which is + visible to the outside user (YZ is hidden). This + simplifies the CAM-specific part of FV (code inside + the dynamics/fv directory but outside of the portable + FV core) enormously. + + o A dynamical core interface has + been written which is ESMF-like (init, run, final) + using an import and export container, and implementing + a dynamics state. + + o Correct calculation of OMEGA, and related diagnostics. + + o Resynchronized versions of FV dycores and PILGRIM + between GEOS5 and CAM (except GEOS5 vertical remapping). + + o Numerous other software engineering improvements + (all bit-for-bit). + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: + + The timings for the FV dycore are roughly the same on bluevista. There + is about a 10% slowdown on phoenix. + +Code reviewed by: sawyer, eaton + +List all subroutines eliminated: + + models/atm/cam/src/dynamics/fv/FVCAM_GridCompMod.F90 + . renamed dyn_comp.F90 + models/atm/cam/src/dynamics/fv/gmean.F90 + . move this subroutine into the new module mean_module.F90 + models/atm/cam/src/dynamics/fv/prognostics.F90 + . prognostic state info now in dyn_import and dyn_export + +List all subroutines added and what they do: + + models/atm/cam/src/dynamics/fv/diag_module.F90 + . contains the new routine compute_vdot_gradp which supplies a fix for + the OMEGA calculation + models/atm/cam/src/dynamics/fv/dyn_comp.F90 + . was FVCAM_GridCompMod.F90 + models/atm/cam/src/dynamics/fv/mean_module.F90 + . new module contains the old gmean.F90 and new XY version of gmean + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/src/control/history.F90 + . add ability to work with FV fields using XY decomp -- it appears that the + ability to use YZ decomp has been maintained. + . generalize the beg/end index names + . allow history restart write/read to work with XY decomp + + models/atm/cam/src/control/cam_comp.F90 + models/atm/cam/src/control/restart.F90 + models/atm/cam/src/control/startup_initialconds.F90 + . add STAGGERED ifdef to support passing dynamics import/export types through top + level interfaces + + models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 + . use XY decomp only + + models/atm/cam/src/dynamics/fv/dp_coupling.F90 + . use XY decomp only + . use dyn import/export types + + models/atm/cam/src/dynamics/fv/dryairm.F90 + . modify for XY decomp + + models/atm/cam/src/dynamics/fv/dynamics_vars.F90 + . move ESMF code inside GEOS_MODE ifdefs + . remove some tracertrans related code + + models/atm/cam/src/dynamics/fv/epvd.F90 + . update for XY decomp + + models/atm/cam/src/dynamics/fv/fv_prints.F90 + . converted to XY decomp + . ifdef out unused code to find max/min constituent values + + models/atm/cam/src/dynamics/fv/inidat.F90 + . use dyn_import/export_t containers + . remove dependency on prognostics + . input fields now scattered to XY decomp + + models/atm/cam/src/dynamics/fv/inital.F90 + . use dyn_import/export_t containers + . remove dependency on prognostics + + models/atm/cam/src/dynamics/fv/io_dist.F90 + . add methods needed for read/write of XY decomp from/to restart files + + models/atm/cam/src/dynamics/fv/mapz_module.F90 + . add option for cubic interpolation + + models/atm/cam/src/dynamics/fv/metdata.F90 + . remove unneeded ghosting of met_us, met_vs (it's done in cd_core). + + models/atm/cam/src/dynamics/fv/p_d_adjust.F90 + . modify to use XY decomp only + + models/atm/cam/src/dynamics/fv/par_xsum.F90 + . remove CPP conditional surrounding par_xsum_r4 + + models/atm/cam/src/dynamics/fv/pfixer.F90 + . remove SPMD ifdefs that surrounded !$omp directives. + + models/atm/cam/src/dynamics/fv/restart_dynamics.F90 + . remove prognostics module + . add dyn_out as intent(in) arg to write_restart_dynamics + . modify read/write methods to work with XY decomp + . add dyn_in/out as intent(out) args to read_restart_dynamcis + + models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + . remove tracertrans-related variables + + models/atm/cam/src/dynamics/fv/stepon.F90 + . remove prognostics by adding dyn_state to dyn_comp + . use dyn_import_t and dyn_export_t from dyn_comp + . get rid of lots of local xy arrays that are now part of the import/export + states + . add dyn_in, dyn_out dummy args to stepon_init + . the components of dyn_in are being initialized rather than local variables + . add dyn_in, dyn_out as dummy args to stepon_run1 + . replace actual args to diag_dynvar_ic with components of dyn_out + (previously used prognostics module data). + . replace actual args to dyn_run with dyn_state, dyn_in, dyn_out. + Previously passed prognostics module vars and local xy vars. + . use dyn_out as actual arg to d_p_coupling instead of all the local xy + arrays. + . add dyn_in, dyn_out as intent(out) args to stepon_run2 + . use dyn_in as actual arg to p_d_coupling instead of mix of prognostics + and local xy arrays + . add dyn_in, dyn_out as intent(out) args to stepon_run3 + . pass components of dyn_out as actual args to fv_out + + models/atm/cam/src/dynamics/fv/sw_core.F90 + . change an index range in one calc + + models/atm/cam/src/dynamics/fv/te_map.F90 + . added some SPMD ifdefs + + models/atm/cam/src/dynamics/fv/trac2d.F90 + . add local variable frac to private declaration in !$omp and !CSD$ directives + + models/atm/cam/src/dynamics/fv/uv3s_update.F90 + . update to use XY decomp. Note that u3s and v3s are no longer passed with + ghost regions because the ghost region is taken care of in local variables. + + models/atm/cam/src/dynamics/eul/dyn_grid.F90 + models/atm/cam/src/dynamics/fv/dyn_grid.F90 + models/atm/cam/src/dynamics/sld/dyn_grid.F90 + . move ptimelevels from prognostics to here. + + models/atm/cam/src/physics/cam1/phys_buffer.F90 + models/atm/cam/src/physics/cam1/restart_physics.F90 + . get ptimelevels from dyn_grid instead of prognostics + + models/utils/pilgrim/mod_comm.F90 + models/utils/pilgrim/parutilitiesmodule.F90 + models/utils/pilgrim/puminterfaces.F90 + models/utils/pilgrim/redistributemodule.F90 + . merge with GEOS5 version of pilgrim + +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. + +bluesky: All PASS except: + + 019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 + 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 + 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 + 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 + 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 + +tempest: All PASS except: + + 017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 + 021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 + 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 7 + 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 + +bangkok/lf95: All PASS except: + + 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 + 024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 + 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 + + All the baseline tests that fail on bluesky, tempest, and bangkok do so + due to changes in the diagnostic OMEGA and OMEGAT fields. + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_3_1 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_2 +Originator(s): Jim Edwards +Date: 4/24/2006 +One-line Summary: Eliminate common block comlun + +Purpose of changes: code clean up + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: self + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: +In control directory: +file comlun.h removed +readinitial.F90 - converted to netcdf f90 interface, modified for ncol format + initial file +runtime_opts.F90, history.F90 - removed reference to ncid_ini and ncid_topo +startup_initial_cond.F90 - made ncid_ini and ncid_topo module variables + added function interfaces initial_file_get_id and topo_file_get_id + to allow read only access to these. +ioFileMod.F90 - made info messages print from masterproc only +error_messages.F90 - added an option integer variable in handle_ncerr to + print the error line number +physics/waccm/tgcm_forcing.F90: removed unused reference to comlun.h +physics/waccm/chemistry.F90: removed unused reference to ncid_trc and comlun.h +physics/cam1/co2_data_flux.F90: removed unused reference to comlun.h +physics/cam1/boundarydata.F90: changed calls to handle_ncerr to add line number +dynamics/*/inidat.F90: changed read_inidat to pass in ncid_ini, ncid_topo + {eul,sld}/spegrd.F90 + {eul,sld}/linemsdyn.F90 + sld/tfilt_massfix.F90 - removed unused refs to comlun.h +tools/scam/scm_init/inital.F90 +tools/scam/scm_init/init_model.F90 - removed refs to comlun.h +ice/csim4/ice_comp.F90 +ice/csim4/ice_data.F90 +ocn/som/somini.F90 +ocn/som/ocn_comp.F90 +ocn/som/somint.F90 +ocn/dom/ocn_comp.F90 +ocn/dom/sst_data.F90 - replaced refs to comlun.h with calls to functions or + local variables as appropriate. + + +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. + +bluesky: All pass + +tempest: All pass + +bangkok/lf95: All pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_1 +Originator(s): Mariana Vertnestein +Date: 4/18/2006 +One-line Summary: bug fixes necessary for CCSM phoenix + +Purpose of changes: Implemented several minor bugs fixes necessary + to run CAM in CCSM on phoenix (Cray X1) + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: None + +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: myself, Jon Wolfe, Brian Eaton + +List all subroutines eliminated: None + +List all subroutines added and what they do: None + +List all existing files that have been modified, and describe the changes: + M src/control/con_cam.F90 + Modifications put in so that only the lead/master MPI process + redirects its stdout to the appropriate component model log file when + running fully coupled, instead of having every process "open" the same + log file. This change solves the problem of logs getting trashed on + phoenix (which has been recently experienced). The only down side is + that warning and error messages generated by other processes + (non-master processes) get stuck in the job's stdout file, so users + may want to archive job output files as well as component model logs. + In addition, when debugging problems with the model system, certain + error messages which may have previously appeared in component model + logs may now appear in the job output. + + M src/dynamics/fv/trac2d.F90 + M src/dynamics/fv/cd_core.F90 + Removed streaming directives for COUP_CSM mode where a routine is called + from within a streaming region. This problem does not exist in stand-alone + CAM mode, but causes the system to hang or crash in coupled mode. This is + bug will be reported to Cray, but a fix has currently been implemented so + that production runs can occur on phoenix. + the following changes was made for cpp directives: + #if defined(USE_OPM => #if (!definedUSE_OMP) && (!defined COUP_CSM) + +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. + +bluesky: no pre-tag testing was done + +tempest: no pre-tag testing was done + +bangkok/lf95: no pre-tag testing was done + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_3_0 +Originator(s): Mariana Vertenstein +Date: 4/18/2006 +One-line Summary: Directory restructuring for sequential ccsm + +Purpose of changes: + Create new directory structure and mct file renaming for + the next step in the creation of a sequential ccsm starting + from stand-alone cam and for the next step in the ESMF stage + 1 evaluation effort. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: + bld/configure was changed to take into account the new directory + structure and to remove the obsolete mode for the sea ice package "ccmice" + +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: Myself, Brian Eaton + +List all subroutines eliminated: +List all subroutines added and what they do: +The following lists the directory restucturing and file renaming that was done + + D atm/cam/src/ocnsice/dom/sst_data.F90 => A models/ocn/dom/sst_data.F90 + D atm/cam/src/ocnsice/dom/ocn_types.F90 => A models/ocn/dom/ocn_types.F90 + D atm/cam/src/ocnsice/dom/albocean.F90 => A models/ocn/dom/albocean.F90 + D atm/cam/src/ocnsice/dom/print_coverage.F90 => A models/ocn/dom/print_coverage.F90 + D atm/cam/src/ocnsice/dom/parpbl.h => A models/ocn/dom/parpbl.h + D atm/cam/src/ocnsice/dom/ocn_comp.F90 => A models/ocn/dom/ocn_comp.F90 + D atm/cam/src/ocnsice/dom/albedo.h => A models/ocn/dom/albedo.h + D atm/cam/src/ocnsice/dom/wtrc_flxoce.F90 => A models/ocn/dom/wtrc_flxoce.F90 + D atm/cam/src/ocnsice/dom/MCT_ocn_comp.F90 => A models/ocn/dom/flxoce.F90 + D atm/cam/src/ocnsice/dom/flxoce.F90 => A models/ocn/dom/ocn_comp_mct.F90 + D atm/cam/src/ocnsice/dom/srfoce.F90 => A models/ocn/dom/srfoce.F90 + + D atm/cam/src/ocnsice/som/ocn_types.F90 => A models/ocn/som/ocn_types.F90 + D atm/cam/src/ocnsice/som/albocean.F90 => A models/ocn/som/albocean.F90 + D atm/cam/src/ocnsice/som/mixed_layer_globalcalcs.F90 => A models/ocn/som/mixed_layer_globalcalcs.F90 + D atm/cam/src/ocnsice/som/ocn_srf.F90 => A models/ocn/som/ocn_srf.F90 + D atm/cam/src/ocnsice/som/parpbl.h => A models/ocn/som/parpbl.h + D atm/cam/src/ocnsice/som/somint.F90 => A models/ocn/som/somint.F90 + D atm/cam/src/ocnsice/som/ocn_comp.F90 => A models/ocn/som/ocn_comp.F90 + D atm/cam/src/ocnsice/som/ocean_data.F90 => A models/ocn/som/ocean_data.F90 + D atm/cam/src/ocnsice/som/somini.F90 => A models/ocn/som/somini.F90 + D atm/cam/src/ocnsice/som/MCT_ocn_comp.F90 => A models/ocn/som/flxoce.F90 + D atm/cam/src/ocnsice/som/flxoce.F90 => A models/ocn/som/ocn_comp_mct.F90 + + D ice/csim4/MCT_ice_comp.F90 => A models/ice/csim4/ice_comp_mct.F90 + + A models/drv/seq_mct/seq_mct_mod.F90 + D atm/cam/src/control/MCT_atmocn_cpl.F90 => A models/drv/seq_mct/map_atmocn_mct.F90 + D atm/cam/src/control/MCT_atmlnd_cpl.F90 => A models/drv/seq_mct/map_atmlnd_mct.F90 + D atm/cam/src/control/MCT_iceocn_cpl.F90 => A models/drv/seq_mct/map_iceocn_mct.F90 + D atm/cam/src/control/MCT_atmice_cpl.F90 => A models/drv/seq_mct/map_atmice_mct.F90 + D atm/cam/src/control/MCT_lndhub_comp.F90 => A models/drv/seq_mct/mrg_x2l_mct.F90 + D atm/cam/src/control/MCT_atmhub_comp.F90 => A models/drv/seq_mct/mrg_x2a_mct.F90 + D atm/cam/src/control/MCT_icehub_comp.F90 => A models/drv/seq_mct/mrg_x2i_mct.F90 + D atm/cam/src/control/MCT_ocnhub_comp.F90 => A models/drv/seq_mct/mrg_x2o_mct.F90 + D atm/cam/src/control/MCT_seq.F90 => A models/drv/seq_mct/seq_mct_init.F90 + D atm/cam/src/control/cam.F90 => A models/drv/seq_mct_drv/seq_ccsm_drv.F90 + D atm/cam/src/control/seq_fields_indices.F90 => A models/drv/seq_flds_indices/seq_flds_indices.F90 + D atm/cam/src/control/seq_fields_mod.F90 => A models/drv/seq_flds/default/seq_flds_mod.F90 + + D atm/cam/src/control/MCT_atm_comp.F90 => A models/atm/cam/src/control/atm_comp_mct.F90 + +List all existing files that have been modified, and describe the changes: + + M atm/cam/tools/scam/configure + M atm/cam/tools/scam/scm_init/init_model.F90 + M atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 + M atm/cam/tools/scam/scm_init/scam_run.F90 + M atm/cam/bld/configure + Modified these files to work with above directory restructuring and file renaming + + M models/SVN_EXTERNAL_DIRECTORIES + Modified to use clm branch tag cammct05_clm3_expa_58 + +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. + +bluesky: None + +tempest: None + +bangkok/lf95: None + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_60 (this is the previous tag) + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_60 +Originator(s): Mariana Vertenstein +Date: 4/11/2006 +One-line Summary: Introduction of MCT CAM-surface coupling + +Purpose of changes: + Incoporate MCT cam-surface component coupling for all + CAM surface components. Introduce the appropriate thin-layer + design for MCT coupling that can also be extended to ESMF. + +Bugs fixed (include bugzilla ID): None + +Describe any changes made to build system: None + +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: + ***These have to still be determined*** + +Code reviewed by: + Erik Kluzek + +List all subroutines eliminated: + D atm/cam/src/physics/cam1/camhub_comp.F90 + +List all subroutines added and what they do: + + A atm/cam/src/control/MCT_atmhub_comp.F90 + A atm/cam/src/control/MCT_lndhub_comp.F90 + A atm/cam/src/control/MCT_ocnhub_comp.F90 + A atm/cam/src/control/MCT_icehub_comp.F90 + -introduced these routines to merge necessary + input for atm, lnd, ocn and ice states + (e.g. MCT_atm_hub_comp.F90 merges lnd,ocn and ice + states and fluxes to create the necessary input + atm attribute vector) + These hub component routines act only on MCT attribute vectors + + A atm/cam/src/control/MCT_atmlnd_cpl.F90 + A atm/cam/src/control/MCT_iceocn_cpl.F90 + A atm/cam/src/control/MCT_atmocn_cpl.F90 + A atm/cam/src/control/MCT_atmice_cpl.F90 + A atm/cam/tools/scam/scm_init/scam_srfdata_MCT.F90 + -introduced new MCT couplers + (e.g. MCT_atmlnd_cpl.F90 maps between atm and lnd domains) + These couplers act only on MCT attribute vectors + + A atm/cam/src/ocnsice/dom/ocn_types.F90 + -introduced new dom specific data structures (ocn_in, ocn_out) + so that MCT could map directory to the dom input/output states + A atm/cam/src/ocnsice/som/ocn_types.F90 + -introduced new som specific data structures (ocn_in, ocn_out) + so that MCT could map directory to the dom input/output states + A ice/csim4/ice_types.F90 + -introduced new csim specific data structures (ice_in, ice_out) + so that MCT could map directory to the dom input/output states + + A ice/csim4/MCT_ice_comp.F90 + -introduced MCT_ocn_comp.F90 that map MCT attribute vectors + to ice_in and ice_out to MCT attribute vectors + A atm/cam/src/ocnsice/dom/MCT_ocn_comp.F90 + -introduced MCT_ocn_comp.F90 that map MCT attribute vectors + to ocn_in and ocn_out to MCT attribute vectors + A atm/cam/src/ocnsice/som/MCT_ocn_comp.F90 + -introduced MCT_ocn_comp.F90 that map MCT attribute vectors + to ocn_in and ocn_out to MCT attribute vectors + + A atm/cam/src/control/seq_fields_indices.F90 + -contains integer indices for all possible character strings that + represent cam and cam surface model couling + A atm/cam/src/control/con_cam.F90 + -replaced part of cam.F90 that dealt with running cam in COUP_CSM mode + +List all existing files that have been modified, and describe the changes: + + M ice/csim4/ice_data.F90 + -removed srfflx_state2d from input argument and replaced it with frac + (frac a frac_t defined type now specific to ice/csim4) + M ice/csim4/ice_dh.F + -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) + A ice/csim4/print_coverage.F90 -> D atm/cam/src/ocnsice/som/print_coverage.F90 + M ice/csim4/ice_srf.F90 + -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) + M ice/csim4/ice_diagnostics.F + -renamed surface_state2d -> ice_in (where ice_in is now of type ice_in_t not surface_state) + D ice/csim4/camice.F90-> A ice/csim4/ice_comp.F90 + -renamed camice.F90 -> ice_comp.F90 and introduced ice_in and ice_out + states to replace srfflx_parm2d_ocn, srfflx_state2d. + -added functionality to read landfrac from cam initial file and store it + as a module variable, rather than use it from camsrf. + + M atm/cam/tools/scam/configure + M atm/cam/tools/scam/testscript + M atm/cam/tools/scam/scm_init/init_model.F90 + M atm/cam/tools/scam/scm_init/scam_srfdata.F90 + M atm/cam/tools/scam/scm_init/scam_run.F90 + M atm/cam/tools/scam/scm_init/inital.F90 + M atm/cam/tools/scam/scm_init/scamMod.F90 + M atm/cam/tools/scam/ui/configure + -incorporated changes into above scam routines so that + they could work with new MCT coupling to surface models + + M atm/cam/tools/cprnc/Makefile + + M atm/cam/src/control/MCT_atm_comp.F90 + -introduced MCT_ocn_comp.F90 that map MCT attribute vectors + to cam_in and cam_out to MCT attribute vectors + M atm/cam/src/control/ccsm_msg.F90 + -extended restart functionality to use logic previously in restart_physics + M atm/cam/src/control/cam.F90 + -this is now a top level MCT coupling driver for stand-alone CAM + M atm/cam/src/control/seq_fields_mod.F90 + -generalized routine to account for cam-ice and cam-ocn coupling + M atm/cam/src/control/restart.F90 + -made changes to removed srfflx_parm and srfflx_state from camsrfexch_typees + M atm/cam/src/control/startup_initialconds.F90 + -removed call to close ncid_topo + -removed srfflx_state2d argument to read_inidat and initial_conds + M atm/cam/src/control/cam_comp.F90 + -removed srfflx_parm from camsrfexch_types use + -removed cam_in from call to cam_initial and read_restart + -added call to hub2atm_alloc + + M atm/cam/src/physics/cam1/comsrf.F90 + -removed snowhland, tsocn and renamed landfrac_field->landfrac_glob + M atm/cam/src/physics/cam1/diagnostics.F90 + -removed outfld calls for TBOT,SNOWHLND,TSOCN + -removed comsrf uses for tsocn + -removed snowhland as input argument + M atm/cam/src/physics/cam1/tphysbc.F90 + -removed snowh ans input argument + M atm/cam/src/physics/cam1/restart_physics.F90 + -removed calls to output srfflx_state2d fields - moved these to + ccsm_msg.F90 and MCT_atmhub_comp.F90. + M atm/cam/src/physics/cam1/physpkg.F90 + D atm/cam/src/physics/cam1/camsrfexch_types.F90 -> A atm/cam/src/control/camsrfexch_types.F90 + -removed module routines bounding, verify_fractions, srfflx_parm_reset, + srfcomp2hub_alloc + -renamed atm2srf_alloc->atm2hub->alloc + -removed srfflx_parm derived type and added snowhland as part of srfflx_state + definition + D atm/cam/src/physics/cam1/srfxfer.F90 -> A atm/cam/src/control/srfxfer.F90 + -cosmetic changes only + M atm/cam/src/physics/cam1/tphysac.F90 + -removed snowh as input argument + M atm/cam/src/ocnsice/dom/sst_data.F90 + - removed landfrac from argument list + M atm/cam/src/ocnsice/dom/albocean.F90 + - removed landfrac from argument list + D atm/cam/src/ocnsice/dom/camoce.F90 -> A atm/cam/src/ocnsice/dom/ocn_comp.F90 + -renamed camoce.F90 -> ocn_comp.F90 and introduced ocn_in and ocn_out + states to replace srfflx_parm2d_ocn, srfflx_state2d. + -added functionality to read landfrac from cam initial file and store it + as a module variable, rather than use it from camsrf. + -introuced ocn_IC_OUTPUT routine to output TSOCN to initial file. + + M atm/cam/src/ocnsice/som/albocean.F90 + - removed landfrac from argument list + D atm/cam/src/ocnsice/som/print_coverage.F90 + -removed routine, no longer needed + M atm/cam/src/ocnsice/som/mixed_layer_globalcalcs.F90 + -added landfrac_glob to argument list, replace landfrac_field->landfrac_glob + M atm/cam/src/ocnsice/som/ocn_srf.F90 + -removed Tffresh, rhow, cp_ocn from ice_constants use statement and used + SHR_CONST_ROWSW, SHR_CONST_CPSW and SHR_CONST_TKFREZ from shr_const_mod instead + D atm/cam/src/ocnsice/som/somoce.F90 -> A atm/cam/src/ocnsice/som/ocn_comp.F90 + -renamed somoce.F90 -> ocn_comp.F90 and introduced ocn_in and ocn_out + states to replace srfflx_parm2d_ocn, srfflx_state2d. + -added functionality to read landfrac from cam initial file and store it + as a module variable, rather than use it from camsrf. + -introuced ocn_IC_OUTPUT routine to output TSOCN to initial file. + -added landfrac_glob as argument to gmean and check_conservation calls + -repalce Focn->ocn_out%frzmlt + -removed use of camice (Focn, frzmlt, aice, sicthk, snowhice now obtained + via ocn_in and ocn_out) + -removed ice_constants use for rhow, cp_ocn and used + SHR_CONST_ROWSW, SHR_CONST_CPSW from shr_const_mod instead + + M atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 + M atm/cam/src/chemistry/trop_mozart/chemistry.F90 + -removed snowhland from camsrf use and added to argument list (part of cam_in) + + M atm/cam/src/dynamics/sld/stepon.F90 + M atm/cam/src/dynamics/eul/stepon.F90 + -removed srfflx_state and srfflx_parm use statements + + M atm/cam/src/dynamics/sld/inidat.F90 + M atm/cam/src/dynamics/eul/inidat.F90 + M atm/cam/src/dynamics/fv/inidat.F90 + -changed varialbe names (surface_state->cam_out) + -introduced landfrac_glob and removed use of landfrac from comsrf + -removed srfflx_state use from camsrfexch_types + + M atm/cam/src/dynamics/sld/inital.F90 + M atm/cam/src/dynamics/eul/inital.F90 + M atm/cam/src/dynamics/fv/inital.F90 + -changed varialbe names (surface_state->cam_out) + -removed srfflx_state2d as input argument + -removed call to hub2atm_alloc and renamed atm2srf_alloc->atm2hub_alloc + +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. + +bluesky: + 005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 + 019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 + 022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + 030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 + 034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 + 037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 + 040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + 044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 + 047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 + 054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 + All these tests only contain differences in the following fields + LHFLXOI, SHFLXOI, FSNSOI + with RMS values on the order of 1.e-15 + In addition, TBL.f2h.outfrq24h contained a difference in QFLX on the order of 1.-e23 + So even though the TBL tests fail, this tag does not change answers. + +tempest: + 014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 + diffs set in at NSTEP=47 + 021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 + only QRS is different in cprnc.out with an RMS on the order of 3.e-24 + 024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 + only SNOWHICE is different in cprnc.out with an RMS on the order of 1.e-23 + 031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 + only VD01 is different in cprnc.out with an RMS on the order of 4.e-25 + +bangkok/lf95: + 012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 + diffs set in at NSTEP=29 + 016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 + differences are only in SHOWHICE with RMS value of 5.e-21 + 028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 + diffs set in at nstep=9 + 040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + diffs set in at nstep=3 + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_59 +Originator(s): mvr, eaton, edwards +Date: 4/6/06 +One-line Summary: collection of bug fixes + +Purpose of changes: +bug fixes for ccsm testing, cray directive on phoenix, compiler workaround +on bluevista, coupled runs on tempest; added cron scripts to repository + +Bugs fixed (include bugzilla ID): +bug#68 is resolved + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, eaton, edwards + +List all subroutines eliminated: +D models/atm/cam/test/system/td_nightly_aix.sh +D models/atm/cam/test/system/td_nightly_linux.sh +- post-tag cron jobs were renamed + +List all subroutines added and what they do: +A + models/atm/cam/test/system/posttag_cron_bangkok.sh +A + models/atm/cam/test/system/posttag_cron_bluesky.sh +A models/atm/cam/test/system/posttag_cron_lightning.sh +A models/atm/cam/test/system/posttag_cron_bluevista.sh +- post-tag cron job scripts for machine-specific testing of cam + +List all existing files that have been modified, and describe the changes: +M models/atm/cam/test/system/TSB.ccsm.sh +M models/atm/cam/test/system/TCB.ccsm.sh +- mods to make cam's ccsm test scripts compatible with changes in ccsm scripts + +M models/atm/cam/test/system/test_driver.sh +M models/atm/cam/test/system/CAM_runcmnd.sh +- test scripts now use unix utility 'hostname' to determine local machine + +M models/atm/cam/src/physics/cam1/dmsbnd.F90 +- removed debug print statement left behind - trips up coupled runs on tempest + +M models/atm/cam/src/physics/cam1/physpkg.F90 +- added workaround for code introduced in cam3_2_58 which trips xlf bug on bluevista + +M models/atm/cam/src/dynamics/fv/fv_prints.F90 +- fix of bug in cpp definition CPP_PRT_PREFIX on phoenix + + + +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. + +bluesky: all PASS + +tempest: all PASS + +bangkok/lf95: all PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_58 +Originator(s): Jim Edwards +Date: 4/4/2006 +One-line Summary: changes for ncol dataset support + +Purpose of changes: Allows data input on non-rectangular grids using an alternative input file format + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: none, no new boundary datasets + are provided at this time + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, Eaton + +List all subroutines eliminated: renamed file zonalbndydata.F90 to boundarydata.F90 + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: + renamed file zonalbndydata.F90 to boundarydata.F90 + dmsbnd.F90 prescribed_aerosols.F90 : added support for ncol based input dataset + chemistry.F90 ozone_data.F90: changed module names from zonalndydata to boundarydata + + +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. + +bluesky: one fails + 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 + + That's due to a change in the CCSM scripts in ccsm3_1_beta24. The test + passes when run in ccsm3_1_beta23. Mat is modifying the CAM test to work + with the new CCSM scripts. + +tempest: all pass + +bangkok/lf95: all pass + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_57 +Originator(s): pworley +Date: Sun Apr 2 12:22:18 MDT 2006 +One-line Summary: Performance optimizations, primarily for Cray-X1E + +Purpose of changes: + + To restore X1E performance lost in recent check-ins; to fix X1E and XT3 + bugs. + +Bugs fixed (include bugzilla ID): + + PGI compile problem; aqua planet error on X1E. + +Describe any changes made to build system: none + +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: + + Performance on X1E doubled compared to 3_2_56 when running T85 on 128 + processors. + +Code reviewed by: myself, eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + a) Vectorized routines chunk_to_buff and buff_to_chunk used by MCT in + land/atmosphere communication and in coupler/atmosphere communication: + + M atm/cam/src/physics/cam1/phys_grid + - buff_to_chunk, chunk_to_buff: interface clean up and vector-friendly + reimplementation + + M atm/cam/src/control/ccsm_msg.F90 + M atm/cam/src/control/MCT_atm_comp + - changed parameters in calls to buff_to_chunk and chunk_to_buff + + b) Fixed bug on X1E caused by diagnostic message output inside streamed + code segment + + M atm/cam/src/dynamics/fv/fill_module.F90 + - surrounded (non fatal) error test with ifdef DEBUG cpp logic + + c) Introduced workaround for PGI compiler bug + + M lnd/clm2/src/biogeophys/Hydrology2Mod.F90 + - removed unnecessary "use" of spmdMod + + d) Optimized performance of MCT Rearranger routine + + M utils/mct/mct/m_Rearranger + - added new optional parameter ALLTOALL and modified code in rearrange_ + to implement an MPI_Alltoallv option for interprocessor communication. + - reordered the send/receive pattern for the non-ALLTOALL implementation + to decrease link and processor contention. + - Reduced number of allocate/deallocate requests. + + M utils/mct/mpi-serial/collective.c + M utils/mct/mpi-serial/mpi.h + - add mpi_alltoallv interfaces (from Ray Loy) + + M lnd/clm2/src/main/MCT_atmlnd_cpl + - added optional parameters VECTOR and ALLTOALL to calls to MCT_Rearrange, + setting VECTOR to .true. if CPP_VECTOR is defined, and setting + ALLTOALL to .true. if SYSUNICOS is defined. Otherwise they are + set to .false. . + + Note that ALLTOALL=.true. may be a better choice for all systems, + but I have only verified this on the X1E. + + e) Improved vector performance in CLM/MCT interface. + + M lnd/clm2/src/main/MCT_lnd_comp + - made minor change to index logic to improve vectorization on the X1E + + f) Improved performance (both vector and nonvector) in routines that + map to/from CLM grid + + M areaMod + - added support for mapping multiple fields in one call to + gridmap_mapparray + - reimplemented gridmap_mapparray to improve vector performance, + incuding changing calling interface + + M clm_atmlnd + - modified logic in clm_mapa2l and clm_mall2a to call gridmap_array once + for all fields + - made other minor modifications to improve vectorization + +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. + +bluesky: All PASS except: + 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 + + That's due to a change in the CCSM scripts in ccsm3_1_beta24. The test + passes when run in ccsm3_1_beta23. Mat is modifying the CAM test to work + with the new CCSM scripts. + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_56 +Originator(s): mvr +Date: 3/27/06 +One-line Summary: +test_driver.sh made to run interactive; test scripts modified for use +on lightning, bluevista; new tests added; some bugs fixes + +Purpose of changes: +wanted to test on lightning, bluevista + +Bugs fixed (include bugzilla ID): +ccsm tests work again + +Describe any changes made to build system: +LAPACK library replaced with ESSL library as default for WACCM_MOZART +configurations on AIX + +Describe any changes made to the namelist: + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: myself, eaton + +List all subroutines eliminated: +D atm/cam/test/system/input_tests_aix +D atm/cam/test/system/input_tests_linux +D atm/cam/test/system/input_tests_irix +D atm/cam/test/system/input_tests_aix_nightly +D atm/cam/test/system/input_tests_linux_nightly +- these files were renamed + + +List all subroutines added and what they do: +A + atm/cam/test/system/tests_pretag_bluesky +A + atm/cam/test/system/tests_pretag_bangkok +A + atm/cam/test/system/tests_pretag_tempest +A + atm/cam/test/system/tests_posttag_bluesky +A + atm/cam/test/system/tests_posttag_bangkok +- newly renamed files + +A atm/cam/test/system/tests_posttag_bluevista +A atm/cam/test/system/tests_posttag_lightning +- new files containing tests for respective platforms + +A atm/cam/test/system/config_files/f1.9h +- new config options file for testing fv 1.9x2.5 resolution +A atm/cam/test/system/TPF.sh +- new test script for performance testing + + +List all existing files that have been modified, and describe the changes: +M atm/cam/test/system/test_driver.sh +- made to run interactive (ie will create/spawn command file to machine's + batch queue); added support for lightning, bluevista; added env var to + specify ccsm tag to be used for testing +M atm/cam/test/system/CAM_runcmnd.sh +- added logic for setting run command on lightning, bluevista +M atm/cam/test/system/TCB.sh +- uses new env var for setting options to configure +M atm/cam/test/system/TSB.ccsm.sh +- bug with ccsm test now fixed - files/dirs now compatible with ccsm scripts +M atm/cam/test/system/TCB.ccsm.sh +- now specifies resources for ccsm test; general cleanup +M atm/cam/test/system/TBL.sh +- minor cleanup +M atm/cam/test/system/td_nightly_aix.sh +- posttag cron script modified with new call to test_driver.sh; + now spawns testing on lightning, bluevista +M atm/cam/test/system/td_nightly_linux.sh +- posttag cron script modified with new call to test_driver.sh +M atm/cam/test/system/input_tests_master +- added performance test, ccsm test w/bgc, ccsm test w/trop_mozart chemistry +M atm/cam/test/system/tag_email.sh +- posttag cron script now used 'mail' to notify developers of new tag +M atm/cam/bld/configure +- now uses ESSL rather than LAPACK library for waccm_mozart on aix + +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. + +bluesky: +055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 +- compatibility bug w/ccsm scripts fixed, this test should pass going forward + +tempest: +- none + +bangkok/lf95: +004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 5 +008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 5 +010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 5 +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 5 +016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 5 +024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 5 +026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 5 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 5 +032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 5 +036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 5 +038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 5 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 5 +- baseline tests failed due to change in env vars used in testing; these tests + should pass going forward + +CAM tag used for the baseline comparison tests if different than previous +tag: ccsm testing used cam3_2_51 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_55 +Originator(s): Francis Vitt +Date: Fri Mar 24 16:51:04 MST 2006 +One-line Summary: Fixed bug in mo_drydep.F90 + +Purpose of changes: To compile and run on lighting + +Bugs fixed (include bugzilla ID): 60 + +Describe any changes made to build system: none + +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: + +Code reviewed by: Jeff Lee ( Yen-Huei Lee) + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: +U models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + changed parameter n_drydep_species from 52 to 53 + + +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. + +bluesky: + +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + Dry deposition species have changed. Bit for bit comparison to + previous version is expected to fail. +055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 + CCSM scripts have changed causing this test to fail + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_54 +Originator(s): Jim Edwards +Date: 03/21/06 12:36PM +One-line Summary: addresses bug reported in http://bugs.cgd.ucar.edu/show_bug.cgi?id=56 + +Purpose of changes: + +Bugs fixed (include bugzilla ID): 56 ccsm cannot read co2 data file + +Describe any changes made to build system: none + +Describe any changes made to the namelist: none + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: + co2_data_flux.F90 changed variable for date and sec to explicitly allocated + arrays. + +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. + +This file is used only with ccsm, no stand-alone tests are available. We have confirmed the +change using ccsm3_1_beta23. + +=============================================================== +=============================================================== + +Tag name: cam3_2_53 +Originator(s): Francis Vitt +Date: Thu Mar 16 09:00:35 MST 2006 + +One-line Summary: + Changes to trop_mozart chemistry for CCSM coupled mode. + +Purpose of changes: + To run CAM with trop_mozart in CCSM and pass acceptance tests + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: + +Describe any changes made to the namelist: + New initial coniditions files are used from trop_mozart chemistry. + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: + +List all subroutines added and what they do: + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/bld/DefaultCAMEXPNamelist.xml + changed IC data files for trop_mozart + + models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + Changed loop indexing where constituent fields are output + to history file to be compatable with BGC package + + models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + Added H2 to the dry deposition species list + + models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 + Initialize surface fluxes to zero before setting to data + + models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 + Increaesed the length of filename to 265 characters + +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. + +bluesky: + +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + These bit-for-bit comparisons to the previous version of trop_mozart + chemistry are expected fail since H2 was added to dry deposition + and different initial conditions are used + +055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 + CCSM scripts have changed causing this test to fail + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name:cam3_2_52 +Originator(s): Jim Edwards +Date: Thu Mar 9 17:11:49 MST 2006 +One-line Summary: netcdf f90 interface, interpaerosols update + +Purpose of changes: non lat/lon grid integration + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: Brian Eaton + +List all subroutines eliminated: copies of bilin and kinds were eleminated from + the interpaerosols directory; subroutine lininterp was overloaded to + avoid several names for the same basic functionality + +List all subroutines added and what they do: lininterp2d1d - interpolate from a 2d lat/lon field to a 1d ncols field - this subroutine is private in interpolate_data.F90 and accesible through the lininterp interface. + +List all existing files that have been modified, and describe the changes: +A host of files were changed in the physics/cam1 directory to move from netcdf f77 interface to the f90 interface. + +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. + +bluesky: + +tempest: + +bangkok/lf95: + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +=============================================================== + +Tag name: cam3_2_51 +Originator(s): eaton +Date: Fri Feb 17 18:27:20 MST 2006 +One-line Summary: configure and Makefile mods + +Purpose of changes: + + . Modify Makefile to enable threading with lf95 and pathf90. + *** N.B. *** lf95 (v6.2) still has severe per thread stacksize limits. + I was only able to get threading to work with the --threadheap option + which puts the thread memory on the heap. That option however doesn't + work with debug flags -g, --chk, or --chkglobal. Set up the Makefile + to allow threading only in non-debug mode. + + . Modify configure so that the checks for include files and libraries are + not done when the -ccsm flag is set since the CAM Makefile is not used + in that case. + + . Modify configure to require that the configure script and all + associated configuration files live in a specified subdirectory of the + source tree for the source being built. This is for robustness. Using + configure with source or configuration files from outside a source tree + that represents a fixed source version is fraught with peril. + + . Add -linker option to the configure script to enable specifying a + linker which is different from the Fortran compiler. This is + particulary useful on Linux platforms where specifying mpif90 as the + linker automatically provides the correct linkage for the MPI + libraries. Note that this depends on the user's PATH being set so that + the correct mpif90 is used, i.e., the one that's consistent with the + Fortran compiler being used. + + . Modify configure to run its tests in a subdirectory of the CAM build + directory. This avoids having the Makefile build the dependency list + for the full CAM just to run the tests, and consequently they run much + faster. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: described above + +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: eaton + +List all subroutines eliminated: + + bld/Makefile -- renamed Makefile.in + +List all subroutines added and what they do: + + bld/Makefile.in -- was Makefile + +List all existing files that have been modified, and describe the changes: + + bld/configure + . Remove -cam_cfg option and CAM_CFGDIR environment variable: require all + configuration files to be in the same directory as the configure script. + . remove -cam_root option and CAM_ROOT environment variable: require + configure to be located in the CAM src tree. + . Modifications for CCSM build: delete setting of locations for all + external include/mod/lib directories. These are only needed for the CAM + Makefile which is not produced when doing a CCSM build. + . Remove -esmf_* options. This was used with the ESMF prototype library + which is no longer supported. Will re-implement ESMF options when we + start linking the new ESMF library. + . add -linker option + . use it to set the USER_LINKER macro in the Makefile + . Run tests in a subdirectory of the CAM build directory. + + bld/Makefile.in + . add "--openmp --threadheap 4096" to FFLAGS and LDFLAGS when SMP is + defined for lf95 compiler + . add -mp to FFLAGS and LDFLAGS when SMP is defined for pathf90 compiler + . Remove default settings of macros that are set by configure. + . Remove ESMF macros except for ESMF_MOD and ESMF_LIB. Currently these are + not set by configure, but they will be when we start linking to the ESMF + library. + . add LINKER macro to be used to link cam executable. + . set LINKER to $(USER_LINKER) if it's defined, otherwise use platform + default which is $(FC) on most platforms, but is "$(CC) -f90lib" on the + SX6 and ES. + + bld/mkDepends + . add fix from Tom Henderson to include Fortran syntax includes in the + dependencies (previously only recognized cpp syntax). + +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. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + NONE + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_50 +Originator(s): eaton +Date: Sat Feb 4 08:28:03 MST 2006 +One-line Summary: Fix FV memory leak & non-adv tracers. SCAM bugfixes. Fix Cray build problem. + +Purpose of changes: + + 1. Fix for FV memory leak found by Siddhartha Ghosh + + 2. Mods FV dycore from Jean-Francois Lamarque to advect only the advected + constituents + + 3. Mod from Rob Jacob to fix the MCT problem on the Cray (replace + "system" call with "ishell") + + 4. Bug fixes for scam from John Truesdale + . Corrects a C++ usage error when using the newest gcc compiler + . Allows the model to use scam generated initial conditions. + . Allows the model to use user generated data for input. + +Bugs fixed (include bugzilla ID): + + Described in Purpose of changes section. The memory leak in FV is + bugzilla ID 26. + +Describe any changes made to build system: + + Define the SYSUNICOS cpp macro when running on Cray. + +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: eaton + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + 1. FV memory leak + dynamics/fv/FVCAM_GridCompMod.F90 + . move allocation of q_internal to top of run method, and deallocation to + bottom of method -- like all the rest of the allocation/deallocation + pairs. + + 2. Mods FV dycore + dynamics/fv/FVCAM_GridCompMod.F90 + . call create_vars with ntotq as actual arg rather than nq + dynamics/fv/inital.F90 + . use pcnst as actual arg corresponding to dummy arg nq in Initialize arg + list + dynamics/fv/restart_dynamics.F90 + . use pcnst as actual arg corresponding to dummy arg nq in Initialize arg + list + + 3. Mod to fix the MCT problem on the Cray + bld/Makefile + . add -DSYSUNICOS to FPPFLAGS for UNICOS/mp build + + 4. Bug fixes for scam + scm_init/runtype.h + scm_init/readsaveinit.F90 + ui/LoadData.ui + ui/plot.h + ui/dataset.cpp + ui/LoadDataImpl.cpp + ui/ncfile.h + + Changes to external code: + + The following fix was made in $SVNREPOS/mct/trunk/mpeu + m_FileResolv.F90 + . use ishell rather than system command when SYSUNICOS is #define'd + + A new tag for MCT was created: $SVNREPOS/mct/mct/trunk_tags/MCT2_2_0_060203 + and CAM's external property for MCT was changed to that tag. + +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. + +bluesky: All PASS + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_49 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_49 +Originator(s): Tony Craig +Date: Thu Feb 2 11:10:17 MST 2006 +One-line Summary: + + Update CLM source code to clm3_expa_56 + +Purpose of changes: + + Bring in a latest version of clm3 which includes changes in + infrastructure to support finemesh integrations. This version + of clm is 100% backward compatable with namelist and datasets + and is bfb with recent version of clm3. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +Describe any changes made to the namelist: new optional namelist + added to clm, fatmgrid. + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: tcraig, mvr + +List all subroutines eliminated: No changes in CAM + +List all subroutines added and what they do: No changes in CAM + +List all existing files that have been modified, and describe the changes: + No changes in CAM + +models/lnd/clm2/src/main: + initGridIndexMod.F90,lnd2atmMod.F90,CNiniTimeVar.F90, + abortutils.F90,clm_comp.F90,driver.F90,clm_camMod.F90,atmdrvMod.F90, + subgridRestMod.F90,accFldsMod.F90,clmtypeInitMod.F90,initializeMod.F90, + pftdynMod.F90,iniTimeConst.F90,histFileMod.F90,program_csm.F90, + clm_atmlnd.F90,clm_varsur.F90,clm_csmMod.F90,restFileMod.F90, + surfFileMod.F90,controlMod.F90,initSurfAlbMod.F90,initSubgridMod.F90, + clm_varctl.F90,ndepFileMod.F90,initGridCellsMod.F90,MCT_lnd_comp.F90, + program_off.F90,domainMod.F90,decompMod.F90,areaMod.F90,clmtype.F90, + histFldsMod.F90 + +models/lnd/clm2/src/riverroute: + RtmMod.F90 + +models/lnd/clm2/src/biogeochem: + CASAMod.F90,DUSTMod.F90,CNPhenologyMod.F90,STATICEcosysDynMod.F90, + DGVMMod.F90,CNrestMod.F90,VOCEmissionMod.F90,CNNDynamicsMod.F90, + CNVegStructUpdateMod.F90 + +models/lnd/clm2/src/biogeophys: + BalanceCheckMod.F90,SurfaceRadiationMod.F90,SoilTemperatureMod.F90, + Biogeophysics1Mod.F90,Biogeophysics2Mod.F90,FrictionVelocityMod.F90, + Hydrology1Mod.F90,Hydrology2Mod.F90,BiogeophysicsLakeMod.F90, + HydrologyLakeMod.F90,BareGroundFluxesMod.F90,CanopyFluxesMod.F90 + SurfaceAlbedoMod.F90 + +Code changes: *** Only in clm code *** + Merge atm2lnd_state_type, atm2lnd_flux_type. Same for lnd2atm state/flux. + Related changes in clm3 and elsewhere in code. + Add domainMod.F90 and domain_type. Migrate grid data into domain type. + Instantiate adomain(atm/coarse), ldomain(lnd/finemesh), rdomain(rtm), + ddomain(atmdrv external data) in model. + Add lats, latn, lonw, lone 2d arrays and associated code changes. + Cleanup areaMod.F90; merging subroutines, removing redundant code, eliminate + *_point routines. + Remove numlon + Add decomp_type for gcelldc and gcellsn. Remove redundant data in other + arrays related to addressing physical space and logical space. + Clean up interface in set_landunit subroutines. Remove redundant code. + Clean up procs and clumps datatypes, removing redundant data. + Migrate clm3 topology data to pointers from copies + Add gridmap_type for interpolation and associated code and routines to + support the type. + Add clm_atmlnd.F90 file for upscale/downscale code. Add clm_mapa2l + and clm_mapl2a to carry out mapping associated with upscale/downscale. + Add gridmap_setmapsFM for generation of weights for downscale/upscale + routines. + forc_ndep should not be in atm2lnd_type. + Reuse new code as much as possible throughout. + Rename latixy and longxy to latc and lonc. + Remove fullgrid attribute. + Add pftm to domain datatype and history file + Modify coupling to handle coarse <-> finemesh for standlaone, cam, and + ccsm. + Add normalized area to history files + Add lat_a, lon_a, latdeg_a, londeg_a to clm3 datatype for atm lats/lons. + required in SurfaceAlbedo computation where the the zenith angle has + to be based on the atm (coarse) grid, not the fine clm grid. + + +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. + +bluesky: All PASS + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_48 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + Answers are bit-for-bit. + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== + +=============================================================== + +Tag name: cam3_2_48 +Originator(s): Francis Vitt +Date: +One-line Summary: + + Update to the tropospheric chemistry code and fixes to the offline driver. + +Purpose of changes: + + The updates to the tropospheric chemistry code where done to include + into CAM the latest MOZART chemistry and to provide the option to + to use interactive dry deposition and interactive photolysis rates + rather than the prescribed table look up methods. + + Changes to the offline dynamics driver were done to fix a total energy + conservation issue that was evident with simulations longer than two + months. A fix to a bug which occurred in high resolution runs is also + included. + +Bugs fixed (include bugzilla ID): + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + +added: + + character(len=256) :: depvel_file + character(len=256) :: depvel_lnd_file + character(len=256) :: clim_soilw_file + character(len=256) :: season_wes_file + character(len=256) :: trop_pause_file + character(len=256) :: lght_landmask_file + real(r8) :: lght_no_prd_factor + logical :: xactive_prates + logical :: xactive_drydep + character(len=256) :: photopath + character(len=8) :: emis_type + integer :: emis_date + integer :: emis_yr_offset + character(len=256) :: met_filenames_list + +removed: + chem_config + +List any changes to the defaults for the boundary datasets: + +Describe any substantial timing or memory changes: + +Code reviewed by: Brian Eaton + +List all subroutines eliminated: + + models/atm/cam/src/chemistry/trop_mozart/mo_waccm_photo.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_read_chm_sim.F90 + models/atm/cam/src/chemistry/trop_mozart/phtadj.F90 + models/atm/cam/src/chemistry/trop_mozart/rxtmod.F90 + +List all subroutines added and what they do: + + models/atm/cam/src/chemistry/trop_mozart/mo_wavelen.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_cnum.F90 + models/atm/cam/src/chemistry/trop_mozart/mak_grp_vmr.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_phtadj.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_airmas.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_photoin.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setaer.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_trislv.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setair.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_waveall.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_seto2.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_tropopause.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_schu.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_rtlink.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_addpnt.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_constants.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_sim_dat.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_lymana.F90 + models/atm/cam/src/chemistry/trop_mozart/time_utils.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setz.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_calcoe.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_zadj.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_pchem.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_ps2str.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_sphers.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setozo.F90 + models/atm/cam/src/chemistry/trop_mozart/m_types.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_photo.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_tuv_inti.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_strato_sad.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_waveo3.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_rxt_mod.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setcld.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_xsections.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_drydep_tables.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_inter.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_wavelab.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_params.F90 + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/bld/config_trop_chem_mozart_defaults.xml + the number of advected constituents has changed to 99 for the tropospheric chemistry + models/atm/cam/bld/camexp.pm + models/atm/cam/bld/DefaultCAMEXPNamelist.xml + made changes to be consistent with the changes to the namelist variables + models/atm/cam/src/control/readinitial.F90 + moved from stepon the adjustment to the top interface pressure when zero + models/atm/cam/src/control/runtime_opts.F90 + see namelist changes above + models/atm/cam/src/control/wrap_nf.F90 + added subroutines wrap_inq_varndims and wrap_get_vara_text + models/atm/cam/src/control/history.F90 + made module variable fieldname_len public and increase its value to 16 + models/atm/cam/src/utils/string_utils.F90 + made GLC function public + models/atm/cam/src/physics/cam1/comsrf.F90 + added fsds field + models/atm/cam/src/physics/cam1/diagnostics.F90 + increased the length of string variable dcconnam + models/atm/cam/src/physics/cam1/tphysbc.F90 + changed the intent on fsds argument variable to inout + models/atm/cam/src/physics/cam1/check_energy.F90 + don't adjust the total global energy in offline mode + models/atm/cam/src/physics/cam1/restart_physics.F90 + models/atm/cam/src/physics/cam1/constituents.F90 + increased the length of string variable names + models/atm/cam/src/physics/cam1/physpkg.F90 + removed module variable fsds + models/atm/cam/src/physics/cam1/chemistry.F90 + made the chemistry interface consistent with trop_mozart + models/atm/cam/src/physics/cam1/tphysac.F90 + the arguments to subroutine chem_timestep_tend has changed + models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + increased the length of vdiffnam string variable + models/atm/cam/src/physics/waccm/chemistry.F90 + made the chemistry interface consistent with trop_mozart + models/atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_mean_mass.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_adjrxt.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 + models/atm/cam/src/chemistry/trop_mozart/m_rxt_id.F90 + models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 + models/atm/cam/src/chemistry/trop_mozart/chem_mods.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 + models/atm/cam/src/chemistry/trop_mozart/m_het_id.F90 + models/atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 + models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 + update the tropospheric chemistry code to be consistent with MOZART 4 + models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 + made the chemistry interface consistent with trop_mozart + models/atm/cam/src/dynamics/fv/pfixer.F90 + changed variable names and cleaned up code + models/atm/cam/src/dynamics/fv/spmd_dyn.F90 + fixed a bug in compute_gsfactors which occurs when 2D decomposition is used + models/atm/cam/src/dynamics/fv/stepon.F90 + removed the adjustment to the top interface pressure if zero + models/atm/cam/src/dynamics/fv/metdata.F90 + Made changes to get the observed surface pressure at sub-timestep + interval times. This is needed for the high resolution bug fix. + models/atm/cam/src/dynamics/fv/FVCAM_GridCompMod.F90 + Made changes needed to fix the bug in the offline driver used in + high resolution simulations. + +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. + +bluesky: + +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 + +Changes to the trop_mozart chemistry have caused the base line comparison +to fail as expected. + +tempest: All PASS + +bangkok/lf95: All PASS + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_47 +Originator(s): eaton, mvr +Date: Thu Jan 19 12:01:57 MST 2006 +One-line Summary: + + Workaround for xlf90 (v9.1.0.3) bug (on bluevista) & test script updates. + +Purpose of changes: + + The workaround for the compiler bug allows running on bluevista. Note + that there is still an unresolved bug on the platform affecting the + trop_mozart chemistry mode. + + The TBR.sh test script has been modified to work around a GPFS + problem (sometimes files that have just been copied don't appear in the + output from an "ls" command executed in the directory that the files were + just copied to) which causes the branch test to fail intermittently on bluesky. + + Misc changes in the overnight test scripts. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: eaton, mvr + +List all subroutines eliminated: + + models/atm/cam/test/system/update_collections.sh + +List all subroutines added and what they do: + + models/atm/cam/test/system/tag_email.sh + +List all existing files that have been modified, and describe the changes: + + models/atm/cam/src/physics/cam1/physpkg.F90 + . in phys_init pass phys_state(begchunk:endchunk) to chem_init and + ozone_data_init + + models/atm/cam/test/system/TBR.sh + models/atm/cam/test/system/td_nightly_aix.sh + models/atm/cam/test/system/td_nightly_linux.sh + +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. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_46 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + Answers are bit-for-bit. + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_46 +Originator(s): eaton +Date: Mon Jan 9 16:58:42 MST 2006 +One-line Summary: refactor restart logic and fix restart bug + +Purpose of changes: + + Provide control of when restart files are written that is decoupled from + the behavior of CAM's history file writes. + + Also did some cleanup work: + . get rid of anncyc, nlhst, itsst + . move nlres and lbrnch into restart module -- get it out of comctl.h + . call set_restart_filepath from restart_setopts -- remove from runtime_opts + . move the restart filepaths into the restart module -- get them out of filepaths.F90 + +Bugs fixed (include bugzilla ID): + + At cam3_2_24 the restart writes for fields needed by CAM's ocean and sea + ice modules were moved into the run methods for those modules. This broke + the writing of restart files in all situations except at the end of the + model run when the restart triggers off the nlend flag. + + The problem is that the calls to write the restart files for the ocean and + ice models are made before atm_run4 which makes the calls to write CAM's + history file. Since the old logic to determine when it's time to write a + restart file depended on the state in CAM's history module, and that state + was being updated after the calls to write the ocean and ice restart files, + the ocn and ice restarts were out of sync with CAM's restarts except when + nlend=.true. The fix was to implement a separate logic for writing restart + files that doesn't depend on the state of CAM's history module. + +Describe any changes made to build system: none + +Describe any changes made to the namelist: + + The namelist variables nrefrq and itsst have been eliminated. + + New namelist variables added: + logical :: no_restart ! true => turn off all restart writes (default: false) + integer :: restart_nsteps ! restart interval in steps + integer :: restart_nhours ! restart interval in hours + integer :: restart_ndays ! restart interval in days + logical :: restart_monthly ! true => write restart at begining of each month (default: true) + logical :: restart_yearly ! true => write restart at begining of each year + +List any changes to the defaults for the boundary datasets: none + +Describe any substantial timing or memory changes: none + +Code reviewed by: mvertens reviewed CLM code changes + +List all subroutines eliminated: + + control/rstwr.F90 + . remove this file -- subroutine added to restart module + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + control/cam.F90 + . change rstwr from external to local variable. add init before timestep + loop. + . add rstwr as actual arg to ocn_run, ice_run, atm_run4 + . add rstwr actual arg to clm_camRun (lnd_run) + + control/cam_comp.F90 + . add rstwr dummy arg to cam_run4 and remove the external declaration + . change write_restart call logic to only use rstwr + . set rstwr using restart_is_write_step method + + control/ccsm_msg.F90 + . add rstwr intent(out) arg to ccsm_run and remove the external declaration + . move the logic to set rstwr from the old rstwr function into ccsm_run + . change write_restart_ccsm call logic to only use rstwr + + control/comctl.h + . remove nrefrq + . remove anncyc -- no longer used + . remove nlhst -- it is equivalent to lbrnch + . remove itsst -- obsolete and broken + . move nlres and lbrnch to restart.F90 + + control/filenames.F90 + . remove comctl.h + . remove nrefrq dependence on initializing rest_pfile + . move nrevsn and rest_pfile to restart module + + control/history.F90 + . add rstwr dummy arg to wrapup and remove the external declaration + + control/restart.F90 + . extend functionality of this module to include the control of setting the + restart write time. + . add restart_is_write_step method. This started as the rstwr + function in rstwr.F90. + . add restart_init to initialize the restart write time + . add restart_{default,set}opts methods for namelist + . restart_setopts provides checking of the namelist settings and echos a + summary to the log file. + . add next_write_{ymd,tod} to restart file + . replace use of nlhst with lbrnch + . add nlres and lbrnch control variables (moved here from comctl.h) + . add nsrest as intent(in) arg of the restart_setopts method - it's needed + to set the values of nlres and lbrnch + . remove comctl.h -- no longer needed + + control/runtime_opts.F90 + . remove nrefrq + . add restart write interval namelist variables + . add restart_{default,set}opts calls + . add mpibcast calls + . replace use of nlhst with lbrnch + . add nlres and lbrnch control variables (moved here from comctl.h) + . add nsrest as intent(in) arg of the restart_setopts method - it's needed + to set the values of nlres and lbrnch + . remove comctl.h -- no longer needed + + control/startup_initialconds.F90 + . add restart_init call to setup_initial method + + control/time_manager.F90 + . cleanup some comments + . remove target attribute from tm_cal + . remove public attribute from tm_clock + . add new methods: + timemgr_time_ge ! check if time2 is later than or equal to time1 + timemgr_time_inc ! increment time instant by a given time interval + + dynamics/eul/initcom.F90 + . use nsrest instead of nlres in conditional + + ice/csim4/camice.F90 + . remove comctl.h from camice_write_restart -- not used + . add rstwr dummy arg to camice_run and remove the external declaration + . change camice_write_restart call logic to only use rstwr + . remove unused ref to nrevsn + + ocnsice/dom/camoce.F90 + . add rstwr dummy arg to camoce_run and remove the external declaration + . change camoce_write_restart call logic to only use rstwr + . remove anncyc -- no longer used + . remove itsst -- obsolete and broken + . remove unused ref to nrevsn + + ocnsice/som/somoce.F90 + . add rstwr dummy arg to somoce_run and remove the external declaration + . change somoce_write_restart call logic to only use rstwr + . remove unused ref to nrevsn + + test/system/nl_files/pghgsul + test/system/nl_files/ttrac + . add restart_nsteps setting to match history write frequency (these are + the only namelists used in the TBR tests) + + tools/scam/scm_init/scam_run.F90 + . add rstwr actual arg to ocn_run and ice_run calls. Hardwire value to + .false. (scam doesn't ask cam to write a restart file) + + Mods were made to the following CLM routines. These mods are accessed + via the external code svn:/clm2/branch_tags/clm3_expa_53_brnchT_cam01 + + clm/src/main/clm_camMod.F90 + . add rstwr intent(in) arg to clm_camRun and use it as actual arg in call to + clm_run2 + . remove setting of cam_nhtfrq, cam_mfilt to nhtfrq, mfilt. + + clm/src/main/clm_comp.F90 + . add rstwr intent(in) arg to clm_run2 and use it as actual arg in call to + driver2. + + clm/src/main/clm_varctl.F90 + . remove cam_nhtfrq and cam_mfilt -- no longer used + + clm/src/main/controlMod.F90 + . remove overwritting of hist_nhtfrq, hist_mfilt with cam_nhtfrq, cam_mfilt + + clm/src/main/driver.F90 + . add rstwr optional intent(in) arg to driver2 and use it in conditional for call to + restFile_write. + . check for presence of rstwr arg and use it to set local logical variable, + or use the do_restwrite method if it's not present. This allows driver2 + to continue to be used by the program_csm and program_off drivers. + + *** NOTE *** The following files have been moved from cam/src/control/ + to cam/src/utils/. (The reason is that by moving utility functions into + a separate directory it's easier to build unit testers using CAM's build + procedure which requires that all source files in each specified + directory be built.) + abortutils.F90 + cfort.h + spmd_utils.F90 + string_utils.F90 + time_manager.F90 + +If there were any failures reported from running test_driver.sh on any test +platform, and checkin with these failures has been OK'd by the gatekeeper, +then copy the lines from the td.*.status files for the failed tests to the +appropriate machine below. All failed tests must be justified. + +bluesky: All PASS. + +tempest: All PASS. + +bangkok/lf95: All PASS. + +CAM tag used for the baseline comparison tests if different than previous +tag: cam3_2_45 + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + + Answers are bit-for-bit. + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_45 +Originator(s): eaton +Date: Sun Dec 18 14:55:02 MST 2005 +One-line Summary: Bug fixes for memory leak and misc. + +Purpose of changes: bug fixes + +Bugs fixed (include bugzilla ID): + +1. Fix memory leak introduced in cam3_0_20. Briefly the problem is that the + overloaded .not. operator defined in diffusion_solver.F90 returns an object + of type vdiff_selector for which memory is allocated, but this operator is + used as an actual argument in the call to compute_vdiff in + vertical_diffusion.F90, and so the memory is never assigned to a variable + which can be deallocated. + +2. The T field in initial files for FV when 2D decomp is used are bad. + This was caused by a problem with an array index in + fv/diag_dynvar_ic.F90 + +3. The history restart files were being removed at the end of the run. The + normal CAM behavior is to not remove any files written at the end of the + run. + +4. The filepath for tgcm data was being truncated at 80 characters. + +Describe any changes made to build system: none + +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: + Memory leak fixed. The severity of this problem depends on what the + compiler did with an object returned by a function that was being used as + an actual argument. The problem was most severe with the lf95 compiler. + +Code reviewed by: myself + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + +Bug 1. + +physics/cam1/vertical_diffusion.F90 +. replace fieldlist by fieldlist_moist +. add fieldlist_dry to module data and replace .not.fieldlist w/ fieldlist_dry +. add fieldlist_dry as actual arg to init_vdiff +. use fieldlist_dry in 2nd call to compute_vdiff +physics/cam1/diffusion_solver.F90 +. add fieldlist_dry as dummy arg to init_vdiff and initialize it + +Bug 2. + +dynamics/fv/diag_dynvar_ic.F90 +. The outfld call for T&IC needs the array referenced as t3(1,kfirst,j), + not t3(1,1,j). + +Bug 3. + +control/history.F90 +. Change the argument in the putfil call that determines whether the file + is removed after it is archived from .true. to .not.nlend. +. Add nlend as a dummy arg to write_restart_history +control/restart.F90 +. add nlend to the actual args of write_restart_history + +Bug 4. + +physics/waccm/tgcm_forcing.F90 +. Change "character*80 locfn" to "character*256 locfn" at line 158 + +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. + +bluesky: +All PASS except: +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +tempest: +All PASS except: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +bangkok/lf95: +All PASS except: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 + +These tests are all expected to fail due to a bug in the current logic for +writing restart files. + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): + +If bitwise differences were observed, how did you show they were no worse +than roundoff? Answers are BFB. + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_44 +Originator(s): Mariana Vertenstein, Rob Jacob +Date: 2005-12-16 +One-line Summary: Incorprated MCT for cam-clm coupling + +Purpose of changes: Replaced current cam-clm lp-coupling scheme with + new MCT coupling and interfaces. + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: MCT is now built as part of the + CAM executable (since it is all F90 code) - configure was changed so + that the MCT filepath could be incorporated into the CAM build + +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 (from a preliminary + analysis of timing numbers). A more detailed timing analysis is planned. + +Code reviewed by: Mariana Vertenstein, Rob Jacob + +List all subroutines eliminated: none + +List all subroutines added and what they do: + + control/seq_fields_mod.F90 + provides list of fields to be coupled using same mechanism as in + concurrent ccsm mode + + control/MCT_seq.F90 + control/MCT_atm_comp.F90 + provide new MCT coupling interfaces + +List all existing files that have been modified, and describe the changes: + + physics/cam1/camhub_comp.F90 + cleaned up interfaces + + physics/cam1/prescribed_aerosols.F90 + bug fix (provided by Andrew Conley) - does not change answers + in current tests + + atm/cam/tools/scam/configure + atm/cam/tools/scam/scm_init/init_model.F90 + atm/cam/tools/scam/scm_init/scam_run.F90 + changes to SCAM in order to run with MCT cam-clm coupling + and also use new camhub_comp changes + +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. + +bluesky: + + 004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + 018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 + 043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 + +tempest: + + 003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + 020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 + 034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +bangkok/lf95: + + 003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 + 015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 + 031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 + +CAM tag used for the baseline comparison tests if different than previous +tag: previous tag + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): results were bit-for-bit + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +Tag name: cam3_2_43 +Originator(s): Mariana Vertenstein, Mat Rothstein +Date: 2005-12-15 +One-line Summary: Updated clm code to clm3_expa_52 + +Purpose of changes: +Update clm code base to clm3_expa_52 + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: Mariana Vertenstein, Keith Oleson + +List all subroutines eliminated: none + +List all subroutines added and what they do: none + +List all existing files that have been modified, and describe the changes: + + src/biogeochem/CASAMod.F90 + src/biogeochem/DGVMEstablishmentMod.F90 + src/biogeophys/CanopyFluxesMod.F90 + src/main/clm_varcon.F90 + src/main/time_manager.F90 + + - Put in changes to use esmf_wrf_timemgr code base + - Changes to clm_varcon.F90 and CanopyFluxesMod.F90 are + Changes made to the clm hydrology in tag clm3_expa_46 that were + increased the conductance of heat and moisture between the soil and the + canopy air space. This leads to the following changes in land climatology: global + increase in soil evaporation and a decrease in transpiration + and in the soil surface temperature. + +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. + +bluesky: +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 +008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 +015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 +044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 +047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 +054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 + +tempest: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 +007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 +014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 7 +017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 +038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 +045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 + +bangkok/lf95: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 +008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 +024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 +036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + +CAM tag used for the baseline comparison tests if different than previous +tag: + +Summarize any changes to answers: The above changes to clm lead to a new climate + +If bitwise differences were observed, how did you show they were no worse +than roundoff? NA + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced: + +- source tag (all code used must be in the repository): + cam3_2_40 (with clm source code corresponding to clm3_expa_48) + +- platform/compilers: + bluesky + +- configure commandline: + configure -ocn dom -dyn fv -spmd -smp -test -res 4x5 + +- build-namelist command (or complete namelist): +&camexp +absems_data = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/abs_ems_factors_fastvx.c030508.nc' +aeroptics = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolOptics_c050419.nc' +bnd_topo = '/fis/cgd/cseg/csm/inputdata/atm/cam/topo/USGS-gtopo30_4x5_remap_c050520.nc' +bndtvaer = '/fis/cgd/cseg/csm/inputdata/atm/cam/rad/AerosolMass_V_4x5_clim_c031022.nc' +bndtvo = '/fis/cgd/cseg/csm/inputdata/atm/cam/ozone/pcmdio3.r8.64x1_L60_clim_c970515.nc' +bndtvs = '/fis/cgd/cseg/csm/inputdata/atm/cam/sst/sst_HadOIBl_bc_4x5_clim_c030228.nc' +caseid = 'cam3_2_40_fv4x5dom' +dtime = 1800 +iyear_ad = 1950 +ncdata = '/fis/cgd/cseg/csm/inputdata/atm/cam/inic/fv/cami_0000-09-01_4x5_L26_c031217.nc' +nelapse = -1 +nsrest = 0 +/ +&clmexp +fpftcon = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/pftdata/pft-physiology-cn16.c040719' +fsurdat = '/fis/cgd/cseg/csm/inputdata/lnd/clm2/srfdata/cam/clms_3.1_4x5_c050523.nc' +/ + +- MSS location of output: + /OLESON/csm/cam3_2_40_fv4x5dom + +MSS location of control simulations used to validate new climate + /OLESON/csm/cam3_2_29_fv4x5dom + +URL for AMWG diagnostics output used to validate new climate: +http://www.cgd.ucar.edu/tss/clm/diagnostics/cam_clm2/cam3_2_40_fv4x5dom-cam3229_fv4x5dom/sets.htm + +=============================================================== +=============================================================== + +Tag name: cam3_2_42 +Originator(s): mvr +Date: 051213 +One-line Summary: csm_share, esmf_wrf_timemgr, timing now from +external sources; updated to share3_051205; new ChangeLog format + +Purpose of changes: taking advantage of some subversion features + +Bugs fixed (include bugzilla ID): none + +Describe any changes made to build system: none + +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: mvr, eaton + +List all subroutines eliminated: all csm_share, esmf_wrf_timemgr, and +timing files; +D models/utils/timing +D models/utils/timing/private.h +D models/utils/timing/gptl_papi.c +D models/utils/timing/rtcrate.F90 +D models/utils/timing/gptlutil.c +D models/utils/timing/threadutil.c +D models/utils/timing/gptl.c +D models/utils/timing/f_wrappers.c +D models/utils/timing/gptl.h +D models/utils/timing/README +D models/utils/timing/gptl.inc +D models/utils/esmf_wrf_timemgr +D models/utils/esmf_wrf_timemgr/ESMF_AlarmClockMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_CalendarMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_BaseMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_TimeMgr.inc +D models/utils/esmf_wrf_timemgr/ESMF_Mod.F90 +D models/utils/esmf_wrf_timemgr/c_esmc_subroutines.F90 +D models/utils/esmf_wrf_timemgr/ESMF_BaseTimeMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_ClockMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_AlarmMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_TimeMod.F90 +D models/utils/esmf_wrf_timemgr/ESMF_Macros.inc +D models/utils/esmf_wrf_timemgr/ESMF_Stubs.F90 +D models/utils/esmf_wrf_timemgr/ESMF_TimeIntervalMod.F90 +D models/utils/esmf_wrf_timemgr/wrf_error_fatal.F90 +D models/utils/esmf_wrf_timemgr/ESMF_FractionMod.F90 +D models/utils/esmf_wrf_timemgr/Makefile +D models/csm_share +D models/csm_share/ChangeLog +D models/csm_share/unit_testers +D models/csm_share/unit_testers/test_shr_sys.F90 +D models/csm_share/unit_testers/test_shr_orb.F90 +D models/csm_share/unit_testers/Makefile +D models/csm_share/ChangeSum +D models/csm_share/shr +D models/csm_share/shr/shr_date_mod.F90 +D models/csm_share/shr/shr_map_mod.F90 +D models/csm_share/shr/shr_sys_mod.F90 +D models/csm_share/shr/shr_file_mod.F90 +D models/csm_share/shr/shr_vmath_mod.F90 +D models/csm_share/shr/shr_timer_mod.F90 +D models/csm_share/shr/shr_orb_mod.F90 +D models/csm_share/shr/shr_kind_mod.F90 +D models/csm_share/shr/shr_tInterp_mod.F90 +D models/csm_share/shr/shr_mpi_mod.F90 +D models/csm_share/shr/shr_const_mod.F90 +D models/csm_share/shr/shr_msg_mod.F90 +D models/csm_share/shr/shr_stream_mod.F90 +D models/csm_share/shr/shr_ncread_mod.F90 +D models/csm_share/shr/shr_alarm_mod.F90 +D models/csm_share/shr/shr_cal_mod.F90 +D models/csm_share/shr/shr_vmath_fwrap.c +D models/csm_share/shr/shr_string_mod.F90 +D models/csm_share/README +D models/csm_share/cpl +D models/csm_share/cpl/cpl_kind_mod.F90 +D models/csm_share/cpl/cpl_const_mod.F90 +D models/csm_share/cpl/cpl_infobuf_mod.F90 +D models/csm_share/cpl/cpl_fields_mod.F90.CO2A +D models/csm_share/cpl/cpl_fields_mod.F90.CO2B +D models/csm_share/cpl/cpl_comm_mod.F90 +D models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA +D models/csm_share/cpl/cpl_iobin_mod.F90 +D models/csm_share/cpl/cpl_interface_mod.F90 +D models/csm_share/cpl/cpl_fields_mod.F90 +D models/csm_share/cpl/cpl_domain_mod.F90 +D models/csm_share/cpl/cpl_bundle_mod.F90 +D models/csm_share/cpl/cpl_contract_mod.F90 +D models/csm_share/cpl/cpl_map_mod.F90 +D models/csm_share/cpl/cpl_control_mod.F90 +D models/csm_share/cpl/cpl_mct_mod.F90 +D models/csm_share/cpl/cpl_iocdf_mod.F90 +D models/csm_share/README.scm +- all these replaced with subversion external directories + +D models/atm/cam/doc/BaseModelSum +D models/atm/cam/doc/BaseModelLog +- some documentation cleanup + +List all subroutines added and what they do: +A models/utils/SVN_EXTERNAL_DIRECTORIES +A models/SVN_EXTERNAL_DIRECTORIES +- contain definitions for the external directories + +A + models/atm/cam/doc/Copyright +- copy of the copyright information that'll be picked up by ccsm external pull + +A models/atm/cam/doc/ChangeLog_template +- template for new ChangeLog format + +List all existing files that have been modified, and describe the changes: + M models + M models/utils +- directories modified with properties for the external definitions + +M models/atm/cam/doc/ChangeLog +- added documentation for this tag + +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. + +bluesky: +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +tempest: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +bangkok/lf95: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 + + +CAM tag used for the baseline comparison tests if different than previous +tag: prev + +Summarize any changes to answers, i.e., +- what code configurations: +- what platforms/compilers: +- nature of change (roundoff; larger than roundoff but same climate; new + climate): b4b + +If bitwise differences were observed, how did you show they were no worse +than roundoff? + +If this tag changes climate describe the run(s) done to evaluate the new +climate in enough detail that it(they) could be reproduced, i.e., +- source tag (all code used must be in the repository): +- platform/compilers: +- configure commandline: +- build-namelist command (or complete namelist): +- MSS location of output: + +MSS location of control simulations used to validate new climate: + +URL for AMWG diagnostics output used to validate new climate: + +=============================================================== +=============================================================== + +cam3_2_41 +Originator: jet ( John Truesdale) +Date: Fri Dec 9 11:56:01 MST 2005 +Model: CAM +Version: CAM3.2.41 +One-line Summary: Fixed SCAM bugs, added SCAM tests to testscript, made SCAM datasets consistent with CAM +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no + +Substantial timing or memory changes: no +Requires change in run script: no + +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) + +bangkok: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 + +tempest: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +bluesky: +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 10 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 + + +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) + +Changes to CLM land-model: One - fixed bug with scam specific code. + +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +This is basically a bug fix for SCAM as well as adding some +small changes to get rid of autopromotion dependency in SCAM. +Changes are bit for bit for CAM/CCSM. I did update the datasets +used by SCM to by consistent with the latest datasets for CAM +so the CRM test output also needed to be updated to reflect this. + +A list of files changed follows: + +history_defaults.F90 - added cpp def BFB_CAM_SCAM_IOP around cam/scam + bfb specific code +runtime_opts.F90 - scam initializes with the name of the topo and initial + conditions datasets +startup_initialconds.F90 - made changes to include this file in scam + intial calls +inidat.F90 - changed scam specific code to use topo info off of topo dataset +.scam_defaults - updated to use topo file and newer boundary dataset files +scam/configure - Brian's changes to get rid of autopromotion +scam/testscript - added tests to check consistency of .scam_defaults + datasets with CAM namelist. + added tests for scam to run in default mode. +getnetcdfdata.F90 - Brian's changes to get rid of autopromotion +init_model.F90 - add topo dataset to scam +inital.F90 - call cam routine setup_initial from scam specific code. +ipc.h - added topo dataset to scam +runtype.h - added topo dataset to scam +scamMod.F90 - let scam initialize topo and initial conditions dataset names +scam_fifo.c - pass topo dataset to scam initialization +scam_run.F90 - fix bug with scam - don't run lsm if no land present +setlatlon.F90 - fix bug with scam - don't error out in iop run if iop + dataset has different column latitude and longitude than + initial data. +IOPSelectDateDlgImpl.cpp - cleanup +OptionsDlg.ui - add topo dataset to scam dataset tab in gui +OptionsDlgImpl.cpp - add topo dataset to scam dataset tab in gui +crm.cpp - add topo dataset to scam +dataset.cpp - add topo dataset to scam +fifomodel.cpp - add topo dataset to scam +manager.cpp - add topo dataset to scam +rpcmodel.cpp - add topo dataset to scam +crmtest26.out - crm radiation values changed slightly when we changed + the default datasets to match the current cam defaults +clm_camMod.F90 - fix bug with scam - don't run lsm if no land present also + get rid of spurious SCAM returns in this file + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_40 +Originator: jedwards ( James Edwards) +Date: Fri Dec 2 17:24:53 MST 2005 +Model: CAM +Version: CAM3.2.40 +One-line Summary: minor cleanup and extended testing of cam3_2_39 commit +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: testing was repeated against 3_2_38 +bangkok: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 +024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 +026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 + +tempest: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 + +bluesky: +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 +054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 + +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton +Restart files change: no +Changes answers: Yes (same-to-roundoff against 3_2_38) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +All reference to macros __FILE__ and __LINE__ have been removed. +File ozone_data.F90 was cleaned up to remove variables which are no longer used. +A further pergrow test was conducted with chemistry enabled since some of the changes in the previous commit involved chemistry but the pergrow test did not. This is why the test were rerun against 3_2_38 instead of 3_2_39. + +Besides we wanted to close the CVS repository with a nice even number. :-) + +=============================================================== +=============================================================== + +cam3_2_39 +Originator: jedwards ( James Edwards) +Date: Fri Dec 2 10:48:22 MST 2005 +Model: CAM +Version: CAM3.2.39 +One-line Summary: Consolidated zonal data input methods used by cam 1 chemistry and ozone files. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: +bluesky: +015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 10 +054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 +tempest: +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +bangkok: +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 +024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 +026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 7 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 +041 sc999 scamtest.sh .............................................FAIL! rc= 4 + +6+3 tests are expected to fail due to problems in the testing procedure introduced in cam3_2_37. +TBL tests failed due to order of operation changes. A perturbation growth test was conducted and passed to show these are errors are order round-off. +The scamtest does not work for me in the test script, the scamtest was sucessfully run by hand. + +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes (same-to-roundoff - details noted above.) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +Added file physics/cam1/zonalbndrydata.F90 +moved netcdf interface in chemistry.F90 and ozone_data.F90 to this new file. +In the past the chemistry file read a full years data at the initial time and held it in memory while the ozone file read two months data and updated during the run when it needed new data. The new file supports both methods but requires that you choose one or the other at compile time. The second method is now the default. + +Several minor changes were made in other files, mostly removing unused references to plat and plon. The interface was changed for one chemistry routine which required changes in all flavors of the chemistry files and dynamics inidat files. Below is a complete list of changed files: + + models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 + models/atm/cam/src/control/interpolate_data.F90 + models/atm/cam/src/control/runtime_opts.F90 + models/atm/cam/src/dynamics/eul/inidat.F90 + models/atm/cam/src/dynamics/fv/inidat.F90 + models/atm/cam/src/dynamics/sld/inidat.F90 + models/atm/cam/src/physics/cam1/advnce.F90 + models/atm/cam/src/physics/cam1/aerosol_intr.F90 + models/atm/cam/src/physics/cam1/chemistry.F90 + models/atm/cam/src/physics/cam1/drydep_mod.F90 + models/atm/cam/src/physics/cam1/ozone_data.F90 + models/atm/cam/src/physics/cam1/physpkg.F90 + models/atm/cam/src/physics/cam1/ramp_scon.F90 + models/atm/cam/src/physics/cam1/seasalt_intr.F90 + models/atm/cam/src/physics/cam1/stratiform.F90 + models/atm/cam/src/physics/cam1/tphysidl.F90 + models/atm/cam/src/physics/cam1/tracers.F90 + models/atm/cam/src/physics/cam1/volcanicmass.F90 + models/atm/cam/src/physics/waccm/chemistry.F90 + + +=============================================================== +=============================================================== + +cam3_2_38 +Originator: mirin ( Arthur Andrew Mirin) +Date: Tue Nov 29 16:50:01 MST 2005 +Model: CAM +Version: CAM3.2.38 +One-line Summary: (1) Restore FV options; (2) Cray-X1E communications, threading, streaming +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +No changes to file/directory structure +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: TBR.sh (Get clearance for failed tests, enter lines from td.*.status files that fail) +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (bluesky) +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 10 (bluesky) +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (bluesky) +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (tempest) +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 (tempest) +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 (tempest) +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 (bangkok) +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 (bangkok) +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 (bangkok) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer, Worley +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: Cray-X1E OpenMP/CSD compatibility +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: +(1) Restored nonworking FV options (geopktrans, tracertrans, modcomm-transpose, +modcomm_geopk) +(2) Added Shmem capability to Cray-X1E (USE_SHMEM if-def - affects mod_comm.F90) +(3) Allowed coexistence of OpenMP and CSD's on Cray-X1E provided they do not operate +on same loop index +(4) Removed nested OpenMP capability +Files changed: +models/atm/cam/bld: CAM_config.pm, config_trop_chem_mozart_defaults.xml, Makefile, +config_waccm_ghg_defaults.xml, config_cam_eul_defaults.xml, config_waccm_mozart_defaults.xml, +config_cam_fv_defaults.xml, configure, config_cam_sld_defaults.xml +models/atm/cam/src/control: runtime_opts.F90 +models/atm/cam/src/dynamics/eul: dyndrv.F90, realloc4.F90, scan2.F90, scanslt.F90 +models/atm/cam/src/dynamics/fv: FVCAM_GridCompMod.F90, geopk.F90, sw_core.F90, +cd_core.F90, pmgrid.F90, tp_core.F90, dynamics_vars.F90, spmd_dyn.F90, trac2d.F90 +models/atm/cam/src/dynamics/sld: realloc4.F90, scan2.F90 +models/atm/cam/src/physics/cam1: phys_grid.F90, radlw.F90 +models/lnd/clm2/src/main: areaMod.F90, driver.F90, histFileMod.F90, atmdrvMod.F90, +filterMod.F90, initializeMod.F90 +models/lnd/clm2/src/riverroute: RtmMod.F90 +lnd/clm2/tools/mksurfdata: mkdynpftMod.F90, mklaiMod.F90, pmkpftMod.F90, mksoitex.F90, +mkglacier.F90, mklanwat.F90, mksoicol.F90, mkurban.F90 +models/utils/pilgrim: mod_comm.F90 +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_37 +Originator: mvr ( Mathew Rothstein) +Date: Fri Nov 18 16:43:50 MST 2005 +Model: CAM +Version: CAM3.2.37 +One-line Summary: Bug fix for cam in ccsm; removed cam-specific code from csm_share; mod to branch test and other test suite cleanup +cam-bugs Requests resolved: none +Requires change in build system: yes +returned spmd mode to builds for ccsm (mistakenly removed with cam3_2_35) +Substantial timing or memory changes: yes, using spmd again in coupled mode +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: + +bluesky +004 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 6 +008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 6 +010 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 6 +013 bl134 TBL.sh e32dh adia 9 .....................................FAIL! rc= 6 +015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 6 +018 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 6 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 6 +024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 6 +027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 6 +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 6 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 6 +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 6 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 6 +043 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 6 +047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 6 +049 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 6 +052 bl534 TBL.sh s32dh adia 9 .....................................FAIL! rc= 6 +054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 6 +055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K ..........................FAIL! rc= 2 + +tempest +003 br131 TBR.sh e32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 6 +007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 6 +009 bl133 TBL.sh e32pdh aqpgro 3 ..................................FAIL! rc= 6 +012 bl135 TBL.sh e32dh idphys 9 ...................................FAIL! rc= 6 +014 bl152 TBL.sh e64o outfrq24h -2 ................................FAIL! rc= 6 +017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 6 +020 br331 TBR.sh f4c11dh pghgsul 6+3 ..............................FAIL! rc= 9 +021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 6 +024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 6 +026 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 6 +029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 6 +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 6 +034 br531 TBR.sh s32c11dh pghgsul 6+3 .............................FAIL! rc= 9 +035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 6 +038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 6 +040 bl533 TBL.sh s32pdh aqpgro 3 ..................................FAIL! rc= 6 +043 bl535 TBL.sh s32dh idphys 9 ...................................FAIL! rc= 6 +045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 6 + +bangkok +003 br111 TBR.sh e8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 6 +008 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 6 +010 bl113 TBL.sh e8pdm aqpgro 3 ...................................FAIL! rc= 6 +012 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 6 +015 br311 TBR.sh f10c8mdm ttrac 6+3 ...............................FAIL! rc= 9 +016 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 6 +024 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 6 +026 bl313 TBL.sh f10pdm aqpgro 3 ..................................FAIL! rc= 6 +028 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 6 +031 br511 TBR.sh s8c8mdm ttrac 6+3 ................................FAIL! rc= 9 +032 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 6 +036 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 6 +038 bl513 TBL.sh s8pdm aqpgro 3 ...................................FAIL! rc= 6 +040 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 6 + +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +M models/atm/cam/bld/configure +- bug fix for running cam in coupled mode with spmd + +M models/atm/cam/src/advection/slt/phcs.F90 +M models/atm/cam/src/chemistry/waccm_mozart/apex_subs.F90 +M models/atm/cam/src/control/gauaw_mod.F90 +M models/atm/cam/src/dynamics/fv/cd_core.F90 +M models/atm/cam/src/dynamics/fv/fill_module.F90 +M models/atm/cam/src/dynamics/fv/geopk.F90 +M models/atm/cam/src/dynamics/fv/pft_module.F90 +M models/atm/cam/src/dynamics/fv/sw_core.F90 +M models/csm_share/shr/shr_kind_mod.F90 +- moved cam-specific code out of csm_share + +M models/atm/cam/test/system/TBR.sh +M models/atm/cam/test/system/input_tests_master +- modified branch test to branch from an earlier restart file + +M models/atm/cam/test/system/TCB.ccsm.sh +M models/atm/cam/test/system/TSB.ccsm.sh +M models/atm/cam/test/system/test_driver.sh +- cleaned up use of environment vars CAMROOT and CAM_ROOT + +M models/atm/cam/test/system/td_nightly_aix.sh +M models/atm/cam/test/system/td_nightly_linux.sh +- just updating repository with mods to nightly scripts + +M models/atm/cam/test/system/TCB.ccsm.sh +- ccsm test will now use tags from ccsm3_1_beta* sequence + +M models/atm/cam/test/system/TBL.sh +M models/atm/cam/test/system/nl_files/adia +M models/atm/cam/test/system/nl_files/aqpgro +M models/atm/cam/test/system/nl_files/ghgrmp +M models/atm/cam/test/system/nl_files/idphys +M models/atm/cam/test/system/nl_files/no_ttrac +M models/atm/cam/test/system/nl_files/off2x2.5 +M models/atm/cam/test/system/nl_files/outfrq24h +M models/atm/cam/test/system/nl_files/outfrq3s +M models/atm/cam/test/system/nl_files/pghgsul +M models/atm/cam/test/system/nl_files/ttrac +M models/atm/cam/test/system/nl_files/ttrac_lb1 +M models/atm/cam/test/system/nl_files/ttrac_lb2 +M models/atm/cam/test/system/nl_files/ttrac_lb3 +- test suite now outputting history/restart files for each time sample + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_36 +Originator: jedwards ( James Edwards) +Date: Fri Nov 11 09:58:15 MST 2005 +Model: CAM +Version: CAM3.2.36 +One-line Summary: rework of new interpolation method, bug fix in phys_gmean, clean up in waccm_mozart +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Reworked recently introduced interpolation changes to contain the method within a physics chunk and eliminate dependence on the phys_grid module. + +Fixed a bug in phys_gmean in which the number of fields passed in was hardcoded, and the incoming number of fields argument was ignored. + +Removed unused 'use ' statements in waccm_mozart. +=============================================================== +=============================================================== + +cam3_2_35 +Originator: erik ( Erik Kluzek) +Date: Tue Nov 8 12:41:27 MST 2005 +Model: CAM +Version: CAM3.2.35 +One-line Summary: Remove prototype ESMF and use WRF implimentation of ESMF_2_1_0 API for time-manager, allow build to use external ESMF +cam-bugs Requests resolved: none +Requires change in build system: yes + (Configure changed so that Filepath also points to models/utils/esmf_wrf_timemgr) +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Remove: models/utils/esmf: + Remove all prototype ESMF files. + +Add: models/utils/esmf_wrf_timemgr: + Put in WRF implementation of ESMF_2_1_0 time-manager API. + +Changes to build: + Change build so default is to build with WRF ESMF time-manager. Can also use + externally compiled ESMF_2_1_0. + + Linking with external ESMF: non-default, have to build ESMF externally + and send appropriate command-line options to configure to use this option. + + Get rid of ESMF_ROOT as unneeded now. Now have three + tokens for dealing with ESMF: ESMF_BLD, ESMF_LIB, and ESMF_MOD. + Setting any of those threes means to link with external ESMF. + If ESMF_BLD is set, the Makefile will figure out the path + based on uname and debug option to the default version of ESMF. + If ESMF_LIB and ESMF_MOD are set the full paths will be used + for these two. The external version of ESMF that you link to is + assumed to be a current download of ESMF, which has it's own build + system. The current ESMF does not have a build for several important + platforms: Cray, Pathscale, ES, NEC etc, therefore only the esmf_wrf_timemgr + version can be used there. Also there were bugs with linking that will + need to be worked out on our standard platforms, before this will work + reliably + + Change configure so SPMD information isn't duplicated in configure output + files. + +Changes to time_manager: + + Update time_manager.F90 so uses the ESMF_2_1_0 API instead of the prototype + ESMF API. Create unit-tests in models/atm/cam/tests/unit/control to do + extensive testing of the time-manager interface. Runs different time-intervals and different ways of setting the stop-date, with one simulation period from + year 0 to year 9999. Answers were compared to the previous time-manager and + found to be bit-for-bit on IBM, SGI and Linux-PGI compilers. + + Calendar can not be set to GREGORIAN right now, only NOLEAP is allowed. + esmf_wrf_timemgr could be extended to allow both calendars, or we can start + using ESMF externally to handle both calendars. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_34 +Originator: jedwards ( James Edwards) +Date: Thu Nov 3 17:00:55 MST 2005 +Model: CAM +Version: CAM3.2.34 +One-line Summary: interpolation method changed in waccm chemistry +cam-bugs Requests resolved: none + +Requires change in build system: no + +Substantial timing or memory changes: Yes reduced memory profile of waccm/chemistry +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +plat and plon dependence were removed from waccm/chemistry.F90 +following the same method as cam1/chemistry.F90 +The method in cam1 was modified to read only on the masterproc, this does +not change the memory profile. + +=============================================================== +=============================================================== + +cam3_2_32 +Originator: mvr ( Mathew Rothstein) +Date: Fri Oct 28 16:58:34 MDT 2005 +Model: CAM +Version: CAM3.2.32 +One-line Summary: Update csm_share to share3_051025; update remaining clm files to clm3_expa_45 that were missed with previous tag +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.sh script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM : yes +Tested to work with SCAM : yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes, updated doc files to clm3_expa_45 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +M models/csm_share/ChangeLog +M models/csm_share/ChangeSum +M models/csm_share/cpl/cpl_contract_mod.F90 +M models/csm_share/cpl/cpl_domain_mod.F90 +M models/csm_share/cpl/cpl_fields_mod.F90 +M models/csm_share/cpl/cpl_fields_mod.F90.CO2A +M models/csm_share/cpl/cpl_fields_mod.F90.CO2B +M models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA +M models/csm_share/cpl/cpl_interface_mod.F90 +M models/csm_share/shr/shr_const_mod.F90 +M models/csm_share/shr/shr_map_mod.F90 +M models/csm_share/shr/shr_ncread_mod.F90 +M models/csm_share/shr/shr_stream_mod.F90 +M models/csm_share/shr/shr_timer_mod.F90 +M models/csm_share/unit_testers/test_shr_orb.F90 +M models/csm_share/unit_testers/test_shr_sys.F90 +- these are the files that changed between share3_050909 and share3_051025 + +M models/lnd/clm2/doc/ChangeLog +M models/lnd/clm2/doc/ChangeSum +- these are the files missed in updating between clm3_expa_29 and clm3_expa_45 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_31 +Originator: mvertens ( Mariana Vertenstein) +Date: Wed Oct 26 15:24:06 MDT 2005 +Model: CAM +Version: CAM3.2.31 +One-line Summary: updated clm to clm3_expa_45 (removed condition that clm and cam grid had to be bfb) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes (describe) +Requires change in run script: no +Ran test_driver.shl script: No (does all of the following tests) +Machines tested: IBM (ran 2 climate simulations on IBM - see below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes +Changes answers: Yes (same-climate) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +No cam physics code was modified. Only clm interface code was modified. +Modified models/lnd/clm2/src/main/clm_camMod.F90 (only several lines of clm code +were commented out) so that cam and clm grid do not have to be bfb. The +tolerance is that the grid latitudes/longitudes grids match to 1.e-12. +The fractional land however, must be identical. The clm code base has +now been updated to clm3_expa_45. + +Two 10 year integration for the entire set of physics changes using climatological SSTs +were performed. See: +/MVERTENS/csm/cam3_2_29_fv4x5dom (cam3_2_29 with changes to clm_camMod.F90) + vs +MVERTENs/csm/cam3_2_29_cam3_2_29_fv4x5dom_0 (cam3_2_29 with no changes) + +Diagnostic output is at: +http://www.cgd.ucar.edu/~mvertens/AMWG_diag/cam3229_fv4x5dom-cam3229_fv4x5dom_0/ +=============================================================== + +=============================================================== + +cam3_2_30 +Originator: mvr ( Mathew Rothstein) +Date: Thu Oct 20 09:49:40 MDT 2005 +Model: CAM +Version: CAM3.2.30 +One-line Summary: mods / new scripts added to cam's test suite for automated testing of new tags +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM : yes +Tested to work with SCAM : yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +A models/atm/cam/test/system/input_tests_aix_nightly +- test ids to run as part of nightly testing of new cam tags on bluesky (aix) +A models/atm/cam/test/system/input_tests_linux_nightly +- test ids to run as part of nightly testing of new cam tags on bangkok (linux) +A models/atm/cam/test/system/td_nightly_aix.sh +- cron script for overnight testing of new cam tag on bluesky (aix) +A models/atm/cam/test/system/td_nightly_linux.sh +- cron script for overnight testing of new cam tag on bangkok (linux) +A models/atm/cam/test/system/update_collections.sh +- cron script for overnight loading of latest cam tag on machine sanitas +M models/atm/cam/test/system/TCB.ccsm.sh +- added command to modify directory path to finite volume code in ccsm scripts +M models/atm/cam/test/system/input_tests_master +- added ccsm tests for running coupled model with finite volume dycore + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_29 +Originator: eaton ( Brian Eaton) +Date: Tue Oct 18 10:52:05 MDT 2005 +Model: CAM +Version: CAM3.2.29 +One-line Summary: add LANDFRAC file, move inti.F90 into phys_init +cam-bugs Requests resolved: bugzilla #19 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Added the ability to specify the file that contains the LANDFRAC field. +The namelist variable bnd_landfrac is used to specify the path of this +file. If not specified the default is to use the file that the topography +fields are read from. + +Moved the physics initialization routines into phys_init. Removed +subroutine inti. Also add initialization of grid information to the +physics_state objects that are allocated in phys_init. This information is +needed to be passed to the physics init routines that do spatial +interpolation of boundary data. + +Misc: +. Fix for problem with WACCM_MOZART on SGI: was failing to write abs/ems + restart file. Resolves bugzilla #19. +. Bugfix in lf95 section of Makefile (reference to apex_subs.F changed to + apex_subs.F90). + +=============================================================== +=============================================================== + +cam3_2_28 +Originator: mvertens ( Mariana Vertenstein) +Date: Mon Oct 17 09:35:36 MDT 2005 +Model: CAM +Version: CAM3.2.28 +One-line Summary: updated clm code clm3_expa_44 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes (all clm restarts, other than history restarts, are now NetCDF) +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes + Updated clm code to clm3_expa_44 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + Updated clm code to clm3_expa_44. Interfaces between cam and clm + (in clm_camMod.F90) have been modified to be consistent with + making clm a gridded component. The clm driver routine has now + also been split into two phases as part of this process. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_27 +Originator: jedwards ( James Edwards) +Date: Fri Oct 14 10:20:58 MDT 2005 +Model: CAM +Version: CAM3.2.27 +One-line Summary: consolidated linear interpolation schemes +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Merged lininterp.F90 bilin.F90 vertinterp.F90 and timinterp.F90 into a single module. added use statements for this module where appropriate + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_26 +Originator: pworley ( Patrick H Worley) +Date: Wed Oct 12 21:20:24 MDT 2005 +Model: CAM +Version: CAM3.2.26 +One-line Summary: Cray X1(E) optimizations for FV +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes - much faster on the X1E when using FV +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: failed all baseline comparisons tests for FV on bluesky. +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +024 bl333 TBL.sh f4pdh aqpgro 3 ...................................FAIL! rc= 7 +027 bl334 TBL.sh f4dh adia 9 ......................................FAIL! rc= 7 +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 +All other tests passed, and all tests passed on other two systems. pergro test +for FV on bluesky passed, indicating that change was within roundoff. +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Art Mirin, Will Sawyer +Restart files change: no +Changes answers: No for EUL and SLD, No for FV on SGI and Linux-Lahey, Yes for FV on IBM (same-to-roundoff) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +Synchronizing FV with NASA version introduced code that does run +efficiently on the Cray vector system (and probably not on the Earth Simulator +either). These changes bring performance back to what it was before, as well +as vectorizing buffer copies in the communication layer. + +dynamics/fv/cd_core.F90, dynamics/fv/sw_core.F90 + eliminated unnecessary array segment specifications in subroutine calls where it + was causing array copying +dynamics/fv/mapz_module.F90 + restructured recently added code to improve vectorization +dynamics/fv/trac2d.F90 + replaced pointer-based implementation of double buffering algorithm with an + equivalent index-based implementation, working around a problem on the Cray X1E +utils/pilgrim/mod_comm.F90, utils/pilgrim/parutilitiesmodule.F90 + restructured buffer copy loops for improved vectorization; general clean-up and optimization + +Some of the timer logic was also broken in a recent check-in: +control/cam.F90, control/cam_comp.F90 + fixed timer logic +utils/timing/gptl.c + fixed problems in mpi_wtime support in timing routines + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_25 +Originator: jeff ( Yen-Huei Lee) +Date: Fri Oct 7 09:16:46 MDT 2005 +Model: CAM +Version: CAM3.2.25 +One-line Summary: user specified constant co2 when running in ccsm +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton, Mathew Rothstein +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +modified the following files: + +models/atm/cam/src/control/runtime_opts.F90 +models/atm/cam/src/physics/cam1/radiation.F90 +models/atm/cam/src/physics/cam1/chem_surfvals.F90 +models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 +- add one namelist variable to allow user to specify a constant co2 (vmr) + for radiation calculation when running in CCSM, indepedent of other settings + of co2. + +models/atm/cam/src/control/ccsm_msg.F90 +- mod to support 1x1.25 resolution when running in CCSM. + +models/atm/cam/test/systems/TSB.ccsm.sh +- mod to run ccsm test effectively. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_24 +Originator: erik ( Erik Kluzek) +Date: Mon Oct 3 13:21:24 MDT 2005 +Model: CAM +Version: CAM3.2.24 +One-line Summary: Move time-loop to top driver, make multiple run methods in cam_comp and + stepon modules to reduce code duplication +cam-bugs Requests resolved: none +Requires change in build system: no (Remove auto-promotion on Darwin) +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, mvertens, mvr (testscript changes) +Restart files change: yes +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes! (clm_camMod only, move allocation method inside, create final method) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +High level structure changes: + +Make multiple run methods in cam_comp and stepon to reduce duplication and move +the time-loop up to the top level driver seq_ccsm -- still called cam.F90. +Remove nlend from comctl and make local data, passing down to relevant subroutines +and functions that need it. Make Gaussian weights and etamid module data +in cam_comp. Move all initialization calls for ocean or ice into one initialization +call (calls to read_restart_xxx moves to inside relevant initialize subroutine). And +move write_restart_xxx calls for ice and ocn inside of ice and ocean run method. Create +final methods for all component models (ice, ocn, land, atm). Use ncol in derived types +rather than using get_ncols_p method. Move tssub from surface_state derived type to private +data inside of camice. Move allocation of input/output derived types from driver to inside +of relevant component (ice, ocean, or land). Remove the temporary place-holder +restart_camsrf.F90 surface restart file. Remove ice_frac in camice and start using areafrac +and move merge of fractions to camhub_comp. This takes care of CCSM/ESMF Stage 1-2.6, 1.4 +and 1.7, and some work on 1.9.1. This creates drivers and component modules that have the +bulk of the Pre-ESMF work complete. + +See the "CCSM/ESMF Stage-1 Release Schedule" at... + + http://swiki.ucar.edu/start/66 + +SCAM Changes: + +Get SCAM and testscript to run on Darwin. Make Eulerian data dimensioned plat/2 to (plat+1)/2, +so will compile correctly with SCAM. Add "skip" and "noclean" as command-line arguments to +SCAM testscript to skip the CAM build/run and/or don't clean before the build of CAM or SCAM. +These are both useful for using testscript interactively for debugging running SCAM. Add +ability to testscript to run CAM at different resolutions and operate over any point +given (it gets the latitude and longitude needed for SCAM from the IOP file produced). + +CAM Makefile change: + +Get rid of auto-promotion on Darwin compile (Mac-OS-X with Absoft IBM XLF/XLC compilers). + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_23 +Originator: pworley ( Patrick H Worley) +Date: Thu Sep 29 15:42:12 MDT 2005 +Model: CAM +Version: CAM3.2.23 +One-line Summary: Explicitly typed variables and constants and deleted autopromotion of reals in Makefile. +cam-bugs Requests resolved: none +Requires change in build system: Yes - removed autopromotion flags from FFLAGS +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton, Art Mirin, Forrest Hoffman, Michael Ham +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes - Explicitly typed variables and constants +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Nearly every file in CAM standalone was modified, some extensively, but most +changes were "syntactic". Note that this includes most Fortran source in csm_share, ice, +lnd, and utils as well as in atm. Only the tool subdirectories were "spared". + +The steps were as follows: + +a) in atm/cam/src, the routines + +chemistry/waccm_mozart/apex_subs.F +chemistry/waccm_mozart/svdcmp.F +chemistry/waccm_mozart/wei96.F +physics/waccm/msise00.F +utils/fft99.F +utils/sgexx.F + + were all changed from fixed format that used implicit typing + to free free format with "implicit none" + and explicitly typing of all variables. (The suffixes + were all changed from .F to .F90 as well.) + +b) Tom Henderson's tool "addrealkind" was used to + change "real" declarations to "real(r8) and to add + "_r8" to all floating point constants that weren't already typed. + "use shr_kind_mod" was added where needed. + (For csm_share/shr. SHR_KIND_R8 was used instead of r8. + In csm_share/cpl, R8 was used. In ice/csim4, dbl_kind was used.) + + (For Tom's tool to work correctly, the name of the module was appended + to "end module" in a number of files, and "end" was replaced + by "end subroutine xxx" or "end function yyy" in a number of + files as well.) + + complex declarations were also changed to complex(r8) + +c) float(iii) and real(iii) were replaced by real(iii,r8). + cmplx(xxx,yyy) was replaced by cmplx(xxx,yyy,r8). + dble(iii) was replaced by real(iii,r16) if r16 was really necessary, + otherwise it was replaced by real(iii,r8). + Constants of the form xxx.yyyDeee were replaced by xxx.yyyEeee_r16 + if r16 was necessary, otherwise were replaced by xxx.yyy.Eeee_r8. + +d) specific intrinsics were changed to generic intrinsics, + e.g. alog10 was changed to log10, etc. + +e) removed local definitions of r8 and r16 when they were identical to + those in shr_kind_mod, but left the local definitions as is if they + were different. + +f) compiler flags that defined real variables to be double precision (or real*8) + and/or promoted floating point constants and intrinsics to double precision + were removed from the CAM makefile. (Something similar will need to + be done in CCSM.) + +Finally, a new command was added to phys_grid to indicated whether phys_grid +had been called or not. This logical function was used in camhub_comp.F90 +in place of the existing error-prone tests for this condition. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_22 +Originator: erik ( Erik Kluzek) +Date: Tue Sep 20 14:19:53 MDT 2005 +Model: CAM +Version: CAM3.2.22 +One-line Summary: Create cam_comp atmosphere component and make stepon a module, add Darwin (Mac-OS-X) as a platform +cam-bugs Requests resolved: none +Requires change in build system: no + (Did add changes to configure/build system so that can compile on Mac-OS-X with + Absoft XLC/XLF compilers. +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, mvertens +Restart files change: yes +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Interface with cam_comp changes +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Move the cam3_2_21_brnchT_chghilev_8 tag onto cam_dev. + +Add changes to esmf, cam, scam, and cprnc to build/run on Darwin (Mac-OS-X) platform +with the ABSOFT IBM XLF/XLC compilers. On Darwin scam will compile, but not link +at this point. More work needs to be done for it to completely build and run. + +Create a cam_comp component module to encapsulate the atmosphere part +of CAM. Make stepon into a module with initial, run and final methods. +Have scam interface with cam_comp rather than underlying subroutines. +Have scam interface with runtime_options in a more straightforward manner, +that won't require duplication of default settings for SCAM inside scam +initialization. Rename scam_inital to inital module a module for scam replacing +the Eulerian inital. + +The next step is to make cam_comp have multiple run phases, and stepon have +multiple run phases (this is outlined in each stepon). Then bring the time-loop +out of stepon and up to the driver level. The driver is still called cam.F90, but +will soon be refered to as sequential CCSM to distinquish it from cam_comp the +atmosphere only component, of the stand-alone CAM modeling system. + +This is documented as Stage-1.2-6 on the CCSM/ESMF webpages.... + +http://swiki.ucar.edu/start/83 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_21 +Originator: mvr ( Mathew Rothstein) +Date: Mon Sep 12 14:34:15 MDT 2005 +Model: CAM +Version: CAM3.2.21 +One-line Summary: re-work of ccsm test within cam test suite; updated to latest version of share code; mods to help waccm work in ccsm mode +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM: yes +Tested to work with SCAM: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +A models/atm/cam/test/system/gen_test_table.sh +- utility to generate html file with table of tests currently included in cam test suite + +A models/csm_share/cpl/cpl_fields_mod.F90.CO2A +A models/csm_share/cpl/cpl_fields_mod.F90.CO2B +A models/csm_share/cpl/cpl_fields_mod.F90.CO2_DMSA +A models/csm_share/shr/shr_map_mod.F90 +A models/csm_share/shr/shr_ncread_mod.F90 +A models/csm_share/shr/shr_stream_mod.F90 +A models/csm_share/shr/shr_string_mod.F90 +A models/csm_share/shr/shr_tInterp_mod.F90 +- added as part of update of share code from share3_0_2 to share3_050909 + +M models/atm/cam/bld/configure +- changed filepath for ccsm builds to correct location of waccm src +M models/atm/cam/src/physics/waccm/msise00.F +- changed the name of variable MSS to avoid ccsm pre-processor confusion +M models/atm/cam/test/system/TCB.ccsm.sh +- redirection of ccsm build test output to appropriate log file and some cleanup +M models/atm/cam/test/system/TCS.ccsm.sh +- re-working of ccsm test within cam test suite +M models/atm/cam/test/system/TMC.sh +- added some error checking to mass conservation test script +M models/atm/cam/test/system/TSB.ccsm.sh +- re-working of ccsm test within cam test suite +M models/atm/cam/test/system/test_driver.sh +- remove references to certain job log file if running interactively + +M models/csm_share/ChangeLog +M models/csm_share/ChangeSum +M models/csm_share/cpl/cpl_bundle_mod.F90 +M models/csm_share/cpl/cpl_comm_mod.F90 +M models/csm_share/cpl/cpl_contract_mod.F90 +M models/csm_share/cpl/cpl_control_mod.F90 +M models/csm_share/cpl/cpl_domain_mod.F90 +M models/csm_share/cpl/cpl_fields_mod.F90 +M models/csm_share/cpl/cpl_infobuf_mod.F90 +M models/csm_share/cpl/cpl_interface_mod.F90 +M models/csm_share/cpl/cpl_iobin_mod.F90 +M models/csm_share/cpl/cpl_iocdf_mod.F90 +M models/csm_share/cpl/cpl_map_mod.F90 +M models/csm_share/cpl/cpl_mct_mod.F90 +M models/csm_share/shr/shr_cal_mod.F90 +M models/csm_share/shr/shr_msg_mod.F90 +- modified as part of update of share code from share3_0_2 to share3_050909 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_20 +Originator: jedwards ( James Edwards) +Date: Wed Sep 7 14:22:57 MDT 2005 +Model: CAM +Version: CAM3.2.20 +One-line Summary: removed the comhyb.h commonblock, made hycoef a module. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: 055 cs999 TCS.ccsm.sh ER.01a T31_gx3v5 K +cam3_2_19 fails ccsm build, that failure is carried forward. + +Tested to work coupled with CCSM (create_ccsmcam): no - see above +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +changes made: removed the file comhyb.h and created a module hycoef. subroutine hycoef is renamed hycoef_init and the common block variables from comhyb +are now module variables. Replaced #include with +use hycoef, only : +this change affected a number of files across the structure. + +=============================================================== +=============================================================== + +cam3_2_19 +Originator: pworley (Pat Worley), eaton ( Brian Eaton) +Date: Tue Sep 6 16:01:22 MDT 2005 +Model: CAM +Version: CAM3.2.19 +One-line Summary: cray performance, XT3 support, timing lib mods +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes - restore Cray performance to levels before commit of cam3_2_1; + also, timing lib changes improve SGI Altix performance significantly. +Requires change in run script: no +Ran test_driver.sh script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: The CCSM test is failing because the CCSM scripts don't use CAM's Makefile. Will fix + the test by updating the appropriate CCSM template file. +Tested to work coupled with CCSM (create_ccsmcam): fails +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Worley, Eaton, Conley +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +> Makefile +> - set default C compiler to mpcc_r for AIX (was "cc") +> - added support for Cray XT3 in Linux section. +> (For XT3, set +> USER_FC := ftn +> USER_CC := cc +> and add -DCATAMOUNT to USER_CPPDEFS ). +> +> control/cam.F90 +> - added four timer calls (mpi_wtime), to get basic +> performance data (total, stepon, SYPD based on stepon time) +> even when -DDISABLE_TIMERS is specified. +> - moved first t_start calls to after spmdinit is called, +> to allow mpi_wtime to be used in the timing library +> - moved trunc call to after first t_start call, so as to +> include in measured initialization phase +> - #ifdef CATAMOUNT +> ! Improve performance of writing to standard out and error on XT3 +> ! (using Catamount kernel) by increasing buffer size. +> call usetlbuf() +> #endif +> +> control/get_memusage.c +> - Linux branch of get_memusage breaks the code on the XT3. +> Disabled the routine when CATAMOUNT defined. +> +> #ifdef CATAMOUNT +> return -1; +> #else ... +> +> dynamics/fv/cd_core.F90 +> - added CSD call (Cray Streaming Directive, for use on Cray X1(E) ) +> that was mistakenly not included in earlier check-in. +> +> physics/cam1/aerosol_radiation_interface.F90 +> - promoted local 1D arrays to 2D; added CSD; moved diagnostic output +> to separate loop; in order to recover vectorization and streaming +> lost in cam3_2_1 check-in +> +> physics/cam1/radsw.F90 +> - deleted hanging CSD region delimiter +> +> utils/timing/gptl.c +> - added support for using mpi_wtime instead of gettimeofday when +> SPMD specified. (This improves performance on SGI Altix significantly, +> and allows timers to be used on Cray XT3.) +> - added call to rtcrate on Cray X1(E) systems, removing hardcoded +> ticks_per_sec value (that is different on X1 and X1E). +> - increased number of digits in timing data output +> +> utils/timing/private.h +> - defined fields needed when using mpi_wtime to measure time +> +> 2 files added: +> +> control/uselbuf.c +> +> - set system buffering for output to stdout and stderr. +> Needed on Cray XT3 to workaround performance problem. +> +> utils/timing/rtcrate.F90 +> +> - C-callable Fortran function that calls irtc_rate intrinsic +> and returns the value (when #ifdef UNICOSMP). + + + +=============================================================== +=============================================================== + +cam3_2_18 +Originator: jedwards (Jim Edwards) eaton (Brian Eaton) +Date: Mon Sep 5 09:42:57 MDT 2005 +Model: CAM +Version: CAM3.2.18 +One-line Summary: spmd_utils module mods +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: jedwards, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Consolidate code into spmd_utils.F90 that sets up the generic spmd +environment. In particular, move pmgrid variables masterproc and iam, +spmd_dyn variables npes, nsmps, proc_smp_map, and the subroutines from the +files spmdinit.F90 and swap_comm.F90 into the spmd_utils module. The +subroutine spmdinit has been modified to initialize these public variables +whether SPMD is defined or not. Hence the "ifdef SPMD" conditional has +been removed from the call to spmdinit in the main cam program. + +Because these variables are so widely used this change touches about 150 +files. Most the changes are only one or two lines of modified "use" +association statements. + +=============================================================== +=============================================================== + +cam3_2_17 +Originator: erik ( Erik Kluzek) +Date: Tue Aug 30 16:32:07 MDT 2005 +Model: CAM +Version: CAM3.2.17 +One-line Summary: Resolve special physics modes beneath driver, move surface restart to seperate call +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: ideal-phys bit-for-bit test + 029 bl335 TBL.sh f4dh idphys 9 ....................................FAIL! rc= 7 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) (Except FV ideal_phys test, because was previously broken) +Changes to CLM land-model: Add noland mode for adibatic,ideal_phys, aqua +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Resolve the non-physics modes of CAM (adiabatic, ideal_phys, and aquaplanet) +below the driver level, so that components know the appropriate action, but +the driver isn't aware of it. Continue to use the common block for the data +that signals this behavior, but move the behavior completely inside of ice, +ocean or land surface models. + +Also move the read of surface initial data and restart information outside +of cam_intial and read_restart to methods just before surface model +initialization. This means breaking up the restart so that intht is called +later, the read_history is called later, and the close of nrg is done at this +later step as well. Move the nrg unit numbers to wholy contained within the +relevent restart modules. + +This actually allows CCSM mode to make use of ideal_phys, or adiabatic, +unlike previously where it wasn't a possiblity. + +Documentation fully spelled out at: + +Pre-ESMF Stage-1.2.3 checkin from + + http://swiki.ucar.edu/start/82 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_16 +Originator: jedwards ( James Edwards) +Date: Mon Aug 29 20:40:09 MDT 2005 +Model: CAM +Version: CAM3.2.16 +One-line Summary: added 'only' clause to some and removed other module statements +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.sh script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml + +Changes Made: + minor changes were made to a number of files which use modules from + the dynamics directories. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_15 +Originator: erik ( Erik Kluzek) +Date: Mon Aug 22 11:36:09 MDT 2005 +Model: CAM +Version: CAM3.2.15 +One-line Summary: Split comsrf into three parts move calls to surface models up to cam.F90 and stepon.F90 level +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.sh script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) + License problems with scamtest +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Pass in new structures to it +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Put cam3_2_14_brnchT_chghilev_2 on the main trunk (with some SCAM changes made so +that CRM should operate properly). Didn't test for anything beyond testscript. + +Changes defined in pre-ESMF Stage-1-2 + + http://swiki.ucar.edu/start/73 + +Make physpkg into a module with and initial and 2 run phase methods. +Move the initialization calls of the surface models to cam.F90. +Move the run calls of the surface models to stepon.F90. + +Divide comsrf into 3 parts: + +comsrf.F90 ------- miscellaneous 2D arrays that should be moved into relevant packages (physics, + ice, or ocean) +camhub_comp.F90 --- Responsible for merging surface models (land, ice, ocean) into a merged + surface state +camsrfexch_types -- definition of derived data types for exchange of surface information + between surface models + +Move landfrac, ocnfrac and icefrac into merged surface derived type. + +Move instantiation of surface exchange types to top driver level. Pass down data types +to relevant subroutines. + +Make physpkg into a module with and initial and 2 run phase methods. +Move the initialization calls of the surface models to cam.F90. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_14 +Originator: boville (Byron Boville), eaton (Brian Eaton) +Date: Fri Aug 12 16:12:13 MDT 2005 +Model: CAM +Version: CAM3.2.14 +One-line Summary: history module mods +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: boville, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Some cleanup of the history module - mainly moving addfld and add_default +calls to the modules that are responsible for defining a quantity and +making outfld calls for it. This gets rid of most of bldfld and h_default. +What remains of those subroutines has been merged into bldfld, and bldfld +has been moved into history_defaults.F90 which we expect to eventually go +away. Also, the SCAM specific routines have been put into +history_scam.F90. What's left in the history module is intended to be the +generic history module interface. + +The functionality of the history module has been extended so that the +defined history files don't have to be sequential, e.g., a user can now +remove fincl2 from a namelist that contains specifications for fincl2 and +fincl3 without having to rename fincl3 to fincl2. Previously the renaming +would have been necessary because having the 2nd history file empty when +the 3rd file was not empty was not allowed. However, this new +functionality was not motivated by increased user convenience which is +pretty negligible. The real reason for this change was to allow more +flexibility in where the calls are made to add fields to the initial file +which is just a special history file which is always the last one in the +list. By allowing the list to contain empty files, the index of initial +file can now be terminal list index which is known at compile time, rather +than being the index that follows the last user or code defined history +file which isn't known until after processing all the add_default calls +which can occur at any point during the physics initialization. + +precc_thresh and precl_thresh have been removed from the namelist. + + +=============================================================== +=============================================================== + +cam3_2_13 +Originator: mvr ( Mathew Rothstein) +Date: Thu Aug 11 12:29:05 MDT 2005 +Model: CAM +Version: CAM3.2.13 +One-line Summary: Added tests to default CAM test suite; various bug fixes and cleanup +cam-bugs Requests resolved: none +Requires change in build system: yes +Makefile changed for pathf90; added -ftpp option to handle directive +embedded in multi-line data statement +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM: yes +Tested to work with SCAM: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +R models/atm/cam/test/system/create_ccsmcam +- most stuff was merged into TCB.ccsm.sh + +A models/atm/cam/bld/run-lightning.csh +- new self-contained example run script specifically for lightning platform +A models/atm/cam/test/system/TMC.sh +- new script for the testing of mass conservation parameters +A models/atm/cam/test/system/TSB.ccsm.sh +- new generic script that will submit a specified ccsm test and include a + baseline test if appropriate + +M models/atm/cam/bld/Makefile +- added pathf90 compiler option -ftpp, needed to pre-process a directive + embedded in a multi-line data statement +M models/atm/cam/src/control/history.F90 +- bug fix for the setting of time_bnds for branch runs +- bug fix for the writes of flag_xyfill and flag_isccplev to the restart file +M models/atm/cam/src/control/time_manager.F90 +- added method get_prev_time (analogous to get_curr_time) +M models/atm/cam/src/physics/cam1/qneg3.F90 +- made mods recommened by dave parks for NEC efficiency +M models/atm/cam/test/system/TBL.sh +- will now skip entirely if not testing vs baseline +- bug fix for mkdir validation +M models/atm/cam/test/system/TBR.sh +- reordering of algorithm for efficiency +- bug fix for mkdir validation +M models/atm/cam/test/system/TCB.ccsm.sh +- complete overhaul; is now just a wrapper script for ccsm's create_test with + some sed commands +M models/atm/cam/test/system/TCB.sh +- bug fix for mkdir validation +M models/atm/cam/test/system/TCS.ccsm.sh +- major overhaul to work with new script TSB.ccsm.sh +M models/atm/cam/test/system/TEQ.sh +- bug fix for mkdir validation +M models/atm/cam/test/system/TER.sh +- reordering of algorithm for efficiency +- bug fix for mkdir validation +M models/atm/cam/test/system/TRX.sh +- reordering of algorithm for efficiency +- bug fix for mkdir validation +M models/atm/cam/test/system/TSM.sh +- bug fix for mkdir validation +M models/atm/cam/test/system/input_tests_aix +- replaced TCB.ccsm.sh with TSB.ccsm.sh in default list +M models/atm/cam/test/system/input_tests_linux +- added the tests for mass conservation to defaul list +M models/atm/cam/test/system/input_tests_master +- added mass conservatin tests, ccsm submit test, most smoke tests now 9 steps +M models/atm/cam/test/system/scamtest.sh +- bug fix for mkdir validation +M models/atm/cam/test/system/test_driver.sh +- now using newcprnc - required to recognize isccp variables +M models/atm/cam/test/system/nl_files/ghgrmp +- added namelist variable to turn on isccp simulator for testing + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_12 +Originator: erik ( Erik Kluzek) +Date: Wed Aug 10 12:53:31 MDT 2005 +Model: CAM +Version: CAM3.2.12 +One-line Summary: Get rid of #ifdefs refering to CAMSURF from cam3.2.3 commit +cam-bugs Requests resolved: none +Requires change in build system: no (but you can get rid of references to CAMSURF in misc.h) +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: Most bit-for-bit tests fail as this is an answer changing commit +On bangkok: +004 bl111 TBL.sh e8c8mdm ttrac 9 ..................................FAIL! rc= 7 +007 bl112 TBL.sh e8sdm ghgrmp 9 ...................................FAIL! rc= 7 +011 bl153 TBL.sh e64m outfrq24h -2 ................................FAIL! rc= 7 +015 bl311 TBL.sh f10c8mdm ttrac 9 .................................FAIL! rc= 7 +022 bl312 TBL.sh f10sdm ghgrmp 9 ..................................FAIL! rc= 7 +026 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +030 bl511 TBL.sh s8c8mdm ttrac 9 ..................................FAIL! rc= 7 +033 bl512 TBL.sh s8sdm ghgrmp 9 ...................................FAIL! rc= 7 +037 bl553 TBL.sh s64m outfrq24h -2 ................................FAIL! rc= 7 +On bluesky: +005 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 +008 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 +015 bl151 TBL.sh e64h outfrq24h -2 ................................FAIL! rc= 7 +019 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +022 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +030 bl336 TBL.sh wm4h outfrq3s 9..................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +037 bl354 TBL.sh fm2dh outfrq3s 9 .................................FAIL! rc= 7 +040 bl355 TBL.sh fmo2dh off2x2.5 9 ................................FAIL! rc= 7 +044 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 +047 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 +054 bl551 TBL.sh s64h outfrq24h -2 ................................FAIL! rc= 7 +On tempest: +004 bl131 TBL.sh e32c11dh pghgsul 9 ...............................FAIL! rc= 7 +007 bl132 TBL.sh e32sdh ghgrmp 9 ..................................FAIL! rc= 7 +014 bl152 TBL.sh e64o outfrq24h -2................................FAIL! rc= 7 +017 bl314 TBL.sh wg10dh outfrq3s 9 ................................FAIL! rc= 7 +021 bl331 TBL.sh f4c11dh pghgsul 9 ................................FAIL! rc= 7 +024 bl332 TBL.sh f4sdh ghgrmp 9 ...................................FAIL! rc= 7 +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +035 bl531 TBL.sh s32c11dh pghgsul 9 ...............................FAIL! rc= 7 +038 bl532 TBL.sh s32sdh ghgrmp 9 ..................................FAIL! rc= 7 +045 bl552 TBL.sh s64o outfrq24h -2 ................................FAIL! rc= 7 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, eaton +Restart files change: no +Changes answers: Yes (same-physics) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + Get rid of all the #ifdef's refering to CAMSURF that went in with + the cam3.2.3 tag. + Basically, this tag gets the same answers as cam3.2.11 if you set + + #define CAMSURF CLIMATE_CAMSURF + + in misc.h and in configure script. + + The exception to this is that in this tag newiceproperties is + still called at initialization + in camice in camice_init. The reason for this is because there is + some initializion + that's important to do in newiceproperties. + + The code changes answers compared to cam3.2.11, and the changes + were validated with + simulations with FV and DOM at 4x5 resolution. Answers also change + for SOM, but this + wasn't verified. + + /ERIK/csm/cam324_fv4x5dom_camsurf_1 --- Experiment based + off cam3.2.4 (10 years) + vs. + /ERIK/csm/cam321_fv4x5dom_1 -- control of cam3.2.1 (10 + years) + + Plots are available from + + http://www.cgd.ucar.edu/~erik/AMWG_diag/cam324_fv4x5dom_camsurf_1-cam321_fv4x5dom_1/ + + The difference in the code is primarily to unify the merging of + surface fields at + timestep==0 with that done while time-stepping. And to unify how + the ocean-ice + diagnostic fluxes are calculated at time-step==0 with when + time-stepping. Also in + order to remove a dependency on the order that ocean and ice are + called, I also use + 1-landfrac rather than ocnfrac as a mask for certain + calculations. This changes + answers for SOM at each time-step. + + The tests that fail have to do with bit-for-bit comparisions with + cam3.2.11. Some + of the bit-for-bit tests pass, if they run ideal-phys, adiabatic, + or aqua-planet. + Also error-growth tests are identical as error-growth is run in + aqua-planet mode. + +See: +http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_11 +Originator: sawyer (Will Sawyer), eaton (Brian Eaton) +Date: Fri Aug 5 11:47:16 MDT 2005 +Model: CAM +Version: CAM3.2.11 +One-line Summary: Cleanup and performance mods for FV +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes (performance improvements for FV on Cray and NEC SX) +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: +on bluesky: +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 7 +034 bl351 TBL.sh f2h outfrq24h -2 .................................FAIL! rc= 7 +on bangkok: +026 bl353 TBL.sh f2m outfrq24h -2 .................................FAIL! rc= 7 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: sawyer, eaton +Restart files change: no +Changes answers: no, except roundoff introduce into FV +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Replace the original dynamics_vars.F90 by the new version. + +Add performance mods for both Cray X1 and NEC SX (from Art Mirin and Pat Worley). + +Clean up implementation of options for using platform optimized FFT +libraries (from Art Mirin and Pat Worley). + +Remove SAVEd variables in cd_core. This will come close to making the code +reentrant. + +Explain failed tests: + +These tests all failed due to a roundoff level changed introduced in the FV dycore. Since no +tests that had debug enabled failed, we assume this is an optimization issue. The roundoff level +changes were verified by perturbation growth tests on both bluesky and bangkok, but only for +the configuration of tests bl351 and bl353. Test bl336 is a waccm_mozart configuration and +the pergro test does not currently work there. + +=============================================================== +=============================================================== + +cam3_2_10 +Originator: sawyer (Will Sawyer), eaton ( Brian Eaton) +Date: Tue Aug 2 18:02:15 MDT 2005 +Model: CAM +Version: CAM3.2.10 +One-line Summary: Bug fix for FV in OMP-only mode +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: sawyer, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +dynamics/fv/p_d_adjust.F90 +. add "pole" to private variables in first OMP directive + +=============================================================== +=============================================================== + +cam3_2_9 +Originator: dcn (David Noone), eaton ( Brian Eaton) +Date: Tue Jul 26 17:57:28 MDT 2005 +Model: CAM +Version: CAM3.2.9 +One-line Summary: mods for water isotopes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) +on tempest: +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: dcn, eaton +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +This is an incremental commit of mods to incorporate water isotopes into +CAM. Added mods to manage the water isotope constituents. Added mods to +allow the cloud sedimentation and ocean evaporation processes to act on +these constituents. + +The regression test that fails is due to a bug in the FV dycore introduced +in cam3_2_8. It has only been observed in pure OMP mode on the SGI. + + +=============================================================== +=============================================================== + +cam3_2_8 +Originator: sawyer, eaton ( Brian Eaton) +Date: Thu Jul 21 13:37:42 MDT 2005 +Model: CAM +Version: CAM3.2.8 +One-line Summary: update FV dycore, part 1 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no (only tested IBM) +Requires change in run script: no +Ran test_driver.sh script: yes +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: +On tempest: +031 bl352 TBL.sh f2o outfrq24h -2 .................................FAIL! rc= 7 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: spectral dycores are bit-for-bit, fv has roundoff change +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Update the FV dycore to contain new code from the GEOS5 version. The new +code includes derived types to encapsulate grid and state information. +Currently we've only used the grid type. The dynamics state remains module +data in the prognostics module. The new grid type replaces most of the +previous uses of the pmgrid and spmd_dyn modules although there is still +cleanup work to be done. There was also a change in the polar filtering +code which introduces a roundoff level change in the FV simulations. The +change was implemented as a bug fix to the problem that answers were +depending on the X decomposition when the 2D decomp option was used. + + +=============================================================== +=============================================================== + +cam3_2_7 +Originator: mvr ( Mathew Rothstein) +Date: Tue Jul 19 11:31:59 MDT 2005 +Model: CAM +Version: CAM3.2.7 +One-line Summary: Fix for CCSM testing within CAM test suite; other test suite enhancements, cleanup +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +R models/atm/cam/bld/CAM.pm +R models/atm/cam/bld/CAM_lab.pm +R models/atm/cam/bld/CAM_run.pm +R models/atm/cam/bld/Design.tex +R models/atm/cam/bld/Requirements.tex +R models/atm/cam/bld/bldtex.csh +R models/atm/cam/bld/condense-path.pl +R models/atm/cam/bld/fvtest.sh +R models/atm/cam/bld/graphgrowth.csh +R models/atm/cam/bld/lab_default.pm +R models/atm/cam/bld/run-model.pl +- cleaned up obsolete files from bld directory + +R models/atm/cam/test/system/TER.ccsm.sh +- script made more generic and renamed - see the new file TCS.ccsm.sh + +A models/atm/cam/test/system/TCS.ccsm.sh +- generic script to check the status of a coupled cam run + +M models/atm/cam/test/system/TBL.sh +- status file renamed for consistency, algorithm re-ordered for efficiency +M models/atm/cam/test/system/TBR.sh +- status file renamed for consistency, algorithm re-ordered for efficiency +M models/atm/cam/test/system/TCB.ccsm.sh +- will now configure build and submit ccsm run for specified test/config +M models/atm/cam/test/system/TCB.sh +- status file renamed for consistency +M models/atm/cam/test/system/TEQ.sh +- status file renamed for consistency +M models/atm/cam/test/system/TER.sh +- status file renamed for consistency, algorithm re-ordered for efficiency +M models/atm/cam/test/system/TRX.sh +- status file renamed for consistency, algorithm re-ordered for efficiency +M models/atm/cam/test/system/TSM.sh +- status file renamed for consistency +M models/atm/cam/test/system/create_ccsmcam +- modified to use CAM sandbox for coupled test rather than CAM of CCSM tag +M models/atm/cam/test/system/input_tests_aix +- new testid for ccsm check status test +M models/atm/cam/test/system/input_tests_master +- new argument lists for ccsm tests (test, resolution, component set) +M models/atm/cam/test/system/scamtest.sh +- status file renamed for consistency +M models/atm/cam/test/system/test_driver.sh +- now allows batch jobs to run from their own directory if env var CAMROOT set +M models/atm/cam/test/system/CAM_runcmnd.sh +- corrected documentation in the comments +M models/atm/cam/tools/scam/testscript +- removed unnecessary output file + +M models/atm/cam/test/system/nl_files/adia +M models/atm/cam/test/system/nl_files/aqpgro +M models/atm/cam/test/system/nl_files/ghgrmp +M models/atm/cam/test/system/nl_files/idphys +M models/atm/cam/test/system/nl_files/no_ttrac +M models/atm/cam/test/system/nl_files/off2x2.5 +M models/atm/cam/test/system/nl_files/outfrq24h +M models/atm/cam/test/system/nl_files/outfrq3s +M models/atm/cam/test/system/nl_files/ttrac +M models/atm/cam/test/system/nl_files/ttrac_lb1 +M models/atm/cam/test/system/nl_files/ttrac_lb2 +M models/atm/cam/test/system/nl_files/ttrac_lb3 +- namelists now specify secondary history tape names, freqs, and use 64-bit + +M models/atm/cam/bld/run-ibm.csh +M models/atm/cam/bld/run-pc.csh +M models/atm/cam/bld/run-sgi.csh +- updated the self-contained example run scripts + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_6 +Originator: fvitt ( Francis Vitt) +Date: Wed Jul 13 09:34:52 MDT 2005 +Model: CAM +Version: CAM3.2.6 +One-line Summary: Fixed bug in earth-sun distance factor used in waccm +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +bluesky, tempest, bangkok +Test id's that fail: +on bluesky -- bug fix in waccm resulted in failure of base line comparison +030 bl336 TBL.sh wm4h outfrq3s 9 ..................................FAIL! rc= 6 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Stacy Walters +Restart files change: no +Changes answers: no (bit-for-bit) or Yes +bit-for-bit except for waccm +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +models/atm/cam/src/chemistry/waccm_mozart/mo_gas_phase_chemdr.F90 +models/atm/cam/src/chemistry/waccm_mozart/mo_waccm_hrates.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_5 +Originator: mvr ( Mathew Rothstein) +Date: Mon Jul 11 15:56:16 MDT 2005 +Model: CAM +Version: CAM3.2.5 +One-line Summary: Removal of params.h and misc.h (clm code excluded) +cam-bugs Requests resolved: none +Requires change in build system: yes +#defines of misc.h and params.h now passed to Makefile via cppdefs +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: +cb999, er999 (ccsm test on bluesky) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +M models/atm/cam/bld/configure +- moved #define's of params.h and misc.h into cppdefs +- removed creation of params.h (misc.h still temporarily remains for clm code) +M models/atm/cam/bld/Makefile +- no longer looks for SPMD specification in misc.h + +**also modified all fortran and c files to remove #include of misc.h and +params.h (excluding clm code) + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_4 +Originator: jeff ( Yen-Huei Lee) +Date: Sun Jul 3 13:48:55 MDT 2005 +Model: CAM +Version: CAM3.2.4 +One-line Summary: fix tro_mozart to allow extra tracers, bug fix to run in ccsm, output co2 fluxes to history tape, add index for fdms +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: none (Get clearance for failed tests, enter lines from td.*.status files that fail) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +M models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 + allow trop_mozart to run with extra tracers, i.e. CO2. + +M models/atm/cam/src/physics/cam1/physpkg.F90 + bug fix to allow ccsm to run + +M models/atm/cam/src/physics/cam1/co2_cycle.F90 +M models/atm/cam/src/control/ccsm_msg.F90 + output co2 fluxes to history tape + +M models/atm/cam/src/physics/cam1/comsrf.F90 + add index for fdms + +M models/atm/cam/src/dynamics/fv/fv_prints.F90 + bug fix + +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml + use new data sad_file for waccm_mozart + +=============================================================== +=============================================================== + +cam3_2_3 +Originator: erik ( Erik Kluzek) +Date: Thu Jun 30 00:18:39 MDT 2005 +Model: CAM +Version: CAM3.2.3 +One-line Summary: Move cam3_2_2_brnchT_srfsimp6 to cam_dev -- makes surface (ocean, land, sea-ice) more modular +Requires change in build system: yes +(Requires CAMSURF defines in misc.h) +Substantial timing or memory changes: no +Requires change in run script: no +Ran test_driver.shl script: yes (does all of the following tests) +Machines tested: IBM, SGI, Linux-Lahey +Test id's that fail: Bluesky: 1, 5,8,15,22,30,34,37,40,44,47,54,55 + 5-54 fail because diagnostic fields change + 001 cb999 TCB.ccsm.sh .............................................FAIL! rc= 4 + 055 er999 TER.ccsm.sh .............................................FAIL! rc= 2 +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, mvertens +Restart files change: yes +Changes answers: no (bit-for-bit) (some ocean/ice diagnostic fields + change to roundoff at time=0) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Add following to misc.h: + +#define B4B_CAMSURF -2 +#define RND_CAMSURF -1 +#define CLIMATE_CAMSURF 0 +#define CAMSURF B4B_CAMSURF + +This allows answers to be the same as current model, while allowing +ifdefs that can provide changes to roundoff or climate-changing. + +Move tsnam and plevmx to ice_constants + +Shorten initext and remove tangled dependencies of surface models. +Create initialization methods for sea-ice and oceanm that are called by +initext. Move surface methods in physpkg to run methods in ocean, and ice. + +Make camice and somocn, and camocn into modules with various methods. +Move ice_read from inidat to camice. Move write_restart, read_restart +of ice to camice methods. + +Make comsrf more modular. Move data specific to ocean, ice, or land +out of comsrf. Create merge method, and make some methods private. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_2 +Originator: mvr ( Mathew Rothstein) jeff, mvertens, eaton +Date: Wed Jun 15 16:37:19 MDT 2005 +Model: CAM +Version: CAM3.2.2 +One-line Summary: configure/build-namelist mods for calls from ccsm and a plethora of bug fixes +cam-bugs Requests resolved: none +Requires change in build system: yes - now enabled for ccsm +Substantial timing or memory changes: no +Requires change in run script: yes - now enabled for ccsm +Tested to work coupled with CCSM (create_ccsmcam): not create_ccsmcam, but other +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey,pgi +Ran test_driver.shl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself,eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes - logical restart writes changed to ints +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: +R models/atm/cam/tools/icesst/bcgen/namelist.T42 +R models/atm/cam/tools/icesst/bcgen/namelist.T42.oldtt +R models/atm/cam/tools/icesst/bcgen/namelist.T5 +- cleanup of files resulting from regeneration of sst datasets + +A models/atm/cam/tools/icesst/bcgen/namelist +- new file required of modified method to generate sst datasets +A models/atm/cam/test/system/config_files/wm4h +- new configuration options file for waccm test without debug + +M models/atm/cam/bld/CAM_namelist.pm +M models/atm/cam/bld/build-namelist +M models/atm/cam/bld/namelist.pm +- mods required for CAM's build-namelist script to be called from within CCSM + +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml +M models/atm/cam/bld/DefaultCLMEXPNamelist.xml +- new defaults for 1.9x2.5 topo datasets + +M models/atm/cam/bld/configure +- mods required for CAM's configure script to be called from within CCSM + +M models/atm/cam/src/chemistry/waccm_mozart/mo_setrxt.F90 +- bug fix to achieve b4b restart of waccm_mozart + +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/history.F90 +M models/atm/cam/src/control/restart.F90 +M models/atm/cam/src/control/time_manager.F90 +M models/lnd/clm2/src/main/histFileMod.F90 +- all logical restart writes are now integers (workaround to pathscale bug) + +M models/atm/cam/src/physics/cam1/co2_cycle.F90 +M models/atm/cam/src/physics/cam1/radiation.F90 +- change co2 tracer from moist to dry + +M models/atm/cam/src/control/ccsm_msg.F90 +- change unit of co2 flux from kgC/m2/s to kgCO2/m2/s + +M models/atm/cam/src/physics/cam1/srfxfer.F90 +- bug fix for computation of netsw in coupled mode + +M models/atm/cam/test/system/input_tests_master +- modified to now test waccm_mozart in non-debug mode + +M models/atm/cam/test/system/scamtest.sh +- bug fix for output of test results + +M models/atm/cam/tools/definesurf/fmain.f90 +- land fractions < .001 set to zero; metadata now complies with CF conventions + +M models/atm/cam/tools/icesst/README +- describe -g option for reading grid info from file + +M models/atm/cam/tools/icesst/bcgen/bcgen.f90 +- pass the history attribute to setup_outfile + +M models/atm/cam/tools/icesst/bcgen/driver.f90 +- input & output filepaths now specified on command-line +- generate the history attribute + +M models/atm/cam/tools/icesst/bcgen/setup_outfile.f90 +- add history attribute to both output files + +M models/atm/cam/tools/icesst/regrid/regrid.f90 +- Modify so that output grid coordinates can be read from the new grid files + +M models/atm/cam/tools/icesst/regrid/wrap_nf.f90 +- add wrap_nf_put_var_int + +M models/atm/cam/tools/scam/ui/crm.cpp +- updated aerosol optics file to be used for column radiation model test +M models/atm/cam/tools/scam/userdata/crmtest26.out +- updated validation file for column radiation model test + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_2_1 +Originator: aconley ( Andrew J. Conley) +Date: Fri Jun 3 17:29:46 MDT 2005 +Model: CAM +Version: CAM3.2.1 +One-line Summary: Improve interface between radiation (LW and SW) and aerosols +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: Yes (problems for vector architecture) +Requires change in run script: Yes + Added new data to AerosolsOptics file. So CAM namelist has changed +Tested to work coupled with CCSM (create_ccsmcam): No: ccsm namelist is now out of date +Tested to work with SCAM (tools/scam/testscript): No: crm part of test fails now because of change to Aerosol Optics +Machines tested: IBM, SGI, Lahey +Ran test_driver.shl script: No: ran test_driver.sh +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: not for waccm +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: Yes (no change to climate, but larger than roundoff changes) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + + + New files: aerosol_radiation_interface.F90 + aerosol_index.F90 + Deleted: volcrad.F90 + Changed: DefaultCAMExpNamelist + runtime_opts.F90 + advnce.F90 + aer_optics.F90 + aerosol_intr.F90 + inti.F90 + prescribed_aerosols.F90 + radae.F90 + radiation.F90 + radsw.F90 + volcanicmass.F90 + + +=============================================================== +=============================================================== + +cam3_2_0 +Originator: mvertens ( Mariana Vertenstein) +Date: Mon May 30 15:53:48 MDT 2005 +Model: CAM +Version: CAM3.2.0 +One-line Summary: incorporated clm3_expa_29 into stand-alone cam +cam-bugs Requests resolved: none +Requires change in build system: yes (new clm cpp variable added) +Substantial timing or memory changes: no (unless CN code is activated) +Requires change in run script: all clm surface datasets have changed +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, +Restart files change: no +Changes answers: new-climate +Changes to CLM land-model: Yes (see below) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +The following code changes accompany the incorporation +of new CLM code - clm_expa_29 - into the stand-alone CAM +development code base. As part of these changes, new CLM +raw datasets were used to create the clm model surface +datasets. All CLM surface datasets were regenerated using +the new raw datasets. In addition, clm3_expa_29 also contains the +the incorporation of the carbon-nitrogen cycle into the CLM code base +(both Peter Thornton's CN model and the CASA carbon cycle model). +A detailed summary of climate changing modifications appears below. +Finally, clm3_expa_29, contains the flexibility, for the first time, +to run dynamic land use runs using prescribed land use datasets. + +Note that generating clm surface datasets is now accomplished +via an offline tool in mksrfdata/tools/mksrfdat. This is not +part of the standard cam clm/tools directory yet +due to the current structure of the cam cvs module. +This will be incorporated into cam in a subsequent cam checkin. + +Validation simulations were carried out for 1979-2000 with annually varying SSTs. + +The tags used for hyd_clm3_1 were cam3_1_7 and clm3_expa_29 +(camroot = /fis/cgd/cseg/people/mvertens/src/cam/cam3_1_7_clm3_expa_29) + +The changes between hyd_clm3_1 and hyd_con were: +o New SST dataset (amipbc_sst_T42_1949_2004.nc as opposed to sst_HadOIBl_bc_64x128_1949_2001_c020411.nc) +o Albedo calculation in CLM moved to end of second biophysics loop +o Peter Thornton's 2-leaf canopy model +o Peter Lawrence's MODIS-based surface dataset (distribution of plant + functional types, LAI, and soil color) +o David Lawrence's and Peter Thornton's hydrology modifications (includes + new formulations for interception, infiltration (surface runoff), soil + moisture effects on stomatal conductance, soil to canopy air space transfer + coefficients, soil hydraulic conductivity, and baseflow. + +=============================================================== +=============================================================== + +cam3_1_9 +Originator: boville, eaton +Date: Fri May 27 09:55:54 MDT 2005 +Model: CAM +Version: CAM3.1.9 +One-line Summary: WACCM bugfix +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: boville +Restart files change: no +Changes answers: no (bit-for-bit) except WACCM_MOZART changes answers +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +chemistry/waccm_mozart/chemistry.F90 +. Fix initialization of qmin. + +=============================================================== +=============================================================== + +cam3_1_8 +Originator: boville, eaton ( Brian Eaton) +Date: Tue May 17 18:33:16 MDT 2005 +Model: CAM +Version: CAM3.1.8 +One-line Summary: Merge latest WACCM development code +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: boville, eaton +Restart files change: no +Changes answers: CAM is bit-for-bit, WACCM has a new climate. +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Merge latest WACCM development code. + +There is a new feature in the FV tracer code (trac2d.F90) which allows the +timestep splitting to differ in different vertical layers. This feature is +currently only enabled for the WACCM_MOZART configuration since it can +introduce answer changes into the standard CAM FV configurations. + +Add LAPACK_LIBDIR macro to Makefile to allow specifying the location of the +LAPACK and BLAS libraries. Optional use is made of these libraries in +WACCM specific code (on AIX only). + +Add the use of the massv library to the AIX section of the Makefile. The +use of this library introduces roundoff level differences into the +simulation when changing the parallel configuration. This library is only +used in WACCM_MOZART specific code. + +In the IRIX64 section of the Makefile the -cpp option was replaced with +-macro_expand. A WACCM_MOZART ifdef which was including code in a +multi-line data statement was failing to compile otherwise. + +=============================================================== +=============================================================== + +cam3_1_7 +Originator: mvr ( Mathew Rothstein) +Date: Wed May 4 12:14:23 MDT 2005 +Model: CAM +Version: CAM3.1.7 +One-line Summary: Updating the new cam test framework with new tests and other enhancements +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +A models/atm/cam/test/system/TEQ.sh +- new generic script to test the equivalence of two cam smoke runs +A models/atm/cam/test/system/TRX.sh +- new script to test the restart of cam using fv 2d decomposition +A models/atm/cam/test/system/scamtest.sh +- new script to test scam and crm +A models/atm/cam/test/system/config_files/f10dm +A models/atm/cam/test/system/config_files/fm2dh +A models/atm/cam/test/system/config_files/fmo2dh +A models/atm/cam/test/system/config_files/wg10dh +A models/atm/cam/test/system/config_files/wm4dh +- new configuration options files for added tests +A models/atm/cam/test/system/nl_files/no_ttrac +A models/atm/cam/test/system/nl_files/off2x2.5 +A models/atm/cam/test/system/nl_files/ttrac_lb1 +A models/atm/cam/test/system/nl_files/ttrac_lb2 +A models/atm/cam/test/system/nl_files/ttrac_lb3 +- new namelist options files for added tests + +M models/atm/cam/test/system/CAM_compare.sh +M models/atm/cam/test/system/TBL.sh +M models/atm/cam/test/system/TBR.sh +M models/atm/cam/test/system/TCB.ccsm.sh +M models/atm/cam/test/system/TCB.sh +M models/atm/cam/test/system/TER.ccsm.sh +M models/atm/cam/test/system/TER.sh +M models/atm/cam/test/system/TSM.sh +M models/atm/cam/test/system/input_tests_aix +M models/atm/cam/test/system/input_tests_irix +M models/atm/cam/test/system/input_tests_linux +M models/atm/cam/test/system/input_tests_master +M models/atm/cam/test/system/test_driver.sh + +mods and enhancements to the new cam test framework scripts including: +- added waccm tests +- added test for load balancing +- added test for the fv offline driver +- added test for fv 2d decomposition +- moved scam/crm test into default tests +- will now stop on first failure for interactive runs by default and + added environment variable CAM_SOFF to override default behavior +- cleaned up handling of shell string variables +- now backs up directories of failed tests when reattempting + +M README +- updated with the wording used for release + + + (Put your detailed description of the changes you made here...) + (You will get your edited copy e-mailed to you. It will also be) + (sent to cam-dev@cgd.ucar.edu.) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_1_6 +Originator: jeff ( Yen-Huei Lee) +Date: Sat Apr 30 12:25:17 MDT 2005 +Model: CAM +Version: CAM3.1.6 +One-line Summary: allow model year to be different from ghg data year +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/chemistry/waccm_mozart/chem_surfvals.F90 +M models/atm/cam/src/physics/cam1/chem_surfvals.F90 +M models/atm/cam/src/physics/cam1/advnce.F90 +M models/atm/cam/src/physics/cam1/srfxfer.F90 +M models/atm/cam/src/physics/cam1/radiation.F90 +M models/atm/cam/src/physics/cam1/co2_cycle.F90 +D models/atm/cam/src/physics/cam1/co2_data_scalar.F90 + +Function add: + +use the following namelists to set model start year and ghg data start year, + + ghg_yearStart_model = 1 + ghg_yearStart_data = 1950 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_1_5 +Originator: eaton ( Brian Eaton) +Date: Mon Apr 25 18:17:11 MDT 2005 +Model: CAM +Version: CAM3.1.5 +One-line Summary: fix CCSM test, update definesurf tool +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): no +Machines tested: IBM +Ran test_driver.shl script: Only ran CCSM test +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None (one-line description) + +Changes made: + +Fix the CCSM test. + +Also add some modifications to the definesurf tool from Byron. These mods +relax the previous restriction that the same filter be applied to both SGH +and PHIS. + +=============================================================== +=============================================================== + +cam3_1_4 +Originator: jeff ( Yen-Huei Lee) +Date: Sat Apr 23 11:20:36 MDT 2005 +Model: CAM +Version: CAM3.1.4 +One-line Summary: add co2 tracer transport and using 2D co2 for radiation +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): no +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test_driver.shl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton +Restart files change: no +Changes answers: Yes (same-to-roundoff) +(Note: test_driver.sh only does checks this -- if you run it with "env BL_ROOT=") +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +The constant co2 value used for radiation computation was replaced by +2D co2 distribution (column-mean). This is responsible for the roundoff. + +Function added: + +co2 tracer can be transported with co2 fluxes from land (through coupler), +from ocean (through data file) and from fossil fuel (through data file). + +co2 scalar data can be read from data file and can be used as data-cycling +type operation. + +M models/atm/cam/src/control/cam.F90 +M models/atm/cam/src/control/initext.F90 +M models/atm/cam/src/control/ccsm_msg.F90 +M models/atm/cam/src/control/restart.F90 +M models/atm/cam/src/control/runtime_opts.F90 +M models/atm/cam/src/dynamics/fv/inidat.F90 +M models/atm/cam/src/dynamics/sld/inidat.F90 +M models/atm/cam/src/dynamics/eul/inidat.F90 +M models/atm/cam/src/physics/cam1/advnce.F90 +M models/atm/cam/src/physics/cam1/initindx.F90 +M models/atm/cam/src/physics/cam1/restart_physics.F90 +M models/atm/cam/src/physics/cam1/comsrf.F90 +M models/atm/cam/src/physics/cam1/inti.F90 +M models/atm/cam/src/physics/cam1/srfxfer.F90 +M models/atm/cam/src/physics/cam1/rad_constituents.F90 +M models/atm/cam/src/physics/cam1/radiation.F90 +M models/atm/cam/src/physics/cam1/radsw.F90 +M models/atm/cam/src/physics/cam1/radlw.F90 +M models/atm/cam/src/physics/cam1/radae.F90 +A models/atm/cam/src/physics/cam1/co2_cycle.F90 +A models/atm/cam/src/physics/cam1/co2_data_flux.F90 +A models/atm/cam/src/physics/cam1/co2_data_scalar.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_1_3 +Originator: eaton ( Brian Eaton) +Date: Thu Mar 31 08:51:32 MST 2005 +Model: CAM +Version: CAM3.1.3 +One-line Summary: move control of rad calcs into rad module. pathscale & g95 builds +cam-bugs Requests resolved: bugzilla IDs 4, 10, 13 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): no, currently broken +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Consolidate control of radiation calculations in the radiation module. +This includes resposibility for maintaining the namelist variables iradsw, +iradlw, iradae, and irad_always, and providing a function for the values +dosw, dolw, doabsems, and aeres. These variables have all been removed +from comctl.h. + +Add bugfix for turbulent mountain stress code. + +Add files to DefaultCAMEXPNamelist.xml needed for WACCM runs at 1.9x2.5 +resolution. + +Add Makefile sections and ESMF build to support pathscale and g95 compilers +on linux systems. + +Replace the PGF90 CPP macro with NO_R16. The PGF90 macro was being used to +indicate that the compiler doesn't support quad precision. But that's also +the case for the pathscale and g95 compilers. The use of a generic CPP +token allows new compilers to be supported by modifying the the Makefile to +specify the compiler properties without requiring source code modification. + +The g95 compiler doesn't recognize the cray pointer syntax in fv/geopk.F90. +The use of cray pointers there can't be trivially replaced by F90 pointers. +Since the cray pointers only appear in the geopk16 routine which is not +used by default, a CPP token NO_CRAY_POINTERS is defined for g95 and used +to stub out geopk16. endrun is called if the user sets the namelist +variable (geopktrans) to use geopk16 when NO_CRAY_POINTERS is defined. + +Add bugfix to cmfmca pointed out by David Noone. This only affects the +simulation of tracers using dry mixing ratio (none by default). The set of +test tracers enabled by setting the namelist variable +tracers_flag=.true. use a dry mixing ratio and are affected by this fix. + + +=============================================================== +=============================================================== + +cam3_1_2 +Originator: mvr ( Mathew Rothstein) +Date: Fri Mar 25 16:41:11 MST 2005 +Model: CAM +Version: CAM3.1.2 +One-line Summary: New testing framework for CAM - replaces test-model; and a few minor bug fixes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey, Linux-PGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +...and much, much more! +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + + +R models/atm/cam/test/system/babyblue.test-model.pl.log +R models/atm/cam/test/system/CAM_test.pm +R models/atm/cam/test/system/cam_timing.pm +R models/atm/cam/test/system/check-timing.pl +R models/atm/cam/test/system/dao_batch.csh +R models/atm/cam/test/system/default_tests.test-model.xml +R models/atm/cam/test/system/llnl_blue.csh +R models/atm/cam/test/system/llnl_compass.csh +R models/atm/cam/test/system/llnl_frost.csh +R models/atm/cam/test/system/namelist-config.test-model.dbg.log +R models/atm/cam/test/system/ncar_batch.csh +R models/atm/cam/test/system/nersc_batch.csh +R models/atm/cam/test/system/ornl_batch.csh +R models/atm/cam/test/system/specs-testslist.test-model.xml +R models/atm/cam/test/system/test-examples.pl +R models/atm/cam/test/system/test-model.pl +R models/atm/cam/test/system/test-production.pl +- cleanup of old test-model files + +A models/atm/cam/test/system/CAM_compare.sh +- utility script for comparison of results +A models/atm/cam/test/system/CAM_runcmnd.sh +- utility script for constructing platform dependent run command +A models/atm/cam/test/system/input_tests_aix +- required aix tests for cam commit +A models/atm/cam/test/system/input_tests_irix +- required irix tests for cam commit +A models/atm/cam/test/system/input_tests_linux +- required linux tests for cam commit +A models/atm/cam/test/system/input_tests_master +- master list of tests +A models/atm/cam/test/system/TBL.sh +- generic script for baseline tests +A models/atm/cam/test/system/TBR.sh +- generic script for branch tests +A models/atm/cam/test/system/TCB.ccsm.sh +- script for configure and build test of cam in coupled model +A models/atm/cam/test/system/TCB.sh +- generic script for configure and build tests +A models/atm/cam/test/system/TER.ccsm.sh +- script for exact restart test of cam in coupled model +A models/atm/cam/test/system/TER.sh +- generic script for exact restart tests +A models/atm/cam/test/system/test_driver.sh +- driver script for all tests +A models/atm/cam/test/system/TSM.sh +- generic script for smoke tests +A models/atm/cam/test/system/nl_files/adia +A models/atm/cam/test/system/nl_files/aqpgro +A models/atm/cam/test/system/nl_files/ghgrmp +A models/atm/cam/test/system/nl_files/idphys +A models/atm/cam/test/system/nl_files/outfrq24h +A models/atm/cam/test/system/nl_files/outfrq3s +A models/atm/cam/test/system/nl_files/pghgsul +A models/atm/cam/test/system/nl_files/ttrac +- files containing non-default namelist options being tested +A models/atm/cam/test/system/config_files/e32c11dh +A models/atm/cam/test/system/config_files/e32dh +A models/atm/cam/test/system/config_files/e32pdh +A models/atm/cam/test/system/config_files/e32sdh +A models/atm/cam/test/system/config_files/e64h +A models/atm/cam/test/system/config_files/e64m +A models/atm/cam/test/system/config_files/e64o +A models/atm/cam/test/system/config_files/e8c8mdm +A models/atm/cam/test/system/config_files/e8pdm +A models/atm/cam/test/system/config_files/e8sdm +A models/atm/cam/test/system/config_files/f10c8mdm +A models/atm/cam/test/system/config_files/f10pdm +A models/atm/cam/test/system/config_files/f10sdm +A models/atm/cam/test/system/config_files/f2h +A models/atm/cam/test/system/config_files/f2m +A models/atm/cam/test/system/config_files/f2o +A models/atm/cam/test/system/config_files/f4c11dh +A models/atm/cam/test/system/config_files/f4dh +A models/atm/cam/test/system/config_files/f4pdh +A models/atm/cam/test/system/config_files/f4sdh +A models/atm/cam/test/system/config_files/s32c11dh +A models/atm/cam/test/system/config_files/s32dh +A models/atm/cam/test/system/config_files/s32pdh +A models/atm/cam/test/system/config_files/s32sdh +A models/atm/cam/test/system/config_files/s64h +A models/atm/cam/test/system/config_files/s64m +A models/atm/cam/test/system/config_files/s64o +A models/atm/cam/test/system/config_files/s8c8mdm +A models/atm/cam/test/system/config_files/s8pdm +A models/atm/cam/test/system/config_files/s8sdm +- files containing configuration options being tested + +M models/atm/cam/src/physics/cam1/sulfur_intr.F90 +- fixed declaration and setting of array totcond +M models/atm/cam/src/physics/cam1/dmsbnd.F90 +- initialized arrays dmsin and dms to 0._r8 +M models/atm/cam/src/dynamics/eul/inidat.F90 +- added explicit setting of phis_hires +M models/atm/cam/src/dynamics/fv/inidat.F90 +- modified the array assignments where it depended upon ncol +M models/atm/cam/src/dynamics/sld/inidat.F90 +- added explicit setting of phis_hires +M models/atm/cam/src/control/initext.F90 +- modified the array assignments where it depended upon ncol +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml +- modified the default settings for fv 4x5 sulpher datasets + + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_1_1 +Originator: fvitt ( Francis Vitt) +Date: Mon Mar 21 12:39:28 MST 2005 +Model: CAM +Version: CAM3.1.1 +One-line Summary: Added a tropospheric chemistry package. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +Files added: + +models/atm/cam/bld/config_trop_chem_mozart_defaults.xml +models/atm/cam/src/chemistry/trop_mozart/chem_mods.F90 +models/atm/cam/src/chemistry/trop_mozart/chemistry.F90 +models/atm/cam/src/chemistry/trop_mozart/m_het_id.F90 +models/atm/cam/src/chemistry/trop_mozart/m_rxt_id.F90 +models/atm/cam/src/chemistry/trop_mozart/m_spc_id.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_adjrxt.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_aerosols.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_airplane.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_ch4_lbc.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_chemini.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_drydep.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_exp_sol.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_gas_phase_chemdr.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_imp_sol.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_indprd.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_jlong.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_jpl.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_jshort.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_lb_vals.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_lightning.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_lin_matrix.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_lu_factor.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_lu_solve.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_mass_xforms.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_mean_mass.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_negtrc.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_nln_matrix.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_prod_loss.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_read_chm_sim.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_regrider.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_seasalt.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_setext.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_setinv.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_setrxt.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_setsoa.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_setsox.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_srf_emissions.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_sulf.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_tracname.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_ub_vals.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_usrrxt.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_waccm_photo.F90 +models/atm/cam/src/chemistry/trop_mozart/mo_wetdep.F90 +models/atm/cam/src/chemistry/trop_mozart/phtadj.F90 +models/atm/cam/src/chemistry/trop_mozart/rxtmod.F90 + +Files modified: + +models/atm/cam/bld/DefaultCAMEXPNamelist.xml + - added files needed for trop_mozart chemistry package +models/atm/cam/bld/camexp.pm + - added trop_mozart input files to the namelist +models/atm/cam/bld/configure + - added trop_mozart chemistry package option +models/atm/cam/src/chemistry/waccm_mozart/chemistry.F90 + - changed interface to be consistent with trop_mozart chemistry +models/atm/cam/src/control/history.F90 + - increased tbl_hash_oflow_percent +models/atm/cam/src/control/runtime_opts.F90 + - added input files to namelist for trop_mozart chemistry +models/atm/cam/src/physics/cam1/aerosol_intr.F90 + - added aerosol feedback capability for trop_mozart chemistry +models/atm/cam/src/physics/cam1/chemistry.F90 + - changed interface to be consistent with trop_mozart chemistry +models/atm/cam/src/physics/cam1/physpkg.F90 + - enabled lightning production of NO for trop_mozart chemistry +models/atm/cam/src/physics/cam1/stratiform.F90 + - added total precip/evap fields to physics buffer needed by trop_mozart +models/atm/cam/src/physics/waccm/chemistry.F90 + - changed interface to be consistent with trop_mozart chemistry +models/atm/cam/tools/scam/testscript + - removed "-test" option from configure invocation + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_1 +Originator: eaton ( Brian Eaton) +Date: Tue Mar 15 20:14:48 MST 2005 +Model: CAM +Version: CAM3.1 +One-line Summary: cam3_1 same as cam3_0_34 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): no +Tested to work with SCAM (tools/scam/testscript): no +Machines tested: none +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? no + +Changes made: none. + +Add tag cam3_1. This is the branch point for the CAM3.1 release + +=============================================================== +=============================================================== + +cam3_0_34 +Originator: pworley ( Patrick H Worley) +Date: Tue Mar 15 18:01:47 MST 2005 +Model: CAM +Version: CAM3.0.34 +One-line Summary: Cray X1 optimizations +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes on X1: recovers performance lost due to changes since cam3.0 +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): no - broken in earlier check-in +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes - added support for SSP execution mode +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +added models/utils/esmf/cray_x1_ssp/ + Identical to cray_x1 except that compiler options in the file base_variables were modified + so that esmf routines could be used in SSP mode. + +models/atm/cam/bld/Makefile + - in UNICOSMP section: added support for SSP mode and higher optimization levels for 4 routines, + recovering performance lost in earlier check-in that lowered optimization + +models/atm/cam/src/control/history.F90, wrap_nf.F90 + - deleted CRAY ifdefs + +models/atm/cam/src/physics/cam1/convect_deep.F90 + - modified calls to convtran, replacing ":" array indices with "1", to improve performance + +models/atm/cam/src/physics/cam1/qneg3.F90 + - modified to improve vectorization and streaming + +models/atm/cam/src/physics/cam1/radiation.F90 + - modified calls to radcswmx and radclwmx, + replacing ":" array indices with "1", to improve performance + - added Cray compiler directives + +models/atm/cam/src/physics/cam1/zm_conv.F90 + - added Cray compiler directives + +models/lnd/clm2/src/main/controlMod.F90 + - added ifdef to define default clump_pproc value for SSP mode + +models/lnd/clm2/src/main/driver.F90 + - added ifdef to disable OpenMP directive around "loop2" for SSP mode (a bug work around) + +models/utils/timing/gptl.c + - added ifdef to not disable timers unnecessarily in SSP mode + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_33 +Originator: rosinski ( Jim Rosinski) +Date: Thu Mar 10 14:05:47 MST 2005 +Model: CAM +Version: CAM3.0.33 +One-line Summary: Enable new timing lib. +cam-bugs Requests resolved: none +Requires change in build system: Maybe for CCSM. +Substantial timing or memory changes: Yes: on IBM timer overhead decreases + by as much as 10x. On SGI by 2x. On + Cray X1 by 3x. No speedup on Linux. +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes but it failed. Told + to go ahead with commit. +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: timer init calls and fortran include file changed. +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +o Replace timer code in utils/timing with new more effecient version. Better + performance results from replacing a linked list search for timer names + with a simple hash table. The new library now prints per-timer overhead + estimates. It can also interface with the PAPI low level performance + counter library. A brief description of how to do so is included in + utils/timing/README. + +o The old interface names (t_xxx) were retained. But these should be changed + to the new names (gptlxxx) as soon as possible. + +o Modify CAM Makefile for optimal performance on Cray X1. + +=============================================================== +=============================================================== + +cam3_0_32 +Originator: eaton ( Brian Eaton) +Date: Tue Mar 8 10:08:10 MST 2005 +Model: CAM +Version: CAM3.0.32 +One-line Summary: topo fields in separate file +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes + namelist includes bnd_topo -- build-namelist provides defaults +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Topography fields (mods from Byron Boville) +=========================================== + +These mods are to read the topo fields (PHIS, SGH, SGH30, LANDFRAC, +LANDM_COSLAT) from their own file. They are no longer written to the +output initial files. Backwards compatibility is maintained by looking for +the topo fields on the initial file if a topo file is not specified using +the new namelist variable bnd_topo. There are also mods to write the names +of the initial, topo, and sst files into global attributes of the history +files. + +An initial set of topo files have been created by extracting the topo +fields from the initial files currently specified in +DefaultCAMEXPNamelist.xml. The topo files are in the data directory +$CSMDATA/atm/cam/topo/. These files will eventually be replaced by a set +of standard files that contain detailed metadata describing how the fields +were produced. + +There are also modifications and cleanup in the definehires and definesurf +utilities. Added alot of information to the README files for both utils. + +Misc +==== + +. Re-insert a fix in phys_grid.F90 (transpose_chunk_to_block) + changing the chunk_buffer arg to intent(in). + +. In history.F90 increase pflds to 2000 and tbl_hash_oflow_percent to 10. + + + +=============================================================== +=============================================================== + +cam3_0_31 +Originator: bundy ( Dani Bundy Coleman) +Date: Wed Mar 2 13:56:13 MST 2005 +Model: CAM +Version: CAM3.0.31 +One-line Summary: Add mass conservation for dry tracers in Eularian dycore; restore same in SLD +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes (bluesky) +Tested to work with SCAM (tools/scam/testscript): yes (bangkok) +Machines tested: IBM (bluesky), SGI (tempest), Linux-Lahey (bangkok) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton +Restart files change: no (pdeld added only when run with dry-type constituents) +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +A models/atm/cam/src/dynamics/eul/massfix.F90 +Currently a module that just holds hw1, hw2, hw3, alpha. Could facilitate +a separation between mass fix and the timefilter. + +M slt/qmassa.F90 +Now a module, old subroutine qmassa is now qmassarun. Added an +optional argument pdeld to be used to calculate hw1lat for dry +mixing-ratio constituents. + +M control/history.F90 +moved addfld and add_defualt for PDELDRY from here to physics/cam1/diagnostics.F90 + +M eul/dp_coupling.F90 +Added transfer of pdeld from p->d,d->p. Calculation of pdeld moved to +tfilt_massfix.F90 instead of call to set_state_pdry. + +M eul/inital.F90 +added initialization of dynamics variable pdeld + +M eul/prognostics.F +added dynamics variable pdeld, only allocated when dry constituents +are present + +M eul/restart_dynamics.F90 +added pdeld to restart files + +M eul/scan2.F90 +moved public hw1, hw2, hw3, alpha to new module massfix.F90 +pass pdeld to tfilt_massfixrun() + +M eul/scandyn.F90 +pass pdeld to qmassarun + +M eul/scanslt.F90 +pass pdeld to qmassarun + +M eul/stepon.F90 +pass pdeld to d_p_coupling + +M eul/tfilt_massfix.F90 +Calculate time filtered value of pdeldry; use this to time-filter dry +constituents conservatively. + +M sld/scanslt.F90 +change qmassa call to new name: qmassarun + +M sld/tfilt_massfix.F90 +save water vapor for use in next timestep; this was inadvertently +removed in cam3_0_28 and is necessary for dry mass conservation + +M physics/constituents.F90 +new public logical cnst_need_pdeldry. Default is flase, set to true if +any constituents are dry. + +M physics/convect_deep.F90 +only use pdeldry when needed + +M physics/diagnostics.F90 +addfld and outfld calls for PSDRY and PDELDRY only when needed + +M physics/icarus_scops.F90 +added r8 to reals + +M physics/physics_types.F90 +added state%pdeldry and related to methods only when needed +added optional argument pdeld_calc (default=true) to subroutine +set_state_pdry, setting false still calculates related fields but +doesn't change state%pdeldry itself. + +M physics/physpkg.F90 +diagnostic subroutine gavglook only calculates dry quantities when +needed + +M physics/tracers_suite.F90 +added missing r8 +Now a module, old subroutine qmassa is now qmassarun. Added an +optional argument pdeld to be used to calculate hw1lat for dry +mixing-ratio constituents. + +M control/history.F90 +moved addfld and add_defualt for PDELDRY from here to physics/cam1/diagnostics.F90 + +M eul/dp_coupling.F90 +Added transfer of pdeld from p->d,d->p. Calculation of pdeld moved to +tfilt_massfix.F90 instead of call to set_state_pdry. + +M eul/inital.F90 +added initialization of dynamics variable pdeld + +M eul/prognostics.F +added dynamics variable pdeld, only allocated when dry constituents +are present + +M eul/restart_dynamics.F90 +added pdeld to restart files + +M eul/scan2.F90 +moved public hw1, hw2, hw3, alpha to new module massfix.F90 +pass pdeld to tfilt_massfixrun() + +M eul/scandyn.F90 +pass pdeld to qmassarun + +M eul/scanslt.F90 +pass pdeld to qmassarun + +M eul/stepon.F90 +pass pdeld to d_p_coupling + +M eul/tfilt_massfix.F90 +Calculate time filtered value of pdeldry; use this to time-filter dry +constituents conservatively. + +M sld/scanslt.F90 +change qmassa call to new name: qmassarun + +M sld/tfilt_massfix.F90 +save water vapor for use in next timestep; this was inadvertently +removed in cam3_0_28 and is necessary for dry mass conservation + +M physics/constituents.F90 +new public logical cnst_need_pdeldry. Default is flase, set to true if +any constituents are dry. + +M physics/convect_deep.F90 +only use pdeldry when needed + +M physics/diagnostics.F90 +addfld and outfld calls for PSDRY and PDELDRY only when needed + +M physics/icarus_scops.F90 +added r8 to reals + +M physics/physics_types.F90 +added state%pdeldry and related to methods only when needed +added optional argument pdeld_calc (default=true) to subroutine +set_state_pdry, setting false still calculates related fields but +doesn't change state%pdeldry itself. + +M physics/physpkg.F90 +diagnostic subroutine gavglook only calculates dry quantities when +needed + +M physics/tracers_suite.F90 +added missing r8 + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_30 +Originator: mvr ( Mathew Rothstein) +Date: Wed Feb 9 16:34:12 MST 2005 +Model: CAM +Version: CAM3.0.30 +One-line Summary: Cleanup of copyright info; minor bug fixes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +R LICENSE +- update to the copyright info and renaming of the file for + consistency with ccsm +A Copyright +- new file to replace LICENSE file that was removed +M models/atm/cam/src/control/cam.F90 +- slight mod to the info on where to find copyright notice +M models/atm/cam/src/control/history.F90 +- bug fix for the variable "vid" whose intent needed to be out rather than in +M models/atm/cam/src/physics/cam1/icarus_scops.F90 +- removed copyright info already contained in Copyright file +M models/atm/cam/test/system/create_ccsmcam +- replaced blackforest with bluesky as default machine +M models/atm/cam/test/system/ncar_batch.csh +- default load-leveller queue now for bluesky rather than blackforest +M models/atm/cam/tools/scam/testscript +- bug fix for how the TESTSCRIPTDIR was determined +M models/atm/cam/tools/scam/ui/Platform.Notes +- removed copyright info already contained in Copyright file +M models/atm/cam/tools/scam/ui/c.h +- removed copyright info already contained in Copyright file +M models/atm/cam/tools/scam/ui/ncarg/c.h +- removed copyright info already contained in Copyright file + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_29 +Originator: rosinski ( Jim Rosinski) +Date: Sun Feb 6 12:50:13 MST 2005 +Model: CAM +Version: CAM3.0.29 +One-line Summary: Reduced grid mods for CAM and interpaerosols boundary dataset generation code. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Modify eul/initcom.F90 to abort in SCAM mode if reduced grid enabled. +o Enable "mkrgrid" utility to work under lf95, ifort, and Cray X1. +o Enable "interpaerosols" utility for reduced grid, and Cray X1. +o Add new utility "mkrgridnew", which can replace "mkrgrid" when IC files + are xyz. The new utility is simpler, and unlike mkrgrid works on ISCCP + history files and on Cray X1. +o Check for reduced grid in optional boundary dataset reading routines + for which reduced grid capability is not yet enabled (e.g. dust module) + and abort in reduced grid mode. +o When CAM reads SST and aerosol data, ensure that boundary dataset grids + match cam grid. +o Delete threading directives from ccsm_msg.F90 per mvertens. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_28 +Originator: olson ( Jerry Olson) +Date: Thu Jan 27 11:11:47 MST 2005 +Model: CAM +Version: CAM3.0.28 +One-line Summary: Add new diagnostics to history file. Other misc mods. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: + +- Changes are round-off for EUL (except for aqua-planet which has a new climate + because of a change in the dry airmass constant) + Changes are BFB for SLD (except for aqua-planet which has a new climate) + Changes are BFB for FV (except for aqua-planet which has a new climate) + +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + + - Add fields to the master field list which complete the heat, moisture, cloud + liquid water, cloud liquid ice, and precip budgets + + (no new *default* fields are added to the History file) + + - Add an attribute ("sampling_seq") to those fields on a NetCDF History File + which are *not* based on an every-time-step sampling frequency. The + attribute would have a descriptive value indicating its sampling sequence. + Currently only one value is added: "rad_lwsw" (for fields that are only + sampled at LW/SW radiation time steps). No code is currently being added to + fill these fields with "missing" values. + + - Replace the "RAD_FIRST_HOUR" namelist variable with "IRAD_ALWAYS". + "RAD_FIRST_HOUR" was a logical that was too inflexible. "IRAD_ALWAYS" is an + integer that specifies length of time in timesteps (positive) or hours + (negative) that the SW/LW radiation will be run continuously from the start + of an initial run. + + - For aqua-planet runs, dry mass is hard-wired to 101325.-245. ( = 101080.) Pa + + - Bug fixes: + + - Fix a potential bug in the history module that would end up clobbering + the creation of the IC file if *all* the fields added to an auxiliary + history file through "add_default" calls are then excluded via FEXCL in + the namelist. + + - Fix bug that corrupts high resolution runs: promote "n" to I8 when + doing n**4 and n**3 math in hdinti, hordif1, and phcs. + + - Correct the logic in the aerosol data interpolator as reported by + Jim Boyle on the CGD forum + + - make "jstrt_p" private in SCAN2 and REALLOC7 loops + + - bugfix for adiabatic restarts + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_27 +Originator: mvr ( Mathew Rothstein) and mirin +Date: Thu Jan 20 16:16:39 MST 2005 +Model: CAM +Version: CAM3.0.27 +One-line Summary: Vectorization mods for finite volume; clarification of pgf90 optimization level +cam-bugs Requests resolved: none +Requires change in build system: yes +set pgf90 optimization explicitly to -O1; vectorization mods (see below) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey, Linux-pgi, cray x1 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mirin, eaton +Restart files change: no +Changes answers: b4b except for fv on cray x1, ibm, and linux-pgi, which are +round-off (pergro test passed on ibm) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M models/atm/cam/bld/Makefile +M models/atm/cam/src/control/cam.F90 +M models/atm/cam/src/control/spmdinit.F90 +M models/atm/cam/src/dynamics/fv/cd_core.F90 +M models/atm/cam/src/dynamics/fv/dp_coupling.F90 +M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 +M models/atm/cam/src/dynamics/fv/dynpkg.F90 +M models/atm/cam/src/dynamics/fv/fill_module.F90 +M models/atm/cam/src/dynamics/fv/fv_prints.F90 +M models/atm/cam/src/dynamics/fv/mapz_module.F90 +M models/atm/cam/src/dynamics/fv/pft_module.F90 +M models/atm/cam/src/dynamics/fv/spmd_dyn.F90 +M models/atm/cam/src/dynamics/fv/stepon.F90 +M models/atm/cam/src/dynamics/fv/sw_core.F90 +M models/atm/cam/src/dynamics/fv/te_map.F90 +M models/atm/cam/src/dynamics/fv/tp_core.F90 +M models/atm/cam/src/physics/cam1/check_energy.F90 +M models/atm/cam/src/physics/cam1/constituents.F90 +M models/csm_share/shr/shr_msg_mod.F90 +M models/utils/pilgrim/mod_comm.F90 + +please reference corresponding documentation in cam checkin list for details + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_26 +Originator: mvr ( Mathew Rothstein) and eaton +Date: Tue Jan 18 13:58:51 MST 2005 +Model: CAM +Version: CAM3.0.26 +One-line Summary: Collection of bug fixes and enhancements for Cray X1 +cam-bugs Requests resolved: none +Requires change in build system: yes +pgi fortran optimization set to O by default; Cray X1 mods; dependency cleanup +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes +removal of equivalences; bug fix for offline mode +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M cam1/models/atm/cam/bld/Makefile +- changed default optimization of pgi fortran compiler to O from O2 +- added Cray X1 mods and cleaned up some dependencies +M cam1/models/atm/cam/src/control/ccsm_msg.F90 +- added mods for Cray X1 +M cam1/models/atm/cam/src/control/history.F90 +- removed equivalences; removed addfld for unused var; added gregorian + calendar type to output; removed some unneeded date checking +M cam1/models/atm/cam/src/control/runtime_opts.F90 +- added code required with removal of equivalence in history.F90; + added phys_buffer mods +M cam1/models/atm/cam/src/dynamics/fv/dp_coupling.F90 +- removed beglev from declaration of var ps +M cam1/models/atm/cam/src/dynamics/fv/fv_prints.F90 +- fixed bug in write statements +M cam1/models/atm/cam/src/dynamics/fv/stepon.F90 +- add call to shr_sys_flush +M cam1/models/atm/cam/src/physics/cam1/phys_buffer.F90 +- added mods to physics buffer +M cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +- fixed bug in date comparison +M cam1/models/atm/cam/tools/scam/configure +- fixed bug with input file location for scam (created with cam3_0_25) +M cam1/models/lnd/clm2/src/main/areaMod.F90 +- bug fix for offline mode +M cam1/models/lnd/clm2/src/main/histFileMod.F90 +- removal of equivalences + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_25 +Originator: jet ( John Truesdale) +Date: Mon Jan 10 16:43:43 MST 2005 +Model: CAM +Version: CAM3.0.25 +One-line Summary: Updated SCAM INSTALL text and added data directory to fix bug with scam configure script. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): no +Tested to work with SCAM (tools/scam/testscript): no +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: n/a +Tested multiple constituents: n/a +Tested that different domain decompositions match bit-for-bit: n/a +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? no this is a nontesting tag, only edited text files (INSTALL and REAME) no code +modified. + +Changes made: + +Added words to the INSTALL file for SCAM to let the user know to set the +CSMDATA environment variable. Also added a directory under scam (/data). +The scam configure script assumes this directory exists and links all +scam data files here. The previous release didn't have this directory. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_24 +Originator: pworley ( Patrick H Worley) +Date: Thu Jan 6 11:20:57 MST 2005 +Model: CAM +Version: CAM3.0.24 +One-line Summary: reduced grid support for spectral dycores and miscellaneous bug fixes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no for full grid, yes (improved) for reduced grid +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: fixed reduced grid support in one routine +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Fixed support for reduced grid (Jim Rosinski): + - control/readinitial.F90 + - physics/cam1/prescribed_aerosols.F90 + - dynamics/eul/initcom.F90 + - lnd/clm2/src/main/surfFileMod.F90 + +Additional reduced grid support modifications (for the X1 +only?). Zeroing out unused locations in the FFT buffers is required +on the X1. + - dynamics/eul/linemsdyn.F90 + - dynamics/eul/spegrd.F90 + - dynamics/sld/spegrd.F90 + - dynamics/sld/scanslt.F90 + +Added new runtime option, dyn_equi_by_col, to improve performance of +spectral dycores when using reduced grid. When set to .true., it +attempts to allocate the same number of columns to each process in the +dynamics rather than the same number of latitude lines. For a full +grid, these goals are identical. The option is on by default. However, +it is not necessarily the best choice when using a reduced grid on a +vector system. Setting it to .false. executes the old code, +equidistributing the number of latitude lines whether using a full or +a reduced grid. + 1) Moved decompinit out of cam, into readinitial.F90 and restart.F90, + so that reduced grid option could be identifed before computing + dynamics decomposition + - control/cam.F90 + - control/readinitial.F90 + - control/restart.F90 + 2) Added dyn_equi_by_col runtime option + - control/runtime_opts.F90 + - dynamics/eul/spmd_dyn.F90 + - dynamics/sld/spmd_dyn.F90 + - dynamics/fv/spmd_dyn.F90 + 3) Added dyn_equi_by_col domain decomposition + - dynamics/eul/spmd_dyn.F90 + - dynamics/sld/spmd_dyn.F90 + +The SLD dycore does not have all of the modifications made to EUL in +Jan.-March, 2004 to, for example, decrease memory requirements in the +spectral domain. The following files were modified as a step toward +implementing these changes. The motivation is that including these +changes allows the SLD version of spmd_dyn.F90 to be almost identical +to that used in EUL. + - dynamics/sld/comspe.F90 + - dynamics/sld/scanslt.F90 + +The current Co-Array Fortran logic in CAM requires that the two +communication buffers allocated in the spectral dycores be the same +size. This is currently true when the number of processors divides the +latitudes, but not otherwise. Since this may be important for other +one-sided messaging systems as well, the following files have been +modified to require that all processes allocate the same size +communcation buffers. Note that this has no performance impact in +normal CAM usage (and probably never has an impact). + - control/mpishorthand.F + - control/spmdinit.F90 + - control/wrap_mpi.F90 + - dynamics/eul/spmd_dyn.F90 + - dynamics/sld/spmd_dyn.F90 + +Reinsert compiler directive fixing Cray X1 bug that was lost in +a previous check-in + - control/history.F90 + +The routine sort_chunks is called in create_chunks and +orders the columns assigned to a chunk. +It was added to phys_grid.F90 back when we were looking for +alternatives to the buffer copies introduced into radcswmx.F90 for +vectorization. A bug in this code was recently identified. Rather than +fix it, we have decided that sort_chunks does nothing useful even when +working correctly. Thus the routine sort_chunks has been removed. + + - physics/cam1/phys_grid.F90 + +Miscellaneous bug fixes: + + 1) A typo in the existing "equidistribute by latitudes" + decomposition logic was fixed. Fortunately, this bug + was never seen in practice. + + - dynamics/eul/spmd_dyn.F90 + - dynamics/sld/spmd_dyn.F90 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_23 +Originator: fvitt ( Francis Vitt) +Date: Tue Dec 21 10:13:50 MST 2004 +Model: CAM +Version: CAM3.0.23 +One-line Summary: Add ability to use offline data to drive finite volume dynamics core. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: yse +Requires OFFLINE_DYN C preprocessor flag to be set. +Substantial timing or memory changes: no +Requires change in run script: yes +Namelist varibles are added. See below. +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton +Restart files change: yes +Offline data file names added to restart file. +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +Added files: + models/atm/cam/src/dynamics/fv/metdata.F90 + models/atm/cam/src/dynamics/fv/pfixer.F90 + +Modified files: + models/atm/cam/src/dynamics/fv/cd_core.F90 + models/atm/cam/src/dynamics/fv/dp_coupling.F90 + models/atm/cam/src/dynamics/fv/dryairm.F90 + models/atm/cam/src/dynamics/fv/dynpkg.F90 + models/atm/cam/src/dynamics/fv/inidat.F90 + models/atm/cam/src/dynamics/fv/restart_dynamics.F90 + models/atm/cam/src/dynamics/fv/stepon.F90 + models/atm/cam/src/dynamics/fv/sw_core.F90 + models/atm/cam/src/dynamics/fv/uv3s_update.F90 + models/atm/cam/src/physics/cam1/inti.F90 + models/atm/cam/src/physics/cam1/physpkg.F90 + models/atm/cam/src/control/runtime_opts.F90 + models/atm/cam/src/control/string_utils.F90 + +Modifications are effective only if CAM is configured to use +offline meteorology data. To configure to use offline data +set OFFLINE_DYN C preprocessor flag. + +Namelist variables added: + + met_data_file The filepath of the netCDF file + containing the meteorology data + + met_cell_wall_winds Set to true if the meteorology winds are + defined on model cell walls. + Default is false. + + met_remove_file Set to true to have the offline data file be + removed from the local file system. + Default is false. + +The offline meteorology data can be read from a sequence of files +provided the files are named stringNNN.nc, where NNN is an integer +of any number of digits. If the data is contained in a series of +files, the files need to be named sequentially, e.g., metdata001.nc, +metdata002.nc, metdata003.nc, etc. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_22 +Originator: jeff ( Yen-Huei Lee) +Date: Fri Dec 10 10:20:33 MST 2004 +Model: CAM +Version: CAM3.0.22 +One-line Summary: add WACCM physics and chemistry +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Brian Eaton +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +Add two new direstories for WACCM: + models/atm/cam/src/physics/waccm/ + models/atm/cam/src/chemistry/waccm_mozart/ + +Change the following files: + A models/atm/cam/bld/config_cam_eul_defaults.xml + A models/atm/cam/bld/config_cam_fv_defaults.xml + A models/atm/cam/bld/config_cam_sld_defaults.xml + A models/atm/cam/bld/config_waccm_ghg_defaults.xml + A models/atm/cam/bld/config_waccm_mozart_defaults.xml + D models/atm/cam/bld/config_cache_defaults.xml + M models/atm/cam/bld/CAM_config.pmonfig.pm + M models/atm/cam/bld/DefaultCAMEXPNamelist.xml + M models/atm/cam/bld/DefaultCLMEXPNamelist.xml + M models/atm/cam/bld/camexp.pm + M models/atm/cam/bld/clm2exp.pm + M models/atm/cam/bld/configure + M models/atm/cam/bld/resolution_parameters.xml + M models/atm/cam/src/dynamics/eul/dp_coupling.F90 + M models/atm/cam/src/dynamics/eul/inital.F90 + M models/atm/cam/src/dynamics/eul/stepon.F90 + M models/atm/cam/src/dynamics/sld/dp_coupling.F90 + M models/atm/cam/src/dynamics/sld/inital.F90 + M models/atm/cam/src/dynamics/fv/dp_coupling.F90 + M models/atm/cam/src/dynamics/fv/dycore.F90 + M models/atm/cam/src/dynamics/fv/dynamics_vars.F90 + M models/atm/cam/src/dynamics/fv/inital.F90 + D models/atm/cam/src/physics/cam1/ghg_surfvals.F90 + A models/atm/cam/src/physica/cam1/chem_surfvals.F90 + M models/atm/cam/src/physics/cam1/advnce.F90 + M models/atm/cam/src/physics/cam1/aerosol_intr.F90 + M models/atm/cam/src/physics/cam1/check_energy.F90 + M models/atm/cam/src/physics/cam1/chemistry.F90 + M models/atm/cam/src/physics/cam1/cloud_fraction.F90 + M models/atm/cam/src/physics/cam1/constituents.F90 + M models/atm/cam/src/physics/cam1/convect_deep.F90 + M models/atm/cam/src/physics/cam1/convect_shallow.F90 + M models/atm/cam/src/physics/cam1/diagnostics.F90 + M models/atm/cam/src/physics/cam1/diffusion_solver.F90 + M models/atm/cam/src/physics/cam1/ghg_defaults.F90 + M models/atm/cam/src/physics/cam1/gw_drag.F90 + M models/atm/cam/src/physics/cam1/initindx.F90 + M models/atm/cam/src/physics/cam1/inti.F90 + M models/atm/cam/src/physics/cam1/molec_diff.F90 + M models/atm/cam/src/physics/cam1/physics_types.F90 + M models/atm/cam/src/physics/cam1/physpkg.F90 + M models/atm/cam/src/physics/cam1/qneg3.F90 + M models/atm/cam/src/physics/cam1/rad_constituents.F90 + M models/atm/cam/src/physics/cam1/radae.F90 + M models/atm/cam/src/physics/cam1/radheat.F90 + M models/atm/cam/src/physics/cam1/radiation.F90 + M models/atm/cam/src/physics/cam1/radlw.F90 + M models/atm/cam/src/physics/cam1/radsw.F90 + M models/atm/cam/src/physics/cam1/stratiform.F90 + M models/atm/cam/src/physics/cam1/sulfur_intr.F90 + M models/atm/cam/src/physics/cam1/tphysac.F90 + M models/atm/cam/src/physics/cam1/tphysbc.F90 + M models/atm/cam/src/physics/cam1/tracers.F90 + M models/atm/cam/src/physics/cam1/upper_bc.F90 + M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + M models/atm/cam/src/control/history.F90 + M models/atm/cam/src/control/restart.F90 + M models/atm/cam/src/control/runtime_opts.F90 + M models/atm/cam/src/control/time_manager.F90 + M models/atm/cam/tools/scam/scm_init/scam_inital.F90 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_21 +Originator: pworley ( Patrick H Worley) +Date: Mon Nov 1 07:40:57 MST 2004 +Model: CAM +Version: CAM3.0.21 +One-line Summary: Communication optimizations (MPI1, MPI2, Co-Array Fortran) for spectral dycores and dp_coupling; physics chunking bug fix. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes, improves performance on Earth Simulator when using MPI-2 one-sided option; may improve performance on Cray X1 +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): no +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +1) Fixed bug in assign_chunks identified by Steve Ghan and Tim Shippert. This + bug did not affect execution in the standard modes of operation. + +2) Fixed UNICOS/MP Makefile option for cam3_0_20 changes. + +3) Communication optimizations: + + - eliminated overlap implementations of realloc and dp_coupling + communications. All that was being overlapped was buffer copies, + which did not appear to be useful on the current target platforms. + + - added "alternative" implementations of alltoall and allgather + (used in realloc routines and dp_coupling), using + 1) one of a large number of MPI-2 point-to-point commands, + controlled by swap_comm_order, swap_comm_protocol, and + swap_comm_maxreq. The first two parameters have the same + meaning as before. swap_comm_maxreq controls the maximum number + of outstanding send/receive requests allowed in the + implementation of alltoall/allgather. This can be used to tune + performance or work around bugs on systems that do + not tolerate large numbers of outstanding requests well. + 2) MPI-2 put commands + 3) Co-Array Fortran remote writes + + #2 is important for performance on the Earth Simulator. The others + represent defensive programming, for situations in which the MPI + collectives are not implemented efficiently. #2 also seems to be + fastest on the Cray X1, but I haven't not done a careful study yet. + + - To support the MPI-2 implementation, replaced original + communication buffer logic + * call spmdbuf in spmdinit_dyn to allocate communication buffers; + call spmdbuf_resize in d_p_coupling or in p-d_coupling to + reallocate communication buffers is they are not large enough + with + * call spmdbuf in inital or in restart, after phys_grid_init, to + allocate communication buffers of the appropriate size the + first time, then use MPI_WINCREATE to enable remote + read/write from/to these buffers. + + - For the SLD dycore, added minor modifications originally + introduced into the EUL dycore to improve vectorization. This + makes realloc5, realloc5, and realloc7 almost identical between + the EUL and SLD dycores again, and should improve vectorization + for the SLD dycore. + + The new runtime options for dyn_alltoall, dyn_allgather, and + phys_alltoall are: + + 0: use collectives + 1: use MPI-2 point-to-point, as specified by swap_comm_order, + swap_comm_protocol, swap_comm_maxreq. (swap_comm_maxreq default + is -1, meaning no limit; >0 sets the upper bound) + 2: if compiled with -DMPI2, then use MPI-2 put implementation, else + use an MPI_SENDRECV implementation + 3: if compiled with -DCAF, then use Co-Array remote write + implementation, else use an MPI_SENDRECV implementation + + Files modified are as follows: + +control/restart.F90 + added call to spmdbuf +control/runtime_opts.F90 + added swap_comm_maxreq parameter +control/swap_comm.F90 + added swapm, swap_comm_maxreq; + removed swap1, swap2, swap3, swap1m, swap3m, do_swap1, do_swap3, + delayed_swap_recv +control/wrap_mpi.F90 + added mpialltoallint, altalltoallv, mpiwincreate +eul/dp_coupling.F90, sld/dp_coupling.F90 + added MPI2 window parameter to transpose call; + replaced spmdbuf_resize call with an spmdbuf_size test +eul/inital.F90, sld/inital.F90 + added smpdbuf call +eul/realloc4.F90, sld/realloc4.F90 + added altalltoall, removed swap routine calls +eul/realloc7.F90, sld/realloc7.F90, eul/scan2.F90, sld/scan2.F90 + added altalltoall, removed swap routine calls +eul/spmd_dyn.F90, sld/spmd_dyn.F90 + removed spmdbuf_resize and modified spmdbuf; + moved local_dp_map, block_buf_nrecs, and chunk_buf_nrecs from phys_grid; + added support for MPI2 and CAF. +fv/dp_coupling.F90 + side effect of moving local_dp_map, block_buf_nrecs, and + chunk_buf_nrecs from phys_grid to spmd_dyn +fv/spmd_dyn.F90 + moved local_dp_map, block_buf_nrecs, and chunk_buf_nrecs from phys_grid +sld/comspe.F90, scanslt.F90, spegrd.F90, trunc.F90 + vectorization modifications ported from EUL +physics/cam1/phys_grid.F90 + added altalltoall, removed swap routine calls + fixed assign_chunk bug. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_20 +Originator: jmccaa ( James McCaa) +Date: Mon Oct 18 11:58:59 MDT 2004 +Model: CAM +Version: CAM3.0.20 +One-line Summary: Refactored vertical diffusion module. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and Brian Eaton +Restart files change: no +Changes answers: Yes (same-to-roundoff) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Refactored the vertical diffusion module: + - new interface names + - new molecular diffusion module + - new turbulent mountain stress module + - new eddy diffusion module + - new diffusion solver module + - removed turbulence module + +Cleaned up unused variables from interfaces to convect_deep, +convect_shallow, cloud_fraction, stratiform modules. + +Added a T42 30-level ic file to the CAM defaults file. + +Added a function form of vqsatd to the wv_saturation module. + +Assorted small fixed to scam, plus modified the scam +configure and test scripts to allow running from a working +directory outside the distribution. + +Files added/deleted/modified: +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml +M models/atm/cam/doc/ChangeLog +M models/atm/cam/src/physics/cam1/advnce.F90 +M models/atm/cam/src/physics/cam1/cloud_fraction.F90 +M models/atm/cam/src/physics/cam1/convect_deep.F90 +M models/atm/cam/src/physics/cam1/convect_shallow.F90 +A models/atm/cam/src/physics/cam1/diffusion_solver.F90 +A models/atm/cam/src/physics/cam1/hb_diff.F90 +M models/atm/cam/src/physics/cam1/initindx.F90 +M models/atm/cam/src/physics/cam1/inti.F90 +A models/atm/cam/src/physics/cam1/molec_diff.F90 +M models/atm/cam/src/physics/cam1/physconst.F90 +M models/atm/cam/src/physics/cam1/stratiform.F90 +M models/atm/cam/src/physics/cam1/tphysac.F90 +M models/atm/cam/src/physics/cam1/tphysbc.F90 +M models/atm/cam/src/physics/cam1/tphysidl.F90 +A models/atm/cam/src/physics/cam1/trb_mtn_stress.F90 +R models/atm/cam/src/physics/cam1/turbulence.F90 +M models/atm/cam/src/physics/cam1/upper_bc.F90 +M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 +M models/atm/cam/src/physics/cam1/wv_saturation.F90 +M models/atm/cam/tools/scam/GNUmakefile +M models/atm/cam/tools/scam/configure +M models/atm/cam/tools/scam/testscript +M models/atm/cam/tools/scam/obj/Makefile +M models/atm/cam/tools/scam/scm_init/c_outfld.c +M models/atm/cam/tools/scam/scm_init/init_model.F90 +M models/atm/cam/tools/scam/scm_init/scam.c +M models/atm/cam/tools/scam/ui/GNUmakefile +M models/atm/cam/tools/scam/ui/configure +M models/atm/cam/tools/scam/ui/ncfile.h + +=============================================================== +=============================================================== + +cam3_0_19 +Originator: erik ( Erik Kluzek) +Date: Thu Sep 23 11:49:07 MDT 2004 +Model: CAM +Version: CAM3.0.19 +One-line Summary: Isolate extended grid information to just spectral dycores and just inside of SLT advection inside SLD and Eul dycores. +cam-bugs Requests resolved: 147 +(See http://wreq.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: see below +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, olson, mvr +Restart files change: yes (Eul and SLD) +Changes answers: bit-for-bit with Eul and FV dycores + same to roundoff for SLD dycore (on IBM and Linux/Lahey, + answers identical if you run with -debug compiler options) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Move cam3_0_18_brnchT_nohalo9 to cam_dev. + + Isolate extended grid information to SLT advection to only + within Spectral dy-cores. + +Use plon(regular grid) instead of plond(extended grid) except for +SLT variables, inside of relevent dynamics. + +Eulerian: + + scanslt becomes a module with alloc, initial, run and final phases. + + Remove comslt and move data to inside of scanslt or scan2. + + scanslt has a advection_state data-type to keep track of all extended + grid information. All data on the extended grid are kept inside of this + state. Dynamics data iscopied into and then out of this state for advection. + + New dimension for FFT -- plondfft. + + spetru has new temporary variables inside of it so it can be dimensioned + the right size for FFT (plondfft). + + linemsdyn becomes a module and scan2 becomes a module + + Make grdini, grdxy, sltb1, and sltini module subroutines of scanslt. + +SLD: + scanslt becomes a module with: alloc, initial, run_setup, run, and + final phases. Extended grid parameters moved from pmgrid and rgrid to + inside of this module. Much of the data becomes private inside of + scanslt module. Create advection_state data type to keep track of all + extended grid data, copy data into this structure and then out of + for the rest of the dynamics + + comslt removed and data moved to inside of scanslt. grmult becomes a module. + Use inf instead of nan for initialization. + + Spmd_dyn data only used for bndexch moved as private data inside of scanslt. + + Make bndexch, grdini, grdxy, sltlinint, slttraj, sltwgts, and trajdp + module subroutines of scanslt. + +test-model.pl + + Fix problem where couldn't change resolution on comand line + with -skip option (cam-bug 147). + + Add -cppdefs option + + Restart tests done at default compiler option rather than explicitly + set to production compiler settings. This allows the use of the "-debug" + option to override the default setting for testing where this is + useful. + +SCAM: + Improve readability of testscript, send output to log files + and have the script clean up after itself better. Use plon instead + of plond. + +Performance changes: (Following tests were done with earlier versions + on no-halo branch based off of cam3_0_9 for eul and + cam3_0_15 for sld test) + Eul@T42 on IBM same + Eul@T85 on IBM with 11 constituents 3% slower + Sld@T42 on IBM 2% faster + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_18 +Originator: mvr ( Mathew Rothstein), eaton, mirin +Date: Fri Sep 17 11:01:58 MDT 2004 +Model: CAM +Version: CAM3.0.18 +One-line Summary: A collection of bug fixes and portability enhancements +cam-bugs Requests resolved: none +Requires change in build system: yes +Makefile changed for pgi compile defaults +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes +mss system calls now go through csm_share code +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M models/atm/cam/bld/Makefile +- mods to pgi compiler defaults: -O2 optimization (non-debug), -Mrecursive + only in debug mode +- mod to ifort name for intel builds +M models/atm/cam/src/control/abortutils.F90 +- fix for ibm jobs hanging in xl__trbk routine +M models/atm/cam/src/control/ccsm_msg.F90 +- fix for ccsm with FV 2D composition +M models/atm/cam/src/control/ioFileMod.F90 +- now calls csm_share code for mss system calls +M models/atm/cam/src/control/runtime_opts.F90 +- fix to properly communicate the input vars kmxhdc, dif2, dif4 +R models/atm/cam/src/control/system_cmd.c +- no longer needed - now using csm_share code +M models/atm/cam/src/physics/cam1/cldwat.F90 +- fix for non-default vertical resolution extending top of model above 1mb +M models/atm/cam/src/physics/cam1/phys_grid.F90 +- corrected routine argument from intent out to intent in +M models/atm/cam/test/system/CAM_test.pm +- bug fix for "-skip" options in test-model +M models/ice/csim4/ice_data.F90 +- fixed out of bounds array reference +M models/lnd/clm2/src/main/fileutils.F90 +- now call csm_share code for mss system calls +R models/lnd/clm2/src/main/system_cmd.c +- no longer needed - now using csm_share code + +M models/utils/esmf/README +M models/utils/esmf/build/common +A models/utils/esmf/build/Darwin_absoft/ESMF_conf.h +A models/utils/esmf/build/Darwin_absoft/base +A models/utils/esmf/build/Darwin_absoft/base.site +A models/utils/esmf/build/Darwin_absoft/base_variables +A models/utils/esmf/build/Darwin_absoft/fix.h +A models/utils/esmf/build/Darwin_xlf/ESMF_conf.h +A models/utils/esmf/build/Darwin_xlf/base +A models/utils/esmf/build/Darwin_xlf/base.site +A models/utils/esmf/build/Darwin_xlf/base_variables +M models/utils/esmf/src/Infrastructure/Error/ESMC_Error.c +M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Alarm.c +M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Calendar.c +M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Date.c +M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_TOD.c +M models/utils/esmf/src/Infrastructure/TimeMgmt/ESMC_Time.c +- upgrade to esmf_0_0_8 + +M models/utils/timing/t_pclstr.c +M models/utils/timing/t_stop.c + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_17 +Originator: jeff ( Yen-Huei Lee) +Date: Mon Sep 13 14:41:57 MDT 2004 +Model: CAM +Version: CAM3.0.17 +One-line Summary: bug fix +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + + Add one file + + A models/atm/cam/src/physics/cam1/upper_bc.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_16 +Originator: jeff ( Yen-Huei Lee) +Date: Mon Sep 13 13:22:44 MDT 2004 +Model: CAM +Version: CAM3.0.16 +One-line Summary: modified vertical diffusion +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Tested to work with SCAM (tools/scam/testscript): yes +Machines tested: IBM, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + + Modified the following files: + M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + M models/atm/cam/src/physics/cam1/tphysac.F90 + M models/atm/cam/src/physics/cam1/rad_constituents.F90 + M models/atm/cam/src/physics/cam1/ghg_defaults.F90 + M models/atm/cam/src/physics/cam1/constitueadvnce.F90 + M models/atm/cam/src/physics/cam1/advnce.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_15 +Originator: eaton ( Brian Eaton) +Date: Thu Sep 2 08:14:58 MDT 2004 +Model: CAM +Version: CAM3.0.15 +One-line Summary: new radiation/constituents interface +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, boville, conley +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Create an new radiation/constituent interface. This functionality (for gas +phase constituents) previously resided in the chemistry module. It has +been reimplemented in it's own module (rad_constituents.F90) to facilitate +swapping in new chemistry code without having to duplicate the control +logic in another chemistry module. Also, the new module can be extended to +coordinate control of the aerosol constituents. + +Modified the constituents module: +1) Add an optional argument to cnst_add to allow specifying that the + default outfld calls for that constituent should not be made. This + allows, for example, the chemistry module to output volume mixing + ratios rather than the default mass mixing ratios. +2) Add an optional argument to cnst_get_ind to allow it to return an error + status rather than just aborting if the requested name is not found in + the constituent array. + +Add a bugfix to cldwat.F90. Some variables needed initializers. Only +caused a problem if the top of the model was above 1mb. + +Create a new module (ghg_defaults.F90) for the default ghg distributions +computed by trcmix. + +Added lat and lon (radians) to the physics_state data type. + +Add a method to the ozone_data module to return a pointer to the +interpolated data. + +Returned the chemistry module to its previous functionality of just +providing prognostic ghg distributions using a simple production/loss +chemistry. + + +=============================================================== +=============================================================== + +cam3_0_14 +Originator: jmccaa ( James Mccaa) +Date: Wed Aug 25 19:58:09 MDT 2004 +Model: CAM +Version: CAM3.0.14 +One-line Summary: Introduction of definehires utility and use of 30 second topographic variance (SGH30) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +This checkin introduces a new utility, definehires, that can be used to process +USGS 30 second topographic data and produce a 10-minute dataset suitable for +use with definesurf. +It is located in the directory: +cam1/models/atm/cam/tools/definehires/README + +The following files were modified to accomodate a new input dataset + field (SGH30) that represents the variance of the 30-second + height data on the 10-minute grid. This supplements the field + SGH, which represents the variance of the 10-minute mean heights + on the model grid. Both definesurf and CAM can still use the + old datasets with no change in answers from the current code. + In the case of CAM, if SGH30 is not present, the model will use + SGH in its place (as it currently does), but SGH30 will be used + if found. +>> cam1/models/atm/cam/src/dynamics/eul/inidat.F90 +>> cam1/models/atm/cam/src/dynamics/sld/inidat.F90 +>> cam1/models/atm/cam/src/dynamics/fv/inidat.F90 +>> cam1/models/atm/cam/src/physics/cam1/comsrf.F90 +>> cam1/models/atm/cam/src/physics/cam1/diagnostics.F90 +>> cam1/models/atm/cam/src/physics/cam1/physpkg.F90 +>> cam1/models/atm/cam/src/physics/cam1/restart_physics.F90 +>> cam1/models/atm/cam/src/physics/cam1/tphysac.F90 +>> cam1/models/atm/cam/src/control/history.F90 +>> cam1/models/atm/cam/tools/definesurf/Makefile +>> cam1/models/atm/cam/tools/definesurf/fmain.f90 +>> cam1/models/atm/cam/tools/definesurf/sghphis.f90 + + +=============================================================== +=============================================================== + +cam3_0_13 +Originator: eaton ( Brian Eaton) +Date: Tue Aug 24 15:28:21 MDT 2004 +Model: CAM +Version: CAM3.0.13 +One-line Summary: add single interface for radiation to access trace gases +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes, same-to-roundoff +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +The non-water gas phase constituents that are required by the radiation +codes are O3, CO2, CH4, N2O, CFC11, CFC12. All these constituents, except +CO2, are now accessed only via the chemistry module. A single method, +chem_get_cnst, returns constituent values regardless of whether they are +prognostic variables from the constituent array, or are diagnosed or +interpolated from a dataset. So all the logic for determining where a +constituent comes from now lives in the top level chemistry interface and +not in the top level radiation interface. + +CO2 is a special case because it is assumed by the radiation algorithms to +be a single global value. For now it is still accessed directly from the +ghg_surfvals module. We expect this to change in the future. + +These changes are roundoff due to the decision that chem_get_cnst should +return values as mass mixing ratio. Previously O3 values were accessed +from the interpolation routine as volume mixing ratio and converted to +mass mixing ratio as needed. The change in where this conversion happens +introduced a roundoff level difference. + + +=============================================================== +=============================================================== + +cam3_0_12 +Originator: jmccaa ( James McCaa) +Date: Thu Aug 19 09:06:13 MDT 2004 +Model: CAM +Version: CAM3.0.12 +One-line Summary: Addition of a column radiation model and various fixes to SCAM. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +This checkin adds a column radiation model to the SCAM, and also +contains a variety of general fixes/enhancements to SCAM, mostly +centered around allowing it to work with nonstandard numbers of model +levels. Details follow... + + +Addition of the column radiation model: +--------------------------------------- + +The CRM can operate on old-style text CRM input files, or on a model +state initialized via any of scam's existing methods. + +The CRM has both non-gui and gui modes. The gui version is accessed +via a new page under scam's "Options" tab. The non-gui version is +accessed via a shell script named crm. + +I modified testscript to test the crm. +The following output from the test script indicates a pass (both lines +must be present): + +scam passed its bfb test. +CRM passed. + + +General scam modifications: +--------------------------- + +Scam now honors the use_srfprop flag. + +To facilitate running at nonstandard numbers of levels: + scam now guesses the appropriate level-dependent pressure file to use. + ncdio_atm.F90 has been modified to interpolate/extrapolate data to + the scam levels if necessary. + +Handling of defaults files and quickstart files is slightly more robust. + +Scam now plots interface level fields correctly. + +Buffer sizes have been increased to allow scam to use up to 300 levels. + +The gui's configure script has been modified to remove an unnecessary +dependency on libg2c when not using ncar graphics + +I fixed an unitialized value problem in readiopdata.F90. + +I modified init_model.F90 to handle C-to-fortran string passing +according to the unix standard. + +I modified the scam testscript to retry (up to 10 times) on +compilation failures to try to overcome our persisent license server +problems. + +I added a sanity check on precab(i) to cldwat.F90. + +Updated init_model.F90 to reference ozone_data.F90 instead of comozp.F90. + +Lastly, I removed 7 Mb of apparently unneeded ncar graphics files from +the repository. + +=============================================================== +=============================================================== + +cam3_0_11 +Originator: eaton ( Brian Eaton) +Date: Fri Aug 13 12:06:12 MDT 2004 +Model: CAM +Version: CAM3.0.11 +One-line Summary: add fv 1.9x2.5 resolution; sst dataset generation tools +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Add 1.9x2.5 (96 lats, 144 lons) resolution for finite volume. Configure +using: + configure -dyn fv -res 1.9x2.5 + +Add sst dataset generation tools from Jim Rosinski. + + +=============================================================== +=============================================================== + +cam3_0_10 +Originator: eaton ( Brian Eaton) +Date: Mon Aug 9 12:11:12 MDT 2004 +Model: CAM +Version: CAM3.0.10 +One-line Summary: add new modules for radiation and ozone data +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +. Created modules for ozone datasets (ozone_data.F90), longwave radiation + (radlw.F90), and shortwave radiation (radsw.F90). + + The old radini which initialized the old common block crdcon contained a + couple of constants which differed from the share constants. In order to + have a bit-for-bit commit the old values have been maintained. + +. Add pointer variables inside radiation_tend to provide flexible method of + passing either prescribed or prognostic constituents to the radiation + calcs. + +. Removed the common block ptrrgrid.h which was not being used. + +. Added some FV 10x15 datasets to the Default*Namelist.xml files. + +. Added back 13 files that were lost during the cam3_0_9 commit. + +=============================================================== +=============================================================== + +cam3_0_9 +Originator: rosinski ( Jim Rosinski) +Date: Sun Jul 25 14:14:34 MDT 2004 +Model: CAM +Version: CAM3.0.9 +One-line Summary: Enable CAM to build and run using Intel compiler suite +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): no +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, CLM changes by Vertenstein +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +CVS says: + +M atm/cam/bld/Makefile +M lnd/clm2/src/biogeophys/Hydrology2Mod.F90 +M lnd/clm2/src/main/decompMod.F90 +M lnd/clm2/src/main/histFileMod.F90 +A utils/esmf/build/linux_altix/ESMF_conf.h +A utils/esmf/build/linux_altix/base +A utils/esmf/build/linux_altix/base.site +A utils/esmf/build/linux_altix/base_variables +A utils/esmf/build/linux_altix/fix.h +A utils/esmf/build/linux_intel/ESMF_conf.h +A utils/esmf/build/linux_intel/base +A utils/esmf/build/linux_intel/base.site +A utils/esmf/build/linux_intel/base_variables +A utils/esmf/build/linux_intel/fix.h +M utils/timing/t_pr.c + +Minor mods (listed above) to CAM Makefile, timing print routine, CLM +routines, and ESMF to enable CAM to build and run on Linux machines using +Intel compiler suite. 2-day error growth test using ifort and icc passed at +T42 in EUL configuration. + +ESMF upgraded to ESMF_0_0_6 per Erik Kluzek. No code changes, but support +added for linux_intel and linux_altix. Note that linux_intel assumes that +Fortran and C compilers are both Intel (ifort and icc respectively). Though +CAM can be configured (and will run) with gcc, there is little point in doing +this as of this commit since ESMF will still require icc. + +Minor mods to CLM routines to allow compilation with ifort. + +Addition of an "fclose" to timing print routine t_pr.c to force a buffer +flush. Without it icc was truncating its printed output of model timers. + + +IMPORTANT: the only configurations of Intel compiler suite and underlying +glibc library that proved successful were: + +ifort >= 8.0.046 +icc >= 8.0.055 +glibc >= 2.3.x + +Tests in which not all these conditions were met resulted in various +failures, including general compiler errors, internal compiler errors, and +segmentation faults. + +Notes: + +o In general the Intel compilers create code that runs fast. Compile times +for optimized code (-O2) can be fairly long. + +o The debugger (idb) is line-based. Hopefully it can be used in conjunction +with ddd to give a window-based option. + +o Hybrid OpenMP/MPI configuration with Intel compilers was tested and does +work. Little timing difference compared with pure-MPI was observed. +Depending on model conifiguration, manipulation of environment variable +KMP_STACKSIZE may be required to avoid seg faults when threading is enabled. + +o Tests enabling floating point traps (-fpe0) did not work in SPMD mode, so +this option was not included in Makefile mods. Hopefully the code changes +required to enable this option will be minor. + + +=============================================================== +=============================================================== + +cam3_0_8 +Originator: jeff ( Yen-Huei Lee) +Date: Wed Jul 21 11:53:53 MDT 2004 +Model: CAM +Version: CAM3.0.8 +One-line Summary: ntoplw changes to radiation arrays +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe)no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate)no +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + + M models/atm/cam/src/physics/cam1/crdcon.h + M models/atm/cam/src/physics/cam1/radae.F90 + M models/atm/cam/src/physics/cam1/radclwmx.F90 + M models/atm/cam/src/physics/cam1/radini.F90 + M models/atm/cam/src/physics/cam1/restart_physics.F90 + M models/atm/cam/src/physics/cam1/trcplk.F90 + M models/atm/cam/src/physics/cam1/trcpth.F90 + +See: http://www.cgd.ucar.edu/cgi-binradae.F90/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_7 +Originator: mvr ( Mathew Rothstein), eaton, bundy +Date: Tue Jul 20 10:03:47 MDT 2004 +Model: CAM +Version: CAM3.0.7 +One-line Summary: Added new physics interface (deep & shallow convection, stratiform, radiation) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: to be determined +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton, bundy +Restart files change: no +Changes answers: Yes (same-to-roundoff) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +R models/atm/cam/src/physics/cam1/cldcond.F90 +R models/atm/cam/src/physics/cam1/cldnrh.F90 +R models/atm/cam/src/physics/cam1/convtran.F90 +R models/atm/cam/src/physics/cam1/moistconvection.F90 +R models/atm/cam/src/physics/cam1/radctl.F90 +A models/atm/cam/src/physics/cam1/convect_deep.F90 +A models/atm/cam/src/physics/cam1/convect_shallow.F90 +A models/atm/cam/src/physics/cam1/hk_conv.F90 +A models/atm/cam/src/physics/cam1/radiation.F90 +A models/atm/cam/src/physics/cam1/stratiform.F90 +M models/atm/cam/src/control/history.F90 +M models/atm/cam/src/dynamics/eul/inidat.F90 +M models/atm/cam/src/dynamics/fv/inidat.F90 +M models/atm/cam/src/dynamics/sld/inidat.F90 +M models/atm/cam/src/physics/cam1/aerosol_intr.F90 +M models/atm/cam/src/physics/cam1/buffer.F90 +M models/atm/cam/src/physics/cam1/carbon_intr.F90 +M models/atm/cam/src/physics/cam1/diagnostics.F90 +M models/atm/cam/src/physics/cam1/dust_intr.F90 +M models/atm/cam/src/physics/cam1/initindx.F90 +M models/atm/cam/src/physics/cam1/inti.F90 +M models/atm/cam/src/physics/cam1/param_cldoptics.F90 +M models/atm/cam/src/physics/cam1/phys_adiabatic.F90 +M models/atm/cam/src/physics/cam1/phys_idealized.F90 +M models/atm/cam/src/physics/cam1/physics_types.F90 +M models/atm/cam/src/physics/cam1/physpkg.F90 +M models/atm/cam/src/physics/cam1/restart_physics.F90 +M models/atm/cam/src/physics/cam1/srfxfer.F90 +M models/atm/cam/src/physics/cam1/sulfur_intr.F90 +M models/atm/cam/src/physics/cam1/tphysbc.F90 +M models/atm/cam/src/physics/cam1/zm_conv.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_6 +Originator: mvr ( Mathew Rothstein) +Date: Fri Jul 16 16:54:46 MDT 2004 +Model: CAM +Version: CAM3.0.6 +One-line Summary: Added SOM tools; Modified CLM log output to version 3.0; Bug fix for system command strings +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes...updated log output to version 3.0 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +---added files needed to create SOM tools +A models/atm/cam/tools/definemld/Makefile +A models/atm/cam/tools/definemld/README +A models/atm/cam/tools/definemld/binf2c.f90 +A models/atm/cam/tools/definemld/definemld1x1.c +A models/atm/cam/tools/definemld/definemld1x1.h +A models/atm/cam/tools/definemld/definemldbdy.f90 +A models/atm/cam/tools/definemld/err_exit.c +A models/atm/cam/tools/definemld/neighborfill.f90 +A models/atm/cam/tools/definemld/precision.f90 +A models/atm/cam/tools/definemld/sm121.f90 +A models/atm/cam/tools/definemld/wrap_nc.c +A models/atm/cam/tools/definemld/wrap_nf.f90 +A models/atm/cam/tools/defineqflux/Makefile +A models/atm/cam/tools/defineqflux/README +A models/atm/cam/tools/defineqflux/backsolve.c +A models/atm/cam/tools/defineqflux/check_consistent.c +A models/atm/cam/tools/defineqflux/defineqflux.c +A models/atm/cam/tools/defineqflux/defineqflux.h +A models/atm/cam/tools/defineqflux/definesomic.h +A models/atm/cam/tools/defineqflux/err_exit.c +A models/atm/cam/tools/defineqflux/gepp.c +A models/atm/cam/tools/defineqflux/mksith.c +A models/atm/cam/tools/defineqflux/printeq.c +A models/atm/cam/tools/defineqflux/timediddle_mavg.c +A models/atm/cam/tools/defineqflux/wrap_nc.c + +M models/lnd/clm2/src/main/initializeMod.F90 + - updated log output to version 3.0 +M models/atm/cam/src/control/system_cmd.c + - bug fix for handling of system command strings + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_5 +Originator: jet ( John Truesdale) +Date: Thu Jun 24 13:17:43 MDT 2004 +Model: CAM +Version: CAM3.0.5 +One-line Summary: Updated SCAM files to match cam3.0 distribution +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: mostly documentation) +(Detailed description below) +Tested to work coupled with CCSM (create_ccsmcam): no +Machines tested: none +Ran test-model.pl script: no +Tested on fv dynamics: na +Tested on eul dynamics:na +Tested on sld dynamics:na +Tested that restarts are bit-for-bit: na +Tested multiple constituents: na +Tested that different domain decompositions match bit-for-bit: na +Tested in adiabatic mode: na +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM +CRB? yes + +Changes made: + +Added data directory and README file +deleted duplicate INSTALL and scam.html file in html directory +updated userguide.html +corrected but in testscript + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_4 +Originator: mvr ( Mathew Rothstein), truesdale, vertenstein +Date: Mon Jun 21 10:19:32 MDT 2004 +Model: CAM +Version: CAM3.0.4 +One-line Summary: Cleanup of default settings of CAM/CLM input datasets; SCAM updated; Fixed two CLM bugs +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, truesdale, vertenstein +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes +fixed bug in code to exclude fields from history tape; fixed bug in code that +generates land surface datasets for fv +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +R models/atm/cam/tools/scam/scm_init/scam_rpc.h +A models/atm/cam/tools/scam/testscript + - new validation test script +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml + - modified entry for fv2x2.5 input dataset, removed references to linked + files, modified some comments +M models/atm/cam/bld/DefaultCLMEXPNamelist.xml + - new entry for fv2x2.5 input dataset, modified some comments +M models/atm/cam/tools/scam/.scam_defaults +M models/atm/cam/tools/scam/configure +M models/atm/cam/tools/scam/ui/configure +M models/atm/cam/tools/scam/ui/manager.cpp +M models/lnd/clm2/src/main/histFileMod.F90 + - fixed bug in code that allows user to exclude fields from primary + history tape +M models/lnd/clm2/src/mksrfdata/mksrfdatMod.F90 + - fixed bug in generation of land surface datasets for fv + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_3 +Originator: olson ( Jerry Olson) +Date: Thu Jun 17 14:33:44 MDT 2004 +Model: CAM +Version: CAM3.0.3 +One-line Summary: new initial conditions input/output +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton +Restart files change: no +Changes answers: no (bit-for-bit) except: + a) answers change in aqua-planet mode for all dycores + (new climate) + b) round-off for SLD on IBMs +Changes to CLM land-model: yes. trivial mods to comments +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + + +-------------- + + Description of changes: + + - The history.F90 module is modified to include the Initial Conditions file as + part of the general history file build process. Details: + + - the IC file is formatted exactly like a history file. + - just as in other history files, the IC file is filled via calls to + "outfld". + - no time averaging; fields are always instantaneous + - only one time sample written to file + - accumulation/output is in double precision + - "ptapes" increased from 6 to 7 + - IC file is indexed "mtapes" in the history module (always at end of + active history file list) + - name of file includes ".i." rather than ".hX." + + - two namelist parameters control the building of the IC file: + + - INITHIST: controls frequency of IC file writes (for both land and + atmosphere): '6-HOURLY, 'DAILY', 'MONTHLY', 'YEARLY' or + 'NONE' + - INITHIST_ALL: .false.: dump ONLY required fields to IC file + .true. : dump required AND optional fields to IC + file (DEFAULT) + - setting "EMPTY_HTAPES = .true." does NOT prevent the IC file from being + created. + - only setting INITHIST = 'NONE' prevents the IC file from being created. + - no space allocated on history buffer if INITHIST = 'NONE' + - the old IC file build routine, "write_inithist" is removed + + - Note: - In an Eulerian run, the new code does not produce identical IC + files as the old code. The values for QCWAT, TCWAT, LCWAT, and + CLD will be different. + + - In adiabatic mode, the FV dycore *still* does not create an IC + file with the proper temperature on it. In adiabatic mode, FV + does not update temperature. Therefore, the IC file will + contain the wrong temperature. + + - History (and IC) fieldnames can be up to 16 characters long + + - inidat.F90 re-written for all dycores. All fields are now read and processed + one at a time, reducing memory costs. All reads are done via a call to a + single netCDF interface (modified version of module written for the Land + Model by Mariana Vertenstein). + + - inidat.F90 is backward compatible with OLD IC files. + + - EUL and SLD spetru.F90 modules modified to be identical to eachother + + - another new namelist variable: + + RAD_FIRST_HOUR: Flag to force model to compute full radiation every + timestep in the first model hour (for use in + "forecast/analysis" runs) + Default: .false. + + - restart files will change (because of extra characters for each field) + + - Removed code associated with HADVTEST and VADVTEST cpp tokens ("blob" test) + + - Bugfixes in aqua-planet mode: + + - the field "landm" is now set to 0. Changes answers; new climate for + aqua-planet. + - fixed bug in analytical SST specification (in a branch of code not run + by default model) + - Bugfix to test-model.pm provided by Erik. + + +-------------- + + Files modified: + + M models/atm/cam/bld/CAM_run.pm + - Bugfix provided by Erik + M models/atm/cam/src/control/comctl.h + - added namelist variable, "rad_first_hour" + M models/atm/cam/src/control/filenames.F90 + - deleted old IC file logic + M models/atm/cam/src/control/history.F90 + - extensive changes to add IC file as + part of the history file set (ptapes = 7) + - history file field names can be up to + 16 characters long + M models/atm/cam/src/control/readinitial.F90 + - added logic to trap possible model and IC file inconsistencies in the + grid/spectral resolutions + M models/atm/cam/src/control/runtime_opts.F90 + - added new namelist variables + M models/atm/cam/src/dynamics/eul/dyndrv.F90 + - removed blob test code + M models/atm/cam/src/dynamics/eul/grmult.F90 + - removed blob test code + M models/atm/cam/src/dynamics/eul/inidat.F90 + - cleanup + M models/atm/cam/src/dynamics/eul/linemsdyn.F90 + - removed blob test code + M models/atm/cam/src/dynamics/eul/spetru.F90 + - modified so that "eul" and "sld" spetru routines are identical + M models/atm/cam/src/dynamics/eul/stepon.F90 + - removed logic associated with old IC file code + - added call to dump state field values to IC file buffer + M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 + - removed blob test code + - fix to qneg3 diagnostic print + M models/atm/cam/src/dynamics/fv/inidat.F90 + - cleanup + M models/atm/cam/src/dynamics/fv/inital.F90 + - modified a "use" statement + M models/atm/cam/src/dynamics/fv/stepon.F90 + - removed logic associated with old IC file code + - added call to dump state fields to IC file buffer + M models/atm/cam/src/dynamics/sld/dyndrv.F90 + - removed blob test code + M models/atm/cam/src/dynamics/sld/grmult.F90 + - removed blob test code + M models/atm/cam/src/dynamics/sld/inidat.F90 + - cleanup + M models/atm/cam/src/dynamics/sld/restart_dynamics.F90 + - removed unused fields from restart file + M models/atm/cam/src/dynamics/sld/scan2.F90 + - removed logic associated with old IC file code + M models/atm/cam/src/dynamics/sld/scanslt.F90 + - removed blob test code + M models/atm/cam/src/dynamics/sld/sltwgts.F90 + - removed blob test code + M models/atm/cam/src/dynamics/sld/spetru.F90 + - modified so that "eul" and "sld" spetru routines are identical + M models/atm/cam/src/dynamics/sld/stepon.F90 + - added call to dump state fields to IC file buffer + M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 + - removed blob test code + - fixed diagnostics bug in qneg3 + M models/atm/cam/src/ocnsice/dom/sst_data.F90 + - fixed bug in analytical SST specification (used in "aqua-planet" mode) + M models/atm/cam/src/physics/cam1/advnce.F90 + - Do full radiation every timestep of first model hour if "rad_first_hour" + is .true. + M models/atm/cam/src/physics/cam1/diagnostics.F90 + - add routine to dump physics fields to IC file buffer + M models/atm/cam/src/physics/cam1/phys_adiabatic.F90 + - cleanup + M models/atm/cam/src/physics/cam1/physics_types.F90 + - fix to qneg3 diagnostic print + M models/atm/cam/src/physics/cam1/phys_idealized.F90 + - cleanup + M models/atm/cam/src/physics/cam1/physpkg.F90 + - call routine to dump physics fields to IC file buffer + M models/atm/cam/src/physics/cam1/qneg3.F90 + - fix to qneg3 diagnostic print + M models/atm/cam/src/physics/cam1/restart_physics.F90 + - fix to quell compiler complaint + M models/atm/cam/src/physics/cam1/tphysbc.F90 + - fix to qneg3 diagnostic print + M models/lnd/clm2/src/main/clm_varctl.F90 + M models/lnd/clm2/src/main/inicFileMod.F90 + +-------------- + + Files added: + + A models/atm/cam/src/control/ncdio_atm.F90 + - Wrapper for reading a 2-D or 3-D field from a netCDF IC file + A models/atm/cam/src/dynamics/eul/diag_dynvar_ic.F90 + - "outfld" dynamics state variables to history buffer (for IC file) + A models/atm/cam/src/dynamics/fv/diag_dynvar_ic.F90 + - "outfld" dynamics state variables to history buffer (for IC file) + A models/atm/cam/src/dynamics/sld/diag_dynvar_ic.F90 + - "outfld" dynamics state variables to history buffer (for IC file) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_2 +Originator: erik ( Erik Kluzek) +Date: Wed Jun 9 10:29:42 MDT 2004 +Model: CAM +Version: CAM3.0.2 +One-line Summary: Major test-model.pl update, bug fix for DGVM in clm code +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton, Matt Rothstein, and Tom Henderson +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: DGVMMod.F90, and driver.F90 from Mariana for DGVM bug-fix +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Synopsis: + +Overall this is a major refactoring of test-model.pl. This is the version +of test-model.pl that was on the subroutinization branch for the last year. +This improves the default behavior of test-model.pl and makes it easier +and more flexible to use. It also provides for the ability to test the +test-model.pl test harness. + +Files changed and a description of the changes: + +M models/atm/cam/bld/CAM.pm +M models/atm/cam/bld/CAM_config.pm +M models/atm/cam/bld/CAM_namelist.pm +M models/atm/cam/bld/CAM_run.pm +R models/atm/cam/bld/check-namelist.pl +R models/atm/cam/bld/lsmexp.pm +M models/atm/cam/bld/run-model.pl + +Add abilities needed by new test-model.pl. Don't delete *.f90 files. +Delete lsmexp.pm file. Make run options more clear. Add printlev and test +option to namelist. Build_namelist always does a new on a namelist +object. Get rid of check-namelist.pl as not used. + +M models/atm/cam/test/system/CAM_test.pm +M models/atm/cam/test/system/README +A models/atm/cam/test/system/babyblue.test-model.pl.log ! testonly mode results +M models/atm/cam/test/system/dao_batch.csh +A models/atm/cam/test/system/default_tests.test-model.xml ! XML default tests +A models/atm/cam/test/system/namelist-config.test-model.dbg.log ! file of + configuration/namelists from testonly mode +M models/atm/cam/test/system/ncar_batch.csh +A models/atm/cam/test/system/specs-testslist.test-model.xml ! XML file of + specifications of fields expected in testslist XML files +M models/atm/cam/test/system/test-model.pl + +New version of test-model.pl as described below. + +M models/atm/cam/tools/newcprnc/Makefile + +Allow use of env variables needed by test-model.pl. Still not used in +test-model.pl as newcprnc doesn't do a proper mass weighting of the +differences. + +M models/lnd/clm2/src/biogeochem/DGVMMod.F90 +M models/lnd/clm2/src/main/driver.F90 + +Bug-fixes from Mariana for DGVM. + +Details of changes to test-model.pl + +test-model.pl -- new version with XML files to control tests that + are run. This is the version of test-model.pl that was + used on the subroutinization branch. Modified batch scripts + to correspond to new command line options. + +Default is changed so that if you are comparing and a test is +NOT bit-for-bit to the comparision code -- test-model.pl will +stop. + +New command line options to test-model.pl + +-cleanonly = only clean files out +-help_defaults = Create file with configuration/namelist information + for all tests -allow_nonb4bcompare = Allow comparisions not bit-for-bit to continue. +-[no]spmd = Turn on [off] SPMD mode +-[no]smp = Turn on [off] SMP mode +-nocompareifskipped = If you are skipping tests a comparision will NOT + be run if a given test is skipped. -namelist "namelist" = Reads in namelist and adds these options to the + namelists that are used. +-testonly = Only test test-model.pl running configure and + build-namelist for all tests to demonstrate what + test-model.pl would have produced. +-testslist filename = Use the given XML file of tests rather + than the default file. + +Information on all command-line options is given with + +test-model.pl -help + +newcprnc -- Add ability to use the env variables needed for test-model.pl + VPATH, EXEDIR. To use this in test-model.pl change the path + in test-model.pl and change CAM_test.pm to NOT use the "-m" option + as the behavior of this flag was reversed in newcprnc from cprnc. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0_1 +Originator: erik ( Erik Kluzek) +Date: Tue May 25 16:40:56 MDT 2004 +Model: CAM +Version: CAM3.0.1 +One-line Summary: Get rid of ncdata_vers stuff, and fix SOM comparision bug in test-model.pl +cam-bugs Requests resolved: 118 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes +(ncdata_vers is no longer needed) +Tested to work coupled with CCSM (create_ccsmcam): yes +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Get rid of ncdata_vers stuff in the build-namelist scripts. + +Fix bug in SOM comparisions, so test-model.pl will flag a difference +if SOM code changes. Previously this aspect was broken and the comparisions +files were mislabled. Now the files are properly labeled, SOM control +tests are made in a seperate directory, and namelist and configuration +variables are consistent such that the comparision is valid. This problem +was documented as cam-bug #118. + +No code was changed only build and configuration and test scripts. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam3_0 +Originator: eaton ( Brian Eaton) +Date: Mon May 24 15:33:43 MDT 2004 +Model: CAM +Version: CAM3.0 +One-line Summary: remove old CAM2 documentation +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: none +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no + +Changes made: + +Remove old CAM2 documentation. + +=============================================================== +=============================================================== + +cam2_0_2_dev86 +Originator: mvertens ( Mariana Vertenstein) +Date: Thu May 20 10:56:00 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev86 +One-line Summary: updated clm code clm3_deva_14 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes (TER.01a.T31_gx3v5.K.blackforest) +Machines tested: IBM, SGI, Linux(lf95) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +1) Updated clm code to clm3_deva_14 +2) Updated clm documentation to clm3_deva_14 +3) One line modification to + atm/src/control/ioFileMod.F90 + clm2/src/main/fileutils.F90 + to fix file removal problem associated with mss writes + +=============================================================== +=============================================================== + +cam2_0_2_dev85 +Originator: jet ( John Truesdale) +Date: Tue May 18 14:53:15 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev85 +One-line Summary: Added SCAM to cam_dev +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Added cpp delimeted code to allow clm to work + in single column mode. + +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +My check-in includes 3 sets of modifications to CAM code. +1) modifications to allow it to work in single column mode +2) additional source code and configuration files to create GUI + for the Single-Column CAM (SCAM). +3) modification to CAM to allow it to produce a history file that + can be used by SCAM to run in a pseudo-iop mode using model + data. + +Most of the modifications to CAM source have been delimited by cpp +tokens (#defined SCAM and #defined BFB_CAM_SCAM_IOP) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev84 +Originator: mvr ( Mathew Rothstein) +Date: Fri May 14 09:43:26 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev84 +One-line Summary: Replaced numerical recipes routines for random# generation and findvalue; modified Makefile to eliminate double comma problem; other small bug fixes +cam-bugs Requests resolved: none +Requires change in build system: yes +- replaced the use of function subst in Makefile with patsubst to eliminate + double comma problem +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, pjr +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +R models/atm/cam/src/utils/findvalue.F90 + - removing old find routine based on numerical recipe algorithm +A models/atm/cam/src/utils/marsaglia.F90 + - new random number generator for cloud simulator +M models/atm/cam/src/physics/cam1/cloudsimulator.F90 + - modified to seed new random number generator +M models/atm/cam/src/physics/cam1/icarus_scops.F90 + - now uses new random number generator rather than algorithm from + numerical recipes +M models/atm/cam/src/physics/cam1/radclwmx.F90 + - added r8 declaration to array aer_trn_ttl +M models/atm/cam/src/physics/cam1/radcswmx.F90 + - now uses fortran intrinsic for finding an array minimum rather + than a routine from numerical recipes +M models/atm/cam/bld/Makefile + - replaced the use of function subst with patsubst to eliminate ,, +M models/atm/cam/test/system/CAM_test.pm + - modified error message in test-model + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev83 +Originator: mvr ( Mathew Rothstein) +Date: Thu May 13 09:56:08 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev83 +One-line Summary: Replaced sort routine; modified handling of namelist vars for computing run stop date; modifed input dataset path strings +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: same-to-roundoff +Changes to CLM land-model: yes +- modified strings of default input datasets to include full path from csmdata +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +R models/atm/cam/src/utils/sortarray.F90 + - removing old sort routine based on numerical recipe algorithm +A models/atm/cam/src/utils/quicksort.F90 + - replacing sort routine with new quick-sort algorithm +M models/atm/cam/src/physics/cam1/radclwmx.F90 + - modified to call new sort routine +M models/atm/cam/src/physics/cam1/radcswmx.F90 + - modified to call new sort routine +M models/atm/cam/src/control/time_manager.F90 + - modified handling of namelist parameters for computing stop date +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml + - modified input dataset strings to include full path from csmdata +M models/atm/cam/bld/DefaultCLMEXPNamelist.xml + - modified input dataset strings to include full path from csmdata +M models/atm/cam/bld/camexp.pm + - modified to use new input dataset strings +M models/atm/cam/bld/clm2exp.pm + - modified to use new input dataset strings + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev82 +Originator: jmccaa ( James Mccaa) +Date: Mon May 10 15:40:39 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev82 +One-line Summary: Tuning modifications for the finite volume dycore. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, intel +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes, for FV -- bit-for-bit for EUL and SLD +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +Modified tuning for FV 2x2.5, and introduced tuning settings for FV 4x5 +and FV 1x1.25. +A new i.c. file for FV 4x5 was introduced. +These files were modified: +M cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml +M cam1/models/atm/cam/src/dynamics/fv/dycore.F90 +M cam1/models/atm/cam/src/physics/cam1/cldwat.F90 +M cam1/models/atm/cam/src/physics/cam1/cloud_fraction.F90 +M cam1/models/atm/cam/src/physics/cam1/moistconvection.F90 +M cam1/models/atm/cam/src/physics/cam1/zm_conv.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev81 +Originator: mvertens ( Mariana Vertenstein) +Date: Tue May 4 10:40:20 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev81 +One-line Summary: updated clm code to clm3_deva_10 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes (TER.01a.T31_gx3v5.K.blackforest) +Machines tested: IBM, SGI, Linux(lf95) +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Forrest Hoffman +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes (see below) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +1) Updated clm code to clm3_deva_10 + This primarily includes the addition of CrayX1 directives to the code + as well as changes to DGVM to make it effectively work on the Cray X1 + Also changed the name of the clm file changed in cam2_0_2_dev80 back + to its original name for the sake of cvs history continuity +2) Modified history.F90 to use (ieor,iand) rather than (xor,and) + +=============================================================== +=============================================================== + +cam2_0_2_dev80 +Originator: eaton ( Brian Eaton) and Pat Worley +Date: Wed Apr 28 17:44:37 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev80 +One-line Summary: merge vector branch +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux/lf95, Linux/pgi +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Pat Worley +Restart files change: no +Changes answers: Yes (same-to-roundoff) +Changes to CLM land-model: rename STATICEcosysDynMod.F90 --> STATICEcosystemDynMOD.F90 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +1. Merge of vector and scalar code branches: + +The mods for the NEC that didn't change answers (bit-for-bit) were +committed previously. This set of mods introduces a roundoff level +change into the simulation. The main modifications are: + +. A new version of radcswmx. This code runs a little slower on the IBM + (about 4% of total run time). It introduces roundoff level changes + which affects all dycores. + +. Large sections of code have been changed which reorder the spectral + calculations in the EUL dycore. We observed no performance degradation + on the IBM from this change. + +. Most of the Cray optimizations have been included as well. They are mainly + compiler directives. + +2. Rename a CLM file which didn't match the module name it contained (this + breaks the dependency generator) + +3. Some cleanup in ncar_batch.csh + +=============================================================== +=============================================================== + +cam2_0_2_dev79 +Originator: eaton ( Brian Eaton) +Date: Fri Apr 23 07:56:47 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev79 +One-line Summary: T31 tuning; T31 and T85 datasets; diagnostics +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, Linux/lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +. Tuning mods for T31 +. New datasets for T31 and T85 +. Diagnostics: + - AIX specific traceback call added to abortutils + - Check for NaNs in timeinterp + +=============================================================== +=============================================================== + +cam2_0_2_dev78 +Originator: eaton ( Brian Eaton) and Mat Rothstein +Date: Tue Apr 20 10:52:58 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev78 +One-line Summary: misc configure/Makefile/test-model changes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes, on Blackforest +Machines tested: IBM, Linux/lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvr +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +. Fix hack in test-model that set F_OPTIMIZATION_OVERRIDE for certain PGI + tests. The hack was broken by the inclusion of a commandline option to + configure for setting the F_OPTIMIZATION_OVERRIDE macro in the Makefile. +. Add print in test-model output to tells which log contains NOT BFB + message. +. Various configure/Makefile changes: + - Temporarily remove -Mbounds from PGI debug options. CLM2 is not working + with this option. + - Add -cppdefs option to configure for defining CPP tokens. These cpp + definitions are appended to the Makefile defaults. Remove the -precomp + option which was adding #define lines to misc.h. + - Add capability to configure to determine the name of the MPI library + being used. This is currently most useful for Linux which may use + either mpi or mpich as the library name. + - Clean up Linux section of Makefile. Fixed a bug which broke the build + if the user specified the option '-fc pgf90' to configure. Remove + options for compilers that don't have corresponding builds of the ESMF + library. +. Add missing addfld call for H2O2DRY in sulfur_intr.F90 + +=============================================================== +=============================================================== + +cam2_0_2_dev77 +Originator: mvr ( Mathew Rothstein) and Brian Eaton +Date: Tue Apr 6 10:38:51 MDT 2004 +Model: CAM +Version: CAM2.0_2.dev77 +One-line Summary: Update cloud simulator; T31 mods; Enable cloud overlap scenarios; Bug fix in masterlist lookups; Re-commit of infnan mods +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes +replaced infnan mods of dev65, mistakenly removed +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +R models/atm/cam/src/physics/cam1/cloudsimulatorparms.F90 + - put data in icarus_scops.h, put doisccp into cloudsimulator.F90 +A models/atm/cam/src/physics/cam1/icarus_scops.F90 + - new module containing subroutine isccp_cloud_types (converted to free + format) and subroutine ran0_vec + - change output types to r8 + - replace "STOP" with endrun calls + - add diagnostic for meanttop + - add icarus_scops_init routine to read in tautab and invtau arrays +M models/atm/cam/bld/DefaultCAMEXPNamelist.xml + - added default value for dataset isccpdata, needed for isccp simulator +M models/atm/cam/bld/camexp.pm + - modified to handle namelist parameters related to the isccp simulator +M models/atm/cam/src/control/cam.F90 + - remove call to initialization routine +M models/atm/cam/src/control/history.F90 + - use icarus_scops instead of use cloudsimulatorparms + - remove addfld and add_default calls for diagnostic fields (move to + cloudsimulator_init) + - remove unnecessary addfld for aermmr + - added endrun calls for hash table lookups of fields not on masterlist +M models/atm/cam/src/control/runtime_opts.F90 + - use cloudsimulator instead of cloudsimulatorparms +M models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 + - removed outfield calls and related code for fields not on masterlist +M models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 + - removed outfield calls and related code for fields not on masterlist +M models/atm/cam/src/physics/cam1/check_energy.F90 + - removed unneeded code to fix bug identified by SX6 machine +M models/atm/cam/src/physics/cam1/cldwat.F90 + - added special setting of physical constants for T31 runs +M models/atm/cam/src/physics/cam1/cloud_fraction.F90 + - added special setting of physical constants for T31 runs +M models/atm/cam/src/physics/cam1/cloudsimulator.F90 + - rename isccptab --> cloudsimulator_init + - rename ccm_isccp --> cloudsimulator_run + - add state to cloudsimulator_run args + - add addfld and add_default calls for diagnostic fields + - change arguments to isccp_cloud_types from single columns to chunks + - use the totalcldarea diagnostic from isccp_cloud_types rather than the + cltot diagnostic from cam to decide whether it's cloudy or not. This + avoids assigning fillvalues inside the isccp_cloud_types code +M models/atm/cam/src/physics/cam1/constituents.F90 + - commented out code for fields no longer in use +M models/atm/cam/src/physics/cam1/initindx.F90 + - commented out code for fields no longer in use +M models/atm/cam/src/physics/cam1/inti.F90 + - call cloudsimulator_init +M models/atm/cam/src/physics/cam1/moistconvection.F90 + - added special setting of physical constants for T31 runs +M models/atm/cam/src/physics/cam1/param_cldoptics.F90 + - add_default call for icldiwp + - modify long name attribute for icldlwp +M models/atm/cam/src/physics/cam1/radclwmx.F90 + - uncommented line and modified associated array declaration in LW + cloud-overlap code (critical for certain cloud overlap assumptions) +M models/atm/cam/src/physics/cam1/tphysbc.F90 + - use cloudsimulator instead of cloudsimulatorparms + - update cloudsimulator_run args + - removed outfield calls and related code for fields not on masterlist +M models/atm/cam/src/physics/cam1/zm_conv.F90 + - added special setting of physical constants for T31 runs +M models/lnd/clm2/src/main/nanMod.F90 + - replaced mods for quiet/signalling NaN's of dev65 that were + mistakenly overwritten with dev75 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev76 +Originator: rosinski ( Jim Rosinski) +Date: Tue Mar 30 15:11:23 MST 2004 +Model: CAM +Version: CAM2.0_2.dev76 +One-line Summary: bit-for-bit NEC vector branch changes. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit). PC is only roundoff +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Merged cam2.0.2.dev67.brnchT.nec15 (vector branch) changes that do not affect + answers onto cam_dev. Opted for Pat Worley's dev68 communication mods over NEC + communication mods where conflicts occurred. A few NEC_SX ifdefs still + exist in the committed code. Most involve reversing "do k" and "do i" + loops in dynamics routines for vectorization. An inner loop over k results + in a non-unit-stride situation on scalar machines and should be avoided. + That is why these code portions were left ifdef'd + +o Note 1: The code appears to be good to roundoff on IBM machines when NEC_SX is + #define'd. To test this on an IBM, "! defined AIX" needs to be added in 2 + obvious places in cfort.h and abortutils.F90 + +o Note 2: An odd behavior was discovered whereby inconsistent chunck indices are + printed from ice_srf.F90 at times when the ice temperature profile is reset to + linear. This behavior appears to only manifest when threads * tasks exceeds + the number of physical CPUs available. It was decided to commit without + resolving this discrepancy because the behavior occurs in the base model and + in earlier libraries, i.e. independent of the NEC vector mods. + +=============================================================== +=============================================================== +cam2_0_2_dev75 +Originator: mvertens ( Mariana Vertenstein) +Date: Fri Mar 26 15:07:40 MST 2004 +Model: CAM +Version: CAM2.0_2.dev75 +One-line Summary: updated clm to clm3_deva_08 +cam-bugs Requests resolved: none +Requires change in build system: no (can removed atmlnd_share from Filepath howeer) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, (Brian Eaton revied cam time_manager.F90) +Restart files change: yes +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes - updated to clm3_deva_08 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +1) added perpetual model to cam-clm + - updated clm/src to clm3_deva_09 which had perpetual mode changes. + - modified models/atm/cam/src/control/time_manager.F90 to add offset argument to + subroutine get_perp_date(..) +2) changes to models/atm/cam/bld/: + - removed setting of reset_csim_iceprops in DefaultCAMEXPNamelist.xml + - removed atmlnd_share from configure +3) chages to atmlnd_share/: + atmlnd_share no longer needed + atmlnd_share/cfort.h updated and moved to models/atm/cam/src/control and models/lnd/clm2/src/main + atmlnd_share/datetime.F90 moved to models/atm/cam/src/control + atmlnd_share/infnan.F90 moved to models/atm/cam/src/control + atmlnd_share/linebuf_stdout.c moved to models/atm/cam/src/control + atmlnd_share/mpishorthand.F moved to models/atm/cam/src/control + atmlnd_share/string_utils.F90 moved to models/atm/cam/src/control + atmlnd_share/wrap_nf.F90 moved to models/atm/cam/src/control +4) other changes: + removed all files in following directories - they are now obsolete:following obsolete files: + models/bld/ + scripts/gui/ + scripts/gui_run/ + scripts/system_test/ + scripts/test.a1/ + scripts/test.a2/ + scripts/tests/cpl_check/ + scripts/tests/gprof/ + scripts/tests/sub_sgi/ + scripts/tests/test_scripts/ + scripts/tests/timing/ +=============================================================== +=============================================================== + +cam2_0_2_dev74 +Originator: mvr ( Mathew Rothstein) +Date: Thu Mar 18 11:51:59 MST 2004 +Model: CAM +Version: CAM2.0_2.dev74 +One-line Summary: Add fields to master list for radiation diagnostics; fixes to build-namelist for "naked decimal" and handling of raw land surface datasets +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes +clm2exp.pm: now properly handles user-specified raw land surface datasets +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M cam1/models/atm/cam/bld/clm2exp.pm + - now properly handles user-specified raw land surface datasets +M cam1/models/atm/cam/bld/namelist.pm + - added ability to read "naked" decimal entries +M cam1/models/atm/cam/bld/script_tests/namelist.pl + - added namelist tests for "naked" decimal entries and more +M cam1/models/atm/cam/src/control/history.F90 + - add addfld calls for ASDIR, ASDIF, ALDIR, ALDIF + - remove old addfld call for REL + - add addfld call for SST +M cam1/models/atm/cam/src/physics/cam1/comsrf.F90 + - init trefmxav, trefmnav + - init lchnk and ncol in srfflx_state_2d +M cam1/models/atm/cam/src/physics/cam1/diagnostics.F90 + - change diag_surf to use srfflx_state and surface_state types + - add outfld calls for ASDIR, ASDIF, ALDIR, ALDIF + - add outfld call for SST +M cam1/models/atm/cam/src/physics/cam1/param_cldoptics.F90 + - add addfld and outfld calls for EMIS, CICEWP, REI, REL +M cam1/models/atm/cam/src/physics/cam1/physpkg.F90 + - pass srfflx_state and surface_state types to diag_surf instead of the + individual fields +M cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 + - remove old outfld call for REL + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev73 +Originator: mirin ( Arthur Andrew Mirin) +Date: Mon Mar 15 09:16:02 MST 2004 +Model: CAM +Version: CAM2.0_2.dev73 +One-line Summary: Mod_comm and related updates. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: new test on blackforest +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +(A) mod_comm has been significantly streamlined to make it easier to +understand the coding; module mod_irreg has been combined into mod_comm; +option to dynamically allocate target window has been added. +More work still needs to be done. Most of the changes in the FV routines +are due to the new linkage. + +(B) the utils/pilgrim subdirectory can now be included for all 3 dycores; +this requires setting the if-def MODCM_DP_TRANSPOSE. Consequently, +the mod_comm option for the dynamics/physics transposes in phys_grid +is now operational with all 3 dycores; + +(C) namelist variable modcomm_method has been fissioned into 2 new +namelist variables - modcomm_transpose and modcomm_geopk; these are +applicable to the FV dycore. + +(D) the namelist variable phys_alltoall is now overloaded when applicable +to mod_comm; its new value is 11 + (mod_comm method), where (mod_comm method) +can have values from 0 to 3; see code documentation in phys_grid. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev72 +Originator: bundy ( Danielle R. B. Coleman) +Date: Fri Mar 12 12:13:22 MST 2004 +Model: CAM +Version: CAM2.0_2.dev72 +One-line Summary: fix FV mass conservation problem +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux (Lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Phil Rasch +Restart files change: no +Changes answers: changes answers in FV only +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +models/atm/cam/src/dynamics/fv/fill_module.F90 + +fix mass conservation for small mixing ratios by scaling tiny fill value +to magnitude of mixing ratio. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev71 +Originator: bundy ( Danielle R. B. Coleman) +Date: Wed Mar 10 16:13:03 MST 2004 +Model: CAM +Version: CAM2.0_2.dev71 +One-line Summary: Add dry mixing ratio formulation, suite of test tracers +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux (Lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Phil Rasch +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + a. A list of any subroutines eliminated; +models/atm/cam/src/physics/cam1/test_tracers.F90 +models/atm/cam/src/physics/cam1/rnozunit.F90 + + b. A list of any subroutines added and what they do; and +models/atm/cam/src/physics/cam1/tracers.F90 +replaces eliminated file test_tracers.F90 +an interface for a generic suite of tracers specified in tracers_suite.F90 + +models/atm/cam/src/physics/cam1/tracers_suite.F90 +replaces eliminated rnozunit.F90 +contains all the specifications for a suite +of tracers, and is interfaced to the model via tracers.F90. + + c. For existing files that have been modified, an itemized list + of the changes and where they can be found + +models/atm/cam/src/physics/cam1/advnce.F90 + add call to tracers_timestep_init +models/atm/cam/src/physics/cam1/check_energy.F90 + add check_tracers mass capability +models/atm/cam/src/physics/cam1/constituents.F90 + add mixtype (wet or dry) field to constituent description + add functions to get type by index or name +models/atm/cam/src/physics/cam1/convtran.F90 +/models/atm/cam/src/physics/cam1/diagnostics.F90 + outfld call for PDELDRY +models/atm/cam/src/physics/cam1/initindx.F90 +models/atm/cam/src/physics/cam1/inti.F90 + change namelist variables that control tracers +models/atm/cam/src/physics/cam1/moistconvection.F90 +models/atm/cam/src/physics/cam1/physics_types.F90 + add capability for wet or dry mixtype tracers +models/atm/cam/src/physics/cam1/physpkg.F90 + calculates pdeldry for dry mixtypes + added gavglook subroutine for checking mass conservation +models/atm/cam/src/physics/cam1/tphysac.F90 + change tracer namelist variables, subroutine calls + check mass of tracers + for LR dyn, convert dry to wet at end +models/atm/cam/src/physics/cam1/tphysbc.F90 + calculate and write out dry surface pressure PSDRY + check mass of tracers +models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + calculate tend wrt dry pressure for dry mixtype tracers + by calling vdiff for again only if there are dry tracersm +models/atm/cam/src/physics/cam1/turbulence.F90:trbintr() + add optional argument to skip outfld calls + ( used on 2nd call to subroutine from 2nd call to vdiff) +models/atm/cam/src/control/filenames.F90 + add boundary file for test tracers: bndtvsf6 +models/atm/cam/src/control/runtime_opts.F90 + change namelist variables for tracers: + [new] bndtvsf6 + [mod] tracers_flag [replaces trace_test{1-3}] +models/atm/cam/src/control/history.F90 + addfld PSDRY +models/atm/cam/src/advection/slt/qmassa.F90 +models/atm/cam/src/advection/slt/xqmass.F90 + add capability for dry mixtype tracers +models/atm/cam/src/dynamics/eul/dp_coupling.F90 +models/atm/cam/src/dynamics/sld/dp_coupling.F90 + only change wet mixtype tracers to dry/wet mr for dyn/phys +models/atm/cam/src/dynamics/fv/dp_coupling.F90 + convert dry mixtype tracers to wet/dry for dyn/phys +models/atm/cam/src/dynamics/fv/stepon.F90 + before 1st call to dynamics, convert dry tracers to wet +models/atm/cam/src/dynamics/eul/inidat.F90 +models/atm/cam/src/dynamics/sld/inidat.F90 +models/atm/cam/src/dynamics/fv/inidat.F90 + name changes test_tracers -> tracers +models/atm/cam/src/dynamics/eul/scanslt.F90 +models/atm/cam/src/dynamics/sld/scanslt.F90 + pass vars (n3,q3) to slt interface +models/atm/cam/src/dynamics/eul/tfilt_massfix.F90 +models/atm/cam/src/dynamics/sld/tfilt_massfix.F90 + modify qneg threshold (corm) for dry mixtypes to conserve mass +/models/atm/cam/src/dynamics/eul/comslt.F90 + add trcavg variable + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev70 +Originator: pworley ( Patrick H Worley) +Date: Tue Mar 9 08:30:43 MST 2004 +Model: CAM +Version: CAM2.0_2.dev70 +One-line Summary: replaced use of mpi_comm_world with mpicom in initialization of swap_comm module +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux/Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +modified control/swap_comm.F90: + replaced mpi_comm_world with mpicom when duplicating communicators (for use in + swap_comm module routines). Without this, CAM does not work with CCSM. + +added test/system/create_ccsmcam: + script provided by Mariana Vertenstein to test CAM with CCSM + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev69 +Originator: mvr ( Mathew Rothstein) +Date: Thu Mar 4 17:35:12 MST 2004 +Model: CAM +Version: CAM2.0_2.dev69 +One-line Summary: Fix for DMS bug; Fix for co2 ramping with rate<0; Added co2vmr to history output +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M models/atm/cam/src/physics/cam1/acbnd.F90 + - move allocate outside of masterproc conditional in acbndint() +M models/atm/cam/src/physics/cam1/dmsbnd.F90 + - fix bug reading new time sample in dmsbndint() + - move allocate outside of masterproc conditional in dmsbndint() +M models/atm/cam/src/physics/cam1/soxbnd.F90 + - move allocate outside of masterproc conditional in soxbndint() +M models/atm/cam/src/physics/cam1/ghg_surfvals.F90 + - fixed the handling of co2 ramping when the rate is less than zero +M models/atm/cam/src/control/history.F90 + - added co2vmr (co2 volume mixing ratio) to the history output files + + +=============================================================== +=============================================================== + +cam2_0_2_dev68 +Originator: pworley ( Patrick H Worley) +Date: Wed Mar 3 12:55:10 MST 2004 +Model: CAM +Version: CAM2.0_2.dev68 +One-line Summary: communication optimizations and removal of PVP ifdefs +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: not with default settings +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux cluster +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself (earlier version reviewed by Tom Henderson) +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + +1) Removed PVP ifdefs (to make merge with vector branches cleaner). Files affected: + control/cam.F90, rgrid.F90 + + dynamics/eul/comspe.F90, dyn.F90, dyndrv.F90, grcalc.F90, hordif.F90, + inital.F90, initcom.F90, quad.F90, settau.F90, spetru.F90, + trunc.F90, tstep.F90 + + dynamics/fv/initcom.F90 + + dynamics/sld/dyn.F90, dyndrv.F90, dynpkg.F90, grcalc.F90, hordif.F90, + initcom.F90, quad.F90, spetru.F90, trunc.F90, tstep.F90, + tstep1.F90, vertnm.F90 + +2) Reimplemented communication algorithms in spectral dycore realloc routines + and in the physics load balancing, using either MPI collectives or + point-to-point implementations that use the swap_comm module. swap_comm + was imported from PSTSWM and PCCM, and supports 28 different options. The default + is to use collectives. When not using collectives, the default is to use the + original point-to-point algorithm (using mpi_sendrecv). Runtime options + dyn_alltoall, dyn_allgather, phys_alltoall, swap_comm_order, and swap_comm_protocol + were added to runtime_options to specify these. For example, + dyn_alltoall == 0 means to use MPI_Alltoallv in realloc4a and realloc4b. + dyn_alltoall == 1 means to use one of the point-to-point algorithms. + + Physics load balancing was also changed to use the same communication buffer + as that used by the realloc routines. Finally, the physics load balancing + options were tweaked, primarily to remove a high complexity initialization algorithm + that was dominating runtime for short runs at high resolution. Files affected: + + control/runtime_opts.F90, spmd_utils.F90, spmdinit.F90, swap_comm.F90, mpi_wrap.F90 + + dynamics/eul/dp_coupling.F90, realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 + + dynamics/fv/spmd_dyn.F90 + + dynamics/sld/dp_coupling.F90, realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 + + physics/cam1/phys_grid.F90 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev67 +Originator: mvr ( Mathew Rothstein) +Date: Fri Feb 27 08:53:27 MST 2004 +Model: CAM +Version: CAM2.0_2.dev67 +One-line Summary: Implemented co2 ramping; Enabled lf95/debug checking with sulfates on; fix for 200MB radiation diagnostics +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI(pending), Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M models/atm/cam/src/control/runtime_opts.F90 + - added new option to namelist var scenario_ghg: RAMP_CO2_ONLY + - added new namelist variables: ramp_co2_annual_rate, ramp_co2_cap, + ramp_co2_start_ymd +M models/atm/cam/src/control/time_manager.F90 + - added new routine to calculate #of days between dates: timemgr_datediff +M models/atm/cam/src/physics/cam1/acbnd.F90 + - mods to enable lf95/debug checking with sulfates on +M models/atm/cam/src/physics/cam1/dmsbnd.F90 + - mods to enable lf95/debug checking with sulfates on +M models/atm/cam/src/physics/cam1/soxbnd.F90 + - mods to enable lf95/debug checking with sulfates on +M models/atm/cam/src/physics/cam1/ghg_surfvals.F90 + - formally implemented ability to ramp co2 +M models/atm/cam/src/physics/cam1/radcswmx.F90 + - added fix for 200MB radiation diagnostics + - uses new function to retrieve co2 mass mixing ratio +M models/atm/cam/src/physics/cam1/trcpth.F90 + - uses new function to retrieve co2 mass mixing ratio + + +=============================================================== +=============================================================== + +cam2_0_2_dev66 +Originator: eaton ( Brian Eaton) +Date: Mon Feb 23 16:40:39 MST 2004 +Model: CAM +Version: CAM2.0_2.dev66 +One-line Summary: misc performance improvements +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes (performance improvement validated by G. Carr) +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Carr, Edwards +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +>> models/atm/cam/src/dynamics/eul/herxin.F90 +>> . "rolled" a loop for better cache performance (Edwards) +>> +>> models/atm/cam/src/dynamics/eul/limdy.F90 +>> models/atm/cam/src/dynamics/eul/limdz.F90 +>> . inlined scm0 by hand into limdy and limdz (Carr) +>> +>> models/atm/cam/src/dynamics/eul/sltini.F90 +>> . remove SPMD ifdefs and thread a loop that was previously unthreaded +>> when SPMD was defined. (Eaton) + +=============================================================== +=============================================================== + +cam2_0_2_dev65 +Originator: hender ( Tom Henderson) +Date: Thu Feb 12 16:18:09 MST 2004 +Model: CAM +Version: CAM2.0_2.dev65 +One-line Summary: IPCC performance upgrade in prognostic sulfate interpolation +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Intel-Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Jim McCaa, Brian Eaton, Jim Rosinski, Mathew Rothstein +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Restored signalling Nan except for pgf90 +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +>> Performance fix to scale computations in linintp. Speedup = ~12% for +>> stand-alone CAM at T85 with IPCC scenario configurations for prognostic +>> sulfates and greenhouse gasses: +>> models/atm/cam/bld/run-ibm.csh +>> models/atm/cam/src/physics/cam1/acbnd.F90 +>> models/atm/cam/src/physics/cam1/dmsbnd.F90 +>> models/atm/cam/src/physics/cam1/soxbnd.F90 +>> models/atm/cam/src/physics/cam1/sulchem.F90 +>> models/atm/cam/src/physics/cam1/sulemis.F90 +>> models/atm/cam/src/physics/cam1/sulfur_intr.F90 +>> models/atm/cam/src/control/error_messages.F90 +>> Jim Rosinski's new timers: +>> models/atm/cam/src/physics/cam1/comsrf.F90 +>> models/atm/cam/src/physics/cam1/convtran.F90 +>> models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +>> models/atm/cam/src/physics/cam1/tphysbc.F90 +>> models/atm/cam/src/control/intp_util.F90 +>> Brian Eaton's change to remove broadcasts from chemistry.F90 that were +>> happening every time step: +>> models/atm/cam/bld/DefaultCAMEXPNamelist.xml +>> models/atm/cam/bld/DefaultCLMEXPNamelist.xml +>> models/atm/cam/src/physics/cam1/chemistry.F90 +>> Mathew Rothstein's change to use quiet NaN for pgf90 and signalling NaN for +>> all other compilers. +>> models/lnd/clm2/src/main/nanMod.F90 +>> models/atmlnd_share/infnan.F90 +>> Jim McCaa's addition of 200mb fields. +>> models/atm/cam/src/physics/cam1/radclwmx.F90 +>> models/atm/cam/src/physics/cam1/radcswmx.F90 +>> models/atm/cam/src/physics/cam1/radctl.F90 +>> models/atm/cam/src/control/history.F90 +>> By default, this change produces no new output fields; however, it allows +>> one to fincl the following: +>> FSN200: Clearsky shortwave flux at 200 mb +>> FSN200C: Shortwave flux at 200 mb +>> FLN200: Clearsky longwave flux at 200 mb +>> FLN200C: Longwave flux at 200 mb + +=============================================================== +=============================================================== + +cam2_0_2_dev64 +Originator: mvr ( Mathew Rothstein) +Date: Mon Feb 2 11:13:05 MST 2004 +Model: CAM +Version: CAM2.0_2.dev64 +One-line Summary: patch to enable runs using portland group compiler; removal of mprun2d.pm +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: yes + - modified definition of parameter nan to enable runs using portland group compiler +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +M cam1/models/lnd/clm2/src/main/nanMod.F90 + - modified definition of parameter nan to enable run using portland + group comiler +R cam1/models/atm/cam/bld/mprun2d.pm + + +=============================================================== +=============================================================== + +cam2_0_2_dev63 +Originator: rosinski ( Jim Rosinski) +Date: Tue Jan 27 10:15:42 MST 2004 +Model: CAM +Version: CAM2.0_2.dev63 +One-line Summary: Eliminate dead code, more flexible endrun, more "intent" attributes, + better lf95 strict error checking compliancy +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Mariana checked this. +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Vertenstein +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o endrun is now in a module and takes an optional character string argument. + If present, this string is printed before the model aborts. +o Eliminated dead code, including the old "dataicemodel". Mods were made to + ncar_batch.csh to eliminate the dataicemodel tests. This was done by passing + -skip all:1-17 to test-model. +o Also eliminated dead logic related to sulfur variables. +o Better strict error checking compliancy under lf95. But "lf95 -x" cannot be + used because lf95 warns that all underlying libraries must also be compiled + with this option in order for it to work properly. +o Added "intent" clause to arguments where the proper value was clear. The code + was already in pretty good shape w.r.t. all arguments having their intent + declared. There are still a few places where intent needs to be added though. +=============================================================== +=============================================================== + +cam2_0_2_dev62 +Originator: hender ( Tom Henderson) +Date: Fri Jan 23 10:49:42 MST 2004 +Model: CAM +Version: CAM2.0_2.dev62 +One-line Summary: IPCC scenario changes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes, new namelist variables, new data files +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC-Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Conley, Bundy, Rosinski +Restart files change: no +Changes answers: no (bit-for-bit) for runs that do not use prognostic sulfates, +Yes otherwise +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + + 1. Complete documentation of the changes, including: + a. A list of any subroutines eliminated; +>> cam1/models/atm/cam/src/physics/cam1/Population.F90 +>> cam1/models/atm/cam/src/physics/cam1/aerosols.F90 +>> cam1/models/atm/cam/src/physics/cam1/ramp_ghg_bau.h +>> cam1/models/atm/cam/src/physics/cam1/ramp_ghg_stab.h +>> cam1/models/atm/cam/src/physics/cam1/ramp_scon.h + + b. A list of any subroutines added and what they do; and +>> cam1/models/atm/cam/src/physics/cam1/carbonscales.F90 +>> Formerly Population.F90 +>> cam1/models/atm/cam/src/physics/cam1/prescribed_aerosols.F90 +>> Formerly aerosols.F90 +>> cam1/models/atm/cam/src/utils/timeinterp.F90 +>> Combined repeated code bits into a new subroutine. + + c. For existing files that have been modified, an itemized list + of the changes and where they can be found + (NOTE: A cvs command that generates all of the above information can be + provided in place of individual answers. For example, "cvs -nq + update ..." or "cvs rdiff ...".) +>> cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml +>> cam1/models/atm/cam/bld/camexp.pm +>> cam1/models/atm/cam/bld/run-model.pl +>> cam1/models/atm/cam/src/physics/cam1/advnce.F90 +>> cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 +>> cam1/models/atm/cam/src/physics/cam1/chemistry.F90 +>> cam1/models/atm/cam/src/physics/cam1/dmsbnd.F90 +>> cam1/models/atm/cam/src/physics/cam1/ghg_surfvals.F90 +>> cam1/models/atm/cam/src/physics/cam1/inti.F90 +>> cam1/models/atm/cam/src/physics/cam1/radae.F90 +>> cam1/models/atm/cam/src/physics/cam1/radcswmx.F90 +>> cam1/models/atm/cam/src/physics/cam1/radctl.F90 +>> cam1/models/atm/cam/src/physics/cam1/ramp.h +>> cam1/models/atm/cam/src/physics/cam1/ramp_scon.F90 +>> cam1/models/atm/cam/src/physics/cam1/ramp_so4_mod.F90 +>> cam1/models/atm/cam/src/physics/cam1/soxbnd.F90 +>> cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 +>> cam1/models/atm/cam/src/physics/cam1/volcanicmass.F90 +>> cam1/models/atm/cam/src/physics/cam1/volcrad.F90 +>> cam1/models/atm/cam/src/control/filenames.F90 +>> cam1/models/atm/cam/src/control/oznint.F90 +>> cam1/models/atm/cam/src/control/runtime_opts.F90 +>> cam1/models/atm/cam/src/control/so4bnd.F90 +>> cam1/models/atm/cam/src/ocnsice/dom/sst_data.F90 +>> cam1/models/atm/cam/src/ocnsice/som/somint.F90 +>> cam1/models/lnd/clm2/src/main/lp_coupling.F90 +>> +>> See below for details of changes. + + 2. Complete documentation of these changes in the code by comments. +>> DONE + + 3. On what machines did you successfully run test-model.pl? + a. blackforest +>> YES + b. chinook +>> YES + c. anchorage-lf95 +>> YES + + 4. For all of the runs in #3 above, which version of cam did you + compare to (which tag)? +>> cam2_0_2_dev61, using hand-tests since test-model does not support +>> "-compare" when namelist has changed. + + 5. If bitwise differences were observed, how did you prove they were no + worse than roundoff? +>> bit-for-bit + + 6. Does the CAM Users Guide need to be updated due to these changes? + (Possible reasons include changes to the namelist, history output, + configure script, build or run process, etc.) +>> Yes + If so, has the CAM Users Guide been updated in the CVS repository? +>> No + + +>> +>> Source: http://www.cgd.ucar.edu/cseg/plans/ipcc_plan2.txt 01/23/04 +>> +>> IPCC Features in CAM +>> +>> Requirements +>> . thoroughly tested +>> . releaseable, reproducible, community usable +>> . usable for 1990, 1870, historicals, future, paleo +>> (without changing source code, only namelist?) +>> . no hacks, no magic dates in code +>> . datasets available to support T85 resolution (T42?, T31?) +>> . implementation must be general, namelist and dataset must be +>> robust for the specified use cases below. that means making +>> sure that 1870-2000 datasets can be used robustly in the model +>> on Jan 1, 1870 and Jan 1, 2000, and that future datasets can +>> be used in the model robustly on Jan 1, 1990. +>> +>> ------------------------------- +>> +>> Present 1870 control run mods relative to 1990 controls +>> Add CAM namelists f11vmr, f12vmr, co2vmr, ch4vmr, n2ovmr +>> Add CAM namelist carscl=0.3 +>> Add CAM namelist sulscl=0.0 +>> +>> ------------------------------- +>> +>> Dust, Sea Salt +>> . seasonal cycle of monthly averages, data(x,y,z,12) +>> . dataset is resolution dependent, requires T42 and T85 datasets +>> . same datasets will be used for all runs +>> . can be scaled, scaling will always be 1 +>> . this has always been on +>> . file name AerosolMass* +>> . file also includes carbon which is also always on +>> Tasks +>> + Review dataset, verify supports all resolutions; T85, T42, T31, 2x2.5 +>> (Andrew, Bill, Jim R) +>> - Verify correct datasets in CAM scripts (Andrew, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana) +>> Namelist +>> bndtvaer +>> +>> Carbon +>> . carbon dataset is in same file as Dust, Sea Salt, same format (x,y,z,12) +>> . in file AerosolMass +>> . always on, carscl can scale, default 1.0 +>> . carscl=0.3 for 1870 run, continuous with pop dataset +>> . historical will be based on population dataset (t) +>> . time interpolation is flexible, can have varying dt in dataset +>> . dataset "easy to generate" +>> . endruns if date outside dataset +>> . dataset will cover 1870 to 2000 +>> . 2000 to 2300 constant carscl at 2000 (1.0) +>> . 1870 and future will use carscl, historical will use dataset +>> . "ramp year" namelist implementation is defered +>> Tasks +>> + Rename carbon_by_pop to scenario_carbon_scale, char string input +>> (Andrew) +>> + Rename bndtvpop to bndtvcarbonscale (Andrew) +>> + Generate a 1870-2000 dataset (Andrew) +>> + Verify carbon will call endrun if date is outside dataset boundaries +>> (Andrew) +>> - Verify correct datasets and namelist in CAM scripts (Andrew, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana) +>> Namelist +>> bndtvaer +>> carscl +>> scenario_carbon_scale (RAMPED, FIXED), ramped will turn on use of +>> dataset, fixed +>> means use carscl. +>> bndtvcarbonscale +>> +>> Solar +>> . normally a constant, namelist (scon) can override default +>> . can turn on ramping via scenario_scon +>> . ramping data is implemented as data statement and include file +>> . 1870-2000 dataset +>> . all runs with using ramping feature, 1870 will use rampyear_scon +>> set to 1870, future runs will use rampyear_scon set to "2005" +>> Tasks +>> - Create solar dataset, end solar cycle in middle of 11 year cycle +>> around 2005, verify dataset, (Lawrence, Caspar) +>> + Remove include file and data statement, add read of netcdf dataset (Tom) +>> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) +>> + Verify solar calls endrun if using ramped feature and date is outside +>> dataset range (Tom) +>> + Implement in source code ability to use new namelist convention +>> (bndtvscon) (Tom) +>> - Verify correct datasets and namelist in CAM scripts (Lawrence, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana, Lawrence) +>> - Verify functionality of scenario and rampYear via code review +>> or validation runs (Tom, Lawrence) +>> Namelist +>> scon (won't be used) +>> scenario_scon (RAMPED) +>> bndtvscon +>> rampYear_scon +>> +>> GHGs +>> . 5 tracers, f11, f12, co2, ch4, n2o +>> . normally a constant, namelist can override the constants +>> . can turn on ramping +>> . ramping data is implemented as data statement and include file, +>> . turns on some ghg chemistry, IPCC will use that feature, automatically +>> turned on when ramped feature is used +>> . future scenarios will be time varying +>> . Use scenario_ghg = RAMPED always +>> . set rampYear_ghg to 1870 for 1870 control +>> . there will be multiple datasets, 1870-2000 for historical, several +>> 1990 to future datasets. +>> . requires pcnst=pcnst+4 +>> Tasks +>> + Talk to Byron or Jeff about ghg chemistry (Bill) +>> + Generate 1870-2000 netcdf ghg dataset (Lawrence) +>> - Generate 1990-future netcdf ghg datasets (Lawrence, Gary) +>> + Remove include file and data statement, add a dataset (Tom) +>> + Verify ghg code calls endrun if year outside dataset for ramped +>> usage (Tom) +>> + Implement in source code ability to use new namelist convention +>> (bndtvghg) (Tom) +>> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) +>> - Verify correct datasets and namelist in CAM scripts (Lawrence, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana, Lawrence) +>> Namelist +>> f11vmr (won't be used) +>> f12vmr (won't be used) +>> co2vmr (won't be used) +>> ch4vmr (won't be used) +>> n2ovmr (won't be used) +>> scenario_ghg (RAMPED) +>> rampYear_ghg +>> bndtvghg +>> trace_gas +>> read_trace +>> +>> Volcanics +>> . one field, mvolc(x,y,z,t), 1 sample per month +>> . flexible time interpolation, won't handle years outside dataset bounds +>> . turned off by default +>> . should be on for historicals only, datafile for 1870-2000 +>> . will do spatial interpolation +>> Tasks +>> + Generate 1870-2000 dataset and review for historical runs, make +>> sure volcanics go to 0.0 at edges of dataset, make sure model +>> calls endrun if strat_volc=true and date is outside bounds of +>> dataset (Andrew, Caspar) +>> + Move datasets to inputdata and verify naming convention (Andrew) +>> - Verify correct datasets and namelist in CAM scripts (Andrew, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana) +>> Namelist +>> strat_volc = .true. +>> bndtvvolc = 'dataset' +>> +>> Sulfate +>> . three different tracers in three datasets, dms, oxidants, sox +>> . dms is f(x,y,t), seasonal cycle with 12 time samples +>> . oxidants is f(x,y,z,t) seasonal cycle with 12 time samples +>> . dms and oxidants are seasonally repeating, not a function of "year" +>> . sox(x,y,2,t) is 4 samples/year, varying over different years +>> . sox time interpolation works fine, no extrapolation currently +>> . dataset must be generated on CAM grid +>> . REQUIRES pcnst = pcnst+4 (not 3) +>> . historical and future will use ramped feature with time varying data +>> . 1870 run will use ramped feature with rampyear_prognostic_sulfur set to +>> 1870 +>> . some sort of huge(int) intrinsic value needs to be default for rampyear +>> Tasks +>> + Design new namelist, prescribed_sulfur and prognostic_sulfur +>> and usage/features (Bill, Andrew, Phil) +>> + Remove dead namelist, aero_sulfur, aero_feedback_sulfur, implement new +>> namelist and features (see below) (Andrew and Dani) +>> + Remove (3) old dataset namelist (dms_emis, oxid, sox_emis) and add +>> (3) new dataset namelists (see below) (Dani) +>> + Verify endrun is called if date outside sox datasets (Dani) +>> + Generate 1870-2000 sox dataset for T85 (Dani, Gary) +>> + Generate future datasets for sulfur (Dani, Lawrence, Gary) +>> + Move all datasets to inputdata and verify naming convention +>> (Andrew, Dani) +>> - Verify correct datasets and namelist in CAM scripts (Andrew, Dani, Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana) +>> Namelist +>> bndtvdms +>> bndtvoxid +>> bndtvsox +>> scenario_prescribed_sulfur (FIXED (DEFAULT), RAMPED) +>> rampyear_prescribed_sulfur +>> prescribed_sulfur (off, passive, direct (DEFAULT)) +>> scenario_prognostic_sulfur (FIXED (DEFAULT), RAMPED) +>> rampyear_prognostic_sulfur +>> prognostic_sulfur (off (DEFAULT), passive, direct) +>> +>> Ozone +>> . ozone function of (x,y,z,t) with seasonal cycle +>> . use T42 dataset with monthly data, 1870-2000, (850Mb) +>> . ozone dataset not CAM grid dependent, does space interpolation +>> . for 1870, use 1870 only dataset with cycling set to true +>> . for historical, use 1870-2000 with cycling set to false +>> . for future, use 2000 dataset with cycling set to true +>> . tropopause consistency issue +>> . defer namelist changes +>> Tasks +>> - Generate 1870-2000 monthly dataset on T42, spoof to 1870 (Lawrence) +>> - Generate 1870 and 2000 cycling datasets (Lawrence) +>> - Create, review, and validate datasets, dataset continuity between +>> 1870 cycling dataset, 1870-2000 dataset, 2000 cycling dataset (Lawrence) +>> - Move datasets to inputdata and verify naming convention (Lawrence, Tom) +>> - Verify correct datasets and namelist in CAM scripts (Tom) +>> + Implement changes to CCSM scripts as needed (Tony, Mariana) +>> Namelist +>> bndtvo +>> ozncyc +>> +>> ------------------------------- +>> +>> Tony will monitor overall task progress +>> Tom will collect code mods and CAM script mods and coordinate checkin +>> Tony will coordinate changes in CCSM scripts +>> +>> ------------------------------- +>> +>> Use Cases: +>> +>> 1990 control - runs out of the box without above turned on, +>> this is not the same as historical run at 1990 or 1990 control +>> done similar to 1870. use pcnst = 3 +>> +>> (no source code mods required to switch between 1870, 1990, +>> historical, future cases below, pcnst = 11 for all cases) +>> +>> 1870 control, pcnst = 11 in build, standard namelist plus, +>> X means not needed or current default inside model (included +>> for clarity) +>> +>> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc +>> X scenario_carbon_scale = 'FIXED' +>> carscl = 0.3 +>> X bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc +>> scenario_scon = 'RAMPED' +>> rampYear_scon = 1870 +>> bndtvscon = *.nc (1870-2005 dataset TBD) +>> scenario_ghg = 'RAMPED' +>> rampYear_ghg = 1870 +>> bndtvghg = ghg_1870_2100_c040122.nc +>> trace_gas = .true. +>> read_trace = .false. +>> X strat_volcanic = .false. +>> X bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc +>> bndtvdms = DMS_emissions_128x256_clim_c040122.nc +>> bndtvoxid = oxid_128x256_L26_clim_c040112.nc +>> bndtvsox = SOx_emissions_128x256_L2_c040109.nc +>> scenario_prescribed_sulfur = 'FIXED' +>> prescribed_sulfur = 'passive' +>> scenario_prognostic_sulfur = 'RAMPED' +>> rampYear_prognostic_sulfur = 1870 +>> prognostic_sulfur = 'direct' +>> X ozncyc = .true. +>> bndtvo = *.nc (1870 dataset) +>> +>> historical (1870-2000), hybrid startup at year 1870, run to 2000 +>> pcnst = 11 in build, set namelist as follows, X means not needed or +>> current default, * indicate changes from 1870 control +>> +>> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc +>> * scenario_carbon_scale = 'RAMPED' +>> *X carscl (remove) +>> bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc +>> scenario_scon = 'RAMPED' +>> *X rampYear_scon (remove) +>> bndtvscon = *.nc (1870-2005 dataset TBD) +>> scenario_ghg = 'RAMPED' +>> *X rampYear_ghg (remove) +>> bndtvghg = ghg_1870_2100_c040122.nc +>> trace_gas = .true. +>> * strat_volcanic = .true. +>> bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc +>> bndtvdms = DMS_emissions_128x256_clim_c040122.nc +>> bndtvoxid = oxid_128x256_L26_clim_c040112.nc +>> bndtvsox = SOx_emissions_128x256_L2_c040109.nc +>> scenario_prescribed_sulfur = 'FIXED' +>> prescribed_sulfur = 'passive' +>> scenario_prognostic_sulfur = 'RAMPED' +>> * rampYear_prognostic_sulfur = (remove) +>> prognostic_sulfur = 'direct' +>> * ozncyc = .false. +>> * bndtvo = *.nc (1870-2000 dataset TBD) +>> +>> future (1990-), hybrid startup at year 1990 from historical 1990, +>> pcnst = 11 in build, set namelist as follows, X means not needed or +>> current default, * indicate change from historical run +>> +>> bndtvaer = AerosolMass_V_128x256_clim_c031022.nc +>> *X scenario_carbon_scale = 'FIXED' +>> *X carscl = 1.0 +>> X bndtvcarbonscale = carbonscaling_1870-1999_c040114.nc +>> scenario_scon = 'RAMPED' +>> * rampYear_scon = 2005 +>> bndtvscon = *.nc (1870-2006 dataset TBD) +>> scenario_ghg = 'RAMPED' +>> X rampYear_ghg (remove) +>> * bndtvghg = *.nc (future dataset TBD) +>> trace_gas = .true. +>> *X strat_volcanic = .false. +>> X bndtvvolc = VolcanicMass_1870-1999_64x1_L18_c040115.nc +>> bndtvdms = DMS_emissions_128x256_clim_c040122.nc +>> bndtvoxid = oxid_128x256_L26_clim_c040112.nc +>> bndtvsox = SOX_T85_future +>> scenario_prescribed_sulfur = 'FIXED' +>> prescribed_sulfur = 'passive' +>> scenario_prognostic_sulfur = 'RAMPED' +>> prognostic_sulfur = 'direct' +>> *X ozncyc = .true. +>> * bndtvo = *.nc (2000 dataset TBD) +>> +>> --------------------------------- +>> +>> Available (and validated) Datasets: +>> +>> bndtvaer: (rad dir) +>> AerosolMass_V_128x256_clim_c031022.nc T85 +>> AerosolMass_V_64x128_clim_c031022.nc T42 +>> AerosolMass_V_48x96_clim_c031022.nc T31 +>> AerosolMass_V_2x2.5_clim_c031022.nc 2x2.5 +>> +>> bndtvdms: (scyc dir) +>> DMS_emissions_64x128_c030722.nc T42 +>> DMS_emissions_128x256_clim_c040122.nc T85 +>> +>> bndtvoxid: (scyc dir) +>> oxid_3d_64x128_L26_c030722.nc T42 +>> oxid_128x256_L26_clim_c040112.nc T85 +>> +>> bndtvsox: (scyc dir) +>> SOx_emissions_64x128_L2_c031219.nc T42 (1870+historical) +>> - T42 (A1) +>> - T42 (A2) +>> - T42 (B1) +>> - T42 (B2) +>> SOx_emissions_128x256_L2_c040109.nc T85 (1870+historical) +>> SOx_emissions_A1_128x256_L26_1990-2100_c030121.nc T85 (A1) +>> SOx_emissions_A2_128x256_L26_1990-2100_c030121.nc T85 (A2) +>> SOx_emissions_B1_128x256_L26_1990-2100_c030121.nc T85 (B1) +>> SOx_emissions_B2_128x256_L26_1990-2100_c030121.nc T85 (B2) +>> +>> bndtvo: (ozone dir) +>> pcmdio3.r8.64x1_L60_clim_c970515.nc (present day cycling +>> dataset) +>> - (1870 cycling) +>> - (1870-2000) +>> - (2000 cycling) +>> +>> bndtvvolc: (rad dir) +>> VolcanicMass_1870-1999_64x1_L18_c040115.nc (1870-2000 dataset) +>> +>> bndtvcarbonscale: (rad dir) +>> carbonscaling_1870-1999_c040114.nc (1870-2000 dataset) +>> +>> bndtvscon: (rad dir) +>> scon_1870_2100_c040122.nc (CAM default, do not +>> use) +>> - (1870-2006 dataset) +>> +>> bndtvghg: (ggas dir) +>> ghg_1870_2100_c040122.nc (CAM default, +>> 1870+historical) +>> - (A1) +>> - (A2) +>> - (B1) +>> - (B2) + +=============================================================== +=============================================================== + +cam2_0_2_dev61 +Originator: mirin ( Arthur Andrew Mirin) +Date: Wed Jan 14 11:51:56 MST 2004 +Model: CAM +Version: CAM2.0_2.dev61 +One-line Summary: Finite Volume and Transpose Improvements (2 of 2) +This is the second of two successive archive updates. The only changed +routine is dynamics/fv/geopk.F90. Due to reordering of computations, +there are roundoff differences. + +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer +Restart files change: no +Changes answers: Yes (same to roundoff for FV), EUL and SLD are bit-for-bit. +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +Reordering of computations in FV geopk.F90 causes roundoff changes. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev60 +Originator: mirin ( Arthur Andrew Mirin) +Date: Wed Jan 14 11:39:22 MST 2004 +Model: CAM +Version: CAM2.0_2.dev60 +One-line Summary: Finite Volume and transpose improvements (1 of 2) +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes +Mprun2d namelist no longer exists; relevant variables in CAMEXP namelist. +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer, Eaton +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +This is the first of two successive archive updates. These changes are +bit-fot-bit. + +Summary of changes: + +Removal of mprun2d namelist. This involved creating routines +spmd_dyn_defaultopts and spmd_dyn_setopts with optional arguments. I +mimicked the procedure in phys_grid.F90. In runtime_opts.F90 I put +"dycore_is" test around the calls, and I created dummy versions in +dynamics/eul and dynamics/sld. The initial dummy versions were just +subroutine and end statements, with no arguments. However, the code would +not compile; there were complaints about inaccessible routines and +needing explicit interfaces with optional arguments. I ended up putting +'public' declarations in the EUL and SLD versions and using the same +argument list as with the FV version. (I think the key problem was the +argument list more than the public declaration.) I know it is our +intention to have different versions (with different arguments) of these +routines for the different dycores, but that clearly didn't work; the +present solution is out of expediency. I suspect that the fact that the +arguments are optional is central to the problem. I used optional +arguments only because that is what was done in phys_grid.F90. Also, one +of the namelist variables (modcomm_method) will eventually apply outside +of FV once we use mod_comm transposes outside of FV, so it will +eventually have to be moved or replicated. + +Single coding path for 1-D and 2-D decompositions for FV dycore. TWOD_YZ +ifdef eliminated. The "xy" variables are always invoked (e.g., ptxy). The +twod_decomp variable now refers to whether or not transposes (versus +copies) are called to go between yz and xy decompositions; naturally +copies are relevant only for 1-D decomposition; for debugging purposes, +one can force transposes even with 1-D decomposition (see new namelist +variable force_2d). Also, there is a new FV runtime diagnostic (not +input) variable (called spmd_on) that indicates SPMD versus non-SPMD. + +Method for FV transposes now runtime rather than compile time (although +the choice between ordinary MPI and MPI-2 is still compile-time). For +ordinary MPI, the choice is between invoking temporary contiguous buffers +versus using MPI derived types. The relevant namelist variable is +modcomm_method (0 for contiguous buffers, 1 for derived types (default)). +MPI-2 presently has 4 options (0,1(default),2,3) (options 0,1,2 use +contiguous buffer at target; 0 is for contiguous source buffers; 1 is for +direct MPI_put's of contiguous segments, with threading over the +segments; 2 is for MPI derived types at the source with threading over +target; option 3 is for MPI derived types at source and target, with +threading over target; option 3 involves re-definition of windows and is +probably not optimal). For MPI-2, one specifies "USE_MPI2" precompile +flag when configuring. + +New configure option "-precomp ", where string is a non-empty +list of precompile flags to be placed in misc.h. For example, one can +specify "-precomp USE_MPI2" for MPI-2 mod_comm transposes. + +Option to use nested OpenMP constructs for FV dycore on IBM. This must be +specified at compile time using new configure option "-nested_omp"; this +has effect on misc.h and the Makefile. In sw_core.F90 and tp_core.F90 +(which are already threaded with respect to z), latitude loops are +threaded. The number of inner threads is the new namelist variable +"ompnest", which must divide evenly into the total number of threads; the +number of outer threads will be the total number of threads divided by +"ompnest". IBM's implementation is non-standard. + +Option to use mod_comm for dynamics/physics transposes when using +load-balanced chunking. In phys_grid.F90, the "alltoall" flag is replaced +by new namelist variable "phys_transpose" (1 for original alltoall +(default), 2 for Pat Worley's send_and_receive, 3 for mod_comm). Because +mod_comm is presently compiled and linked only for FV, the mod_comm +option is presently valid only for FV; it must be activated at compile +time with the MODCM_DP_TRANSPOSE if-def (use precomp option in +configure). + +Miscellaneous transpose improvements and code cleaning. + +Deletion of configure_fv.pl and script.m4. + +I also created the necessary surface data and aerosol files to support +the FV 0.5x0.625 resolution. The CAM and CLM default namelists were +updated accordingly. This required updating +tools/interpaerosols/REGRID.pl as well. + +***************************************************************** +With the removal of the TWOD_YZ if-def and mprun2d namelist, the +interactive configuration procedure no longer queries for the 2-D +decompositions, and test-model contains no references to 2-D +decompositions. The validity of 2-D decompositions is checked in +spmd_dyn.F90. To impart 2-D decompositions in test-model, one needs to +set the camexp namelist accordingly. A decision needs to be made on which +decompositions are to be used, and the necessary changes must be made in +the namelist specification. +***************************************************************** + +Changed files: + +utils/pilgrim: mod_comm.F90, mod_irreg.F90, parutilitiesmodule.F90 + +bld: CAM_config.pm, CAM_namelist.pm, CAM_run.pm, configure, Makefile, +DefaultCAMEXPNamelist.xml, DefaultCLMEXPNamelist.xml, +config_cache_defaults.xml, mprun2d.pm (deleted), configure_fv.pl +(deleted), script.m4 (deleted) + +test/system: CAM_test.pm, test-model.pl + +tools/interpaerosols: REGRID.pl + +src/physics/cam1: phys_grid.F90 + +src/control: cam.F90, history.F90, runtime_opts.F90 + +src/dynamics/fv: cd_core.F90, d2a3dijk.F90, d2a3dikj.F90, +dp_coupling.F90, dyn_grid.F90, dynamics_vars.F90, dynpkg.F90, geopk.F90, +pmgrid.F90, spmd_dyn.F90, stepon.F90, sw_core.F90, te_map.F90, +tp_core.F90, trac2d.F90, uv3s_update.F90 + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== +cam2_0_2_dev59 +Originator: mvertens ( Mariana Vertenstein) +Date: Thu Jan 8 13:52:37 MST 2004 +Model: CAM +Version: CAM2.0_2.dev59 +One-line Summary: updated clm code to clm3_deva_01 (vector version of clm) + Requires change in build system: no (see below) + ecosysdyn/ is no longer needed in clm Filepath (will not + trigger error if it is there) +Substantial timing or memory changes: Yes (describe) + 3-5% performance improvement should be obtained +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Forrest Hoffman, Dave Parks, Keith Oleson +Restart files change: yes (for clm) + Backwards compatilibity with older restart files have been incorporated +Changes answers: Yes (same-climate) +Changes to CLM land-model: Yes (see below) +Have you filled out the pre-check-in documentation as required by the CAM CRB? no, I plan to. +Changes made: +1) Updated the clm code to clm3_dev_01 (the vector version of clm). + Both offline and cam-clm stand-alone runs showed that the new code + resulted in the same climate. For the cam-clm validation diagnostic + results see: + http://www.cgd.ucar.edu/tss/clm/diagnostics/cam_clm2/cam202d39clm2d47a-cam202d39clm2d36a/sets.htm +2) Modified models/atm/cam/bld/configure to removed ecosysdyn/ from + the clm filepath. +=============================================================== +=============================================================== + +cam2_0_2_dev58 +Originator: aconley ( Andrew J. Conley) +Date: Wed Jan 7 13:53:42 MST 2004 +Model: CAM +Version: CAM2.0_2.dev58 +One-line Summary: added volcanic aerosols and population based carbonaceous aerosol scaling +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes (same-to-roundoff, same-physics) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? no, I plan to. +Changes made: +New documentation: +UG-20.html +UG-20a.html +UG-27.html +UG-45.html +table_of_contents.html + +addition of filenames for volcanic mass, new optics, and population data +as well as namelist variables for strat_volcanic and carbon_by_pop +filenames.F90 +DefaultCAMEXPNamelist.xml +camexp.pm +runtime_opts.F90 + +advnce.F90 initialization for volcanics and population + +aer_optics.F90 added volcanic optics +aerosols.F90 added massfields for volcanics +volcanicmass.F90 (new file) read, interpolate volcanic masses +radctl.F90 added diagnostics for volcanic masses and effects of volcanics + +radcswmx.F90 added volcanic mass shortwave effects + + +Added effects of volcanics +radclwmx.F90 +radae.F90 +trcab.F90 +trcabn.F90 +trcems.F90 +volcrad.F90 (new file) + +Population.F90 (new file) read population history and provide carbonaceous aerosol scaling factor based on population + +New data files +bndtvvolc: historical masses from volcanic eruptions +bndtvpop: estimates of global total population + +appended new volcanic shortwave optics to aeroptics + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev57 +Originator: mvr ( Mathew Rothstein) +Date: Fri Jan 2 12:03:34 MST 2004 +Model: CAM +Version: CAM2.0_2.dev57 +One-line Summary: Upgrade CSM share; Upgrade ESMF; Add namelist option brnch_retain_casename; Update ccsm_msg to remove chunks and knuhcs; caseid now length 80; Remove goto from aerosols.F90. +cam-bugs Requests resolved: none +Requires change in build system: yes +-references to directory csm_share now point to csm_share/shr +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux (Lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, tcraig, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +- Updated ESMF to ESMF0_0_4 +- Updated CSM_SHARE to share3_0_2 +- added function get_chunk_owner_p in src/physics/cam1/phys_grid.F90: returns + the owner of a chunk given the lat, lon +- modified bld/configure: references to directory csm_share now point to + csm_share/shr +- modified bld/configure_fv.pl: references to directory csm_share now point + to csm_share/shr +- modified src/control/ccsm_msg.F90: utilize new function get_chunk_owner_p + rather than vars chunks, knuhcs +- modified src/control/filenames.F90: modified length of caseid to 80 from 33; + now using shr_kind_cs and shr_kind_cl for strings of length 80 and 256; + defined new namelist var brnch_retain_casename +- modified src/control/restart.F90: modified var tcase to same length as + caseid (shr_kind_cs); implemented new namelist var brnch_retain_casename to + allow branch runs without a change in casename +- modified src/control/runtime_opts.F90: added var brnch_retain_casename to + namelist camexp +- modified src/physics/cam1/phys_grid.F90: added new function + get_chunk_owner_p +- modified src/physics/cam1/aerosols.F90: replaced "goto" statement with code + friendlier to compiler optimization +- updated users guide to reflect new namelist option + +=============================================================== +=============================================================== + +cam2_0_2_dev56 +Originator: rosinski ( Jim Rosinski) +Date: Mon Dec 29 15:35:44 MST 2003 +Model: CAM +Version: CAM2.0_2.dev56 +One-line Summary: Enable restarting coupled model from dev51 restart file. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes (done by mvertens) +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes (in coupled mode they now look like dev51 restart files) +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Modified coupled-mode CAM restart file to be identical to dev51. +o NOTE: Standalone and SOM restart files are NOT the same. + +=============================================================== +=============================================================== + +cam2_0_2_dev55 +Originator: jmccaa ( James McCaa) +Date: Mon Dec 22 14:11:07 MST 2003 +Model: CAM +Version: CAM2.0_2.dev55 +One-line Summary: Tuning mods for finite volume 2x2.5. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes - new-climate for FV +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +Model parameters have been adjusted for runs using the finite volume +dycore. Changes occurred in the following routines: +cldwat.F90 +cloud_fraction.F90 +gw_drag.F90 +vertical_diffusion.F90 +moistconvection.F90 +zm_conv.F90 + +The turbulence mountain stress parameterization is now turned off. Also, +the parameters governing gravity wave drag are now the same for FV as for +the spectral dycores. + +=============================================================== +=============================================================== + +cam2_0_2_dev54 +Originator: pworley ( Patrick H Worley) +Date: Thu Dec 18 09:27:25 MST 2003 +Model: CAM +Version: CAM2.0_2.dev54 +One-line Summary: Improved existing and added SMP-aware physics load balancing schemes +cam-bugs Requests resolved: none +Requires change in build system: maybe +To exploit alternative EUL and SLD latitude decomposition, need to add -DMIRROR_DECOMP to Makefile +Substantial timing or memory changes: Yes - benchmarks by Rory Kelley indicate that new opt=0 load balancing improves performance +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC cluster +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Tom Henderson +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +1) Added Henderson, et al's modification to call spmdinit_dyn after runtime_options, + so that future modifications can use namelist input to decide how to decompose + dynamics data structures. + added: control/decompinit.F90 + modified: control/cam.F90, control/spmdinit.F90 +2) Added Henderson, et al's modification to move duplicate code (ceil_2, pair) + to a new spmd_util module. + added: control/spmd_utils.F90 + modified: dynamics/eul - realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 + dynamics/sld - realloc4.F90, realloc7.F90, scan2.F90, spmd_dyn.F90 + physics/cam1 - phys_grid.F90 +3) Determined number of SMPs and process/SMP map. For EUL and SLD, equidistributed extra + latitudes (when mod(NLAT/npes) /= 0) over the SMPs. (This is useful when using option 1 + load balancing. See below.) + modified: control/spmdinit.F90, dynamics/eul/spmd_dyn.F90, dynamics/sld/spmd_dyn.F90, + dynamics/fv/spmd_dyn.F90 +4) For EUL and SLD, added an option to assign latitudes to processes so that southern + hemisphere latitudes and their "mirrors" in the northern hemisphere are assigned + to consecutive processes. This is useful when using load balancing options 1 and 3 (see below). + Currently, this is a compile time option. It will be changed to a runtime option + in the near future. To enable now, the CPP token MIRROR_DECOMP must be added to the + FPPFLAGS in the Makefile. + modified: dynamics/eul - spmd_dyn.F90, bndexch.F90; dynamics/sld - spmd_dyn.F90, bndexch.F90 +5) Redesigned load balancing options and implementation. The new options are + -1: each latitude line is a single chunk, same as 1D dynamics decompositions. + (UNCHANGED) + 0: split local longitude/latitude blocks into chunks, + while attempting to create load-balanced chunks. + (IMPROVED) + 1: split SMP-local longitude/latitude blocks into chunks, + while attempting to create load-balanced chunks. + (NEW) + 2: load balance chunks with respect to diurnal and + seaonsal cycles and wth respect to latitude, + and assign chunks to processor + in a way that attempts to minimize communication costs + (UNCHANGED) + 3: load balance chunks with respect to diurnal and + seasonal cycles (but not latitude), and assign chunks to + processor in a way that attempts to minimize communication + costs + (NEW) + + The implementation was significantly modified. The heuristic for + load balancing is now identical for options 0-3. The only difference + between the options is which processes are allowed to communicate + when load balancing.` + + Performance comparisons on the IBM indicate that the new option 0 is an improvement + over the old option 0. The other options (especially option 3) are now + competitive with option 0, but are not noticeably better. These results are for T85L26 + on 128 processors of Bluesky, and different results may hold on other systems or + for other problem sizes. + + modified: physics/cam1/phys_grid.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev53 +Originator: hender ( Tom Henderson) +Date: Mon Dec 15 11:55:00 MST 2003 +Model: CAM +Version: CAM2.0_2.dev53 +One-line Summary: Improve and extend prototype of new run-time options module. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, anchorage-lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton. Design reviewed by Eaton and Rosinski +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: +Files removed: +models/atm/cam/src/control/comhd.h +models/atm/cam/src/control/parse_namelist.F90 +models/atm/cam/src/control/preset.F90 + +Files added: +models/atm/cam/src/control/comhd.F90 +models/atm/cam/src/control/runtime_opts.F90 + +Files Modified: +models/atm/cam/src/dynamics/eul/courlim.F90 +models/atm/cam/src/dynamics/eul/grcalc.F90 +models/atm/cam/src/dynamics/eul/hdinti.F90 +models/atm/cam/src/dynamics/eul/hordif.F90 +models/atm/cam/src/dynamics/eul/spegrd.F90 +models/atm/cam/src/dynamics/sld/courlim.F90 +models/atm/cam/src/dynamics/sld/grcalc.F90 +models/atm/cam/src/dynamics/sld/hdinti.F90 +models/atm/cam/src/dynamics/sld/hordif.F90 +models/atm/cam/src/dynamics/sld/spegrd.F90 +models/atm/cam/src/physics/cam1/aerosol_intr.F90 +models/atm/cam/src/physics/cam1/phys_grid.F90 +models/atm/cam/src/control/cam.F90 +models/atm/cam/src/control/history.F90 + + + +=============================================================== +=============================================================== + +cam2_0_2_dev52 +Originator: rosinski ( Jim Rosinski) and John Truesdale +Date: Fri Dec 12 15:56:44 MST 2003 +Model: CAM +Version: CAM2.0_2.dev52 +One-line Summary: Improve handling of surface fractions, especially in coupled mode (SOM and CCSM) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Rosinski, Truesdale +Restart files change: yes +Changes answers: no (bit-for-bit) except SOM which is roundoff. There is a #define in somoce.F90 + that if defined will make SOM bfb. If the "puny" criterion of ice_srf.F90 is + ever met (aice <= puny = 1.e-12) then there is a possibility that prescribed-ice + mode could be good only to roundoff, but we were unable to generate such a case. +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Install a more permanent fix to erroneous surface fraction calculations +than the quick fix of dev50. The original bug which dev50 addressed was that +surface fractions were being changed in an incorrect way by calls to +update_srf_fractions in coupled mode (both SOM and CCSM). At various points +during a timestep, variable ICEFRAC contained either ice fraction of the grid +box or ice fraction of the non-land portion of the grid box. Routine +update_srf_fractions implicity assumed it was being called to convert a +non-land fraction into a grid box fraction. In coupled mode, +update_srf_fractions was being called by ccsmrcv every timestep after +receiving surface fraction information from the coupler. Since ICEFRAC held +ice fraction of the grid box at this point, an erroneous calculation thus +resulted. The dev50 quick fix was to install ifdefs around the ICEFRAC +recomputation in update_srf_fractions. In the more permanent fix, array AICE +always represents ice fraction of the non-land portion of the grid box, and +ICEFRAC always represents the ice fraction of the entire grid box. + +The updating of surface fractions and verifying their validity is now +segregated into two subroutines, comsrf.F90 routines update_ocnice and +verify_fractions, respectively. ccsm_msg.F90 routines ccsmrcv and +ccsm_msg_getalb now call verify_fractions, instead of a routine which will +actually change the surface fractions. If update_ocnice is ever called in +coupled mode it will result in an endrun() call. Instead, ccsmrcv and +ccsm_msg_getalb now contain explicit code to compute new fractions +(correctly) rather than make calls to update_ocnice. This resetting should +be unnecessary, but was retained to obtain bit-for-bit reproducibility with +earlier libraries and to avoid concerns about restartability. We believe the +calls to update_srf_fractions were originally installed to address bizarre +restartability issues in the coupled model. Ultimately the recomputation of +fractional information (especially landfrac every timestep) should be removed +from these routines. These spots are currently delimited with "bit-for-bit" +comments. + +For further details see details on the CAM checkin list. +=============================================================== +=============================================================== + +cam2_0_2_dev51 +Originator: mvr ( Mathew Rothstein) +Date: Mon Dec 8 11:29:27 MST 2003 +Model: CAM +Version: CAM2.0_2.dev51 +One-line Summary: add -Q to Makefile for IBM, added XLSMPOPTS back into run-ibm.csh +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, hender +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + +>> Makefile: +>> Add "-Q" for ~1% speedup. +>> +>> run-ibm.csh: +>> Add XLSMPOPTS do avoid thread-stack limits that cause seg-fault when +>> prognostic sulfates, carbon, sea salt, and dust are all turned on. +>> +>> ## suggestion from Jim Edwards to reintroduce XLSMPOPTS on 11/13/03 +>> setenv XLSMPOPTS "stack=256000000" + +=============================================================== +=============================================================== + +cam2_0_2_dev50 +Originator: jmccaa ( James Mccaa) +Date: Wed Dec 3 15:35:26 MST 2003 +Model: CAM +Version: CAM2.0_2.dev50 +One-line Summary: Small change to prevent CAM from incorrectly modifying sea ice fractions in SOM/CCSM mode. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +A small change was made to comsrf.F90 to prevent CAM from incorrectly +modifying sea ice fractions in SOM/CCSM mode. This corrects an error +introduced in dev47, and therefore the tags dev47, dev48, and dev49 +should not be used for SOM or CCSM runs. + +=============================================================== +=============================================================== + +cam2_0_2_dev49 +Originator: hender ( Tom Henderson) +Date: Tue Nov 18 12:26:08 MST 2003 +Model: CAM +Version: CAM2.0_2.dev49 +One-line Summary: New T85 surface data set with pre-computed fields, fixed SST data sets at T85 and T170, T85 tuning. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +- Modified DefaultCLMEXPNamelist.xml to point to new T85 surface data set from + Jim McCaa. This data set contains pre-computed surface fields and cuts more + than 10 minutes off of T85 initialization. + +- Modified DefaultCAMEXPNamelist.xml to point to new climatological sst files + for T85 and T170 from Jim McCaa. + Details from Jim McCaa: + On Fri, 31 Oct 2003, Jim McCaa wrote: +> These two files are intended to replace broken climatological sst files for +> T85 and T170, respectively, in /fs/cgd/csm/inputdata/atm/cam2/sst. +> +> /fs/cgd/data0/jmccaa/sst_HadOIBl_bc_128x256_clim_c031031.nc +> /fs/cgd/data0/jmccaa/sst_HadOIBl_bc_256x512_clim_c031031.nc +> +> +> The defaults xml file should be updated to point to these new files, +> replacing> any entries pointing to either of +> /fs/cgd/csm/inputdata/atm/cam2/sst/sst_HadOIBl_bc_128x256_clim_c020812.nc +> /fs/cgd/csm/inputdata/atm/cam2/sst/sst_HadOIBl_bc_256x512_clim_c020812.nc +> +> This will primarily affect anyone trying to run Jim R.'s defineqflux +> program, +> i.e. anyone trying to set up a T85 or T170 SOM run. +> +> I produces these new files using the old ones and the command: +> ncks -d time,0,11 + +- T85 tuning in cloud_fraction.F90 from Jim McCaa: +49c49 +< rhminl = .92 +--- +> rhminl = .91 + + +=============================================================== +=============================================================== + +cam2_0_2_dev48 +Originator: rosinski ( Jim Rosinski) +Date: Tue Nov 11 09:12:51 MST 2003 +Model: CAM +Version: CAM2_0_2_dev48 +One-line Summary: Save memory in aerosol code by holding in-core only 2 time levels of data. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes. per MPI task memory saved @ T42 = 190 MB/ntask +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit), except only roundoff under PC/pgf90 +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Revised aerosol reading to be like SST and ozone, keeping in-core only 2 + time levels of data to save memory. Initialization should speed up lots, + since 2 time levels of aerosol data are read in instead of 12. + + It is now feasible from a memory use standpoint to run T85 using 2 MPI + tasks on a machine with 2 GB of memory. + + BYPASS ifdef was removed since the speedup renders it unnecessary. + + Minor mods were made to sst and ozone interpolation routines for clarity + and consistency. + + There are still some differences between the new code and ozone/SST + handling. There is no "aercyc = .false." namelist option. Date info is + gotten from an internal Fortran "data" statement rather than read from a + boundary dataset. Existing routine "aerosol_initialize" takes the role of + what otherwise would be called "aerini" (instead of being named like + "sstini" and "oznini"), and is called from "inti" instead of "initext". + There is a new routine "aerint" in aerosols.F90 a la "sstint" and "oznint" + which is called from "advnce". Like these routines it reads in a new time + slice of data when needed. But the actual time interpolation is done in + "get_aerosol". The reasons for these differences have mainly to do with + maintaining minimal intrusiveness, and the fact that there are plans + to modify the way time and vertical interpolation of aerosols is done. + + +=============================================================== +=============================================================== + +cam2_0_2_dev47 +Originator: jet ( John Truesdale) +Date: Wed Nov 5 15:41:05 MST 2003 +Model: CAM +Version: CAM2.0_2.dev47 +One-line Summary: cam usage of boundary dataset ice fraction made consistant with HADISST data. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no + +Substantial timing or memory changes: no +Requires change in run script: no + +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: yes. Ice extent is now reduced around land. + +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +After computing the ice area of the original datasets and comparing it to +the ice area produced by our t42 model, it became apparent that CAM was +over estimating the ice area. The ice fraction on the boundary dataset was +intrepreted as being the fraction of ice covering an entire gridbox. A more +accurate way of determining the ice coverage is to regard the boundary +dataset ice fraction as the fraction of ice covering the *non-land* portion +of the grid box. So + +gridbox ice fraction = boundary dataset ice fraction * (1-land fraction) + +The ice area produced by cam with this change is now very close to the +original datasets and to the ice area produced by CSM. The overall effect +is a reduction of ice coverage in those grid boxes with some land fraction. + +This change is a one line mod to comsrf.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev46 +Originator: pworley ( Patrick H Worley) +Date: Tue Nov 4 15:26:37 MST 2003 +Model: CAM +Version: CAM2.0_2.dev46 +One-line Summary: Decreased memory requirements in dynamics/eul/inidat and added new load balancing scheme to phys_grid (same as dev39). +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes - decreased number of full 3D fields needed in inidat from 9+(pcnst+pnats) to 4 +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Linux cluster +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes (same as dev39) +Changes made: + + The cam2_0_2_dev39 commit failed (on Sep. 29, 2003). This commit reintroduces those changes. + The following is identical to the dev39 documentation ... + + 1) restructured dynamics/eul/inidat.F90 to minimize the memory requirements. + In the original version, masterproc allocates (9+pcnst+pnats) 3D fields + and 16 2D fields. It then reads in or generates the initial data, + scatters the data, and finally deallocates the arrays. In the revised + version, subsets of arrays are allocated, initialized, scattered, and + deallocated together, decreasing the maximum memory requirements to 4 3D fields. + Note that I implemented the logic that Brian Eaton used in FV inidat (for WACCM) + to treat each species in q3 separately. + + 2) added a new load balancing algorithm in physics/cam1/phys_grid.F90. + The original global balancing algorithm (opt = 1) eliminates + imbalances due to the diurnal and seasonal cycles. However, it still + assigns all polar latitdues to the same processors, the mid-latitudes + to the same processors, and the equatorial latitudes to the same processors. + The new algorithm (opt = 2) mixes up the latitudes as well, achieving + almost perfect load balance. It comes at a cost of increased communication cost + compared to opt = 1, and may or may not be a performance enhancer for + a given system, problem size, and processor count. + + 3) added an option to physics/cam1/phys_grid.F90 to implement the transpose_block_to_chunk + and transpose_chunk_to_block routines using point-to-point MPI commands rather + than mpi_alltoallv. This has been important on some systems in the past, + and is included here as an aid to experimentation. This option is currently + disabled in the code. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev45 +Originator: hender ( Tom Henderson) +Date: Fri Oct 31 11:24:43 MST 2003 +Model: CAM +Version: CAM2.0_2.dev45 +One-line Summary: Performance optimization for IBM. +cam-bugs Requests resolved: none +Requires change in build system: yes +Fortran compiler optimization for IBM "xlf90" has changed from +"-O2 -qmaxmem=-1 -Q" to "-O3 -qstrict". The "-lmass" library is now +linked in unless DEBUG is on. +Substantial timing or memory changes: yes, it runs ~5% faster. +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Linux-lf95 +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Jim McCaa +Restart files change: no +Changes answers: Yes, same-physics +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Changed optimization in Makefile for IBM. +Changed "sanity checks" in pcond() (cldwat.F90) to make IBM compiler +happy (bfb). +Changed "rliq1 sanity check" in pcond() (cldwat.F90) to use Jim McCaa's +fix (bfb). + +=============================================================== +=============================================================== + +cam2_0_2_dev44 +Originator: jmccaa ( James McCaa) +Date: Fri Oct 31 09:48:06 MST 2003 +Model: CAM +Version: CAM2.0_2.dev44 +One-line Summary: T85 tuning, removal of many default history file fields, modification of dif4 initialization. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit at all resolutions except T85) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +This tag supplies three changes to the model: + +1) The tuning of the T85 Eulerian model has been modified through the + addition of the relative humidity cloud threshold ramp in + cloud_fraction.F90. Tuning parameters were also modified in + zm_conv.F90, moistconvection.F90, and cldwat.F90. + +2) The number of fields on the default monthly history files has been + reduced substantially. All fields continue to be available via the + fincl namelist facility. Also, default daily history files have + been eliminated. + +3) The initialization of the diffusion parameters dif4 and dif2 have + been moved out of build-namelist and into the model. The default + dif4 value for T85 has been modified. + +The files that were modified are: +>> M models/atm/cam/bld/DefaultCAMEXPNamelist.xml +>> M models/atm/cam/src/control/history.F90 +>> M models/atm/cam/src/control/preset.F90 +>> M models/atm/cam/src/dynamics/eul/dycore.F90 +>> M models/atm/cam/src/dynamics/sld/dycore.F90 +>> M models/atm/cam/src/physics/cam1/cldcond.F90 +>> M models/atm/cam/src/physics/cam1/cldwat.F90 +>> M models/atm/cam/src/physics/cam1/cloud_fraction.F90 +>> M models/atm/cam/src/physics/cam1/gw_drag.F90 +>> M models/atm/cam/src/physics/cam1/moistconvection.F90 +>> M models/atm/cam/src/physics/cam1/vertical_diffusion.F90 +>> M models/atm/cam/src/physics/cam1/zm_conv.F90 + +=============================================================== +=============================================================== + +cam2_0_2_dev43 +Originator: rosinski ( Jim Rosinski) +Date: Wed Oct 29 14:02:46 MST 2003 +Model: CAM +Version: CAM2.0_2.dev43 +One-line Summary: cos(lat) now applied to LANDM field offline. Since all IC files now require this + field (LANDM_COSLAT), new IC fields were generated. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes. Same-to-roundoff T42. Changes answers other resolutions (due to LANDM). +Changes to CLM land-model: None (except sfc datasets must be generated). +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Migrated multiplication of LANDM field by cos(lat) offline. One reason to do this was that +model-written IC files were invalid, due to erroneous multiple applications of the above-mentioned +cosine function. Also, for horizontal resolutions other than T42 there was an undesirable +resolution-dependent behavior of the LANDM specification algorithm. In the new approach, +linear interpolation to the target resolution is done from a "master" LANDM dataset, which was +built at T42 (per pjr). The resulting LANDM_COSLAT field now looks similar regardless of resolution. + +The "master" LANDM_COSLAT dataset lives in /fs/cgd/csm/inputdata/atm/cam2/hrtopo/landm_coslat.nc +It is read in by offline tool "definesurf", which has been modified to read it. + +Since new IC files are now required for all resolutions, it was decided to introduce consistency +to these files by using the newest 10-minute hi-res topography dataset when creating them. The +newest topography file is /fs/cgd/csm/inputdata/atm/cam2/hrtopo/topo10min.merged_c030506.nc +As a consequence of using this new file, existing resolution-specific surface datasets and IC +files for CLM also are invalid. Thus for many resolutions (though not T42), CLM must be spun +up for any runs done with cam2.0.2.dev43 and beyond. These changes are reflected in the xml +files which are used to build CAM and CLM namelists. + +=============================================================== +=============================================================== + +cam2_0_2_dev42 +Originator: rosinski ( Jim Rosinski) +Date: Tue Oct 28 16:02:07 MST 2003 +Model: CAM +Version: CAM2.0_2.dev42 +One-line Summary: Eliminate global TS print from physpkg and other minor speedups. + Add T85 and 2x2.5 aerosol datasets to xml file. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Minor speedup (see below). +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +o Eliminated global TS calculation and printout from physpkg. This code was left over +from long ago and the output is now more easily obtainable by other means. Minor speedup. + +o Moved calculation of tsice_rad to threaded region. Minor speedup on IBM, potentially +more significant when OMP_NUM_THREADS is a larger number (e.g. SGI). Unfortunately this +calculation is needed to create v2 IC files so it cannot be eliminated entirely. But it is +only needed when an IC file is generated, not every timestep. So further speedup is +possible. + +o Made srfflx_state_reset callable by chunk to enable fusing threaded loops. + +o Added reference to T85 and 2x2.5 aerosol datasets to CAM namelist xml file. + +=============================================================== +=============================================================== + +cam2_0_2_dev41 +Originator: jmccaa ( James Mccaa) +Date: Thu Oct 23 15:54:52 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev41 +One-line Summary: Climate tuning mods for T42 and T85. + +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes, new-climate +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Modifications have been made to allow the code to run using different +physics tuning parameters for different dycores and resolutions. +The values of these parameters have been adjusted following numerous +sensitivity experiments. + +The file cldfrc.F90 has been converted to a module named cloud_fraction.F90, and +an initialization routine has been added. +The files closure.F90, guang.h, and q1q2.F90 have merged into zm_conv.F90. +Minor code modifications have been made to allow greater optimization levels on +the IBM. + +Changed files: +>> M models/atm/cam/src/advection/slt/hordif1.F90 +>> M models/atm/cam/src/control/cam.F90 +>> M models/atm/cam/src/control/history.F90 +>> M models/atm/cam/src/control/preset.F90 +>> M models/atm/cam/src/control/spmdinit.F90 +>> M models/atm/cam/src/dynamics/eul/dycore.F90 +>> M models/atm/cam/src/dynamics/fv/dycore.F90 +>> M models/atm/cam/src/dynamics/sld/dycore.F90 +>> M models/atm/cam/src/physics/cam1/cldnrh.F90 +>> M models/atm/cam/src/physics/cam1/cldwat.F90 +>> M models/atm/cam/src/physics/cam1/geopotential.F90 +>> M models/atm/cam/src/physics/cam1/inti.F90 +>> M models/atm/cam/src/physics/cam1/moistconvection.F90 +>> M models/atm/cam/src/physics/cam1/pkg_cld_sediment.F90 +>> M models/atm/cam/src/physics/cam1/radae.F90 +>> M models/atm/cam/src/physics/cam1/sulchem.F90 +>> M models/atm/cam/src/physics/cam1/tphysbc.F90 +>> M models/atm/cam/src/physics/cam1/zm_conv.F90 +>> M models/csm_share/shr_vmath_mod.F90 + +Removed files: +>> R models/atm/cam/src/physics/cam1/cldfrc.F90 +>> R models/atm/cam/src/physics/cam1/closure.F90 +>> R models/atm/cam/src/physics/cam1/guang.h +>> R models/atm/cam/src/physics/cam1/q1q2.F90 + +Added files: +>> A models/atm/cam/src/physics/cam1/cloud_fraction.F90 + +=============================================================== +=============================================================== + +cam2_0_2_dev40 +Originator: rosinski ( Jim Rosinski) +Date: Wed Oct 22 16:54:16 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev40 +One-line Summary: Move horizontal aerosol interpolation offline. Modify print_memusage for readability and portability. +cam-bugs Requests resolved: none +Requires change in build system: yes: resolution-specific aerosol dataset required +Substantial timing or memory changes: yes: faster, uses less memory +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Andrew Conley +Restart files change: no +Changes answers: Yes (same-to-roundoff) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + +Changes made: + +o Moved horizontal aerosol interpolation to CAM grid offline. The main reason for +this was to speed up initialization and reduce memory usage when running CAM. At T42 +using 2 MPI tasks, the memory hi-water mark for MPI task 0 is reduced by about 50%. +Memory reduction for MPI task 1 is around 20%. + +Since the boundary aerosol dataset is now resolution-specific, the amount of speedup vs. +dev39 will be resolution-dependent, with lower resolutions seeing the biggest benefit. +There will also be some speedup during the time-integration phase due to reordering loops +and array structure for cache efficiency in aerosol routine vert_interpolate. Since +the aerosol initialization code still reads a full 12 months of data, the startup time +overhead and memory overheads are not insignificant. We may want to further restructure +the code to read in aerosols the same way as SST and Ozone, keeping just 2 bounding +months of data in-core at any given time. In the meantime, if time spent reading +the aerosol boundary data still proves to be an annoyance, things can be sped up dramatically +if the aerosol dataset is made local rather than read from an NFS-mounted file system. +Alternatively, #define BYPASS is still available from earlier libs. + +The new boundary dataset generation code lives in cam/tools/interpaerosols. A +README in that directory explains the procedure to generate an aerosol boundary +dataset at the target model resolution. Resolution-specific aerosol datasets have +already been created for resolutions needed by test-model, and some other common +resolutions. + +Mods were also made to the main CAM Makefile. LAPACK/BLAS routines are only used by the +aerosol initialization procedure, so library references to these routines now only +exist in the offline code. + + +o Rewrote utility routine print_memusage for readability of output and portability. It now +works on Linux as well as SGI and IBM. The point of the routine is to print +memory use information at whatever point in the code the user wishes. On most machines +the numbers printed refer to hi-water mark, but on Linux they refer to current use (i.e. +on Linux the numbers do not necessarily increase monotonically with time). Also on +most machines, the printed numbers refer to KB of memory used. But this is not necessarily +true on all machines (e.g. Linux). Refer to "man getrusage" on most machines, and "man proc" +on Linux machines for details. The output from print_memusage now goes to Fortran unit 0, +which in most cases translates to stderr. So memory use information can be segregated from +stdout by for example: (cam < namelist >! out) >&! err. This code is far from perfect, e.g. +printed output can still be jumbled between MPI tasks. + + +Misc. notes: + +o To get bit for bit vs. dev39, created a 64-bit aerosol dataset, pasted lon and lat +coordinate variables from a dev39 run into the input/output file required by interpaerosols. +Under pgf90 this is bfb. Unfortunately this procedure did not yield bfb results on IBM or SGI. + +o Input aerosol dataset variable names and output history variable names are as before, but +with an "_V" appended to their name. This reflects the fact that these variables have +undergone a vertical sum. The different names will also cause the model to crash if an +incorrect boundary dataset is used. + +=============================================================== +=============================================================== + +cam2_0_2_dev39 +Originator: pworley ( Patrick H Worley) +Date: Mon Sep 29 13:44:01 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev39 +One-line Summary: Decreased memory requirements in dynamics/eul/inidat and added new load balancing scheme to phys_grid. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes - decreased number of full 3D fields needed in inidat from 9+(pcnst+pnats) to 4 +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux cluster +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + + 1) restructured dynamics/eul/inidat.F90 to minimize the memory requirements. + In the original version, masterproc allocates (9+pcnst+pnats) 3D fields + and 16 2D fields. It then reads in or generates the initial data, + scatters the data, and finally deallocates the arrays. In the revised + version, subsets of arrays are allocated, initialized, scattered, and + deallocated together, decreasing the maximum memory requirements to 4 3D fields. + Note that I implemented the logic that Brian Easton used in FV inidat (for WACCM) + to treat each species in q3 separately. + + 2) added a new load balancing algorithm in physics/cam1/phys_grid.F90. + The original global balancing algorithm (opt = 1) eliminates + imbalances due to the diurnal and seasonal cycles. However, it still + assigns all polar latitdues to the same processors, the mid-latitudes + to the same processors, and the equatorial latitudes to the same processors. + The new algorithm (opt = 2) mixes up the latitudes as well, achieving + almost perfect load balance. It comes at a cost of increased communication cost + compared to opt = 1, and may or may not be a performance enhancer for + a given system, problem size, and processor count. + + 3) added an option to physics/cam1/phys_grid.F90 to implement the transpose_block_to_chunk + and transpose_chunk_to_block routines using point-to-point MPI commands rather + than mpi_alltoallv. This has been important on some systems in the past, + and is included here as an aid to experimentation. This option is currently + disabled in the code. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev38 +Originator: hender ( Tom Henderson) +Date: Mon Sep 22 11:46:03 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev38 +One-line Summary: Bug fix for prognostic aerosols, SE improvements. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux-lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Phil Rasch, Brian Eaton, Erik Kluzek +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Fixed bugs and added namelist variables to control prognostic aerosols. +(Bug fix for prognostic aerosols was provided by Phil Rasch.) +Improved design of parse_namelist(), prototype implementation is included +subject to review. So far design and implementation have been reviewed +only by Brian Eaton and Erik Kluzek. +Brought physics performance tuning parameters out to CAMEXP namelist. + +New namelist variables are: + +PHYSICS CONTROLS + +AERO_SULFUR +Type: Logical +Default: .FALSE. +Description: If true, turn on sulfur prognostic aerosols. + +AERO_FEEDBACK_SULFUR +Type: Logical +Default: .FALSE. +Description: If true, turn on feedback of sulfur prognostic aerosols. May +only be true if AERO_SULFUR is also true. + +AERO_CARBON +Type: Logical +Default: .FALSE. +Description: If true, turn on carbon prognostic aerosols. + +AERO_FEEDBACK_CARBON +Type: Logical +Default: .FALSE. +Description: If true, turn on feedback of carbon prognostic aerosols. May +only be true if AERO_CARBON is also true. + +AERO_SEA_SALT +Type: Logical +Default: .FALSE. +Description: If true, turn on sea salt prognostic aerosols. + +AERO_FEEDBACK_SEA_SALT +Type: Logical +Default: .FALSE. +Description: If true, turn on feedback of sea salt prognostic aerosols. May +only be true if AERO_SEA_SALT is also true. + + +PERFORMANCE TUNING + +PHYS_LOADBALANCE +Type: Integer +Default: 0 +Description: Select different options for organization of physics chunks. +Each uses a different scheme for static load balancing. + +PHYS_CHNK_PER_THD +Type: Integer +Default: 1 +Description: Select target number of chunks per thread. Must be positive + + +CHANGED FILES: + cam1/models/atm/cam/doc/UsersGuide/UG-20.html + cam1/models/atm/cam/src/dynamics/eul/inidat.F90 + cam1/models/atm/cam/src/dynamics/sld/inidat.F90 + cam1/models/atm/cam/src/dynamics/fv/inidat.F90 + cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 + cam1/models/atm/cam/src/physics/cam1/carbon_intr.F90 + cam1/models/atm/cam/src/physics/cam1/dust_intr.F90 + cam1/models/atm/cam/src/physics/cam1/phys_grid.F90 + cam1/models/atm/cam/src/physics/cam1/radctl.F90 + cam1/models/atm/cam/src/physics/cam1/seasalt_intr.F90 + cam1/models/atm/cam/src/physics/cam1/sulchem.F90 + cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 + cam1/models/atm/cam/src/physics/cam1/wetdep.F90 + cam1/models/atm/cam/src/control/cam.F90 + cam1/models/atm/cam/src/control/comhd.h + cam1/models/atm/cam/src/control/parse_namelist.F90 + + + +=============================================================== +=============================================================== + +cam2_0_2_dev37 +Originator: mirin ( Arthur Andrew Mirin) +Date: Wed Sep 17 16:30:30 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev37 +One-line Summary: Transpose and other FV improvements +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: no (unless test_model did that) +Code reviewed by: myself, Will Sawyer +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +This update accomplishes improvements to the finite-volume transposes and to +the FV dycore itself, as undertaken by Art Mirin and Will Sawyer. Specifically: + +(A) The irregular communication routines of the mod_comm library +have been placed in their own module (mod_irreg), to enable use of a unified +version of mod_comm in CAM2 and FVGCM (NASA Goddard). This facilitates making use +of ongoing improvements at Goddard (such as support for SHMEM). + +(B) The transpose calls directly reference mod_irreg routines as opposed to +going through the Pilgrim layer. This is true for use of mpi derived types as +well as contiguous buffers. Pilgrim's main function is to set up communication +patterns; mod_irreg then accomplishes the transposes. + +By default, the transposes gather/scatter data from/to contiguous buffers. We +have found mpi derived types to be very slightly superior on the IBM. +One can implement use of mpi derived types at compile time by activating the line +"FPPFLAGS += -WF,-DUSE_MPI_TYPES" in the AIX section of the Makefile. +Support for one-sided (MPI2) communications when using MPI derived types has not +yet been implemented. + +(C) There have been other miscellaneous improvements to Pilgrim / mod_comm. + +(D) The Held-Suarez, Rayleigh friction and high-pressure mode have been removed +from the FV dycore. + +(E) The FV version of inidat.F90 has been rewritten to minimize use of global 3D +arrays. + +(F) Additional sectional timing diagnostics have been added, as well as an additional +optional timing barrier in the physics. + +(G) There have been other miscellaneous improvements. + +The following routine was added: + cam1/models/utils/pilgrim/mod_irreg.F90 + +The following routines were deleted: + cam1/models/atm/cam/src/dynamics/fv: hswf.F90, highp2.F90, dry_adj.F90, rayl_fric.F90 + +The following routines were modified: + cam1/models/utils/pilgrim: Makefile, mod_comm.F90, parutilitiesmodule.F90 + cam1/models/atm/cam/bld/Makefile + cam1/models/atm/cam/src/physics/cam1/physpkg.F90 + cam1/models/atm/cam/src/dynamics/fv: cd_core.F90, d2a3dikj.F90, dp_coupling.F90, + dynamics_vars.F90, dynpkg.F90, geopk.F90, inidat.F90, inital.F90, mapz_module.F90, + p_d_adjust.F90, pft_module.F90, pmgrid.F90, restart_dynamics.F90, spmd_dyn.F90, + stepon.F90, te_map.F90, uv3s_update.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev36 +Originator: jmccaa ( James McCaa) +Date: Fri Sep 12 14:32:06 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev36 +One-line Summary: Merge of physics tuning branch onto cam_dev branch. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux cluster +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers:Yes -- new climate +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +The following changes apply to all dycores: +* The fall velocity of large (400 micron) ice crystals has been reduced + from 3.5 m/s to 1 m/s. +* There is a lapse-rate reduction of the SST used for stratus diagnosis + when the sea surface elevation is not 0. +* The temperature ramp used to compute the effective radius of warm + clouds over land now goes from -20 C to 0 C. +* The land fraction ramp over the ocean goes from cos(lat) near the + coast to 0 at 1000 km from the coast. +* The effective radius and CCN of warm clouds over land now depend + on snow depth (linear ramp from 0 to 0.1 m liquid water equivalent). +* The evaporative efficiency for rain falling from cumulus has been + lowered from 3.0e-6 to 2.0e-6. +* Formulae for cloud fraction associated with moist convection have + been changed. +* Adjustments have been made to the aerosol optics. + +The following modifications only apply to the finite volume dycore: +(They are in addition to the changes described above.) +* A new energy fixer has been added. +* The parameterization of gravity wave drag has been modified. +* A new parameterization of orographic form drag has been added. +* The Hack scheme now detrains cloud liquid. +* Evaporation efficiency for stratiform rain has been halved. +* Evaporation efficiency for convective rain has been halved. +* Formulae for cloud fraction associated with moist convection have + been changed. + +The following modififications have been made to keep the standalone +CAM consistent with recent coupled runs: +* The snow fraction on land as a function of snow depth has been + changed. +* Both visible and near-ir albedos of snow on sea ice have been + lowered by 0.02. +* Albedos of bare sea ice have been lowered by 0.10 for visible and + 0.06 for near-ir. + +There is one infrastructure change: +* ncar_batch.csh now overrides any previously set values of the environment + variables INC_NETCDF and LIB_NETCDF to point to 64 bit versions + +=============================================================== +=============================================================== +cam2_0_2_dev35 +Originator: mvertens ( Mariana Vertenstein) +Date: Wed Sep 10 10:37:47 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev35 +One-line Summary: fix clm bug that caused problems at very high mpi task number +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Forrest Hoffman +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + Fixed bug in clm code (lnd_grid.F90) that caused problems to occur at very + high mpi task number +=============================================================== +=============================================================== + +cam2_0_2_dev34 +Originator: hender ( Tom Henderson) +Date: Tue Sep 2 12:41:50 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev34 +One-line Summary: AIX 64-bit addressing and a bunch of other stuff +cam-bugs Requests resolved: 98, (127), 128 +Requires change in build system: AIX build now uses 64-bit addressing +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux-lf95 +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, contributors +Restart files change: no +Changes answers: Yes (same-to-roundoff for AIX, bfb for all others) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + Bunch-o-fixes II: + - Jim Edwards' performance fix for estblf + - wv_saturation.F90 + - change Makefile (etc.) to use 64-bit on AIX + - Modified Makefile, run-ibm.csh, CAM_lab.pm + - From Jim McCaa + The code already exists in history.F90, but is CPPed out. So, what I'm + requesting is to remove the two CPP lines, thereby enabling the code. + They are: + line 2501: #if ( defined CNTL_FORSOM ) + line 2506: #endif + This won't affect answers, but will add fields to the monthly history + tape. + - From John Truesdale: + In diagnostics.F90 the outfld call for TSICERAD needs to be removed (per + Jerry O.) In tphysbc.F90 the DQCOND outfld call needs to be removed + (duplicate of outfld call using dcconnam). + - Jim Rosinski kindly offered to add a summary message to cprnc indicating + how many fields were compared and how many passed bfb. + - only one file changed: + /fs/cgd/data0/rosinski/newcprnc/cam1/models/atm/cam/tools/cprnc/cpr.F + - Fixed bug in fv 2D decomposition (From Art Mirin) + - Changed dp_coupling.F90 for fv + - Fixed CAM bug #98 (originally reported by Woo Sun Yang) + - Francis Vitt (ACD) provided the bug fix for writing staggered 'US' grid + from history.F90. + - Attempted to remove undocumented Lahey compiler option from Makefile as + suggested by Jim Rosinski + "For some reason the default CAM Makefile includes an undocumented compiler + flag (-CcdRR8) when using lf95 on the PC. The documented flag --dbl used + to suffice for auto-promotion of real to real*8, and has been removed. + Does anyone know why this was changed? If not, I propose changing back to + the documented flag if identical answers can be obtained. Undocumented + flags are a bad idea all around, I think. + JR" + - Can't make this change because "--dbl" promotes real*4's too (which + will break MPI communications and history output). + - Corrected misleading comments about this in Makefile. + - Implemented Brian Eaton's fix for incorrect override of qmin from namelist + - Modified all three flavors of initcom.F90 + - Removed ccm366 physics from Default*Namelist.xml. + - Added new data file for Jerry Olson to DefaultCAMEXPNamelist.xml. + eul/ncdata_vers=2: cami_0000-09-01_64x128_L26_c030624.nc + sld/ncdata_vers=2: cami_0000-09-01_64x128_L26_c030624.nc + eul/ncdata_vers=1: cami_0000-09-01_64x128_L26_030506.nc + sld/ncdata_vers=1: cami_0000-09-01_64x128_L26_030506.nc + - Fix CAM bug #128 (fv build problems on Compaq and SGI) with bug fixes + from Tony Craig and Wei Yu. + - Modified cd_core.F90, and ccsm_msg.F90 (physpkg.F90 already fixed) + + dev34 is bfb vs. dev33 on non-AIX machines, but + roundoff on AIX machines. AIX perturbation growth of cam2_0_2_dev33 is + nearly identical to error growth of difference between cam2_0_2_dev33 and + cam2_0_2_dev34 for all three dycores. roundoff is entirely due to change + in AIX compiler options to use 64-bit addressing in Makefile and in cprnc + Makefile. This was tested by comparing dev33+(new Makefiles) vs. dev33 + (roundoff differences observed) and comparing dev34-(new Makefiles) vs. + dev33 (bfb exact). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== +cam2_0_2_dev33 +Originator: mvertens ( Mariana Vertenstein) +Date: Mon Aug 25 12:06:15 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev33 +One-line Summary: updated clm code from clm2_deva_30 to clm2_deva_36 +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes (new-physics (clm only) +Changes to CLM land-model: Yes +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +Only clm changes have been made in this tag. + +cam2_0_2_dev32 contains clm2_deva_30 (with some changes on the cam branch for dust +that are only invoked when the cpp variable DUST is defined). + +cam_0_2_dev33 contains clm2_deva_36 (which has incorporated the above dust mods). + +The following summarizes the changes between clm2_deva_30 and clm2_deva_36. +The changes that lead to greater than roundoff differences are denoted by (*). + + 1) Put in dust mods in cam2_0_2_dev32. +*2*) Put in bug fix to BareGroundFluxesMod.F90 so that z0hg and z0qg at the column + level would not be set by pft level quantities. This changes answers to more + than roundoff. + 3) Put in bug fix in Biogeophysics2Mod.F90 so that would not divide by + zero when calculating the ratio of soil evaporation for a pft relative + to the total of all evaporating PFTs. This would occur if the weight + became 0. in the dgvm calculation. This results in bfb answers in non-dgvm mode. + 4) Put in bug fix to BareGroundFluxesMod.F90 so that z0hg and z0qg at the column + level would not be set by pft level quantities. This changes answers to more + than roundoff. + 5) Put in bug fix in Biogeophysics2Mod.F90 so that would not divide by + zero when calculating the ratio of soil evaporation for a pft relative + to the total of all evaporating PFTs. This would occur if the weight + became 0. in the dgvm calculation. This results in bfb answers in non-dgvm mode. + 6) Put in a change to DGVMMod.F90 to fix a bug in history file output + in compete mode (the default now). +*7*) Reversion to old fraction snow cover algorithm (clm2_deva_32) + 8) Made clmtype variables relating to soil hydraulic and thermal properties + column physical state properties rather than land physical state properties + 9) Fixed DGVM restart problem in compete mode: + Modified restFileMod.F90 and DGVMMod.F90 so that average over all + column pfts for h2ocan (needed by begwb computation in routine + driver.F90) is done in restfileMod.F90 only for non-DGVM mode and in + resetWeightstDGVM (in module DGVMMod.F90) for DGVM mode (since this + needs to be done after the weights are reset in the DGVM case). + 10) Modified tssbef dimension in clmtype.F90 to be consistent. +=============================================================== + +=============================================================== + +cam2_0_2_dev32 +Originator: pworley ( Patrick H Worley) +Date: Tue Aug 19 20:38:06 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev32 +One-line Summary: Chunking data structures and optimizing interprocessor communication in ozone routines +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes (performance improves for large process counts) +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +The original version of oznini reads in two timelevels of ozone data +and saves them in masterproc. masterproc then interpolates the data to the +current timelevel and broadcasts the entire field to each process. +Each shortwave or longwave timestep, advnce calls oznint. +In oznint, masterproc again interpolates the ozone data +to the current timelevel and broadcasts the entire field to each process. +(Every month or so, oznint also reads a new timelevel of +ozone data into masterproc.) + +In the new version, oznini reads in the two timelevels, then distributes +both timelevels to all of the processes, so that they can do the interpolation +on their own. Moreover, the ozone data has been chunked, and each process +holds only the data that it needs for the columns that it is responsible for. +The performance impact is a significant decrease in the number of times +masterproc sends ozone data to the other processes, and a decrease in the +amount of data sent in each remaining communication. Routines modified were +comozp.F90, oznini.F90, oznint.F90, and radozn.F90, all in control/ . + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev31 +Originator: rosinski ( Jim Rosinski) +Date: Thu Aug 14 21:54:00 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev31 +One-line Summary: Bugfix from Natalie M. for sulfur fields. Consistent treatment of r4 vs. r8 in function calls +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +o Sulfur bugfix from Natalie M. addresses negative concentrations. +o Consistent treatment of constants as r8. + +=============================================================== +=============================================================== + +cam2_0_2_dev30 +Originator: pworley ( Patrick H Worley) +Date: Wed Aug 13 15:23:59 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev30 +One-line Summary: Replaced global spectral arrays and indices with local arrays in EUL dycore, to decrease memory requirements. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes:Yes (spectral memory requirements now decrease as number of MPI processes increase) +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux cluster +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: No (bit-for-bit) for SGI and Linux cluster, Yes (same-to-roundoff) for IBM +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +The primary goal of this update is to decrease the memory requirements +in the spectral Eulerian dycore by allocating space only for the +spectral coefficients that each processor is responsible for. While +we earlier decomposed the work, we have still been allocating the +full spectral arrays on each processor. This modification is important +for higher horizontal resolutions (T85, T170) as it decreases the memory +required for each process and may improve performance by improving memory +locality. To this end, the following files in dynamics/eul were modified: + +comspe, spmd_dyn, trunc, initcom, inital, dynpkg, grcalc, hordif, +quad, and tstep + +The routine spetru was also divided into 4 routines (in a new spetru module): +spetru_u., spetru_t, spetru_ps, and spetru_phis, spectrally truncating +the fields u and v, t, ps, and phis, respectively. The old spetru used +the global spectral arrays vz, d, t, and phis, which have been eliminated. +The new routines use at most a few single level global spectral arrays to +truncate the fields, again decreasing the required memory. + +Finally a few random changes were included in this update: + +Makefile - + Added -lcxml to the LDFLAGS for OSF, to link in DGETRF and DGETRS + on the Pittsburgh AlphaServer SC (needed by aerosols.F90) + +caerbnd.F90, dmsbnd.F90: + Moved declaration for ncol so that it appears before its use in + array declarations. (HP/Compaq compiler complained.) + +physpkg.F90: + Removed redundant USE of time_manager variables. (HP/Compaq compiler + complained.) + +carbon_intr.F90, seasalt_intr.F90 + Removed redundant USE of shr_const_mod variables. (HP/Compaq compiler + complained.) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev29 +Originator: aconley ( Andrew J. Conley) +Date: Thu Aug 7 10:25:49 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev29 +One-line Summary: linearly interp asym and ssa parameters, Do not extrap optics beyond rh = 1.0 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, chinooke, anchorage +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers:Yes new-physics ( < 10^-3 relative change in aerosol heating) + +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + Aerosol optics are no longer extrapolated beyond rh = 1.0. + Asymmetry and single scattering albedo are now linearly interpolated + in rh rather than exponentially interpolated. +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev28 +Originator: rosinski ( Jim Rosinski) +Date: Wed Aug 6 11:49:49 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev28 +One-line Summary: Back out nf90 interface from sulfur codes. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: + +o Backed out the Fortran 90 interface from sulfur codes per CRB. +o IMPORTANT NOTE: There is a reproducibility problem on the IBM when the sulfur routines are + enabled. This problems exists both in the previous library (2.0.2.dev27) and this commit. + Only the sulfur fields are affected, and the impact appears to be minor. The problem is + likely related to threading, since 1-day test runs on IBM machines with OMP_NUM_THREADS=1 + give reproducible answers. Threaded tests on chinook (SGI) were successful. Note that + test-model does not enable the sulfur routines, so results were bit-for-bit. + +=============================================================== +=============================================================== + +cam2_0_2_dev27 +Originator: hender ( Tom Henderson) +Date: Wed Jul 30 15:10:50 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev27 +One-line Summary: First cut at getting dust to work with physics chunking. +cam-bugs Requests resolved: none +Requires change in build system: no + +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, anchorage-lf95 +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Hacks for dust, see "#if (defined DUST)" +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: +Updated Natalie Mahowald's dust package (including her land model changes) to +work with PCOLS=16. It does not crash on anchorage but does crash on +blakcforest when cpp token DUST is defined (by default, dust, sulfates, +sea salt, and carbon packages are turned off via cpp tokens). MORE WORK NEEDS +TO BE DONE. + +This tag is identical to cam2_0_2_dev25_brnchT_paero7. + +Note that pgf90-pgcc and pgf90-gcc are known to fail because the Makefile has +not been updated to deal with the new F90 netcdf interfaces used in the new +code. The next tag should replace the F90 interfaces with the standard CAM +wrap_ncf() calls, if possible. + +=============================================================== +=============================================================== + +cam2_0_2_dev26 +Originator: hender ( Tom Henderson) +Date: Mon Jul 28 18:18:26 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev26 +One-line Summary: Added Phil Rasch's prognostic SOx aerosols. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux-lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + (If not abort this tag and follow the procedures in) + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: +Added prognostic aerosols. All four packages (sulfates, carbon, sea salt, and +dust) are independently #ifdef'd out in aerosol_intr.F90. Sulfates have +been tested with the other three off. Results are bfb with cam2_0_2_dev25 +when all four are off. Feedback to radiation is disabled in radctl.F90 (see +commented-out calls to set_aerosol_from_prognostics). + +Time constraints forced the choice of cpp and comments instead of namelist +variables... + +NEW FILES: +cam1/models/atm/cam/src/physics/cam1/acbnd.F90 +cam1/models/atm/cam/src/physics/cam1/acsf.F +cam1/models/atm/cam/src/physics/cam1/aerosol_intr.F90 +cam1/models/atm/cam/src/physics/cam1/caerbnd.F90 +cam1/models/atm/cam/src/physics/cam1/caer.F90 +cam1/models/atm/cam/src/physics/cam1/carbon_intr.F90 +cam1/models/atm/cam/src/physics/cam1/dmsbnd.F90 +cam1/models/atm/cam/src/physics/cam1/drydep_mod.F90 +cam1/models/atm/cam/src/physics/cam1/dust.F90 +cam1/models/atm/cam/src/physics/cam1/dust_intr.F90 +cam1/models/atm/cam/src/physics/cam1/dust_sediment_mod.F90 +cam1/models/atm/cam/src/physics/cam1/scyc.F90 +cam1/models/atm/cam/src/physics/cam1/seasalt_intr.F90 +cam1/models/atm/cam/src/physics/cam1/soxbnd.F90 +cam1/models/atm/cam/src/physics/cam1/sulbnd.F90 +cam1/models/atm/cam/src/physics/cam1/sulchem.F90 +cam1/models/atm/cam/src/physics/cam1/sulemis.F90 +cam1/models/atm/cam/src/physics/cam1/sulfur_intr.F90 +cam1/models/atm/cam/src/physics/cam1/surface.F +cam1/models/atm/cam/src/physics/cam1/volcemission.F +cam1/models/atm/cam/src/physics/cam1/wetdep.F90 + +CHANGED FILES: +cam1/models/atm/cam/doc/UsersGuide/UG-20.html +cam1/models/atm/cam/bld/DefaultCAMEXPNamelist.xml +cam1/models/atm/cam/bld/camexp.pm +cam1/models/atm/cam/bld/run-ibm.csh +cam1/models/atm/cam/bld/run-pc.csh +cam1/models/atm/cam/src/dynamics/eul/inidat.F90 +cam1/models/atm/cam/src/physics/cam1/advnce.F90 +cam1/models/atm/cam/src/physics/cam1/aerosols.F90 +cam1/models/atm/cam/src/physics/cam1/cldcond.F90 +cam1/models/atm/cam/src/physics/cam1/comsrf.F90 +cam1/models/atm/cam/src/physics/cam1/initindx.F90 +cam1/models/atm/cam/src/physics/cam1/inti.F90 +cam1/models/atm/cam/src/physics/cam1/physpkg.F90 +cam1/models/atm/cam/src/physics/cam1/radctl.F90 +cam1/models/atm/cam/src/physics/cam1/tphysac.F90 +cam1/models/atm/cam/src/physics/cam1/tphysbc.F90 +cam1/models/atm/cam/src/control/filenames.F90 +cam1/models/atm/cam/src/control/intp_util.F90 +cam1/models/atm/cam/src/control/parse_namelist.F90 +cam1/models/atm/cam/test/system/ncar_batch.csh + + +=============================================================== +=============================================================== + +cam2_0_2_dev25 +Originator: jmccaa ( James Mccaa) +Date: Thu Jul 17 15:38:48 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev25 +One-line Summary: Introduction of orographic form drag and modification of gravity wave drag routines. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, linux-lf95, linux-pgf90 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes, new-physics +Changes to CLM land-model: None (one-line description) +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Modified three files: +models/atm/cam/src/physics/cam1/gw_drag.F90 +models/atm/cam/src/physics/cam1/tphysac.F90 +models/atm/cam/src/physics/cam1/vertical_diffusion.F90 + +Introduced orographic form drag in vertical_diffusion module. +Modified gravity wave drag in gw_drag module. +These changes necessitated changes to the interfaces in tphysac. + +Form drag and the new gravity wave drag algorithm are implemented only +when using the finite volume dycore. However, for the spectral dycores +the gravity wave algorithm was changed to disallow the formation of +gravity waves over pure ocean points with non-zero orographic standard +deviation. + +==================================================== +==================================================== + +cam2_0_2_dev24 +Originator: eaton ( Brian Eaton) +Date: Fri Jul 11 12:48:54 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev24 +One-line Summary: dycore independent energy fixer, only active for FV +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, pc-lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: roundoff changes in spectral dycores, fv has new physics +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Reinsert changes made at cam2_0_2_dev21 (dycore independent energy fixer active +for fv only). + +Fix bad error growth (add PERGRO condition in cldfrc.F90) + +Fix namelist problem for 64x128 sld (new dataset in DefaultCAMEXPNamelist.xml). + + +=============================================================== +=============================================================== + +cam2_0_2_dev23 +Originator: hender ( Tom Henderson) +Date: Sat Jun 21 09:41:17 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev23 +One-line Summary: Fixes for coupled runs, removal of CCM366 and LSM, other minor fixes. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Intel-Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Tony Craig, Art Mirin, and a cast of thousands +Restart files change: no +Changes answers: no (bfb with dev22) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + - Bug fix #122. (outfld calls from Jerry Olson's commit) + Modified routine diag_surf() in diagnostics.F90 so fields TSICE + and TSICE_RAD are excluded from the history files during a coupled + run. + - bugfix for ccsm_msg from Tony for fractional land + /fs/cgd/data0/tcraig/ccsm2_runs/f22.006/src.atm/ccsm_msg.F90 + - Strip out CCM366 code now that test-model tests are no longer run... + Removed all files in models/atm/cam/src/physics/ccm366/ (CCM366 + physics) and models/lnd/lsm/src/ (LSM). + - Deal with huge volume of print statements + Commented out print of "TIMEFILTER" messages per CAM CRB meeting on + 6/20/03. Modified tfilt_massfix.F90 + - Restore fv_prints.F90 as per Art Mirin's email + Got new fv_prints.F90 from sunray3:/home/mirin/outgoing/. + - Added Art Mirin's "one-line-change" to resolution_parameters.xml + Added new line for resolution=".5x.625" + + +=============================================================== +=============================================================== + +cam2_0_2_dev22 +Originator: hender ( Tom Henderson) +Date: Fri Jun 20 15:50:11 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev22 +One-line Summary: Rolled back dev21 changes (per CAM CRB). +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: none. I verified that the entire cam1 module is identical to +dev20. Testing will be done for dev23 +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: dev22 is identical to dev20 +=============================================================== +=============================================================== + +cam2_0_2_dev21 +Originator: eaton ( Brian Eaton) +Date: Wed Jun 18 13:15:50 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev21 +One-line Summary: dycore independent energy fixer, only active for FV +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC/lf95 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, boville +Restart files change: no +Changes answers: Yes. spectral dycores change to round-off. FV dycore has a physics change. +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes +Changes made: + +Add dycore independent energy fixer. Currently it is only applying an energy fix when run +with the FV dycore. For the spectral dycores it is diagnostic. + +A round-off level change was introduced into the spectral dycores due to 2 changes: +1. The definition of dry static energy was changed to include the surface geopotential. +2. The conversion between dry and wet constituent mixing ratios was moved into the coupling layer, + and an extraneous conversion that previously happened at the end of tphysbc and at the beginning + of tphysac has been removed. + +See http://www.cgd.ucar.edu/~cam/cam_checkins/ for details. + +=============================================================== +=============================================================== + +cam2_0_2_dev20 +Originator: erik ( Erik Kluzek) +Date: Mon Jun 16 12:54:27 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev20 +One-line Summary: Get rid of ccm366/lsm test in test-model.pl, clean more files in $MODEL_BLDDIR, send *.cprout files in test-model to $MODEL_EXEDIR +cam-bugs Requests resolved: 112, 118(partial) +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux(lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, hender +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB?no + +Got rid of the ccm366/lsm test in test-model.pl. + +Clean more files in the $MODEL_BLDDIR when using test-model.pl or run-model.pl +(fixes bug #112) + +Send all *.cprout files to $MODEL_EXEDIR instead of $SCRIPT_DIR this prevents +overwrites of files by different machines. This is a partial fix to bug #118. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. + http://www.cgd.ucar.edu/~cam/cam_checkins/ + for most recent and proposed checkins + +=============================================================== +=============================================================== + +cam2_0_2_dev19 +Originator: hender ( Tom Henderson) +Date: Fri Jun 13 10:28:19 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev19 +One-line Summary: Merged "science" branch into "dev" branch. +cam-bugs Requests resolved: none +Requires change in build system: Yes (see science branch documentation) +Substantial timing or memory changes: Yes (see science branch documentation) +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: many +Restart files change: yes +Changes answers: Yes (new-climate) +Changes to CLM land-model: Yes +Have you filled out the pre-check-in documentation as required by the CAM CRB? yes + http://www.cgd.ucar.edu/~cam/cam_checkins/checkin_process.shtml +Changes made: +See http://www.cgd.ucar.edu/~cam/cam_checkins/ for details of all changes +made on the science branch. + +=============================================================== +=============================================================== + +cam2_0_2_dev18 +Originator: rosinski ( Jim Rosinski) +Date: Tue Apr 8 17:09:30 MDT 2003 +Model: CAM +Version: CAM2.0_2.dev18 +One-line Summary: Speedup mods. Particularly for large number of threads (e.g. typical SGI) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes. Speedup mods. See below for details. +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Have you filled out the pre-check-in documentation as required by the CAM CRB? no but I will +Changes made: + +o Speedup mods. Should see order 10% speedup on SGI, 3% on IBM. Even better than that for + more than 32 threads on SGI. Specifics were: + - fuse threaded loops to minimize threading overhead + - Don't dereference pointers in expensive history calculations. + - Thread some calculations called from physpkg that were previously single-threaded. This + likely is the reason for such a big speedup on SGI. + +o Changed ifdef DEBUG to HDEBUG inside history.F90. Reason was model barfed somewhere in + physics when DEBUG ifdef was set. + +o Fix max/min combined with flag_xyfill=.true. pathological history case (prv commit). + +=============================================================== +=============================================================== + +cam2_0_2_dev17 +Originator: rosinski ( Jim Rosinski) +Date: Sat Apr 5 11:48:41 MST 2003 +Model: CAM +Version: CAM2.0_2.dev17 +One-line Summary: Added ISCCP cloud simulator +cam-bugs Requests resolved: none +Requires change in build system: yes (new namelist variables) +Substantial timing or memory changes: history speedup. +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +o Added ISCCP cloud simulator. Cost overhead is around 5%. You need to set + namelist variable doisccp = .true. to enable the simulator. Then + isccpdata = '/fs/cgd/csm/inputdata/atm/cam2/rad/isccp.tautab_invtau.nc' + to tell the simulator where the required boundary dataset is. + + Had to set default doisccp = .false. because test-model will barf when cprnc + gets confused at the different values of the "levels" coordinate variable. + This needs to be fixed. + + Output from the simulator is 6 fields. The key field is FISCCP1, dimensioned + lon x 49 x lat x time. The 49 is really 7 pressure levels by 7 optical + depths. Pressure and optical depth of each "level" can be determined from + dimension variable "isccp_prstau". Pressure is the number to the left of + the decimal point in mb. Optical depth is the number to the right of the + decimal point times 1000. + + The simulator is only called during daytime (coszrs > 0). As a consequence, + routine outfld in history.F90 was modified to ignore input array locations + set to fillvalue. To enable this feature, a new argument to addfld named + flag_xyfill was added. Set it to .true. to enable outfld ignoring fillvalue + input. Currently this is only done for appropriate ISCCP fields. If this + feature is enabled, for multilevel fields the setting of fillvalue MUST be + invariant in the z-direction. The reason is that the accumulator (nacs) is + currently only dimensioned x-y. The history handler checks for this + consistency and barfs if it is not met. Changing the accumulator to be + x-y-z capable would not be too hard, but might have severe performance + ramifications. + +=============================================================== + +cam2_0_2_dev16 +Originator: tcraig ( Anthony Craig) +Date: Thu Apr 3 15:51:34 MST 2003 +Model: CAM +Version: CAM2.0_2.dev16 +One-line Summary: Updates for CCSM coupling with cpl6, CCSM coupling with FV, rain/snow in coupling +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + + ccsm_msg.F90 + - Significant rewrite for cpl6, has no impact on stand-alone CAM + (Rob Jacob). + - Fixed bug in outfld call for CPLRAIN*, CPLSNOW*, CPLPRCER + (Mariana Vertenstein). + - Removed artificial repartitioning of snow and rain in fields + sent to coupler to be ready for CLM2.2. + - Fixed bug in read/write of precca, precla, precsca, precsla + (Mariana Vertenstein, Bryon Boville) + - Modified coupling for LR dycore, removed special mods for LR + dycore in sendgrid setting mask to zero at most pole latitudes. + This was required for CCSM coupled runs with the LR dycore. + + spmdinit.F90 + - Removed the MPI_INIT call for COUP_CSM mode, cpl6 now handles this. + - Removed use of shr_msg_comm_atm (cpl5). Added a call to + cpl_interface_init (cpl6) to return the MPI communicator group. + + cam.F90 + - Modified some code on COUP_CSM definitions, remove calls to + shr_msg_init, shr_msg_groups, and shr_msg_finalize (cpl5). + Added call to cpl_interface_finalize (cpl6). + + phys_grid.F90 + - Added two new routines, buff_to_chunk and chunk_to_buff (Rob Jacob). + These are used in ccsm_msg to rearrange data from a lon-lat buffer + into chunk structure. + + +=============================================================== +=============================================================== + +cam2_0_2_dev15 +Originator: jet ( John Truesdale) +Date: Wed Apr 2 08:27:51 MST 2003 +Model: CAM +Version: CAM2.0_2.dev15 +One-line Summary: Added capability to output history tape fields on a column by column basis +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Changes made: + +I've added code and a set of namelist variables that allow fields for +a particular history tape to be written on a column by column basis. +The new namelist variables are named fincl1lonlat ... fincl6lonlat and +are used in conjunction with the fincl1 ... fincl6 namelist variables. + +Here is an example of how to use the new variables to define individual +columns or a lat/lon range of columns for output. + +1. Define a history tape with a set of fields that you would like to see + output at specific columns + + ex. fincl3 = 'LHFLX','SHFLX','PS','T','U' + +2. Define the columns for that history tape using fincl[1..6]lonlat + Like the fincl[1..6] specifiers all of the column identifiers are strings. + Specify the longitude in degrees followed by a single character + (e)ast/(w)est modifier. Follow this with an underscore ('_') and then + specify the latitude in degrees followed by a single character + (n)orth/(s)outh modifier. + + ex. fincl3lonlat = '30.5e_45.5n' + + will output the model column closest to 30.5 degrees east longitude + and 45.5 degrees north latitude for all fields defined by history tape + 3. + + You can specify a range of longitudes (or latitudes) by separating + the min and max values with a colon (':') like so + + ex. fincl3lonlat = '30e:40e_45n' + + will output the closest model columns from 30 to 40 degrees east + and at 45 degrees north for all fields defined on history tape 3. + + The latitudes/longitudes must be positive (real or integer). + + longitude values range from [0w to 180w] and [0e to 180e] + latitude values range from [90s to 0s] and [0n to 90n] + +3) Variables will be put on the history tape with the longitude and latitude + coded as part of the name. + + Ex. Using these namelist variables + + fincl3 = 'LHFLX','SHFLX','PS','T','U' + fincl3lonlat = '30.5e_45.5n','30e:40e_45n' + + will produce the following fields on history tape 3. + + LHFLX_30.5e_45.5n + LHFLX_30e_to_40e_45n + PS_30.5e_45.5n + PS_30e_to_40e_45n + SHFLX_30.5e_45.5n + SHFLX_30e_to_40e_45n + T_30.5e_45.5n + T_30e_to_40e_45n + U_30.5e_45.5n + U_30e_to_40e_45n + + The netcdf attributes for each field will be set to include the + actual latitude and longitude. This allows tools like ferret + to correctly plot the correct part of the world grid. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev14 +Originator: eaton ( Brian Eaton) +Date: Thu Mar 27 15:07:31 MST 2003 +Model: CAM +Version: CAM2.0_2.dev14 +One-line Summary: fix fv restart under lf95/debug and fix bug in pseudo-ozone test tracer +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, pc-linux-lf95 +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +>> physics/cam1/restart_physics.F90 - in subroutine read_restart_physics add +>> calls to get_ncols_p inside the chunk loops and only assign the correct +>> number of columns worth of restart data into srfflx_state2d and +>> surface_state2d member arrays. +>> +>> physics/cam1/test_tracers.F90 - fix bug in subroutine test_tracers_timestep_tend. +>> All levels of the pseudo-O3 were being zeroed rather than just the bottom level. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev13 +Originator: hender ( Tom Henderson) +Date: Tue Mar 25 10:17:12 MST 2003 +Model: CAM +Version: CAM2.0_2.dev13 +One-line Summary: Fixes and upgrades to test scripts, change for omega in history output. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux-lf95 +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Erik Kluzek, Jim McCaa +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + + 1) Fixes to test-model.pl so -compare works (Kluzek). + 2) Shorten run length for SOM tests in test-model.pl (Kluzek). + 3) Script improvements to allow Wei to easily test lf95, pgf90-pgcc, and + pgf90-gcc in his automated runs (Henderson). + 4) Makefile changes to make pgf90 bfb restarts with different number of + processes work with the fv dycore (Henderson). + 5) Makefile changes to add Fortran optimization override environment + variable F_OPTIMIZATION_OVERRIDE (Henderson). + 6) test-model.pl upgrade to use F_OPTIMIZATION_OVERRIDE when pgf90 is + used for fv04-fv06 and fv10-fv13 tests (Henderson). + 7) test-model.pl upgrade to allow multiple test-model.pl incarnations to + be launched simultaneously from ncar_batch.csh (i.e. via queuing + systems) (Henderson, Kluzek). + 8) Modified ncar_batch.csh to pass the "-unique_id" option to + test-model.pl (Henderson). + 9) Changed $COMPARE_DIR/cam1 to $COMPARE_DIR in ncar_batch.csh to help + folks who use non-standard directory naming (Henderson). + 10) Upgraded CAM XML parser to latest version (Kluzek). + 11) Modified history file output to replace Omega@600mb with Omega@500mb + (McCaa and Henderson). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev12 +Originator: erik ( Erik Kluzek) +Date: Thu Mar 20 15:48:06 MST 2003 +Model: CAM +Version: CAM2.0_2.dev12 +One-line Summary: Fix bug in test-model with -compare and update XML::Lite from 0.11 to 0.14 +cam-bugs Requests resolved: 104 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Sun, Linux-PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, hender, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Update XML::Lite from 0.11 to 0.14. Creator of XML::Lite, gave us +a newer version as he said the old version had "a significant bug" +in it. + +Fix bug in -compare option for test-model.pl (bug #104). Previously +worked ok if you specified the dynamics, or for eul dynamics. It would +fail when it changed dynamics. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev11 +Originator: mirin ( Arthur Andrew Mirin) +Date: Thu Mar 13 17:21:11 MST 2003 +Model: CAM +Version: CAM2.0_2.dev11 +One-line Summary: Changes to transposes for 2D FV decomposition. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no; however one can now make with 64-bit addressing on IBM. +Substantial timing or memory changes: no +Requires change in run script: no; however, there are some new input options. +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes; however, bug in script, so could not verify. +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Will Sawyer +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None +Changes made: + + The main changes are in the area of transposes for the 2D FV decomposition. + + a. Transposes now include ghost points, which obviates extra ghost point + communication following the transposes. This improves performance, + but with limited impact because so few of the transposes involve ghost + points. + + b. Transposes now use the NASA/Goddard mod_comm package, which lies underneath + Pilgrim. This enables use of one-sided MPI-2 communications as well as + standard MPI. NASA/Goddard personnel report substantial gains on + the SGI when MPI-2 is used in place of standard MPI. + + c. Arrays containing extra points in any of the dimensions still cannot + be handled and must be copied into (out of) arrays without extra + points. Instead, the associated copies are, to the extent possible, + overlapped with other messages. This improves performance. + + d. The number of tracers to be transposed simultaneously is now specifiable. + Formerly, all tracers had to be transposed together. This facilitates + overlapping copying with communication (see above point). If there are + N tracers altogether, to be transposed in groups of M, one solves + N = Q * M + R, and does Q groups of M and 1 group of R. Preliminary + tests indicate that M=1 is good for coarse domain decompositions, + but that as the decomposition becomes finer, the latency of multiple + transpose calls outweighs the computation/communicaiton overlap + benefit. The default is M=6. + + e. A new method for initializing the transposes has been implemented. + Unlike the old methodology, this new method works for ghost points. + The method scales fine spatially but very poorly with the number of + tracers to be simultaneously transposed. Until this is fixed, + one would best limit M (see above point) to 6 (the default). + + f. We have been experimenting with MPI derived types, versus the current + method of copying data in and out of contiguous buffers. At present + we are getting mixed results. This option has been implemented for + MPI-1 only (not MPI-2). Further testing is underway. + + The files affected are: + Directory ...../src/dynamics/fv, files cd_core.F90, dp_coupling.F90, + dynamics_vars.F90, dynpkg.F90, geopk.F90, inidat.F90, + p_d_adjust.F90, pmgrid.F90, spmd_dyn.F90, stepon.F90, trac2d.F90. These are virtually all transpose-related changes. + + Directory ...../src/control, files cam.F90, spmdinit.F90. + The change to cam.F90 is to make sure TWOD_YZ is not set when SPMD + is unset. The change to spmdinit.F90 has to do with MPI + initialization on SGI machines when using MPI-2. + + Directory ...../utils/pilgrim, files Makefile, Makefile.conf.AIX, + Makefile.conf.IRIX64, decompmodule.F90, ghostmodule.F90, memstuff.c, + mod_comm.F90, parutilitiesmodule.F90, puminterfaces.F90, + redistributemodule.F90. + + Directory ...../utils/pilgrim/unit_testers, files Makefile, + decomptest.F90, ghosttest.F90, parpatterntest.F90, + parutilitiestest.F90, redistributetest.F90, unstructured.F90. + + Directory ...../bld, files Makefile, configure_fv.pl, script.m4. + The change to Makefile is to provide option for 64-bit addressing + on IBM. To do so, switch actual and commented lines to set + ADDRESS := Q64. The other two files are NASA/Goddard-specific. + + Directory ...../test/system, file llnl_frost.csh. + + A full diff of changes is on goldhill in ~mirin/diffs/diff_archive_cam2_0_2_dev10. + + Here is some information on new, as well as existing knobs: + + Two parameters have been added to the mprun2d namelist (used for 2D FV + decomposition) - geopktrans and tracertrans. Geopktrans refers to the + geopotential computation/communication method in geopk.F90. A value + of 0 (default), which results in the setting of geopk16byte false, + means that transposes are computed before and after the calls to + geopk (from cd_core) in order to do the vertical indefinite integrals + in geopk. A value of 1 causes geopk16byte to be set to true, + meaning that instead of computing transposes, partial sums in each + vertical subdomain are calculated and then communicated in z as + needed; 16-byte arithmetic may be used to guarantee bit-for-bit agreement + across domain decomposition; the default (for purposes of speed) is + 8-byte arithmethic. One can change to 16-byte arithmetic by editing + geopk.F90 to change DSIZE from 8 to 16 (switch actual and commented + statements). For performance purposes, the code should be used + as is with geopktrans equal to 1. The other parameter, tracertrans, + refers to the number of tracers simultaneously transposed (denoted by + M above); the default is 6 and in general need not be changed. + + One can implement MPI derived types in the transposes by activating + USE_MPI_TYPES in models/utils/pilgrim/parutilitiesmodule.F90. + This is unsupported - do so at your own risk. This bypasses mod_comm + and works for only MPI-1. One can make use of MPI-2 in mod_comm by + activating MPI2 at the beginniing of mod_comm.F90. Use of this is + definitely at your own risk. + + To run waccm configuration tests, please see instructions on goldhill + in ~mirin/waccm. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev10 +Originator: hender ( Erik Kluzek, tagged by Tom Henderson) +Date: Wed Mar 12 13:46:38 MST 2003 +Model: CAM +Version: CAM2.0_2.dev10 +One-line Summary: Added SOM test to test-model.pl. Various bug fixes. Update to ESMF_0_0_2p8 +cam-bugs Requests resolved: 101, 100, 99 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: yes, if running with new SOM +-som option in configure now works. Default will behave as before. +Substantial timing or memory changes: no +Requires change in run script: yes, if running with new SOM +Must use initial and SST datasets that are compatible with SOM. See +/ftp/pub/erik/cam2_0_2.scidac-atm.datasets.tar.gz +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Intel-Linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Jim Rosinski, Erik Kluzek, Brian Eaton, Tom Henderson +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes to ESMF library: Update to ESMF_0_0_2p8, a pruned version of ESMF_0_0_2p5 +Changes made: + +Added SOM test to test-model.pl and fixed bugs: + +Add a SOM test for all dycores and for the control library. +Add new datasets needed for running with SOM. Reset namelist +each test in test-model.pl to make test-model.pl more robust. +Add a no-fail option to cam_timing so that when using -nofail +if a simulation aborts test-model.pl won't stop. Fix reporting +problem of different history files with -nofail. Improve the +diagnostic output of test-model.pl especially for the -nofail +case. Also be more careful at cleaning up data, such that data files +are deleted only after needed comparisions are done. + +New datasets are available under "datasets" on the cam developers +web page. + +Put, support message about ESMF in Makefile. + +U atm/cam/bld/DefaultCAMEXPNamelist.xml +U atm/cam/bld/Makefile +U atm/cam/doc/UsersGuide/test-model.html +U atm/cam/test/system/CAM_test.pm +U atm/cam/test/system/cam_timing.pm +U atm/cam/test/system/test-model.pl + +Bug fixes to make Lahey compiler happy: +U atm/cam/src/ocnsice/som/ocn_srf.F90 +U atm/cam/src/dynamics/fv/inidat.F90 +U atm/cam/bld/configure + +Changed these ESMF files to allow for removal of lots and lots of other +ESMF files: + +Update to ESMF_0_0_2p8, so can prune out unused files and directories. +Also turn off dependency of OMP, PCL, and MPI libraries. This simplifies, +shortens, and makes the ESMF make more robust. It also removes half of the +amount of disk storage for ESMF than was used before, several of the unused +code directories were removed and only the minimal set needed for using +the ESMF time manager. + +U utils/esmf/README +U utils/esmf/build/IRIX/ESMF_conf.h +U utils/esmf/build/IRIX64/ESMF_conf.h +U utils/esmf/build/alpha/ESMF_conf.h +U utils/esmf/build/linux_gnupgf90/ESMF_conf.h +U utils/esmf/build/linux_lf95/ESMF_conf.h +U utils/esmf/build/linux_pgi/ESMF_conf.h +U utils/esmf/build/rs6000_64/ESMF_conf.h +U utils/esmf/build/rs6000_64/base_variables +U utils/esmf/build/rs6000_sp/ESMF_conf.h +Ripped out lots and lots of ESMF files: +... + +Upgraded to simplify automated testing on anchorage with pgf90-pgcc and +pgf90-gcc: +U atm/cam/test/system/ncar_batch.csh + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev9 +Originator: rosinski ( Jim Rosinski) +Date: Wed Feb 26 17:59:48 MST 2003 +Model: CAM +Version: CAM2.0_2.dev9 +One-line Summary: Added SOM capability. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) except Linux-pgf90 is only roundoff +Changes to CLM land-model: None +Changes made: + +o Added Slab Ocean Model (SOM) capability. To enable, change som/ to dom/ +in Filepath, and add #define COUP_SOM in misc.h. + +For prescribed-ice control runs that will create fluxes for SOM, to get +good results CNTL_FORSOM must also be #defined. + +Climates have only been examined in EUL mode. SLD and FV do compile, but they +have not yet been tested. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev8 +Originator: jet ( John Truesdale) +Date: Wed Feb 19 16:51:27 MST 2003 +Model: CAM +Version: CAM2.0_2.dev8 +One-line Summary: fix bug in srface diagnostic variables - fsnslnd fsnsocn etc +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no + +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Changes made: +These mods were to fix a bug with the newly added surface diagnostics. +They were not giving bit for bit when restarting fv and sld runs. To +fix this I had to add some variables to the restart dataset +as well as put a n-1 timelevel of landfrac,ocnfrac,and icefrac into the +physics buffer. These n-1 timelevel values are used from the physics +buffer on restart. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev7 +Originator: hender ( Tom Henderson) +Date: Mon Feb 10 09:49:09 MST 2003 +Model: CAM +Version: CAM2.0_2.dev7 +One-line Summary: Grab bag -- Makefile, script, and source code fixes for SGI, Linux (PGI and Lahey), IBM +cam-bugs Requests resolved: 92, 88 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Lots of accumulated minor fixes for SGI, Linux, IBM. All bfb. Biggest change +is support for Linux-Lahey in source code and ncar_batch.csh. Brian Eaton, +Pat Worley, John Truesdale, Jim Rosinski, and Erik Kluzek contributed various +bits. +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Makefile, run-ibm.csh, ncar_batch.csh, ice_srf.F90, comsrfdiag.F90, +fv_prints.F90, test-model.pl (and files it uses) +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux-Lahey +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Brian Eaton (SGI bits in Makefile), Jim Rosinski +(Linux-Lahey bits in Makefile), John Truesdale (John made the fixes for +ice_srf.F90, comsrfdiag.F90, and fv_prints.F90), Erik Kluzek (Erik made the +fixes for test-model.pl) +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: +Note: This is item #018 on CAM Check-in List "Fix performance bug in Makefile + for SGI (formerly CAM task list #02.12.19.5)". It's scope has expanded + a bit. +A- Modified Makefile for SGI so LDFLAGS has options and libraries in the + correct order ( -mp -lmp -lmpi ) as described by Pat Worley. +B- Added Brian Eaton's fix for run-ibm.csh: + "On the IBM there are 3 environment variables that allow you to specify the + node/task configuration. The 2 that are set in the run-ibm.csh file imply + that the total number of mpi tasks (procs) is 2. It's likely that your job + has procs=1 due to the 3rd environment variable, MP_PROCS, being set + somewhere else, like your .cshrc or .profile file (perhaps by the SCD + supplied default version of these files). The fix I'd suggest is to add + the command "unsetenv MP_PROCS" to run-ibm.csh file in the POE Environment + settings section." -- Brian Eaton +C- Added Brian Eaton's fix for run-ibm.csh to ncar_batch.csh too. +D- Added support for the Lahey compiler on anchorage to ncar_batch.csh. PGI + becomes an option, Lahey the default. +E- Added John Truesdale's fixes for ice_srf.F90, comsrfdiag.F90, and + fv_prints.F90. This allows versions cam2_0_2_dev1 and later to work + with the Lahey compiler. Prior to these fixes, lf95 was complaining about + unintialized variables (etc.). +F- Erik Kluzek fixed test-model.pl to work around a problem on bluesky. +G- Changed pgf90 optimization from -fast to -O1 in Makefile to fix bfb problem + with test-model.pl test #fv06 (compare initial run to restart run with + different number of processors for fv dycore). All other tests were + passing bfb with -fast. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev6 +Originator: pworley ( Patrick H Worley) +Date: Wed Feb 5 15:19:36 MST 2003 +Model: CAM +Version: CAM2.0_2.dev6 +One-line Summary: New 1D decomposition for Fourier and Spectral domains in SLD dycore, for improved performance +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes, faster for large processor counts +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: No (bit-for-bit) on SGI and Compaq; Yes (same-to-roundoff) on IBM +Changes to CLM land-model: changed division by parameter to division by local copy in lnd_grid, to eliminate compiler complaint +Changes made: + +Implemented a consistent wavenumber decomposition for Fourier +and Spectral domains in SLD dycore, decreasing MPI communication and +storage requirements. Wavenumber decomposition also modified, +to improve load balance and decrease amount of communication. +This modification is similar to that in cam2_0_1_dev3, except for +SLD instead of EUL. + +Routines modified in dynamics/sld: comspe, courlim, dyn, dyndrv, +dynpkg, grcalc, hordif, quad, realloc4, realloc7, scan2, scandyn, +scanslt, spegrd, spmd_dyn, trunc, tstep, tstep1, vertnm. +Routines deleted in dynamics/sld: realloc3, realloc6 . + +Also, changed division by parameter to division by a local +copy of the parameter in two places in lnd_grid, to eliminate +a compilation failure with some versions of the IBM compiler. +(Fix provided by Art Mirin.) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev5 +Originator: eaton ( Brian Eaton) +Date: Tue Jan 21 12:33:04 MST 2003 +Model: CAM +Version: CAM2.0_2.dev5 +One-line Summary: makefile/configure changes +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, pc-linux +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Add ability to specify additional flags to the C compiler and to the loader +(this ability already exists for the Fortran compiler). This provides +flexibility in porting to new platforms. + +Change Makefile so that the Filepath, Srcfiles, and Depends files are +explicitly in the current directory. This fixes a bug which occurs when +make finds a Srcfiles file in the VPATH, and that Srcfiles is newer than +the Filepath (which results in Srcfiles not being created in the current +directory and the command to build the Depends file fails). + +Add an option to configure to allow the configuration cache file to be +created in a different directory than the CAM build directory. The default +behavior of configure is unchanged. + +Fix a broken configuration. The combination of omp on linux using pgf90 +and gcc resulted in the timing library being built without threading +enabled. Removed the setting of the THREADED_PTHREADS and THREADED_OMP cpp +macros from utils/timing/gpt.h and set these in the Makefile. This also +allows them to be set only when SMP is true. They were previously set to +use threads whether the rest of the model was threaded or not. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev4 +Originator: hender ( Tom Henderson) +Date: Fri Jan 17 11:23:15 MST 2003 +Model: CAM +Version: CAM2.0_2.dev4 +One-line Summary: ncar_batch.csh: added support for test-model.pl with -compare option +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + +The new ncar_batch.csh can be used to do bitwise comparison with a previous +source version. The test-model.pl script is run internally with the -compare +option. + +For NQS or PBS, the new usage is: +>> env SCRIPT_DIR=`pwd` COMPARE_DIR=$MYBASEDIR qsub ncar_batch.csh + +For LoadLeveler, the new usage is: +env SCRIPT_DIR=`pwd` COMPARE_DIR=$MYBASEDIR llsubmit ncar_batch.csh + +In both cases, directory $MYBASEDIR should contain the source code for the +previous version. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev3 +Originator: jet ( John Truesdale) +Date: Mon Jan 13 08:53:33 MST 2003 +Model: CAM +Version: CAM2.0_2.dev3 +One-line Summary: Added diagnostics for surface budget calculation, moved sst/ocn interpolation to correct minor flux bug +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Apache +Ran test-model.pl script: yes: Only on IBM +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: Yes (new-physics) +Changes to CLM land-model: None (one-line description) +Changes made: + +Added diagnostics to allow for surface energy budget calculations. The +following diagnostics were added: + +FSNSLND,FSNSOCN,FSNSICE,FLNSLND,FLNSOCN,FLNSICE,SHFLXLND,SHFLXOCN,SHFLXICE, +LHFLXLND,LHFLXOCN,LHFLXICE. + +Also added the following diagnostics to provide ocean/ice forcing for som +model + +FSNSOI,FLNSOI,SHFLXOI,LHFLXOI + +Moved the interpolation of ocean and ice right before the surface routines +that use them. SSTINT and ICEINT were previously at the top of the time +loop before tphysbc in the routine advnce. I removed them from advnce and +placed them after tphysbc right before camocn and camice. This corrected +a minor bug in the models use of fluxes calculated by camocn and camice. +Previously new fluxes were computed by camocn and camice with a set of +land, ocean, and ice fractions. The time loop ended, advnce was called, +new surface fractions computed and then tphysbc used the fluxes calculated +the previously time around only using the new fractions instead of the +surface fractions used to compute the fluxes. tphysbc now uses the time +level of fractions appropriate for the fluxes that are being read in. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev2 +Originator: rosinski ( Jim Rosinski) +Date: Thu Jan 9 17:16:38 MST 2003 +Model: CAM +Version: CAM2.0_2.dev2 +One-line Summary: Add evap bugfix to ice_srf.F90 per C. Bitz +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) or Yes (same-to-roundoff, same-physics, new-physics, new-climate) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Changes made: + +o One-line chage adds sublimation over sea ice to evaporative flux in ice model. + Changes answers beyond roundoff. Analysis of effects of this change available at: + www.cgd.ucar.edu/cms/rosinski/analysis/20shrconstevap-cam20shrconst/sets.htm + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_2_dev1 +Originator: hender ( Tom Henderson) +Date: Mon Jan 6 15:25:38 MST 2003 +Model: CAM +Version: CAM2.0_2.dev1 +One-line Summary: Minor improvements to batch execution of test-model and User's Guide updates +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and Erik +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Description: + CAM_lab.pm Update linux defaults + CAM_test.pm Fixed bug so "FAIL" is printed when a test fails (instad of + "ran"). Only affected the -nofail option. + ncar_batch.csh Updated to chinook "ded_16" queue and added PBS stuff for + anchorage. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev17 +Originator: erik ( Erik Kluzek) +Date: Fri Dec 20 15:42:18 MST 2002 +Model: CAM +Version: CAM2.0_1.dev17 +One-line Summary: Small script change for testing, Makefile change to run on Compaq +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, Sun, Linux-Lahey, Linux-PGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + +Point to new test-production.pl baseline. + +Change Makefile to run on Compaq. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev16 +Originator: mvertens ( Mariana Vertenstein) +Date: Thu Dec 19 14:31:58 MST 2002 +Model: CAM +Version: CAM2.0_1.dev16 +One-line Summary: updated cam documentation for cam2_0_2 release +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: None +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: +Updated cam documentation for cam2_0_2 release. +Clm documentation has already been updated. +Did not modify any code. +=============================================================== +=============================================================== + +cam2_0_1_dev15 +Originator: mvertens ( Mariana Vertenstein) +Date: Wed Dec 18 21:19:12 MST 2002 +Model: CAM +Version: CAM2.0_1.dev15 +One-line Summary: updated clm to clm2_deva_08 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: (see below) + tested that clm2_deva_08 worked with CCSM +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes +Changes made: +1) Updated clm user's guide to clm2.1 +2) Fixed restart problem for clm2.1 auxiliary history files +=============================================================== +=============================================================== + +cam2_0_1_dev14 +Originator: erik ( Erik Kluzek) +Date: Tue Dec 17 16:14:46 MST 2002 +Model: CAM +Version: CAM2.0_1.dev14 +One-line Summary: Fix script problems use new datasets, update to ccsm2_0_beta61 +cam-bugs Requests resolved: 76, 79, 84, 85 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes (IBM) +Machines tested: IBM, SGI, Sun, Linux (PGI,Lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) -- Except Z050 field changes! +Changes to CLM land-model: None + +New datasets: + + Add capability for 1x1.25 for FV. Use new datasets for FV 2x2.5. + Download the new cam2.0.2 set of SCIDAC datasets for use with + this version of the model. + +Fix test-model.pl bug in comparision: + + Fix comparision problem in test-model.pl. Also fix so that + doesn't use as much disk-space. And change so that does + a error-growth test with the control code. + +Fix build-namelist bug: + + Fix bug in writing out long lists. + +Fix bug in Z050: + + Z050 was 5 mbar surface rather than 50 mbar surface. + +Fix PGI bug for open-MP processing: + + Delete a specific OpenMP loop in dynamics/fv/inidat.F90 that + caused answers to change with number of processors. + +Update to ccsm2_0_beta61: + + Update models/bld and scripts to ccsm2_0_beta61. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev13 +Originator: mvertens ( Mariana Vertenstein) +Date: Mon Dec 9 09:49:17 MST 2002 +Model: CAM +Version: CAM2.0_1.dev13 +One-line Summary: clm code updated to development tag clm2_deva_07 (clm2.1 code) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +New (converted) clm initial datasets must be used +see DefaultCLMEXPNamelist.xml +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, Sun, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: Yes (for clm only) +Changes answers: Yes (same-to-roundoff, same-climate) +Changes to CLM land-model: YES (updated to clm2.1 data structures) +Changes made: + +1) clm2.1 has replaced clm2.0 in the current code. + updated models/lnd/clm to clm development tag clm2_deva_07 + The differences are roundoff. + Two climate simulations were done to verify this commit. + case: /OLESON/csm/eul_201dev10 - cam2_0_1_dev10 (clm2.0) + case: /OLESON/csm/eul_201dev10_06 - cam2_0_1_dev10 (clm2.1 - tag clm2_deva_06) + The two cases were been compared with the standard climatological SST simulation + using CAM2.0.dev24 (case eul20dev24_a) and show the same climate + Performance on blackforest is effectively the same. + +2) initial clm datasets used with clm2.0 are no longer compatible with clm2.1 + surface datasets used with clm2.0 will work with clm2.1 + restart files used with clm2.0 are not compatible with clm2.1 + a conversion tool has been created (see directory models/lnd/clm2/tools/convert_inic) + running gmake in this directory will generate the conversion tool executable, convert_inic + datasets needed by configure have already been converted and have been placed in the + directory /fs/cgd/csm/inputdata/lnd/clm2/inidata_2.1/cam + +3) the xml file DefaultCLMEXPNamelist.xml in models/atm/cam/bld has been modified + to point to the converted clm2.1 initial datasets + +4) the following tests were done using test-model.pl: + tests platform status + ------------------------------------------------------------------ + eul:1-6:64x128L26 ibm (blackforest) success + eul:1-6:64x128L26 sgi (chinookfe) success + eul:1-6:64x128L26 linux (apache) lf95, pgf90 success + eul:1-6:64x128L26 sun (flagstaf) success + eul:1-6:64x128L26 compaq (ornl-colt) cannot test due to know problem starting with + cam2_0_1_dev10 on compaq + eul:1-6:48x96L26 ibm (blackforest) success + eul:1-6:48x96L26 sgi (chinookfe) success + eul:1-6:48x96L26 linux (apache) pgf90 success + eul:1-6:48x96L26 sun (flagstaf) success + eul:1-6:48x96L26 compaq (ornl-colt) cannot test due to know problem starting with + cam2_0_1_dev10 on compaq + fv:1-6:2x2.5L26 ibm (blackforest) success + fv:1-6:2x2.5L26 sgi (chinookfe) success + fv:1-6:2x2.5L26 linux (apache) lf95 success (know problem with pgf90 on restart due to openmp) + fv:4-6:2x2.5L26 sun (flagstaf) success + fv:1-6:2x2.5L26 compaq (ornl-colt) cannot test due to know problem starting with + cam2_0_1_dev10 on compaq + sld:1-6 ibm (blackforest) success + sld:1-6 sgi (chinookfe) success + sld:1-6 linux (apache) lf95 success + sld:1-6 sun (flagstaf) success + sld:1-6 compaq (ornl-colt) cannot test due to know problem starting with + cam2_0_1_dev10 on compaq + sld:1-6:64x128L26 ibm (blackforest) success + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev12 +Originator: eaton ( Brian Eaton) +Date: Tue Nov 26 17:48:40 MST 2002 +Model: CAM +Version: CAM2.0_1.dev12 +One-line Summary: new physics buffer and misc makefile changes +cam-bugs Requests resolved: none +Requires change in build system: yes +ccm366 physics now requires pnats=0 (done by configure) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, pc-linux-lf95 +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: yes, one fewer timelevel saved for cld, tcwat, qcwat, +and lcwat fields. +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Implement new physics buffer (phys_buffer.F90) to manage fields that +persist across timesteps or that are communicated between different physics +packages within a time step. Eventually the buffer.F90 module will be +replaced. For now only the fields used by the stratiform cloud condensate +scheme are being managed by the physics buffer. + +The new module in cldcond.F90 is the start of an implementation of the new +physics interface for the cloud condensate parameterization. It currently +just deals with the fields that use the physics buffer. These fields save +a dycore dependent number of timelevels in the buffer, and that number has +been reduced by one from the buffer.F90 implementation (i.e., eul saves 2 +old timelevels while fv and sld just save one). + +Removed the need to declare pnats=1 for a cloud water constituent which +wasn't used when running with ccm366 physics. The configure script now +sets pnats=0 in that case. + +Modify Makefile, configure, and config_cache_defaults.xml to support using +netCDF f90 interface. The environment variable MOD_NETCDF should be set to +the directory that contains the netCDF module files. This capability is not yet +required as CAM isn't currently using the netCDF Fortran 90 interface. + +Added -qmaxmem=-1 to the AIX fflags for optimization. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev11 +Originator: eaton ( Brian Eaton) +Date: Thu Nov 21 19:12:10 MST 2002 +Model: CAM +Version: CAM2.0_1.dev11 +One-line Summary: constituent initialization mods +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, pc-linux-lf95 +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no, except for a specific non-production configuration described below +Changes to CLM land-model: None +Changes made: + +Implemented mods to allow specifying for each constituent whether the +initial values are to be read from the initial file or set by an +initialization routine. The namelist variable readtrace now serves to set +the default value for all constituents except water vapor (its default +value is .true.). The default may be overridden by an optional argument in +the calls that register the constituents. The optional argument may be set +by namelist variables that are managed by the constituent's package, or may +be hardwired in the call. The ghg chemistry package uses the default value +determined by readtrace. The test_tracers package hardwires the initial +values to be set by an initialization routine. Thus it is no longer +necessary to set readtrace=.false. to run the test_tracer package in CAM. +The namelist variables nusr_adv and nusr_nad have been disabled. + +In the FV dycore only, the initialization of constituents has been modified +to initialize one constituent at a time. This is to reduce the memory +requirements since we couldn't fit the waccm configuration (2x2.5, 66 +levels, 50 constituents) on the ibm-winterhawk2 nodes. + +The mods do not change answers in the production model. However the +following configuration has non-bfb changes: When the ghg chemistry is run +using initial values that are set by its initialization routine (rather +than being read from the initial file), the answers change due to changed +initial values. The ghg initial values are set with uniform distributions +rather than having a decay in the stratosphere as was previously done. +Byron believes this distribution will spin up to an equilibrium state more +quickly than the previous initial distribution. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev10 +Originator: eaton ( Brian Eaton) +Date: Thu Nov 14 19:03:59 MST 2002 +Model: CAM +Version: CAM2.0_1.dev10 +One-line Summary: fix some uninitialized variables so lf95 debug mode works +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, pc-linux-lf95 +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself. Pat Worley provided the mods. +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + +These mods fix a couple of references to uninitialized variables that caused a +runtime error in executables built w/ lf95 and strict error checking. +The test-model.pl debug test (test 1) now works on all dycores with lf95. +Also fixed a couple of incorrect intent attributes. + +Mods: +dynamics/{eul,sld}/linemsdyn.F90 - init vcour to 0. +vmax2d, vmax2dt, and vcour declared intent(inout) in +1) sld/realloc7.F90 +2) sld/dyndrv.F90 (in both PVP and nonPVP branches) +3) sld/courlim.F90 +cam1/radctl.F90 - fix outfld call for qrl + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev9 +Originator: eaton ( Brian Eaton) +Date: Thu Nov 14 09:31:24 MST 2002 +Model: CAM +Version: CAM2.0_1.dev9 +One-line Summary: change AIX optimization from O3 to O2 +cam-bugs Requests resolved: 75 +Requires change in build system: no +Substantial timing or memory changes: didn't do performance tests +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + +Makefile changes for AIX only: +O3 --> O2, and remove -qstrict which is only needed with -O3 +Use -qsmp=omp:noopt in debug mode. + +Surprisingly (at least to me) the answers are bfb when changing from "-O3 -qstrict" to "-O2". + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev8 +Originator: forrest ( Forrest Hoffman) +Date: Wed Nov 13 12:37:22 MST 2002 +Model: CAM +Version: CAM2.0_1.dev8 +One-line Summary: Fix for new code introduced in cam2_0_1_dev7 that caused run-time failures on SGI and Linux +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM (cheetah), SGI (thanks to Mariana Vertenstein) +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Mariana Vertenstein +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Fixes to lp_coupling +Changes made: + +Replaced intent(out) with intent(inout) for srfflx to avoid passing +undefined elements back to the atmosphere physics since only land point +values are filled. This problem was exhibited under SGI IRIX and +Linux. + +Added working scalars to the private clause of the OpenMP do parallel +statements to assure appropriate scope. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev7 +Originator: forrest ( Forrest Hoffman) +Date: Fri Nov 8 15:46:07 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: introduced clump land model decomposition and implemented new alltoall comm between atm and lnd +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes, about 7x speedup in cam<->clm communications (only) +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Mariana Vertenstein, Pat Worley +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: New land model decomposition on clumps and alltoall comunication for CAM+CLM configuration +Changes made: + +1. Added new subroutine get_chunk_coord_owner_p() to phys_grid for + both cam1 and ccm366 versions. + +2. Added lnd_grid module containing the following: + + public surface_grid_init ! initializes land surface decomposition + public get_nclumps ! returns the number of clumps defined + public get_clump_cell_id_coord ! returns clump/cell ids based on lon/lat + public get_clump_owner_id ! returns clump owner based on clump id + public get_clump_ncells_proc ! returns number of cells for process + public get_clump_ncells_id ! returns number of cells in clump + public get_clump_tpatch_proc ! returns number of patches for process + public get_clump_tpatch_id ! returns number of patches in clump + public get_clump_coord_id ! returns lon/lat coordinates based on id + public get_clump_patchinfo ! returns patch id and number of patches + public get_clump_patchwt ! returns patch weight based on patch num + + surfage_grid_init() performs the land model domain decomposition into + clumps of grid cells containing patches. Clumps are private derived + data types which may be accessed through a suite of functions and + subroutines also contained in lnd_grid (see above). + +3. Added lp_coupling module containing the following: + + public lp_coupling_init ! initialize clump<-->chunk mapping + public lp_coupling_finalize ! destroy clump<-->chunk mapping + public alltoall_clump_to_chunk_init ! communicate fluxes from lnd to atm + public alltoall_clump_to_chunk ! communicate fluxes from lnd to atm + public alltoall_chunk_to_clump ! communicate fluxes from atm to lnd + + lp_coupling_init() initializes the mapping between atmosphere + physics chunks and land model clumps. It also allocates buffers + for use by subroutines within the module which perform the alltoallv + communication/transposition of surface state and fluxes between the + atmosphere and the land. This coupling is used when CAM and CLM are + run together as a single executable (when COUP_CAM is defined). + +4. Removed lnd_atmMod module which previously did processor mapping + for coupling. + +5. Modified atm_lndMod module to use routines from lp_coupling for coupling. + Added TIMING_BARRIERS barriers for communications timing tests. + +6. Modified clm_map subroutine to call surface_grid_init() (lnd_grid) for + domain decomposition and lp_coupling_init() (lp_coupling) to initialize + the atm<->lnd coupling. + +7. Added npes=1 definition even for the case when SPMD is undefined so + that new domain decomposition works correctly when running SMP-only. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev6 +Originator: pworley ( Patrick H Worley) +Date: Wed Nov 6 22:34:11 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: Fixed minor bugs introduced in cam2_0_1_dev3 that were found with Lahey and SGI compilers +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + + All changes in dynamics/eul only: + + 1) Modified courlim and dyndrv to change intent of vmax2d, + vmax2dt, and vcour from in to inout. + 2) Modified grcalc to set dalpn(2) to zero on processors + that do not calculate it. This eliminates a failure in + the SGI test-model DEBUG tests from using an uninitialized + variable. (dalpn(2) is used to calculate zurcor, which is + used only on the processor which also calculates dalpn(2). ) + 3) Moved an array initialization using array syntax + out of an OpenMP loop, as a + work around for a pgf90 compiler error. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev5 +Originator: bshen ( Bo-Wen Shen) +Date: Wed Nov 6 09:22:18 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: Changed DAO scripts +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: Yes (in DAO scripts) +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) + +Changes to CLM land-model: None (one-line description) +Changes made: + + + Modified DAO scripts (configure_fv.pl and script.m4) to run +the model on DAO SGI machines. + + 1. Defined SMP in Make.macros when OpenMP is used + to run a hybrid mode on SGI. + 2. Changed the way to call system_cmd, which is + written in C and does not accept a function name + (trim in this case) as an argument on DAO SGI. + 3. Modified mswrite/msread which will generated at run time + 4. Calculated total # of CPUs and passed the # to PBS + directives + + +=============================================================== +=============================================================== + +cam2_0_1_dev4 +Originator: eaton ( Brian Eaton) +Date: Wed Oct 30 07:46:47 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: implement ghg surface values module +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, pc-linux +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +This set of mods is in preparation for further mods to implement the new +physics interface design for initializing constituents. The current loop +to initialize constituents that are not read from the initial file (in +{eul,fv,sld}/inidat.F90) contains a call to ramp_ghg(). This function sets +surface values for the ghg constituents which are used by the radiation +codes as well as by the ghg chemistry code. The mods being committed +gather the code which is responsible for setting surface values of the ghg +constituents, and time interpolating them (ramping) from an annual dataset +if requested, into the single module in the file ghg_surfvals.F90. + +The new module ghg_surfvals does the following: +. maintains the values co2vmr, co2mmr, n2ovmr, ch4vmr, f11vmr, and f12vmr + as public data +. maintains the namelist variables scenario_ghg and rampyear_ghg. The + meaning of these variables has not changed. +. provides ramping functionality (time interpolation) when scenario_ghg is + set to 'RAMPED'. The data used by the ramp is determined by an include + statement in the module. Either file ramp_ghg_bau.h or ramp_ghg_stab.h + may be included. These .h files contain data formated as module data. + When using ramped data the default is to interpolate to the current + time. This may be modified by setting the rampyear_ghg variable to a + valid year which is then used to produce values that will cycle within + that fixed year. + +Files added: +physics/{cam1,ccm366}/ghg_surfvals.F90 + +Files removed: +physics/{cam1,ccm366}/ramp_ghg.F90 +physics/ccm366/comvmr.F90 + +Files changed: +control/preset.F90 +control/parse_namelist.F90 +control/comctl.h +control/restart.F90 +physics/cam1/constituents.F90 +physics/cam1/{chemistry.F90,radae.F90,radini.F90,trcmix.F90} +physics/cam1/ramp.h +physics/cam1/{ramp_ghg_bau.h,ramp_ghg_stab.h} +physics/cam1/crdcon.h +physics/cam1/radini.F90 +physics/cam1/{radcswmx.F90,trcpth.F90} +physics/cam1/advnce.F90 +physics/ccm366/ramp_ghg.F90 +physics/ccm366/{ramp_ghg_bau.F90,ramp_ghg_stab.F90} +physics/ccm366/constituents.F90 +physics/ccm366/{radabs.F90,radems.F90,radinp.F90} +physics/ccm366/radini.F90 +physics/ccm366/crdcon.h +physics/ccm366/{radcsw.F90,trcpth.F90} +physics/ccm366/trcmix.F90 +physics/ccm366/chemistry.F90 +physics/ccm366/physconst.F90 +physics/ccm366/inidat.F90 +physics/ccm366/advnce.F90 +dynamics/{eul,fv,sld}/inital.F90 +dynamics/{eul,fv,sld}/inidat.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev3 +Originator: pworley ( Patrick H Worley) +Date: Sun Oct 27 18:17:22 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: New 1D decomposition for Fourier and Spectral domains in EUL dycore, for improved performance +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: Yes, faster for large processor counts +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: John Drake, Michael Ham +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + Implemented a consistent wavenumber decomposition for Fourier + and Spectral domains in EUL dycore, decreasing MPI communication and + storage requirements. Wavenumber decomposition also modified, + to improve load balance and decrease amount of communication. + Routines modified: comspe, dp_coupling, dyn, dyndrv, + dynpkg, grcalc, hordif, linemsdyn, quad, realloc4, realloc7, scan2, + scandyn, scanslt, spegrd, spmd_dyn, trunc, and tstep. Also, + realloc3 and realloc6 no longer needed and deleted. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev2 +Originator: pworley ( Patrick H Worley) +Date: Sun Oct 27 09:10:31 MST 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: In-lined two temporaries in grcalc, so that new EUL dom. decomp. will be bit_for_bit on the IBM in next check-in +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and Jim Rosinski +Restart files change: no +Changes answers: no on Compaq, yes on IBM (same-to-roundoff, same-physics) +Changes to CLM land-model: None +Changes made: + + Eliminated tmpr and tmpi in grcalcs and grcalca in dynamics/eul/grcalc.F90: + + tmpr = alps(ir)*alp(mr+n,irow) + tmpi = alps(ii)*alp(mr+n,irow) + + in-lining the expressions in the two places where each + of them is used.This causes roundoff level changes to the solution + on the IBM, but not on the HP/Compaq. With this change, the restructuring + of the domain decomposition used in the spectral Eulerian (next check-in) + will be bit-for-bit. This check-in is used to isolate and document + the source of the roundoff change. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_1_dev1 +Originator: sawyer ( William Barton Sawyer) +Date: Sun Oct 20 00:53:30 MDT 2002 +Model: CAM +Version: CAM2.0.1 +One-line Summary: Bug fix for tracer advection (from S.-J. Lin) +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit +Changes to CLM land-model: None +Changes made: + + Retagged cam2_0_dev26 to confirm with new tagging scheme. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev26 +Originator: sawyer ( William Barton Sawyer) +Date: Fri Oct 18 07:48:14 MDT 2002 +Model: CAM +Version: CAM2.0.dev26 +One-line Summary: Bug fix from FVGCM for multiple advected constituents (S.-J. Lin) +cam-bugs Requests resolved: unlisted +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Lin +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + src/dynamics/fv/trac2d.F90: bug fix, dp2 copy to dp1 + moved from above label 5000 to between labels 5000 and 6000 + + bld/script.m4: changes to avoid runtime errors in DAO runs + which resulted from bug fix 64 (shell cmd now returns error code). + + Note: test-model.pl is successful but does not test the + multiple advected constituent case. This change will be + further tested by DAO runs. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev25 +Originator: erik ( Erik Kluzek) +Date: Wed Oct 2 08:33:38 MDT 2002 +Model: CAM +Version: CAM2.0.dev25 +One-line Summary: Fix run-pc.csh script. +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: Linux-PGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + +Fix run-pc.csh so will run without a core-dump on apache. To do this +I changed it from pur-SPMD to pure-OpenMP mode. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev24 +Originator: erik ( Erik Kluzek) +Date: Tue Sep 24 22:42:42 MDT 2002 +Model: CAM +Version: CAM2.0.dev24 +One-line Summary: Fix minor problems (tau units, SGI system call, FV array) +cam-bugs Requests resolved: 64,65,66 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! (SGI, IBM) +Machines tested: IBM, SGI, lf95, PGIF90, Solaris +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself,mvertens,boville (units) +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Use "C" wrapper for SGI system call +Changes made: + +Units change: (cam-bugs 66) + + Surface stress was identified as N, consistently use N/m^2. + +FV fix: (cam-bugs 65) + + Make cut array allocatable and dimension acording to npes. + +SGI System routine: (cam-bugs 64) + + Use a "C" wrapper to system call on SGI so that the return +code can be queried. + +INT long-name: + + Change long-name on PRECCINT and PRECLINT to note that to +get intensity (average precipitation of precipitating events), you +divide by PRECCFRQ or PRECLFRQ respectively. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev23 +Originator: eaton ( Brian Eaton) +Date: Fri Sep 20 15:41:12 MDT 2002 +Model: CAM +Version: CAM2.0.dev23 +One-line Summary: updates to User Guide +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: none +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + +Made changes to the sections on configuring and building CAM. Added new +material on the run scripts. Edited details of config files and make +procedure in appendix B. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev22 +Originator: rosinski ( Jim Rosinski) +Date: Fri Sep 20 14:50:14 MDT 2002 +Model: CAM +Version: CAM2.0.dev22 +One-line Summary: fix potential memory overwrite bug in radae.F90 +cam-bugs Requests resolved: 63 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +o Fixed potential memory overwrite bug in radae.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev21 +Originator: erik ( Erik Kluzek) +Date: Mon Sep 16 23:41:41 MDT 2002 +Model: CAM +Version: CAM2.0.dev21 +One-line Summary: Add new output fields: PRECCINT, PRECCFRQ, PRECLINT, PRECLFRQ, and Z050 +cam-bugs Requests resolved: 46, 61 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! (IBM) +Machines tested: IBM, SGI, Linux-PGI, Linux-Lahey, Solaris +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +New output fields and namelist items: + + PRECCINT, PRECCFRQ, PRECLINT, and PRECLFRQ. Precipitation that +exceeds a given threshold (PRECC_THRESH = 0.1mm/hr and PRECL_THRESH=0.05mm/hr +by default, both can be set on the namelist). + +Fix minor problem with FV with Lahey: + +Update ccsm scripts to ccsm2_0_beta54: + +Fix so Solaris would work: + + Reduce optimization level. + +Minor changes to test-production.pl: + + Remove files after completion, new reference simulation. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev20 +Originator: rosinski ( Jim Rosinski) +Date: Mon Sep 16 14:38:10 MDT 2002 +Model: CAM +Version: CAM2.0.dev20 +One-line Summary: Implement shared constants in ice code. NOTE: no control run for this tag yet exists. +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, PC +Ran test-model.pl script: not yet. +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode:no +Code reviewed by: myself +Restart files change: no +Changes answers: Yes (new-climate) +Changes to CLM land-model: None (one-line description) +Changes made: + +o Use shared constants in CSIM4 ice code. +o Have not yet run test-model, but will today. Wanted to get commit in + because folks are waiting for it. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev19 +Originator: eaton ( Brian Eaton) +Date: Sat Sep 14 10:24:24 MDT 2002 +Model: CAM +Version: CAM2.0.dev19 +One-line Summary: implement the Makefile SMP option for linux-pgf90 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: pc-linux-pgf90 +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + + Added SMP option to the pc-linux-pgf90 section of the Makefile. Set + the default value of SMP to true since that replicates previous Makefile + behavior (the -mp flags were hardwired into the pgf90 settings). But + note that the default in the configure script sets SMP false for pc-linux. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev18 +Originator: olson ( Jerry Olson) +Date: Fri Sep 6 17:29:17 MDT 2002 +Model: CAM +Version: CAM2.0.dev18 +One-line Summary: bugfix in sld/scan2.F90 +cam-bugs Requests resolved: none +Requires change in build system: no +(one-line description of changes: fixed treatment of non-advected tracers in sld/scan2.F90 +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: no +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + + sld/scan2.F90 was copying cloud water from one time level to + another. Loop was generalized to copy *all* non-advected + tracers. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev17 +Originator: sawyer ( William Barton Sawyer) +Date: Thu Sep 5 06:48:57 MDT 2002 +Model: CAM +Version: CAM2.0.dev17 +One-line Summary: Allowed 3 latitudes per process; improvements from fvgcm-1_3_71 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, S.-J. Lin +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + In src/dynamics/fv: + + spmd_dyn.F90 Test for >= 4 latitudes now + >= 3 latitudes per process; tested + 72x46x26 with 12 processes and + 144x91x26 with 24 processes. Works. + cd_core.F90 Integrated optimizations and restructuring + from fvgcm-1_3_71. Zero diff changes. + Note that some experimental changes + from FVGCM (HIGH_P, value of tau) + have not yet been integrated. + sw_core.F90 Now includes upol5, vpol5 + upol5.F90 Removed + vpol5.F90 Removed + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev16 +Originator: erik ( Erik Kluzek) +Date: Wed Aug 28 11:22:02 MDT 2002 +Model: CAM +Version: CAM2.0.dev16 +One-line Summary: Fix deadlock with scenario_so4, fix various bugs, + T85, T170 in scripts, update to clm2_3_dev32, ccsm2_0_beta53 +cam-bugs Requests resolved: 37, 49, 51, 52 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! (IBM) +Machines tested: IBM, SGI, Compaq, Solaris, PGF90 +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: update to clm2_3_dev32 +Changes made: + +Build changes: + + Fix bug in "configure -test", so that tests will be done +in cam_bld directory, and then return to pwd. Add ability to do +T85, and T170 resolutions. Change prun in CAM_lab.pm for running +in hybrid mode. + +History restart fix: + + History restart files weren't going to mass store -- now +they do. + +Decomposition set in phys_grid_init rather than in call to it: + + Previously there were four locations to determine the +chunking decomposition type. + + Also remove the "is_lsm" and "is_phys366" methods. Always +assume that lsm will ONLY be run with phys366 and CLM will ONLY be +run with the new physics. + +Update CLM to CLM2_3_dev32 + + This fixes a problem with getting clmi files at T170. + +Fix deadlock problem with scenario_so4: + + A parameter was only set on masterproc that needed to be +set on all nodes. + +Update to ccsm2_0_beta53 and scripts_a020822 + + both scripts and models/bld directories. scripts_a020822 fixes +a minor problem in ccsm2_0_beta53 scripts. + +Test scripts: + + Add test-example.pl script to run the examples from the +users guide. Does limited checking to ensure things work as expected. +This is setup to run on blackforest. + + Add ability to set the remote lab in the "-errgro" option +in test-model.pl. This allows for port validation for remote +machines. Also delete more files that test-model.pl produces when +running in the default "clean" configuration. This prevents having +lots of wasted disk space for test-model.pl tests. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev15 +Originator: sawyer ( William Barton Sawyer) +Date: Wed Aug 7 07:58:09 MDT 2002 +Model: CAM +Version: CAM2.0.dev15 +One-line Summary: Completed merge of fvgcm-1_3_56 te_map, cleaned up remaining t3/tvm arrays +cam-bugs Requests resolved: none +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + src/dynamics/fv: + + te_map.F90: completed merge of fvgcm-1_3_56 te_map.F90 + code is same except for 2D decomposition + additions + dynpkg.F90: removed tvm, tvmxy arguments (information is + in pt, ptxy) + dp_coupling.F90:Use pt/ptxy instead of t3/t3xy + stepon.F90: remove t3xy entirely, t3 from d_p_coupling + arguments + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev14 +Originator: sawyer ( William Barton Sawyer) +Date: Tue Aug 6 09:01:22 MDT 2002 +Model: CAM +Version: CAM2.0.dev14 +One-line Summary: Patched FV communicator bug in coupled mode; T3 reset to phys_state%t in p_d_coupling; config. improvments +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + models/utils/pilgrim: + + parutilitiesmodule.F90, mod_comm.F90: extended initialization + routines to accept an optional communicator from which + the FV global communicator is determined. + + models/atm/cam/bld + + configure_fv.pl, fvtest.sh, script.m4: for DAO + code execution, renamed run script fvcam.j, + number of threads, processes renamed to DAO + convention AGCM_N_PROCESSES, AGCM_N_THREADS_PER_PROCESS + + models/atm/cam/src/dynamics/fv + + dp_coupling.F90 : t3 reset to phys_state%t in p_d_coupling + (suggestion from Brian). + + stepon.F90 : modified arg list to p_d_coupling, removed + explicit transpose of T3XY->T3 for 2D decomp. + + spmd_dyn.F90 : pass mpicom to ParInit. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev13 +Originator: jet ( John Truesdale) +Date: Thu Aug 1 16:03:16 MDT 2002 +Model: CAM +Version: CAM2.0.dev13 +One-line Summary: Fix initialization problem with fractional land, doesn't affect climate, only for CAM not CCSM +cam-bugs Requests resolved: 43 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: no (does all of the following tests) +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: Yes ( new-physics) +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Changes made: +initext now uses the ts value from the land initialization routine instead +of the value returned from the update surface fluxes routine. I added an +array to save off these values and apply them after iceint is called. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev12 +Originator: erik ( Erik Kluzek) +Date: Wed Jul 31 14:20:10 MDT 2002 +Model: CAM +Version: CAM2.0.dev12 +One-line Summary: Add 2D-decomp for FV to bld, Fix Solaris climate, add production test, add timing parser, fix various bugs +cam-bugs Requests resolved: 17, 20, 27, 30, 31, 33, 35, 36, 37, 39 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: yes + (makes use of the _OPENMP CPP token when SMP on, compiler options + must set this) +Substantial timing or memory changes: no +Requires change in run script: Yes + (dif4 now required on namelist if Eulerian and not T42) +Tested to work coupled with CCSM: Yes! (IBM) +Machines tested: IBM, SGI, Solaris, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +FV 2D parallel decomposition option added to bld scripts: + + Requires a new namelist (mprun2d). + Also added a "-fv2d" option to test-model.pl to run fv tests + with 2D decompostion. Also fix the constraint in src/dynamics/fv + so that the npr_yz array from the namelist is checked properly. + +Solaris: + Change Makefile so that model gives climate similar to IBM. + +Makefile: + Add CPPDEF for CPP definitions used by all platforms. Also + include a new token "CAM" declared when compling code with CAM. + Remove "-d" on AIX, and turn on "-g, -qfullpath" in + production mode so that when the model core-dumps you can + query the core files to find where it died. + +dif4: + Now require dif4 to be set on namelist for Eulerian dynamics not + at T42 resolution. + +restart-pointer files: + Get rid of getfil for restart-pointer file and add an optional + argument to opnfil, so that "old" can be given for type so that + the model will die if a restart pointer file doesn't exist. + +Fix some problems with using scenario_so4: + Fix write statements before "call endrun" so that they will be + written even if not on masterproc. Also broadcast sulfdata to all + nodes. There still seems to be other problems with this configuration. + +namelist: + Fix namelist parsing so that repeat declarations can be used + (i.e. mfilt = 4*1). Also update the change method so that it parses + as a regular namelist which allows arrays to be entered and more + complex namelist entries. +test/system: + Add ccm366 test and SMP=FALSE test to test-model.pl (unless on + AIX, ensure that SMP test gives same answers as SPMD). Add "-fv2d" + option to test-model.pl to check FV 2D decompostion. Add some simple + performance checking to test-model.pl. Add test-production.pl + a script to run the production model from Sep to Feb/1 weekly + to ensure the model is running as expected. + +check-timing.pl: + Add a script to do straight forward parsing of timing.* files to + look at performance. Simplist operation is as follows: + + check-timing.pl directory1 directory2 + + Options also exist to load the log-files in, and casenames, as + well as a list of timers to parse in the file. To get help invoke + it with "-help" or without any arguments. + +ESMF: Update to ESMF_0_0_2p5 (fixes problem with compiling on Sanitas) + This small update changes the name of "conf.h" to ESMF_conf.h + so that it won't find the wrong file in the search path. It also + removes the hard-wired use of /usr/local/include. Also previous + model versions didn't have all files updated to ESMF_0_0_2p4, and + this update fixes that problem. + +FV now passes LF95 strict checking tests with test-model.pl: + + Arrays in restart_physics:write_restart were going over pcols + rather than cols for FV. By having the arrays only go to ncols + this worked with LF95 and FV. + +phys_grid.F90: + Change a difficult to understand OMP loop used to get the + number of threads to a more straight-forward OMP subroutine call. +CCSM: + Update to ccsm2_0_beta50. Add table for dif4 to atm.setup.csh. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev11 +Originator: sawyer ( William Barton Sawyer) +Date: Tue Jul 30 09:22:20 MDT 2002 +Model: CAM +Version: CAM2.0.dev11 +One-line Summary: te_map.F90 aligned with latest FVGCM version; optimizations: overlapping communication/computation +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, W. Putman +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + src/dynamics/fv/te_map.F90 + + o Removed CPP token OLDWAY + o Aligned with latest FVGCM version + o Restructured communication (particularly for 2D + decomposition) to overlap communication with computation + as much as possible. Slight performance gains conceivable. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev10 +Originator: sawyer ( William Barton Sawyer) +Date: Mon Jul 15 10:20:32 MDT 2002 +Model: CAM +Version: CAM2.0.dev10 +One-line Summary: Merged latest work from DAO FVGCM version fvgcm-1_3_44 +cam-bugs Requests resolved: none +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Lin, Putman, Shen +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + atm/cam/src/dynamics/fv + + sw_core.F90, tp_core.F90, upol5.F90, vpol5.F90 -- + changes by Putman allow runs with only 3 + latitudes per PE + + trac2d.F90 -- cache optimizations by Lin for tracer advection + + utils/pilgrim + + mod_comm.F90 -- latest version from FVGCM + Makefile.conf.IRIX64 -- support recent change #include + unit_testers/Makefile rather than #include "file.h" + + atm/cam/test/system + + dao_batch.csh -- batch script to run test-model.pl on DAO + machines (currently tropic and dycore) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev9 +Originator: sawyer ( William Barton Sawyer) +Date: Thu Jul 4 14:12:43 MDT 2002 +Model: CAM +Version: CAM2.0.dev9 +One-line Summary: Bug fixes for 2D domain decomposition, LF95 strict error checking +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + + in src/dynamics/fv: + + inidat.F90 : chunking patch suggested by Pat Worley + + restart_dynamics.F90: bufres now allocated on all PEs + (for LF95 strict error checking) + + sw_core.F90, tp_core.F90 : revision by S.-J. Lin + crx in tpcc now ghosted +/- ng_c latitudes + + benergy.F90, cd_core.F90, trac2d.F90, uv3s_update.F90: + fix for 2D domain decomposition on IBM -- + pole PEs now do not accidently send data + to lower or upper levels. Code still does + not work on all IBM 2D configurations but + it is getting closer. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev8 +Originator: sawyer ( William Barton Sawyer) +Date: Mon Jun 24 02:12:01 MDT 2002 +Model: CAM +Version: CAM2.0.dev8 +One-line Summary: FV patches for Lahey strict error checking +Requires change in build system: no +ubstantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + src/dynamics/fv: + + mapz_module.F90:Q2 now INOUT in map1_ppm, mapn_ppm, + because Q1 (IN) and Q2 (was OUT) + were being passed same array + + sw_core.F90: crx now declared (im,jfirst-ng_d:jlast+ng_d) + passed to tpcc crx(1,jfirst-ng_d). + No error when ng_d == 0 (SMP-only) + + tp_core.F90: In tpcc, dummy argument crx now declared + crx(im,jfirst-ng:jlast+ng). No error when + ng (== ng_d) == 0. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev7 +Originator: erik ( Erik Kluzek) +Date: Thu Jun 20 23:48:55 MDT 2002 +Model: CAM +Version: CAM2.0.dev7 +One-line Summary: #include "" to <>, Fix Solaris make, Fix SLD for Lahey, change coupled restarts, fix sort, update csm_share/bld/scripts, fix clm restart +cam-bugs Requests resolved: 19, 18, 25, 26 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes! (IBM, restarts tested as well) +Machines tested: IBM, SGI (some testing on Solaris, and Linux/Lahey) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, olson (sld) +Restart files change: yes (but only if COUP_CSM set) +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Fix restart pointer files for long casenames +Changes made: + +SLD changes for Lahey strict error checking: + + Small changes to q arrays sent to a few routines so that + dimension of arrays would pass strict error checking in Lahey + compiler. + +Restarts: + + Change restarts when running coupled (COUP_CSM on), so that + data not used for coupled runs not output/read. This also allows + model to use the restart files from the b20.007 simulation. + +Sort routines: + + Change sort routines in responce to bug found by Phil Rasch. + +csm_share: + + Update csm_share to share2.1.3. + +Misc: + + #include "" to #include <> + Initialize ctitle and let it be up to 256 characters. + Put "if (masterproc)" around write(6 statements for ramping. + test-model.pl, get rid of global data used for setting up tests. + Replace it with methods. This is a better more robust solution. + Add -qfullpath when debug on for IBM. + Update models/bld, and scripts directories to ccsm2_0_beta47. + Get coupled scripts to work with CAM directory structure, and + change so that restart can work. + +CLM: + Don't limit length on string read in from restart pointer file, + as this causes problem when casenames are long. + +Solaris: + + Change Makefile so that model will work, get rid of special + F77 compilation and use new autopromotion flag in the new compiler. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev6 +Originator: mvertens ( Mariana Vertenstein) +Date: Thu Jun 20 15:31:15 MDT 2002 +Model: CAM +Version: CAM2.0.dev6 +One-line Summary: put chunking into coupled model +Requires change in build system: no +cam-bugs Requests resolved: 24 +(See http://www.cgd.ucar.edu/cgi-bin/wreq/req?list-5) +Substantial timing or memory changes: Yes + (significant performance improvement when chunking is turned on) +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI +Ran test-model.pl script: no (does all of the following tests) + Changes only affected coupled model model +Code reviewed by: myself, erik +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + + Put chunking into coupled model + + Verified bfb with ccsm2_0 and that PCOLS=16 and PCOLS=128 was bfb the same + on the SGI and IBM in coupled mode + + Verified that coupled model restarts and branches correctly + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev5 +Originator: eaton ( Brian Eaton) +Date: Wed Jun 19 19:49:37 MDT 2002 +Model: CAM +Version: CAM2.0.dev5 +One-line Summary: build procedure mods, memory allocation mods +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Erik +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + + Remove ccm366/cldwat.F90 - not used + + Add capability to bld/build-namelist to build LSM namelists + + bld/configure + Add -[no]smp option + Add -pcols option + + Makefile: + Add SMP macro to allow enabling/disabling openMP without having + to edit Makefile. Currently only implemented for AIX and SGI. + Get rid of the -macro_expand option to SGI f90 because + it's not needed when you use -cpp. + + physics/cam1/phys_grid.F90 - move globalfield allocation from stack to heap + in write_field_from_chunk and read_chunk_from_field + + dynamics/{eul,fv,sld}/stepon.F90 - move stack memory allocation of + 3-D physics and dynamics data structures to heap + + models/ice/csim4/ice_tstm.F - change first character of comment lines + starting with c to ! + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev4 +Originator: erik ( Erik Kluzek) +Date: Sat Jun 15 08:04:21 MDT 2002 +Model: CAM +Version: CAM2.0.dev4 +One-line Summary: Remove precision module, and use csm_share/shr_kind_mod + instead with renames to r8,r4,i8 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, eaton +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes, same change to precision as above. +Changes made: + +Precision change: + + Remove precision module and use csm_share shr_kind_mod module + to get precision types. Use the rename feature to get the names + that were used in the precision module. + +Tools change: + + Make same change to the tools: cprnc, definesurf, interpic, mkrgrid, + and cprlndnc. In this case keep a local copy of shr_kind_mod for + their use. Made sure each tool changed would build after the change. + +Bug-Fix: + + Added definition of CPP_INTEGER4 to pilgrim.h as was needed to + get fv to build. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev3 +Originator: sawyer ( William Barton Sawyer) +Date: Thu Jun 13 07:39:36 MDT 2002 +Model: CAM +Version: CAM2.0.dev3 +One-line Summary: Solved SUN compilation problem; further merging of FVGCM into CAM; bug fix for SMP-only +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, SUN +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Putman, Mirin +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + models/atm/cam/bld: + configure_fv.pl, script.m4, revised for cam2_0 data sets (Mirin) + + models/atm/cam/src/dynamics/fv: + + pft_module.F90 : merged from FVGCM (minor additions) + sw_core.F90 : merged from FVGCM + cd_core.F90 : bug fix in call of c_sw + modified to use pft_module and sw_core + + models/atmlnd_share: + + precision.F90 : added i4 needed by DAO (mod_comm) + + models/utils/pilgrim: + + mod_comm.F90 : fixed SUN compilation problem, upgrade (Putman) additions for STAND_ALONE mode (Sawyer) + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev2 +Originator: sawyer ( William Barton Sawyer) +Date: Tue Jun 4 09:40:49 MDT 2002 +Model: CAM +Version: CAM2.0.dev2 +One-line Summary: Merge of FVGCM (DAO) software engineering improvements into CAM2 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM (test-model.pl) SGI (DAO A26, B26 cases) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Bill Putman, others +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + + This merges cam1_8_dev6_brnch_fvgcm_merge with cam2_0_dev1. + + models/utils/pilgrim: + + Newest version of mod_comm (but does not yet solve + real -> real(r8) promotion problem on SUN). + Upgrade of other modules for use in CAM-DAS + restructuring and upgrades of unit testers. + + models/atm/cam/src/dynamics/fv: + + Software engineering improvements from FVGCM (DAO) + + benergy.F90 cd_core.F90 d2a3dijk.F90 d2a3dikj.F90 + dp_coupling.F90 dynpkg.F90 highp2.F90 hswf.F90 + p_d_adjust.F90 te_map.F90 trac2d.F90 uv3s_update.F90 + use new mod_comm interface. + + mod_mpi.F90 removed. + + mapz_module.F90 consolidates vertical interpolation routines: + kmppm.F90 map1_ppm.F90 map3_ppm.F90 ppm2m.F90 steepz.F90 + + inidat.F90 initcom.F90 pmgrid.F90 spmd_dyn.F90 trunc.F90 + minor structural changes + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam2_0_dev1 +Originator: erik ( Erik Kluzek) +Date: Mon Jun 3 14:10:23 MDT 2002 +Model: CAM +Version: CAM2.0.dev1 +One-line Summary: Fix test-model.pl problems, fix problems running Lahey + for Eul dy-core, add T31 namelist options +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM (some testing on Linux with Lahey--lf95) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +T31: + + Add namelist options and datasets needed to run T31. + +test-model.pl + + Fix a couple problems with test-model.pl. Will now properly +run through the list of all dynamics. Start refactoring to a more +general way to run through the tests with object methods rather than +global data. Put quotes around run env variables, allow setting of +interactive option in CAM_namelist, make sure CAM objects have everything +properly set withe either setenv or setcfg. + +Lahey fix: + + A few changes to dynamics/eul so that qfcst arrays can be properly +dimensioned. Inside spegrd and tfilt_massfix copy qfcst from i1 to nlon+i1-1, +so that strange things with memory don't have to be done. This allows +tests 1 and 2 with test-model.pl to work for Eulerian dynamics. Test 13 fails. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev11 +Originator: erik ( Erik Kluzek) +Date: Fri May 17 10:37:16 MDT 2002 +Model: CAM +Version: CAM1.8.dev11 +One-line Summary: License update, icefrac bug-fix, build fixes, dataset name changes, fix test-model.pl so that validation could be done +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes + (dataset names change) +Tested to work coupled with CCSM: yes! (IBM) +Machines tested: IBM, SGI, Linux-PC-PGI + (some testing on Compaq, Linux-Lahey, and Solaris) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +License update: + Update to CAM license as reviewed by Bill Collins and Catherine + Shea (NCAR lawyer). + +icefrac bug-fix: + Fix problem introduced in cam1_8_dev10 on initialization of + icefrac. + +Build fixes: + Various fixes to build scripts to work on machines at ORNL. + +Name changes: + + Dataset names change to be consistent with the following format: + + _YYYY-MM-DD__L__.nc + + resolution for spectral dycores is refered to as nlatxnlon, with + the spectral truncation following. So for example, Eulerian T42 is + refered to as: 64x128_T42, SLD T63 is 64x128_T63. Datasets that + don't have a specific spectral truncation associated with them + leave off the spectral truncation part (so initial datasets run + through definesurf or most land datasets). + + Example: + + cami_0000-09-01_64x128_L26_c020514.nc + +test-model.pl + + Fix test-model.pl so that release version of the model could be + validated. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev10 +Originator: erik ( Erik Kluzek) +Date: Mon May 13 12:01:17 MDT 2002 +Model: CAM +Version: CAM1.8.dev10 +One-line Summary: Replace Numerical-Recipe code, Lahey fixes for multiple constituents, Update to ccsm2_0_beta45, update to clm2_3_dev30, some Solaris and Compaq fixes +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes +Machines tested: IBM, SGI, Linux-PGI, Linux-PGI/GCC + Some testing with Solaris and Compaq, but not everything works. +Ran test-model.pl script: yes (does all of the following tests) + (test-model.pl currently broken test-model ran with previous version) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Update to clm2_3_dev30 +Changes made: + +Known problem: + This model core-dumps in the standard configuration due +to a problem with the initialization of icefrac. + +Lahey fixes: + + Do some fixes for strict error checking with Lahey compiler when +using multiple constituents. + +Numerical Recipes sorting routines replaced: + + Numerical Recipes routines CAN NOT be publically released, so +they were replaced by Tony Craig's implementation of the same alogrithm. + +cprnc: + + Fix cprnc so it would work on Solaris. Solution was a Kludge to +get it to work. More work should be done to find the underlying problem. + +CCSM2_0_beta45 update: + + Update models/bld and scripts to ccsm2_0_beta45. + +CLM2_3_dev30 update: + + Update CLM to clm2_3_dev30. + +test-model.pl + + With the new build stuff in place test-model.pl is currently +broken. It will be fixed as soon as possible (which may be after the +model release). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev9 +Originator: eaton ( Brian Eaton) +Date: Mon May 13 11:22:15 MDT 2002 +Model: CAM +Version: CAM1.8.dev9 +One-line Summary: merge newbld branch +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: none +Ran test-model.pl script: no - it's officially broken +Tested on fv dynamics: no +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: no +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself, Erik +Restart files change: no +Changes answers: no +Changes to CLM land-model: None (one-line description) +Changes made: + +Added new build scripts and user docs. + +atm/cam/bld/configure produces the Filepath, misc.h, params.h, preproc.h files, +and a Makefile. + +atm/cam/bld/build-namelist produces a namelist file + +test-model.pl is currently broken because Erik's mods to have it use CAM_namelist.pm +have not been completed. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev8 +Originator: erik ( Erik Kluzek) +Date: Wed May 8 17:41:26 MDT 2002 +Model: CAM +Version: CAM1.8.dev8 +One-line Summary: Fix CCSM restart problem +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes! IBM +Machines tested: IBM +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes (eul coupled only) +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + +Fix problem where restarts when running coupled were not bit-for-bit. +All changes are isolated to ccsm_msg.F90. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev7 +Originator: jet ( John Truesdale) +Date: Wed May 8 16:22:05 MDT 2002 +Model: CAM +Version: CAM1.8.dev7 +One-line Summary: definesurf to extend ross ice shelf by default, clean up csim error messages +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no or Yes (describe) +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: yes +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Restart files change: no +Changes answers: no +(Note: test-model.pl only does checks this -- if you run it with the "-compare" option) +Changes to CLM land-model: None (one-line description) +Changes made: +Fix to definesrf to make it extend ross ice shelf by default. Non-land +below S79 is set to land so that land will treat the area as glacier. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev6 +Originator: sawyer ( William Barton Sawyer) +Date: Wed May 8 07:59:26 MDT 2002 +Model: CAM +Version: CAM1.8.dev6 +One-line Summary: FV patches to help pass lf95 strict error checking, Erik's fix of tphysbc.F90 to pass FV test 1 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI, Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, erik +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + + bld: configure_fv.pl and script.m4 upgraded for cam1_8 + + src/physics/cam1: tphysbc.F90 fix by Erik to pass FV test 1 + + src/dynamics/fv: + + avgc.F90 : retired + cd_core.F90 : inlined avgc.F90 + dp_coupling.F90 : intent(inout) u3s (it's updated during ghost) + dynamics_vars.F90: temporary arrays allocated for SPMD only + dynpkg.F90: 2D decomposition arrays now allocated consistently + pmgrid.F90: initialize 2D decomp variables for non-2D case + stepon.F90: 2D decomposition arrays now allocated consistently + + utils/pilgrim: + + mod_comm.F90: intent(inout) q in BufferUnPack*D + +Note: it will pass lf95 strict error checking in SPMD mode on Linux + only if following routines are compiled with DEBUG FALSE: + fv_prints.F90, restart_dynamics.F90 and restart_physics.F90. + Strict error checking yields errors in those routines which + may be related to the chunking mechanism. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev5 +Originator: erik ( Erik Kluzek) +Date: Tue May 7 13:03:41 MDT 2002 +Model: CAM +Version: CAM1.8.dev5 +One-line Summary: Fix problem with restarts when running coupled. +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: yes! IBM (full "K" test suite) +Machines tested: IBM +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: No -- not when running coupled! +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + +Change ONLY ccsm_msg.F90 so that restarts would work. Ran the +full CCSM test GUI on the BIM (blackforest). + +This version has a bug in it where restarts are not exact when +running coupled. This problem is fixed in cam1_8_dev8. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev4 +Originator: rosinski ( Jim Rosinski) +Date: Thu May 2 15:12:01 MDT 2002 +Model: CAM +Version: CAM1.8.dev4 +One-line Summary: xlf90 bugfix for h_override. make clean deletes esmf. flint complaints. modified timing calls. Added lf95 to definesurf makefile. +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None (one-line description) +Changes made: + +o Bug in xlf90 caused h_override to behave improperly. +o "make clean" now deletes esmf/ directory as well as .o, etc. files +o Fixed some flint complaints. +o Added lf95 entry to definesurf makefile. +o Modified some of the calls to the timing library. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev3 +Originator: erik ( Erik Kluzek) +Date: Wed May 1 22:25:25 MDT 2002 +Model: CAM +Version: CAM1.8.dev3 +One-line Summary: Output field changes, cam1 to cam2, FLAND to LANDFRAC, + fix vertinterp, longname for constituents +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: yes + (Restart pointer files are now cam2 instead of cam1, restart files have cam2 in name) +Tested to work coupled with CCSM: Yes! (SGI and IBM) +Machines tested: IBM, SGI, Linux-PGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens (and input from wcollins, pjr, and boville) +Restart files change: no +Changes answers: no (bit-for-bit) (although DTCOND different) +Changes made: + +Output field changes: + + DTCOND -- Changed to be defined by dry static energy instead of + temperature to be more consistent with current alogrithms. + This change is from Fabrizio Sassi. + New fields: + WSPEED -- Wind speed (default maximum) + FSDSC --- Clearsky downwelling solar flux at surface + PRECTMX - Maximum precipitation rate + (Add above to monthly files) + Put TREFMNAV and TREFMXAV on output monthly files for non-coupled case. + + These changes are in ccsm-bugs as request 19. + +Change instances of cam1 to cam2: + + Change occurances of cam1 to cam2 in output file names and code comments. + +FLAND on initial files is now LANDFRAC: + + Have initial files that are produced use the name LANDFRAC instead +of FLAND to be consistent with history files. This also put attributes on +the field which didn't happen with the FLAND name. For backwards compatability +allow the names on the initial files to be either LANDFRAC or FLAND. + +vertinterp: + Apply a fix to vertinterp as found by Art Mirin. This fixes a problem + if the interpolation pressure happens to exactly equal the pressure + at a data-point. Recorded in ccsm-bugs as request 29. + +Constituents module now has longname data element: + + Add longname to constiuents module and set it as an optional argument + in add_cnst. When add_cnst called if appropriate set longname to + something useful. + +Coupled: + Change scripts to look at inputdata/atm/cam2 input directory. + Fix log-file output problem by adding a if( masterproc) on + the "stopping at end of day" print. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev2 +Originator: erik ( Erik Kluzek) +Date: Sat Apr 27 09:39:39 MDT 2002 +Model: CAM +Version: CAM1.8.dev2 +One-line Summary: Update to cam1_8_dev1_brnchT_esmfup4 -- + Update to ESMF_0_0_2p4, clm2_3_dev29, ccsm2_0_beta41, simple fixes, + nix scatter/gather aliasing for CCSM +Requires change in build system: Yes (ESMF build changes) +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! (SGI and IBM) +Machines tested: Some testing on all platforms: + IBM, SGI, Compaq, Solaris, Linux-PGI, Linux-Lahey, Linux-PGI/GCC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Update to clm2_3_dev29 +Changes to ESMF: Update to ESMF_0_0_2p4 +Changes made: + +ESMF update: Update to newer version of ESMF with name changes from + mf_ to esmf_. The newer ESMF simplifies the build by not needing + dependence on OMP or MPI, so nothing is referenced outside the + ESMF distribution. + +CLM2 update: Update to clm2_3_dev29 which works with ESMF version above. + +CCSM Update: Update models/bld and scripts directories to ccsm2_0_beta41 + version of the scripts. Also put PCOLS define in CCSM scripts rather + than hardcoded in ppgrid.F90. Ran csm.csh test on babyblue and utefe. + Bit-for-bit with non-SPMD version and bit-for-bit with previous + model. + +CCSM Scatter/Gather aliasing: Get rid of the aliasing (using the same array + for input and output) in the mpigather and mpiscatter calls in + ccsm_msg.F90. In the process create a new allocatable array allocated + on masterproc and an old array allocatable so that only dimensioned + from beglat:endlat. This reduces the total amount of memory needed + for the mpi scatters and gathers. + +Solaris: Fix a couple subscript problems caught on solaris in history.F90. + Then as a particularly difficult problem was caught, turn subscript + checking off for solaris when DEBUG=TRUE. + +phys_grid.F90: Get updates from Pat Worley and Art Mirin to generalize + phys_grid.F90 in cam1 for odd numbers for FV dynamics. Tried same + routine in ccm366 physics, but results in problems. + +ORNL -Colt: Add settings needed to CAM_lab.pm to run on colt.ccs.ornl.gov. + +Testing: Ran at least some test-model.pl tests on all platforms: + + Linux-PGI (Apache, longs), Linux-Lahey (Apache, compile test on longs) + Linux-PGI/GCC (Apache, longs), SGI (utefe), IBM (babyblue, eagle@ornl), + Solaris (sanitas, test 1 works), Compaq (colt@ornl tests 2-5 with SPDM off) + + There are problems with some of the standard tests in test-model.pl + on particular platforms. These problems will need to be cleanup in + before model release. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_8_dev1 +Originator: erik ( Erik Kluzek) +Date: Mon Apr 22 13:11:18 MDT 2002 +Model: CAM +Version: CAM1.8.dev1 +One-line Summary: Move cam1_7_dev34_brnchT_fractional_8 branch to the development branch +Requires change in build system: Yes! + Filepath requires new directories +Substantial timing or memory changes: Yes (running with new ice-model is slower) +Requires change in run script: Yes + New set of SST and Initial condition files are required. +Tested to work coupled with CCSM: Yes! (IBM and SGI) + (bit-for-bit with ccsm2_0_beta38) +Machines tested: IBM, SGI, Compaq, Sun, Linux-Lahey, Linux-PGI + (Sun compiles but doesn't run, Compaq core-dumps on error-growth + test, Linux-PGI core-dumps on error-growth test with fv dynamics) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, John Truesdale, Mariana Vertenstein, Jim Rosinski +Restart files change: yes! +Changes answers: new-physics +Changes to CLM land-model: Interface changes +Control cases: + /EATON/csm/fv2x-fland05 -- Finite-Volume with PCMDI SST's. + /JET/csm/sldnewicefrac01 -- SLD dynamics with PCMDI SST's. + /ROSINSKI/csm/newsstclim03 - Eulerian dynamics with Hurrell + Hadley Center OI / Reynolds blended SST data climatology. + /ROSINSKI/csm/newsstamip02 - Eulerian dynamics with Hurrell + blended monthly SST data. +Changes made: + +Physics: + + Fractional land and ocean: Old binary ORO flag is gone replaced + by the fractions: landfrac, icefrac, and ocnfrac. Also the old + flag on SST datasets is done away with and ice-cov is used for + sea-ice concentrations. comsrf.F90 was reworked as part of this change. + Also the offline tool "definesurf" was changed to work with the + new datasets. "interpic" continues to work with IC files as well. + + New ice-model: A modified version of the CCSM Sea-Ice model + Community Sea-Ice Model (csim4) is included with the model + now in the "models/ice/csim4" directory. The old ice-model is + included in the new directory "models/atm/cam/src/ocnsice/dataicemodel". + +CCM3.6.6 Physics: + + The CCM3.6.6 physics is still supported although now it can ONLY + be run with Eulerian dynamics/LSM and the old data ice/sst model. + The old version of the data ice model codes are in the "physics/ccm366" + directory. + +Namelist changes: + + prognostic_icesnow -- If TRUE determine snow-depth over ice prognostically + otherwise use a climatology. + reset_csim_iceprops -- Reset the CSIM ice-model initial properties + (used on a new initial run if the model blows up). + +Script / Makefile changes: + + Filepath, datasets and new variable "ICEMODEL" added to deal with + the two ice-models (CSIM4 or CCMDATA). Lahey error-checking added + to Makefile. Initial datasets now require the land-fraction on + them in the variable "FLAND". When using the new ice model + SST datasets are required to have the variables "SST_cpl" (for SST), and "ice_cov" for sea-ice concentration. + + "NEWBUILD=TRUE" option now the only way to use the standard makefile. + The old "makdep" dependency generator logic ripped out of the Makefile + and deleted from the "tools/makdep" directory. + + Users guide updated to reflect changes. DatasetLog updated with + new datasets. + +New datasets: + To obtain the new tar-ball of datasets: + + ftp ftp.cgd.ucar.edu + cd pub/erik + bin + get cam1_8.scidac-atm.datasets.tar.gz + +Error-growth: + + Error-growth is much faster than previous versions of the model. + Error-growth is still high using the dataicemodel and active-land. + Using prognostic_icesnow=.false. improves error-growth, and using + standard T42L26 datasets provides reasonable error-growth. Also + running error-growth with aqua_planet on provides reasonable error-growth. + +Coupled model: + + landfrac, and ocnfrac are now binary values of 0.0 or 1.0 in + accordance to how ORO was previously assigned in the model. This + should eventually be changed to use the values the coupler send + explicitly. + +test-model.pl: + + Change restart tests to restart after 5 time steps. + Change error-growth full-physics test to use prognostic_icesnow=.false. + and aqua_planet=.true. and use date from dataset rather than Dec/31. + Delete the SOM test and add a new test to make sure using the + dataicemodel works. + Fix problem with recognizing old files. + +interpsst gone: + + The old tools/interpsst code removed as it will not work with the + new SST files. Also new tools for creating SST datasets are in + development. The new tools use the Hurrell SST datasets and also + modify data so that when a linear time-interpolation is applied + to the mid-monthly datapoints the observed monthly average is + reconstructed. It's unclear when the new tools will become part + of the distribution. + +Changes to make most of the model Lahey compliant: + + Small changes to large amounts of the code so that strict error-checking + with the Lahey compiler can be performed on most of the model. The + files: binary_io.F90, wrap_nf.F90, wrap_mpi.F90 have not been converted. + As part of this change the routines bouyan, and cldprp where moved + to inside the zm_conv.F90 file. + +Bug-fixes: + + Fix in phys_grid.F90 for SGI. + Fix in filenames.F90 for IBM. + +Known problems: + + IBM -- history.F90 still doesn't always compile when DEBUG=TRUE. + Compaq -- Model core-dumps with "floating invalid" when running + error-growth test on Compaq (Colt @ ORNL) + The model compiles but has trouble running on the Sun. Subscript overflow + problem when running compiler checking (Sanitas @ NCAR). + Linux-PGI -- fv: When running FV dynamics and Error-growth the model + aborts with an error + "DEALLOCATE: memory at 43d18c10 not allocated" + (Apache @ NCAR) + + SOM -- New model does not work with the slab-ocean model. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev34 +Originator: rosinski ( Jim Rosinski) +Date: Fri Mar 29 16:44:22 MST 2002 +Model: CAM +Version: CAM1.7.dev34 +One-line Summary: Bugfix to tphysbc.F90 to keep uninitialized data (in ptend) from being used. +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, PC +Ran test-model.pl script: yes (does all of the following tests) + NOTE: fv tests on IBM failed for both this commit and the comparison + previous library due to compiler bugs. But all ran OK on PC. +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) presuming the short tests are sufficient to ensure no garbage + from stack being used +Changes to CLM land-model: None +Changes made: + +o Contents of local variable ptend in tphysbc were being used uninitialized. No ill symptoms were + noticed in the dev branch, but the fractional branch was randomly seg faulting or encountering + a floating point error when restarting on 16 nodes on blackforest. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev33 +Originator: pworley ( Patrick H Worley) +Date: Tue Mar 12 14:30:32 MST 2002 +Model: CAM +Version: CAM1.7.dev33 +One-line Summary: load-balanced physics option; PCOLS cpp token for setting pcols; SOM chunking bug fix +Requires change in build system: yes +PCOLS cpp token required to set pcols in ppgrid.F90. params.h.in.csh modified to do this automatically. +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM and Compaq at ORNL +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and Marcia Branstetter +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +1) Changed phys_grid_init call. Instead of specifying number of + columns per chunk, now specify number of chunks per thread. + This then sets the number of columns per chunk appropriately, + guaranteeing that the same number of chunks can be assigned + to each processor. Files affected: + + control/restart.F90 + control/wrap_mpi.F90 + dynamics/eul/inital.F90 + dynamics/sld/inital.F90 + dynamics/fv/inital.F90 + physics/cam1/phys_grid.F90 + physics/ccm366/phys_grid.F90 + +2) Augmented physics domain decomposition options: + opt == -1: same as before (latitude-slice chunk, for compatibility + with ccm366 physics, lsm1, and CSM) + opt == 0: For a given MPI process, all chunks have the same number + of columns, and each thread associated with a process has + the same number of chunks. Columns are assigned to chunks + to improve load balance between chunks (compared to + the default ordering), but without requiring + interprocessor communication in dp_coupling. + opt == 1: All chunks have the same number of columns and each + thread has the same number of chunks, across all MPI + processes. Columns are assigned to chunks to balance + day/night, summer/winter "static" load imbalances. + Chunks are assigned to processes to minimize interprocessor + communication in dp_coupling, but it will occur + anyway unless the dynamics decomposition is compatbile. + Files affected: + + + dynamics/eul/dp_coupling.F90 + dynamics/eul/dyn_grid.F90 + dynamics/eul/inital.F90 + + dynamics/fv/dp_coupling.F90 + dynamics/fv/dyn_grid.F90 + dynamics/fv/inital.F90 + + dynamics/sld/dp_coupling.F90 + dynamics/sld/dyn_grid.F90 + dynamics/sld/inital.F90 + + physics/cam1/phys_grid.F90 + physics/ccm366/phys_grid.F90 + + control/wrap_mpi.F90 + control/restart.F90 + +3) Added PCOLS cpp token, used to set pcols parameter in ppgrid.F90 . + When running coupled, pcols (still) set to PLOND. params.h.in.csh + modified to set PCOLS default, taking care of LSM1 and CCM366 physics + special cases. (Code courtesy of Erik Kluzek.) + + Files affected: + + ../bld/README + ../bld/params.h.in.csh + physics/cam1/ppgrid.F90 + physics/ccm366/ppgrid.F90 + +4) Fixed chunking bug in SOM. Files affected: + + ocnsice/som/somoce.F90 + ocnsice/som/srfsomi.F90 + ocnsice/som/srfsomo.F90 + ocnsice/som/srftsbi.F90 + +5) Miscellaneous clean-up (removing pchnk and pchnkd parameters, + renaming a phys_grid routine). Files affected: + + physics/cam1/physgrid.F90 + physics/cam1/ppgrid.F90 + physics/cam1/cldwat.F90 + physics/ccm366/physgrid.F90 + physics/ccm366/ppgrid.F90 + control/history.F90 + + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev32 +Originator: erik ( Erik Kluzek) +Date: Thu Mar 7 23:00:41 MST 2002 +Model: CAM +Version: CAM1.7.dev32 +One-line Summary: Bug-fix to cam1_7_dev30 snowfall rates, also fix interpret_filename_spec +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! +Machines tested: IBM, SGI (some testing on Linux, SunOS as well) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, tcraig +Restart files change: no +Changes answers: Yes (fixes bug from cam1_7_dev30 where everything appears as snow) +Changes to CLM land-model: fix problem where numpatch was "use"'d twice +Changes made: + +tphysbc.F90: + + Fix bad merge from cam1_7_dev30 that caused all precipitation to fall +as snow. + +filenames.F90: + + Check if prev is present before using. Without this the SGI and Compaq +would seg-fault when running the model. + +test-model.pl: + + Fix problem in test 6. Tests skipped don't build-namelist. + +run-model.pl: + + Don't resubmit till year 1 after first simulation. + +clm: + + Fix double "use" of numpatch. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev31 +Originator: mirin ( Arthur Andrew Mirin) +Date: Thu Mar 7 10:11:37 MST 2002 +Model: CAM +Version: CAM1.7.dev31 +One-line Summary: Completed full history capability for 2D FV decomposition +Known bug: All precipitation appears as snowfall! +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Added 32-bit accumulation buffers and initial history file capability for 2D FV decomposition. This involved a number of changes to history.F90, minor changes to stepon.F90, enhancements to restart_dynamics.F90, and enhancements (made by Will Sawyer) to the Pilgrim library (puminterfaces.F90, pilgrim.h, parutilitiesmodule.F90, redistributemodule.F90). Also made a minor unrelated improvement to trac2d.F90 (elimination of 2D temporary array). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev30 +Originator: erik ( Erik Kluzek) +Date: Wed Mar 6 08:58:37 MST 2002 +Model: CAM +Version: CAM1.7.dev30 +One-line Summary: Fix labels on monthly files, physics changes from mzh6, + fix CCSM logs, update to ccsm2_0_beta38 +Known bug: All precipitation appears as snowfall! +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! +Machines tested: IBM, Linux (PGI) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens +Restart files change: no +Changes answers: Yes! (same-physics -- less snowfall, reduced Cn over sea-ice) + Case names for changes: /CCSM/csm/b20.001 +Changes made: + +Bug introduced: + + This version introduces a bug where all precipitation appears as snow. +This was due to incorrectly resolving a conflict in the merge from mzh5 to +mzh6. + +Fix labels on monthly files: + +Monthly files were labeled with the current time-stamp. Now they are labeled +with the previous month. Also don't output a monthly file, if nstep == 0, +as it will just be an instantaneous time-sample rather than an average. + +Get code updates from ccm3_12_47_brnchT_mzh6: + +Snowfall is reduced by requring average temperature to be -2C. Reduce cloud +condensation nuclei over sea-ice from 40 to 5. These code changes were tested +coupled, but not stand-alone yet. Both a new coupled and uncoupled simulation +will be run shortly. + +Fix log-files when running coupled: + +Only redirect masterproc output to atm.log file. Redirecting all output was +causing conflicts in the log file and causing most of the information +to be lost. Also add more checks on masterproc for output when running coupled. + +Update CCSM scripts to ccsm2_0_beta38: + +Update the "models/bld" and "scripts" directories to point to the "beta38" +version of CCSM2.0. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev29 +Originator: erik ( Erik Kluzek) +Date: Fri Mar 1 20:53:28 MST 2002 +Model: CAM +Version: CAM1.7.dev29 +One-line Summary: Fix initial filenames and increase caseid from 16 to 32 characters +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM (eul,sld,fv), SGI (eul only) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Increase caseid from 16 to 32 +Changes made: + +Increase caseid from 16 to 32 characters. + +Fix filenames of initial files (the .nc extension was dropped off). + +Change test-model.pl. SOM test now run on all platforms (AIX was left +off before). $CASE is a little longer and more descriptive. Filewildcard +more explicit (solves a simple problem I ran into, where the old file +was found). + +Ran run-model.pl with a 32-character caseid (both with CLM and LSM) +producing initial files to make sure worked with long caseid, and +initial files had proper name. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev28 +Originator: erik ( Erik Kluzek) +Date: Fri Feb 15 17:56:56 MST 2002 +Model: CAM +Version: CAM1.7.dev28 +One-line Summary: Add new flexible filenames with CCSM names as defaults, update to CLM2.3.17 +Requires change in build system: yes + (SHELL_MSS is no longer required) +Substantial timing or memory changes: no +Requires change in run script: no + (namelist options changed: rirt, nrmvn, nsmvn removed, irt => mss_irt, + nswrps => mss_wpass, add hfilename_spec, archive_dir option) +Tested to work coupled with CCSM: yes! +Machines tested: IBM, SGI (some testing on Linux PGI, Sun) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, mvertens, eaton +Restart files change: yes! +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Update to CLM2.3.17, get to work with changes +Changes made: + +Flexible filenames: + + New namelist option, hfilename_spec to specify filenames, newly +adopted CCSM standard filenames are the default. Filename specifiers set +the filenames, with the following interpretations: + + %c = casid + %t = tape number + %y = current year + %m = month + %d = day + %s = seconds into current day + %% = % character + +By default non-monthly files have a hfilename_spec of: "%c.cam1.h%t.%y-%m-%d-%s.nc" +Hence, for example, with a caseid="test", tape number 2, writing it's first data +for 12/1 UT 0:0 for year 1, will have the filename: +"test.cam1.h1.0001-12-01-00000.nc". + +Namelist: + + nsmvn, nrmvn, and rirt removed from namelist. + old irt renamed to mss_irt + old nswrps renamed to mss_wpass + + Added hfilename_spec filename specifyer to history filenames. + Added archive_dir to give MSS archive directory + + (now defaults to /USERNAME/caseid/csm/atm). + +Filenames module: + + New module to deal with filenames, and MSS options and interpret +filename specifiers (as above). Unit-test for this module was created. + +Restarts: + + history and abs-ems restart full filepaths added to master restart file. +Restart pointer file changed to include information on all files needed to +successfully do a restart. Restart files are disposed to MSS when closed +rather than in wrapup. + +History: + + History filenames are created and opened when data is first written to +them. Added methods: get_mtapes, get_hist_restart_filepath, get_hfilepath +to get private data in history module. Increase length of filenames to 256. + +CCSM scripts: + + models/bld updated to ccsm2_0_beta35, scripts updated to +scripts_a011228_brnchT_a020201. system_test script updated to changes in these +scripts. atm.setup.csh updated for new namelist changes. + +test-model.pl: + + New SOM dataset names added. Changed test-model.pl to use NEWBUILD +mechanism which should speedup build, changed so that error-growth tests +run without trace-gas, but with readtrace to exercise more code options. Set +nhtfrq(1) for restart tests so that all history files produce restart files. +Change Makefile so that explicit path to mkSrcfiles and mkDepends scripts +is given (using Rootdir). + +CLM: + + CLM updated to CLM2.3.17 (uses new CCSM filename convention). Update +to filenames module and namelist change. + +Move files unused by CLM from atmlnd_share to control: + (Testing of files in atmlnd_share is insufficient to work with + CLM2. So we are working on seperating the two.) + ioFileMod.F90, gauaw_mod.F90, wrap_mpi.F90 + ioFileMod.F90 changes so that comments, and mvn is not needed, and + SHELL_MSS option becomes standard. + +MSS: + + Remove MSS comments when mswrite done, and remove SHELL_MSS CPP token, +since always used. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev27 +Originator: eaton ( Brian Eaton) +Date: Fri Feb 8 18:19:23 MST 2002 +Model: CAM +Version: CAM1.7.dev27 +One-line Summary: bugfix for CAM makefile +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC-Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Erik +Restart files change: no +Changes answers: no +Changes to CLM land-model: None +Changes made: + +The CAM build was failing when the new ESMF macro MF_BUILD was set to a +relative path. Added fix to CAM makefile to convert the relative pathname +to an absolute one. + +Misc: modified bld/condense-path.pl to look for CAM.pm in $MODEL_CFGDIR. +This allows bld/configure.csh to be used in a directory other than bld. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev26 +Originator: eaton ( Brian Eaton) +Date: Wed Feb 6 14:52:17 MST 2002 +Model: CAM +Version: CAM1.7.dev26 +One-line Summary: update esmf to MF_LLU_0_0_12p1 and add fixes for lf95 +Requires change in build system: yes +CAM Makefile modified to set MF_BUILD macro used by esmf makefile. +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC-Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +David Neckels' summary of changes in MF_LLU_0_0_12p1: +> Version: MF_LLU_0.0.12 +> One-line summary: Added relocatable build support. +> Changes made: +> +> -Added variable MF_BUILD, which allows the code to be built in a +> directory other than the default. To use, invoke: +> gmake BOPT=g MF_BUILD=/tmp/esmf_build +> This will build the library under "/tmp/esmf_build". The object files, +> the library and the mod files will all be created under the new +> directory. +> +> -Added an install target to makefile. The variables MF_LIB_INSTALL +> and MF_MOD_INSTALL determine where the libraries and mod files are +> copyed during the install: (e.g) +> gmake BOPT=g MF_BUILD=/tmp/esmf_build MF_LIB_INSTALL=/usr/lib \ +> MF_MOD_INSTALL=/usr/mod install +> (Notice that once the MF_BUILD is used, it must be passed to the +> subsequent make commands). + +The CAM Makefile was changed to set the MF_BUILD directory to $(MODEL_EXEDIR)/esmf. + +The latest lf95 compiler (lf9561) required the following changes to the source code: + +physics/cam1/{radae.F90,chemistry.F90} - removed save attribute in variable +declarations that were in the same scope as a save statement. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev25 +Originator: eaton ( Brian Eaton) +Date: Tue Feb 5 12:04:52 MST 2002 +Model: CAM +Version: CAM1.7.dev25 +One-line Summary: remove prognostic sulfur cycle stubs +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, PC-Linux +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes made: + +Only the interface to the prognostic sulfur cycle is being removed. The +following independent features have not been removed: 1) a specified +sulfate aerosol distribution may be read from a dataset, 2) a ramp function +may be applied to the specified sulfate distribution, and 3) the indirect +radiative effects of sulfate aerosols may be estimated. + +Modify files: +control/history.F90 +control/initext.F90 +control/parse_namelist.F90 +control/restart.F90 +dynamics/eul/inidat.F90 +dynamics/fv/inidat.F90 +dynamics/sld/inidat.F90 +physics/cam1/advnce.F90 +physics/cam1/initindx.F90 +physics/cam1/inti.F90 +physics/cam1/moistconvection.F90 - left icwmr in arg list of cmfmca. +physics/cam1/radctl.F90 +physics/cam1/tphysac.F90 +physics/cam1/tphysbc.F90 +physics/cam1/tracers.F90 +physics/cam1/zm_conv.F90 +physics/ccm366/advnce.F90 +physics/ccm366/initindx.F90 +physics/ccm366/tracers.F90 + +Remove files: +control/acbnd.F90 +control/clddiag.F90 +control/dmsbnd.F90 +control/drydep.F90 +control/massbgt.F90 +control/scyc.F90 - move the indirect flag into comctl.h. Use this flag + directly rather than via the doindirect query method. +control/soxbnd.F90 +control/sulbnd.F90 +control/sulchem.F90 +control/sulemis.F90 +control/wetdep.F90 + +Misc: + Change variable count to count1 in history.F90(wshist) to fix a problem + with the pgf90 compiler. count is the name of an F90 intrinsic function + and apparently using it as a local variable was causing a problem. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev24 +Originator: olson ( Jerry Olson) +Date: Thu Jan 31 17:06:44 MST 2002 +Model: CAM +Version: CAM1.7.dev24 +One-line Summary: modifications and bufixes to eulerian, sld, and physics + routines +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (IBM only) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Restart files change: no +Changes answers: EUL: no (bit-for-bit; unless "DIVDAMPN" is used in namelist) + SLD: Yes (same-physics) +Changes to CLM land-model: None +Changes made: + + bugfixes: + - divergence damper in Eulerian code + src/dynamics/eul/hordif.F90 + - SLD energy fixer + src/physics/cam1/comsrf.F90 + src/physics/cam1/physpkg.F90 + src/physics/cam1/radctl.F90 + src/physics/cam1/tphysbc.F90 + + other mods + - SLD vector-field advection routine + src/dynamics/sld/nunv1.F90 + - src/advection/sld/engy_tdif.F90 + - removed an option from idealized physics + src/physics/cam1/phys_idealized.F90 + src/physics/cam1/tphysidl.F90 + - modified "test_trace3" tracer + src/physics/cam1/tphysac.F90 + +=============================================================== +=============================================================== + +cam1_7_dev23 +Originator: sawyer ( William Barton Sawyer) +Date: Wed Jan 16 13:46:35 MST 2002 +Model: CAM +Version: CAM1.7.dev23 +One-line Summary: Upgraded fvCAM to newest mod_comm primitives +Requires change in build system: no +Substantial timing or memory changes: possibly faster +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Putman (mod_comm primitives) +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: (For changes that change answers) +Changes to CLM land-model: None (one-line description) +Changes made: + + models/utils/pilgrim: + + removed bufferpack/unpack 2d,3d,4d primitives (in mod_comm) + mod_comm.F90: added generic mp_send/recv primitives + + models/atm/cam/src/dynamics/fv + + cd_core.F90 d2a3dijk.F90 d2a3dikj.F90 dynpkg.F90 + highp2.F90 hswf.F90 p_d_adjust.F90 te_map.F90 uv3s_update.F90 + + replaced parbegin/endtransfer primitives with mp_send/recv + primitives from mod_comm. The only tricky part about this + was determining the proper source and destination PE numbers: + in the 2D decomposition this depends on the ordering of + the mapping of the decomposition to the PEs (row-major or + column-major). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev22 +Originator: mirin ( Arthur Andrew Mirin) +Date: Tue Jan 15 14:49:36 MST 2002 +Model: CAM +Version: CAM1.7.dev22 +One-line Summary: Support history files for 2D FV decomposition +Requires change in build system: no +(one-line description of changes: Makefile, include files, directories, etc.) +(Detailed description below) +Substantial timing or memory changes: no +Requires change in run script: no +(one-line description of changes: data files, run-scripts, namelist etc.) +(Detailed description below) +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation:not-applicable +Changes answers: no (bit-for-bit) +(Note: test-model.pl only does checks this -- if you run it with the "-c" option) +Name of tests cases on NCAR Mass-Store: (For changes that change answers) +Changes to CLM land-model: None (one-line description) +Changes made: + +Changed history.F90, uv3s_update.F90 and restart_dynamics.F90. +Also changed CAM_lab.pm and script.m4. + +Main changes were to history.F90, in order to support 2D FV decomposition. +The field_info structure was generalized to include a vertical extent. Support +for dynamics variables having global vertical extent 1, plev and plevp was added; +however, only tested variables had global extent plev. New coding supports 64-bit +accumulation buffers. 32-bit accumulation buffers are still not supported for +2D FV but are supported for 1D FV decomposition. + +Previous coding had bug involving non-preservation of subscript array +range for associated pointers. That bug affected the hbuf_accum routines and +hbuf_compute_avg. Bug has been fixed; inside those routines relevant arrays +have beginning subscript equal to 1. + +uv3s_update.F90 needed minor fix to properly call the history routine. + +restart_dynamics.F90 had a minor bug involving 2D FV decomposition. + +script.m4 (DAO) was given 1-line change involving ccm to cam transition. + +CAM_lab.pm had 1-character change involving working directory on LLNL frost. + + + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev21 +Originator: sawyer ( William Barton Sawyer) +Date: Mon Jan 7 07:38:50 MST 2002 +Model: CAM +Version: CAM1.7.dev21 +One-line Summary: Merge of current DAO fvGCM FV dycore into CAM baseline: ghosting of variables, mod_comm for communication +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Linux +Ran test-model.pl script: no (test-model.pl -l dao not currently working) +Tested on fv dynamics: yes +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: no +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): no +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: n/a +Changes to CLM land-model: None (one-line description) +Changes made: + + Phase 2 of fvGCM-CAM fv dycore merge: ghosted prognostic + variables U3S, V3S, Q3. Uses mod_comm for communication + (as well as pilgrim). More consistent use of "only" statement + in "use" lines. Upgrade of pilgrim (synchronized with DAO + Chemistry Transport Model development) and mod_comm (should + compile on Compaq now). + + models/utils/pilgrim: + + pilgrim.h, parutilitiesmodule.F90, ghostmodule.F90: + synchronized with DAO CTM development. + mod_comm.F90 : should now compile on Compaq (sorry, + not tested -- no access to a Compaq) + + models/atm/cam/src/control: + + history.F90: rather ugly code to support write of + ghosted U3S array. Well be improved in later version. + + models/atm/cam/src/dynamics/fv + + prognostics : ghosted variables U3S, V3S, Q3 + + cd_core.F90, trac2d.F90 : ghosting of U, V, Q3, replaced many + pilgrim calls with mod_comm. + + benergy.F90, dryairm.F90, inidat.F90, restart_dynamics.F90 + map1_ppm.F90, d2a3dijk.F90, d2a3dikj.F90, dynpkg.F90, + te_map.F90, fv_prints.F90, p_d_adjust.F90, dp_coupling.F90, + hswf.F90, uv3s_update.F90 : accommodated ghosted variables. + + mod_mpi.F90 : retired (now uses mod_comm) + + dynamics_vars.F90 : new temporary unghosted variables as + interim solution for 2D decomposition redistributions. + + stepon.F90 : ghosted variable u3sxy + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev20 +Originator: rosinski ( Jim Rosinski) +Date: Wed Jan 2 16:48:01 MST 2002 +Model: CAM +Version: CAM1.7.dev20 +One-line Summary: Mods to SOM: MLD renamed MLDANN on SST dataset., and contains + yearly values. SPMD SOM indexing fix. No resetting SICTHK, + SNOWH, TSSUB in SOMINI +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, PC +Ran test-model.pl script: no +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: no (bit-for-bit) at least for non-SOM configurations +Changes to CLM land-model: None +Changes made: + +NOTE: All changes are to slab ocean model (SOM) code. + +o Changed name of mixed layer depths to MLDANN on SST boundary file +o Fixed indexing bug in SPMD mode (SOMINI, SOMINT) +o Removed code from SOMINI which reset SICTHK, SNOWH, TSSUB, ORO. + +=============================================================== + +cam1_7_dev19 +Originator: sawyer ( William Barton Sawyer) +Date: Thu Dec 27 07:47:01 MST 2001 +Model: CAM +Version: CAM1.7.dev19 +One-line Summary: FV core upgrade: Q3 indexing changed to (i,j,k,iq); no changes in order on history/restart files +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Art Mirin +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: (For changes that change answers) +Changes to CLM land-model: None (one-line description) +Changes made: + + Changed indexing of prognostic var. Q3 from (i,k,iq,j) to + (i,j,k,iq) in FV dynamical core. This change affected + numerous files in FV, + + cd_core.F90 fv_prints.F90 pmgrid.F90 stepon.F90 + dp_coupling.F90 inidat.F90 prognostics.F90 sw_core.F90 + dryairm.F90 mod_mpi.F90 restart_dynamics.F90 te_map.F90 + dynpkg.F90 p_d_adjust.F90 spmd_dyn.F90 trac2d.F90 + + and one common file: src/control/history.F90. + + The section in history is protected by an "if ( dycore_is('LR) ) then" + line (and is also embedded in an #ifdef STAGGERED CPP statement -- + does any other dycore use STAGGERED?) + + The order of Q3 on the initial/restart files has *not* changed. + For the time-being there is logic to read and write Q3 in the + original order. This might change (in restart_dynamics.F90) later on. + + + models/util/pilgrim/mod_comm.F90 has also been upgraded with + new routines; which are not yet used by the FV core. A code + review/revision of these changes by Putman/Shen is pending. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev18 +Originator: eaton ( Brian Eaton) +Date: Tue Dec 18 12:40:35 MST 2001 +Model: CAM +Version: CAM1.7.dev18 +One-line Summary: changes for share constants +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, sun, pc/linux/pgf +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: Erik, myself, and Mariana +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: Yes, new constants sometimes agree to only 2 digits with old ones. This tag requires scientific validation. +Name of tests cases on NCAR Mass-Store: Erik will do production runs. +Changes to CLM land-model: Updated to clm2_3_dev10. +Changes made: + + Update CLM to clm2_3_dev10. + + The following changes were implemented by Erik and reviewed by me. + + Use values of constants from models/csm_share/shr_const_mod.F90 for + consistency with other CCSM component models. The changes are mainly in + the physics/cam1/physconst.F90 module. + + Also changed some hard-wired constants in individual parameterizations: + + ocnsice/dom/srftsb.F90 + cmair = cpair (was 1.00e3) + cmice = shr_const_cpice (was 2.07e3) + rhair = shr_const_rhodair (was 1.25) + rhice = shr_const_rhoice (was 9.20e2) + + ocnsice/som/oceanconst.F90 + tof = shr_const_tkfrz -1.9_r8 (was 271.26) + rhoocn = shr_const_rhosw (was 1.026e3) same + cpocn = shr_const_cpsw (now 3.996e3, was 3.930e3) + tsm = shr_const_tkfrz (was 273.16) + + physics/cam1/cldwat.F90 + rhonot = rhodair/1000. (was 1.275e-3) + t0 = tmelt (was 273.16) + replace hard-wired 273.16 with t0 + + physics/cam1/esinti.F90 + pass tmelt as an arg + + physics/cam1/gffgch.F90 + replace hard-wired 273.16 with tmelt + + physics/cam1/radae.F90 + amd = mwdry (now 28.966, was 28.9644) + + Made some interface changes to provide initialization routines for + setting constants in parameterizations. + + Moved routines for water vapor pressure calcs into new wv_saturation + module. + + Moved routines for shallow convection into moistconvection module. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev17 +Originator: sawyer ( William Barton Sawyer) +Date: Tue Dec 18 07:25:41 MST 2001 +Model: CAM +Version: CAM1.7.dev17 +One-line Summary: Bug fix of mod_comm library for AIX and Linux +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, Linux +Ran test-model.pl script: no +Tested on fv dynamics: yes +Tested on eul dynamics: no +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: no +Tested that different domain decompositions match bit-for-bit: no +Tested in adiabatic mode: no +Code reviewed by: myself, Shen +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: N/A +Changes to CLM land-model: None +Changes made: + + models/utils/pilgrim: memstuff.c, mp_assign_to_cpu.c mod_comm.F90 + + Minor bug fixes to get mod_comm to compile and run on AIX and Linux + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev16 +Originator: sawyer ( William Barton Sawyer) +Date: Mon Dec 17 03:19:29 MST 2001 +Model: CAM +Version: CAM1.7.dev16 +One-line Summary: FV dycore improvements: mod_comm comm. library; more support for 2D decomposition +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: SGI +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Putman, Lin +Updated the DatasetLog (for new input data-files): no +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: N/A +Changes to CLM land-model: None +Changes made: + + model/utils/pilgrim: + + mod_comm.F90: optimized comm. library (Lin, Putman, Shen) + memstuff.c: related utilities for MLP parallelism + mp_assign_to_cpu.c: CPU pinning utility (MLP and MPI modes) + + model/atm/cam/bld + + CAM_lab.pm: improvements for -l dao + configure_fv.pl, script.m4: Additional support for 2D decomp. + + model/atm/cam/src/dynamics/fv + + benergy.F90, cd_core.F90, dynpkg.F90, geopk.F90, + hswf.F90. prognostics.F90, restart_dynamics.F90, + spmd_dyn.F90, stepon.F90, te_map.F90: + + Phase 1 of transition to mod_comm library, + mod_mpi replaced by mod_comm in cd_core.F90. + Variable PT ghosted throughout various routines. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev15 +Originator: rosinski ( Jim Rosinski) +Date: Thu Dec 6 11:47:59 MST 2001 +Model: CAM +Version: CAM1.7.dev15 +One-line Summary: Add per-tape averaging flag. Delete inlining for SGI +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, PC +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): no or Yes or not-applicable +Updated the documentation: no +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: (For changes that change answers) +Changes to CLM land-model: None +Changes made: + +o Added namelist option avgflag_pertape. Usage ex: if set avgflag_pertape(2) = 'I', + all fields on history file 2 will by default be instantaneous. Can still + be overridden (for example) with fincl2 = 'T:A' + +o Deleted inlining for SGI (a mod to bld/Makefile). Inlining slowed compilation + down by 60% and resulted in zero or negative speedup. Could also delete for + other machines, but Makefile mods, compilation time and execution time effects + of including inlining were not nearly as obnoxious as on SGI so left alone for now. + +o Added addfld call for NSTEP. Writing this field to history file is often useful + for diagnosing mods to history.F90. By default this field is not written. + +o Moved dycore print from parse_namelist.F90 to cam.F90 + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev14 +Originator: mvertens ( Mariana Vertenstein) +Date: Tue Dec 4 09:08:53 MST 2001 +Model: CAM +Version: CAM1.7.dev14 +One-line Summary: put in esmf calendar manager into clm2 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, erik +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: Yes (for clm2 only) +Changes answers: On utefe(sgi) and prospect (compaq) the result were +bfb when running test-model.pl with the -c option. On the ibm, +the changes were roundoff compared with cam1_7_dev13 when running with +the esmf libO version and bfb when running with the esmf libg version +(differences only appeared after 98 times steps and were due to +roundoff differences in the computation of the calendar day) +Changes to CLM land-model: Yes + +1) Put in the esmf time manager into clm2 + Brought cam code up to date with clm2_3_dev6. + Only clm2 code was changed. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== + +=============================================================== + +cam1_7_dev13 +Originator: eaton ( Brian Eaton) +Date: Sun Dec 2 15:54:13 MST 2001 +Model: CAM +Version: CAM1.7.dev13 +One-line Summary: make history files conform to CF metadata conventions +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, sun, linux-pgf +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: +Changes to CLM land-model: None +Changes made: + + Changes are all in history.F90 except for some units changes in addfld + calls in gw_drag.F90. The modifications are: + .Fix units attributes. + .Fix convention attribute. + .Fix description of hybrid vertical coordinates. + .Write all coordinate variables as type double. + .Fix description of time averaged values. + .Add time interval boundaries. + .Remove _FillValue attribute for variables on a full grid. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev12 +Originator: eaton ( Brian Eaton) +Date: Thu Nov 29 19:08:09 MST 2001 +Model: CAM +Version: CAM1.7.dev12 +One-line Summary: update ESMF lib to MF_LLU_0_0_11p3 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, sun, linux/pgf +Ran test-model.pl script: yes +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: David Neckels +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: +Changes to CLM land-model: None +Changes made: + + Update the ESMF library from version MF_LLU_0_0_11p2 to MF_LLU_0_0_11p3. + Date increment incorrectly normalized itself when on the first month of the + year. The time management increment function did not completely construct + itself. These bugs were uncovered during unit testing of the ESMF library + by David Neckels. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev11 +Originator: mirin ( Arthur Andrew Mirin) +Date: Wed Nov 28 23:02:45 MST 2001 +Model: CAM +Version: CAM1.7.dev11 +One-line Summary: Changes for multi-2D decomposition for FV dycore +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Sawyer +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: Yes (minor roundoff differences in FV dycore routine te_map.F90) +(Note: test-model.pl only does checks this -- if you run it with the "-c" option) +Name of tests cases on NCAR Mass-Store: (For changes that change answers) +Changes to CLM land-model: None (one-line description) +Changes made: +Changed 13 files in dynamics/fv; most changes were fairly minor. +Changed control/spmdinit.F90. +Changes 3 files in physics/cam1, to allow more general chunking. These changes were actually made by Pat Worley. +Changed 2 files in Pilgrim (minor). +Added batch capability for test-model.pl for LLNL IBM Frost. +Minor change to CAM_lab.pm for LLNL Frost. +Minor changes to DAO scripts configure_fv.pl, script.m4. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev10 +Originator: mvertens ( Mariana Vertenstein) +Date: Mon Nov 26 08:32:45 MST 2001 +Model: CAM +Version: CAM1.7.dev10 +One-line Summary: changed mpi distribution of subgrid patches in clm2 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq +Ran test-model.pl script: yes (does all of the following tests) +On Compaq only tested eul dynamics +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Ran test-model.pl with -compare optio +Changes to CLM land-model only: +Brought cam code up to date with clm2_3_dev4 +1) changed the distribution of subgrid patches among processors + so that patches for a given land point must all be on the same processor +2) changed all mpi gather/scatter calls to mpi gatherv/scatterv calls + and introduced subroutines to determine the asymmetric vector lengths +3) Put in CF1.0 conventions into clm history file +4) removed rtm_doavg from namelist - rtm averaging is now done + if rtm_nsteps is set to greater than 1 (this does not appply + to cam model unless cam is run with RTM - by default this is + not the case) + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev9 +Originator: erik ( Erik Kluzek) +Date: Wed Nov 21 16:02:10 MST 2001 +Model: CAM +Version: CAM1.7.dev9 +One-line Summary: Get coupled model to work, update to scripts_a011121 + and bld_b011121 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: Yes! (IBM only) +Machines tested: IBM +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Terminate string in clm_csmMod.F90 so would compile. +Changes made: + +Make changes needed to get CAM to work with coupled with CCSM. Update models/bld +to bld_b011121, and scripts/test.a1 to scripts_a011121. Run csm.csh on babyblue +to make sure would work. Also ran on utefe, but lnd.setup.csh failed due to +a "getdata" problem, the compile of CAM was successful however. Update "csm.csh" +coupled version to ccsm2_0_beta26. + +Change ccsm_msg.F90 to use time_manager to get nstep (from Lawrence Buja). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev8 +Originator: eaton ( Brian Eaton) +Date: Wed Nov 21 08:47:35 MST 2001 +Model: CAM +Version: CAM1.7.dev8 +One-line Summary: add perpetual calendar option to time manager +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, pc-linux, sun +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): no +Updated the documentation: Yes +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: +Changes to CLM land-model: None +Changes made: + +Add namelist variables to enable perpetual calendar: + +logical perpetual_run - Set to .true. to specify that a perpetual run is + being done (default is .false.). If perpetual_ymd + is not set then read the perpetual date from the + initial file. + +integer perpetual_ymd - Perpetual date specified as (year*1000 + month*100 + + day). This overrides value from initial file. + +If aqua_planet=.true. then the values of perpetual_run and perpetual_ymd +are ignored. aqua_planet mode uses a perpetual date of 321. + +Modify files: + +control/time_manager.F90 - add perpetual_run, perpetual_ymd to public data. +add is_perpetual method to indicate that perpetual calendar is in use. +Modify internal logic so that perpetual calendar doesn't depend on +aqua_planet mode. Add an optional argument to specify an offset in the +get_curr_date method (needed by the CLM). + +control/parse_namelist.F90 - add perpetual_run, perpetual_ymd. + +Modify code in the following files to use the perpetual date when +interpolating boundary datasets if perpetual calendar is in use. +control/initext.F90 +control/oznini.F90 +control/oznint.F90 +control/so4bnd.F90 +dom/sst_data.F90 +physics/advnce.F90 +physics/chemistry.F90 +physics/tphysac.F90 + +Misc: +control/initext.F90 - There was code in a #ifdef COUP_CSM section that was +nested inside a #if (!defined COUP_CSM) section. Remove this code which +wasn't being executed anyway. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev7 +Originator: eaton ( Brian Eaton) +Date: Fri Nov 16 17:35:37 MST 2001 +Model: CAM +Version: CAM1.7.dev7 +One-line Summary: update ESMF library +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, pc, sun +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and David Neckels +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: +Changes to CLM land-model: None +Changes made: + + Update the ESMF library from version MF_LLU_0_0_11 to MF_LLU_0_0_11p2. + This includes bugfixes for the mfm_datedecrement and mfm_timemgrlaststep + functions. + + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev6 +Originator: erik ( Erik Kluzek) +Date: Fri Nov 16 09:37:28 MST 2001 +Model: CAM +Version: CAM1.7.dev6 +One-line Summary: Update ESMF to MF_LLU_0_0_11, change test-model.pl interface, fix problem with run-model.pl +Requires change in build system: Yes +(Changed Makefile on sun to be compatable with new ESMF) +(Changed Makefile for Linux-PGF90 so sgexx.F doesn't get compiled with -fast) +Substantial timing or memory changes: no +Requires change in run script: Yes (run-model.pl scripts need to use + setup_directories( "support" ) +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, Sun, Linux-PGI (NERSC-IBM, ORNL-IBM) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Mariana Vertenstein +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes to ESMF: Update to MF_LLU_0_0_11 +Changes made: + +ESMF Update: + + Get newer version of ESMF library. This fixes a problem with calculating +the ending date (which fixes a problem that the CLM had in writing out restart +files at the end of the run). It also fixes problems in building on several +platforms. The previous version did not build on the DAO SGI (tropic) for +example. + +Makefile changes: + + SUN: Use -dalign for DEBUG, and otherwise -fast to be compatable + with the new version of ESMF. + + Linux-PGF90: Set to compile sgexx.F withotu -fast, so that SLD + simulations won't hang. + +run-model.pl change: + Change so that CAM_run.pm sets up a directory to build makdep in + like test-model.pl does. This allows run-model.pl to use the same + source directory, but submit to different machines simultaneously. + The change requires the setup_directories( "support" ) method to + be called from run-model.pl type scripts. + +test-model.pl changes: + + Change interface from mixed short names like "-l" and "-nofail" to +consistent longer names: "-lab", "-compare", "-help" etcetera. + + -l ==> -lab + -c ==> -compare + -h ==> -help + -t ==> Eliminated you now get the list of test from -help + -r ==> -resume + -dirty ==> -noclean + -e ==> -errgro + -s ==> -skip + +For backwards compatability, -l, -c, -r, -e, and -s are still allowed, although +the longer names are prefered. + +ornl: Change default CASE_DIR to a GPFS directory so that builds will work. +llnl: Change default SPMG_CMND depending on whether machine has prun or dmpirun. + Will now automatically detect which exists and use the one that works. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev5 +Originator: eaton ( Brian Eaton) +Date: Tue Nov 13 10:19:40 MST 2001 +Model: CAM +Version: CAM1.7.dev5 +One-line Summary: makefile changes for ESMF library build +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq, PC/linux-pgf +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself and Erik +Updated the DatasetLog (for new input data-files): no +Updated the documentation: no +Changes answers: no (bit-for-bit) +Name of tests cases on NCAR Mass-Store: +Changes to CLM land-model: None +Changes made: + +Modified the CAM Makefile to prevent unnecessary rebuilding of the ESMF +library. + +The ESMF Makefile has been improved (by David Neckels) to include support for +more Fortran compilers under Linux, and to allow simultaneous builds of the +library from different platforms with access to the same source on a shared +filesystem. There is also a README file for the ESMF build in +top_dir/models/utils/esmf/README. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev4 +Originator: erik ( Erik Kluzek) +Date: Fri Nov 9 11:44:51 MST 2001 +Model: CAM +Version: CAM1.7.dev4 +One-line Summary: Fix problem with run-model.pl, add condense-path utility, + update ESMF to MF_LLU_0_0_10p1 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI, Compaq (partial tests on Linux and Sun) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Known problems: SOM test fails on AIX, LSM/phys366 test fails on Linux + SLD test 3 (in test-model.pl) hangs on Linux-PGf90 +Code reviewed by: myself, Brian Eaton +Changes answers: no (bit-for-bit) +Changes to CLM land-model: None +Changes to ESMF: Update to MF_LLU_0_0_10p1 +Changes made: + +Fix path problems with run-model.pl + + Add a condense-path.pl utility to shorten pathnames with "/.." in them. +This is important since the longer directory names of CAM and the multiple +levels cause line length problems when building. + +test-model.pl: Turn SOM test on for all platforms but AIX + + Let the SOM test happen for all platforms except the IBM where it fails. +Once this is fixed we should re-enable it. + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +cam1_7_dev3 +Originator: mvertens ( Mariana Vertenstein) +Date: Wed Nov 7 13:00:31 MST 2001 +Model: CAM +Version: CAM1.7.dev3 +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: no +Tested to work coupled with CCSM: no +Machines tested: IBM +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: no +Tested on eul dynamics: yes +Tested on sld dynamics: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: no (bit-for-bit) +Simulations: + /ERIK/csm/eul17dev3_a ---- 5 year simulation with + PCMDI climatological SST's +Changes made: + +1) put in restart consistency checks between cam and clm2 + i.e ensure that both models restart with same time step + +=============================================================== +=============================================================== + +cam1_7_dev2 +Originator: mvertens ( Mariana Vertenstein) +Date: Wed Nov 7 10:16:12 MST 2001 +Model: CAM +Version: CAM1.7.dev2 +One-line Summary: Put in three clm2 bug fixes that change answers +Requires change in build system: no +Substantial timing or memory changes: no +Requires change in run script: Yes + CLM2 namelist must have the following changes: + 1) fpftcon = $LM_DATDIR/pftdata/pft-physiology-vegdyn-cleanup-ratio + 2) remove mksrf_firr from namelist +Tested to work coupled with CCSM: no +Machines tested: IBM, SGI +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Erik Kluzek +Updated the DatasetLog (for new input data-files): not-applicable +Updated the documentation: not-applicable +Changes answers: Yes (new-physics - bug fixes) +Changes to CLM land-model: YES +Changes made (CLM2 code): +Put in changes from clm2_2_12, clm2_2_13, clm_2_14 + +clm2_2_12: +1) Update to clm2 changes from CCM3.12.62, from Brian Eaton + "Use public data and methods from time_manager mod for initialization." + +clm2_2_13: +1) cleaned up pft physiology file and related code + removed anything related to biogeochemistry when DGVM is off (not defined) +2) used ratio of roughness length and displacement height to canopy top height + instead of actual values for roughness lenght and displacement height +3) fixed openmp bug in RtmMod.F90 +4) fixed branch bug in AccumulMod.F90 +5) fixed DGVM bug in Fire.F90 + +clm2_2_14: +The clm2 code in this tag is clm2_2_14 with Erik's cam1_7_1 mods +where ccm->cam in various files min the clm2/main directory +1) (Biogeophysics_Lake.F90) - Fixed bug in lake model where latent heat of + fusion was being used (incorrect) instead of latent heat of sublimation + (correct). + Also Fixed two "problems" noticed in the b202.20.0 simulations: +2) (CombineSnowLayers.F90) - Global water and ice contents in the + top soil layer were increasing with time. Eliminated ponding in + wetlands by assigning snow melt to runoff. +3) (SurfaceRunoff.F90) - Eliminated formation and growth of basal ice layer + beneath snow cover by assigning snow melt reaching impermeable ground + surface to surface runoff. + The above three fixes were tested by examining output from several single + point and 21-year standalone simulations. No trends in surface soil + water and ice were noted. Lake bug fix has small effects on surface + fluxes from grid cells with lakes that have snow cover. +4) Put in volr in initial dataset +5) Put in restart id tag on restart file for consistency - + if restart file is modified, the parameter rest_id in restFileMod.F90 + must be updated. +6) Set maximum number of auxillary history files to 2 to be + consistent with parameter settings. + +=============================================================== +=============================================================== + +cam1_7_dev1 +Originator: erik ( Erik Kluzek) +Date: Wed Nov 7 09:11:22 MST 2001 +Model: CAM +Version: CAM1.7.dev1 +One-line Summary: Move from CCM to CAM, mask error-growth problems by not + letting CLM see snowfall, Change build +Requires change in build system: Yes! + (Change COUP_CCM to COUP_CAM for CLM, Makefile uses Rootdir file for + ESMF build, ESMF build is done from within Makefile, directory + structure different) +Substantial timing or memory changes: no +Requires change in run script: Yes! + (namelist is now camexp instead of ccmexp, input data files directory + changed, Env variable for datasets is now $CSMDATA) +Tested to work coupled with CCSM: no (need to update CCSM build for ESMF) +Machines tested: IBM, SGI, Compaq, Sun, Linux-PGF90 + (SOM test fails on IBM, LSM/PHYS366 test fails on Linux) +Ran test-model.pl script: yes (does all of the following tests) +Tested on fv dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Code reviewed by: myself, Mariana Vertenstein, Brian Eaton (som changes) +Updated the DatasetLog (for new input data-files): no (but need to) + Did create 26 level T21 datasets for testing, and got test-datasets + at T42L18 for SOM + (new datasets at ftp.cgd.ucar; cd pub/erik; + get cam1_7.scidac-atm.datasets.tar.gz) +Updated the documentation: Yes (first pass at changes from CCM to CAM) +Changes answers: no (bit-for-bit) +Changes to CLM land-model: Yes (COUP_CCM to COUP_CAM, nix references to ccm) +Changes made: + +Change references from CCM to CAM. + +datafiles: ccmr and ccmi files are now camr and cami +filenames: ccm3, conv_ccm, ccmoce, are now cam, conv_cam, camoce +lnd filenames: ccm_lndMod, lnd_ccmMod, are now atm_lndMod, and lnd_atmMod +CPP Tokens: COUP_CCM is now COUP_CAM +Directory structure: New directory structure compatable with the "cam1" + cvs module rather than the "ccm" cvs module. +Other references in code and comments to CCM were changed to CAM. + +New build: + + Build changed to create a Rootdir file with the top level directory +of "cam1". This is used by the Makefile to figure out the location of the ESMF +directory. The Makefile then builds the ESMF library directly from the +Makefile. This new build system comes from David Neckels via Brian Eaton. +It is a much easier more robust way of building the model. The env variable +DYNAMICS for Lin-Rood should now be set to "fv" in agreement with the new directory name. For the SUN take out the "-fast" option to be compatible with the +ESMF library build (put this back in when ESMF build is updated). + +Run scripts: + +Run scripts use "CSMDATA" instead of MODEL_DATDIR. AM_DATDIR, and LM_DATDIR +env variables removed. New directory structure for cam with subdirectories +for: inic, ggas, rad, hrtopo, ozone, scyc, and sst for initial conditions, +greenhouse gas, radiation, high-resolution topography, ozone, sulfur-cycle +and sea surface temperatures respectively. The environment variable OCEAN +was added to refer to the ocean model to use "dom" or "som". The env variable +PHYSICS now either should be "cam" or "ccm366" to refer to the type of physics +used. + +Error-growth problem: + + Mask the current error-growth problem to some extent by only letting +CLM see rain and not snowfall. Error-growth for FV still seems to be large. + +Remove Sulfur-cycle codes: + + Remove the sulfur-cycle codes (they are still accessible on the +cam_brnch_scyc branch and with the cam1_scyc module). In their place the +dummy stubs from dscyc were put into the control directory. Eventually, we +will rip these out of the main development and only leave them on the +sulfur-cycle branch. + +Changes to test-model.pl: + + Change vertical resolution of the sld and eul tests to 26, in agreement +with the vertical resolution used for production simulations (the difference +in vertical resolution can have an impact on how changes to physics are +perceived). Remove "-clean" option and make cleaning old directories out the +default, add the option "-dirty" to not clean files before the build. + +Users Guide: + + Users Guide now part of the distribution, first pass on moving from +CCM3.12 to CAM was completed. Namelist documentation is up to date, directory +structure is outlined. Further updates should update documentation at the +same time that code is changed. + +SOM: + + SOM now part of the distribution, SOM was updated to use the new +timing routines. "test-model.pl" has a test for SOM that is currently commented +out since it doesn't run on the IBM (does complete on other platforms however). + +See: http://www.cgd.ucar.edu/cgi-bin/cms/ncar_only/view_change_file.cgi?ChangeLog + for latest version of this file on the web. +=============================================================== +=============================================================== + +ccm3_12 +Originator: erik ( Erik Kluzek) +Date: Wed Jun 13 11:35:28 MDT 2001 +Model: CCM +Version: CCM3.12 +One-line Summary: New H2O LW abs/ems, geo-potential, precip evap, cloud-water changes, no oro-drag over ocean +Requires change in build system: no (but, Makefile updated for in-lining, see below) +Substantial timing or memory changes: no +Requires change in run script: Yes (New abs_ems_dataset, see below) +Tested to work coupled with CSM: Yes (IBM and SGI) +Machines tested: IBM, SGI, Compaq, Sun, Linux (see below) +Ran test-model.pl script: yes (does all of the following tests) +Tested on lr dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: yes +Updated the DatasetLog (for new input data-files): Yes +Updated the documentation: no (but need to) +Changes answers: Yes (new-physics) +Name of tests cases on NCAR Mass-Store: + /JET/csm/zm31139evap06 ---- Climatological SST's T42L26, Eulerian dynamics + /JET/csm/amipevap06 ------- AMIP2 SST's T42L26, Eulerian dynamics + /JET/csm/amipevap06_3h ---- Daily output same as above. + /CCSM/csm/b202.02 --------- Coupled simulations, T42L26, Eulerian dynamics +Changes made: + +IMPORTANT: Problems on SUN, and Linux, problems on batch submission to: + blue, eagle, gseaborg (see below). Need new datasets (see below). +---------------------------------------------------------------------------- +Physical changes: + Precipitation evaporation: J.J. Hack. + Cloud water changes for mid-atm.: P.J. Rasch + LW water-vapor abs/ems changes: W. Collins + no orographic drag over ocean: B.B. Boville + fix to geo-potential: B.B. Boville + +Land-model: + Tested with both LSM1 and CLM2 land-models (see below). CLM2 + was updated to CLM2.1.20. +Interface changes: + Makefile changed so that in-lining is done. + radems/radabs became a module. + LINUX CPP token changed to Linux (so you can use uname -s) + Block data removed (except for phys366). + Check that ORO is valid from IC file. +Testing: + Code was tested both on many NCAR platforms and several off-site + platforms as well. test-model.pl was primarily used to validate + that the model started/restarted for all dynamics as well as + both the "physics" and "phys366" physics directories and "lsm1" + and "clm2" land models. It also verified that restarts give exact + answers to the history files (both average and instant values), + and that changing the decomposition gives the same answers and + that SPMD and non-SPMD gives the same answers. It also checks + that the code can run with bounds checking on (on Sun and Linux), + and with the compiler initializing variables to indefinite. + + CCSM tests run ccm/test/csm.csh to ensure that the model works + with the CCSM coupler. This version of the model works with + ccsm2_0_beta11. + +Machine lsm1-physics CCSM clm2-physics clm2-phys366 lsm1-phys366 +babyblue(aix) X X X X X +blackforest(aix) X X +gseaborg(aix) X +eagle(aix) X +blue(aix) X +longs(PC) X X X +prospect(osf) X X X X +compass(osf) X +utefe(sgi) X X X X +tropic(sgi) X X X +sanitas(sun) X X X + +Error growth: + The error-growth is faster than the previous model, especially + SLD but, it was deemed acceptable. HOWEVER, + THE ERROR-GROWTH ON THE SUN IN COMPARISON TO THE IBM IS + UNACCEPTABLE. Until this is fixed the Sun should not be + used for simulations. + +Script changes: + test-model.pl was made more robust. Tests + to compare SPMD non-SPMD were added and to check both avg + and instant history files for restart tests, and new + input options added: + + set the env variables: + + LANDMODEL --- to define whether to use LSM1 or CLM2 + PHYSICS ----- to define whether to use "phys366" or "physics". + + skip option (-s) now allows an end-point and allows resolution + to be specified. So + + -s eul:3-5:T42L26 + + Will run tests 3-5 with Eulerian dynamics at T42 and 26 levels. + + Error-growth option. To do a port validation you can validate + against a given trusted machine. To do this use something like: + + -e "blackforest.ucar.edu(aix)" + + This assumes you already ran test-model.pl on blackforest (and + left everything in the standard locations). Then the "errg*.cprout" + files will contain a comparison to the above machine. + +New datasets: + Bundle of datasets needed to run the model and use "test-model.pl". + + ftp.cgd.ucar.edu; cd pub/erik; bin; + get ccm3.12.acpi-atm.datasets.tar.gz + + abs_ems_factors_fastvx.052001.nc --- Required for use with + the new LW code. + clm datasets ---- In order to run with clm2. + fv.4x5L18 -------- 4x5 degree resolution dataset with 18 levels + for LR dynamics from Sharon Nebuda. +Known-Bugs: + Linux: S.-J. had trouble with 10x15 on Linux with LR and the + Portland group compiler. I had trouble with Linux at + 2x2.5 with LR. + Sun: Error-growth was bad. Ran out of memory at some resolutions, + especially when doing SPMD, or when using CLM2. + Batch: Had trouble with batch submission on the IBM-SP machines: + blue, gseaborg, and eagle. Interactive, didn't have the + same trouble, so I'm unclear why this is the case. + test-model.pl: When using "-s all:" option you can't give an + end-point or it will only run for the first dynamics. +Changes since CCM3.11: + Many enhancements, bug-fixes, and progress on 2D-decompostion to LR + dynamics. Update to F90 and initial Protex pass for LR. + Replace Rayleigh friction with 1st order upwind transport. + Revised mapping algorithm near the surface for winds. + + slaveio namelist item removed. Namelist variable "IDEALDYN" + changed to "IDEAL_PHYS" + + Support for Lahey and Fujitsu compilers on Linux. Work on chunking. + Columns given by phys_grid methods. timing library added. + Ability for bounds-checking added. FORTFFT cpp parameter deleted + use USEFFTLIB if library available. SPMD now doesn't require that + the number of MPI tasks evenly divide into the number of latitudes. + + History modularized. Progress on physics/dynamics split. Restart + dyanmics and physics split out better. Sulfur-cycle codes fixed. + SLD energy fixer added. + + phys366 and clm2 directories added. Generic interface to both + land-models. + + Options added to scripts: PHYSICS, LANDMODEL, tests to run. + NO_SWITCH option for LLNL Compaq. "-clean", "-nofail" and "-t" + options added. Fix interpic for multiple times if available in file. + +=============================================================== +=============================================================== + +ccm3_11 +Originator: erik ( Erik Kluzek) +Date: Thu Dec 21 16:22:20 MST 2000 +Model: CCM +Version: CCM3.11 +One-line Summary: New LW absorption,new vertical diffusion,SLD energy fixer, + scripts,Lin/Rood fixes,split dynamics +Requires change in build system: yes, new build system, use 26 level model +Tested on lr dynamics: yes +Tested on eul dynamics: yes +Tested on sld dynamics: yes +Tested to work coupled with CSM: no +Tested that restarts are bit-for-bit: yes +Tested multiple constituents: yes +Tested that different domain decompositions match bit-for-bit: yes +Tested in adiabatic mode: no (currently broken) +Substantial timing or memory changes: no +Machines tested: IBM, SGI, Sun, PC +Requires change in run script: yes + (New namelist parameter: absems_data) + (New namelist parameter for Lin-Rood: nsplit) + (New namelist parameter: empty_htapes) + (New namelist parameter: aqua-planet) + (New build/run environment provided) + (Need to use new 26 level datasets) +Updated the DatasetLog (for new input data-files): Yes +Updated the documentation: no (will need to though) +Changes answers: Yes (improved physics) +Name of tests cases on NCAR Mass-Store: See CCM3.10.60 below +Changes made: + +Physics changes from CCM3.10: + + New LW absorption of water vapor as per Dr. William Collins. + New vertical diffusion on dry static energy as per Dr. Byron Boville. + + Energy fixer for SLD from Dr. David Williamson and Jerry Olson. + Many bug-fixes to Lin/Rood dynamics. + Many routines migrated to modules. + +New build run environment provided: + + A completly new set of scripts provided to configure, build, and + run the model. Also a test script provided for testing before + committing code changes. + + A script provided to help with the process of interpolating and + creating new initial condition datasets. + +Code changes: + + Work to split dynamics and physics better. + Initial work on 2D decomposition. + Open MP works on PC. + More platforms supported with LR. + Add version, revision_id to history files. + Fix floating point trapping on Compaq. + Various bug-fixes. + +=============================================================== +=============================================================== + +ccm3_10 +Originator: erik ( Erik Kluzek) +Date: Tue Jun 20 08:35:26 MDT 2000 +Model: CCM +Version: CCM3.10 +One-line Summary: Update code to F90 and coding standard, + optimize radcsw, fix bugs, new LR core, + Finish reduced grid tools +Requires change in build system: no +Tested on lr dynamics: Yes +Tested on eul dynamics: Yes +Tested on sld dynamics: Yes +Tested to work coupled with CSM: Yes +Requires change in run script: Yes (requires I/C files with LANDM) +Updated the DatasetLog (for new input data-files): Yes +Updated the documentation: Yes +Changes answers: Yes (different climate) +Name of tests cases on NCAR Mass-Store: /JET/csm/ccm3911 (full grid Eulerian) + /ROSINSKI/csm/ccm3911_r1up (reduced grid Eul) +Changes made: + + Double tagged as CCM3.9.28. + + Update code to F90 free-form and coding standard. + New optimized version of radcsw. Fix bug with CSM with flxave on. Fix bug + with first time-step on Eulerian. Get offline tools to work with reduced + grid and L/R dynamics. Change so LANDM is calculated in offline tool rather + than inside model. Update L/R to new version, add "precision" changes. Fix + Linux Makefile for F90 files. Fix bug with SLD and hortal smoothing and hordif. + Fix problems with SLD on Sun, IBM and Compaq. Fix PHIS filter bug. + +=============================================================== +=============================================================== + +ccm3_9 +Originator: erik ( Erik Kluzek) +Date: Thu Apr 27 15:04:53 MDT 2000 +Model: CCM +Version: CCM3.9 +One-line Summary: New cloud overlap, reduced grid option, addition of Lin-Rood dynamics. +Requires change in build system: Yes +Requires change in run script: Yes +(New options for reduced grid, or Lin-Rood) +Updated the DatasetLog (for new input data-files): not-applicable +Updated the CCM development schedule: no +Updated the documentation: Yes +Changes answers: Yes (new-climate) +Name of tests cases on NCAR Mass-Store: /JET/csm/bill30e +Changes made: + + Added new cloud overlap assumptions from Bill Collins (random overlap when gap + between clouds in column, maximum overlap when clouds exist in both adjoining + layers). + + Added the reduced grid option from Dave Williamson. + + Added Lin-Rood dynamics as a new dynamics configuration. + + Output cleanup. Code cleanup. Two default output streams monthly and daily + files. + + Support IBM and Compaq. Will compile/run on Cray, but radiation changes + turned on. + (a fix is on the way soon). + +=============================================================== From 159502b85290e99fcb7b4afc48a5a9b9fdc5ebf9 Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 8 Oct 2025 15:56:37 -0600 Subject: [PATCH 444/466] remove unnecessary gpu directives --- src/physics/rrtmgp/radiation.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/physics/rrtmgp/radiation.F90 b/src/physics/rrtmgp/radiation.F90 index 5583c2260c..475119b247 100644 --- a/src/physics/rrtmgp/radiation.F90 +++ b/src/physics/rrtmgp/radiation.F90 @@ -1251,9 +1251,6 @@ subroutine radiation_tend( & ! Compute the gas optics (stored in atm_optics_sw). ! toa_flux is the reference solar source from RRTMGP data. !$acc data copyin(kdist_sw%gas_props,pmid_day,pint_day,t_day,gas_concs_sw%gas_concs,atm_optics_sw%optical_props) & - !$acc copy(atm_optics_sw%optical_props%tau, & - !$acc atm_optics_sw%optical_props%g, & - !$acc atm_optics_sw%optical_props%ssa) & !$acc copyout(toa_flux) call rrtmgp_sw_gas_optics_run(dosw, 1, nday, nday, pmid_day, pint_day, t_day, & gas_concs_sw, atm_optics_sw, kdist_sw, toa_flux, errmsg, errflg) From 992fd3d71f448be5402e405afd0d65e9b18142be Mon Sep 17 00:00:00 2001 From: peverwhee Date: Wed, 8 Oct 2025 16:32:32 -0600 Subject: [PATCH 445/466] update atmospheric physics tag --- .gitmodules | 4 ++-- src/atmos_phys | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 56ba0ded94..52b6265a67 100644 --- a/.gitmodules +++ b/.gitmodules @@ -28,8 +28,8 @@ [submodule "atmos_phys"] path = src/atmos_phys - url = https://github.com/sjsprecious/atmospheric_physics - fxtag = 5b48970 + url = https://github.com/ESCOMP/atmospheric_physics + fxtag = atmos_phys0_18_002 fxrequired = AlwaysRequired fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics diff --git a/src/atmos_phys b/src/atmos_phys index 5b48970d3c..98af1fa354 160000 --- a/src/atmos_phys +++ b/src/atmos_phys @@ -1 +1 @@ -Subproject commit 5b48970d3ce794b178c858308a5157e6c3f0efd9 +Subproject commit 98af1fa354176879f971ad160434d212e1048d04 From 4f7b5f8ed0e677cc786e48486af9f69e6ff0a55b Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 16 Oct 2025 14:17:52 -0600 Subject: [PATCH 446/466] fix bad merge in namelist_defaults_cam --- bld/namelist_files/namelist_defaults_cam.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index c8b18a1611..d83d6b291d 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -3417,6 +3417,14 @@ 7 10 + 3 + 2 + 2 + 4 + 2 + 3 + 5 + 3 2 2 From 934f4c77033d23de2b4daa4ddc4c975781202cd4 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 23 Oct 2025 11:26:03 -0600 Subject: [PATCH 447/466] updated clubb+mf test --- .../cam/outfrq9s_clubbmf/shell_commands | 1 - .../cam/outfrq9s_clubbmf/user_nl_cam | 27 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands index c8762f7cbf..eb40ad83e0 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/shell_commands @@ -1,3 +1,2 @@ ./xmlchange ROF_NCPL=\$ATM_NCPL ./xmlchange GLC_NCPL=\$ATM_NCPL -./xmlchange CAM_CONFIG_OPTS='-phys cam6 -microphys mg2' --append diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index b70d0e8205..bdd93f92fb 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -4,24 +4,33 @@ nhtfrq=9,9,9,9,9,9 !nhtfrq=1,1,1,1,1,1 inithist='ENDOFRUN' -do_clubb_mf=.true. -do_clubb_mf_diag=.true. -do_clubb_mf_rad=.true. -do_clubb_mf_precip=.true. -deep_scheme='off' +do_clubb_mf = .true. +do_clubb_mf_diag = .true. +do_clubb_mf_precip = .true. +do_clubb_mf_rad = .true. +do_clubb_mf_addtke = .true. clubb_mf_nup = 25 +clubb_mf_ent0 = 0.2 clubb_mf_Lopt = 6 clubb_mf_up_ndt = 1 -clubb_mf_a0 = 2.0D0 -clubb_mf_b0 = 0.5D0 -clubb_mf_max_L0 = 1000.0D0 +clubb_mf_a0 = 0.15D0 +clubb_mf_b0 = 1.0D0 clubb_mf_alphturb = 3.0D0 +clubb_mf_max_L0 = 1000.00D0 do_clubb_mf_rhtke = .true. clubb_mf_fdd = 0.5 do_clubb_mf_coldpool = .true. clubb_mf_cp_ndt = 1 -clubb_mf_ddalph = 500. +clubb_mf_ddalph = 12. clubb_mf_ddbeta = 1.0 +clubb_mf_ddexp = 3.0 + +do_clubb_mf_lscale_perplume = .true. +do_clubb_mf_coldpool_perplume = .true. + +do_clubb_mf_aloft = .true. +clubb_l_predict_upwp_vpwp = .false. +clubb_l_do_expldiff_rtm_thlm = .false. From 0a0b6ac1417aeb61edd628a32978068dee541c14 Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 23 Oct 2025 11:42:55 -0600 Subject: [PATCH 448/466] forgot a couple namelists in clubbmf test --- .../testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam index bdd93f92fb..a2083e3357 100644 --- a/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam +++ b/cime_config/testdefs/testmods_dirs/cam/outfrq9s_clubbmf/user_nl_cam @@ -4,6 +4,9 @@ nhtfrq=9,9,9,9,9,9 !nhtfrq=1,1,1,1,1,1 inithist='ENDOFRUN' +deep_scheme = 'off' +use_gw_convect_dp = .false. +use_gw_movmtn_pbl = .false. do_clubb_mf = .true. do_clubb_mf_diag = .true. From 6aca81ccbc726fe97252d01b5c9a84a5fb8c149d Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 11 Dec 2025 15:51:15 -0700 Subject: [PATCH 449/466] address copilot review --- bld/namelist_files/namelist_defaults_cam.xml | 10 +--------- bld/namelist_files/namelist_definition.xml | 10 +++++----- src/utils/time_manager.F90 | 12 ------------ 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index d83d6b291d..bd0eb0e5fa 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2328,7 +2328,7 @@ 10 10.e3 0.0 - .false + .false. 2.e2 1.0 1.0 @@ -2354,14 +2354,6 @@ 10 10 - - 10 - 10 - 10 - 10 - 10 - 10 - .false. .false. diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 1e884ff983..9608a6912f 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4424,7 +4424,7 @@ Default: 2.0 -Real: expoential coefficient relating ztop/cape to entrainment length scale +Real: exponential coefficient relating ztop/cape to entrainment length scale Default: 0.5 @@ -4448,7 +4448,7 @@ Default: 10 -Real: limiter on entrainmnet length scale + threshold to diable TKE enhanced entrainmnet +Real: limiter on entrainment length scale + threshold to disable TKE enhanced entrainmnet Default: 10.e3 @@ -4550,7 +4550,7 @@ Default: 1 -If .true. turn on elevated convective initiliazation +If .true. turn on elevated convective initialization Default: .false. @@ -6353,13 +6353,13 @@ Default: set by build-namelist. -templatefull path for analysis forcing dataset. +template path for analysis forcing dataset. Default: set by build-namelist. -Force scam to compute large-scale forcing from renalysis or 3D model output +Force scam to compute large-scale forcing from reanalysis or 3D model output Default: FALSE diff --git a/src/utils/time_manager.F90 b/src/utils/time_manager.F90 index 43c27fcf61..af211e5fe4 100644 --- a/src/utils/time_manager.F90 +++ b/src/utils/time_manager.F90 @@ -1229,18 +1229,6 @@ subroutine timemgr_time_inc(ymd1, tod1, ymd2, tod2, inc_s, inc_h, inc_d) ! set esmf time object date1 = TimeSetymd( ymd1, tod1, "date1" ) -!++jtb - if (present(inc_s)) then - if ((inc_s >= 10*365*86400) .OR. (inc_s == -999999)) then - ymd2 = ymd1 + 500 * 10000 - tod2 = 0 - if (masterproc) write(iulog,*) "500 year inc", ymd1,ymd2 - RETURN - end if - end if -!--jtb - - ! set esmf time interval object if (present(inc_s)) then call ESMF_TimeIntervalSet(t_interval, s=inc_s, rc=rc) From 254a0baf6c1b6f0390344abe8da7de02a74ff7aa Mon Sep 17 00:00:00 2001 From: adamrher Date: Thu, 11 Dec 2025 16:57:44 -0700 Subject: [PATCH 450/466] address Jon's review --- bld/namelist_files/namelist_definition.xml | 73 ------------------- .../testmods_dirs/cam/outfrq9s/shell_commands | 1 - src/chemistry/utils/aircraft_emit.F90 | 5 +- src/control/cam_snapshot_common.F90 | 3 - src/cpl/nuopc/atm_comp_nuopc.F90 | 35 --------- src/physics/cam/clubb_intr.F90 | 30 +++----- src/physics/cam/ref_pres.F90 | 6 +- 7 files changed, 13 insertions(+), 140 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 9608a6912f..7e2ef83adb 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -6290,79 +6290,6 @@ Force scam to use the lat lon fields specified in the scam namelist not what is Default: FALSE - -SCAM to calculate or read tendencies from a global ana/dycore -Default: FALSE - - - -Use 1st order upwind for ana tendencies (instead of 2nd order space centered) -Default: FALSE - - - -Use scam state as center column in stencil for ana adv tendencies -Default: FALSE - - - -Use scam state as center column in stencil for ana adv tendencies -Default: FALSE - - - -Use scam state as center column in stencil for ana adv tendencies -Default: FALSE - - - -Use scam state as center column in stencil for ana adv tendencies -Default: FALSE - - - -Force scam to use tendencies directly from dycore or ana (not recalculated) -Default: FALSE - - - -Force scam to use omega directly from dycore or ana (not recalculated) -Default: FALSE - - - -Interpolate ana fields to constant pressure surfaces -Default: FALSE - - - - -template for analysis forcing dataset. -Default: set by build-namelist. - - - -template path for analysis forcing dataset. -Default: set by build-namelist. - - - -Force scam to compute large-scale forcing from reanalysis or 3D model output -Default: FALSE - - Date: Thu, 18 Dec 2025 13:28:16 -0700 Subject: [PATCH 451/466] Add back in BFB change to allow regression testing going forward will put back in a future commit and fix se_nsplit default for se regression test. --- bld/namelist_files/namelist_defaults_cam.xml | 8 ++++---- bld/namelist_files/namelist_definition.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index bd0eb0e5fa..042e913ae6 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2320,7 +2320,7 @@ .false. .false. 50.0 - 0.2 + 0.22 0.0 0 2.0 @@ -2994,7 +2994,7 @@ 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' - + 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' @@ -3378,8 +3378,8 @@ .true. .true. - 2 - 1 + 2 + 1 3 3 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 7e2ef83adb..55f54d34bc 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3160,7 +3160,7 @@ Default: .true. for CAM6; all others => .false. For small ice cloud concentrations, take the geometric mean of the iceopt=4 and iceopt=5 area fractions -Default: .true. for CAM_DEV; all others .false. +Default: .true. for CAM7; all others .false. Date: Thu, 18 Dec 2025 22:14:15 -0700 Subject: [PATCH 452/466] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- bld/namelist_files/namelist_definition.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 55f54d34bc..783016f825 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4439,6 +4439,7 @@ Default: 0.22 group="clubb_mf_nl" valid_values="" > Weighting factor for CLUBB TKE on plume entrainment Default: 0.0 + From b6d191beaef59b76c1969b1dafc26db7647d2f6c Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:21:00 -0700 Subject: [PATCH 453/466] Update namelist_definition.xml with new entries Added new entries for downdraft enhancement factors and pressure drag term in the namelist definition. --- bld/namelist_files/namelist_definition.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 783016f825..02c467970d 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4468,26 +4468,31 @@ Default: .false. group="clubb_mf_nl" valid_values="" > Linear enhancement factor to the downdrafts used for the cold pool calculations Default: 200.0 - + + Exponent enhancement factor to the downdrafts used for the cold pool calculations Default: 1.0 - + + Enhancement factor for the near surface pressure drag term in downdraft equation Default: 1.0 - + + Elevation power law exponent for downdrafts velocities in the subcloud layer Default: 3.0 + Factor to increase the ensemble MF plume cloud fractions Default: 1.0 + From fbe4c399af5a4e40c62b94925f688073c4b7daf4 Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:27:48 -0700 Subject: [PATCH 454/466] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 8aba214b96..0dc78d4be4 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -1460,7 +1460,7 @@ subroutine integrate_mf( nz, do k=kstart,nz ! return if no convection at k=2 if (k == 2 .and. ac(k) == 0._r8 .and. .not.aloft) then - sqt(k) = 0_r8 + sqt(k) = 0._r8 sthl(k) = 0._r8 ztopm1(:) = zm(1) ddcp(:) = 0._r8 From e12163815777cdcdefdc0a601ac840f70d2117ea Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:39:33 -0700 Subject: [PATCH 455/466] Fix formatting of clubb_mf_cldfrac_fac entry --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 042e913ae6..97519a6f91 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2333,7 +2333,7 @@ 1.0 1.0 3.0 - 1.0 + 1.0 .false. .false. 1 From f6c078364164de3d4ffe2b26fd5c0b8d70ecdfad Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:41:39 -0700 Subject: [PATCH 456/466] Update namelist_definition.xml with new entries --- bld/namelist_files/namelist_definition.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index 02c467970d..cb20b8f4c7 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -4457,6 +4457,7 @@ Default: 10.e3 group="clubb_mf_nl" valid_values="" > Fraction of autoconversion partitioned to downdrafts (zero means no downdrafts) Default: 0.0 + From 677c5027976cca1df4ebf9448de66499f790a275 Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:43:41 -0700 Subject: [PATCH 457/466] Update src/utils/time_manager.F90 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/utils/time_manager.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/time_manager.F90 b/src/utils/time_manager.F90 index af211e5fe4..e0d9d49464 100644 --- a/src/utils/time_manager.F90 +++ b/src/utils/time_manager.F90 @@ -1223,7 +1223,7 @@ subroutine timemgr_time_inc(ymd1, tod1, ymd2, tod2, inc_s, inc_h, inc_d) type(ESMF_Time) :: date2 type(ESMF_TimeInterval) :: t_interval - integer :: year, month, day + integer :: year, month, day !----------------------------------------------------------------------------------------- ! set esmf time object From 1aa8989d2daf82c5c1458f2f40c9243a4620ac4c Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:45:07 -0700 Subject: [PATCH 458/466] Fix formatting of character declarations in Fortran file --- src/physics/cam/cloud_rad_props.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/cloud_rad_props.F90 b/src/physics/cam/cloud_rad_props.F90 index 4fad92cdd2..da15a72a96 100644 --- a/src/physics/cam/cloud_rad_props.F90 +++ b/src/physics/cam/cloud_rad_props.F90 @@ -95,8 +95,8 @@ subroutine cloud_rad_props_init(tiny_out) #endif real(r8), intent(out) :: tiny_out - character(len=256) :: liquidfile - character(len=256) :: icefile + character(len=256) :: liquidfile + character(len=256) :: icefile character(len=256) :: locfn integer :: ncid, dimid, f_nlwbands, f_nswbands, ierr From 7fa70967d228a6c902d71b69731e00ab7b865810 Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:47:14 -0700 Subject: [PATCH 459/466] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/physics/cam/clubb_mf.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 0dc78d4be4..666c863b2c 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -630,8 +630,10 @@ subroutine integrate_mf( nz, end do kmid = 1 -!+++arh - !do while (zm(kmid) < 9.E3_r8) + ! Use a pressure-based criterion to locate the mid-level within the + ! troposphere. A threshold of ~500 hPa is preferred over the previous + ! fixed height (9 km) because it better represents the tropopause + ! location across different atmospheric conditions. do while (p_zm(kmid) > 500.E2_r8) kmid = kmid+1 end do From 401bb9eab6a72d6faa2f2ec3283b35985512e1aa Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 22:48:08 -0700 Subject: [PATCH 460/466] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/physics/cam/clubb_mf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/physics/cam/clubb_mf.F90 b/src/physics/cam/clubb_mf.F90 index 666c863b2c..7402b775e0 100644 --- a/src/physics/cam/clubb_mf.F90 +++ b/src/physics/cam/clubb_mf.F90 @@ -38,7 +38,7 @@ module clubb_mf ! 2 = wpthlp_clubb L0 ! 3 = test plume L0 ! 4 = lel - ! 4 = cape + ! 5 = cape ! 6 = ztopm1 ! 7 = rel.hum. at 500 hPa ! 8 = column int. rel.hum. From dd55f2d8ca211d9d3953725e85ca85c5835b870a Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 23:00:41 -0700 Subject: [PATCH 461/466] Remove parameter logging from iop_forcing Removed logging of parameters in iop_forcing. --- src/physics/cam/iop_forcing.F90 | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/physics/cam/iop_forcing.F90 b/src/physics/cam/iop_forcing.F90 index 7f309caabc..f5db9cd5d1 100644 --- a/src/physics/cam/iop_forcing.F90 +++ b/src/physics/cam/iop_forcing.F90 @@ -39,17 +39,6 @@ subroutine scam_use_iop_srf( cam_in ) integer :: c ! Chunk index integer :: ncol ! Number of columns - - if (masterproc) write(iulog,*) " Parameters in iop_forcing :" - if (masterproc) write(iulog,*) " scm_iop_lhflxshflxTg =", scm_iop_lhflxshflxTg - if (masterproc) write(iulog,*) " scm_iop_Tg =", scm_iop_Tg - if (masterproc) write(iulog,*) " scm_crm_mode =", scm_crm_mode - if (masterproc) write(iulog,*) " have_lhflx =", have_lhflx - if (masterproc) write(iulog,*) " have_shflx =", have_shflx - if (masterproc) write(iulog,*) " have_Tg =", have_Tg - if (masterproc) write(iulog,*) " Tground =", tground - - if( scm_iop_lhflxshflxTg .and. scm_iop_Tg ) then call endrun( 'scam_use_iop_srf : scm_iop_lhflxshflxTg and scm_iop_Tg must not be specified at the same time.') end if From a4d8bfede685d4c8b32a799a94d2a03c76081a08 Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 23:02:03 -0700 Subject: [PATCH 462/466] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/utils/time_manager.F90 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/time_manager.F90 b/src/utils/time_manager.F90 index e0d9d49464..bf40b296c8 100644 --- a/src/utils/time_manager.F90 +++ b/src/utils/time_manager.F90 @@ -694,7 +694,16 @@ subroutine get_start_date(yr, mon, day, tod) end subroutine get_start_date !========================================================================================= -!+++arh manually add get_stop_date & get_run_duration (mpas build failure) +! NOTE: The following wrappers (e.g., get_stop_date) are maintained to satisfy +! external MPAS build/link requirements. Some MPAS configurations expect +! these specific time_manager entry points to be available; if they are +! missing, the MPAS build fails with unresolved symbol errors. +! +! These routines follow the same pattern as get_start_date/get_prev_date +! and simply expose ESMF_Clock/ESMF_Time state through the legacy CAM +! interface used by MPAS. Do not remove or rename them unless the MPAS +! coupling/interface code has been updated to stop referencing them and +! the build has been verified without these wrappers. !========================================================================================= From d6d306038438fd16769c0aa68bdce1c102237a0c Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 23:04:33 -0700 Subject: [PATCH 463/466] Update clubb submodule URL and related fields --- .gitmodules | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index d8dde5bdee..e4ce4e33c3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -101,14 +101,11 @@ [submodule "clubb"] path = src/physics/clubb -# url = https://github.com/larson-group/clubb_release - url = https://github.com/adamrher/clubb_release + url = https://github.com/adamrher/clubb_release fxrequired = AlwaysRequired - fxsparse = ../.clubb_sparse_checkout -# fxtag = clubb_4ncar_20240605_73d60f6_gpufixes_posinf + fxsparse = ../.clubb_sparse_checkout fxtag = d224307f798b654f5312a9f035568c8a99ca400c -# fxDONOTUSEurl = https://github.com/larson-group/clubb_release - fxDONOTUSEurl = https://github.com/adamrher/clubb_release + fxDONOTUSEurl = https://github.com/adamrher/clubb_release [submodule "cism"] path = components/cism From 68575dcf17cd56332e7e6ecf730c6884365ff75f Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 23:09:42 -0700 Subject: [PATCH 464/466] Update src/control/cam_snapshot_common.F90 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/control/cam_snapshot_common.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/control/cam_snapshot_common.F90 b/src/control/cam_snapshot_common.F90 index a465113dff..fca111917d 100644 --- a/src/control/cam_snapshot_common.F90 +++ b/src/control/cam_snapshot_common.F90 @@ -86,6 +86,11 @@ module cam_snapshot_common type (snapshot_type) :: tend_snapshot(6) type (snapshot_type) :: cam_in_snapshot(pcnst+31) ! needs to be bigger than pcnst because cam_in is split by constituent. type (snapshot_type) :: cam_out_snapshot(30) +! pbuf_snapshot must be large enough to hold all pbuf fields that can be written by the +! snapshot logic. npbuf_all (currently 310) covers the hard-wired pbuf fields; the extra +! margin here allows for additional data-driven pbuf fields and future expansion. +! If new pbuf fields are added to the model or more fields are snapshotted, increase this +! bound so that it remains >= the maximum number of pbuf entries used. type (snapshot_type_nd) :: pbuf_snapshot(350) contains From 638c98c8aa2e28f82102b5cdf260e3b09ce68455 Mon Sep 17 00:00:00 2001 From: jtruesdal Date: Thu, 18 Dec 2025 23:11:05 -0700 Subject: [PATCH 465/466] Update bld/namelist_files/namelist_defaults_cam.xml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 97519a6f91..139b160bb0 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2994,7 +2994,7 @@ 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' - + 'T', 'bc_a1', 'bc_a4', 'dst_a1', 'dst_a2', 'dst_a3', 'ncl_a1', 'ncl_a2', 'ncl_a3', 'num_a1', 'num_a2', 'num_a3', 'num_a4', 'pom_a1', 'pom_a4', 'so4_a1', 'so4_a2', 'so4_a3', 'soa_a1', 'soa_a2' From 5ce7600f1772bc29d5c9b1fde660e99e8567d53e Mon Sep 17 00:00:00 2001 From: John Truesdale Date: Fri, 19 Dec 2025 11:40:41 -0700 Subject: [PATCH 466/466] push Adams changes for aircraft emissions and clubb_mf parameter --- bld/namelist_files/namelist_defaults_cam.xml | 2 +- src/chemistry/utils/aircraft_emit.F90 | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 042e913ae6..840139dd11 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2320,7 +2320,7 @@ .false. .false. 50.0 - 0.22 + 0.2 0.0 0 2.0 diff --git a/src/chemistry/utils/aircraft_emit.F90 b/src/chemistry/utils/aircraft_emit.F90 index f2a242aa63..3ba13c2d4f 100644 --- a/src/chemistry/utils/aircraft_emit.F90 +++ b/src/chemistry/utils/aircraft_emit.F90 @@ -156,6 +156,7 @@ subroutine aircraft_emit_init() ! **** Initialize the aircraft aerosol data handling **** !------------------------------------------------------------------- use cam_history, only: addfld, add_default + use dycore, only: dycore_is use tracer_data, only: trcdata_init use phys_control, only: phys_getopts @@ -208,7 +209,12 @@ subroutine aircraft_emit_init() !----------------------------------------------------------------------- forcings_air(m)%file%stepTime = .true. ! Aircraft data is not to be interpolated in time forcings_air(m)%file%cyclical_list = .true. ! Aircraft data cycles over the filename list - forcings_air(m)%file%weight_by_lat = .true. ! Aircraft data - interpolated with latitude weighting + + if (dycore_is('LR')) then + forcings_air(m)%file%weight_by_lat = .true. ! Aircraft data - interpolated with latitude weighting + else + forcings_air(m)%file%weight_by_lat = .false. ! Aircraft data - interpolated with latitude weighting + end if forcings_air(m)%file%conserve_column = .true. ! Aircraft data - vertically interpolated to conserve the total column forcings_air(m)%file%dist = dist(m) forcings_air(m)%species = spc_name