Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bld/namelist_files/namelist_definition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5193,19 +5193,19 @@ Interpolate ana fields to constant pressure surfaces
Default: FALSE
</entry>


<entry id="scm_ana_frc_file_template" type="char*128" input_pathname="abs" category="scam"
<entry id="scm_ana_frc_file_template" type="char*128" category="scam"
group="scam_nl" valid_values="" >
template for analysis forcing dataset.
Default: set by build-namelist.
Default: none
</entry>

<entry id="scm_ana_frc_path" type="char*128" input_pathname="abs" category="scam"
<entry id="scm_ana_frc_path" type="char*256" input_pathname="abs" category="scam"
group="scam_nl" valid_values="" >
templatefull path for analysis forcing dataset.
Default: set by build-namelist.
Default: none
</entry>


<entry id="scm_use_ana_iop" type="logical" category="scam"
group="scam_nl" valid_values="">
Force scam to compute large-scale forcing from renalysis or 3D model output
Expand Down
8 changes: 6 additions & 2 deletions src/chemistry/mozart/upper_bc.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

module upper_bc

!---------------------------------------------------------------------------------
Expand Down Expand Up @@ -157,11 +156,16 @@ subroutine ubc_init()
use mo_snoe, only: snoe_inti
use mo_msis_ubc, only: msis_ubc_inti
use constituents,only: cnst_get_ind
use scamMod,only: single_column

!---------------------------Local workspace-----------------------------
logical :: zonal_avg
!-----------------------------------------------------------------------
apply_upper_bc = ptop_ref<1._r8 ! Pa
if ( .not.(single_column) ) then
apply_upper_bc = ptop_ref<1._r8 ! Pa
else
apply_upper_bc = .FALSE. ! Always false for HiTop SCAM config
end if

if (.not.apply_upper_bc) return

Expand Down
101 changes: 99 additions & 2 deletions src/physics/cam/cam_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ module cam_diagnostics
integer :: kvh_idx = 0
integer :: cush_idx = 0
integer :: t_ttend_idx = 0
integer :: t_utend_idx = 0
integer :: t_vtend_idx = 0

integer :: prec_dp_idx = 0
integer :: snow_dp_idx = 0
Expand Down Expand Up @@ -150,6 +152,8 @@ subroutine diag_register_dry()

! Request physics buffer space for fields that persist across timesteps.
call pbuf_add_field('T_TTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_ttend_idx)
call pbuf_add_field('T_UTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_utend_idx)
call pbuf_add_field('T_VTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_vtend_idx)
end subroutine diag_register_dry

subroutine diag_register_moist()
Expand Down Expand Up @@ -195,6 +199,8 @@ subroutine diag_init_dry(pbuf2d)

! State before physics
call addfld ('TBP', (/ 'lev' /), 'A','K', 'Temperature (before physics)')
call addfld ('UBP', (/ 'lev' /), 'A','m/s2', 'Zonal wind (before physics)')
call addfld ('VBP', (/ 'lev' /), 'A','m/s2', 'Meridional Wind (before physics)')
call addfld (bpcnst(1), (/ 'lev' /), 'A','kg/kg', trim(cnst_longname(1))//' (before physics)')
! State after physics
call addfld ('TAP', (/ 'lev' /), 'A','K', 'Temperature (after physics)' )
Expand All @@ -208,7 +214,11 @@ subroutine diag_init_dry(pbuf2d)
call addfld ('TFIX', horiz_only, 'A', 'K/s', 'T fixer (T equivalent of Energy correction)')
end if
call addfld ('TTEND_TOT', (/ 'lev' /), 'A', 'K/s', 'Total temperature tendency')


call addfld ('UTEND_TOT', (/ 'lev' /), 'A', 'm/s2', 'Total zonal wind tendency')
call addfld ('VTEND_TOT', (/ 'lev' /), 'A', 'm/s2', 'Total meridional wind tendency')
call register_vector_field('UTEND_TOT','VTEND_TOT')

! Debugging negative water output fields
call addfld ('INEGCLPTEND ', (/ 'lev' /), 'A', 'kg/kg/s', 'Cloud ice tendency due to clipping neg values after microp')
call addfld ('LNEGCLPTEND ', (/ 'lev' /), 'A', 'kg/kg/s', 'Cloud liq tendency due to clipping neg values after microp')
Expand Down Expand Up @@ -330,9 +340,13 @@ subroutine diag_init_dry(pbuf2d)
call add_default ('U ' , history_budget_histfile_num, ' ')
call add_default ('V ' , history_budget_histfile_num, ' ')
call add_default ('TTEND_TOT' , history_budget_histfile_num, ' ')
call add_default ('UTEND_TOT' , history_budget_histfile_num, ' ')
call add_default ('VTEND_TOT' , history_budget_histfile_num, ' ')

! State before physics (FV)
call add_default ('TBP ' , history_budget_histfile_num, ' ')
call add_default ('UBP ' , history_budget_histfile_num, ' ')
call add_default ('VBP ' , history_budget_histfile_num, ' ')
call add_default (bpcnst(1) , history_budget_histfile_num, ' ')
! State after physics (FV)
call add_default ('TAP ' , history_budget_histfile_num, ' ')
Expand All @@ -351,9 +365,68 @@ subroutine diag_init_dry(pbuf2d)
end if

! outfld calls in diag_phys_tend_writeout
call addfld ('PTTEND', (/ 'lev' /), 'A', 'K/s','T total physics tendency' )
call addfld ('PTTEND', (/ 'lev' /), 'A', 'K/s','T total physics tendency')
call addfld ('UTEND_PHYSTOT', (/ 'lev' /), 'A', 'm/s2','U total physics tendency')
call addfld ('VTEND_PHYSTOT', (/ 'lev' /), 'A', 'm/s2','V total physics tendency')
call register_vector_field('UTEND_PHYSTOT','VTEND_PHYSTOT')
if ( history_budget ) then
call add_default ('PTTEND' , history_budget_histfile_num, ' ')
call add_default ('UTEND_PHYSTOT' , history_budget_histfile_num, ' ')
call add_default ('VTEND_PHYSTOT' , history_budget_histfile_num, ' ')
end if

! outfld calls in physpkg
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')
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, ' ')
end if

! create history variables for fourier coefficients of the diurnal
Expand Down Expand Up @@ -613,6 +686,8 @@ subroutine diag_init_moist(pbuf2d)
if ( history_budget ) then
call add_default (cnst_name(1), history_budget_histfile_num, ' ')
call add_default ('PTTEND' , history_budget_histfile_num, ' ')
call add_default ('UTEND_PHYSTOT' , history_budget_histfile_num, ' ')
call add_default ('VTEND_PHYSTOT' , history_budget_histfile_num, ' ')
call add_default (ptendnam( 1), history_budget_histfile_num, ' ')
if (ixcldliq > 0) then
call add_default (ptendnam(ixcldliq), history_budget_histfile_num, ' ')
Expand Down Expand Up @@ -862,6 +937,8 @@ subroutine diag_conv_tend_ini(state,pbuf)

integer :: i, k, m, lchnk, ncol
real(r8), pointer, dimension(:,:) :: t_ttend
real(r8), pointer, dimension(:,:) :: t_utend
real(r8), pointer, dimension(:,:) :: t_vtend

lchnk = state%lchnk
ncol = state%ncol
Expand All @@ -885,6 +962,10 @@ subroutine diag_conv_tend_ini(state,pbuf)
do m = 1, dyn_time_lvls
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_ttend(:ncol,:) = state%t(:ncol,:)
call pbuf_get_field(pbuf, t_utend_idx, t_utend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_utend(:ncol,:) = state%u(:ncol,:)
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_vtend(:ncol,:) = state%v(:ncol,:)
end do
end if

Expand Down Expand Up @@ -2018,6 +2099,8 @@ subroutine diag_phys_tend_writeout_dry(state, pbuf, tend, ztodt)
real(r8) :: heat_glob ! global energy integral (FV only)
! CAM pointers to get variables from the physics buffer
real(r8), pointer, dimension(:,:) :: t_ttend
real(r8), pointer, dimension(:,:) :: t_utend
real(r8), pointer, dimension(:,:) :: t_vtend
integer :: itim_old,m

!-----------------------------------------------------------------------
Expand All @@ -2043,19 +2126,31 @@ subroutine diag_phys_tend_writeout_dry(state, pbuf, tend, ztodt)
ftem3(:ncol,:pver) = tend%dtdt(:ncol,:pver)
end if
call outfld('PTTEND',ftem3, pcols, lchnk )
ftem3(:ncol,:pver) = tend%dudt(:ncol,:pver)
call outfld('UTEND_PHYSTOT',ftem3, pcols, lchnk )
ftem3(:ncol,:pver) = tend%dvdt(:ncol,:pver)
call outfld('VTEND_PHYSTOT',ftem3, pcols, lchnk )

! Total (physics+dynamics, everything!) tendency for Temperature

!! get temperature stored in physics buffer
itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))
call pbuf_get_field(pbuf, t_utend_idx, t_utend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))

!! calculate and outfld the total temperature tendency
ftem3(:ncol,:) = (state%t(:ncol,:) - t_ttend(:ncol,:))/ztodt
call outfld('TTEND_TOT', ftem3, pcols, lchnk)
ftem3(:ncol,:) = (state%u(:ncol,:) - t_utend(:ncol,:))/ztodt
call outfld('UTEND_TOT', ftem3, pcols, lchnk)
ftem3(:ncol,:) = (state%v(:ncol,:) - t_vtend(:ncol,:))/ztodt
call outfld('VTEND_TOT', ftem3, pcols, lchnk)

!! update physics buffer with this time-step's temperature
t_ttend(:ncol,:) = state%t(:ncol,:)
t_utend(:ncol,:) = state%u(:ncol,:)
t_vtend(:ncol,:) = state%v(:ncol,:)

end subroutine diag_phys_tend_writeout_dry

Expand Down Expand Up @@ -2220,6 +2315,8 @@ subroutine diag_state_b4_phys_write_dry (state)
lchnk = state%lchnk

call outfld('TBP', state%t, pcols, lchnk )
call outfld('UBP', state%u, pcols, lchnk )
call outfld('VBP', state%v, pcols, lchnk )

end subroutine diag_state_b4_phys_write_dry

Expand Down
16 changes: 14 additions & 2 deletions src/physics/cam/check_energy.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

module check_energy

!---------------------------------------------------------------------------------
Expand Down Expand Up @@ -66,6 +65,8 @@ module check_energy

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
Expand Down Expand Up @@ -137,9 +138,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('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
Expand Down Expand Up @@ -173,7 +178,7 @@ subroutine check_energy_init()
! Initialize the energy conservation module
!
!-----------------------------------------------------------------------
use cam_history, only: addfld, add_default, horiz_only
use cam_history, only: addfld, add_default, horiz_only, register_vector_field
use phys_control, only: phys_getopts

implicit none
Expand All @@ -193,12 +198,19 @@ 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('DUCORE', (/ 'lev' /), 'A', 'm/s2' , 'U tendency due to dynamical core')
call addfld('DVCORE', (/ 'lev' /), 'A', 'm/s2' , 'V tendency due to dynamical core')
call register_vector_field('DUCORE','DVCORE')

if ( history_budget ) then
call add_default ('DTCORE', history_budget_histfile_num, ' ')
call add_default ('DUCORE', history_budget_histfile_num, ' ')
call add_default ('DVCORE', history_budget_histfile_num, ' ')
end if
if ( history_waccm ) then
call add_default ('DTCORE', 1, ' ')
call add_default ('DUCORE', 1, ' ')
call add_default ('DVCORE', 1, ' ')
end if

end subroutine check_energy_init
Expand Down
3 changes: 2 additions & 1 deletion src/physics/cam/gw_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ subroutine gw_drag_readnl(nlfile)
gw_lndscl_sgh, gw_prndl, gw_apply_tndmax, gw_qbo_hdepth_scaling, &
gw_top_taper
!----------------------------------------------------------------------

! Gratuitous mod to learn git Dec 2021
!----------------------------------------------------------------------
if (use_simple_phys) return

if (masterproc) then
Expand Down
Loading