Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Arctic high-res region",
"component": "ocean",
"object": "region",
"author": "Luke Van Roekel"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-66.4453125,
50.82879925192134
],
[
-2.109375,
53.10743118848039
],
[
102.3046875,
77.54209596075547
],
[
88.9453125,
81.74845396137906
],
[
21.796875,
84.08887757413991
],
[
-40.78125,
84.67351256610522
],
[
-61.87499999999999,
84.30218294503882
],
[
-73.47656249999999,
82.58610635020881
],
[
-78.046875,
81.77364370720657
],
[
-87.1875,
79.87429692631282
],
[
-86.1328125,
73.82482034613932
],
[
-82.265625,
68.65655498475735
],
[
-74.1796875,
58.81374171570782
],
[
-66.4453125,
50.82879925192134
]
]
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -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.ocean import build_spherical_mesh
from mpas_tools.mesh.creation.signed_distance import \
signed_distance_from_geojson
from mpas_tools.cime.constants import constants
from geometric_features import read_feature_collection

import xarray


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
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)

_, cellWidth = np.meshgrid(lon, cellWidthVsLat)

fc = read_feature_collection('north_mid_res_region.geojson')

earth_radius = constants['SHR_CONST_REARTH']

mr_signed_distance = signed_distance_from_geojson(fc, lon, lat,
earth_radius,
max_length=0.25)

fc = read_feature_collection('arctic_high_res_region.geojson')

hr_signed_distance = signed_distance_from_geojson(fc, lon, lat,
earth_radius,
max_length=0.25)

frac = (-mr_signed_distance / (-mr_signed_distance + hr_signed_distance))

frac = np.maximum(0., np.minimum(1., frac))

dx_min = 15.
dx_max = 30.

arctic_widths = dx_max + (dx_min - dx_max) * frac

trans_width = 1000e3
trans_start = 0.

weights = 0.5 * (1 + np.tanh((mr_signed_distance - trans_start) /
trans_width))

cellWidth = arctic_widths * (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()

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<driver_script name="run.py">
<case name="base_mesh">
<step executable="./run.py" quiet="true" pre_message=" * Creating 2D global base mesh with jigsaw..." post_message=" complete! Created file: base_mesh/base_mesh.nc"/>
</case>
<case name="culled_mesh">
<step executable="./run.py" quiet="true" pre_message=" * Culling land cells from 2D global mesh..." post_message=" complete! Created file: culled_mesh/culled_mesh.nc"/>
</case>
</driver_script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"stroke": "#555555",
"stroke-width": 2,
"stroke-opacity": 1,
"fill": "#555555",
"fill-opacity": 0.5,
"name": "northern mid res region",
"component": "ocean",
"object": "region",
"author": "Xylar Asay-Davis"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-158.90625,
65
],
[
-115.6640625,
56.559482483762245
],
[
-75.234375,
36.59788913307022
],
[
-3.8671874999999996,
38.272688535980976
],
[
101.953125,
72.18180355624855
],
[
180,
65
],
[
180,
90
],
[
0,
90
],
[
-180,
90
],
[
-180,
65
],
[
-158.90625,
65
]
]
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# 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_EN4_1900/simulation/restarts/restart.0001-01-01_01.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 = EC
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. Bathymetry is from
GEBCO 2019, combined with BedMachineAntarctica around Antarctica.
The initial condition is from EN4 1900. The mesh is documented at
https://github.com/MPAS-Dev/MPAS-Model/pull/740
e3sm_version = 2
mesh_version = 04
creation_date = autodetect
min_res = 15
max_res = 60
max_depth = autodetect
levels = autodetect
runoff_description = <<<Spreading function described here>>>

# 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<driver_script name="run.py">
<case name="files_for_e3sm">
<step executable="./run.py" quiet="true" pre_message=" * Creating ocean and sea-ice initial conditions and supporting files for E3SM" post_message=" - Complete"/>
</case>
</driver_script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<config case="files_for_e3sm">

<add_link source="../../spin_up_EN4_1900/initial_state/initial_state.nc" dest="mesh_before_metadata.nc"/>
<add_link source="../../spin_up_EN4_1900/initial_state/graph.info" dest="graph.info"/>
<add_link source_path="script_configuration_dir" source="scripts/create_E3SM_coupling_files.py" dest="create_files_for_e3sm.py"/>
<add_link source_path="script_configuration_dir" source="scripts/config_E3SM_coupling_files.ini" dest="defaults.ini"/>
<copy_file source_path="script_test_dir" source="config_E3SM_coupling_files.ini" dest="config_E3SM_coupling_files.ini"/>
<add_link source_path="script_configuration_dir" source="scripts/readme_E3SM_coupling_files" dest="readme"/>

<run_script name="run.py">
<step executable="./create_files_for_e3sm.py">
</step>
</run_script>
</config>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<driver_script name="run.py">
<case name="initial_state">
<step executable="./run.py" quiet="true" pre_message=" * Initializing ocean state with bathymetry and tracers..." post_message=" complete! Created file: initial_state/initial_state.nc"/>
</case>
<case name="simulation">
<step executable="./run.py" quiet="true" pre_message=" * Running simulation" post_message=" - Complete"/>
</case>
<validation>
<compare_fields file1="simulation/output.nc">
<template file="prognostic_comparison.xml" path_base="script_core_dir" path="templates/validations"/>
</compare_fields>
</validation>
</driver_script>
Loading