Skip to content
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
194 changes: 194 additions & 0 deletions exp/test_cases/frierson/frierson_test_case_ssm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
import os

import numpy as np

from isca import IscaCodeBase, DiagTable, Experiment, Namelist, GFDL_BASE

NCORES = 8
base_dir = os.path.dirname(os.path.realpath(__file__))
# a CodeBase can be a directory on the computer,
# useful for iterative development
cb = IscaCodeBase.from_directory(GFDL_BASE)

# or it can point to a specific git repo and commit id.
# This method should ensure future, independent, reproducibility of results.
# cb = DryCodeBase.from_repo(repo='https://github.com/isca/isca', commit='isca1.1')

# compilation depends on computer specific settings. The $GFDL_ENV
# environment variable is used to determine which `$GFDL_BASE/src/extra/env` file
# is used to load the correct compilers. The env file is always loaded from
# $GFDL_BASE and not the checked out git repo.

# create an Experiment object to handle the configuration of model parameters
# and output diagnostics
exp = Experiment('frierson_test_experiment_ssm', codebase=cb)

#Tell model how to write diagnostics
diag = DiagTable()
diag.add_file('atmos_monthly', 30, 'days', time_units='days')

#Tell model which diagnostics to write
diag.add_field('dynamics', 'ps', time_avg=True)
diag.add_field('dynamics', 'bk')
diag.add_field('dynamics', 'pk')
diag.add_field('atmosphere', 'precipitation', time_avg=True)
diag.add_field('dynamics', 'sphum', time_avg=True)
diag.add_field('dynamics', 'ucomp', time_avg=True)
diag.add_field('dynamics', 'vcomp', time_avg=True)
diag.add_field('dynamics', 'temp', time_avg=True)
diag.add_field('dynamics', 'vor', time_avg=True)
diag.add_field('dynamics', 'div', time_avg=True)

diag.add_field('atmosphere', 'dt_tg_convection', time_avg=True)
diag.add_field('atmosphere', 'dt_tg_condensation', time_avg=True)
diag.add_field('atmosphere', 'dt_tg_diffusion', time_avg=True)
diag.add_field('mixed_layer', 't_surf', time_avg=True)
diag.add_field('mixed_layer', 'flux_lhe', time_avg=True)
diag.add_field('atmosphere', 'dt_ug_diffusion', time_avg=True)
diag.add_field('atmosphere', 'dt_vg_diffusion', time_avg=True)
diag.add_field('simple_spectral', 'swdn_sfc', time_avg=True)
diag.add_field('simple_spectral', 'swdn_toa', time_avg=True)
diag.add_field('simple_spectral', 'lwup_sfc', time_avg=True)
diag.add_field('simple_spectral', 'lwdn_sfc', time_avg=True)
diag.add_field('simple_spectral', 'olr', time_avg=True)
diag.add_field('simple_spectral', 'olr_spec', time_avg=True)
diag.add_field('simple_spectral', 'tdt_rad', time_avg=True)

exp.diag_table = diag

#Empty the run directory ready to run
exp.clear_rundir()

#Define values for the 'core' namelist
exp.namelist = namelist = Namelist({
'main_nml':{
'days' : 30,
'hours' : 0,
'minutes': 0,
'seconds': 0,
'dt_atmos':720,
'current_date' : [1,1,1,0,0,0],
'calendar' : 'thirty_day'
},

'idealized_moist_phys_nml': {
'do_damping': True,
'turb':True,
'mixed_layer_bc':True,
'do_virtual' :False,
'do_simple': True,
'roughness_mom':3.21e-05,
'roughness_heat':3.21e-05,
'roughness_moist':3.21e-05,
'two_stream_gray': False,
'do_simple_spectral_radiation': True, #Use Simple Spectral Radiation model
'convection_scheme': 'SIMPLE_BETTS_MILLER', #Use the simple Betts Miller convection scheme from Frierson
},

'vert_turb_driver_nml': {
'do_mellor_yamada': False, # default: True
'do_diffusivity': True, # default: False
'do_simple': True, # default: False
'constant_gust': 0.0, # default: 1.0
'use_tau': False
},

'diffusivity_nml': {
'do_entrain':False,
'do_simple': True,
},

'surface_flux_nml': {
'use_virtual_temp': False,
'do_simple': True,
'old_dtaudv': True
},

'atmosphere_nml': {
'idealized_moist_model': True
},

#Use a large mixed-layer depth, and the Albedo of the CTRL case in Jucker & Gerber, 2017
'mixed_layer_nml': {
'tconst' : 285.,
'prescribe_initial_dist':True,
'evaporation':True,
'depth': 2.5, #Depth of mixed layer used
'albedo_value': 0.31, #Albedo value used
},

'qe_moist_convection_nml': {
'rhbm':0.7,
'Tmin':160.,
'Tmax':350.
},

'betts_miller_nml': {
'rhbm': .7 ,
'do_simp': False,
'do_shallower': True,
},

'lscale_cond_nml': {
'do_simple':True,
'do_evap':True
},

'sat_vapor_pres_nml': {
'do_simple':True
},

'damping_driver_nml': {
'do_rayleigh': True,
'trayfric': -0.25, # neg. value: time in *days*
'sponge_pbottom': 5000., #Bottom of the model's sponge down to 50hPa (units are Pa)
'do_conserve_energy': True,
},

'simple_spectral_rad_nml': {
'do_seasonal': False, #do_seasonal=false uses the p2 insolation profile from Frierson 2006. do_seasonal=True uses the GFDL astronomy module to calculate seasonally-varying insolation.
'atm_abs': 0, # default: 0.0
'do_co2': True,
'carbon_conc': 300,
},

# FMS Framework configuration
'diag_manager_nml': {
'mix_snapshot_average_fields': False # time avg fields are labelled with time in middle of window
},

'fms_nml': {
'domains_stack_size': 600000 # default: 0
},

'fms_io_nml': {
'threading_write': 'single', # default: multi
'fileset_write': 'single', # default: multi
},

'spectral_dynamics_nml': {
'damping_order': 4,
'water_correction_limit': 200.e2,
'reference_sea_level_press':1.0e5,
'num_levels':25, #How many model pressure levels to use
'valid_range_t':[100.,800.],
'initial_sphum':[2.e-6],
'vert_coord_option':'input', #Use the vertical levels from Frierson 2006
'surf_res':0.5,
'scale_heights' : 11.0,
'exponent':7.0,
'robert_coeff':0.03
},
'vert_coordinate_nml': {
'bk': [0.000000, 0.0117665, 0.0196679, 0.0315244, 0.0485411, 0.0719344, 0.1027829, 0.1418581, 0.1894648, 0.2453219, 0.3085103, 0.3775033, 0.4502789, 0.5244989, 0.5977253, 0.6676441, 0.7322627, 0.7900587, 0.8400683, 0.8819111, 0.9157609, 0.9422770, 0.9625127, 0.9778177, 0.9897489, 1.0000000],
'pk': [0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000],
}
})

#Lets do a run!
if __name__=="__main__":
cb.compile() # compile the source code to working directory $GFDL_WORK/codebase

exp.run(1, use_restart=False, num_cores=NCORES)
for i in range(2,121):
exp.run(i, num_cores=NCORES)
Loading
Loading