From 5fc09f1050d3d235d2b3bacc5ae9def3096823ff Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 3 Jan 2024 11:16:29 +0100 Subject: [PATCH 1/4] Add land-locked cells to land-ice mask If there are land-locked cells at calving fronts of ice shelves, they need to be added to the land-ice mask so sea-ice doesn't get trapped there. This merge also gets the minimum latitude and number of sweeps used in finding land-locked cells from config options. --- compass/ocean/mesh/cull.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/compass/ocean/mesh/cull.py b/compass/ocean/mesh/cull.py index b7a015425f..7e57761720 100644 --- a/compass/ocean/mesh/cull.py +++ b/compass/ocean/mesh/cull.py @@ -166,12 +166,19 @@ def run(self): convert_to_cdf5 = config.getboolean('spherical_mesh', 'convert_culled_mesh_to_cdf5') + latitude_threshold = config.getfloat('spherical_mesh', + 'latitude_threshold') + + sweep_count = config.getint('spherical_mesh', 'sweep_count') + cull_mesh(with_critical_passages=True, logger=logger, use_progress_bar=use_progress_bar, preserve_floodplain=preserve_floodplain, with_cavities=with_ice_shelf_cavities, process_count=self.cpus_per_task, - convert_to_cdf5=convert_to_cdf5) + convert_to_cdf5=convert_to_cdf5, + latitude_threshold=latitude_threshold, + sweep_count=sweep_count) if do_inject_bathymetry: inject_bathymetry(mesh_file='culled_mesh.nc') @@ -180,7 +187,8 @@ def run(self): def cull_mesh(with_cavities=False, with_critical_passages=False, custom_critical_passages=None, custom_land_blockages=None, preserve_floodplain=False, logger=None, use_progress_bar=True, - process_count=1, convert_to_cdf5=False): + process_count=1, convert_to_cdf5=False, latitude_threshold=43., + sweep_count=20): """ First step of initializing the global ocean: @@ -241,21 +249,29 @@ def cull_mesh(with_cavities=False, with_critical_passages=False, process_count : int, optional The number of cores to use to create masks (``None`` to use all available cores) + convert_to_cdf5 : bool, optional Convert the culled mesh to PNetCDF CDF-5 format + + latitude_threshold : float, optional + Minimum latitude, in degrees, for masking land-locked cells + + sweep_count : int, optional + Maximum number of sweeps to search for land-locked cells """ with LoggingContext(name=__name__, logger=logger) as logger: _cull_mesh_with_logging( logger, with_cavities, with_critical_passages, custom_critical_passages, custom_land_blockages, preserve_floodplain, use_progress_bar, process_count, - convert_to_cdf5) + convert_to_cdf5, latitude_threshold, sweep_count) def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages, custom_critical_passages, custom_land_blockages, preserve_floodplain, use_progress_bar, - process_count, convert_to_cdf5): + process_count, convert_to_cdf5, latitude_threshold, + sweep_count): """ Cull the mesh once the logger is defined for sure """ critical_passages = with_critical_passages or \ @@ -286,9 +302,9 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages, dsBaseMesh = xr.open_dataset('base_mesh.nc') dsLandMask = xr.open_dataset('land_mask.nc') - dsLandMask = add_land_locked_cells_to_mask(dsLandMask, dsBaseMesh, - latitude_threshold=43.0, - nSweeps=20) + dsLandMask = add_land_locked_cells_to_mask( + dsLandMask, dsBaseMesh, latitude_threshold=latitude_threshold, + nSweeps=sweep_count) write_netcdf(dsLandMask, 'land_mask_with_land_locked_cells.nc') # create seed points for a flood fill of the ocean @@ -425,6 +441,10 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages, dsMask = xr.open_dataset('ice_coverage.nc') + dsMask = add_land_locked_cells_to_mask( + dsMask, dsCulledMesh, latitude_threshold=latitude_threshold, + nSweeps=sweep_count) + landIceMask = dsMask.regionCellMasks.isel(nRegions=0) dsLandIceMask = xr.Dataset() dsLandIceMask['landIceMask'] = landIceMask From d78b6f10309d3bd9bcce4da7477e3008327c0235 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 3 Jan 2024 11:18:29 +0100 Subject: [PATCH 2/4] Add new config options related to masking land-locked cells --- compass/ocean/tests/global_ocean/global_ocean.cfg | 4 ++++ compass/ocean/tests/hurricane/hurricane.cfg | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/compass/ocean/tests/global_ocean/global_ocean.cfg b/compass/ocean/tests/global_ocean/global_ocean.cfg index e6657eb166..18b11ae447 100644 --- a/compass/ocean/tests/global_ocean/global_ocean.cfg +++ b/compass/ocean/tests/global_ocean/global_ocean.cfg @@ -10,6 +10,10 @@ cull_mesh_min_cpus_per_task = 1 cull_mesh_max_memory = 1000 # Whether to convert the culled mesh file to CDF5 format convert_culled_mesh_to_cdf5 = False +# Minimum latitude, in degrees, for masking land-locked cells +latitude_threshold = 43.0 +# Maximum number of sweeps to search for land-locked cells +sweep_count = 20 # Options relate to adjusting the sea-surface height or land-ice pressure diff --git a/compass/ocean/tests/hurricane/hurricane.cfg b/compass/ocean/tests/hurricane/hurricane.cfg index 7940fde3bc..2f1678f65c 100644 --- a/compass/ocean/tests/hurricane/hurricane.cfg +++ b/compass/ocean/tests/hurricane/hurricane.cfg @@ -4,3 +4,7 @@ # Config options related to the step for culling land from the mesh # Whether to convert the culled mesh file to CDF5 format convert_culled_mesh_to_cdf5 = False +# Minimum latitude, in degrees, for masking land-locked cells +latitude_threshold = 43.0 +# Maximum number of sweeps to search for land-locked cells +sweep_count = 20 From ef6b62992cafbfb0511341b8695ec24ed6d67720 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Tue, 15 Aug 2023 03:45:57 -0500 Subject: [PATCH 3/4] Update to RRSwISC6to18E3r4 --- .../tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compass/ocean/tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg b/compass/ocean/tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg index 76aace69b4..35bb046883 100644 --- a/compass/ocean/tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg +++ b/compass/ocean/tests/global_ocean/mesh/rrs6to18/rrs6to18.cfg @@ -45,21 +45,22 @@ approx_cell_count = 4000000 # the prefix (e.g. QU, EC, WC, SO) prefix = RRS # a description of the mesh and initial condition -mesh_description = MPAS Eddy Closure mesh for E3SM version ${e3sm_version} with - enhanced resolution around the equator (30 km), South pole - (35 km), Greenland (${min_res} km), ${max_res}-km resolution - at mid latitudes, and ${levels} vertical levels +mesh_description = MPAS Rossby-radius scaled (RRS) mesh for E3SM version + ${e3sm_version} with ${min_res}-km resolution at the poles, + ${max_res}-km resolution at the equator, and <<>> + vertical levels. This mesh includes cavities under the ice + shelves around Antarctica. # E3SM version that the mesh is intended for e3sm_version = 3 # The revision number of the mesh, which should be incremented each time the # mesh is revised -mesh_revision = 1 +mesh_revision = 4 # the minimum (finest) resolution in the mesh min_res = 6 # the maximum (coarsest) resolution in the mesh, can be the same as min_res max_res = 18 # The URL of the pull request documenting the creation of the mesh -pull_request = <<>> +pull_request = https://github.com/MPAS-Dev/compass/pull/754 # config options related to remapping topography to an MPAS-Ocean mesh From 6b65c9213c5d3738966b0fe488bb31ada79d6ad8 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 28 Aug 2023 15:50:59 -0500 Subject: [PATCH 4/4] Reduce timestep for simulation --- .../tests/global_ocean/mesh/rrs6to18/dynamic_adjustment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compass/ocean/tests/global_ocean/mesh/rrs6to18/dynamic_adjustment.yaml b/compass/ocean/tests/global_ocean/mesh/rrs6to18/dynamic_adjustment.yaml index 8dadf614bd..16c8fb448d 100644 --- a/compass/ocean/tests/global_ocean/mesh/rrs6to18/dynamic_adjustment.yaml +++ b/compass/ocean/tests/global_ocean/mesh/rrs6to18/dynamic_adjustment.yaml @@ -63,6 +63,6 @@ dynamic_adjustment: run_duration: 18_00:00:00 output_interval: 10_00:00:00 restart_interval: 06_00:00:00 - dt: 00:06:00 - btr_dt: 00:00:12 + dt: 00:05:00 + btr_dt: 00:00:10 Rayleigh_damping_coeff: None