Last active
October 16, 2018 16:34
-
-
Save jamesp/26b550fbcd79f31c6c1f17836f73155e to your computer and use it in GitHub Desktop.
An example script to run the Held Suarez test case in the Isca framework.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from isca import IscaCodeBase, Experiment, DiagTable, Namelist, FailedRunError, GFDL_BASE | |
from isca.util import run_cli | |
expname = 'held_suarez_basic' | |
cb = IscaCodeBase.from_directory(GFDL_BASE) | |
NDAYS = 30 | |
RESOLUTION = 'T42', 25 | |
held_suarez_configuration = { | |
# TEMPERATURE PROFILE | |
't_zero': 315, # maximum surface temperature forcing | |
't_strat': 200, # statospheric temperature constant | |
'delh': 60, # equator-pole temperature gradient | |
'delv': 10., # vertical potential temperature gradient | |
# RELAXATION TIMESCALES | |
'ka': -20, # Newtonian cooling timescale in atmosphere | |
'ks': -5, # Newtonian cooling timescale at surface | |
'kf': -1, # Rayleigh friction (pos. = seconds, neg. = days) | |
} | |
namelist = Namelist({ | |
# model settings | |
'main_nml': { | |
'dt_atmos': 900, | |
'days': NDAYS, | |
'calendar': 'no_calendar', | |
}, | |
'spectral_dynamics_nml': { | |
'damping_order': 2, # hyperviscosity 2=del4, 4=del8. | |
'reference_sea_level_press': 1.0e5, # default: 101325 | |
'valid_range_t': [150., 400.], | |
# choose coordinate system to set level 7 at ~ 100hPa | |
'vert_coord_option': 'uneven_sigma', # default: 'even_sigma' | |
'scale_heights': 6.0, | |
'exponent': 7.5, | |
'surf_res': 0.5, | |
}, | |
'atmosphere_nml': { | |
'idealized_moist_model': False # run in HS-mode | |
}, | |
'hs_forcing_nml': held_suarez_configuration, | |
# framework and IO config | |
'diag_manager_nml': { | |
# diagmanager gives a warning if you don't set this | |
'mix_snapshot_average_fields': False | |
}, | |
'fms_nml': { | |
'domains_stack_size': 600000 # default: 0 | |
}, | |
'fms_io_nml': { | |
'threading_write': 'single', # default: multi | |
'fileset_write': 'single', # default: multi | |
}, | |
}) | |
diag_table = DiagTable() | |
#diag_table.add_file('6hourly', 6*60*60, 'seconds', time_units='days') | |
#diag_table.add_file('hourly', 1, 'hours', time_units='days') | |
diag_table.add_file('daily', 1, 'days', time_units='days') | |
diag_table.add_field('dynamics', 'ps') | |
diag_table.add_field('dynamics', 'bk') | |
diag_table.add_field('dynamics', 'pk') | |
diag_table.add_field('dynamics', 'ucomp') | |
diag_table.add_field('dynamics', 'vcomp') | |
diag_table.add_field('dynamics', 'omega') | |
diag_table.add_field('dynamics', 'temp') | |
diag_table.add_field('dynamics', 'vor') | |
diag_table.add_field('dynamics', 'div') | |
diag_table.add_field('dynamics', 'height') | |
diag_table.add_field('dynamics', 'height_half') | |
diag_table.add_field('hs_forcing', 'teq') | |
diag_table.add_field('hs_forcing', 'tdt') | |
exp = Experiment(expname, codebase=cb) | |
exp.diag_table = diag_table | |
exp.namelist = namelist | |
exp.set_resolution(*RESOLUTION) | |
run_cli(exp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment