Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added single cell ridging test case #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions configurations/aerosol_shortwave_physics/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions configurations/prescribed_ice/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions configurations/snicar_shortwave/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions configurations/snow_tracer_physics/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions configurations/standard_bgc/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions configurations/standard_physics/namelist.seaice
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions testcases/advection/namelist.seaice.advection
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions testcases/error_analysis/namelist.seaice.strain
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
52 changes: 52 additions & 0 deletions testcases/ridging_1D/create_input_itd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from netCDF4 import Dataset
import argparse
import numpy as np

#-------------------------------------------------------------------------------

def create_input_itd(filenameout="itd.nc"):

nCells = 1
nCategories = 5

categoryThicknessLimits = np.zeros(nCategories+1)
categoryThicknessLimits[0] = 0.0
categoryThicknessLimits[1] = 0.6
categoryThicknessLimits[2] = 1.4
categoryThicknessLimits[3] = 2.4
categoryThicknessLimits[4] = 3.6
categoryThicknessLimits[5] = 1e6

initialCategoryIceArea = np.zeros(nCategories)
initialCategoryIceArea[0] = 0.05
initialCategoryIceArea[1] = 0.1
initialCategoryIceArea[2] = 0.3
initialCategoryIceArea[3] = 0.35
initialCategoryIceArea[4] = 0.2

fileout = Dataset(filenameout,"w",format="NETCDF3_CLASSIC")

fileout.createDimension("nCells",nCells)
fileout.createDimension("nCategories",nCategories)
fileout.createDimension("nCategoriesP1",nCategories+1)
fileout.createDimension("ONE",1)

categoryThicknessLimitsVar = fileout.createVariable("categoryThicknessLimits","d",dimensions=["nCategoriesP1"])
categoryThicknessLimitsVar[:] = categoryThicknessLimits[:]

initialCategoryIceAreaVar = fileout.createVariable("initialCategoryIceArea","d",dimensions=["nCategories"])
initialCategoryIceAreaVar[:] = initialCategoryIceArea[:]

fileout.close()

#-------------------------------------------------------------------------------

if __name__ == "__main__":

parser = argparse.ArgumentParser(description='')

parser.add_argument('-o', dest='filenameOut', required=True, help='')

args = parser.parse_args()

create_input_itd(args.filenameOut)
1 change: 1 addition & 0 deletions testcases/ridging_1D/namelist.seaice.ridging_1D
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
3 changes: 3 additions & 0 deletions testcases/ridging_1D/run_testcase.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from create_grid import create_grid
from create_input_itd import create_input_itd
from run_model import run_model
from plot_testcase import plot_testcase
from plot_thicknesses import plot_thicknesses

create_grid()

create_input_itd()

run_model()

plot_testcase()
Expand Down
10 changes: 10 additions & 0 deletions testcases/ridging_1D/streams.seaice.ridging_1D
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
<var name="vAirVelocity"/>
</stream>

<stream name="itd"
type="input"
filename_template="itd.nc"
filename_interval="none"
input_interval="initial_only">

<var name="categoryThicknessLimits"/>
<var name="initialCategoryIceArea"/>
</stream>

<stream name="specialBoundaries"
type="input"
filename_template="special_boundaries.nc"
Expand Down
1 change: 1 addition & 0 deletions testcases/ridging_island/namelist.seaice.ridging_island
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
1 change: 1 addition & 0 deletions testcases/simple_shear/namelist.seaice.simple_shear
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
config_ridging_redistribution_function = 'exponential'
config_ridiging_efolding_scale = 3.0
config_ratio_ridging_work_to_PE = 17.0
config_use_ridge_forcing = false
/
&atmosphere
config_atmos_boundary_method = 'ccsm3'
Expand Down
82 changes: 82 additions & 0 deletions testcases/single_cell_ridging/create_forcing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
from netCDF4 import Dataset
import netCDF4
import numpy as np
from datetime import datetime, timedelta
import argparse

#-------------------------------------------------------------------------------

def create_forcing_file(filenameout, nTimes, timesStr, ridgeConvergence, ridgeShear):

fileout = Dataset(filenameout,"w",format="NETCDF3_CLASSIC")

fileout.createDimension("nCells",1)
fileout.createDimension("Time",None)
fileout.createDimension("StrLen",64)

varXtime = fileout.createVariable("xtime","c",dimensions=["Time","StrLen"])
for iTime in range(0,nTimes):
varXtime[iTime,0:19] = netCDF4.stringtochar(np.array(timesStr[iTime], 'S19'))
varXtime[iTime,19:] = " "*45

varRidgeConvergence = fileout.createVariable("ridgeConvergence","d",dimensions=["Time","nCells"])
varRidgeConvergence[:] = ridgeConvergence[:]

varRidgeShear = fileout.createVariable("ridgeShear","d",dimensions=["Time","nCells"])
varRidgeShear[:] = ridgeShear[:]

fileout.close()

#-------------------------------------------------------------------------------

def create_forcing(filenameout):

nTimes = 8760

ridgeConvergence = np.zeros(nTimes)
ridgeShear = np.zeros(nTimes)

timesStr = []
time0 = datetime.fromisoformat('0001-01-01T00:00:00')
timeDelta = timedelta(hours=1)
time = time0
for iTime in range(0,nTimes):
timeSinceStart = float((time - time0).total_seconds())

if (iTime > 1000 and
iTime < 2000):

ridgeConvergence[iTime] = 1e-8

if (iTime > 3000 and
iTime < 4000):

ridgeConvergence[iTime] = -1e-8

if (iTime > 5000 and
iTime < 6000):

ridgeShear[iTime] = 1e-8

if (iTime > 7000 and
iTime < 8000):

ridgeConvergence[iTime] = 1e-8
ridgeShear[iTime] = 1e-8

timesStr.append(time.strftime("%04Y-%m-%d_%H:%M:%S"))
time = time + timeDelta

create_forcing_file(filenameout, nTimes, timesStr, ridgeConvergence, ridgeShear)

#-------------------------------------------------------------------------------

if __name__ == "__main__":

parser = argparse.ArgumentParser(description='')

parser.add_argument('-o', dest='filenameOut', required=True, help='')

args = parser.parse_args()

create_forcing(args.filenameOut)
63 changes: 63 additions & 0 deletions testcases/single_cell_ridging/create_input_itd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from netCDF4 import Dataset
import argparse
import numpy as np

#-------------------------------------------------------------------------------

def create_input_itd(filenameout):

nCells = 1
nCategories = 5

categoryThicknessLimits = np.zeros(nCategories+1)
categoryThicknessLimits[0] = 0.0
categoryThicknessLimits[1] = 0.6
categoryThicknessLimits[2] = 1.4
categoryThicknessLimits[3] = 2.4
categoryThicknessLimits[4] = 3.6
categoryThicknessLimits[5] = 1e6

initialCategoryIceArea = np.zeros(nCategories)
#initialCategoryIceArea[0] = 0.05
#initialCategoryIceArea[1] = 0.1
#initialCategoryIceArea[2] = 0.3
#initialCategoryIceArea[3] = 0.35
#initialCategoryIceArea[4] = 0.2
initialCategoryIceArea[:] = 0.2

surfaceTemperature = np.zeros((nCells,nCategories,1))
surfaceTemperature[:,0,0] = -1.0
surfaceTemperature[:,1,0] = -2.0
surfaceTemperature[:,2,0] = -3.0
surfaceTemperature[:,3,0] = -4.0
surfaceTemperature[:,4,0] = -5.0

fileout = Dataset(filenameout,"w",format="NETCDF3_CLASSIC")

fileout.createDimension("nCells",nCells)
fileout.createDimension("nCategories",nCategories)
fileout.createDimension("nCategoriesP1",nCategories+1)
fileout.createDimension("ONE",1)

categoryThicknessLimitsVar = fileout.createVariable("categoryThicknessLimits","d",dimensions=["nCategoriesP1"])
categoryThicknessLimitsVar[:] = categoryThicknessLimits[:]

initialCategoryIceAreaVar = fileout.createVariable("initialCategoryIceArea","d",dimensions=["nCategories"])
initialCategoryIceAreaVar[:] = initialCategoryIceArea[:]

surfaceTemperatureVar = fileout.createVariable("surfaceTemperature","d",dimensions=["nCells","nCategories","ONE"])
surfaceTemperatureVar[:] = surfaceTemperature[:]

fileout.close()

#-------------------------------------------------------------------------------

if __name__ == "__main__":

parser = argparse.ArgumentParser(description='')

parser.add_argument('-o', dest='filenameOut', required=True, help='')

args = parser.parse_args()

create_input_itd(args.filenameOut)
Loading