Skip to content

Commit

Permalink
Fixes to ensure that SCM can be run in ACME and with CIME5
Browse files Browse the repository at this point in the history
Merge branch 'bogensch/atm/SCM_dev' (PR #1252)

Changes mostly only effect Eulerian dycore (many of these changes originated from Wuyin),
thus all baseline tests are b4b. Also includes small modifications to CIME5 to sure
that the Eulerian core (and thus SCM) will still work.

  . changes to run SCM and ARM97
  . changes for SCM to work
  . update for SCM functionality

[BFB]
  • Loading branch information
wlin7 committed Feb 25, 2017
2 parents 1155ba0 + 3a86cc8 commit a810dfe
Show file tree
Hide file tree
Showing 13 changed files with 900 additions and 312 deletions.
9 changes: 9 additions & 0 deletions components/cam/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ chdir "$CASEBUILD/camconf";

if ($BUILD_COMPLETE eq 'FALSE') {

# The following translation is hard-wired for backwards compatibility
# to support the differences between how the scripts specify the land grid
# and how it is specified internally

if ($ATM_GRID eq 'T31'){$ATM_GRID = "48x96";}
if ($ATM_GRID eq 'T42'){$ATM_GRID = "64x128";}
if ($ATM_GRID eq 'T85'){$ATM_GRID = "128x256";}
if ($ATM_GRID eq 'T341'){$ATM_GRID = "512x1024";}

# Some settings for single column mode.
my $scm = "";
if ($PTS_MODE eq 'TRUE') {$scm = "-scam -nosmp";}
Expand Down
15 changes: 14 additions & 1 deletion components/cam/cime_config/config_compsets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@
<alias>FG20TRCN</alias>
<lname>20TR_CAM4_CLM40%CN_CICE%PRES_DOCN%DOM_RTM_CISM1_SWAV</lname>
</compset>

<compset>
<alias>F_ARM97_SCAM5</alias>
<lname>AR97_CAM5%SCAM_CLM40%SP_CICE%PRES_DOCN%DOM_RTM_SGLC_SWAV</lname>
</compset>

<entries>

Expand All @@ -551,7 +556,7 @@
<value compset="C2R[68]_CAM">1950-01-01</value>
<value compset="C2R4_CAM">2004-01-01</value>
<value compset="AR95_CAM">1995-07-18</value>
<value compset="AR97_CAM">1997-06-18</value>
<value compset="AR97_CAM">1997-06-19</value>
</values>
</entry>

Expand Down Expand Up @@ -595,14 +600,22 @@
<entry id="STOP_OPTION">
<values>
<value compset="AR95_CAM">ndays</value>
<value compset="AR97_CAM">ndays</value>
</values>
</entry>

<entry id="STOP_N">
<values>
<value compset="AR95_CAM">2</value>
<value compset="AR97_CAM">29</value>
</values>
</entry>

<entry id="MASK_GRID">
<values>
<value compset="AR97_CAM">USGS</value>
</values>
</entry>

<entry id="GET_REFCASE">
<values>
Expand Down
24 changes: 13 additions & 11 deletions components/cam/src/control/vrtmap.F90
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
module vrtmap_mod

implicit none

private

public :: vrtmap

contains

subroutine vrtmap (pkdim ,pmap ,sigln ,dsigln ,kdpmap )
!-----------------------------------------------------------------------
Expand All @@ -12,14 +21,9 @@ subroutine vrtmap (pkdim ,pmap ,sigln ,dsigln ,kdpmap )
! Author: Jerry Olson
!
!-----------------------------------------------------------------------
use shr_kind_mod, only: r8 => shr_kind_r8
use shr_kind_mod, only: r8 => shr_kind_r8
use cam_abortutils, only: endrun
use cam_logfile, only: iulog
#if (!defined UNICOSMP)
use srchutil, only: ismin
#endif
!-----------------------------------------------------------------------
implicit none
use cam_logfile, only: iulog
!-----------------------------------------------------------------------
!
! Arguments
Expand All @@ -42,15 +46,12 @@ subroutine vrtmap (pkdim ,pmap ,sigln ,dsigln ,kdpmap )
real(r8) del ! artificial grid interval
real(r8) dp ! artificial departure point
real(r8) eps ! epsilon factor
#if (defined UNICOSMP)
integer, external :: ismin
#endif
!
!-----------------------------------------------------------------------
!
eps = 1.e-05_r8
del = ( sigln(pkdim) - sigln(1) )/real(pmap,r8)
imin = ismin( pkdim-1,dsigln, 1 )
imin = minloc( dsigln(:pkdim-1), dim=1 )
if (del + eps >= dsigln(imin)) then
newmap = ( sigln(pkdim) - sigln(1) )/dsigln(imin) + 1
write(iulog,9000) pmap,newmap
Expand All @@ -73,3 +74,4 @@ subroutine vrtmap (pkdim ,pmap ,sigln ,dsigln ,kdpmap )
' Reset parameter "pmap" to at least ',i20)
end subroutine vrtmap

end module vrtmap_mod
131 changes: 87 additions & 44 deletions components/cam/src/dynamics/eul/dyn_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module dyn_comp
use constituents, only: sflxnam, tendnam, fixcnam, tottnam, hadvnam, vadvnam, cnst_get_ind
use pmgrid, only: plev, plevp, dyndecomp_set
use hycoef, only: hycoef_init
use cam_history, only: dyn_decomp, addfld, add_default
use cam_history, only: addfld, add_default, horiz_only
use phys_control, only: phys_getopts
use eul_control_mod, only: dyn_eul_readnl, eul_nsplit
use cam_logfile, only: iulog
Expand All @@ -36,21 +36,35 @@ module dyn_comp
integer :: placeholder
end type dyn_export_t

! Frontogenesis indices
integer, public :: frontgf_idx = -1
integer, public :: frontga_idx = -1

! Index into physics buffer for zonal mean zonal wind.
integer, public :: uzm_idx = -1

!#######################################################################
CONTAINS
!#######################################################################

subroutine dyn_init(file, nlfilename)
use phys_control, only : use_gw_front
use dyn_grid, only: define_cam_grids, initgrid
use scamMod, only: single_column
use physics_buffer, only : pbuf_add_field, dtype_r8
use ppgrid, only : pcols, pver

! ARGUMENTS:
type(file_desc_t), intent(in) :: file ! PIO file handle for initial or restart file
character(len=*), intent(in) :: nlfilename

! Local workspace
integer m ! Index
integer :: ixcldice, ixcldliq ! constituent indices for cloud liquid and ice water.
logical :: history_amwg ! output for AMWG diagnostics
logical :: history_budget ! output tendencies and state variables for CAM4
! temperature, water vapor, cloud ice and cloud
! liquid budgets.
! temperature, water vapor, cloud ice and cloud
! liquid budgets.
integer :: history_budget_histfile_num ! output history file number for budget fields
!----------------------------------------------------------------------------

Expand All @@ -64,57 +78,86 @@ subroutine dyn_init(file, nlfilename)
call spmdinit_dyn()
#endif

!----------------------------------------------------------------------

if (use_gw_front) then
call pbuf_add_field("FRONTGF", "global", dtype_r8, (/pcols,pver/), &
frontgf_idx)
call pbuf_add_field("FRONTGA", "global", dtype_r8, (/pcols,pver/), &
frontga_idx)
end if

! Initialize hybrid coordinate arrays
call hycoef_init(file)

call addfld ('ETADOT ','1/s ',plevp,'A','Vertical (eta) velocity',dyn_decomp)
call addfld ('U&IC ','m/s ',plev, 'I','Zonal wind' ,dyn_decomp )
call addfld ('V&IC ','m/s ',plev, 'I','Meridional wind' ,dyn_decomp )
call add_default ('U&IC ',0, 'I')
call add_default ('V&IC ',0, 'I')
! Run initgrid (the old initcom) which sets up coordinates and weights
call initgrid()

call addfld ('PS&IC ','Pa ',1, 'I','Surface pressure' ,dyn_decomp )
call addfld ('T&IC ','K ',plev, 'I','Temperature' ,dyn_decomp )
call add_default ('PS&IC ',0, 'I')
call add_default ('T&IC ',0, 'I')
! Define the CAM grids (must be before addfld calls)
call define_cam_grids()

call addfld ('ETADOT',(/ 'ilev' /),'A', '1/s','Vertical (eta) velocity', gridname='gauss_grid')
call addfld ('U&IC', (/ 'lev' /), 'I', 'm/s','Zonal wind', gridname='gauss_grid' )
call addfld ('V&IC', (/ 'lev' /), 'I', 'm/s','Meridional wind', gridname='gauss_grid' )
call add_default ('U&IC',0, 'I')
call add_default ('V&IC',0, 'I')

call addfld ('PS&IC',horiz_only,'I', 'Pa','Surface pressure', gridname='gauss_grid' )
call addfld ('T&IC',(/ 'lev' /),'I', 'K','Temperature', gridname='gauss_grid' )
call add_default ('PS&IC',0, 'I')
call add_default ('T&IC',0, 'I')

do m = 1, pcnst
call addfld (trim(cnst_name(m))//'&IC','kg/kg ',plev, 'I',cnst_longname(m) ,dyn_decomp )
call addfld (trim(cnst_name(m))//'&IC',(/ 'lev' /),'I', 'kg/kg',cnst_longname(m), gridname='gauss_grid' )
call add_default(trim(cnst_name(m))//'&IC',0, 'I')
call addfld (hadvnam(m), 'kg/kg/s ',plev, 'A',trim(cnst_name(m))//' horizontal advection tendency ',dyn_decomp)
call addfld (vadvnam(m), 'kg/kg/s ',plev, 'A',trim(cnst_name(m))//' vertical advection tendency ',dyn_decomp)
call addfld (tendnam(m), 'kg/kg/s ',plev, 'A',trim(cnst_name(m))//' total tendency ',dyn_decomp)
call addfld (tottnam(m), 'kg/kg/s ',plev, 'A',trim(cnst_name(m))//' horz + vert + fixer tendency ',dyn_decomp)
call addfld (fixcnam(m), 'kg/kg/s ',plev, 'A',trim(cnst_name(m))//' tendency due to slt fixer',dyn_decomp)
call addfld (hadvnam(m), (/ 'lev' /), 'A', 'kg/kg/s',trim(cnst_name(m))//' horizontal advection tendency', &
gridname='gauss_grid')
call addfld (vadvnam(m), (/ 'lev' /), 'A', 'kg/kg/s',trim(cnst_name(m))//' vertical advection tendency', &
gridname='gauss_grid')
call addfld (tendnam(m), (/ 'lev' /), 'A', 'kg/kg/s',trim(cnst_name(m))//' total tendency', &
gridname='gauss_grid')
call addfld (tottnam(m), (/ 'lev' /), 'A', 'kg/kg/s',trim(cnst_name(m))//' horz + vert + fixer tendency', &
gridname='gauss_grid')
call addfld (fixcnam(m), (/ 'lev' /), 'A', 'kg/kg/s',trim(cnst_name(m))//' tendency due to slt fixer', &
gridname='gauss_grid')
end do

call addfld ('DUH ','K/s ',plev, 'A','U horizontal diffusive heating',dyn_decomp)
call addfld ('DVH ','K/s ',plev, 'A','V horizontal diffusive heating',dyn_decomp)
call addfld ('DTH ','K/s ',plev, 'A','T horizontal diffusive heating',dyn_decomp)
call addfld ('DUH ',(/ 'lev' /),'A', 'K/s ','U horizontal diffusive heating', gridname='gauss_grid')
call addfld ('DVH ',(/ 'lev' /),'A', 'K/s ','V horizontal diffusive heating', gridname='gauss_grid')
call addfld ('DTH ',(/ 'lev' /),'A', 'K/s ','T horizontal diffusive heating', gridname='gauss_grid')

call addfld ('ENGYCORR',(/ 'lev' /),'A', 'W/m2 ','Energy correction for over-all conservation', gridname='gauss_grid')
call addfld ('TFIX ',horiz_only ,'A', 'K/s ','T fixer (T equivalent of Energy correction)', gridname='gauss_grid')

call addfld ('ENGYCORR','W/m2 ',plev, 'A','Energy correction for over-all conservation',dyn_decomp)
call addfld ('TFIX ','K/s ',1, 'A','T fixer (T equivalent of Energy correction)',dyn_decomp)
call addfld ('FU ',(/ 'lev' /),'A', 'm/s2 ','Zonal wind forcing term', gridname='gauss_grid')
call addfld ('FV ',(/ 'lev' /),'A', 'm/s2 ','Meridional wind forcing term', gridname='gauss_grid')
call addfld ('UTEND ',(/ 'lev' /),'A', 'm/s2 ','U tendency', gridname='gauss_grid')
call addfld ('VTEND ',(/ 'lev' /),'A', 'm/s2 ','V tendency', gridname='gauss_grid')
call addfld ('TTEND ',(/ 'lev' /),'A', 'K/s ','T tendency', gridname='gauss_grid')
call addfld ('LPSTEN ',horiz_only ,'A', 'Pa/s ','Surface pressure tendency', gridname='gauss_grid')
call addfld ('VAT ',(/ 'lev' /),'A', 'K/s ','Vertical advective tendency of T', gridname='gauss_grid')
call addfld ('KTOOP ',(/ 'lev' /),'A', 'K/s ','(Kappa*T)*(omega/P)', gridname='gauss_grid')

call addfld ('FU ','m/s2 ',plev, 'A','Zonal wind forcing term',dyn_decomp)
call addfld ('FV ','m/s2 ',plev, 'A','Meridional wind forcing term',dyn_decomp)
call addfld ('UTEND ','m/s2 ',plev, 'A','U tendency',dyn_decomp)
call addfld ('VTEND ','m/s2 ',plev, 'A','V tendency',dyn_decomp)
call addfld ('TTEND ','K/s ',plev, 'A','T tendency',dyn_decomp)
call addfld ('LPSTEN ','Pa/s ',1, 'A','Surface pressure tendency',dyn_decomp)
call addfld ('VAT ','K/s ',plev, 'A','Vertical advective tendency of T',dyn_decomp)
call addfld ('KTOOP ','K/s ',plev, 'A','(Kappa*T)*(omega/P)',dyn_decomp)
call phys_getopts(history_amwg_out=history_amwg, &
history_budget_out = history_budget, &
history_budget_histfile_num_out = history_budget_histfile_num)

if (history_amwg) then
call add_default ('DTH ', 1, ' ')
end if

call add_default ('DTH ', 1, ' ')
call phys_getopts(history_budget_out = history_budget, history_budget_histfile_num_out = history_budget_histfile_num)
if ( history_budget ) then
call cnst_get_ind('CLDLIQ', ixcldliq)
call cnst_get_ind('CLDICE', ixcldice)
call add_default(hadvnam( 1), history_budget_histfile_num, ' ')
call add_default(hadvnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(hadvnam(ixcldice), history_budget_histfile_num, ' ')
call add_default(vadvnam( 1), history_budget_histfile_num, ' ')
call add_default(vadvnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(vadvnam(ixcldice), history_budget_histfile_num, ' ')
! The following variables are not defined for single column
if (.not. single_column) then
call add_default(hadvnam( 1), history_budget_histfile_num, ' ')
call add_default(hadvnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(hadvnam(ixcldice), history_budget_histfile_num, ' ')
call add_default(vadvnam( 1), history_budget_histfile_num, ' ')
call add_default(vadvnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(vadvnam(ixcldice), history_budget_histfile_num, ' ')
end if
call add_default(fixcnam( 1), history_budget_histfile_num, ' ')
call add_default(fixcnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(fixcnam(ixcldice), history_budget_histfile_num, ' ')
Expand All @@ -124,11 +167,11 @@ subroutine dyn_init(file, nlfilename)
call add_default(tendnam( 1), history_budget_histfile_num, ' ')
call add_default(tendnam(ixcldliq), history_budget_histfile_num, ' ')
call add_default(tendnam(ixcldice), history_budget_histfile_num, ' ')
call add_default('TTEND ' , history_budget_histfile_num, ' ')
call add_default('TFIX ' , history_budget_histfile_num, ' ')
call add_default('KTOOP ' , history_budget_histfile_num, ' ')
call add_default('VAT ' , history_budget_histfile_num, ' ')
call add_default('DTH ' , history_budget_histfile_num, ' ')
call add_default('TTEND', history_budget_histfile_num, ' ')
call add_default('TFIX', history_budget_histfile_num, ' ')
call add_default('KTOOP', history_budget_histfile_num, ' ')
call add_default('VAT', history_budget_histfile_num, ' ')
call add_default('DTH', history_budget_histfile_num, ' ')
end if

end subroutine dyn_init
Expand Down
Loading

0 comments on commit a810dfe

Please sign in to comment.