From 8d0e103388afcda0ec36dbdec3960172abc96a53 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 17 Mar 2021 09:07:33 +0100 Subject: [PATCH 01/17] Add first draft of WC_SO_Atl10 --- .../files_for_e3sm/config_driver.xml | 5 + .../files_for_e3sm/config_files_for_e3sm.ini | 78 ++++++++++++ .../files_for_e3sm/config_files_for_e3sm.xml | 17 +++ .../WC_SO_Atl10/init/atlantic.geojson | 117 ++++++++++++++++++ .../WC_SO_Atl10/init/build_base_mesh.py | 82 ++++++++++++ .../WC_SO_Atl10/init/config_base_mesh.xml | 12 ++ .../WC_SO_Atl10/init/config_culled_mesh.xml | 13 ++ .../WC_SO_Atl10/init/config_driver_init.xml | 25 ++++ .../WC_SO_Atl10/init/config_initial_state.xml | 60 +++++++++ .../init/config_ssh_adjustment.xml | 50 ++++++++ .../WC_SO_Atl10/init/config_test.xml | 37 ++++++ .../WC_SO_Atl10/init/define_vertical_grid.py | 12 ++ .../init/so_high_res_region.geojson | 73 +++++++++++ .../WC_SO_Atl10/spin_up/config_driver.xml | 19 +++ .../spin_up/config_prep_spin_up1.xml | 45 +++++++ .../spin_up/config_prep_spin_up2.xml | 49 ++++++++ .../spin_up/config_prep_spin_up3.xml | 49 ++++++++ .../WC_SO_Atl10/spin_up/config_simulation.xml | 45 +++++++ .../WC_SO_Atl10/template_forward.xml | 14 +++ .../WC_SO_Atl10/template_initial_state.xml | 7 ++ 20 files changed, 809 insertions(+) create mode 100644 ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_driver.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.ini create mode 100644 ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/atlantic.geojson create mode 100755 ocean/global_ocean/WC_SO_Atl10/init/build_base_mesh.py create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_base_mesh.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_culled_mesh.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_driver_init.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_initial_state.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_ssh_adjustment.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/config_test.xml create mode 100755 ocean/global_ocean/WC_SO_Atl10/init/define_vertical_grid.py create mode 100644 ocean/global_ocean/WC_SO_Atl10/init/so_high_res_region.geojson create mode 100644 ocean/global_ocean/WC_SO_Atl10/spin_up/config_driver.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/spin_up/config_prep_spin_up1.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/spin_up/config_prep_spin_up2.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/spin_up/config_prep_spin_up3.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/spin_up/config_simulation.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/template_forward.xml create mode 100644 ocean/global_ocean/WC_SO_Atl10/template_initial_state.xml diff --git a/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_driver.xml b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_driver.xml new file mode 100644 index 0000000000..b7331f7fd0 --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_driver.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.ini b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.ini new file mode 100644 index 0000000000..12fca4263d --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.ini @@ -0,0 +1,78 @@ +# This is the custom config file specific to this test case. Any values here +# will override the defaults in defaults.ini Users wishing to alter the +# configuration should modify this file, rather than defaults.ini + +[main] +nprocs = 1 +# the file name of the initial condition, possibly after spin-up +initial_condition = ../../spin_up/simulation/restarts/restart.0001-01-21_00.00.00.nc + +[mesh] +short_name = ${prefix}${min_res}to${max_res}E${e3sm_version}r${mesh_version} +long_name = ${prefix}${min_res}to${max_res}kmL${levels}E3SMv${e3sm_version}r${mesh_version} +prefix = WC_SO_Atl +description = MPAS Southern Ocean regionally refined mesh for E3SM version + ${e3sm_version} with enhanced resolution (${min_res} km) around + Antarctica, 45-km resolution in the mid southern latitudes, + 30-km resolution in a 15-degree band around the equator, 60-km + resolution in northern mid latitudes, 30 km in the north + Atlantic and 35 km in the Arctic. This mesh has ${levels} + vertical levels and includes cavities under the ice shelves + around Antarctica. The mesh is described in the following pull + request: https://github.com/MPAS-Dev/compass/pull/37 +e3sm_version = 2 +mesh_version = x +creation_date = autodetect +min_res = 12 +max_res = 60 +max_depth = autodetect +levels = autodetect + +# The following options are detected from .gitconfig if not explicitly entered +author = autodetect +email = autodetect + +[initial_condition_ocean] +enable = true + +[graph_partition_ocean] +enable = true + +[initial_condition_seaice] +enable = true + +[scrip] +enable = true + +[transects_and_regions] +enable = true + +[mapping_analysis] +enable = true + +[mapping_CORE_Gcase] +enable = false + +[mapping_JRA_Gcase] +enable = false + +[mapping_ne30] +enable = false + +[domain_CORE_Gcase] +enable = false + +[domain_JRA_Gcase] +enable = false + +[domain_ne30] +enable = false + +[mapping_runoff] +enable = false + +[salinity_restoring] +enable = false + +[prescribed_ismf] +enable = false diff --git a/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.xml b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.xml new file mode 100644 index 0000000000..26618a85c1 --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/files_for_e3sm/config_files_for_e3sm.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + config_files_for_e3sm.ini + + + + diff --git a/ocean/global_ocean/WC_SO_Atl10/init/atlantic.geojson b/ocean/global_ocean/WC_SO_Atl10/init/atlantic.geojson new file mode 100644 index 0000000000..885b379414 --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/init/atlantic.geojson @@ -0,0 +1,117 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "name": "Atlantic region", + "component": "ocean", + "object": "region", + "author": "Xylar Asay-Davis" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -97.3828125, + 85.05112877979998 + ], + [ + -102.3046875, + 40.17887331434696 + ], + [ + -102.3046875, + 23.241346102386135 + ], + [ + -93.1640625, + 15.623036831528264 + ], + [ + -85.78125, + 13.581920900545844 + ], + [ + -83.583984375, + 9.535748998133627 + ], + [ + -81.2109375, + 8.059229627200192 + ], + [ + -79.013671875, + 9.795677582829743 + ], + [ + -75.9375, + 5.61598581915534 + ], + [ + -77.6953125, + 0 + ], + [ + -56.6015625, + -15.623036831528252 + ], + [ + -72.421875, + -49.38237278700955 + ], + [ + -67.5, + -73.92246884621463 + ], + [ + 27.421875, + -72.81607371878991 + ], + [ + 24.960937499999996, + -25.48295117535531 + ], + [ + 16.171875, + 0 + ], + [ + 27.773437499999996, + 26.745610382199022 + ], + [ + 37.96875, + 32.24997445586331 + ], + [ + 39.7265625, + 39.36827914916014 + ], + [ + 32.6953125, + 53.9560855309879 + ], + [ + 37.6171875, + 61.438767493682825 + ], + [ + 25.664062500000004, + 68.26938680456564 + ], + [ + 24.609375, + 85.05112877979998 + ], + [ + -97.3828125, + 85.05112877979998 + ] + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/ocean/global_ocean/WC_SO_Atl10/init/build_base_mesh.py b/ocean/global_ocean/WC_SO_Atl10/init/build_base_mesh.py new file mode 100755 index 0000000000..ba229c5045 --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/init/build_base_mesh.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python +import numpy as np +import mpas_tools.mesh.creation.mesh_definition_tools as mdt +from mpas_tools.mesh.creation.signed_distance import \ + signed_distance_from_geojson +from geometric_features import read_feature_collection +from mpas_tools.ocean import build_spherical_mesh +from mpas_tools.cime.constants import constants + + +def cellWidthVsLatLon(): + """ + Create cell width array for this mesh on a regular latitude-longitude grid. + Returns + ------- + cellWidth : ndarray + m x n array, entries are desired cell width in km + + lat : ndarray + latitude, vector of length m, with entries between -90 and 90, + degrees + + lon : ndarray + longitude, vector of length n, with entries between -180 and 180, + degrees + """ + dlon = 0.1 + dlat = dlon + earth_radius = constants['SHR_CONST_REARTH'] + nlon = int(360./dlon) + 1 + nlat = int(180./dlat) + 1 + lon = np.linspace(-180., 180., nlon) + lat = np.linspace(-90., 90., nlat) + + cellWidthVsLat = mdt.EC_CellWidthVsLat( + lat, cellWidthEq=30., cellWidthMidLat=60., cellWidthPole=35.) + + _, cellWidth = np.meshgrid(lon, cellWidthVsLat) + + cellWidthAtlantic = mdt.RRS_CellWidthVsLat( + lat, cellWidthEq=30., cellWidthPole=10.) + + _, cellWidthAtlantic = np.meshgrid(lon, cellWidthAtlantic) + + fc = read_feature_collection('atlantic.geojson') + + atlantic_signed_distance = signed_distance_from_geojson( + fc, lon, lat, earth_radius, max_length=0.25) + + trans_width = 400e3 + trans_start = 0. + weights = 0.5 * (1 + np.tanh((atlantic_signed_distance - trans_start) / + trans_width)) + + cellWidth = cellWidthAtlantic * (1 - weights) + cellWidth * weights + + fc = read_feature_collection('so_high_res_region.geojson') + + so_signed_distance = signed_distance_from_geojson(fc, lon, lat, + earth_radius, + max_length=0.25) + + # Equivalent to 20 degrees latitude + trans_width = 1600e3 + trans_start = 500e3 + dx_min = 12. + + weights = 0.5 * (1 + np.tanh((so_signed_distance - trans_start) / + trans_width)) + + cellWidth = dx_min * (1 - weights) + cellWidth * weights + + return cellWidth, lon, lat + + +def main(): + cellWidth, lon, lat = cellWidthVsLatLon() + build_spherical_mesh(cellWidth, lon, lat, out_filename='base_mesh.nc') + + +if __name__ == '__main__': + main() diff --git a/ocean/global_ocean/WC_SO_Atl10/init/config_base_mesh.xml b/ocean/global_ocean/WC_SO_Atl10/init/config_base_mesh.xml new file mode 100644 index 0000000000..7fbc6e41df --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/init/config_base_mesh.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/ocean/global_ocean/WC_SO_Atl10/init/config_culled_mesh.xml b/ocean/global_ocean/WC_SO_Atl10/init/config_culled_mesh.xml new file mode 100644 index 0000000000..c7fbbf6f16 --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/init/config_culled_mesh.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ocean/global_ocean/WC_SO_Atl10/init/config_driver_init.xml b/ocean/global_ocean/WC_SO_Atl10/init/config_driver_init.xml new file mode 100644 index 0000000000..cbdd51b72d --- /dev/null +++ b/ocean/global_ocean/WC_SO_Atl10/init/config_driver_init.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + +