Skip to content

Commit 62b45a6

Browse files
Merge pull request #749 from hollyhan/hollyhan/landice/add-MALI-SLM-coupled-ISMIP6-runs
Add an option to setup coupled MALI-SLM runs in the ismip6 run testgroup This PR adds to the `/landice/ismip6_run/ismip_ais_proj2300` testcase the option to setup coupled MALI-Sea Level Model simulations using the ismip6-Antarctica-2300 experimental protocol. With these changes, inclusion of the SLM can be activated through a test case cfg option. This will set up required namelist and input settings, as well as the namelist.sealevel file used by SLM. It will also set up an additional test case step that generates the required mapping files between MALI and SLM. This must be run before any of the experiments are run. This PR requires addition of Pyproj string `projections['ais-bedmap2-sphere'] = '+proj=stere +lat_ts=-71.0 +lat_0=-90 +lon_0=0.0 +k_0=1.0 +x_0=0.0 +y_0=0.0 +ellps=sphere'` in the MPAS-Tools script `set_lat_lon_fields_in_planar_grid.py` to set the latitude and longitude values as if MALI was projected on sphere rather than ellipse. The requirement has been merged here (https://github.com/MPAS-Dev/MPAS-Tools/pull/559/files).
2 parents dc641b6 + 6b17c26 commit 62b45a6

File tree

12 files changed

+489
-42
lines changed

12 files changed

+489
-42
lines changed

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/__init__.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import os
22

3+
from compass.landice.tests.ismip6_run.ismip6_ais_proj2300.create_slm_mapping_files import ( # noqa
4+
CreateSlmMappingFiles,
5+
)
36
from compass.landice.tests.ismip6_run.ismip6_ais_proj2300.set_up_experiment import ( # noqa
47
SetUpExperiment,
58
)
@@ -70,13 +73,32 @@ def configure(self):
7073
# each experiment (step) should be run manually
7174
self.steps_to_run = []
7275

76+
sea_level_model = self.config.getboolean('ismip6_run_ais_2300',
77+
'sea_level_model')
78+
if sea_level_model:
79+
subdir = 'mapping_files'
80+
if os.path.exists(os.path.join(self.work_dir, subdir)):
81+
print(f"WARNING: {subdir} path already exists; skipping. "
82+
"Please remove the directory "
83+
f"{os.path.join(self.work_dir, subdir)} and execute "
84+
"'compass setup' again to set this experiment up.")
85+
else:
86+
self.add_step(
87+
CreateSlmMappingFiles(test_case=self,
88+
name='mapping_files',
89+
subdir=subdir))
90+
self.steps_to_run.append('mapping_files')
91+
7392
def run(self):
7493
"""
7594
A dummy run method
7695
"""
7796
raise ValueError("ERROR: 'compass run' has no functionality at the "
7897
"test case level for this test. "
7998
"Please submit the job script in "
80-
"each experiment's subdirectory manually instead.")
99+
"each experiment's subdirectory manually instead."
100+
"To create Sea-Level Model mapping files, submit"
101+
"job script or execute 'compass run' from the"
102+
"'mapping_files' subdirectory.")
81103

82104
# no validate() method is needed

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/albany_input.yaml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ ANONYMOUS:
1717
# Zero Effective Pressure On Floating Ice At Nodes: true
1818
Zero Beta On Floating Ice: true
1919

20-
Cubature Degree: 4
21-
Basal Cubature Degree: 8
20+
Cubature Degree: 8
2221

2322
# Discretization Description
2423
Discretization:
@@ -94,12 +93,6 @@ ANONYMOUS:
9493
Preconditioner Type: MueLu
9594
Preconditioner Types:
9695

97-
Ifpack:
98-
Overlap: 1
99-
Prec Type: ILU
100-
Ifpack Settings:
101-
'fact: level-of-fill': 0
102-
10396
Ifpack2:
10497
Overlap: 1
10598
Prec Type: ILUT
@@ -244,29 +237,3 @@ ANONYMOUS:
244237
A: myRebalanceAFact
245238
Coordinates: myRebalanceProlongatorFact
246239
Importer: myRepartitionFact
247-
248-
ML:
249-
Base Method Defaults: none
250-
ML Settings:
251-
default values: SA
252-
ML output: 0
253-
'repartition: enable': 1
254-
'repartition: max min ratio': 1.327e+00
255-
'repartition: min per proc': 600
256-
'repartition: Zoltan dimensions': 2
257-
'repartition: start level': 4
258-
'semicoarsen: number of levels': 2
259-
'semicoarsen: coarsen rate': 14
260-
'smoother: sweeps': 4
261-
'smoother: type': Gauss-Seidel
262-
'smoother: Chebyshev eig boost': 1.2e+00
263-
'smoother: sweeps (level 0)': 1
264-
'smoother: type (level 0)': line Gauss-Seidel
265-
'smoother: line GS Type': standard
266-
'smoother: damping factor': 1.0e+00
267-
'smoother: pre or post': both
268-
'coarse: type': Gauss-Seidel
269-
'coarse: sweeps': 4
270-
'coarse: max size': 2000
271-
'coarse: pre or post': pre
272-
max levels: 7
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import shutil
2+
3+
from mpas_tools.logging import check_call
4+
from mpas_tools.scrip.from_mpas import scrip_from_mpas
5+
6+
from compass.step import Step
7+
8+
9+
class CreateSlmMappingFiles(Step):
10+
"""
11+
A step for creating mapping files for the Sea Level Model
12+
13+
Attributes
14+
----------
15+
"""
16+
17+
def __init__(self, test_case, name, subdir):
18+
"""
19+
Initialize step
20+
21+
Parameters
22+
----------
23+
24+
"""
25+
26+
super().__init__(test_case=test_case, name=name, subdir=subdir)
27+
28+
def setup(self):
29+
print(" Setting up mapping_file subdirectory")
30+
31+
def run(self):
32+
"""
33+
Run this step of the test case
34+
"""
35+
36+
config = self.config
37+
logger = self.logger
38+
section = config['ismip6_run_ais_2300']
39+
sea_level_model = section.getboolean('sea_level_model')
40+
if sea_level_model:
41+
self._build_mapping_files(config, logger)
42+
43+
def _build_mapping_files(self, config, logger):
44+
"""
45+
Build mapping files between the MALI mesh and the SLM grid.
46+
47+
Parameters
48+
----------
49+
config : compass.config.CompassConfigParser
50+
Configuration options for a ismip6 forcing test case
51+
52+
logger : logging.Logger
53+
A logger for output from the step
54+
"""
55+
56+
config = self.config
57+
section = config['ismip6_run_ais_2300']
58+
init_cond_path = section.get('init_cond_path')
59+
nglv = section.getint('nglv')
60+
section = config['parallel']
61+
ntasks = section.getint('cores_per_node')
62+
63+
# create the mapping files
64+
# first create scrip files
65+
mali_scripfile = 'mali_scripfile.nc'
66+
slm_scripfile = f'slm_nglv{nglv}scripfile.nc'
67+
mali_meshfile = 'mali_meshfile_sphereLatLon.nc'
68+
69+
# slm scripfile
70+
logger.info(f'creating scripfile for the SLM grid with '
71+
f'{nglv} Gauss-Legendre points in latitude')
72+
73+
args = ['ncremap',
74+
'-g', slm_scripfile,
75+
'-G',
76+
f'latlon={nglv},{2*int(nglv)}#lat_typ=gss#lat_drc=n2s']
77+
78+
check_call(args, logger=logger)
79+
80+
# mali scripfile
81+
# first have to adjust lat-lon values as if they are on sphere
82+
shutil.copy(init_cond_path, mali_meshfile)
83+
args = ['set_lat_lon_fields_in_planar_grid.py',
84+
'--file', mali_meshfile,
85+
'--proj', 'ais-bedmap2-sphere']
86+
87+
check_call(args, logger=logger)
88+
89+
logger.info('creating scrip file for the mali mesh')
90+
scrip_from_mpas(mali_meshfile, mali_scripfile)
91+
92+
# create mapping file from MALI mesh to SLM grid
93+
logger.info('creating MALI -> SLM grid mapfile with bilinear method')
94+
95+
parallel_executable = config.get("parallel", "parallel_executable")
96+
# split the parallel executable into constituents
97+
args = parallel_executable.split(' ')
98+
args.extend(['-n', f'{ntasks}',
99+
'ESMF_RegridWeightGen',
100+
'-s', mali_scripfile,
101+
'-d', slm_scripfile,
102+
'-w', 'mapfile_mali_to_slm.nc',
103+
'-m', 'conserve',
104+
'-i', '-64bit_offset', '--netcdf4',
105+
'--src_regional'])
106+
107+
check_call(args, logger)
108+
109+
# create mapping file from SLM grid to MALI mesh
110+
logger.info('SLM -> MALI mesh mapfile with bilinear method')
111+
args = parallel_executable.split(' ')
112+
args.extend(['-n', f'{ntasks}',
113+
'ESMF_RegridWeightGen',
114+
'-s', slm_scripfile,
115+
'-d', mali_scripfile,
116+
'-w', 'mapfile_slm_to_mali.nc',
117+
'-m', 'bilinear',
118+
'-i', '-64bit_offset', '--netcdf4',
119+
'--dst_regional'])
120+
121+
check_call(args, logger)
122+
123+
logger.info('mapping file creation complete')

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/ismip6_ais_proj2300.cfg

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,28 @@ von_mises_parameter_path = UNKNOWN
4444

4545
# Whether facemelting should be included in the runs
4646
use_face_melting = False
47+
48+
# True if running coupled MALI-sea level model simulation
49+
sea_level_model = False
50+
51+
# NOTE: for the directories related to the sea-level model input/outputs, the slash '/' at the end of the directory name is necessary.
52+
# Path to the directory containing globally defined ice thickness field for the sea-level model
53+
slm_input_ice = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/icemodel/
54+
55+
# Path to the directory containing earth model for the sea-level model
56+
slm_input_earth = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/earthmodel/
57+
58+
# Earth structure profile
59+
# possible values: any file name string of earth model file.
60+
# Note that there is no single representative earth model for the globe or
61+
# any region of the globe (e.g., West Antarctica, East Antarctica, Greenland)
62+
# But for this test, we use 'prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22' for West Antarctica
63+
# and 'prem_coll_512.l120C.ump5.lm10' for East Antarctica. Other earthmodels that can be used
64+
# should exist in the path defined in the config option 'slm_input_earth'.
65+
slm_earth_structure = prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22
66+
67+
# Path to the diectory containing other input files (present-day global topography and sea-level model grid files)
68+
slm_input_others = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/others/
69+
70+
# number of gauss-legendre nodes in latitude (typically an integer multiple of 512)
71+
nglv = 2048

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/ismip6_ais_proj2300_4km_chicoma.cfg

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Can be "tier1", "tier2", "all", or a comma-delimited list of runs
44
# "tier1" is expAE01-expAE06 plus hist and ctrlAE
55
# "tier2" is expAE07-expAE14
6-
exp_list = hist,ctrlAE,expAE05
6+
exp_list = hist,ctrlAE,expAE01,expAE02,expAE05
77

88
# Resolution that will be set up, in km. Should be one of 4, 8, as those are
99
# the two resolutions currently supported.
@@ -43,3 +43,28 @@ von_mises_parameter_path = UNKNOWN
4343

4444
# Whether facemelting should be included in the runs
4545
use_face_melting = True
46+
47+
# True if running coupled MALI-sea level model simulation
48+
sea_level_model = False
49+
50+
# NOTE: for the directories related to the sea-level model input/outputs, the slash '/' at the end of the directory name is necessary.
51+
# Path to the base directory containing globally defined ice thickness field for the sea-level model
52+
slm_input_ice = /usr/projects/climate/hollyhan/SeaLevelModel_Inputs/icemodel/
53+
54+
# Path to the directory containing earth model for the sea-level model
55+
slm_input_earth = /usr/projects/climate/hollyhan/SeaLevelModel_Inputs/earthmodel/
56+
57+
# Earth structure profile
58+
# possible values: any file name string of earth model file.
59+
# Note that there is no single representative earth model for the globe or
60+
# any region of the globe (e.g., West Antarctica, East Antarctica, Greenland)
61+
# But for this test, we use 'prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22' for West Antarctica
62+
# and 'prem_coll_512.l120C.ump5.lm10' for East Antarctica. Other earthmodels that can be used
63+
# should exist in the path defined in the config option 'slm_input_earth'.
64+
slm_earth_structure = prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22
65+
66+
# Path to the diectory containing other input files (present-day global topography and sea-level model grid files)
67+
slm_input_others = /usr/projects/climate/hollyhan/SeaLevelModel_Inputs/others/
68+
69+
# number of gauss-legendre nodes in latitude (typically an integer multiple of 512)
70+
nglv = 2048

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/ismip6_ais_proj2300_4km_nersc.cfg

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,29 @@ calving_method = restore
4343
von_mises_parameter_path = UNKNOWN
4444

4545
# Whether facemelting should be included in the runs
46-
use_face_melting = False
46+
use_face_melting = True
47+
48+
# True if running coupled MALI-sea level model simulation
49+
sea_level_model = False
50+
51+
# NOTE: for the directories related to the sea-level model input/outputs, the slash '/' at the end of the directory name is necessary.
52+
# Path to the base directory containing globally defined ice thickness field for the sea-level model
53+
slm_input_ice = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/icemodel/
54+
55+
# Path to the directory containing earth model for the sea-level model
56+
slm_input_earth = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/earthmodel/
57+
58+
# Earth structure profile
59+
# possible values: any file name string of earth model file.
60+
# Note that there is no single representative earth model for the globe or
61+
# any region of the globe (e.g., West Antarctica, East Antarctica, Greenland)
62+
# But for this test, we use 'prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22' for West Antarctica
63+
# and 'prem_coll_512.l120C.ump5.lm10' for East Antarctica. Other earthmodels that can be used
64+
# should exist in the path defined in the config option 'slm_input_earth'.
65+
slm_earth_structure = prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22
66+
67+
# Path to the diectory containing other input files (present-day global topography and sea-level model grid files)
68+
slm_input_others = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/others/
69+
70+
# number of gauss-legendre nodes in latitude (typically an integer multiple of 512)
71+
nglv = 2048

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/ismip6_ais_proj2300_8km_nersc.cfg

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,28 @@ von_mises_parameter_path = UNKNOWN
4444

4545
# Whether facemelting should be included in the runs
4646
use_face_melting = False
47+
48+
# True if running coupled MALI-sea level model simulation
49+
sea_level_model = False
50+
51+
# NOTE: for the directories related to the sea-level model input/outputs, the slash '/' at the end of the directory name is necessary.
52+
# Path to the directory containing globally defined ice thickness field for the sea-level model
53+
slm_input_ice = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/icemodel/
54+
55+
# Path to the directory containing earth model for the sea-level model
56+
slm_input_earth = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/earthmodel/
57+
58+
# Earth structure profile
59+
# possible values: any file name string of earth model file.
60+
# Note that there is no single representative earth model for the globe or
61+
# any region of the globe (e.g., West Antarctica, East Antarctica, Greenland)
62+
# But for this test, we use 'prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22' for West Antarctica
63+
# and 'prem_coll_512.l120C.ump5.lm10' for East Antarctica. Other earthmodels that can be used
64+
# should exist in the path defined in the config option 'slm_input_earth'.
65+
slm_earth_structure = prem_512.l60K2C.sum18p6.dum19p2.tz19p4.lm22
66+
67+
# Path to the diectory containing other input files (present-day global topography and sea-level model grid files)
68+
slm_input_others = /global/cfs/cdirs/fanssie/MALI_projects/SeaLevelModel_Inputs/others/
69+
70+
# number of gauss-legendre nodes in latitude (typically an integer multiple of 512)
71+
nglv = 2048

compass/landice/tests/ismip6_run/ismip6_ais_proj2300/namelist.landice

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
config_thickness_advection = 'fo'
77
config_tracer_advection = 'fo'
88

9+
config_uplift_method = 'none'
10+
config_slm_coupling_interval = 5
11+
config_MALI_to_SLM_weights_file = 'mapfile_mali_to_slm.nc'
12+
config_SLM_to_MALI_weights_file = 'mapfile_slm_to_mali.nc'
13+
914
config_calving = 'none'
1015
config_apply_calving_mask = .false.
1116
config_restore_calving_front_prevent_retreat = .false.
@@ -50,7 +55,7 @@
5055
config_do_restart = .true.
5156
config_restart_timestamp_name = 'restart_timestamp'
5257
config_start_time ='file'
53-
config_stop_time = '2300-01-01_00:00:00'
58+
config_stop_time = '2301-01-01_00:00:00'
5459
config_calendar_type = 'noleap'
5560

5661
config_stats_interval = 0

0 commit comments

Comments
 (0)