forked from ESMCI/cime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'init_interp_same_grid'
New init_interp method The main change in this tag is to introduce a new method for init_interp. This is needed in order for subgrid areas to be the same in initialization in runs with and without init_interp. The choice of init_interp method is controlled by a new namelist variable, init_interp_method, whose documentation appears below: Method to use for init_interp. Only applies when use_init_interp = .true. 'general': The general-purpose method that can be used when changing grids, configurations, etc. This starts off with subgrid areas taken from the surface dataset. 'use_finidat_areas': This starts off with subgrid areas taken from the input finidat file. This is needed to achieve bit-for-bit results in a coupled case (where areas in initialization impact initial fields sent to the atmosphere) (but using the 'general' method will typically have only a very minor impact on results in this case). For this method to work, the input finidat file needs to be at the same resolution as the current configuration. So this is a less general form of init_interp. However, it can be used when transitioning from a spinup run to a transient run, or in other cases where the only difference is in internal memory allocation. In order to catch possible problems, this uses a different algorithm for finding the input point for each output point, which ensures that each active output point is associated with exactly one input point with the same latitude, longitude and type. This method requires (a) the same grid for input and output, within roundoff; (b) any non-zero-weight point in the input must have memory allocated for it in this grid cell in the output (this will be satisfied if the point is non-zero-weight on the surface dataset or if it's a point for which we allocate memory even for zero-weight points); (c) any active point in the output (based on the surface dataset and rules for determining active points) must have a matching point in this grid cell in the input. This tag also has some other changes: - Fixes ESMCI#347 - endrun message behavior: needed for some of the new unit tests - Fixes ESMCI#345 - Add a cmip6_evolving_icesheet usermods directory: unrelated, but folded in here for convenience of testing)
- Loading branch information
Showing
39 changed files
with
1,365 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
""" | ||
Implementation of the LII2FINIDATAREAS test. | ||
This is similar to the LII test, but tests init_interp with mode | ||
'use_finidat_areas'. | ||
As with the standard LII test, this must be used in a configuration for | ||
which we have a compatible out-of-the-box finidat file (so that the run | ||
with use_init_interp = .false. runs successfully). In constrast to our | ||
standard LII test (which uses glcMEC_spunup_1way), this one can use a | ||
standard CISM2%NOEVOLVE configuration: we do *not* need to set | ||
GLC_TWO_WAY_COUPLING=FALSE; in fact, it's a better test if we have | ||
GLC_TWO_WAY_COUPLING=TRUE: with this mode of operation, areas should | ||
match between the two runs. | ||
It may not be totally necessary to have a system test covering this | ||
init_interp_method: between unit tests and inline checks, we have quite | ||
a bit of testing of this code. It's important to have at least one LII | ||
test to make sure we're interpolating all the fields we're supposed to | ||
interpolate, but we don't necessarily need a LII test with this mode of | ||
operation as long as we have one with the general mode of operation. | ||
However, this test is a good check that every point has a unique type | ||
(because this mode of operation will fail if that's not the case); this | ||
is something needed even for the 'general' init_interp method to work | ||
correctly, but the 'general' mode won't catch problems in this regard. | ||
One other reason why this test is useful is to cover the threading | ||
directives in the set_single_match routine, since those aren't covered | ||
by unit tests. So this test mod should be used in a test with threading. | ||
To update the initial conditions (finidat) file for this test: | ||
(1) Run the test; the 'base' case should run to completion even if the | ||
no_interp test fails. (If the 'base' case fails, you may need to retry | ||
with init_interp_method='general'.) | ||
(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata | ||
space. Rename this to be similar to the out-of-the-box finidat file | ||
currently used by this test, but with a new creation date. | ||
(3) Update namelist defaults to point to the new finidat file. If | ||
updating the out-of-the-box file is not desired, then you could instead | ||
point to this new finidat file with a user_nl_clm file in this testmod. | ||
""" | ||
|
||
from CIME.XML.standard_module_setup import * | ||
from CIME.SystemTests.test_utils.user_nl_utils import append_to_user_nl_files | ||
|
||
# We can import lii directly because the SystemTests directory has been | ||
# added to sys.path. | ||
# | ||
# A cleaner and more general way to accomplish this would be: In cime: | ||
# Rather than adding the SystemTests directory to sys.path and then | ||
# importing an individual module from there: instead, allow each | ||
# component to have a COMPNAME_pylib directory within its cime_config, | ||
# and then have cime add each component's cime_config directory to | ||
# sys.path and then do something like: | ||
# import_module("COMPNAME_pylib.SystemTests.TESTNAME"). Then, for | ||
# example, ctsm could access its own modules via "import | ||
# ctsm_pylib.foo", or (in this case) "from ctsm_pylib.SystemTests.lii | ||
# import LII". | ||
from lii import LII | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
class LII2FINIDATAREAS(LII): | ||
|
||
def __init__(self, case): | ||
super(LII2FINIDATAREAS, self).__init__(case) | ||
|
||
def _case_one_setup(self): | ||
super(LII2FINIDATAREAS, self)._case_one_setup() | ||
append_to_user_nl_files(caseroot = self._get_caseroot(), | ||
component = "clm", | ||
contents = "init_interp_method = 'use_finidat_areas'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Note that this testmod directory includes cmip6_evolving_icesheet rather | ||
than simply cmip6: cmip6_evolving_icesheet includes cmip6 and adds to | ||
it. So, rather than having tests of the cmip6 usermods and separate | ||
tests of cmip6_evolving_icesheet, it's more efficient to just have tests | ||
of the cmip6_evolving_icesheet usermods directory, which then also cover | ||
the cmip6 usermods directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../../../usermods_dirs/cmip6 | ||
../../../../usermods_dirs/cmip6_evolving_icesheet |
23 changes: 23 additions & 0 deletions
23
cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/README
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
This testmod provides an finidat file compatible with the current model | ||
configuration, at f09 resolution. | ||
|
||
This testmods directory is for running LII tests which compare the answers for a case where | ||
initial condition interpolation is on (use_init_interp=T) to a case with it's off and ensures | ||
they are exact. For the interpolated result to match uninterpolation, it needs to be a case that | ||
essentially needs no interpolation so it's at the same resolution as the initial condition | ||
file (finidat file). When surface datasets are changed, or the land-mask is changed, or an | ||
important change is made to model physics (for example where new fields are added to the restart | ||
file) -- you'll need to update the initial conditions file in this test (finidat file in | ||
the user_nl_clm file). | ||
|
||
To update the initial conditions (finidat) file for this test: | ||
|
||
(1) Run the LII test; the 'base' case should run to completion even if the | ||
no_interp test fails. | ||
|
||
(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata | ||
space. Rename this to be similar to the name of the file pointed to in this | ||
test's user_nl_clm file, but with a new creation date. | ||
|
||
(3) Update this the user_nl_clm file in this directory to point to the new | ||
finidat file. |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/user_nl_clm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop.1366-01-01.0.9x1.25_gx1v6_simyr1850_c180424.nc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/README
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_cpl
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/README
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/include_user_mods
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop1850/include_user_mods
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop1850/user_nl_cpl
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
cime_config/usermods_dirs/cmip6_evolving_icesheet/include_user_mods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../cmip6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hist_fincl4 += 'ICE_MODEL_FRACTION' |
Oops, something went wrong.