Skip to content

Commit

Permalink
Merge pull request #91 from ESMCI/mvertens/newcalendar
Browse files Browse the repository at this point in the history
new pop cap features and removal of shr_cal_mod uses
  • Loading branch information
uturuncoglu authored May 14, 2019
2 parents 4a67f36 + 03f1d19 commit 1ca2910
Show file tree
Hide file tree
Showing 28 changed files with 611 additions and 377 deletions.
2 changes: 2 additions & 0 deletions config/cesm/config_grids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@
<file grid="ocnice" mask="tx0.1v2">$DIN_LOC_ROOT/share/domains/domain.ocn.tx0.1v2.161014.nc</file>
<file grid="atm|lnd" mask="tx0.1v3">$DIN_LOC_ROOT/share/domains/domain.lnd.TL319_tx0.1v3.170730.nc</file>
<file grid="ocnice" mask="tx0.1v3">$DIN_LOC_ROOT/share/domains/domain.ocn.tx0.1v3.170730.nc</file>
<mesh driver="nuopc">$DIN_LOC_ROOT/share/meshes/TL319_151007_ESMFmesh.nc</mesh>
<desc>TL319 grid for JRA55</desc>
</domain>

Expand Down Expand Up @@ -1528,6 +1529,7 @@

<domain name="JRA025">
<nx>1440</nx> <ny>720</ny>
<mesh driver="nuopc">$DIN_LOC_ROOT/share/meshes/JRA025m.170209_ESMFmesh.nc</mesh>
<!-- TODO (mvertens, 2018-12-02): create a domain file for this -->
<desc>JRA is 0.25 degree runoff grid for use with JRA-55 runoff data</desc>
</domain>
Expand Down
4 changes: 3 additions & 1 deletion config/cesm/machines/config_pio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@

<entry id="PIO_REARRANGER">
<values>
<value>$PIO_VERSION</value>
<!-- Note: problem not using box rearranger with nuopc caps -->
<!-- <value>$PIO_VERSION</value> -->
<value>1</value>
</values>
</entry>

Expand Down
9 changes: 6 additions & 3 deletions scripts/create_test
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ def parse_command_line(args, description):
parser.add_argument("--xml-testlist",
help="Use this testlist to lookup tests.The default is specified in config_files.xml")

parser.add_argument("--xml-driver", choices=('mct', 'nuopc', 'moab'),
help="Override driver specified in tests and use this one.")

parser.add_argument("testargs", nargs="*",
help="Tests to run. Testname form is TEST.GRID.COMPSET[.MACHINE_COMPILER]")

Expand Down Expand Up @@ -388,9 +391,9 @@ def parse_command_line(args, description):
"At least one of --xml-machine, --xml-testlist, "
"--xml-compiler, --xml-category or a valid test name must be provided.")

test_data = get_tests_from_xml(args.xml_machine, args.xml_category,
args.xml_compiler, args.xml_testlist,
machine_name, args.compiler)
test_data = get_tests_from_xml(xml_machine=args.xml_machine, xml_category=args.xml_category,
xml_compiler=args.xml_compiler, xml_testlist=args.xml_testlist,
machine=machine_name, compiler=args.compiler, driver=args.xml_driver)
test_names = [item["name"] for item in test_data]
for test_datum in test_data:
test_extra_data[test_datum["name"]] = test_datum
Expand Down
15 changes: 14 additions & 1 deletion scripts/lib/CIME/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
logger = logging.getLogger(__name__)

def get_tests_from_xml(xml_machine=None,xml_category=None,xml_compiler=None, xml_testlist=None,
machine=None, compiler=None):
machine=None, compiler=None, driver=None):
"""
Parse testlists for a list of tests
"""
Expand Down Expand Up @@ -46,6 +46,19 @@ def get_tests_from_xml(xml_machine=None,xml_category=None,xml_compiler=None, xml
test["name"] = CIME.utils.get_full_test_name(test["testname"], grid=test["grid"], compset=test["compset"],
machine=thismach, compiler=thiscompiler,
testmod=None if "testmods" not in test else test["testmods"])
if driver:
# override default or specified driver
founddriver = False
for specdriver in ("Vnuopc","Vmct","Vmoab"):
if specdriver in test["name"]:
test["name"] = test["name"].replace(specdriver,"V{}".format(driver))
founddriver = True
if not founddriver:
name = test["name"]
index = name.find('.')
test["name"] = name[:index] + "_V{}".format(driver) + name[index:]


logger.debug("Adding test {} with compiler {}".format(test["name"], test["compiler"]))
listoftests += newtests
logger.debug("Found {:d} tests".format(len(listoftests)))
Expand Down
25 changes: 22 additions & 3 deletions src/components/data_comps/dice/nuopc/dice_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,16 @@ module dice_comp_mod
!===============================================================================

subroutine dice_comp_advertise(importState, exportState, flds_scalar_name, &
ice_present, ice_prognostic, fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)
ice_present, ice_prognostic, flds_i2o_per_cat, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)

! input/output arguments
type(ESMF_State) , intent(inout) :: importState
type(ESMF_State) , intent(inout) :: exportState
character(len=*) , intent(in) :: flds_scalar_name
logical , intent(in) :: ice_present
logical , intent(in) :: ice_prognostic
logical , intent(in) :: flds_i2o_per_cat
integer , intent(out) :: fldsToIce_num
integer , intent(out) :: fldsFrIce_num
type (fld_list_type) , intent(out) :: fldsToIce(:)
Expand Down Expand Up @@ -154,6 +156,15 @@ subroutine dice_comp_advertise(importState, exportState, flds_scalar_name, &
call dshr_fld_add(data_fld='ifrac', data_fld_array=avifld, model_fld='Si_ifrac', model_fld_array=avofld, &
model_fld_concat=flds_i2x, model_fld_index=kiFrac, fldlist_num=fldsFrIce_num, fldlist=fldsFrIce)

if (flds_i2o_per_cat) then
call dshr_fld_add(model_fld='Si_ifrac_01' , model_fld_concat=flds_i2x, model_fld_index=kiFrac_01)
call dshr_fld_add(model_fld='Fioi_swpen_ifrac_01', model_fld_concat=flds_i2x, model_fld_index=kswpen_iFrac_01)
call dshr_fld_add(med_fld='Si_ifrac_n', fldlist_num=fldsFrIce_num, fldlist=fldsFrIce, &
ungridded_lbound=1, ungridded_ubound=1)
call dshr_fld_add(med_fld='Fioi_swpen_ifrac_n', fldlist_num=fldsFrIce_num, fldlist=fldsFrIce, &
ungridded_lbound=1, ungridded_ubound=1)
end if

! export fields that have no corresponding stream field (computed internally)

call dshr_fld_add(model_fld='Si_imask', model_fld_concat=flds_i2x, model_fld_index=km, &
Expand Down Expand Up @@ -500,7 +511,7 @@ subroutine dice_comp_init(flds_i2o_per_cat, mpicom, compid, my_task, master_task
! optional per thickness category fields
if (flds_i2o_per_cat) then
kiFrac_01 = mct_aVect_indexRA(i2x,'Si_ifrac_01')
kswpen_iFrac_01 = mct_aVect_indexRA(i2x,'PFioi_swpen_ifrac_01')
kswpen_iFrac_01 = mct_aVect_indexRA(i2x,'Fioi_swpen_ifrac_01')
end if

call mct_aVect_init(x2i, rList=flds_x2i, lsize=lsize)
Expand Down Expand Up @@ -966,10 +977,11 @@ end subroutine dice_comp_import

!===============================================================================

subroutine dice_comp_export(exportState, rc)
subroutine dice_comp_export(exportState, flds_i2o_per_cat, rc)

! input/output variables
type(ESMF_State) :: exportState
logical, intent(in) :: flds_i2o_per_cat
integer, intent(out) :: rc

! local variables
Expand All @@ -981,6 +993,13 @@ subroutine dice_comp_export(exportState, rc)
call dshr_export(i2x%rattr(kiFrac,:) , exportState, 'Si_ifrac', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (flds_i2o_per_cat) then
call dshr_export(i2x%rattr(kiFrac_01,:), exportState, 'Si_ifrac_n', ungridded_index=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call dshr_export(i2x%rattr(kswpen_iFrac_01,:), exportState, 'Fioi_swpen_ifrac_n', ungridded_index=1, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

call dshr_export(i2x%rattr(km,:) , exportState, 'Si_imask', rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down
16 changes: 12 additions & 4 deletions src/components/data_comps/dice/nuopc/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

call NUOPC_CompAttributeGet(gcomp, name='flds_i2o_per_cat', value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
read(cvalue,*) flds_i2o_per_cat

call dice_comp_advertise(importstate, exportState, flds_scalar_name, &
ice_present, ice_prognostic, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)
ice_present, ice_prognostic, flds_i2o_per_cat, &
fldsFrIce_num, fldsFrIce, fldsToIce_num, fldsToIce, rc)

!----------------------------------------------------------------------------
! Reset shr logging to original values
Expand Down Expand Up @@ -347,6 +351,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
Emesh = ESMF_MeshCreate(filename=trim(cvalue), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (my_task == master_task) then
write(logunit,*) " obtaining dice mesh from " // trim(cvalue)
end if

!--------------------------------
! Initialize model
!--------------------------------
Expand Down Expand Up @@ -406,7 +414,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
calendar, modeldt, current_ymd, current_tod, cosArg)

! Pack export state
call dice_comp_export(exportState, rc=rc)
call dice_comp_export(exportState, flds_i2o_per_cat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call State_SetScalar(dble(nxg),flds_scalar_index_nx, exportState, &
Expand Down Expand Up @@ -539,7 +547,7 @@ subroutine ModelAdvance(gcomp, rc)
! Pack export state
!--------------------------------

call dice_comp_export(exportState, rc=rc)
call dice_comp_export(exportState, flds_i2o_per_cat, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

!--------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/components/xcpl_comps/xglc/nuopc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ subroutine field_setexport(exportState, fldname, lon, lat, nf, ungridded_index,
else
call ESMF_FieldGet(lfield, farrayPtr=data1d, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (fldname == 'Sg_icemask' .or. 'fldname == Sg_icemask_coupled_fluxes' .or. fldname == 'Sg_ice_covered') then
if (fldname == 'Sg_icemask' .or. fldname == 'Sg_icemask_coupled_fluxes' .or. fldname == 'Sg_ice_covered') then
data1d(:) = 1._r8
else
do i = 1,size(data1d)
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/mct/cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
<value compset="_CAM\d+%WCXI">288</value>
<value compset="_DATM%COPYALL_NPS">72</value>
<value compset="_DATM.*_CLM">48</value>
<value compset="_DATM.*_DICE.*_POP2">4</value>
<value compset="_DATM.*_DICE.*_POP2">24</value>
<value compset="_DATM.*_SLND.*_CICE.*_POP2">24</value>
<value compset="_DATM.*_CICE.*_DOCN">24</value>
<value compset="_DATM.*_DOCN%US20">24</value>
Expand Down
2 changes: 2 additions & 0 deletions src/drivers/nuopc/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def _create_drv_namelists(case, infile, confdir, nmlgen, files):
config['timer_level'] = 'pos' if case.get_value('TIMER_LEVEL') >= 1 else 'neg'
config['bfbflag'] = 'on' if case.get_value('BFBFLAG') else 'off'
config['continue_run'] = '.true.' if case.get_value('CONTINUE_RUN') else '.false.'
config['flux_epbal'] = 'ocn' if case.get_value('CPL_EPBAL') == 'ocn' else 'off'
config['atm_grid'] = case.get_value('ATM_GRID')

# needed for determining the run sequence
config['COMP_ATM'] = case.get_value("COMP_ATM")
Expand Down
58 changes: 29 additions & 29 deletions src/drivers/nuopc/cime_config/config_component_cesm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,34 +203,34 @@
<value compset="_DATM.*_CLM">48</value>
<!-- NOTE: if the following is changed from 24 -> 4 - then a new run sequence is needed since the -->
<!-- ocn coupling interval for this case is 24 - but the atm is longer -->
<value compset="_DATM.*_DICE.*_POP2">24</value>
<value compset="_DATM.*_SLND.*_CICE.*_POP2">24</value>
<value compset="_DATM.*_CICE.*_DOCN">24</value>
<value compset="_DATM.*_DOCN%US20">24</value>
<value compset="_DATM%CPLHIST.+POP\d">48</value>
<value compset="_MPAS">1</value>
<value compset=".+" grid="a%0.23x0.31">96</value>
<value compset=".+" grid="a%ne60np4">96</value>
<value compset=".+" grid="a%ne60np4.pg3">96</value>
<value compset=".+" grid="a%ne60np4.pg4">96</value>
<value compset=".+" grid="a%ne120np4">192</value>
<value compset=".+" grid="a%ne120np4.pg2">192</value>
<value compset=".+" grid="a%ne120np4.pg3">192</value>
<value compset=".+" grid="a%ne120np4.pg4">192</value>
<value compset=".+" grid="a%ne240np4">384</value>
<value compset=".+" grid="a%ne240np4.pg2">384</value>
<value compset=".+" grid="a%ne240np4.pg3">384</value>
<value compset=".+" grid="a%ne0np4CONUS.ne30x8">144</value>
<value compset=".+" grid="a%T42">72</value>
<value compset=".+" grid="a%T85">144</value>
<value compset=".+" grid="a%T341">288</value>
<value compset=".+" grid="1x1">48</value>
<value compset=".+" grid="1x1_urbanc">48</value>
<value compset=".+" grid="1x1_mexico">24</value>
<value compset=".+" grid="1x1_vancou">24</value>
<value compset="_DLND.*_CISM\d">1</value>
<value compset="_DATM.*_DICE.*_POP2.*_WW3">4</value>
<value compset="_DATM.*_DICE.*_POP2.*_DWAV">4</value>
<value compset="_DATM.*_SLND.*_DICE.*_POP2" >24</value>
<value compset="_DATM.*_SLND.*_CICE.*_POP2" >24</value>
<value compset="_DATM.*_CICE.*_DOCN" >24</value>
<value compset="_DATM.*_DOCN%US20" >24</value>
<value compset="_DATM%CPLHIST.+POP\d" >48</value>
<value compset="_MPAS" >1</value>
<value compset=".+" grid="a%0.23x0.31" >96</value>
<value compset=".+" grid="a%ne60np4" >96</value>
<value compset=".+" grid="a%ne60np4.pg3" >96</value>
<value compset=".+" grid="a%ne60np4.pg4" >96</value>
<value compset=".+" grid="a%ne120np4" >192</value>
<value compset=".+" grid="a%ne120np4.pg2" >192</value>
<value compset=".+" grid="a%ne120np4.pg3" >192</value>
<value compset=".+" grid="a%ne120np4.pg4" >192</value>
<value compset=".+" grid="a%ne240np4" >384</value>
<value compset=".+" grid="a%ne240np4.pg2" >384</value>
<value compset=".+" grid="a%ne240np4.pg3" >384</value>
<value compset=".+" grid="a%ne0np4CONUS.ne30x8" >144</value>
<value compset=".+" grid="a%T42" >72</value>
<value compset=".+" grid="a%T85" >144</value>
<value compset=".+" grid="a%T341" >288</value>
<value compset=".+" grid="1x1" >48</value>
<value compset=".+" grid="1x1_urbanc" >48</value>
<value compset=".+" grid="1x1_mexico" >24</value>
<value compset=".+" grid="1x1_vancou" >24</value>
<value compset="_DLND.*_CISM\d" >1</value>
<!-- <value compset="_DATM.*_DICE.*_POP2.*_WW3">4</value> -->
<!-- <value compset="_DATM.*_DICE.*_POP2.*_DWAV">4</value> -->
</values>
<group>run_coupling</group>
<file>env_run.xml</file>
Expand Down Expand Up @@ -269,7 +269,7 @@
<type>integer</type>
<default_value>$ATM_NCPL</default_value>
<values match="last">
<value compset="_POP2">1</value>
<value compset="_POP2">24</value>
<value compset="_POP2" grid="oi%tx0.1v2">4</value>
<value compset="_POP2" grid="oi%gx1v6">24</value>
<value compset="_POP2" grid="oi%gx1v7">24</value>
Expand Down
Loading

0 comments on commit 1ca2910

Please sign in to comment.